From the course: Amazon Web Services Machine Learning Essential Training

Predict using AWS Lex for chatbots - Amazon Web Services (AWS) Tutorial

From the course: Amazon Web Services Machine Learning Essential Training

Start my 1-month free trial

Predict using AWS Lex for chatbots

[- Instructor] The next service we're going to look at is called AWS Lex and it's used for conversational interfaces, sometimes called chat bots. This is the same sort of services that's used by the really popular AWS Alexa and it uses machine learning in combination with both voice and text to create these conversational interfaces. There are a lot of concepts involved so before we explore on the console, let's take a minute to look at the concepts. So each set of services is called a bot. So here we have an example of ordering flowers. A bot has several objects associated with it. The first object is called an intent, and I think of this like a verb or a method. In this case we have delivery order, so this is a particular goal that the user wants to achieve. Then we have utterances. Here an example is, "I'd like to order flowers", spoken or typed phrases that invoke the intent. That basically called delivery order, in this case. Then we have the slots, the data that the user must provide to fulfill the intent. Of course, Lexa is responding here after the customer says, "I'd like to order flowers." What kind? And the customer says, "A dozen roses please" Then there are prompts which are in response to utterances. So once the customer says, "A dozen roses" Lex answers, "Where should we deliver?" And then the customer gives the address and then the last object is fulfillment. The business logic required to fulfill the users input. Now there are a lot of concepts here, a lot of functionality is prepackaged for you. The best way to try this out, like with the other machine learning APis is in the console and the demo really is pretty good. Let go over and take a look. I'm in Amazon Lex, and I'm going to click the blue get started. I have different samples that I can work with. I could do a custom bot, I could book a trip, I could order flowers or schedule an appointment. Since we looked at order flowers previously lets look at book trip. I'll call this book trip demo. You can see that I have intents, utterances, slots, prompts and fulfillment. I'd like to book a hotel. Sure, which city? New York. What day do you want to check in? There it is, and then book the hotel. Notice, there are two other aspects of this an IAM role, it's automatically created and then COPPA which is a US regulatory set of standards around children's online privacy protection. It's not going to be subject to COPPA because children can not book hotel rooms in the US. Let's click create. Now we have our sample bot and you can see we are in the section around the utterances. So these are the phrases that the bot can respond to and you can add more inside of here. Then we have Lambda initialization validation. Then we have slots. This would be the information that the person who is interacting needs to supply. So the pick up city, the pick up date, the return date. So on and so forth. And we're in book car, which we get book car and book hotel. Then the confirmation prompt and then the fulfillment Whether it's something that Amazon can ship, so if you're ordering a product that Amzaon.com or if you're going to get an interaction with some other service provider. Let me test this out, by clicking on test. I'm going to type an utterance. I'm going to test this out by typing, book a car, and then pressing enter. Notice I get the response, "In which city?" I'm going to say, "New York City" Then I'm going to say, "On what day?" Now the reason my microphone is grayed out is because I would have to enable interaction with my microphone, then I could speak to the bot. I'm just going along the process here. Typing in based on the prompts. Ready for fulfillment. You can see that there's a lot of customization capability inside of here. You can go into the settings and you can set up aliases. I'll work with the voices and you'll probably recognize this probably from the previous movie. These are the voices of Polly the output voices. Then you can set channels to integrate with popular third party APTs such as Facebook, Kik, Slack or Twilio and then you have monitoring here. Our bot's successfully built because we were able to test it. The next step would be to publish it. This is the last step before we can connect our bot to a mobile app or a chat bot. I'm going to pause here and go back to the use case. So an example use case for this would be patient bookings. We looked at booking hotel rooms, ordering flowers, and booking rental cars. But another flavor of this would be to book patient appointments. You can see the input device, the patent requests an appointment, and then Lex recognizes that scheduling an appointment has been requested. Then Lex is going to respond to the input, asking for the preferred day. Then using subsequent downstream processing with Lambda the appointment time is reserved. The message is sent back through Lex and the patient is notified that the appointment is made. The data generated form the downstream processing in Lambda can be persisted in your choice of persistent stores. In this scenario they're using Dynamo DB and they're using SNS and SES and other services.

Contents