Provide different responses to options in an Assistant List using only Dialogflow? - actions-on-google

I have an intent with an Assistant List containing two options, Apples and Cheese. I want to provide a different response to each option chosen.
My first attempt was to use follow-up intents for each item, but when I do this I get a “not understood” message when tapping/choosing the item. On reading more, I understand this is because the actions_intent_OPTION event has been fired and there is no intent to handle it.
My second attempt was to add the actions_intent_OPTION event handler to each of my follow-up intents. When I did this, only the Cheese intent was invoked each time. I understand this is because actions_intent_OPTION can only be handled by a single intent.
So my conclusion is that the only way I can provide different responses for different items in an Assistant List is to handle this event with a webhook, and that it’s not possible using Dialogflow alone. Can anyone confirm or point me in the right direction if not?

The answer is, as suspected, that you can’t use an Assistant List purely in Dialogflow, you have to add a handler function in the fulfilment, that fires on the event actions_intent_OPTION. For example:
const option = conv.arguments.get('OPTION');
if (!option) {
conv.ask('No choice made');
} else if (option === 'optionA') {
// Do something
} else if (option === 'optionB') {
// Do something else
}

Follow this ideal approach:
remove follow-up intents
add a new intent with event set as actions_intent_OPTION
enable webhook for the new intent
in the webhook extract the selected option
based on the selected option, pass the required response
If you want to use only Dialogflow, then it won't work! This is because, when you select an option, the output context and the generated event both will be the same as the 2 intents - cheese and apple. There will be no way for the AI engine to decide which Intent should be triggered. Whichever intent is first, it will be called every time.
I tried to recreate what you did all be Dialogflow and even put cheese and apple as training phrases for the 2 intents just to provide some differentiation to the AI engine, but it still selected only one intent.

Related

How to add different fallback intents for different intents

How to add different fallback intents for different intents? So that user will see appropriate message instead of common fallback message.
If you are developing your own webhook to handle requests and response, it would be better to use Default Fallback intent for all the intents.
Add an output context to each of your individual intents and based on this context you can respond back from the webhook using the single Default Fallback Intent like
switch(inputContextToDefaultFallback){
case "context1"...
case "context2"...
}
But if all your intents are not using webhook, then you can add a fallback intent from the dialogflow by clicking Add follow-up intent --> then selecting fallback
like this
In order to add different Fallback intents for different contexts, you should just follow the steps provided in the documentation to add a new Fallback intent.
To do so, go to the three dots more options menu next to the Create intent button in the Intents tab in the Dialogflow UI, and then click on the Create Fallback Intent option. Once there, you will be able to create a fallback intent, where you need to specify the Input Context (which should be the context under which you want this fallback intent to trigger), and Responses
You can add different Fallback Intents to handle different user replies to what your Action has asked. Just like you can add different Intents to specifically handle based things you've asked or said.
The trick in both these cases is to set an Output Context along with with your reply, and then to require this as an Input Context for the regular Intents and Fallback Intents that you wish to be valid in this context.

Generic Training Phrase in Dialogflow

I'm trying to create a mock interview Action that asks a specific set of questions in a specific order, regardless of what the user says in response to each question. How can I set up the intent in Dialogflow to accept any phrase from a user to trigger the next question as the response?
Ex of the dialog path:
User: "I want to practice for an interview"
Google: "Question 1: tell me about yourself"
User: [says literally anything]
Google: "Great job. Question 2..."
User: [says literally anything]
Google: "Okay! Question 3..."
Using Dialogflow, you can create an intent that accepts any input by taking the user utterances and marking them as #sys.any.
Then you can do one of the following:
Use Dialogflow contexts to make the next step dependent on the first (this is good if you want to do everything in Dialogflow)
Keep track of the conversational state in your webhook using the app.data object.
There are a few good ways to handle what you want, the best solution will depend on your other needs.
If you're using a fulfillment webhook, you can handle this as part of the Fallback Intent. Make sure the checkbox to use fulfillment is on for the Fallback Intent, and you'll be sent everything that the user says that doesn't meet other structures. You'll need to keep count of how many times you've been called and you can store this as a parameter in a context, as part of the app.data session storage object, or as part of the app.userStore cross-session storage object. Your webhook will return the next question as a response.
If you want to avoid fulfillments and handle it through Dialogflow, you can use the same general idea, but you will need to keep track of which question you're on for each time. You can do this by creating multiple Fallback Intents with each one having as an Incoming Context a context named after which question you're expecting the user to answer (say "question_1") and the Outgoing Context named after the question that is in the reply (for example, "question_2").

