Add LUIS for language understanding

This article will instruct how to integrate language understanding in your bot using the cloud-based service LUIS. LUIS lets your bots identify valuable information from user input by interpreting user needs (intents) and extracting key information (entities). Understanding user intent makes it possible for your bot to know how to respond with helpful information using language generation.

Prerequisites

Update the recognizer type to LUIS

Composer uses recognizers to interpret user input. A dialog can use only one type of recognizer, each of which are set independently from the other dialogs in your bot.

  1. Select the dialog that needs language understanding capabilities in the Navigation pane.

  2. In the Properties panel, select Default recognizer from the Recognizer Type drop-down list.

    Default recognizer

    Note

    The Default recognizer can be one of the following recognizers:

    • None - do not use recognizer.
    • LUIS recognizer - to extract intents and entities from a user's utterance based on the defined LUIS application.
    • QnA Maker recognizer - to extract intents from a user's utterance based on the defined QnAMaker application.
    • Cross-trained recognizer set - to compare recognition results from more than one recognizer to decide a winner.

Add language understanding data and conditions

  1. Select the desired dialog in the Navigation pane. Click the three dots next to the dialog and then click + Add a trigger.

    Create trigger

  2. On the Create a trigger screen.

    1. Select Intent recognized for the trigger type.
    2. Enter a name for the trigger, like Greeting.
    3. Enter example phrases in the Trigger phrases field using the .lu file format.
     - Hi!
     - Hello.
     - Hey there.
    

    This is what your create a trigger screen should look like:

    Intent recognized trigger

  3. After you click Submit, you will see the trigger node created in the authoring canvas.

  4. If you want to specify a threshold for a specific intent, set a condition for this intent in the Condition field on the Properties panel on the right. An example condition can be =#greeting.score >=0.8.

  5. You can add actions to execute when the trigger fires, for example, the send a response action. Create a new action by selecting the plus (+) icon in the Authoring canvas, then Send a response from the drop-down list.

    Send a response

  6. Enter This is a greeting intent! in the response editor of the Properties panel.

    Greeting message image

    Tip

    The message in the response editor is defined in the .lg file format.

Update LUIS keys

After you are done with all previous steps you need to provide Composer with information from LUIS.

  1. Go to your LUIS resource in the Azure portal and copy your LUIS Authoring key and Location. You will need these values in the next step.

  2. Go back to Composer and click the Project Settings on the left.

  3. Select the dialog associated with the LUIS data you created. On External Services section, paste your Authoring key and Location into the LUIS authoring key and Location fields, seen below:

    External services

  4. To find the LUIS authoring key from your LUIS Authoring resource in Azure portal:

    Find LUIS authoring keys

The keys will be saved automatically. Your bot is now ready to test.

Test

It's always a good idea to verify that your bot works correctly when you add new functionality. You can test your bot's new language understanding capabilities using the Emulator.

  1. Click Start bot on the top right to start your bot's local runtime.

    Start bot

  2. After the bot finishes building click the Test in Emulator button that pops up in the Local bot runtime manager.

    Test in Emulator button

  3. When the Emulator is running send it messages using the various utterances you created to see if it executes your Intent recognized triggers.

    Emulator image

Next