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.
- A basic bot built using Composer
- Knowledge of language understanding and events and triggers
- A LUIS account and a LUIS authoring key
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.
Select the dialog that needs language understanding capabilities in the Navigation pane.
In the Properties panel, select Default recognizer from the Recognizer Type drop-down list.
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
Select the desired dialog in the Navigation pane. Click the three dots next to the dialog and then click + Add a trigger.
On the Create a trigger screen.
- Select Intent recognized for the trigger type.
- Enter a name for the trigger, like Greeting.
- 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:
After you click Submit, you will see the trigger node created in the authoring canvas.
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
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.
Enter This is a greeting intent! in the response editor of the Properties panel.
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.
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.
Go back to Composer and click the Project Settings on the left.
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:
To find the LUIS authoring key from your LUIS Authoring resource in Azure portal:
The keys will be saved automatically. Your bot is now ready to 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.
Click Start bot on the top right to start your bot's local runtime.
After the bot finishes building click the Test in Emulator button that pops up in the Local bot runtime manager.
When the Emulator is running send it messages using the various utterances you created to see if it executes your Intent recognized triggers.