Dialogflow
Confirmation, Disconfirmation, Farewell Intents
...
confirmation
If a user wants to agree or say ‘yes’.
no
If a user wants to disagree or say ‘no’.
farewell
If a user wants to say 'goodbye'.
Visuals
Add a closing page at the end of the program to bid farewell and thank the user.
Code Block |
---|
%%% Thank you page at the end. page(c43, _, Html) :- |
Prolog and Patterns
...
a50recipeConfirm: Confirming a Recipe in patterns.pl
Code Block |
---|
% Pattern a50recipeCheck: present recipe ingredients and instructions for final check before committing to recipe choice.
pattern([a50recipeConfirm, [agent, recipeCheck], [user, confirmation]]).
pattern([a50recipeConfirm, [agent, recipeCheck], [user, appreciation]]).
% % If user does not like recipe, we go back to the recipe selection stage (a50recipeSelect).
pattern([a50recipeConfirm, [agent, recipeCheck], [user, no],
[agent, insert(a50recipeSelect)]]). |
c43 the farewell patternAfter the user selects a recipe, the agent should confirm the user’s choice. We foresee two potential situations for this conversation, which can be accommodated by making two a50recipeConfirm patterns. After the agent uses ‘recipeCheck’ to ask if the user can look over the recipe information to decide if they want to cook that recipe, the user could confirm (1), or deny (2).
In patterns.pl, make the a50recipeConfirm patterns for the two scenarios mentioned above. Look at Dialogflow for the appropriate Intent identification naming. If the user says it does not want to choose that recipe, we need to go back to a50recipeSelect
. How would one do this?
In responses.pl fill in ‘text(recipeCheck, “”)’ response.
c43: Farewell in patterns.pl
Make a pattern that encapsulates the following conversation called c43.
% Pattern C4.3: Closing Farewell (Agent)
% Example:
% A: goodbye
% U: bye
% Instruction:
% 1. Introduce an intent 'farewell‘farewell' for saying goodbye by adding this intent to your Dialogflow
% agent (for user recognition) and the textresponse.pl file (for agent text generation).
% 2. Add a pattern here where the agent initiates (i.e. starts) saying goodbye and then the user is
% allowed to say goodbye.
% 3. Add a rule in the dialog generation module in the right place to update the session by adding
% the c43 pattern you introduced in step 2.
pattern([c43, [agent, farewell], [user, farewell]]).
responses.pl add
% Intent: recipeCheck
text(recipeCheck, "Can you check the recipe and let me know if you want to cook this?").
% Intent: farewell
text(farewell, "bye").
Extend
last topic check, restart
%%% C4 Patterns: Closing
% Pattern C4.0: Last Topic Check (Agent)
% Example 1:
% A: is there anything else I can help you with?
% U: bye
% A: goodbye
% Example 2:
% A: is there anything else I can help you with?
% U: yes
% A: okay!
% Example 3:
% A: is there anything else I can help you with?
% U: i don't think so
% A: have a good day!
% U: goodbye
% A: bye
% Instruction:
% 1. Introduce intents for 'lastTopicCheck', 'acknowledgement', and a 'wellWish' for the agent (i.e.
% add these to the text.pl file) and the intents 'confirmation' and 'disconfirmation' for the
% user (i.e. add these to your Dialogflow agent). Re-use the 'farewell' intent.
% 2. Add three variants of the last topic check pattern, each with the same c40 pattern id, that
% match the three examples above. For the second variant, use the special agent management
% instruction 'restart' as an intent the agent should perform at the end of the pattern
% variant. You do not need to do anything else than use this intent as it has already been
% implemented for you (see the dialog generation module).
% 3. Add a rule in the dialog generation module in the right place to update the session by adding
% the c40 pattern you introduced in step 2.
% pattern variant 1 (farewell):
pattern([c40, [agent, sessionCloser], [agent, farewell]]).
% pattern variant 2 (confirmation):
% use of special instruction 'restart' to reset agenda to initial agenda at start of session.
%pattern([c40, [agent, lastTopicCheck], [user, confirmation], [agent, acknowledgement],
% [agent, restart]]).
% pattern variant 3 (disconfirmation):
%pattern([c40, [agent, lastTopicCheck], [user, disconfirmation], [agent, wellWish],
% [user, farewell], [agent, farewell]]).
Test it Out
add c43 to agent agenda in dialog_init file
run agent all the way thru from greeting to closingto the agent’s agenda.
Extend
Introduce a last topic check to your farewell pattern to see if the user wants anything else or wishes to find another recipe. If they do restart the entire conversation. Note: this can be done using [agent, restart] which resets the agent agenda to the initial agenda at the start of session.
Test it Out
Add c43 to the agent agenda in the dialog_init file.
Run the agent all the way through from greeting to closing.