0% found this document useful (0 votes)
83 views

Automation Week - Chatbot Lab - User Guide

This document provides step-by-step instructions to build a simple question and answer chatbot using Microsoft Azure services. It details how to create an Azure account, build the bot using the Azure portal, create a QnA knowledge base to store questions and answers, train and test the bot, publish and integrate the knowledge base, and host the bot on a custom HTML page. The goal is to outline the full process to develop a basic QnA chatbot solution on Azure from start to finish.

Uploaded by

ahlem
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
83 views

Automation Week - Chatbot Lab - User Guide

This document provides step-by-step instructions to build a simple question and answer chatbot using Microsoft Azure services. It details how to create an Azure account, build the bot using the Azure portal, create a QnA knowledge base to store questions and answers, train and test the bot, publish and integrate the knowledge base, and host the bot on a custom HTML page. The goal is to outline the full process to develop a basic QnA chatbot solution on Azure from start to finish.

Uploaded by

ahlem
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 27

Automation Week 2018

Build Your First Chatbot


User Guide

October 2018
Table of Contents

Purpose of the document ............................................................................................................................ 3


Scope ............................................................................................................................................................ 3
Prerequisites ................................................................................................................................................. 3
Creating an Azure account .......................................................................................................................... 4
Step by Step Guide ...................................................................................................................................... 5
1) Creating the bot ................................................................................................................................... 5
2) Creating the QnA knowledge base ................................................................................................... 13
3) Training the bot ................................................................................................................................. 18
4) Testing the bot................................................................................................................................... 19
5) Publishing the knowledge base ........................................................................................................ 20
6) Integrating the knowledge base with chatbot ................................................................................ 21
7) Hosting the bot in a Channel ............................................................................................................ 25

2|Page
Purpose of the document
The primary objective of this document is to detail out the steps to create an end to end
chatbot solution using Microsoft Azure Cognitive Services. The document shall cover all
information required to build, train, test and host a simple QnA bot.

Scope
The scope of the document is limited to outlining the steps involved in creating a simple QnA
bot using Microsoft Azure chatbot and QnA Maker service. Other advanced features of Azure
chatbots are out of scope of this document.

Prerequisites
All participants must have an active MS Azure subscription to get started (process is
described below) and must bring a laptop with them to the workshop to be able to create an
own chatbot!

3|Page
Creating an Azure account
Participants need to create a free MS Azure account (if not having one already) to proceed
with the next steps.

Important: The account needs to be created using a Non-Ericsson ID to avoid access


issues, i.e. when creating the account, one cannot use an @ericsson.com email address but
has to use a private one. This could be for example the Microsoft account one is already
using for Office 365 or a completely new one.

Note: Upon creation of the MS Azure account you will be asked to provide your credit card
information following which a nominal amount (around 1 USD) will be debited from your
account. Please note that this is a free account and the amount will be credited back in few
business days. This is just to validate the credit card and avoid spam. The usage of MS
Azure for the chatbot creation is completely free. You can read more about the conditions of
the free account here: https://azure.microsoft.com/en-us/free/

Login to https://portal.azure.com with your free MS Azure account or create a new one
using the Create One link below. Now you are ready to go!

4|Page
Step by Step Guide

1) Creating the bot

Log into the Azure portal and click on Create a resource option on the left menu bar

https://portal.azure.com

5|Page
Select Web App Bot under AI + Machine Learning section

Fill out the mandatory fields such as the bot name and resource group (create a new
resource group and name it the same way as the bot).

6|Page
Select the Bot Template option. On the right window make the following selections

SDK Version: SDK v3

SDK language: C#

Bot Type: Question and Answer

7|Page
Select App service plan/Location -> Create New. Enter App service plan name and Location.
Click on OK.

8|Page
Select Microsoft App ID and password -> Create New.

Click on Create App ID in the App Registration Portal link on the right most pane

Login to the portal using the same MS Azure credentials as before.

9|Page
Click on Generate an app password to continue button

Take a note of the password! Please note that this is the only time the password will be
displayed.

