Multiple intents call with single utterance in Actions on Google - dialogflow-es

Is there a way to let the user activate multiple intents with a single utterance?
Example:
User: I sat on the sofa and I kicked the ball
I want that "I sat on the sofa" triggers the sitting-intent and "I kicked the ball" triggers the kicking-intent
Is it possible?

No, in Dialogflow a user utterance will only match a single intent at a time. If you are looking for more advanced logic, you could do additional matching in a webhook or create an intent that would match both inputs in a single phrase.

Related

DialogFlow WelcomeDefaultIntent

The DialogFlow documentation writes that the base WelcomeDefaultIntent is triggered either by matching training phrases or every time the user starts a dialogue. But this is not true. If the user's phrases match one of the training phrases of another intent, this intent is triggered, instead of a WelcomeIntent. As a result, the user does not understand that he is communicating with the bot and the quality of service fall down. Please, give a hint, how to make the DefaultWelcomeIntent always works first when the user starts a dialogue, no matter what he wrote. I hope on you
That is an expected behavior. As the documentation mentions:
The default welcome intent is matched in one of two ways:
One of its training phrases are matched, which are pre-populated with
common greetings, like "hello".
This intent has a welcome event
attached to it, which is triggered when the end-user begins a
conversation with your agent via a supported integration.
However, it doesn't specify that no other intents can be matched at the beginning of a conversation. At the end of the day, the default welcome intent is just another intent that is automatically created alongside the agent, and pre-populated with training phrases. Intents will always "compete" with each other's matching phrases, so the best intent gets selected according to the user input, regardless of whether the intent is the welcome default intent or not.
From a natural conversational point of view, it doesn't makes much sense to "force" the welcome intent to always be triggered at the beginning of a conversation, regardless of the user input. An example could be:
User: What time is it?
Bot: It's 1:55 pm PT.
And you would be forcing this into something like:
User: What time is it?
Bot: Hey, my name is Bot, how can I help you?
User: What time is it?
Bot: It's 1:55 pm PT.
Adding an extra interaction for the user.
However, if you do want to force your welcome intent at the start of a conversation, or your use case requires to, you could try with:
Dialogflow Contexts, or.
Using the Detect Intent API method, which can receive a EventInput object that allow for matching intents by event name instead of the natural language input. Hence, you could use this to match the intent attached to the Welcome event, regardless of the user input.

Is there a way to specify which intents are active at specific points in a conversation using DialogFlow?

I am creating an interactive fiction game for the Google Assistant, and I want to move the story on after each choice the user makes.
I have created new intents to deal with each new scene, which look to see which choices have been made. I also want some other general intents to look for questions like, "What are my options?"
The problem I've encountered is that, when a user has moved on to a follow-up intent, they can still say a key word linked to a previous intent, and that intent provides an unwanted fulfilment.
What is the easiest way to disable certain intents from providing fulfilments in certain scenes, or of specifying which intents should be active at any time?
To get some control on which intents can be triggered by the user your can use Dialogflow's context to set which intent can and cannot be triggered. You can set an Output Context on an intent, once that intent is triggered the output context will be active. While any contexts are active, Dialogflow will only match intents that are configured with input contexts that match the currently active contexts.
In the above image you can see an example, the CheckingBalance intent can only be triggered once an active context has been set in the CheckingInfo intent and while the context is active, Dialogflow will first look for any intents matching the context. For more info about setting input and output context. Have a look at the docs.

How to prevent user from hopping to another intent in the middle of the conversation?

