Web Hack Wednesday

Question and Answer Bot

Rate this post
(Video Transcript)
Hello and welcome to Web Hack Wednesday, I’m Martin Beeby,

>> And I’m Martin Kearn.

>> And today we are going to be speaking about bots again.

>> Bots, you love bots didn’t you, they’re your favorite thing in the whole world.

>> We showed bots a little bit before, how you create your own.

>> Yep.

>> And what I want to show you now is how you can create one with practically no effort.

>> Sounds brilliant. Sign me up, I want one of these bots.

>> This is quite a good sort of idea if you just wanna create a bot quickly. Which is some, let me just show someone in the business or whatever how.

>> It’s a show-off, it’s a show-off bot. [CROSSTALK] It’s an impress-your-boss bot. Impress-your-boss bot?

>> Yeah, I think it’s good for a little proof of concept just to explain what a bot is maybe in the context of your company.

>> Yeah.

>> So we’re gonna build one using, I think we will do QnA Maker

>> Okay, cool.

>> Which is a question and answer bot.

>> Yeah.

>> And the way that you do that is use her on a preexisting FAQ page.

>> Yeah.

>> Or it can be a Excel file or, it’s basically something which contains a key value pair of question and answer.

>> Okay.

>> And you upload it into the service and then that service then makes it clever.

>> Yes, so it’s kind of does matrix, [CROSSTALK]

>> So a user can speak to it, ask not the same exact question, and it will just try to match one of the questions from its repertoire.

>> This is based on cognitive services?

>> It is a cognitive service which it’s using. And then we’re also going to create the actual bot thing which we’re going to post in some, to actually host our bot for Facebook messenger and stuff. We’re gonna be using another service called zero functions.

>> Okay cool, let’s take a look.

>> Let’s indeed. So if we go over to dev.bot framework, the first portion of this is going to be the QnA, or getting the questions and answers portion of it. So you click on Learn More over here. And it’s gonna take you over to QnA maker.AI. And what we’re gonna do is create a new service, okay? And we’re gonna call this one Brexit bot.

>> Brexit bot?

>> Yeah. [LAUGH]

>> Is it gonna tell us why we’re Brexiting?

>> I don’t wanna get too-

>> We said we weren’t gonna do politics on the show, didn’t we.

>> Yeah, well this ends now.

>> Really, we’re gonna start being political?

>> It’s not particularly political.

>> Could you do a Trump bot? Is that for you? No that’s not-

>> That is too political.

>> Yeah, okay.

>> What we are gonna [LAUGH] do is we are going to stay with the idea of, and the only reason I’ve done a Brexit bot is because there is a great FAQ page on the government website.

>> Right, it’s okay.

>> And I was trying to find a decent FAQ page.

>> So out of all of the things the government has FAQ on, the only good FAQ page is Brexit.

>> Well there’s loads actually. I tell you what is a great one from a company called Innocent, which I’ve built Innocent Drink here in the UK, they do incredible copy in for their website.

>> Yeah.

>> So they’ve got an incredible FAQ page.

>> They’ve got a very good tone of voice, haven’t they? Mark says, we call that a tone of voice.

>> Turn of voice, yeah. So in their FAQ its got stuff about their drinks, which they sell. But it also has stuff like, can I borrow your car? And they have a funny answer to that. [CROSSTALK] Also, they’ve got a little bit of personality. If you ever phone up their customer help line, they answer it, hello, banana phone, which I think’s really good. Cuz they’re a smoothie company, they mix fruits.

>> Do they do that every time, then?

>> Yes.

>> But doesn’t that get, yeah.

>> We’ll try it, shall we try it? Yeah, okay, we’ll do that and make-

>> So they’re sick of Brexit, it’s a nice, safe topic. We don’t really, do we?

>> Yeah, [LAUGH] it’s a nice, safe topic.

>> Yeah.

>> Honestly, this isn’t political. It’s just purely-

>> Cuz it’s got a good FAQ.

>> Yeah, a good FAQ.

>> Okay.

>> Right, so go to this particular website, which is the same thing. Try faq gov European, that’ll do. That should get us there. FAQ on the UK’s departure from the European Union. Copy that.

>> It seems to be quite serious all of a sudden.

>> It does, doesn’t it? [LAUGH] I need some answers, so this is [CROSSTALK]

