/
Select Recipes by Name
  • Ready for review
  • Select Recipes by Name

    Prolog and Patterns

    Now that we have introduced a new intent for asking for a specific recipe by its name, we can add a new variant of the a50recipeSelect pattern that we introduced earlier for Request a Recommendation. To illustrate it, we repeat the example of the type of pattern that we have in mind:

    A: What recipe would you like to cook?

    U: I'd like to make an artichoke and pine nut pasta.

    A: Artichoke and pine nut pasta is a great choice!

    To specify this pattern, it is useful to identify the type of each dialog move that is part of it. The second dialog move of the user is the recipeRequest intent that we just defined above in the Dialogflow section. The first agent move is the same as the first dialog move in our previous a50recipeSelect pattern variant, a specifyGoal intent (cf. Request a Recommendation). The third dialog move of the agent is a new type of intent, and we suggest to call this intent recipeChoiceReceipt. Finally, as before, the agent should insert the pattern a50recipeConfirm into the agenda of the agent to move the conversation onto the next phase where the user can (dis)confirm that they like the recipe that has been selected. Recall that you can insert something into the agent's agenda utilizing the special insert(PatternID) action that can be added as a special kind of actor-intent pair in a pattern. Now you should add the variant of the pattern to the patterns.pl file (as indicated in a comment in that file too).

    The new agent intent label recipeChoiceReceipt that we introduced also needs to be added to the responses.pl file. To specify a phrase or response the agent can use when performing the intent, you should take into account that the name of the recipe should be part of the response (see the example again: Artichoke and pine nut pasta is a great choice!). As before, defining the response, therefore, requires a rule to define the text(recipeChoiceReceipt, Txt) clause. The idea is that the agent first finds the current recipe stored in its conversational memory, retrieves the recipe's name, and finally constructs a response using the template string_concat(PhrasePart1, PhrasePart2, Txt) where you need to replace the PhrasePart1 and PhrasePart2 arguments.

    Visuals

    You can update the visuals based on what you think will help the user the most. Think about how you can support the implemented capability visually.

    Test it Out

    When you finished implementing this capability and you Run your Conversational Agent, you should be able to conduct the following conversational interaction and go through the following dialog moves:

    1. After the Start page, when you click the Start button,

    2. You should see the welcoming page.

    3. The agent starts by greeting you by self-identifying it (moves greeting, selfIdentification).

    4. You should be able to greet the agent (greeting).

    5. You should see the recipe recommendation page.

    6. The agent asks you what kind of recipe you would like (specifyGoal).

    7. You should be able to say that you want a specific recipe (recipeRequest); Ask your agent for a specific recipe you find in the recipe database by name. An example would be “crispy pork spring rolls”.

    8. The agent then should acknowledge this choice (recipeChoiceReceipt).

    9. You should see the recipe confirmation page with the recipe you specified in step 6.

    You can also check whether the intent recognition works. In your Dialogflow agent in the Training Tool, you should be able to see a conversation listed with a greeting and recipeRequest intent. You also should be able to see the SIC server received those intents with transcripts from Dialogflow in the terminal where you started the server.

    As we noted already in the Test it Out section for Greet, and Self-Identify, Dialogflow may not be able to recognize what you are saying correctly (ASR failure), and, as a result, the agent may receive a default fallback intent and get stuck because the agent cannot handle these yet (which we will fix when implementing the next Handle Unexpected Intents).

    For now (and this will be useful throughout the project), you can also avoid ASR failures by adding and using a chatbox to a page in which you can type a response (instead of using the microphone). We have already provided you with the option to add a chatbox to the footer of pages, but the code is still commented out (check the code for the footer/1 predicate in the html.pl file.

     

    Related content

    Pattern and Responses: Instructions
    Pattern and Responses: Instructions
    More like this
    OLD Capability 9: Confirm or Disconfirm Recipe and Closing
    OLD Capability 9: Confirm or Disconfirm Recipe and Closing
    More like this