Practice Exams:

AI-102 Microsoft Azure AI – Implement Conversational AI Solutions

  1. Overview of QnA Maker

Now we’re on to the last section of this course and the last section of the exam which says implement conversational AI solutions currently worth 15% to 20% of the overall score. Now, conversational AI is just as it sounds. You have a human on one side and a computer on the other and a human is able to ask the computer a question in and the computer is able to respond to that question. In some bot scenarios it might even respond with a question and then the human has to provide an additional answer. And so really you’ve got a computer and a human going back and forth in a conversation. Now hopefully that conversation has a purpose.

The human is looking for information or looking to get a task done and at the end of that conversation they’ve got their information or the task has been started. And so that is basically a chat bot. Now, we’re going to see in this set of sections here, we’re going to start talking about something called QNA Maker. It’s just as it sounds, questions and answers and it’s a very simple way to get into chatbots. And so in this section of the course we’re going to dive into Q and A Maker. We’re going to create our first Q and A bot live and we’re going to basically play around with that. Now, you can only go so far with this but it is again a very simple way to get started.

Now, you may want to move on to your chatbots to have some type of flow or a workflow to them. So let’s say you want the person to be able to order a pizza. Well, they’re going to start from talking about their pizza, the sauce and the toppings and address and the payment method. There’s probably some flow to how you get someone to get through an order process. That can be a conversation flow. There is a thing called a Brought bot framework which is basically an API or an SDK that we can use to build our bots and finally we can deploy these bots and these bots.

Again, it’s almost like Lewis, it’s a conversational front end and you’re probably going to want to do something in the back end and that could very well be integrating with speech service. So the bot actually speaks to you, speech synthesis or understanding you as speech and turning that into the bots responses, et cetera. So we’re going to start at the beginning and that is Q and A Maker, right? So in this section of the course, you’ll see in the portal there is a Q and A Maker in the marketplace and that’s going to eventually lead us to a web portal called QnAMaker AI. And then we can start to build our bot bots using a separate portal specifically for that.

  1. Create QnA Maker Resource

So we’re going to start off by creating ourselves a resource called Q and A Maker. If you go under the plus sign and the Azure Portal search for Q and A, you will see Q and A Maker come up and we can click Create. Now, it’s a very simple resource for us to create. We just have to give it a name and a location. And then we’re going to choose the pricing tier for this. So I’m going to create a new resource group for this. I’m going to call this Q and a bot. I’ll leave this in the default location. In my case, it’s east us. Yours might be different. I do need to give it a name. Now, like with a lot of things that are Azure related, it is going to try to find a unique name across all of Azure.

And so I like to put my initials on things to try to make them unique. And that case does seem to work. Now we do have some options when it comes to pricing. If we open the drop down, we can see that there is a free tier which allows us to do three transactions per second, 100 transactions per minute. There’s some limitations on that. Or pay up for Standard Tier, which just gets us $10 per month for three transactions per second. Could certainly go into the learn more to find out more about Q and A Maker pricing. So we can see here on that page three transactions per second and all of the limitations up to the Standard Tier.

You are also required to have some back end cognitive services. So you’re going to need an Azure App service to manage your bot. So when you are interacting back and forth, it is basically an Azure App service that you’ll be dealing with, and Cognitive Search, which is going to be how your questions and answers are stored and retrieved. So we will have to, at a minimum, have these two things which have their own pricing. Of course, App Service does have a free Tier, et cetera. So I’m just going to stick with the free tier for now. Now, we do need to again, we’ll have to have our own thing.

We can choose the Azure search. Tier. I will choose the free Tier. For that, we are going to need an Azure App service name. It’s going to keep the same name as my Q and A Maker. At the location for this website, you can see it says the App Service plan defaults to S one pricing that does have a price to it and you can modify that. So you don’t get to choose at the creation time. If you want to be able to have telemetry and chat logs and things in here that will be within App Insights, I’ll leave that enabled. I usually turn that off.

But in this case, if the chat logs are going to be in there that could be useful for something. So that’s all you need to in order to create your first Q and A bot. I’m going to say a review and create. I can see the list of things that I’ve chosen, and I’m going to say create, so that’s going to go off. Create me these services, which are a few. And when we come back, we will have the Q and A Maker resource created. But we haven’t created a bot yet, obviously. And we’re going to have to end up going into the Q and A Maker portal to build our first bot. So this is the start of our Q and A Maker adventure.

  1. Create QnA Maker Knowledgebase

