Reputation: 1182
I'm using a LuisDialog
, and I would like to know how to use the LuisResult
to detect the actions, parameters and prompt the user for the missing parameters. I know the LuisResult
already contains the actions and parameters, however I don't know what is the best way to prompt the user, or how to send that information back to LUIS using the contextId
. I wasn't able to find any example regarding this subject on the BotBuilder SDK or on the web in general.
Upvotes: 1
Views: 252
Reputation:
My rough approach would be this. For instance, you're expecting some entities in the LuisResult
. If they're missing, you want to prompt the user for them.
First you'll check which entities are missing. If something is missing, prompt the user and redirect their response to another method that will process the new data. The LuisResult that was already received will need to be saved in ConversationData
first.
var requiredEntities = new List<string>()
{
"builtin.places.place_name",
"builtin.places.place_type"
};
string askForMore = null;
foreach(var entity in requiredEntities)
{
EntityRecommendation temp;
var found = result.TryFindEntity(entity, temp);
if (!found)
{
//Prompt the user for more information
askForMore = entity;
}
}
if (askForMore != null)
{
//TODO: store values from existing LuisResult for later use
//For example, use ConversationData for storage.
context.PostAsync("Please enter value for entity " + askForMore);
context.Wait(AdditionalUserInputReceived);
}
else
{
//do normal stuff
}
This is a fully manual way, I assume there could be more automation by combining FormFlow
with a LuisDialog
, but with less flexibility
Upvotes: 1