10 | P a g e
Navigate back to the Azure portal and enter the newly generated Microsoft App ID and
Password. Click on OK.

Click on Create.

11 | P a g e
Wait for the deployment to get completed

Once deployment is completed the following resources should get created.

12 | P a g e
We have successfully created a QnA Chatbot Client! Now we need to create a Knowledge
Base repository for our chatbot to interact with. This can be considered as a database for our
chatbot client. The knowledge base will store all the FAQs in the form of question/answer
pairs. Let’s proceed to the next section to create the knowledge base.

2) Creating the QnA knowledge base

Open the Microsoft QnA Maker portal using the link https://www.qnamaker.ai/

13 | P a g e
Login to portal using the same Azure credentials. Click on Create a knowledge base option
on the top menu bar. Click on Create a QnA service button as part of Step 1.

The azure portal should get launched in a new tab/window. Fill up the empty mandatory
fields and leave the others with their default values. Click on Create.

14 | P a g e
Wait for the deployment to get completed.

Once deployment is completed go back to the QnA Maker portal. Click refresh this page link
under step 2. Select the following drop downs.

1. Microsoft Azure Directory ID


2. Azure Subscription name
3. Azure QnA service

15 | P a g e
Enter a name for the Knowledge base as part of Step 3

Select the personality you want your chatbot to be as part of Step 4 and click on Create your
KB button as part of Step 5.

16 | P a g e
Wait for the Knowledge Base to get created.

17 | P a g e
3) Training the bot

Click on + Add QnA Pair to train the knowledge base with new Question/Answer pairs.

Click on the Save and train button. Wait for the training to get completed.

18 | P a g e
We have now successfully trained the system with all the Question/Answer pairs available in
the repository.

4) Testing the bot

Click on the Test button. Use the test window to chat with the bot. Use variations in sentence
construction to test the Natural Language Understanding capabilities of the bot.

19 | P a g e
5) Publishing the knowledge base

Click on the Publish tab.

Make note of the Knowledge based id, Hostname and the Authorization key. The
information will be needed to integrate the knowledge base with the chatbot we created in
Azure.

20 | P a g e
6) Integrating the knowledge base with chatbot

Navigate back to the azure portal and select the chatbot App Service.

Note: There will be multiple resources listed in the dashboard. Select the App Service and
not the Web App Bot.

Scroll down and select Application settings. Fill the QnAAuthKey, QnAEndpointHostName,
QnAKnowledgebaseId properties with the publish information of the knowledge base
available in the QnA Portal (see below).

21 | P a g e
Note: the order of QnAKnowledgebaseId, QnAEndpointHostName, QnAAuthKey in the QnA
Portal is the other way around in MS Azure. Furthermore, make sure to only copy and paste
the parts underlined in the screenshot below:

QnAKnowledgebaseId
QnAEndpointHostName
QnAAuthKey

22 | P a g e
Click on Save.

Navigate back to the Dashboard where all the resources are listed and select the Web App
Bot.

23 | P a g e
Test the chatbot using the Test in Web Chat option

We have now successfully integrated the QnA Knowledge base with our Chatbot client!

24 | P a g e
7) Hosting the bot in a Channel

We now need to host our chatbot client in one of the channels (in this case a web page) to
be able to use it. As part of this exercise we will be using a custom HTML page. Please use
the HTML file embedded in this document by clicking on the icon:

Click on Channels option.

Click on the link (“Get the embed codes”) to open the Web Chat configuration page.

25 | P a g e
Click on Show under any of the Secret Keys and make note of the key.

Make note of the Embedded Code.

26 | P a g e
Save the embedded HTML file on your desktop. Open to edit with any preferred text editor
(Notepad++ recommended)

Replace the ‘src’ attribute with the embedded code and replace the YOUR_SECRET_HERE
text (within the embedded code) with the secret key. Save the file and close the editor.

Now open the saved HTML file in your preferred browser. Now started using the chatbot
from the newly hosted channel.

CONGRATULATIONS! You have successfully Created -> Trained -> Tested -> Hosted an
end to end chatbot solution.

Have fun with your bot!

--- END ---

27 | P a g e

You might also like