Create Your Own Amazon Lex Chatbot - Full tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hi and welcome to learn to dev today we're going to learn how to build a chat bot using Amazon Lex we'll start by programming simple chat phrases before making our bot smarter using personalized information all of this will be built and deployed on Amazon Web Services if you haven't created account you can create one here at aws.amazon.com if you haven't done this before then pause the video and play again when you've completed the process once you've logged in you'll end up on the AWS console this is where you access all of the tools available through the Amazon Web Services the one we'll be using today is Amazon Lex so what we'll do is search for Lex and go through to the page if this is the first time you're creating an Amazon next bot your page will look slightly different but the important thing is that we can create a new bot we have four options here we can either use one of the three samples made by Amazon or we can create our own custom bot we're gonna be going with a custom box so click that option and now we have a configuration screen we get to call our bot so I'm gonna call mine tutorial bot and we get to select the output voice this can be changed at any point so I'm gonna call I'm gonna use Matthew hello my name is Matthew you can try out hearing different sample texts if you want the next thing we need to do is set out time out I'm using the 5-minute default the last thing you need to do is select no under the Copp a because we're not going to be storing any of the user information once all of this is done you can click create and it'll get us through onto our bot page this is where all the magic happens and I'll explain what each bit does as we go at the top of the screen is this create intent button and we'll be clicking that soon but before we do I'm going to tell you a little bit about intense and intent is something that I user intend to do or find out and hence the name these intents can be simple as saying hi to asking what day it is to complex tasks like booking a holiday in essence there are a question or utterance from the user with a response that the bot will reply with now that we understand the basics of an intense let's create one click the create intent button and we're going to be creating a new intent we get to name our intent give it something nice and descriptive so it's easy to identify I'm gonna be calling this one what's your name and add that now we're on to the intent page there are two really important areas of this page the sample utterances at the top and the responses at the bottom we can start at the top with sample utterances these are phrases that the user might type if they're trying to find out what the bot is called a phrase could be something like what is your name or it could be what are you called now we have two different phrases in really smart thing happens because Amazon uses something called natural language understanding this is where it understands what the user is trying to say and interprets it as one of your utterances for example if we said something like what's your name instead of what is your name it would understand that they mean the same thing and would still get us onto this intent now that we have the in torrance is sorted we need to reply scroll down to the bottom and you have responses we can click add a message and in this box we can reply with whatever message we want i might reply with my name is Sam Bock and here you have the option to reply with more than one thing what this does is it chooses one of the options which makes it feel more realistic and more human so I'm also going to add in you can call me sandbox now that we have this all sorted we can scroll right the way down to the bottom and click on save intent that is our first intent created to test this what we need to do is look up in the right-hand corner to the build button when we build this it takes all the utterances that we've entered and it builds those into a mural Network that learns how to interpret our user inputs you can start testing the bot once the build is completed so we're gonna do that right now it can take up to a minute so just be patient when the bot finishes building we get this test bot latest in the right-hand side this is where you can send messages to your bot and see what it replies with let's test it out what if I say what is your name oh hey it replies with you can call me Sam bot that's brilliant now we can work on making this more interesting and do more things with it now that we've created and tested our first intent we know everything we need to know to create loads more intense we could try intent like who made you what is your favorite color or what is it like being a robot instead of these we're gonna make a basic hello intent but then we're going to make it more intelligent to create the next intent we click the blue plus button next to intense and select create intent I'm going to call this one hello intent and click Add sample utterances I'm going to keep it simple and have hello and hi and at the bottom I'm gonna add a response of hi there for now this is all we're gonna do so we're gonna test it first click Save intent and now that's saved we can build it and wait for this to build now that that's built we can test it out in chat window on the right in here we can say hi and we get back hi there exactly as we expect we're gonna make sure that our what's your name intent still works so type in what is your name and we still get back my name is Sam bot that's brilliant now let's make this spot more intelligent to make these intents more intelligent we want to add personalized information to the chat making our bot feel more real the way we include this is slots each slot has a name a type and a prompt the name is just the name for the variable the slot type is the kind of information you're going to store in that variable and the prompt is the message that the user is going to get to make sure they send up the information that we want what we're gonna do is we're gonna ask them for their name so in the variable name I'm gonna call it name in the slot type and scroll down and Amazon have a lot of custom slot types available so right down here we have G B dot first name so this will accept most of the British first names and as a prompt I'm going to say what is your name now this is the exact message you're going to send so make sure that you use capitals and any punctuation you want and click the plus button now that's all built we can scroll down to the responses now to make sure that we're actually responding with the information we need we need to include that slot to include the slot you need to wrap the variable name in curly braces so something like this so now it will reply with hi there and whatever they've entered as their name so if we now scroll down to the bottom and save this intent make sure that this tick this required box is ticked and then click build again now that our box is built we can test it out start by saying hi and we'll get asked what is your name now in here I'm gonna apply with stamp just gonna say hi there son that's a lot better than what we had before now what if the person says hi it asks what is your name and I say my name is Sam it doesn't understand what I'm trying to say we can change this by going it on to the settings in this slot when you open it up you have the prompts at the top so what is your name and you also have a corresponding a pterence at default the only thing it accepts is just the name so I can reply with Sam or anyone can reply with Claire or Ben or Tom and it will work fine but if I want to say something like my name is then we have to do something different similar to the responses the way we do this is we type my name is and then in curly braces the variable and add that so now if I say my name is Sam it will now if I enter my name is Sam it will look at the utterance realize the first three words are just the utterance and the last word is the variable it will then take that and put it into the slot without any of them my name is at the start so we need to save this scroll down to the bottom again and click Save intent now we need to go up to the top and build it again again we have to test this bot so tight hi what is your name and I'll this time we're gonna say my name is Sam and there we go it's taken out the name Sam and replied with hi there Sam that's much more natural so in this tutorial we've covered how to create an intent how to create the sample utterances and responses we've then made it more intelligent by including slots and making sure that the bots can get the right variable from that information using all this you can create as many intense as you want and create quite a complicated bot that can have conversations and talk all at once if you've liked this tutorial please give it a like and subscribe to get the next in a series of bot tutorials
Info
Channel: Complete Coding
Views: 53,696
Rating: undefined out of 5
Keywords: chatbot, software, tutorial
Id: Gy0C9g16DW0
Channel Id: undefined
Length: 12min 29sec (749 seconds)
Published: Mon Mar 12 2018
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.