Dialogflow - Multiple Yes / No Questions not staying in context - dialogflow-es

I am trying to setup a structure in the Dialogflow console that involves multiple yes / no questions. It looks like something like this:
Agent: do you want to go to Basel?
If User: No -> Agent: Do you want to go to Zurich?
If User: Yes: Great, you chose Zurich!
If User: Yes -> Agent: Great, you chose Basel!
Basically, it keeps asking questions based on something like a location and when the user says Yes, it responds with with the chosen location.
If the user says yes for the first question everything works fine. However, when the user responds with yes for a followup question, Dialogflow still maps the intent of the first question and responds with:
Great, you chose Basel!
Instead of:
Great, you chose Zurich!
In the image you can see my intent structure from the Dialogflow console.
IntentStructure
Does anyone have any recommendations here? I am aware that the mutliple yes / no questions all contain the same examples, but how can I make sure that Dialogflow stays in context?

I will suggest not to keep all your intents as a follow-up intent. Instead, you can manage all your contexts. What you have to do is that create an intent for each location and two follow-up intent "Yes" and "No". If the user responds with yes show the message else add your next question to the no follow-up intent response and set its output context for the new location "yes" follow-up intent. Similarly, you can create a chain.

Related

Dialogflow prevent repeating intent

I'm bulding an agent with a lot of top level intents. Sometimes users ask a question which has not been added as an intent and it gets triggered by a wrong intent. Usually they try to ask the very same question again in a little different way. They get the same (wrong) intent again.
Is there a way I can avoid triggering the same intent multiple times in a row? It'd be cool to call the default fallback at the second time it is triggered. I'd like to apply this to all of the top level intents.
The way I would achieve this without fulfillment is a little clunky, but it will do the job. All you do is for every top-level intent, create a duplicate (with the same training phrases), named something like [original_intent_name]_repeat and put a input context required of [original_intent_name]_asked. Then for all your original top-level intents, add an output context of [original_intent_name]_asked with a lifespan of 1.
That way what happens is the following:
User: What's your name?
Bot: It's Dave! [intent `name`, output context `name_asked:1`
User: What's your name?
Bot: It appears you've already asked me my name! Try something else. [intent `name_repeat`]
This works because Dialogflow priorities intents with input context requirements over ones that do not.

Contexts and Fallbacks on Dialogflow

Is it possible to set fallback intents using only contexts?
The example would be the user asks a question which triggers fallback intent 1 "sorry I don't understand"
The user then tries again with a reformulation of the question which then triggers fall back intent 2 "hmmm I still don't understand you, please leave your email and someone will get back to you right away"
I have tried adding contexts but it is always the default fallback intent that is triggered
You can use fulfillment code to give response like that.
For this you need to set a counter for fallback occurance.
then according to counter variable you can reply with different text each time fallback has occured.

( Alexa ) Is it possible to get the response in same Intent Handler?

I have a custom Alexa Skill similar to some Q&A skill , in which I'm asking the user for a response (say option_1, option_2, option_3), but when the user responds with one of these asked options a different intent (say ruleIntent) is triggered because the option text is somewhat similar to its utterances.
I think it is not a good design if more than one IntentHandler is triggered for same( or similar) phrase, but then I don't know the text of options in advance to avoid this (or what the user is going to speak out as the answer of asked question). What if I can somehow maintain the context of user's response, I think that will be one of the solutions.
Example : -
1.User : Start a Science test {Invokes testIntent }.
2.Alexa : Okay, but before starting do you want to know the rules. Please answer in Yes or No. { response generated from testIntentHandler}
3.User : Yes { invokes many intents }
In line 3 even if I hard-code this to a Intent (say ruleIntent) , then what will happen if some question contains its options as Yes or No. How will I differentiate that and map that to the response of asked question.
One way to deal with this is to track the state using persistent or session attributes.
You can do a check of the state in the canhandle method to route the user to appropriate test intent
One way to solve this could be to use Dialogs. You can use auto delegation for dialogs
Enable auto delegation, either for the entire skill or for specific
intents. In this case, Alexa completes all of the dialog steps based
on your dialog model. Alexa sends your skill a single IntentRequest
when the dialog is complete
Delegate the Dialog to Alexa

Change default message when assisstant misunderstands user

I have created a google action, which takes in three parameters, I have done training phrases for many word combinations, but sometimes it will not pick it up.
I set my input parameters in the dialog flow to number1, number2, and number3.
It seems by default, if it misses a value it will say: "what is $varName"
however, this could be misleading to users since it may be unclear if it just prompts the user for 'what is number3'.
Id like to edit this response to be a more descriptive message.
I hope this is clear enough - I cant really post any code since its all concerning this dialogflow ui...
cheers!
If you want to add prompt variations for capturing parameters in an entity follow the "adding prompt variation" explained here. Just add variations to prompts as below or handle it from webhook by enabling slot-filling for webhook.
If you want to ask questions when the agent did not understand the intent then you can either use a Default Fallback Intent for a generic reply or create a follow-up fallback intent for the intent you are targetting.
or

Dialog flow default response set to follow-up no

I'm new to dialog flow and was trying to build a conversational chatbot. The following is the example I'm working with.
I created an intent "Q1" with question 1 as the user input. Later, I added a follow up yes and no intent for "Q1". When I test it, though it gives the correct answer for yes and no, I noticed that when I enter "thank you" after asking question 1, I get the output intent as Q1-no. Is there an explanation why the default is Q1-no instead of small talk?
Your dialogflow follow-up intent for NO has default user says added as thanks but no & so when you enter Thank you, it matches it with user says in intents, compute a threshold & check how much percent it matches with a user-entered query. If it is higher than the threshold value you have set in your agent's ML settings, then it gives response for that intent. The solution to your problem is either disable ML from follow-up intent for NO or remove thanks but no user expression from that intent.
snap-1
snap-2
snap-3
snap-4: Output: Follow-up intent is not called after I removed thanks but no user expression.

Resources