Table of Contents | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
Dialogflow
The previous capability made the agent select a random recipe name from the recipe database and recommend this to a user. We now want to allow the user to request a specific recipe by mentioning the name of a recipe. In this case, the conversational agent should be able to understand that a user is mentioning a specific recipe’s name. In other words, our Dialogflow agent needs to be able to recognize all the names of all the recipes in the recipe database.
...
The way to do that is by creating an entity for recipes in the Dialogflow agent. For your convenience, we have already provided you with a JSON file that you can use to upload a recipe entity that contains all recipe names (as there are a lot of these names).
...
Use this
file to create theView file name recipe.csv recipe
entity by uploading it to your Dialogflow agent.
...
Warning |
---|
Test that your intent is correctly recognizing user requests by using the microphone button in the Dialogflow test console (you can also enter phrases in the test console by typing). Try various phrases and check whether what you say is classified as your recipe request intent. Note that just copy-pasting the training phrases you entered for the intent into the test console is not that useful (you will find that Dialogflow will correctly classify these with a confidence score of 1 by inspecting the Diagnostic Info). But you can use these phrases to check that ASR is working by using the microphone button in the test console and talking to the agent. |
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 Capability 2: Request a Recommendation. To illustrate it, we repeat the example of the type of pattern that we have in mind:
...
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
Nothing we ask you to do here for this capability. It’s up to youYou 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:
...