I have an intent with slot-filling, after all parameters are set my agent then prompts the user to confirm that the parameters are correct. If the user answers "no", a follow up intent is triggered, but I don't know how to make it so this repeats the previous intent allowing the user to correct the information.
Add a follow-up intent with yes and another follow-up intent with no values.
Then in the follow-up no values, check the user input and then again call the main intent.
Remember that Intents represent what the user says or does and not what you do with that information. So there is no way to force "repeating" the previous Intent, since the user may choose to do something else.
What you can do is
Clear out the various Input Contexts, except for an Input Context that your original Intent is valid.
Re-prompt in a way that they would answer it so the original Intent would be triggered.
Related
In Dialogflow-es, I want to trigger the Custom fallback intent ("Want an appointment-service-fallback") anytime the user doesn't trigger the other intent ("Want an appointment - service-hairdressor") with the training phrases.
However, I'm not sure how to set it up and I keep triggering the default fallback intent.
The way you have the Intents setup are as Followup Intents, meaning they will only be matched in the turn (or two) after the Intent they're following up on has matched.
So in your illustration, in order for the "service-Fallback" intent to be triggered, the conversation must have:
Matched the "want an appointment" Intent by something the user said
Then matched the "service" Intent on the next exchange with what the user said
And then, when the user said something else, it can't have matched the hairdresser phrase
So unless you have gotten to that point in the conversation, you won't end up triggering the "service-Fallback" intent.
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 have a bot that answers question related to a certain topic. However, the user may say something that doesn't match with any intent I have. This phrases need to be stored on a database.
So far, I found out that I need to create a fallback intent. How can I make it so upon being triggered this intent returns a response with the text that triggered the intent?
Also, if I only have one fallback intent, will every missed match trigger it or do I have to link it in some way to all my intents?
The easiest way to do something with the user input in a Fallback Intent is through your fulfillment webhook. In the request object that is sent, you can look at the queryResult.queryText parameter to get the text from the user. You can then send this as part of your response as part of the fulfillmentMessages object.
You can't "attach" a Fallback Intent to a regular Intent. That doesn't actually make sense, since Intents represent what a user says, rather than the state of the conversation.
While there is a single Fallback Intent available, which can catch all no-match phrases, it is also possible to create Fallback Intents that only trigger if specific input contexts are set. If you have regular Intents with these same input contexts set, then the Fallback Intent with the context would catch anything they don't.
I have two intents get_name and get_age
in get_name I take the user name, this intent is enabled for fulfillment.
In the editor, how to ask for confirmation of the name?
if confirmed, then I should add output context to get_name, so that get_age intent gets invoked.
i tried using the conv object to start a conversation without leaving the intent, but it does not even call the function.
function confirmation(agent){
var entity_name = agent.name;
var name = agent.parameters.name;
var conv = agent.conv();
conv.ask(`Is ${name} correct?`);
agent.add(conv);
var user_query = conv.query;
if(user_query.entities.name=='yes'){
agent.setContext({
name: `${entity_name}`+'_done',
lifespan: 2
});
agent.add(`Give your age ${name}`);
}
}
You're mixing up a couple of concepts. While it is possible to use the Inline Editor to do fulfillment, and it is possible to confirm an entry from a user without a Followup Intent, you will still need additional Intents to do the confirmation.
There are two important things to understand about Dialogflow fulfillment programming:
All responses from the user have to come through an Intent. It doesn't need to be a unique or Followup Intent, but the intent of what the user says is always captured this way.
When an Intent is triggered, it can send the information to an Intent Handler. This is the only way an Intent Handler gets information from the user. When a Handler is triggered, it does not wait for further user input. All it can do is send a reply.
So in your code, once you have sent
conv.ask(`Is ${name} correct?`);
agent.add(conv);
you will not get the response from that prompt in the same Intent Handler.
You will need another Intent that can capture the user saying yes or no. You can do this as one Intent or two - which you do is up to you. Based on what the user says, you then prompt them again.
Your issue is similar to what is described in this article, which points out that how we reply is based on two things:
The current state (in your case, which question you are asking them to confirm)
The user's reply ("yes", in which case you save the info and ask about the next question, or "no", in which case you repeat the question)
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