2
votes

I am trying to give my LUIS the missing piece of information which it requires when the query has missing item. For example.

if someone says, i want to make an order. For this i need to know how many users. The LUIS on https://api.projectoxford.ai/luis/v2.0/apps/ automatically creates the context id when that ensures i am talking to this query.

How can i get or tell the same thing in Bot Framework when the LUIS Dialog Prompts the question for missing thing.

This is the code

[Serializable]
[LuisModel("something", "something")]
public class SimpleLUISDialog : LuisDialog<object>
{
 [LuisIntent("GetQuote")]
    public async Task GetQuote(IDialogContext context, LuisResult result)
    {
       PromptDialog.text(context, GetChildNumberAsync, "How many Users will you be adding ?", "Sorry please try again", 2);
    }
}


    private async Task GetUserNumberAsync(IDialogContext context, IAwaitable<string> result)
    {
       // send to LUIS again for checking the entity for number of users with Context ID
    }
}

This is what is written is LUIS Dialog on API (JSON)

"dialog": {
    "prompt": "How many users needed?",
    "parameterName": "NumberOfLicenses",
    "parameterType": "number",
    "contextId": "746024ff-a4eb-4f58-b014-42605a3cb757",
    "status": "Question"
  }
1

1 Answers

0
votes

It seems you are using ActionParameters in your LuisModel and that you are trying to fulfill them if they are not provided in the original message.

While you could do some "manual hacks" to call LUIS again as explained here (not with the context id, but simulating a new message), I wouldn't recommend that.

Instead, I would encourage you to take a look to the BotBuilder's develop branch (see commits from Nov-11) where the BotFramework team added support for LUIS v2 API and added some brand new capabilities; one of them, I believe is exactly what you are looking for.

With the latest changes, the LuisDialog will now act if your intent requires parameters and those are not provided. In that scenario, the LuisDialog will automatically launch and a LuisActionDialog and ask the user for the missing parameter, using the Prompt message you defined in the action parameter.

The last time I checked this wasn't published as NuGet package yet; but it might be worth checking again. In the worst case, you can temporarily download the BotBuilder's code and reference that in your project.

You will need to specify the API Version in your LuisModel attribute to start suing it.

[LuisModel("something", "something", LuisApiVersion.V2)]