Ram Prasad
 

Microsoft Bot Framework: Adding common intents to the dispatch LUIS app.

May, 28 2019
 
2 min/s
 
 

Go directly to the steps for adding a common cancel intent in the dispatch LUIS app

Dispatch is a special type of LUIS app which helps in routing a user’s action to the correct module from different models. For a bot which handles Service Desk requests, Meeting rooms booking & answers generic questions, we may design the following models with a dispatch tool

The dispatch tool is used to create the dispatch LUIS app, where the 2 LUIS Apps and the QnA Knowledge Base are added as sources. Once it is created, we can see that there are three intents (one each for the 2 LUIS Apps and one for the QnA Knowledge Base) created in the dispatch LUIS APP.

Upon the receiving the message from the user, within the OnTurnAsync method a call is made to the dispatch LUIS app, which returns the top intent. Based on this intent we can identify which Bot model to call, i.e., QnA KB or ServiceDeskOps LUIS or MeetingRoomsBooking LUIS.

Cancel Intents

There could be scenarios where one might want to create intents for cancelling an action/dialog. Now there are two possible ways to do this. With each approach having its own pros and cons.

Separate Intent in each LUIS App:

We can create a cancel intent in each of the LUIS Apps and refresh your dispatch model. In this case we identify the cancel intent from the individual LUIS App. This approach is used when we want different conversation flows/paths for each cancel operation. The first call to dispatch identifies which model to call. And second call to the respective LUIS app finds the cancel intent.

Common Intent in the dispatch LUIS App:

There could be scenarios where having a common intent in the dispatch LUIS app would be helpful. If the dispatch LUIS app itself can identify the user’s cancel intent, we can avoid calling the subsequent LUIS calls and immediately take action. This could be helpful for common cancellation flows.

Follow these steps for creating a cancel intent in the dispatch LUIS app using dispatch tool

  1. Create a text file called ‘dispatch_cancel.txt’ with utterances for this intent. Each utterance to be written in a separate line in the txt file.
    stop
    cancel
    exit
    I want to cancel
    I do not want
    I dont need
    I dont want 
    I want to cancel
    I want to stop this
    halt
    end
    close
    finish
    terminate
  2. Use the following dispatch command line code to add a source of type file to the dispatch model.
    dispatch init -b BotConfiguration.bot
    

    dispatch add -t file -name dispatch_cancel -f C:\Users\ram\botmodels\dispatch_cancel.txt

    dispatch refresh

  3. If you have the dispatch LUIS created already, refresh the model. Create the dispatch model if you haven’t created it already.
  4. This will create a new intent in your dispatch LUIS App

Now, the first call to the dispatch LUIS app, will identify if the users intent was to cancel an action without subsequent calls to the individual LUIS models/apps.