In the Dialogflow, we have a option like slot filling when a particular intent is matched, the Dialogflow agent continues collecting all the required parameters (which is specified by us within the intent).
The same option in Alexa too.
But I can't able to find this same option in Google Actions Builder. In the scenes, they are having slot filling but this will execute before the intent matching. So it is not checking for the particular intent.
How can I validate whether the required type is satisfied or not when the intent is matching?
When you create an intent in Actions Builder, there is a section Add intent parameters. In this section you can provide a parameter using a Type you have previously defined in Develop > Types.
Once you have an intent parameter name defined, you can use it's associated values within the training phrases of your intent, similar to Dialogflow.
If you have an intent defined with intent parameters, you can add this intent to a Scene under User intent Handling, enabling the intent to be matched along with the intent parameter data. There is no need to add slot filling to the Scene.
Related
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.
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.
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.
In the DialogFlow console, you can set an input and output context for an intent.
I would like to have the same functionality using the Actions SDK.
Since I can set the context in my fullfilment webhook in the code, the output SDK is covered.
However, how do I set the input context for an intent to only trigger if that context was fetched?
I could not find this in the documentation examples.
I don't believe you can in the same way, which is part of why they added Dialogflow.
Although as part of your response you can indicate the ExpectedInput for the next Intent, the documentation for the ExpectedIntent makes it clear that your Intents are only used for speech biasing - you'll always get the built-in TEXT Intent.
In fact, this documentation says that you'll only get custom Intents for the initial call - later Intents are always triggered with a built-in one.
Update: One thing you can do is to include information in the response that will be sent back to you in the next request.
If you're using the JavaScript SDK, this is done with the second parameter to ask() and is available via the getDialogState() function.
If you're sending back JSON, this is done using the conversationToken attribute and is available in conversation.conversationToken in the request object you're sent the next round.
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".