- [Jon] In the previous lecture, we built a bot from the samples. Now, let's do some changes to our bot. But first, you need to understand the concept of "versions." Bots, intents, and custom slot types all have versions. So, version for the bot, a version for the BookHotel intent, and even my slot type has a version here. Why are those versions required? It's to create immutable versions of your bot. You may have a bot version you use for dev, beta, and prod. They may each use a different version of intent, and those intents may use a different version of a slot type. The idea is to make sure that nothing changes once you publish a version of your bot. You can only edit the latest version of each of those constructs. Let's do a change by adding another utterance and save my intent. I'll add "Book a room." You can see that the version of my intent is still set to Latest. The reason for that is that the new version of intents only gets created once the bot is built. First, I will save my intent at the bottom of this page. And then, I will build this intent. Amazon Lex is now building a machine learning model for our bot. This sounds way simpler than doing all of the work myself, no math required here. [Laughing.] This should take less that 1 minute, with the power of recording, we'll fast forward that a bit. My bot is now successfully built. You can see now that I have two versions of my BookHotel. Before we move on with the bot versions, let's make sure that this bot is actually working. I can do that using the test bot interface on the right, and I can now interact with my bot either via text or voice. Let's first try by text. Book a hotel in Boston. Whoa, this wasn't part of our utterance. Look at our utterance on the left-hand side. Yes, remember what I said about utterances? They are just samples. And the machine learning model that was built is doing the job of doing natural language understanding. You don't need to think of every use case. That's why the model is there. You can also see that it detected that I said Boston as the location below, in the summary here. Location? Boston. It's now asking me to fill in other slots in here. What day do you want to check in? I will enter "tomorrow." Wait, tomorrow? That's not a date. Well, it kind of is. The bot took care of translating "tomorrow" into a date, as you can see it in the summary, where it was translated to 2019-02-21. We now need an amount of night. How many nights will you be staying? Three. The bot again translated the word "three" into the number 3. So, it's easier for our backend. Finally, I need to enter my room type. What type of room would you like - queen, king, deluxe? Let me enter "king" here, as I love having all the space in the world in my bed, even if it's just for one in there. You can see all of the slots have been filled at the bottom of the screen. There's none of them that are null, now. The next step is for confirmation prompt. Okay. I have you down for an amount of night. Perfect, that's what the bot is returning me. I can revise the answers that were sent. Everything looks good to me. Let me answer "go for it." The intent fulfillment has now been executed. And if you remember our choice from earlier, I said to return the data back to the client with what the model has interpreted. You can see every one, all of the data that Lex found. Let's try using my voice this time. I'm going to look at the BookCar. I don't need to, but it's just for you to follow me. The way this web interface works is that once you click the microphone icon, it will start recording. You need to click it again to submit the audio clip to Lex. Let's try it. - [Jon] I want to book a car. - [Computer] In what city do you need to rent a car? - [Jon] Wait, it just talked to me. How can that be? Lex only does speech recognition and natural language understanding. It doesn't do text to speech. Oh yeah, I remember now. Lex uses Amazon Polly, the service that does text to speech. Great. Now that I understand what's happening, let's converse with our bot. - [Jon] Seattle. - [Computer] What day do you want to start your rental? - [Jon] The day after tomorrow. - [Computer] What day do you want to return the car? - [Jon] On Saturday. - [Computer] How old is the driver for this rental? - [Jon] Oh, my age. Well, this is something very strange that happened to me when I hit 25. I just stopped aging. My official documents are just getting more wrong every year. So, 25. - [Computer] What type of car would you like to rent? Our most popular options are economy, midsize, and luxury. - [Jon] Midsize. - [Computer] Okay. I have you down for a midsize rental in Seattle from February 22, 2019, to February 23, 2019. Should I book the reservation? - [Jon] Sure. Great. Sounds like this worked. I'll encourage you to play with Lex a bit more and try a few other utterances. If you see that one doesn't work the way that you are expecting it, apply what we have learned in this lecture to add an utterance to get the bot to understand you, and don't forget to build the intent again. Now that we built our bot and tested it to make sure it does what it's supposed to do, it's time to deploy this bot. However, as you can see, it's still pointing to our latest version. I could point my application to this latest version and be done with it, but if I make any modifications, what do you think happens? I'm impacting my users, which isn't great for customer satisfaction. So, I want my application to point to a version. Version 1, 2, 3. But wait! That would mean that each time I modify my bot I need to redeploy my application? That sounds pretty bad. Yeah, that would be. That's why you shouldn't do that. Instead, you should use an alias. Let's see that in action. I'll click Publish. It asks me to create an alias version or update an alias version. An alias points to a version, so you can still only have one deployment of your code. Let me create a new alias. I'll call that "prod" and hit the Publish button. This will take a minute or so to publish. So, what did I just do? Well, by clicking Publish, it creates a new version - version 1. And an alias name "prod" is created, pointing to version 1 of our bot. Now that version 1 of our bot points to two intents, BookCar still at version 1 and BookHotel that's now at version 2. Now, I can go in my application and make it point to the prod alias, without having to worry about making changes to the bot as the only way to impact the application will be to publish the bot again and then change the prod alias to point to that new version. That's a lot of mistakes in a row, if you were to have that problem. As you can see, BookTrip has been published. You can see version 1 of our bot right here. It uses version 1 of BookCar and version 2 of BookHotel intent. I'm ready to use this bot in production, now. Before we leave, I want to show you the Monitoring tab here. It shows metrics over time to understand how your bot is being used and things like latency for the execution of your bot. The other important piece I wanted to show you is the Utterances section here. It is currently empty, which is normal. You can use it to view utterances that your bot did not recognize. Utterance statistics are generated once a day. You can see a utterance that was not recognized, how many times it was heard, and the last date and time that utterance was heard. It can take up to 24 hours for missed utterances to appear in the console, and data is typically generated overnight. So, don't wait for it yet. From this interface, you can select an utterance that was missed and add it to your intent. So, this is a good practice to review this list when you deploy new intents in your bot. In the next module, you will put to use what you have learned about Lex to do an exercise. Rick is waiting for you. Thanks for watching.