0
votes

i'm new with luis and bot framework. what i learned until now is how to trigger a dialog by an intent recognized by luis. but i don't know how to send a message to luis inside a dialog. i want to use the 'builder.EntityRecognizer.findEntity' method. i'm pretty sure that my builder.prompts.text just gives me the pure text as a result, not the intents and entities of this text recognized by LUIS. but i can't find a solution how i can send a single request to luis, to get back a luis-json object which i think is needed for the 'findEntity' method.

bot.dialog('reklamation',[
function(session){
    session.send('Gerne kümmere ich mich um Ihre Reklamation.');
    builder.Prompts.text(session, 'Bitte nennen Sie mir Ihr Anliegen.');
},
function(session, results){
    session.dialogData.reklamation = results.response;
    session.send('Ich habe Ihre Mitteilung aufgenommen.');
    builder.Prompts.text(session, 'Bitte geben Sie mir eine E-Mail-Adresse, unter der wir Ihnen den aktuellen Stand Ihrer Reklamation mitteilen können.');
},
function(session, results){
    var email = builder.EntityRecognizer.findEntity(results.entities, 'email');
    session.dialogData.email = email;
    session.send('Ok! Ich habe folgende Informationen gespeichert:');
    session.send('Reklamationsgrund: ' + session.dialogData.reklamation);
    session.send('E-Mail: ' + session.dialogData.email);
    session.endDialog('Wir werden uns schnellstmöglich mit Ihnen in Verbindung setzen. Vielen Dank für Ihre Anfrage!');
}]).triggerAction({
matches: 'reklamation'});

I appreciate any suggestion.

1

1 Answers

2
votes

The entities are retrieved in the first step of the waterfall. The intent is basically defined in the matches. So your code will be triggered if your LUIS app has a intent "reklamation"

Then you need to update the signature of the first function to:

bot.dialog('reklamation', [
    function (session, args, next) {

Then you can use:

builder.EntityRecognizer.findEntity(args.intent.entities, 'email');

If what you are looking is to call LUIS manually after the first step of the waterfall, you can try with:

builder.LuisRecognizer.recognize("your input", modelUrl, (err, intents, entities) { ... }

Take a look at the LUIS Node.js sample for more information.