LUIS (Language Understanding) is a cloud-based conversational AI service that applies custom machine-learning intelligence to a user’s conversational, natural language text to predict overall meaning, and pull out relevant, detailed information. Learn more about it here.
A client application for LUIS is any conversational application that communicates with a user in natural language to complete a task. It becomes especially usefull when creating a chatbot to provide the ability to comunicate using human language. The communication between LUIS and Azure Bot is done using JSON.
In the Bot Framework Composer select the Core Bot with Language template and click Next. This will allow you to create a sample bot with LUIS capabilities.
Name your bot accordingly and then click Create.
You might be asked to login using your Microsoft account.
Once your bot is created, you will se an error pop up. Select the Set up Language Understanding requirement to proceed with LUIS.
Select the Create and configure new Azure resources option to create a new LUIS resource. Then click Next.
You might need to login to your Microsoft account again. Then select your Azure directory and subscription. Click Next to continue.
Pick a name for your LUIS resource, the resource group you want to include it and your preferred region. After that click Next to proceed.
Once you hit Done, your LUIS resource has been already created!
If you take a look in your resource group you will now find a new LUIS resource available.
CLick Start bot in the composer to run your bot.
Once your bot is up and running you can test it using the emulator or the Web Chat. We will use the Web Chat for now, so you do not need to download the emulator. However for larger projects, downloading the emulator is adviced.
Add an Intent
Once you are sure that your bot works as expected, you can add new intents to LUIS. If you want to learn more about intents and how LUIS works, you can read about it in this post. To add an intent, navigate to the Create tab of the composer, click the three dots next to your bot’s name and select Add New Trigger.
Leave the first field as Intent recognized. The second field is the name of your intent (or trigger). The Trigger phrases field should contain the utterances that correspond to your intent. It is very important to start each utterance with “- “ in a new line.
For this example we will create a How Are You intent and the utterances we will use are presented below.
- How are you? - Are you well? - How are you doing? - Is everithing fine today?
Now you can see in front of you the newly created trigger, which corresponds to one LUIS intent. Click the “+” icon and then Send a response to customize the massage that will appear after this intent is detected.
Write your bot’s response in the Text field and click Restart bot to run you bot.
If you take a look at your new LUIS resource at https://www.luis.ai/, you will find the new intent you just created along with all the utterances synced automatically.
Back to the bot, while it is running open the Web Chat and try your new intent. The bot should be responding with your custom text.
And this is how to intergrade LUIS into an Azure Bot!