>> The only way we could possibly find this out is by hiring a [CROSSTALK]

>> [LAUGH] The URL for that website.

>> Yeah.

>> We could just add in files, if we don’t have a URL. Or you can start from scratch and add your own stuff in, but.

>> So presumably there’s some kind of schema if you were, I think you were in Files.

>> It’s just key value pairs.

>> Just key value pairs.

>> It’s a question and answer. And what it does is it breaks that website, which we’re just on, it breaks that into the two columns, which we’ve got. So now we’ve got, in our data set, we’ve got the question on the left-hand side and then the answer on the right-hand side. And you’ll see its done a pretty good job, I mean, it’s only got 20 or so things there but its kind of got the idea. So I’m just gonna save that. And you can go and edit this now, add your own questions and improve on it. But the cool thing is we can just go to test. What do you wanna ask Brexit bot?

>> When will Brexit happen?

>> When will we leave? Does it understand the term Brexit? Cuz that’s obviously not the official term.

>> Okay, will Brexit happen? European Communities Acts will repeal on the day we leave the EU meaning that the authority of the EU law in Britain will end. Will convert the body of blah blah blah blah blah.

>> Blah blah blah.

>> Seems roughly kind of right.

>> Seems legit. And you’ll see on the left hand side, it gives you a selection of question that you could, might be appropriate.

>> Yeah.

>> And so. We could maybe, if that’s not the right answers to that question [CROSSTALK].

>> This is user kind of bot designer or [INAUDIBLE] what happened to it.

>> What are you actually building is a service. We’re not actually building a bot at the moment, we’re building a service which will then become a bot.

>> A Brexit service.

>> A Brexit. [LAUGH]

>> Are we building a Brexit API? Is that what’s happening? My gosh.

>> This is it, ultimately you have a Brexit API. So if we go back to the thing here, we can add alternative questions and so forth on here, or we can select from the pre-existing questions which are there. This is pretty good. It also does some pretty decent stuff like the stuff on that page that you didn’t know about. But it does a pretty good job using Bing magic, Bing voodoo. So, if I say who is Boris? You might want to read about this here. UK Foreign Secretary, Boris Johnson. Boris, by the way, how’d it do that?

>> What magic is this?

>> I’ve got no actual idea how it does that. That’s not in the FAQ page. It mus be doing it

>> It must be using the Bing API as well in some ways. It’s just magic. [CROSSTALK] I don’t want to know how it does it.

>> It just figures it out, that’s it.

>> When it uses that, word, it means it’s not in FAQ?

>> So that’s the don’t know-

>> I’m figuring something something out.

>> Somewhere in the code it says, don’t know, doing some [CROSSTALK].

>> And what I’ve found is that it’s quite good at this, so even in the case when it doesn’t know from the FAQ’s, it’s trying its hardest to try and get you in the right place.

>> Yeah.

>> This is quite cool, I think, in the way that it’s working.

>> Yeah, that’s cool.

>> So it’s giving you some information about Boris Johnson there. If you’re not into British politics, Boris Johnson is the Foreign Secretary of the United Kingdom..

>> It’s quite amusing. Just search for him, you’ll see all about Boris

>> Yeah, Boris Johnson stuck on a high wire, YouTube that.

>> [LAUGH] Okay.

>> Okay, so we’ve now got our bot, our API. So I’m gonna go on and publish that. And then this will check my source and editorial. This is stuff I think I’ve added to the, there’s the two things, the changes that I’ve made. And I say, yeah, I’ve reviewed my changes.

>> Okay, of course you have

>> When I publish it says, hang tight and then it gives me a-

>> You’re always saying hang tight, I said that several times to you.

>> Is it?

>> Yeah, I just made you say. Anyway carry on.

>> Maybe, their tone of voice is rather cool, isn’t it?

>> Given their-

>> Success! Your service has been deployed. What’s next? Use the below HTTP request to build your bot. Learn here. At this point we haven’t got a bot. We’ve got an API. We can post to it, post a question to it, and we’d get the same responses we just asked it.

>> So is the QnA Maker API side of it.

>> So important point of it here, it doesn’t have to be a bot. You can use it in other ways.

>> Maybe you could use this in a website.

>> Yep. You can build your own interface for this. It doesn’t have to be a bot. Basically, we’re storing key value pairs, intelligently.