All right, so the deployment of this Q and A bot resource has been completed. We can click the Gotoreesource now with taking us straight to this Quick Start page where we can start to build our bot. I’m going to go to the overview page before doing that. Now we can see the basic essentials, the name of the A bot, location, pricing tier, its status. It does have a key metaphor similar to storage accounts and similar to Cognitive Services, where you’re going to have a key that you provide with your calls that will ensure it’s you. And again, there’s a charge to it when you get beyond the free tier. We can also see some monitoring right now that nobody has called the bot, so there’s no data to show.

Now, if at some point, remember, we saw with the pricing tier that there’s a free tier and a standard tier, then click on the pricing tier management. We can see here that if we ever do need more than 50,000 transactions per month or more than three documents, the documents being the data that we’re going to manage our Q and A, then we’re going to have to upgrade to the standard plan. It’s not that expensive at $12 a month. We can also see that we can, similar to Cognitive Services for the individual services, we can deploy this to specific networks, hide this basically behind a firewall.

If this is not something you want the general public to access, generally for a chat bot, the purpose might be to put this on your website or to put this into a messenger, integrate this with your app. And you may want this to be public, but certainly if you’re using the SDK and things like that, maybe you don’t we can see other options that we go under. Keys. Again, very similar metaphor, having an end point and having the key. It’s the key that’s going to allow us to call this. And if you ever lose control of your key, you can always regenerate it. So we’ll go back to Quick Start. So we need to get the API key in order to use this in our code.

Now, I mentioned that there is a separate portal, q and A Maker AI, and this link is going to take us to the Q and A Maker portal. And then we’re going to have to log in and it’s going to find our chatbot. So let’s skip ahead and go into the portal at this point. All right, so we do have a Q and A service, so we don’t have to do this. First step, connect your Q and A service to your knowledge base. So if we were to find our Q and A service, we can go into our subscription, we can choose the Q and A bot, and we can choose which language our bot is going to be. And in this case, it will be in English.

You can see there are dozens of languages available, chitchat’s, more filler conversation as opposed to relying on the data in your database. So there’s chitchat for a few languages and more deep Q and A for the rest. Third step says name your knowledge base. So this is the document. This is what it’s going to be. So let’s call this basic store hours, basic Store Info. Now this is sort of the key of it all. And that’s why it’s called Q and a maker. Because this bot is going to extract, I’m going to zoom in here, apologize for that. This bot is going to extract question and answer payers from an online FAQ product manuals or other files.

You can supply this as web pages or PDFs documents, Word documents, Excel files or tabsparated files that have Q and A’s in them. If you want to do this later, we can skip this step. But if you provide a number of URLs, it’s going to basically build the knowledge base based off of that URL. So this is sort of the key to your successful chatbot. Now you can customize it. So once you’ve created your Q and A, then you’re going to go in there manually and you’re going to remove the ones that aren’t valid. You’re going to modify the answers. You’re going to tweak it a little bit. This sort of starts you off. This population step starts you off on something that you can edit.

And of course, it’s easier to edit than to create. Now, I have a website ironically called Azurefaq CA. And zoom in on that. And this is just a simple search engine. This isn’t based on Q and A maker, but if I start to search on a Word, I can come up with an EFF frequently Asked Question, which is the most difficult exam you’ll see that’s populated. Scroll down here. I can see sort of categories of things. If I click on one, I can see the individual questions. I can turn this. I’m going to copy that URL and I’m going to let the Q and A maker create a Q and A database based off of this site. Now, I’ll warn you right now that as I record this video, this website is a bit out of date. I don’t do a great job of keeping it up to date.

And so you’ll see references to exam codes. For instance, we can even see here it’s talking about AZ 103, AZ 203. These exam codes are out of date. You know what, this video is going to probably inspire me to go and start to edit this tonight. But for now, this is the FAQ site that we will point to. So I’m going to be able to post create this knowledge base based off of my own FAQ site. I don’t have any additional things to add. Now, chitchat, I mentioned chitchat is basically the ability to have small talk in your chatbot. So it’s like, hello, hi, how are you? I’m fine. How’s the weather? I don’t know, that kind of thing. So having your chatbot able to handle basic hellos and other greetings, we can automatically add that.

And so I might add a friendly you can get different tones. I can might add a friendly chitchat banter to my Q and A bot as well because it makes an additional good demo. So now that I’ve done that, I can click this Create your knowledge Base. And that’s going to create the foundation again, the database of questions and answers, along with this chitchat that’s going to make the foundation of my chat bot. So I’m going to click this Create button and in the next video, we’re going to look at the Q and A editor that will allow us to see all of these questions and answers that it’s pulled in. And assuming it might make some mistakes or what needs to be manually updated, we can do at that point.

  1. Edit Knowledgebase

