Bot Framework v4 NLP with Dispatch bot sample
This bot has been created using Microsoft Bot Framework, it shows how to create a bot that relies on multiple LUIS.ai and QnAMaker.ai models for natural language processing (NLP).
This samples requires prerequisites in order to run.
Dispatch CLI is a tool to create and evaluate LUIS models used for NLP (Natural Language Processing). Dispatch works across multiple bot modules such as LUIS applications, QnA knowledge bases and other NLP sources (added to dispatch as a file type).
Use the Dispatch model in cases when:
- Your bot consists of multiple modules and you need assistance in routing user's utterances to these modules and evaluate the bot integration.
- Evaluate quality of intents classification of a single LUIS model.
- Create a text classification model from text files.
-
Clone the repository
git clone https://github.com/Microsoft/botbuilder-samples.git
-
In a terminal, navigate to
samples/javascript_nodejs/14.nlp-with-dispatchcd samples/javascript_nodejs/14.nlp-with-dispatch -
Install modules
npm install
-
Setup LUIS
Assuming prerequisites have been installed:
# log into Azure az login# set you Azure subscription az account set --subscription "<azure-subscription>"
# Create the LUIS & QnA Maker service applications msbot clone services --name "<your_bot_name>" --luisAuthoringKey <LUIS-authoring-key> --code-dir "." --location westus --sdkLanguage "Node" --folder deploymentScripts/msbotClone --verbose
-
Start the bot
npm start
Microsoft Bot Framework Emulator is a desktop application that allows bot developers to test and debug their bots on localhost or running remotely through a tunnel.
- Install the Bot Framework Emulator version 4.2.0 or greater from here
- Launch Bot Framework Emulator
- File -> Open Bot Configuration
- Navigate to
samples/javascript_nodejs/14.nlp-with-dispatchfolder - Select
nlp-with-dispatch.botfile
Dispatch is a CLI tool that enables you to create a dispatch NLP model across the different LUIS applications and/ or QnA Maker Knowledge Bases you have for your bot. For this sample, you would have already created 2 LUIS applications (Home Automation and Weather) and one QnA Maker Knowledge base.
After creating the bot and testing it locally, you can deploy it to Azure to make it accessible from anywhere. To deploy your bot to Azure:
# login to Azure
az loginAs you make changes to your locally running bot, you can deploy those changes to Azure Bot Service using a publish helper. See publish.cmd if you are on Windows or ./publish if you are on a non-Windows platform. The following is an example of publishing local changes to Azure:
# build the TypeScript bot before you publish
npm run build# run the publish helper (non-Windows) to update Azure Bot Service. Use publish.cmd if running on Windows
./publishTo learn more about deploying a bot to Azure, see Deploy your bot to Azure for a complete list of deployment instructions.