MSFT CLU  Azure AI Conversational language.  A great update!

MSFT CLU  Azure AI Conversational language.  A great update!

Brad Crain

1 min read

As a mentioned in a previous post, CLU is a very good improvement over LUIS. By upgrading to CLU your solution gets improved accuracy of intent classification, multilingual support, one click integration with OpenAI to help in creating example utterances, and optional integration with Azure’s orchestration workflow service. These are all big wins!

For our chatbot solution, to refactor our chatbot authoring and runtime solution from LUIS to CLU was straightforward.  I mentioned in this post we first migrated our LUIS schema to one using CLU.  The next step was to enhance our authoring application so the chatbot author could specify they want to use CLU (and in doing so specify the endpoint, subscription key and other required information).  Then, I enhanced our bot runtime by adding a new CLU recognizer.  

This recognizer calls the CLU endpoint passing in the user utterance, then analyzed CLU’s return results, filtering out the top intent which the chatbot solution then used to determine the appropriate chatbot response.

 

        //get bot info about CLU endpoint and related properties, setup data to pass in to routine to make CLU call

let endpointInfo = getAIInfo(botInfo.getCoreProperties(botId),1);

const apiRequestInfo = {

     "kind": "Conversation",

     "analysisInput": {

         "conversationItem": {

             "participantId": "ebotspotruntime-1-"+botId,

             "id": "ebotspotruntime-1",

             "modality": "text",

             "language": "en",

             "text": str

         }

     },

     "parameters": {

         "projectName": endpointInfo.projectName,

         "deploymentName": endpointInfo.deploymentName

     }

}

//call CLU endpoint, check for return results, return top intent if found

getData (endpointInfo,apiRequestInfo,function (err,endpointurl,results) {

     if (err) {

             appinsights.logException('runtimecluutteranceintentrecognizer err on return from call to getData', {});

     } else if (!results || (results === null)){

             appinsights.logException('runtimecluutteranceintentrecognizer Null results returned from call to getData', {});

     } else {

         if (results.result.prediction && results.result.prediction.topIntent && results.result.prediction.topIntent.length>0){

             recognized.intent = results.result.prediction.topIntent;

             recognized.score = 1;

             appinsights.logEvent ('topIntent exist',{recognized:recognized});

            }

     }

     callback.call(null, null, recognized);

}); //getData

 

Code above - a portion of the recognizer logic