Table of Contents | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
Dialogflow
Removing feature requests again
...
Recall that we used the agent intent ackFilter to implement the first move in this fragment as part of the a21featureRequest
pattern. If a user complies with the agent’s request, that would trigger another a21featureRequest
pattern. If a user does not comply but rather responds negatively, we can also view that as a disconfirmation move. We argue that we can reuse that intent to capture negative responses to the agent’s request. A user, for that matter, could also simply respond to the agent’s move by saying “No, I won’t” or something similar. We implemented this intent before, but we should extend it to now also cover the variety of user expressions a user could use to say they do not want to add anything else. So, you should add training phrases to make sure these expressions are covered too.
Prolog and Patterns
We will begin with implementing a pattern for allowing a user to express they are done, and then get back to what is still missing to implement requests to remove a filter.
...
We can base the name for the agent intent on our design choice to show more recipe pictures and call the one that grants the user’s request pictureGranted
, and the one that denies the request pictureNotGranted
. Using these labels, you can implement two versions of the a21noMoreFilters
pattern in the patterns.pl
file. And don’t forget to add responses for the agent intents pictureGranted
and pictureNotGranted
to the responses.pl
file. This will require you to define two rules each with a different condition on the number of recipes left. Recall that you can use the recipesFiltered/1
predicate to compute a list of the filtered recipes and use that to compute how many recipes are still left after filtering.
There is still one thing missing… Just by talking the agent will not change the page that is displayed. Recall that you have created two pages for the a50recipeSelect
pattern for Capability 5: Filter Recipes by Ingredients and Cuisine. When the agent grants the user’s request we still need to make sure that the second recipe recommendation page showing the recipe pictures is displayed. To make that happen, we need to change the condition for showing that page. We need the store the fact that the user requested this. The idea is to use the conversational memory of the agent for that and update it with this information. Therefore, when the agent grants the user's request, the version of that pattern should end with the agent updating its memory using an [agent, update(['show'='true'])]
actor-intent pair. To change the condition of for showing the page showing in the html.pl
file, we can then use the memoryKeyValue/2
predicate defined in the dialog.pl
file to add a an alternative condition for showing this page.
...
This completes the implementation of all the different cases for the agent’s response. The patterns for removing filters should now work!
Visuals
What you do visually for this capability is up to you.
...