Creating an Enterprise Bot with LUIS & QnA Maker from Microsoft Cognitive Service

Today, I would like to share how can we create an Enterprise Bot with Language Understanding Intelligent Service (LUIS) & QnA functionality.

Purpose

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.

Pre-requisites:

  1. Microsoft Visual Studio 2017 and above.
  2. Latest Azure CLI installed – (Download here)
  3. An Active Microsoft Azure subscription – (Sign up here for a trial if don’t have one)
  4. NodeJS’s NPM must be installed.
  5. Bot Framework Emulator – (Download here)

Steps:

  1. Create a new project with Microsoft Visual Studio (VS). Upon writing, I am using Microsoft Visual Studio 2017.
  2. Click Online tab and search, install & create with “Enterprise Bot” template online.
  3. 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)
  4. On Windows PowerShell, go to the directory of your project is located. In my case, type cd “C:\Users\MarvinHeng\Documents\Visual Studio 2017\Projects\TechconnectBot\TechconnectBot”

  5. 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
  6. 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.
  7. Set the Azure Subscription (in my case, it will be Visual Studio Enterprise) with the command – az account set –subscription “Visual Studio Enterprise” .
  8. Install LUISGen tool by command – dotnet tool install -g luisgen.
    LUISGen allows auto generate backing C#/Typescript classes for your LUIS intents and entities
  9. Now, we have to get LUIS authorization key from 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.
  10. Create an App ID at https://apps.dev.microsoft.com/
  11. Then, generate a new password and remember the application ID & password .
  12. 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 “DeploymentScripts\en” –location “westus” –appId “<YOUR_APP_ID>” –appSecret “<YOUR_APP_PASSWORD>”

  13. Middle of the cloning, it will prompt to verify the device.
  14. Wait until it finished all the required services are being provisioned.
  15. Once provisioned, you should see .bot file is being created in your Bot project.
  16. 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

 

About hmheng

Marvin possess a strong passion in smart AI, bot & cloud development. He is good in planning, executing duties along with stakeholders to achieve goals. Equipped with broad experiences and skills to work across different industries. Awarded with Microsoft MVP in 2018. “To me, bringing new ideas into reality is great excitement and achievement.”

View all posts by hmheng →

2 Comments on “Creating an Enterprise Bot with LUIS & QnA Maker from Microsoft Cognitive Service”

Leave a Reply

Your email address will not be published. Required fields are marked *