Nguyen Ngoc Tuan
Nguyen Ngoc Tuan

Reputation: 351

Get Intent from user response in a waterfall dialog

I am working with LuisDialog. For a specific intent, I have a waterfall dialog to get information from user. In this process, I want to parse user's sentence/response with LUIS.

luisDialog.on('orderItem', [
  function (session, args) {
    builder.Prompts.text(session, "Please enter your item ID:");
  },
  function (session, results) {
    // parse user's response with LUIS
    // User can text: "1245" or "my item ID is 1245"
    // Need to get "1245" as item_number which is an entity in LUIS train model
  }
]);

Is there any ways to achieve this purpose?

Upvotes: 2

Views: 858

Answers (2)

Atin Singh
Atin Singh

Reputation: 11

You can do it like this.

bot.dialog("/schedule", [
    (session, args, next)=>{
        builder.Prompts.text(session,"When do you prefer new appoitment");
     },
    (session,results,next)=>{
        session.sendTyping();
        builder.LuisRecognizer.recognize(results.response,model, (err,intents,entities)=>{
                if(err){
                    console.log("Some error occurred in calling LUIS");
                }
                console.log(intents);
                console.log("==================");
                console.log(entities);
        });

    }
]);

Upvotes: 1

Ian Boggs
Ian Boggs

Reputation: 542

I don't know if there is a way to do it directly with node.js. However, LUIS has a REST interface. This would enable you to call the service and manually process the JSON returned to get the data you need.

So you can make a call to

https://api.projectoxford.ai/luis/v1/application?id=applicationid&subscription-key=subscriptionkey&q=my item ID is 1245

using your REST client of choice. You'll get a JSON response back that you can process to extract the data you need. applicationid and subscriptionkey should be replaced with the appropriate values for your Luis Model

Upvotes: 1

Related Questions