Add language understanding

APPLIES TO: Composer v1.x and v2.x

This article shows 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 bot explorer.
  2. In the properties pane, go to Recognizer/Dispatch type and select Change. The Choose a recognizer type menu will appear.
  3. Select Default and then select Done to set the recognizer type to LUIS.

Add language understanding data and conditions

  1. Select the desired dialog in the bot explorer. Select the three dots next to the dialog and then + Add new trigger.

  2. On the Create a trigger screen:

    1. Select Intent recognized for the trigger type.
    2. Enter a name for the trigger, like Goodbye.
    3. Enter example phrases in the Trigger phrases field using the .lu file format.
    - Bye.
    - Goodbye.
    - See you later.
    - Take it easy.
    

    Here's an example of what your screen should look like:

    Create a trigger screen showing the Goodbye example

  3. After you select 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 pane on the right. An example condition can be =#goodbye.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.

  6. Enter This is a greeting intent! in the response editor of the properties pane and press Enter.

Update LUIS keys

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

  1. Select the error icon in the upper right corner of Composer. The number 2 is next to it, indicating that there are two errors.

    These errors occur because you have yet to add the LUIS information Composer needs. After selecting the error icon, the Problems pane will appear on the bottom of the screen:

  2. Select the Settings link in blue in either of the errors. Composer will switch to the Azure Language Understanding of the Configure your bot page.

    Azure Language Understanding

  3. Select the Set up Language Understanding button. The Set up Language Understanding window will appear, shown below:

    Setup Language Understanding window options

The following sections explain the different options for setting up language understanding. Below is a link to each set up option and when to choose each:

Use existing resources

Choose this option if you already existing language understanding Azure resources for your bot.

  1. Select Use existing resources and then select Next at the bottom of the window.

  2. Now select the Azure directory, Azure subscription, and Language Understanding resource name.

  3. Select Next on the bottom. Your Key and Region will appear on the next on the next window, shown below:

    A message showing that your language understanding keys were successfully added

  4. Select Done.

Your bot is now ready to test.

Create and configure new Azure resources

Choose this option if you need to create and configure new Azure resources for language understanding.

  1. Select Create and configure new Azure resources and then select Next at the bottom of the window.

  2. Select the Azure directory and Azure subscription you want to use to create your resources.

  3. Fill in the values for the following on the next window:

    1. Azure resource group: An existing Azure resource group, or you can create a new one (seen in the screenshot below).
    2. Region: A region from the drop-down list.
    3. Language Understanding resource name: The name of your language understanding resource.
  4. Select the Next button. Blue text will appear on the bottom left of the window indicating that Azure is Creating resources.

  5. Once your resource has been successfully created, Composer will display the Subscription, Resource Group, Region, and Resource name, as show in the screenshot below:

    A message showing that your language understanding resources were successfully created and added to your project

  6. Select Done.

Your bot is now ready to test.

Generate instructions for Azure administrator

Choose this option if you need an administrator to create Azure resources for you.

  1. Select Generate instructions for Azure administrator and then select Next at the bottom of the window.

  2. Copy the instructions on the next window and send them to your Azure administrator. They will create the resources you need to LUIS in your bot.

    Generate Azure administrator instructions window

  3. Select Okay.

  4. Your administrator will send you a JSON with your bot's configuration information. On the Configure your bot page, toggle on the Advanced Settings View (json). Replace the existing JSON with the one supplied by your administrator.

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. Select Start bot on the top right to start your bot's local runtime.

  2. Once the bot is running, select Open Web Chat in the Local bot runtime manager.

  3. When Web Chat pops open, send it messages using the various utterances you created to see if it executes your Intent recognized triggers.

Next