>> Could you somehow integrate this into MySpace?

>> Yes, yes, we’re not going to go into how, but yes.

>> Okay.

>> So if we go back to the screen there, what I’m gonna do now is go back to the, not that, go back to the dev dot bot framework. And there’s a whole thing that says go serverless. This is the cool thing at the moment is to go serverless.

>> So serverless is to web what Node.js is to, so serverless is to infrastructure what Node.js is to web?

>> Yeah. It would just say, like say it because, do that in Node. Do that serverless.

>> Just do it serverless. Don’t need servers.

>> Probably won’t do that server. Interestingly, serverless obviously still has servers involved. Which I think’s like a-

>> It’s a bit of a con.

>> It is a bit of a con. But what the idea of it being is that if you create a serverless application, you’re not managing, thinking about anything to do with the server.

>> Yeah.

>> You’re just writing code.

>> Yeah.

>> And in Amazon terminology that’s a Lambda.

>> Okay, yeah.

>> Function.

>> Yeah. What do we call that?

>> Function.

>> Function.

>> [LAUGH]

>> Funny. [LAUGH] >> It’s called, the Amazon service is called Lambda.

>> Yeah.

>> And in Azure world, it’s called functions.

>> Okay, cool, I think in series one, I think we covered functions a wee, okay.

>> A little bit, yeah.

>> Yeah.

>> What I’m gonna show you here is, they kind of have some prebuilt functions for you, for bots.

>> Right.

>> One of them, integrates the QnA Maker

>> My gosh.

>> [LAUGH] So I know, it’s just the best, isn’t it? And it actually integrates pretty nicely. So I’m gonna learn more, take me to this page. Start or free, or already using Azure. Yes I am. Try Azure Bot Service now, so okay.

>> Seasoned Azure campaigner by now.

>> I hate it when it takes me to the sales site.

>> I’ve got [INAUDIBLE]. Azurely, you’re already using Azure.

>> Azurely, you’re already using Azure. Yeah, yep, yep, yep.


>> [LAUGH] So that should’ve deep linked us. I always love this portal. The codename, internally, is the Ibiza portal.

>> Why is that? Why is it called that?

>> Because they like to party hard.

>> [LAUGH] Okay, maybe.

>> But this is a Ibiza portal. So we’re gonna give our app a name, so Brexit bot I’m going to stick this on my.

>> [INAUDIBLE] is that you?

>> No it’s not. I don’t think so. I think this is the first time I’ve done this. I’m pretty sure. I’m gonna use an existing resource group that I have called Celia. [LAUGH] You know what that is. That’s a whole different story. I’m gonna put that dash on created. And hopefully this will take a few seconds. And what this is doing is creating a bot service for me with Azure functions.

>> Okay, it’s just magic again.

>> Yeah well, you can do all of these steps yourself. It’s just, why do it when you can just click.

>> Why do it if you’ve got some cloud magicians? You can click a few buttons and it just wafts its cloud.

>> When I started, when I was doing this demo originally, I built a QnA Maker and then I built a bot, which called the API.

>> Yeah.

>> And then I discovered that the functions already a had a sort of template for this.

>> Yeah.

>> So what was I doing?

>> You’ve been crazy.

>> Yeah, let’s go back and see if it’s built. It’s been built.

>> It’s by magic.

>> Now, you know there’s a bot framework website?

>> Yeah.

>> And I ordinarily have to go to the bot framework site. Create a new bot.

>> Yeah.

>> Get the ID of it and all that stuff. They’ve actually done a really good job here of integrating it.

>> Okay.

>> Create a Microsoft app ID and password for my bot. It’s gonna link me off to the website, the bot framework. Now it’s going to ask me to log in. [INAUDIBLE]

>> When you say your password don’t read that out. Because otherwise people know how to log into your Live account. They know how long my password is.

>> Okay.

>> Hackers around the globe-

>> Yeah, just recognising the key press sounds. Okay, brexitbotbeeby is the app name.

>> I see.

>> It’s got an app ID. I am going to generate an app password. It’s gonna pop-up a GUI with an app password. The only time it shows you it, you have to reset it. If you don’t get it here, you have to reset it.

>> So get it whilst you can. Get it [INAUDIBLE].

