Chat Bot - Adding Language Understanding Service

Introduction 

 
In this article, we are going to add a Language Understanding Service - LUIS to our chatbot. LUIS uses machine learning, which is helpful to developers to build applications that can create user input in natural language which can get meaning from it. As we have developed a chatbot-botD in Microsoft Azure, we will now move on with further steps to give it a realistic view of the end-user understanding.
 

Bot Lab

 
For building an intelligent bot, first we have to collect a few lab tools:
  1. Azure subscription with Microsoft VS Dev Essentials. 
  2. Download Microsoft Visual Studio 2019 or any newer version
 
Open Visual Studio and go to TOOLS

Click on GET TOOLS AND FEATURES. Microsoft Visual Studio must have these workloads:
  • ASP.NET and Web Development
  • Azure Development
  • .NET Cross-Platform Development
  1. Open a new browser tab and navigate this link. Select download and open it. Complete the modify step.
  2. Open a new browser tab and navigate this link, Select the CLONE repo from the Git or DOWNLOAD the code from your browser. Note: uncompress/clone your code to Download/ailabs. Copy the Content of BuildAnIntelligentBot folder to Download/buildanintelligentbot.
  3. Installation of Bot Builder SDK v4: Bot Framework Emulator:
Open a new browser tab and navigate here:
 
Download the .exe file of the 4.x version and complete your installation (if you already have it, then you can skip this step.)
 
 
Here, all the lab materials are downloaded on our Windows system. 
Once we're with the basic bot, we will move towards the next step where our bot should understand the natural and complex conversation using LUIS capabilities. LUIS has a standalone portal for building models using Azure Cognitive Services.
 

Create a LUIS Subscription

 
Step 1 - Create a resource in Azure
 
Open Azure Portal -> Create new resource -> type Language Understanding Select the first option and choose Create. 
 
 
Step 2
 
Fill the required information
  • App Name: chatbot-luis-<give a name here> 
  • Location: West US
  • Pricing tier: F0
  • Use existing resource group: ttmb-lab-<mention the name as given above> 
Click on Create. Wait until the deployment is completed. Check the notification Deployment Succeeded
 
 
Step 3
 
Go to all resources and search for the new resource chatbot-luis-botD, the botD name I gave in the first step to my app information. 
 
Select this resource and go to Keys and Endpoint page. Copy the Key 1 value to Notepad. We will use it later on.
 
 
Step 4
 
Log in to Luis Portal. Use the same credentials as Azure Portal. 
 
If this is your first time logging then you will get a welcome message. Follow these steps,
  • Scroll down the page, select Create Luis app 
  • Select United States from the country list
  • Checked I Agree and select Continue
Step 5
 
From My Apps, select chatbot-botD which we had already deployed with the Web App Bot. 
 
 
Step 6
 
Click on the Manage option.
 
Step 7
 
Copy the LUIS Application ID to Notepad.
 
 
Step 8
 
Select the Versions Option. Click on Import Version
 
Click on Choose Version File. Select From \Downloads\buildanintelligentbot\resources\talk-to-my-bot.json file. Then click on Done.
 
 
Wait for the import to complete.
 
Step 8
 
Click on the Train Button and wait until this is finished. Then, click the Test Button. It opens a testing panel to the right side. 
 
 
Type a sentence there: I need a dinner reservation, then click Enter. It will return an intent with the name ReserveTable.
 
 
Click on Test Button to close this Testing Panel. 
 
Step 9
 
Now we will add a new intent: 
 
Click on Build-> Intent -> Create new intent 
 
Type new intent: TodaysSpecialty
 
Click on Done
 
 
Step 10
 
Add utterance to our intent, we will type as an example: what is the specialty for today? Press Enter.
 
Add one more, what's the dish of the day? Press Enter.
 
 
Test tour new intent. Click on the Train button, and type in the testing panel what's today's special? Press enter: the Test should return TodaysSpecialty intent.
 
Step 11
 
Click on the Manage Option. Go to Azure Resources and copy the authoring key to Notepad. We will need it later on. 
 
Note
If you didn't find the Azure Resources, then Assign Resource will be there. Fill the instructions and get the authoring key.
 
 
Step 12
 
Click on the Publish Button. Choose production from the slot and wait until the process has finished. 
 
 
Your application published successfully on LUIS Cognitive Service. 
 
 
This is the onetime process for the chatbot.
 
Reference Link
 
https://aischool.microsoft.com/en-us/conversational/learning-paths 
 

Summary

 
In this article, we discussed the LUIS cognitive service tool from our lab tools. It is a crucial part of setting up the end-user conversational understanding of natural languages with machines. Moreover, we built an intelligent chatbot with Artificial Intelligence, where LUIS has the best ability of fairness and diversity. Furthermore, we went through the Visual Studio and Bot Emulator to run our application using these tools.