Table of Contents | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
Dialogflow
deleteFilterValue
‘deleteFilterValue’ is useful to deal with a scenario where the user requests to remove a filter that they have added beforehand. For example, “I wish to remove the onion filter”, “Forget about excluding broccoli”, and “Can you delete the Chinese cuisine”. Add some training phrases for all the different filters that user could want to delete.
It is important that you include all filter-related entities in your training phrases, and that these entities are also given specific values and parameter names in the Action and Parameters tables. These entities are given new parameters and value names in order to identify them as a filter to be deleted. Specifically, you tag the entity in your training phrases as normal (e.g. “ingredient”) and then you change the parameter name and value name to “entitynameDel”. Your entity table under Action and Parameters should look like this when you are done.
...
The ‘noMoreFilters’ noMoreFilters intent is used when the user does not want to add any other filters to their recipes list and wishes to see the available recipes.
Prolog and Patterns
...
User does not want to specify more recipe constraints
Example:
A: “What other filters would you like to add?”
...
a21noMoreFilters pattern handles a user request to not add more feature requests, preferences, or requirements. When filtering the recipes, the user is not shown the list of filtered recipes until there are only 15 (or fewer) recipes. It could be, though, that the user does not wish to filter recipes further. The user would then use the NoMoreFilters intent. The agent can then allow the user to see the list with the ‘grantPicture’ pictureGranted
response, or deny with ‘pictureNotGranted’ pictureNotGranted
. If the agent grants the user’s user's request, the pattern should end with the agent updating its memory using ‘'[agent, update(['show'='true'])]’'. This triggers the showing of recipes by updating the agent’s memory.Implement the ‘a21noMoreFilters’ pattern in patterns.pl.agent's memory.
In responses.pl
we have to make two rules, for ‘grantPicture’ and ‘pictureNotGranted’'grantPicture' and 'pictureNotGranted'. An agent can allow the list of recipe pictures to be shown if the list is less than 100 recipes long. An agent cannot grant the recipes if the list is over 99 recipes long. The ‘recipesFiltered’ recipesFiltered/1
predicate provides a list of the filtered recipes. Fill in the two rules with the corresponding conditions.
Implement the a21noMoreFilters
pattern in the patterns.pl
file.
Add this predicate to the responses.pl
file in the indicated spot.
Code Block |
---|
% used in a21removeKeyFromMemory for handling deleteParameter. text(removedSpecificFilter(DelFilter), Txt) :- convert_to_string(DelFilter, Str1), string_concat("I removed the ", Str1, Str2), string_concat(Str2, " requirement.", Txt). |
featureInquiry intent
Multiple text predicates take the argument feature inquiry in responses.pl
. Each feature inquiry response is different based on how many recipes there are left to filter.
...
Start with the
text/2
predicate forfeatureInquiry
.The response text will be "Here are some recipes that fit your requirements.".
Use the
recipesFiltered/1
predicate to get the filtered list.Create a condition that checks if the length
L
is less than 16 but more than 0, or if the memory key-value pair'show', 'true'
exists. This condition is composed of two parts joined by a semicolon;
, representing a logical OR.
Removed Filter
Add this predicate to the responses.pl file in the indicated spot.
...
.
Visuals
What you do visually for this capability is up to you.
Test it Out
Now Run your Conversational Agent again and try to remove some of the recipe constraints after you added them.
Info |
---|
All done? |