Versions Compared

Key

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

We have taken you by the hand thus far and walked you through the code you were asked to produce step-by-step. We will still be providing useful information for you to learn more about developing conversational agents, but now we will change gears a bit and leave more for you to figure out yourself, too. Remember that you can find useful information and links on the Project Background Knowledge page.

Dialogflow

Conversational patterns set expectations about what actors participating in a conversation will do, but users often will not quite meet these expectations and make moves that do not fit into the active pattern. The conversational agent will need to be able to handle such “unexpected” moves from users. “Unexpected” here means that these moves do not fit into the currently active conversational pattern, not that such moves should not be expected from users. Two intents that we should actually expect to match with what a user could say are an appreciation intent and an intent for checking what the agent is capable of. You should add the following intents to your Dialogflow agent, making sure that you use the intent labels specified below:

...

Throughout the project, you should keep checking the validation page for issues and update the fallback intent by adding negative examples when they come to mind (e.g., when you add more training phrases for other intents).

Prolog and Patterns

Repair

When a conversational agent does not understand a user, it needs to have the conversational competence to deal with the situation. Here, we will make two important distinctions related to the type of misunderstanding. The first case is that the agent is not able to match what a user says with an intent and the Dialogflow agent matches with a fallback intent. The second case is quite different. Here the Dialogflow agent is able to make sense of what a user says and matches it with one of the intents created for that agent. The conversational agent, however, has trouble handling the intent within the conversational context as defined by the active conversational pattern. In other words, the intent does not fit into that pattern and the question is how the agent should deal with this. We provide two repair mechanisms using (somewhat special) patterns again for the agent to deal with each of these situations.

Responding to a fallback with a paraphrase request

An example of a user expression that will not be recognized by our Dialogflow agent is the following:

...

A: What do you mean?

In this case, the user expression clearly does not match with any of the agent does not understand the user's utterance intents that we created for our Dialogflow agent and the agent will not understand it (a fallback intent will be received from the Dialogflow agent). In Moore and Arar, 2019’s taxonomy, this is a b12 pattern.

Your user has just said something odd or does not match the current situation, and so your Dialogflow cannot identify the user's intention and goes to a default fallback intent. In this pattern, your agent can try to come to an understanding by asking for a rephrasing with ‘paraphraseRequest’. Add a b12 pattern using the defaultFallback intent and paraphraseRequest response.

In responses.pl: In this pattern, the agent responds to a misunderstanding by asking the user to rephrase, i.e. it makes a paraphraseRequest move. Retrieve the intent label that you should use for the first user move by inspecting the Action section of the default fallback intent in your Dialogflow agent (and make sure this label is of type atom).

  • Add a b12 pattern to the patterns.pl file.

Don’t forget to add textual responses in the responses.pl for the paraphraseRequest intent. You can use the Responses section of the fallback intent in your Dialogflow agent for inspiration.

Responding to an out of context user intent

The user said something that Dialogflow can identify with the user’s intent, but your agent is not at a stage where that intent is appropriate. b13

Example:

A: What recipe would you like to cook?

U: Hey there.

A: I am not sure what that means in this context.

Think about what feature in Prolog you could use to symbolize that there is some intent identified, regardless of what particular intent it is. The agent should respond with a ‘contextMismatch’ response. 

Make a contextMismatch response in responses.pl.

paraphrase requests are determined depending on the context of the conversation (the pattern that is currently active). Under the paraphrase request section in responses.pl, you should create ‘text/3’, which specifies the active pattern, the agent response name, and what the agent should say. Fill all these in. 

Code Block
% Intent: paraphrase request

text(c10, paraphraseRequest, ""). % we don't care exactly what user said. 
                                        we got some response.

text(a50recipeSelect, paraphraseRequest, " ") :- % this should be used 
                                if the number of filtered recipes is greater than 0
                                
text(a50recipeSelect, paraphraseRequest, " ") :- % this should be used 
                                if the number of filtered recipes is  0                                
	
text(a50recipeConfirm, paraphraseRequest, "").

text(c43, paraphraseRequest, "").

b13 Out of Context. 

The user said something that Dialogflow can identify with the user’s intent, but your agent is not at a stage where that intent is appropriate.

Example:

A: what recipe would you like to cook?

U: goodbye

A: not sure what that means in this context.

Think about what feature in Prolog you could use to symbolize that there is some intent identified, regardless of what particular intent it is. The agent should respond with a ‘contextMismatch’ response. 

...

.

Appreciation 

A simple example of a pattern where a user first expresses its appreciation and the agent receives this well is the following:

...

In Moore and Arar’s taxonomy, this classifies as a c30 pattern for a general capability check. Implement this pattern in the patterns.pl file. You should use the intent labels checkCapability and describeCapability. Define the agent’s response in the responses.pl file.

Visuals

Nothing we ask you to do here for this capability. It’s up to you.

...