Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents
minLevel1
maxLevel6
outlinefalse
typelist
printablefalse

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.

...

  1. Go to the Dialogflow Console and create a new intent. Call this intent recipeRequest to suggest that utterances asking for a specific recipe are example phrases that should be classified as this intent. The agent assumes that the intent is called recipeRequest and uses this label also already in the dialog_update.mod2g file so do not use another label.

  2. Add Training Phrases: Add a (large) variety of phrases that users might use when requesting a specific recipe. Example phrases could include, for example, "I'll have the grilled asparagus please", "Can I try the butter chicken", or "I'd like to make goat's cheese toast". When you enter these example phrases as Training phrase, you will see that Dialogflow automatically recognizes the recipe entity and the associated recipe title value in these phrases and marks these phrases.
    We recommend that you add quite a few training phrases that vary in shape and form (you should add at least >10, but much more would be much better). That will provide a user with some flexibility of how they can express themselves. By adding only a few very specific phrases, it will be hard for Dialogflow to recognize variants of phrases that a user could use to ask for a specific recipe. It may, however, also be hard for you to come up with all these variants. But as before, you do not need to craft them by hand but should feel free to use any other tool you can think of for creating varied training phrases (e.g., Google, ChatGPT, etc.).

  3. As before, don’t forget to make sure the box above the table in the Action and parameters section is filled in with the name of your intent! There is more work to be done here this time, as a recipeRequest intent should be recognized only when a recipe title (a recipe entity) can be extracted from the user’s utterance too. In other words, we should make sure the recipe entity is required for this intent. The intent cannot be complete without it. You should already see the recipe entity listed in the section. You should also make sure that the parameter linked to the recipe entity is named recipe too. Finally, you should check the Required checkbox so that your Dialogflow agent knows that when it recognizes the recipeRequest intent, it also needs to be able to extract a recipe name from the transcription of what the user said.

...

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 already earlier for the 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 you.

...