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.
Related
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.
I'm developing a chatbot in Dialogflow and, in order to make it easier to me to get the parameters I need, I would like to "force" the conversation to go to a specific intent, where those parameters are required.
As far as I've seen, there is no way to move between intents as there is no such thing as a "flow" between them, but is there any other way to try to force my system to fall into a specific intent?
I'm not sure about how Contexts and Events work, so maybe using those functionalities?
In my case, I start the conversation in the Welcome intent, as usual, and then I say "I want to make an enquiry". This sends me to an "initicialization" that as me to enter my user name. Here is where I would like to go to my specific "user" intent, where the user name and other parameters are required in Actions and Parameters.
Thanks in advance for the help!
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.
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.
Not much to add to this question I don't think. Basically, I have a series of questions the user needs to answer, but they are veeeery open-ended, so the user input could be pretty much anything. Once the user responds to a question I want the system to simply ask the next one, regardless of what they said (unless they say something like "help" or "I don't understand", etc, which I can deal with).
I know I can include contexts, but without supplying the next intent with adequate user input, there doesn't seem like a way to get it to trigger the next question (even when the output and input contexts match).
Is there something I'm missing, or do I really need to just supply dozens and dozens of potential user inputs from across the board and hope the machine learning component extrapolates adequately?
For open-ended responses, the easies way to handle this is through Fallback Intents. You can create more than one Fallback Intent - but each one needs to have a different Input Context which will indicate under what conditions it will be triggered.
To be clear - Fallback Intents are slightly different than regular Intents, and you create them slightly differently as well. In the most simple configuration, they are only triggered if the user input does not match the input for any other Intent. Dialogflow provides a "Default Fallback Intent", which is what will be triggered if no other Intent of any sort matches. You'll need to set the Input Context of your Fallback Intents to indicate when it should handle it with that Fallback Intent and then also set the Output Context to indicate which question you have asked and, therefore, what the next expected Fallback Intent will be.
To create a Fallback Intent, don't click on the "Create Intent" button, instead, click on the three dots next to it.
In the menu that appears, click "Create Fallback Intent"
The screen that shows is very similar to a regular Intent editing screen, but it is specifically for Fallback Intents. You'll do the usual things about adding the name and (not shown) showing the replies (ie - the next questions you'll be asking).
You can tell it is a Fallback Intent because of the message at the top. As noted, you should then enter the Input and Output Contexts you plan to use for this.
You will notice there is a "Training Phrases" section. In your case - you will leave this blank. These are actually Negative Training Phrases - phrases that will not match other Intents (even if they should) and will always be handled by the Fallback Intent instead. Since you aren't trying to mask out phrases that might match elsewhere - leave it blank.