Alright, so now the Q amp, a maker has extracted the FAQs from my Azure Fact CA website and we can see that it’s created 121 questions and answers from that in this editor. I can go and add some. If there’s some questions that don’t make sense, I can certainly edit them or add them, et cetera. That’s the whole purpose of this. So now, let’s say it starts with are there any Performance Lab questions on AZ 103? And for instance, the answer says yes, there are. Microsoft will ask you to go to the portal. Now, I can certainly at this point say, although it has been temporarily suspended since last year and we don’t know when they will add it back.

Right? So I can modify these if the answers are not as great as they could be, we can see the other options that are coming up, what type of coding is on the exam, et cetera. If there are other ways of asking this question, I can say tell me about Performance Lab questions on AZ 103 or I can say any labs on AZ 103 you can get some creative about what are the other ways of asking this question. Now, that’s certainly a lot of work if you want to go through these 120 questions and sort of tweak it a little bit, but this is going to be a tool for your customers. Another way to do this is to we got this blue test button here. Now that I’ve made some changes, I’m going to have to retrain the model.

So give it a second here. Save and train. So now I can click this blue test button and it’s opened up a window and I can actually start to ask a question. So I can say how difficult is AZ 103? It’s looked at that question and you can see that it’s come up with this mapping. I believe it’s mapped to do what topics are on the AZ 103 exam. It might not be the best answer and I can certainly go and create my own how difficult is question within the adding of the questions? Right? I can also click this inspect button and I can see that it’s asking me is this the best answer? And if it’s not, which is a better answer? So I can certainly will probably be better to write up the question specifically for how difficult it is as opposed to trying to pick a different answer.

What about are there any labs on AC 103? Now, you can see that even though my exact question is not part of the questions that I’ve preempted it with, it’s actually accurately mapped it to this question and answer. So are there any labs yes, there are, although it has been temporarily suspended. So that’s actually the right result. So we can see here through this testing interface, we get our chatbot into a nice state. I’m going to close the test here. So let’s assume you’ve worked on it, you’re happy with it, you’re ready to continue. Then the next step is going to be to publish the knowledge Base effectively. And so in the next video, we’re going to move on to the publishing step.

  1. Create Web Chat Bot for Qna Maker

Alright, so we’re going to move on to the Publishing tab here from our Knowledge Base. Now, when we click Publish, as you can see here, what it’s doing is it moves our Knowledge Base from the Test Search Index to the Production Search Index within the Azure Search service. So our back end of all of this is the Search Index. So if I click Publish, what I’m doing is that URL that was created for the Q and A maker becomes a working endpoint to call this. Now this is not yet a chat bot. So right now what we have is a Search Index that you can post questions to and get answers from in order to create a bot. We can see here that we can actually click the Create Bot button.

Azure, it’s having a little issue in order to create the bot. We can see that we can do a couple of things. One of the things, we can click the Create Bot button which will take us to another wizard, which will go through the process of creating another web app. Not the same web app as we just working with. Or we can obviously knowing the URL, we can basically call our Knowledge Base within our own code. So you can have your own C sharp or Python code, whatever you need to call the back end. So let’s go through this process of creating the bot now that we have the Knowledge Base published.

So by clicking on the Create a Bot button, it’s taking me into the portal and it’s taking me into a web app. Bought creation wizard. You can see it’s fairly straightforward here. One pane to say create. Now we have to give the bot a name and it has to be different than the search service that we were using. So if I said Azsjd Q and a bot that’s already been taken, but if I said Azure FAQ, then that would be available again. We’re going to publish it to our subscription to the same resource group. Now you’ll notice this app is creating itself in a separate location, a different location than the bought back end don’t need. There’s a reason for that.

We do have pricing available. So we can get the free plan again or into a standard plan. Click on the pricing screen, we can see the details of that. While this is loading up, we can see that there is a 10,000 message limit on the free plan. Or we’re going to pay sixty four cents per thousand messages. Sixty four cents Canadian, which is like fifty cents US per thousand messages. I’ll stick with the free plan. Now we do get the choice of language here. We can create a C sharp bot in this interface or node JS. It’s giving us the authentication key we know what we’re using for the back end here.

Now it’s picked in an app service plan, but I’m going to put this in the same app service plan that we used for the bot. So what we’re doing is creating a new web app in the same app service plan and it’s in the same location east US as the app. We can have application insights on or off. I usually create it off and if we wanted to, we can create an app ID password or just let it all create. And I’m going to leave that as the default. So when I click the create button, it’s going to go, now, create me a web app, which is my web front end to the where the back end is the knowledgebased search service. So we’ll let that run.

  1. Test Chat Bot

