Exercise 4 – Creating an AI solution using a Bot Service
This section will look at the steps to create a Bad Joke Knowledge Base (KB) Bot Service as part of AI Cognitive Services. This could be the basis for building any customer services chatbot or conversational client application.
In the following subsections, the process of creating a solution has been segregated into tasks for ease of understanding.
Task – Accessing the Azure portal
- Log into the Azure portal: https://portal.azure.com. Alternatively, you can use the Azure desktop app: https://portal.azure.com/App/Download.
Task – Creating a QnA maker
- From a browser, enter the following URL: https://www.qnamaker.ai.
- Sign into this site using the Microsoft account associated with the Azure subscription you wish to use.
- Once you’ve signed in, from the Create a knowledge base screen, click on Create a QnA Service via STEP 1 of the QnA Maker site. Upon doing this, you will be redirected to the Azure portal, which will open in a new browser tab:
Figure 5.42 – Create a QnA Service
5. From the QnA Maker Create blade, from the Basics tab, set the Subscription and Resource group settings as required:
- Name: Enter a unique name to be used.
- Pricing tier: Select Free F0.
- Azure Search location: Choose a location.
- Azure Search pricing tier: Select Free F.
- Website location: Chose a location.
- App Insights location: Choose a location.
- Click Review + create.
- On the Review + create tab, review your settings; you may go back to the previous tabs and make any edits if required. Once you have confirmed your settings, click Create.
- When the deployment is complete, you will receive a notification stating that the deployment succeeded. Return to the QnA Maker portal and from STEP 2, click Refresh.
Task – Configuring QnA Maker
9. From STEP 2, select the following as required; Microsoft Azure Directory ID, Azure subscription name, Azure QnA service, and Language:
Figure 5.43 – Connecting the bot service
- From STEP 3, name your KB as you wish.
- From STEP 4, choose a Chit-chat setting.
- From STEP 5, click Create your KB; an empty QnA will be created:
Figure 5.44 – Creating a bot knowledge base
- From the QnA Knowledge base screen, click Add QnA pair; this will add a new row to the KB table.
- In the Question cell, enter your question (or input) text; in the Answer cell, enter your answer (or response) text:
Figure 5.45 – Populating the bot knowledge base
- Repeat Steps 19 and 20 as required.
- Click Save and train from the top-right toolbar.
Task – Testing the solution
- From the top toolbar, click -> Test.
- Enter text from the question values you created earlier; the answer value you created will be returned. In our example, the response is the joke punchline; the following are some examples:
Figure 5.46 – Testing the bot knowledge base
19. With that, we have completed this chapter’s exercises.
This section covered various hands-on exercises. Now, let’s summarize this chapter.