Building Chatbot using Amazon Lex, Amazon Lambda and Amazon S3

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hi guys welcome to this session today we will discuss and build about using Amazon lakhs so why Amazon lakhs as we know Amazon lakhs is a service offering from Amazon to create mods so what's so special about it right when Amazon let's has excellent recognition capability it has amazing natural language understanding capability which is powered by artificial intelligence and machine learning Amazon lakhs and Amazon Alexa use same technology another feature Amazon lakhs is completely server less you need not to worry about provisioning underlying infrastructure and scaling it from couple of users to thousands of users life supports both text and voice based conversations it can be easily integrated with popular messaging platforms like Facebook and slap you can also integrate it with your own website or mobile app the biggest advantage is ability to use a SS lambda which in turn can call nearest aw services this changes the landscape what Lex can achieve and automate believe me it's a game changer last but most important is security and pricing Amazon NEX is fully secured there is no upfront cost and it works on pay-as-you-go practicing it is very cheap today we will build Amazon lakhs chatbot demonstrate its integration with Amazon lambda we will use Amazon s3 for storage to demonstrate real world example to make this demo very simple and easy to understand we will use very simple form of lambda code and chat board design with Amazon free tier account chances are you don't have to pay anything for using any AWS services during this demo however always check latest pricing of Amazon services on its official website with this covered in a very basic way I am sure you will be able to build enterprise chat bar additionally you can always enhance sample a doublet lambda function which we will be using in this demo to connect to a database or any other service lambda and XS so let's get started login to your account and on the AWS management console search Amazon Lux under find services over here you if you are navigating Lux for the first time you will see this kind of screen click get started on this screen you will see few sample amazon has created to get started we will build board from scratch click custom bot given him choose voice timeout select no for Children's Online Privacy Protection Act in this demo we are not going to deal with any data or usage related to children create now let's understand few basics of jet board in layman language the way Jack what works is like you type in a world and check what recognize the words and gives you next options in some scenarios jet board can provide you options to start in the mid me as well overall there can be series of commands or actions to achieve specific tasks in short the task we want to achieve is known as intent and the keywords we type in or speak are called utterances so an intent represents an action that the user wants to perform to understand better let's take banking solution example you can have welcome greeting intent to greet user when they start session that's one intent little based on the options you have provided user can request for checking account balances or any other action those can be separate intense you create a bot to support one or more related intense as a best practice always create separate intents for different actions in case you need to change anything later you just need to touch specific intent only on this page click create intent give a meaningful name add now let's take an example to better understand but rensis imagine a user access board interface and say hi so we will create intent to respond to users hi it's not necessary that user always type hi user can type in hey or hello as well so let's add all of these utterances to an intent remember Lex is powered by natural language understanding capability which means it is smart enough to recognize closely matching phrases and make sense out of it once uh trances are added we will add response to eating's intent this pose is the message returned by Lex bot broadly there are two ways to fulfill response simple messages are returning messages using a SS lambda for now we will use simple messages as response over here let's add some messages hydeia welcome always add multiple messages and Lux return these messages randomly to give human touch save intent bitte now this can take a minute or two now let's test bot you see it returns random messages in real world we can't just rely on messages we need to ask the user some details like name or City and then use it in messages this way we make but little interactive to accept user input we achieve this using slots slots are used to store user input value we will create a slot to store user name and then add it as part of bot response let's minimize this under slot let's create a slot user name Amazon has built-in slot type let's choose first name enter message in prompt now prompt message is that exact phrase both will ask user click plus can add slot in response to make it more personalized you let's save this bed bed let's test again you good now let's go little advance we will use a double slam de to return the response for this demo I have placed CSV file in AWS s3 we will access this file contents using bot interface to keep this demo short we will not cover AWS lambda and AWS s3 service let me show you s3 bucket you over here let me show you CSV file it has basic employee details like imply name employee ID Department ID like that now let's access AWS lamda service from AWS management console you for the first time you will see this screen click create function give a name we will use Python now under permissions choose create a new role from AWS policy template give a name we will add permissions in next step click create function after creation of function let's change some basic properties over here let's change timeout let's also change role permissions click over here this way we are going to modify role for lambda because we need to read CSV file placed in a SS s3 let's attach policies attached policy that's it we are good here see next at Puppy lambda code from github repository let me show you over here I will add link to github repository in notes for this demo I have downloaded code in sublime editor already over here let's copy paste this code and paste it over here save just a point to note in the code replace bucket name with s3 bucket you have created let me show you over here this is the bucket name now let's configure test event let's give it a name now copy Jason event file from github I'll take it from Peter clipped now let's test if everything is set correctly function should succeed it has written output as rape perfect our main goal is to ask user to enter department ID and return associated employees so let's create separate indent to achieve this task this way we will learn how to link intent as well let's go to Amazon laughs click intent now this intent name and the intent name given in lambda code should be seen over here and over here this is important as lambda cold will recognize in 10th name to perform specific action had provide sample utterances as department department ID next we are going to create slot with name as department ID let's minimize this slot type as number you Plus under fulfillment click AWS lambda function select lambda function save intent now we need some strategy to link ratings and written my name there are several ways to link intents in a conversation like add messages in front greeting intent and guide user to add specific keywords to invoke next intent those specific keywords will act as a trances for next intent or add slot cards as part of first intent response now we are not going to discuss about slot cars but I just wanted to mention that this is another possibility this option over here another way is make your first intend to response so intuitive that user will type specific keywords which can act as a trans is for next intent I personally prefer first two options so let's go to greetings navigate to response let's add a phrase I can search for employees in a department to continue type Department let's add it here as well save intent build let's test hi John I can search for implies in a department to continue type Department enter department ID hello imply names are Tom Linda and Julie amazing this is a very simple bar demonstration do let me know if you like this session
Info
Channel: Tech Evangelist
Views: 3,254
Rating: 5 out of 5
Keywords: AWS LEX, AMAZON LEX, Lex, chatbot, build chatbot, amazon, build lex
Id: kIBcsUqZK8E
Channel Id: undefined
Length: 15min 42sec (942 seconds)
Published: Wed Apr 22 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.