All right, so the web app bot was created. We can see here, right off the overview screen, we can download the source code if we wanted to customize our bot, download the source code, test the source code or publish it, and it can actually connect to different channels. So if you want your for your bot to be responding within various channels, we’ll talk about that in a second. But let’s go into the test here. So here is our chat bot. It says hello and welcome. Let’s have a little fun with our chatbot. So hi there. And it says hi back. How are you? I’m doing great. That’s great. Where are you located? Well, that’s true. What topics are on the AZ 103 exam these days? Great question.

Thank you. Great answer. So we’ll see that it’s got the link in there, it’s got all the things and what topics are on the AZ 300 exam? Like I said, I got to update this to be the latest codes and stuff. But we can see our chatbot is responding to our questions. And because we did add the chit chat, you can see that it’s got that in the case, it’s not the professional one that I chose. It was more of the casual one that I chose. So you can sort of see the answer might be different if I chose the professional one. So take care and goodbye. Well, it doesn’t understand goodbye. It just says hi. And so this is our chatbot example.

Now, again, based on this, you might want to go back and go into the Q and A maker, edit the model and then test that, train that and republish it. And you don’t have to republish the source code. You just republish the model. And that will just get into the Azure Search resource, update it. So let’s have a look at the source code that comes with our bot. I click the download bot source code. It’s going to zip it up. In the case, it asked me if I wanted to include the secrets and it’s going to include the secrets in this code. So it’s not something I want to publish publicly to GitHub because it’s got the secrets in it. But I’ll let that so it’s zipped it up for me and I can download the source code and see you can download it to my local.

Let’s open that up into a code editor. So if you download the code, open it up, the solution up. In Visual Studio, for instance, we can see that. Of course, there’s a lot of generic code here that we can basically build upon. So if we see the Microsoft bot builder namespace here and basically we can build our own little bot controller. Remember, this is accessing the search service. In the back end we have a lot of the configuration. I won’t open it, but it’s under app settings. Json you can see all the private keys and everything like that. You can run this on your local. If you hit F Five, you basically have a bot front end running on your local. I’ll show you what that looks like.

Actually, I’ll hit F Five and what it’s doing is it’s loading up didn’t like that. It’s loading up this sample and it’s basically just got links to the documentation. There’s a thing called an emulator that you can download. And since this is running on my local, you can see the local host in the URL. I can basically download this emulator which will interact with the bot that’s running on my local here. Now that’s pretty for the code. In the next video, we’re going to go into channels and we can see how to connect the bot service to all sorts of Skype and your emails and things like that to get bots working in the real world. And we’ll do that next.

  1. Publish QnA Bot to Channels

Now, the last bit we’ll talk about when it comes to Q amp A maker bots is this concept of channels. And when you click on it, you’ll pretty much see exactly what it’s about. Now the web chat bot is already connected, already running. We can get an embedded code. So if we wanted to post this as a frame inside of, of our website, we can say get bought embed codes and that’ll embed. We can add this as a teams channel. You’ll see that there are skype telegram, slack SMS messages. I can imagine doing this over phone, but I guess you could have a phone bot, Facebook bot. And so lots of options for basically connecting your chat bot once you’ve got it working and happy with all of these really interesting front ends, right.

So if you want to add a if you want to add a Facebook bot, then we basically have to connect this to Facebook Messenger. There’s a certain process for that, creating our Facebook app ID Secret. We have to register an app with Facebook and then you’re basically adding this bot to your messenger. And then customers come to your Facebook Messenger, start up a chat with your company and would be greeted by the bot saying, hello, hi, how are you? And they can start to ask their questions. We’re not going to go through setting up this channel, this Facebook channel or any other channel right now. But the whole concept is basically you can tie in your chatbot with lots of different front ends that can connect to it besides websites.

With the web channel, we can see how simple it is. We get the embed code, we show the secret keys which are hidden right now. And then we’ve got this iframe code that we can use to put into our web page. And so if you’ve got a website that would hold code such as this, you can basically set this up. And if you’re an accomplished web developer, maybe you can do even better than this, right? So lots of cool options. Anyways, that’s it for the Q and A maker. You get that sense of how you can use the artificial intelligence to build the questions and answers based on a source such as your website or such as a document or Excel spreadsheet. Coming up in the next section, we’re going to talk about conversation flow and actually starting to build with the bot framework. And we’ll get into that.