Reputation: 39
This post is in context to bot framework in C#(.Net)
so i wanted to know that if my expected utterance from the user is:
"show me the projects starting on 3rd march"
but the user misses the date entity and writes
"show me the projects starting on"
now i want to prompt the user for the date(which is the missing entity) that please mention the date.
and then simply run the intent now.
Which is the best approach to take it forward ?
Upvotes: 1
Views: 401
Reputation: 27805
In Nicolas R’s reply, he has shared idea and approach to achieve your requirement, you can refer to it.
Besides, you can refer to the following sample code to prompt for providing the date when the specific intent is reached and required entity is missing.
[Serializable]
public class BasicLuisDialog : LuisDialog<object>
{
string bdate;
public BasicLuisDialog() : base(new LuisService(new LuisModelAttribute(
"{ID_here}",
"{subscriptionKey_here}",
domain: "westus.api.cognitive.microsoft.com")))
{
}
//....
//for other intents
[LuisIntent("GetProjectInfo")]
public async Task GetProjectInfoIntent(IDialogContext context, LuisResult result)
{
if (result.Entities.Count == 0)
{
PromptDialog.Text(
context: context,
resume: ResumeGetDate,
prompt: "Please enter the date",
retry: "Please try again.");
}
else
{
await this.ShowLuisResult(context, result);
}
}
public async Task ResumeGetDate(IDialogContext context, IAwaitable<string> mes)
{
bdate = await mes;
await context.PostAsync($"You reached GetProjectInfo intent. And you entered the date: {bdate}");
context.Wait(MessageReceived);
}
private async Task ShowLuisResult(IDialogContext context, LuisResult result)
{
await context.PostAsync($"You have reached {result.Intents[0].Intent}. You said: {result.Query}");
context.Wait(MessageReceived);
}
}
Test result:
Upvotes: 3
Reputation: 14619
Which is the best approach to take it forward ?
Upvotes: 2