Today, I would like to share how can we create an Enterprise Bot with Language Understanding Intelligent Service (LUIS) & QnA functionality.
To introduce how organization can create an Enterprise Bot that allows human-like interaction and it is designed to cater for their business needs. Upon setup, it will have simple function that answers QnA and allows customers/users to connect them via Microsoft Teams/Phone.
- Microsoft Visual Studio 2017 and above.
- Latest Azure CLI installed – (Download here)
- An Active Microsoft Azure subscription – (Sign up here for a trial if don’t have one)
- NodeJS’s NPM must be installed.
- Bot Framework Emulator – (Download here)
- Create a new project with Microsoft Visual Studio (VS). Upon writing, I am using Microsoft Visual Studio 2017.
- Click Online tab and search, install & create with “Enterprise Bot” template online.
- Once the project is created, you should be able to see an enterprise bot project under Solution Explorer on the right of VS.
(Note: Enterprise Bot project template doesn’t provide .bot file like Bot V4 template, we will learn how to generate one later)
- On Windows PowerShell, go to the directory of your project is located. In my case, type cd “C:UsersMarvinHengDocumentsVisual Studio 2017ProjectsTechconnectBotTechconnectBot”
- Install LUIS, QnAMaker, Dispatch, other services via NPM Command – npm install -g ludown luis-apis qnamaker botdispatch msbot chatdown.
- Dispatch – a tool to build language models allowing you to dispatch between disparate components.
- MSBot – Create and manage connected services in your bot configuration file.
- LUDown – Build LUIS language understanding models using markdown files
- Chatdown – Prototype mock conversations in markdown and convert the markdown to transcripts you can load and view in the new V4 Bot Framework Emulator
- Next, we have to login our Azure subscription on PowerShell. Type az login in PowerShell. It will redirect you to login via Azure logon page on browser. Once you’ve logged in, it will list out the subscriptions you have. Please also take note of the subscription name & ID as you will require that later.
- Set the Azure Subscription (in my case, it will be Visual Studio Enterprise) with the command – az account set –subscription “Visual Studio Enterprise” .
- Install LUISGen tool by command – dotnet tool install -g luisgen.
LUISGen allows auto generate backing C#/Typescript classes for your LUIS intents and entities
- Now, we have to get LUIS authorization key from http://www.luis.ai.
- Go to https://www.luis.ai and signin.
- Once signed in click on your name in the top right hand corner.
- Choose Settings and make a note of the Authoring Key for the next step.
- Create an App ID at https://apps.dev.microsoft.com/
- Then, generate a new password and remember the application ID & password .
- Next, let’s clone the services to our App. On PowerShell, type following command by replacing LUIS Authorization Key – msbot clone services –name “TechconnectBot” –luisAuthoringKey “<YOUR_AUTHORING_KEY>” –folder “DeploymentScriptsen” –location “westus” –appId “<YOUR_APP_ID>” –appSecret “<YOUR_APP_PASSWORD>”
- Middle of the cloning, it will prompt to verify the device.
- Wait until it finished all the required services are being provisioned.
- Once provisioned, you should see .bot file is being created in your Bot project.
- You may now run the project on your Visual Studio and test it using Bot Framework Emulator. As mentioned in the beginning of article, this bot service is supporting LUIS & QnA. You may try it out~!
Follow us @ https://www.facebook.com/techconnectio