>> And then you say finish and go back. And then you have to paste the password in here. And then you choose your language. C# or NodeJS. I am gonna choose C#. And then you get your framework of things that you changed, the samples that you can choose from.

>> Yeah.

>> I’m assuming that no jazz has got the [INAUDIBLE]. So we’ve got C#. Wait, something just showed, changed.

>> Just a text, I think.

>> The word sequins. A guided conversations using formflow. [CROSSTALK] Because they don’t have formflow in OHS do they? It’s not the same, the SDK for bot framework’s slightly different so they just have to adjust the text there. So the C# one, I’ll just say questions and answers.

>> Okay.

>> But there’s other things like language understanding base. Ultimately, they’re just, they’re just templates, these things at the moment. So I’m gonna say I wanna question and answer template. Create. Look at this integration level. So it says-

>> This is next level.

>> I can create a new knowledge base, but I have already created one. I actually built one for that Innocent Smoothies, but never mind. Brexit bot, I will choose that one. And click OK. And then that will go and create my bot service as a serverless bot function.

>> Serverless bot function calling a QnA Maker API based on a government website.

>> Yeah.

>> Amazing,

>> Brexit bot in 7 or 8 minutes. This is, or 14 minutes generating a bot. This could take a few minutes don’t say it.

>> Okay So now we have a bot.

>> Okay.

>> And I’m not gonna go into too much of what’s going on, but basically when a request comes in to this service it will pass over to what we call a dialog. And this is where the sort of, the magics of the application happens.

>> Yeah.

>> But by basics, if we’re, can I, not, nevermind. Basically, if I go in here and ask the same questions now.

>> Okay.

>> That’s gonna be a, it’s actually now a bot running. So this could be-


>> Look at that. So, when will we leave? And we get the same response back. And you can see the dialogue of what’s happening inside your function and so forth. And you can dig into the code [INAUDIBLE] this stuff up. But it’s kind of, it’s not what I’m looking at at the moment. Will it be hard or soft?

>> Is that really, is that really?

>> I’ve got no idea. Never mind. I’m glad that it didn’t do a Bing search for that [INAUDIBLE].

>> Yeah, so am I but, for the people outside the UK, they might think that you were being slightly silly there. But those inside the UK know that those are terms used-

>> Hard Brexit, soft Brexit, yeah. Yeah, so it’s this-

>> [CROSSTALK] But the FAQ on which way it’s gonna be.

>> They haven’t used that terminology.

>> They don’t wanna destroy their negotiation position. So let’s go back into here and look at, once we’ve built this we can edit the code live here. This is the same as any Azure function. You could build continue to integration here which is possibly the way that most people work on these things.

>> Okay.

>> So what they do is they have a Git, a Git repository.

>> Yeah.

>> Which contains all these functional logic. They edit that inside of an editor.

>> Yeah.

>> And then they commit that and it will then upload to the function.

>> Okay.

>> What’s cool about this is you can edit it immediately, in this browser, press save and that’s your function immediately will change.

>> That’s because it’s serverless.

>> Azure function. You’re never having to deploy it to a server.

>> The code here is the same code that you’d have with a non-serverless node bot or C sharp bot.

>> No actually.

>> Is it actually quite different? It looks different to me but

>> I think they’ve updated the SDK specifically. It looks a lot cleaner I’d say than the SDK in C sharp that I last looked at. And now we can click on Channel Settings and Publish and we can set these things up. So we can set up Skype, Facebook, and then we can start talking to our bot through Skype and so forth. So if to add this to Skype, for example, I will just click on add to Skype and then I can send this to anyone.

>> Yeah.

>> And then they could add that to the Skype.

>> Okay. That’s cool.

>> So that’s fundamentally how you build a Q&A maker API?

>> Yeah.

>> Connect it to an Azure server less function.

>> Yeah.

>> Create a bot inside of a bot framework, all from just double tapping and clicking. [CROSSTALK] Zero code.

>> [CROSSTALK] It’s amazing, thank you.

>> Thank you very much for joining us. Please come back next week and we’ll be talking about a new web topic. See you then.

>> Bye bye.


Read the video

This Week Martin and Martin use the QandA Maker and Azure functions to create a bot that can convert any Frequently Asked Questions page into a fully functioning chat bot.

Leave a Comment

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

1Code.Blog - Your #1 Code Blog