I want to do some thing like this with api.ai. I am doing it as a telegram bot.
1st question: Tell me a joke?
Bot: Tells a joke ( picks it from text response that I specified )
2nd input from user: Some more.
Bot: It should tell another joke from the same list of responses.
One thing I could do is include MORE as a user input is joke intent and it would pick a response.
But I can not do this, because then even without asking 1st question if I give "more" as input it would pick a response from the list. Basically that wouldn't pick response based on context.
Any help onn the structure I should be using on api.ai to achieve something like this.
So the first intent where the user asks "tell me a joke?" sets an outgoing context- 'jokes'.
Follow-up intents for telling more jokes have 'jokes' for the incoming context, and, if you want to chain repeatable requests, set the outgoing context as 'jokes' as well.
If the user input like "tell me more" outside the 'jokes' context is still triggering the followup intent, either train your bot to recognize the difference, or create an explicit "tell me more" example in a fallback intent outside the jokes context.
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 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.
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
I am developing a google assistant app on Dialogflow.
And I have a intent that receives two entities: #name and #age
Using the fulfillment throught the inline editor I verify if the #age is below 18.
In that case I need to ask for additional info, I need to ask the name of the person responsible for the child.
I looked around the internet, including the fulfillment samples at https://dialogflow.com/docs/samples
I believe it would look something like this:
let conv = agent.conv();
conv.ask('As your age is under 18 I need the name of the person responsible for you:');
//Some code to retrieve user input into a variable
agent.add(conv);
But I was unable to find how to do it.
Can someone help me to achieve this?
Thanks in advance.
While you are handling an Intent, there is no way to "wait for" the user to respond to your question. Instead, you need to handle user input this way:
You send a response back from your Intent.
The user replies with something they say.
You handle this new user statement through an Intent.
Intents always represent the user taking some action - usually saying something.
So one approach would be to create a new Intent that accepts the user's response. But somehow you need to distinguish this response from the initial Intent that captured the person's name.
One way to do this would be, in the case you ask the question about who the responsible adult is, is to also set a Context. Then you can have a different Intent be triggered only when that Context is set and handle this new Intent to get the name of the adult.
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.