MS Bot framework i want to put a form builder in an open conversation

I want to start Form conversation chat in Microsoft Bot framework.
if(user says hello)
{
reply = what u want to listen hi or hello
if(user says order)
{
reply= start a formbuilder.form with order form workflow
}
if(user says hello)
{
reply= hello
}
}
My problem is the first thing i do always works
example: if i say first chat line as order it starts order form but it never goes to the normal conversation mode even if the form ends.
if i start hi then it always goes in hi mode never goes or create order form on typing order.
Need it to be dynamic
you can use below code to end your conversation when you are in a dialog or a conversation flow ends.
context.Done<object>(new object());
or
context.Done(true);
do let me know if you need any help further
Per my understanding, you want start specific dialogs while triggering different words like "hollo" for greeting dialog, "order" for form dialog.
I think there are two methods to achieve this in C#:
You can leverage Recognize intents to implement LUIS, which can identify your users' intent from their spken or textual input, or utterances. Trigger specific dialogs for each LUIS intent.
For this solution you can refer to the official document Recognize intents and entities with LUIS using a prebuilt domain for details, and refer to https://github.com/Microsoft/BotBuilder-Samples/tree/master/CSharp/intelligence-LUIS for a sample for your reference.
You also can build Global message handlers using scorables in your bot application for yourself. With which, you can route users to certain fuctionality by using words like "help," "cancel," or "start over" in the middle of a conversation when the bot is expecting a different response.
Please refer to https://github.com/Microsoft/BotBuilder-Samples/tree/master/CSharp/core-GlobalMessageHandlers for the sample for this solution.
Hope it helps.

Why my actions on Google doesn't recognize touch selection?

I'm writing a simple action on google without any webhooks. Every response is generated by dialogflow.
I have an intent that works flawless if I call it by speech or type but if I call it by selecting it from a list it doesn't work and the Default Fallback is called.
In the simulator it show the right "text" when I click on the list.
Have I done something wrong or did I need to specify something in the list?
This is how the list is generated
This is my intent
This is what happens in the simulator if I click on the "easyTravel" item in the list (it trigger the default fallback intent)
This is what happens in the simulator if I type "easyTravel" (the right intent is executed)
To catch a click on a list I need an intent configured to be triggered by the event actions_intent_OPTION
Only once I read this question - and your anwser - I could fix my own problem. Just to share: if you are using a webhook and are waiting for a webhook actions in your script, you can create a new intent, which has the event as #Edo states: actions_intent_OPTION. If you define an action in that intent, this is what will be trigger by your webhook. You can then get the parameter by (node.js):
const param = app.getSelectedOption();
Without the 'empty' intent, with the event and action, I was not receiving any input.

Carousel and list in Dialogflow

I have a question about the Carousel and list selector. How to use actions.intent.OPTION in Dialogflow for Actions on Google? I have tried adding actions_intent_OPTION in event section of every intent that the user will be selecting. But every time the response came from a single intent.
An API.AI/Dialogflow event tends to override anything that may have been "said" by the user, so Dialogflow's processing stops when it gets the first event that matches and handles that as the Intent. Option processing tends to be done in fulfillment. Rather than trying to match the option key or title against any phrases, anything said that matches the title or key will return the key as the matched "phrase".