API.AI: possible multiple intents in a result - dialogflow-es

API.AI returns a top scoring intent. I was wondering could we have lower scoring intents in the same response like LUIS?

I sent an email and API.ai staff confirmed only top scoring intent is returned.

Edit: I misread the question initially and thought this was a LUIS question.
For API.ai, it would appear that it does not return multiple intents in the response to a query.
Original Answer:
Yes, LUIS returns the following properties:
"query", "topScoringIntent", "intents", "entities", "compositeEntities"
The last three properties are arrays, and "intents" has all of the intents recognized by LUIS.

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.

DialogFlow- Invoke intent without training phrases and saving response

I'm trying to build a basic "question/answer" app in Actions using DialogFlow. Right now I have two intents:
Intent 1: User says "Ask me a question" and the intent responds "Tell me about yourself"
Intent 2: I'd like to capture the user response to "tell me about yourself", but frankly there's no way to write enough training phrases to cover it.
I tried following this suggestion, and having Intent 1 send an output context called save_response and Intent 2 has an input context of save_response. Then for the training phrase I used #sys.any:save_response
When I try this action, it just invokes the default fallback intent every time. Thoughts on where I might be going wrong?
You need to create 2 intents, in the first intent your training phrase would be Ask me a question, output context will be save_response and response will be the question which you want to throw at the user.
Then in intent 2, you need to do following:
Set input context to save_response, so that it will only be
triggered when this is present in the contexts
Go to actions and parameters section and create a parameter named
answer, give entity type as #sys.any
Then go to training phrases section and add any training phrase, then
highlight it all, and select the parameter you just created
After that, your training phrases and entity section will be looking
like something like below image
Save the intent and you are done
Hope it helps.
In general, having an Intent with a training phrase that consists only of #sys.any may not always work as you expect.
Better would be to have a Fallback Intent that has the Input Context set to make sure you only capture things in that state (save_response in your case) and then to use the full text captured in your fulfillment.
When doing it this way, you do not need the "Intent 2" you described - or rather, this would be a Fallback Intent that you create in the Dialogflow UI. The Fallback Intent is triggered if no other Intent would match what the user has said.
To create a Fallback Intent, select the three dots in the upper right of the Dialogflow UI
then select "Create Fallback Intent"
The Fallback Intent editor is very similar to the normal Intent editor. The biggest difference is that the phrases you enter (and you don't need to enter any) will explicitly not match this Intent, and there are no parameters. Other aspects (the name, the Incoming Context, turning on fulfillment) are the same.

Parameter value filling with quick responses in messenger

I have created a bot using Dialogflow (api.ai) and integrated it with Facebook messenger. I want to get the parameter values from user: like city, date (today, tomorrow) by using the quick reply feature of messenger, where user is presented with select-box like options, and can tap on one of the options. The required parameter receives the user-tapped value, saving the user from typing it manually.
I cannot find anywhere in documentation any way to fill up parameter values (slots) using quick replies. There is an option to give quick replies in response section, but the response section is called on fulfilment, and if I take user input in response, then I have to create another follow up intent to process the user-response further, because the current intent gets fulfilled after response.
If I add quick replies in the response section, then I have to create multiple levels of follow-up intents. Ex: I take city input in one intent, and give two options to user (like New York, Delhi). Then I have to create two follow up intents, each for handling one reply (New York and Delhi), and then for each follow up intent, I will have to create more follow up intents to get more parameter inputs. Below is the flow diagram of this case. --->
This can get pretty complex when more levels are added! Amazon Lex has this feature of filling slots using quick replies. Can't I just fill up parameter values directly using the quick replies like Lex?
You don't have to go this far. There is a simple way of using entities & prompts in dialogflow.com. The workflow can be: Weather(intent)->quick reply(New york/Delhi)->City(intent) use entities here->quick reply(Today/Tomorrow)->Use different intents here for today & tomorrow as you will have different responses. You don't need to create different intents unless you have different responses. User says can have different parameters for which you can define different prompts as well. This will again reduce your complexity of creating follow-up intents. Let me know if you need more explanation on this.

BotFramework : is it possible to combine LUIS intents and normal intents?

I'm currently taking my first steps into chatbots with the Microsoft Botframework for NodeJS.
I've so far seen 'normal' intents and LUIS.ai intents
Is it possible to combine the two?
I've had an .onDefault intent that wasn't a LUIS one and a LUIS intent but no matter what the input was it always returned the output of the LUIS intent.
Could someone give me a quick example or point me to one?
Thanks in advance
It is possible to combine LUIS intents and normal intents. To do this we'll use two IntentRecognizers; LuisRecognizer and RegExpRecognizer.
let pizzaRecognizer = new builder.LuisRecognizer('YOUR-LUIS-MODEL');
let mathRecognizer = new builder.RegExpRecognizer('MathHelp', /(^mathhelp$|^\/mathhelp$)/i);
Now let's create our IntentDialog and configure its options...
let intents = new builder.IntentDialog({ recognizers: [mathRecognizer, pizzaRecognizer], recognizeOrder: 'series' })
By combining our pizzaRecognizer and mathRecognizer into a list, we can pass this list to our 'recognizers' property so IntentDialog uses both recognizers. The last property we're going to fiddle with is 'recognizerOrder', its default is 'parallel'. By changing the value to 'series', the IntentDialog will now trigger our RegExpRecognizer 'mathRecognizer' first. If a match with a score of 1 exists, the LuisRecognizer will not be used, saving a wasted LUIS endpoint hit.
I would like to reiterate, if you are trying to use RegExpRecognizers to speed up a chatbot's response and reduce the amounts of LUIS calls your chatbot makes, you need to pass in those recognizers first to your recognizers list. Then you need to set your recognizerOrder to 'series'. Without setting your order to series, your chatbot will continue to perform LUIS calls. Also note that any matched intent must have a score of 1.0 to prevent the other recognizers from being employed. To encourage perfect matches, you should use the RegExp quantifiers ^ and $ to define clear start and ending points for your patterns to match against. (See mathRecognizer for an example)
If accuracy is your primary priority, then you should not change the value of 'recognizerOrder', which will then employ all the recognizers at once.
I've built an example here for you to examine. I included the Luis model as well, named LuisModel.json.

Dialog flow default response set to follow-up no

I'm new to dialog flow and was trying to build a conversational chatbot. The following is the example I'm working with.
I created an intent "Q1" with question 1 as the user input. Later, I added a follow up yes and no intent for "Q1". When I test it, though it gives the correct answer for yes and no, I noticed that when I enter "thank you" after asking question 1, I get the output intent as Q1-no. Is there an explanation why the default is Q1-no instead of small talk?
Your dialogflow follow-up intent for NO has default user says added as thanks but no & so when you enter Thank you, it matches it with user says in intents, compute a threshold & check how much percent it matches with a user-entered query. If it is higher than the threshold value you have set in your agent's ML settings, then it gives response for that intent. The solution to your problem is either disable ML from follow-up intent for NO or remove thanks but no user expression from that intent.
snap-1
snap-2
snap-3
snap-4: Output: Follow-up intent is not called after I removed thanks but no user expression.

Resources