Azure Cognitive services for language provides functionalities for understanding and analyzing the text. Among the various features, Conversation Language Understanding (CLU) allows the bot to identify the intent of the text from users input. Based on the intent, Bot can perform the required action. CLU is the next generation of LUIS.
Prerequisite:
1.Azure Subscription
Find the below steps to create language resource and CLU project.
To create a Language Resource
In Azure Portal choose Language->Create ->Custom question answering
Login to the Language Studio and select the resource created in Azure portal.
In the Language Studio,Create New Project ->Conversational Language understanding ->Enter basic information and click create.
From the incoming utterance, there will be intents and entities.
Find the below steps to be followed in CLU recognition.
Step 1: Define the action and corresponding information that needs to be identified from users activity (utterances)
Intent – This is the overall action to be performed from the user’s input.
Entities – Entity can be predicted if a word from user input exactly matches the word from entity list.
Let’s assume, Input: Apply leave in Oct 6th2023.
Intent – Apply leave.
Entities – From, To
In the Schema definition- >Add Intent, add sample intent (“Apply leave”)
2.Data Labelling
In the right-side Activity Pane ->Add entities,
Date,FromDate,EndDate
Choose the Intent and add utterances. Select the word and choose the entity.
Save the changes.
3.Training jobs: With the given model, create a new training job.
4.Deploying a model: Choose the trained model for deployment.
5.Testing deployment
Choose the deployment to be tested and enter the input to identify the intent and entities from the utterances.
Copy the solution from below Git URL where all codes for CLU implementation on echo bot has been added.
https://github.com/BharathiDemo/CLUBot.git
In appsettings.json
, add all the respective Ids.
CluProjectName – Project name created.
CluDeploymentName – Last deployment model tested in Language studio.
CluAPIKey – Key1 in below image
CluAPIHostName – Endpoint in below image without https://
Now the solution can be deployed and tested in Bot framework Emulator/Teams App/ Test in Webchat in Azure Bot service as mentioned in the previous blog.
Conversational Bot deployments – Athen
Below is the result of the above solution in Bot framework emulator. The source code for the below result can be found in below GIT URL.
https://github.com/BharathiDemo/CLUBot.git
Bot Composer
The same CLU logic can be explained in Bot composer as below.
1.Download and install Bot Composer.
2.Open Bot Composer and Create new Empty Bot
3.Go to Package Manager ->Install ” Microsoft.Bot.Components.Recognizers.CLURecognizer “(Any version)
4.In project, Right pane ->Recognizer/Dispatch type ->Click Change and choose “Custom”
5.Enter the CLU details as retrieved from the language studio.
{
"$kind": "Microsoft.CluRecognizer",
"projectName": "<your project name>",
"endpoint": "<your endpoint, including https://>",
"endpointKey": "<your endpoint key>",
"deploymentName": "<your deployment name>"
}
6.Select the trigger type as “Intent Recognized” and name the trigger
7.
8.Choose the required action when the intent is recognized.
For our demo, I have chosen Send Response and given text “Leave applied.”
Now start the Bot in Bot composer and choose “Open in Web Chat “.
Input : Apply leave on Oct 7th
Response:
Hope this blog explains the implementation of CLU in echo bot.
No Comment! Be the first one.