Let say I have 2 basic intents i.e Set Appointment and Cancel Appointment.
Each of the intents has its own follow up questions and so on. When the user is in the follow up chain for the intent, Set Appointment, I want to prevent the user from hopping to another intent if he/she says "cancel appointment for abc"
Since both intents have empty input contexts so they can be called from the Google Assistant's invocation i.e Tell XYZ App to set appointment for...., it seems that this allows the user to be able to hop between intent mid conversation.
How do I limit this behavior? Or is there some kind design best practices here?
First of all, remember that Intents represent what the user says, not what you're doing with that the user says.
Second, remember that users can change the course of the conversation at any time. So it makes sense that if they start adding an appointment, that they might want to cancel that appointment.
The best approach is that, if they try to cancel in the middle of making an appointment, you decide how you want to handle this change in conversation. And then just reply that way. You may choose to change tracks. Or you may choose to say something like "let's add this new appointment first, and then we can cancel the old one". With this scheme:
You have one Intent that matches "set the appointment for 10am"
In your handler:
If you aren't taking any action, you'd start prompting them for additional appointment setting info, or whatever.
If you are already setting an appointment, prompt them if they want to change the time to 10am
If you're cancelling an appointment, tell them that you'll talk about canceling the old one when you're done with the new one.
I tend to go with this approach in most (tho not all) cases. It lets me code the logic and lets me determine the best way to reply based on the entire state.
Another approach that you can use is to create an Intent with the Input Context that matches your current contextual line of questioning that matches the phrases from the Intent you don't want to match. (This might even be reasonable as part of a negative training phrase for a context-specific Fallback Intent.) Context matches are handled before context-free matches. So under this scheme you would have:
An Intent, without input context, that matches "set the appointment for 10am". The handler for this Intent would set the "set" context and start prompting for additional info.
An Intent, with your "set" input context, that matches "set the appointment for 10am". This could do something like re-start the prompting, or just change the time they're requesting.
An Intent, with your "cancel" input context, that matches "set the appointment for 10am". This handler would let them know that you'll ask about cancelling older appointments at the end.
Which method you use depends on how you're handling other state management in your code.

How to implement "Change of mind" ability into the bot or conversation for any given intent in Dialogflow?

Consider a scenario where user wants to order a meal :
User : I would like to order 1 burger 1 orange juice and one coffee
Bot : Would you like to have a veg burger or a non-veg one?
User: A veg burger
User: Sorry, I would like it to be non-veg
Bot: (Generally how would we handle this change of mind without having to start the conversation from scratch) ?
In this part where I've been implementing something like a bus ticket booking, this the bot seems to remember the previous order that is veg-burger or some how ends up falling on to default intent or fallback intent whichever is suitable. But I would like to know if there is a way for letting the bot know that the user has "Changed the mind" (Hopefully it is possible using or manipulating the context) and wants a non-veg burger now?
Can we work out an followup intent recognizing words like Sorry and then entity such as type i.e. non-veg here. What is the best practice? Because starting the conversation from scratch doesn't seem to be a good idea from UX point of view.
Good day TGW,
You have 2 options, either you split your intents into a search intent and book intent e.g. search.salad and buy.salad intents OR you have a confirmation step before you actually send to Fulfilment.
If you choose to split your intents into 2 then a similar flow should work for you:
If the food type is finite then create an entity with the options.
Add your search.salad intent that should have most of what the users will say to order a salad. Remember to incoporate the entity from step 1.
Add a followup intent to your search.salad Intent, and select custom from the options.
In this newly created followup Intent add the User says that you want to use to update the search, enable fulfilment and save.
NB: Ensure the newly created intent has an intent that ends with *-followup in the In-context and this same intent is in the Out-context of the search.salad intent. Dialogflow will automatically update the parameters for you based on what the user enters.
The second option is similar to this, you can add your confirmation step as a followup to the search.salad intent and enable fulfilment only on the confirmation intent.

Looping back to an intent without repeat the responses list

I want to do something similar to this question: Looping back to an intent?
My bot is telling jokes when a user ask "Tell me a joke", (intent: smalltalk.agent.telljoke) and if the user respond with "another one" I want to send another one.
I understand the answer in the linked question, I can create repeat.smalltalk.agent.telljoke intent if the user say "another one" with a specific input context set in smalltalk.agent.telljoke intent.
But can I trigger my smalltalk.agent.telljoke intent in the repeat.smalltalk.agent.telljoke intent ? I am not calling a webhook to get the jokes so they are in the Responses section of my smalltalk.agent.telljoke intent and I do not want to write them at two places (in both intents).
Can I redirect an intent to another one's responses ?
I asked the same question on the Dialogflow Google forum:
Looping back to an intent without repeat the responses list
To have the input "another one" trigger the joke-telling intent (smalltalk.agent.telljoke), just add "another one" to the training phrases of that intent. There's no need to have two intents if they both do exactly the same thing.
You can do that by adding an output context (let's name it anotherJoke) to your smalltalk.agent.telljoke intent which can expire after two messages (to allow a follow up to a ha ha ha or lol from the user).
Then create a new intent (maybe smalltalk.agent.anotherJoke) that will take the anotherJoke as it's input context.Make this intent recognize another one, shoot again, etc and provide another set of jokes for it.
That way the smalltalk.agent.anotherJoke intent will have priority matching only after the smalltalk.agent.telljoke intent has been triggered, the context kinda links the two intents together.

Resources