Are in-dialog intents supported? I tried something that I thought might work. It didn't. I'm wondering if I need to look harder for a bug on my part or if I can't get there from here. I looked at the ask() method:
ask (inputPrompt, dialogState) {
debug('ask: inputPrompt=%s, dialogState=%s',
JSON.stringify(inputPrompt), JSON.stringify(dialogState));
const expectedIntent = this.buildExpectedIntent_(this.StandardIntents.TEXT, []);
if (!expectedIntent) {
error('Error in building expected intent');
return null;
}
return this.buildAskHelper_(inputPrompt, [expectedIntent], dialogState);
}
It is specifying the name of the intent where the user's response will end up. The comments above the buildExpectedIntent_() method have this quip
intent Developer specified in-dialog intent inside the Action
* Package or an App built-in intent like
* 'assistant.intent.action.TEXT'.
So I thought I might be able to create a new method by starting with the ask method and adding a parameter to take the name of an in-dialog intent and then defining the intent in my action package. I don't see an obvious error when I do that but my text intent is the one that gets the text spoken by the user, not the in-dialog intent.
Should this work - that is should I keep looking for where I went wrong?
While I'm at it, there is also this
* Refer to {#link ActionsSdkApp#newRuntimeEntity} to create
* the list of runtime entities required by this method.
* Runtime entities need to be defined in the Action Package.
just above the description of the intent. What are runtime entities in this context?
It is not possible to match any user defined intent using the Actions SDK integration after the MAIN intent as all the next intents will match the TEXT intent unless it's a built-in intent (system intent). You can find more info on ExpectedIntent in this page.
User defined intents are only accessible through deep-linking. More info here.
Related
I need to declare a parameter to store username as input in the first message of dialogflow session, "My name is John" will be the first message the user type to dialogflow cx,
I noticed it's not possible to create a parameter on the Start page, is there is a way to detect parameters using EntityType from the first message of the session ?
To detect parameter values from the first end-user input, you can use intent parameters.
First, create an intent and add training phrases like "My name is John" and similar. See how the intent may look like.
Then, add an intent route on the Start page and define agent response in fulfillment. See how the route and a simulator test may look like.
You can also check the general agent design best practices for more information.
I would like to use Conditions to dispatch the conversation through different Routes depending on the intent entity that appeared in the last user's message:
But it only enables me to use the condition $intent.params.entityX != null; when I try to extract the exact value of that entity like: $intent.params.entityX = "some_value" it does not match. I have also try $intent.params.entityX.original and $intent.params.entityX.resolved. It seems that the intent param values can apparently only be read in the Route response.
If what you're looking for is to evaluate a parameter that may have been filled through entity detection, you may wanna check in session rather than the intent:
$session.params.entityX
I am trying to connect my chat bot created using Dialogflow to the Google Cloud Firestore. I was thinking if I have to map the intent in the fulfillment one by one that'd be a huge amount of work.
Is it possible to write a fulfillment to detect the user input and maps to the intent then go on to query data from the Firestore?
For example, I would like the agent below to map the user input to the intent I already created then query
function intentHandler(agent) {
const userInput = request.body.queryResult.parameters['Entity_detected'];
}
Dialogflow provides default intent called Fallback Intent. It will be called when there is no matching intent found.
You can take advantage of this and call webhooks on this intent.
Checkout official document
You can indeed map to a different intent using the user input. For this you can use context to map to a different intent after sending a response. I've never tried it with entities, but I imagine it would be implemented something like this.
const userInput = request.body.queryResult.parameters['Your Entity'];
switch (typeof(userInput)) {
case SelectQueryEntity:
// perform select query
conv.ask("I've performed a select query");
conv.context.set("SelectQueryIntent", 1);
break;
case UpdateQueryEntity:
// perform update query
conv.ask("I've performed a update query");
conv.context.set("UpdateQueryIntent", 1);
break;
etc..
};
The context will allow you to navigate the conversation into your desired direction. So if the user inputs anything that matches a SelectQueryEntity, the context will be set to SelectQueryIntent. Any intent which has SelectQueryIntent as an input context will then be allowed to follow up the users next input. Using an intent lifespan of 1 makes this navigation easier to work with.
I have a query on a Google home (Dialogflow).
In a specific, after I execute fallback intent three times it exits with a statement
Sorry I can't help
But it should prompt
I am ending this session see you again later.
Here is code of fallback intent
app.intent('Default Fallback Intent', (conv) =>
{
const repromptCount = parseInt(conv.arguments.get('REPROMPT_COUNT'));
if (repromptCount === 0) { conv.ask(`Hey are you listening?`); }
else if (repromptCount === 1) { conv.ask(`Are you still around?`); }
else if (conv.arguments.get('IS_FINAL_REPROMPT')) { conv.close(`I am ending this session see you again later.`); }
});
I am assuming you're trying to follow the directions in the documentation about dynamic reprompts for "no-input" type responses.
The problem appears to be that you're trying to use this for the Fallback Intent, which is not specifically triggered on a NO_INPUT event. So it is doing the test, and neither the REPROMPT_COUNT nor IS_FINAL_REPROMPT arguments are set.
If you're using the multivocal library, it will keep counters of all the Intents and Actions that are called (both for the session and sequentially) and has some macros that assist in your responses.
If you want to use the existing library, you'll need to keep track of this yourself and either store this in a Context or store it in the session data object.
If you intended to use this as part of a "no-input" response, you need to make sure you're using this with an Intent that has the actions_intent_NO_INPUT event set.
There is a new feature in the conversation service where you can define slots/ entities for specific intents to extract the relevant information from the user input like currencies or specific string inputs. Those slots can be set mandatory in case you need them to proceed and the user will be asked for missing slots until he provides them.
Is it possible to define sth. like quit parameter so I can easily interrupt this conversation? The general documentation does not provide any information regarding this problem.
https://console.bluemix.net/docs/services/conversation/entities.html#defining-entities
You can do it by adding node-level handler which will listen to your cancellation intent and fill the slots with dummy values.
You can read more about this approach in the documentation: https://console.bluemix.net/docs/services/conversation/dialog-build.html (paragraph "Handle requests to exit the process")