DialogFlow- Invoke intent without training phrases and saving response - dialogflow-es

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.

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 parameter entity similar to Alexa's AMAZON.SearchQuery

I've developed an Alexa skill and now I am in the process of porting it over to a Google action. At the center of my Alexa skill, I use AMAZON.SearchQuery slot type to capture free-form text messages. Is there an entity/parameter type that is similar for google actions? As an example, see the following interactions from my Alexa skill:
Alexa, tell my test app to say hello everyone my name is Corey
-> slot value = "hello everyone my name is Corey"
Alexa, tell my test app to say goodbye friends I'm logging off
-> slot value = "goodbye friends I'm logging off"
Yes, you have a few options depending on exactly what you want to accomplish as part of your Action.
Using #sys.any
The most equivalent entity type in Dialogflow is the built-in type #sys.any. To use this, you can create an Intent, give it a sample phrase, and select any of the text that would represent what you want included in the parameter. Then select the #sys.any entity type.
Afterwards, it would look something like this.
You may be tempted to select all the text in the sample phrase. Don't do this, since it messes up the training and parsing. Instead use...
Fallback Intents
The Fallback Intent is something that isn't available for Alexa. It is an Intent that gets triggered if there are no other Intents that would match. (It has some additional abilities when you're using Contexts, but thats another topic.)
Fallback Intents will send the entire contents of what the user said to your fulfillment webhook. To create a Fallback Intent, you can either use the default one that is provided, or from the list of Intents select the three dot menu next to the create button and then select "Create Fallback Intent"
So you may be tempted to just create a Fallback Intent if all you want is all the text that the user says. If that is the case, there is an easier way...
Use the Action SDK
If you have your own Natural Language Processing / Understanding (NLP/NLU) system, you don't need Dialogflow in the mix. You just want the Assistant to send you the result of the speech-to-text processing.
You can do this with the Action SDK. In many ways, it is similar to how ASK and Dialogflow work, but it has very basic Intents - most of the time it will just send your webhook a TEXT intent with the contents of what the user has said and let you process it.
Most of the Platform based ASR systems are mainly built on 3 main parameters
1. Intent - all sorts of logic will be written here
2. Entity - On which the intent will work
3. Response - After executing all the process this is what the user will able to hear.
There is another important parameter called webhook, it is used to interact with an external API.
the basic functionalities are the same for all the platforms, already used dialogflow(google developed this platform- supports most of the platforms even Alexa too), Alexa, Watson(developed by IBM).
remember one thing that to get a precise result giving proper training phases is very much important as the o/p hugely depends on the sample input.

Change default message when assisstant misunderstands user

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

How to get Dialogflow to trigger an intent with ANY input without using fulfillment

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.

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