Live from the London Loft | Deep Dive: Amazon Lex

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
okay welcome back thanks for joining me again my second session of the day it's gonna be a little bit more cutting edge and a little bit more alive than the last one I did on recognition here we're going to be looking at building chat BOTS with Amazon elects something that I've learned a lot about over the course the last couple of weeks called trying to build a good demo for this session which I'll show you a little bit later on I'm not entirely finished but finished enough for me to show you quite a few of the core concepts that we're going to be talking about here so they didn't reduce myself before but if you joined us just now joining us on the stream I twitch my name is Ian in massing I'm the technology evangelist with AWS I was in quite a long time mostly about coming to four years which is longer than 72% of the people in the company so quite a while so chat bots with Amazon Lex Lex is a service that we launched last year I mentioned it briefly in my choir session it's one of these abstracted services that makes use of a deep learning neural network but it doesn't require developers to know anything about deep learning neural networks and in this case the neural net is put to use for quite a few different things so I'm going to talk about that in the course of the session it's put to use by directionally so it's used to understand input to the chat BOTS but it's also used for another purpose which in my view is more interesting okay a little bit more a little bit more nuanced okay so we'll get to that in a second it's what we're going to cover before I get to the console and the idea here is to spend most of this session in the console showing you how to build stuff so we're going to quickly get through right eight slides and then I'm just going to go alive in the console and show you how to get started and build these interfaces in the console so why did we build this well there's a natural evolution taking place in the interfaces to the machines that were used to build information systems okay who remembers this Bob bobs a very active member of the AWS community here in London so I'm not picking on him unnecessarily yeah I knew that you would answer the question in that way so you had to know you needed a filing cabinet for that right full of these punch cards so yeah so then you got onto the GUI okay which is you know probably what most people of my generation a 30 40 something's 40 some things in my case grew up with so when we first sort of booted Windows 3.1 for the first time and moved away from ms-dos it's like wow this is amazing okay and that same kind of experience has been replicated for me much more recently with the Amazon echo so there's something really magical about speaking to a machine or information system or application and having responses to your question given to you in real time in a way which is almost like you know talking to the Starship Enterprise and this I think for me there's one really good example of how impactful this is I was at an AWS user group in Dublin and in the AWA news group in Dublin which by the way you should go to an AWS user group no matter where you are in the world go to them they're a really valuable resource for customers to learn from peers unfiltered by AWS or anybody else just genuine community knowledge sharing they're a fantastic resource the one in Dublin is really really good and they have a sub group like a side group that focuses specifically on Alexa development Alexa devs Dublin she's actually very popular in its own right when they were starting this up they wanted somebody to come in and illustrate how revolutionary the voice based interface was they found a person that was visually impaired somebody that was almost blind that had previously not been able to interface with the kind of applications and systems that we all take for granted imagine never being able to use Google and literally it was that transformational he got the voice device within a few hours it had completely transformed the information it had these fingertips and the services that you could use okay so this is a big deal for accessibility it's a big deal for making information systems and services available to groups that have traditionally been excluded and it's also a big deal from a commercial perspective because you can access markets that you might not have previously been able to access okay my kids for example they can control Spotify in fact the most popular Alexa utterance in my house is the following phrase Alexa play black magic by Little Mix on Spotify it ranks way above any other utterance because my five and seven year old say it 50 times a day at the weekends you know so yeah accessibility is really really important here of course there's some challenges in building systems like that okay so these are some of the challenges that developers face with Alexa and the Amazon echo we're tackling these challenges for a specific device okay in order to deploy your skill within the Alexa skills kit customers need to have an echo or another device which is hooked up to the Alexa voice service now you can connect your own device to that that you are you know you do have a dependency then on Alexa skills on the programming model and on fitting within that framework okay what we're trying to solve for with with Amazon Lakes is disconnecting that removing that constraint removing that assumption that you're going to be building your application for users that are interfacing with the Alexa voice service Lexx itself is a standalone Amazon Web Services API endpoint or is represented by a standalone Amazon Web Services API endpoint and using the service you can deploy a fully featured chat service behind that endpoint and you can interface it with a variety of different channels called channels so this is things like Facebook slack you can write your own clients which use either text-based interfaces or use voice based interfaces so you can build a special-purpose chat bot with a speech based interface that allows your customers to quite literally talk to products that you're building so you could build a washing machine a home security system a car a special-purpose kiosk that gives tourist information safety unit that goes on public transport that individuals talk to these could all be physical devices that use the human voice for communication but are actually backed by special-purpose chat BOTS running in Amazon Lakes okay so you have the capability to decouple the physical device use your own special-purpose physical device or this open connectivity into a variety of different channels the locations that your users are already present in because they're already on Facebook they're already got the facebook Messenger they're already on slack they're already got slack clients you can deliver your services into these pre-existing ecosystems using tools and interfaces that your customers are already using it's really really important than that perspective I think so like I said there's two sides of the service speech recognition okay and then natural language understanding so these are important distinctions the same phraseology that's used in in the Alexa skills can actually with with the echo so speech recognition is what words did I say in what sequence okay so I want to book a hotel I just said I want to book a hotel right but what do they actually mean well in that case I'm n I want to book a hotel which is the NLU but it might have said I'd like to book a hotel please it's the same intent right I mean the same thing or I want to book a hotel in London next week from Wednesday to Friday my budget is 200 pounds maximum a very complicated phrase that needs to resolve down to the same intent and this is what I know you is NLU is unpacking the tens of thousands hundreds of thousands or millions of different ways in which human beings can say the same thing okay and that's where the deep learning neural network comes into play it comes into play in unpacking your intent and also of course which is every bit as important extracting the pertinent data which we call slots in our programming model that relate to the intent so in London next Wednesday next Friday 200 pounds location start date end date budget okay and I need to be able to pick those out of the model even if I say I want to book a hotel in London departing next Friday but arriving on Wednesday my maximum budget is 200 pounds yeah same thing same slots completely different sentence structure imagine trying to do that with the case statement or a switch statement in a traditional programming model like a gate based model it's just completely impossible to do that and that's where the pre trained neural network that we operate comes into play it comes into play unpacking the meaning from those sentences and pulling out the important important components and as I said before you can deploy in facebook Messenger in Twilio with one click you can integrate with with slack you can deploy to mobile in the case of deploy to mobile you can use our mobile SDKs on the Android and iOS platform and you can use an adjacent complimentary service that we have called Amazon kognito for identity and credentials management on those platforms ok this allows you to issue scope limited and time limited AWS API credentials to mobile apps and to have those mobile apps work in a secure and twisted way with our AWS API endpoints so for that particular model we have another adjacent service called AWS mobile hub that will build you a skeleton application for the Android or iOS platform including the components of our SDK that are required for you to deliver whatever functionality you want so basically mobile hub will build you a deployment for a source code package that includes the right features from AWS to use services like Lex in mobile application development I'm not going to say much more about that here but it is a good way to get started if you are a mobile developer and you want to put a you know a speech button in your app where your users can use a touch-based interface for your app but they can also just press a button and tell your application what they want which might help you reach excluded audiences that don't have good written English skills for example ok so you can do that very simply in the app as well ok so let's get out of these slides I hope I'm going to sit now that's ok for the camera at the back and you can still see me OK on the stream I need to concentrate on this next section so wanted to do something here which is to show you the interface and then talk a little bit about the the bot creation process ok so let me switch to this screen and I'm gonna make this full screen so you'll see I've already got one bot that's been created here within my console just in the Lexx console here in the North Virginia region which is the only region currently that supports this service I mean that console and I have one bot that I've already created I'm gonna come back to that later and describe the functionality of that bot and show you how it's accessible and then show you how it works by showing you a little bit of code that's been implemented at the back end but before we do that let's look at creating something from scratch okay and what we've done here with Amazon Lex I'm just going to hide this toolbar to make a little bit more space what we've done here with Amazon legs is to provide several different startup options for developers so you can take one of our samples okay and you can quickly deploy it into your account to see how it works or you can create a custom bot from scratch if I go to create a custom bot from scratch I'm asked to enter descriptive information about the bot and it will then take me through creating let's do this okay so London loft demo ok choose my output voice I'm actually gonna use text here so it's a text-based application I want a three minute session timeout then I've got some IM stuff and I've also got some legal terms here that relate to making these services available to children because there's a specific regulatory framework for that so I'm going to say no for that okay to simplify the process and I'm gonna create my bot create an alias my robots called let's not go straight to that let's go to alpha okay and let's use latest for alpha okay and then in general that's it I can save that so okay so in these are the yeah so the next thing I need to do is to create an intent so I've created the basic settings from my bot I need to create an intent so what is it I want my bot to allow users to do okay so if I hit create intent I can create a custom or I can use an existing there's some custom except intents that are already created in the system I'm going to create a new one let's go for something nice and simple so let's go for today's weather okay so I need sample utterances these are essentially pieces of training data that will prime the understanding capability of the neural network so that it can detect when a user is invoking the intent that I'm creating so here I would have like what's the weather today I pick one example can you tell me the weather what's it like outside is it raining is it something so I'm creating sample phrases which are used to initiate the intent okay those will prime the model and that will help my bot detect what it's being asked to do I don't need to create an exhausted exhaustive list but I can use this for tuning so if I have a missed intent which I'll show you later in Metrix in other words somebody's trying to invoke my bot via one of the channels but they're saying something that we we can't figure out what that is then we can use this to add additional kind of capture phrases that will be used to route users to this in the intent in the future as we try and cover all available permutations of the invocation phrases that are available okay and I'm just going to have location and there are built-ins here okay so built-ins for European cities I can have a prompt which city are you interested in question mark okay and I can save that intent I'm going to return the parameters to the client this is as much as I need to do in order to build my bot so I can build it okay and what's happening now is this is going pushed out into our infrastructure the intent priming kind of question mark so that's fantastic so you don't need punctuation knees just remove all those so the the sampling sample utterances are being primed now into the system and the bot is being deployed here for testing okay so in a minute this will complete and I'll then be able to show you the neck the next step now you notice that I didn't select these advanced features like lambda initialization invalidation a confirmation prompt and at the very end all I'm going to do is return parameters to the client so this is about as simple as it's possible to build okay and then I'm presented with this testing panel over on the right hand side and I can I can chat to my bot so what's the weather okay so it's getting ready to fulfill now I haven't got any specific pieces of data that I am trying to capture here okay but if I do enter specific slots that I want to capture let's have a slot called location save that intent to get deployed it's crass Loctite okay this will now shouldn't our work do a quick rebuild so there what I'm doing is adding the specific data that I need to capture in order to fulfill the intent that I'm creating here just rebuild that and redeploy it if they say watch progress meter never finishes which you've heard them so I build and redeploy okay there we are so there we're now looking for that missing piece of information that I've asked for and I can say London there okay so that intent is now ready for fulfillment and I've specified a piece of data which is one of my slots and I have captured that so that is the most simple Lex bot that you can build okay it's ready to dispatch that event to a fulfillment function and you can use this for building your language model and training for creating the front-end part of your conversational interface without having to be concerned about fulfilment or any validation of the values that you're entering for your particular use case okay so that's all you need to do and get started in in getting started to build the interface it's far too simplistic an example to be representative so let's move on and take a look at something which has got a little bit more a little bit more to it without this and I'll show you another use case example so you might recall there were a couple of available examples there in the console that related to one related to booking flowers one related to booking travel so traveling to a city and it's this travel booking one that I just want to focus in on for a few minutes and talk about so this is one of the sample BOTS that can be deployed via the console and I will deploy in a second okay and show you how that works and in that sample we've got much more sophisticated back-end logic okay and that back-end logic is expressed using AWS lambda functions and you might have seen this initiate a dialog fulfillment function or initiate dialogue code hook I think is the phraseology that's used in the console what that means is when our intent is detected or a conversation is detected that has that intent we fire up a specific lambda function okay and we pass the lambda function information about the current conversational state okay and I'll show you some documentation about that in a second because we know the format of the data object that we receive received that reflects the current conversational state we can write an automated processor that responds to it we can use this automated processor in the form of a lambda function to interactively control the conversation in a way which is dynamic okay so we can ask for specific slots that are missing with specific dialogue that we create we can perform validation operations on the specific slots may be selecting cities only from a valid list of cities or validating that dates are in the future or performing pricing calculations to enable us to return back information to the session which is dynamic in nature even which comes from information sources that are external to the bot itself so the lambda function is an executable piece of code and that executable piece of code it's capable of responding to responding to the chat session which is being run with the user this is how we build the rich experiences so we do using the same things we're using intents we're using or Torrance's we're using slots and we're using fulfillment but because we have the capability to develop very sophisticated logic to call out to other systems and to dynamically generate responses that go back in the session we can build very sophisticated logic flows as part of this this process is part of part of this platform so we're able to do things as I said like validate sessions and to provide a really rich and interactive experience for customers that are using that service so the next thing I want to do is show you deployment of one of those sample applications I'm going to deploy the lambda lambda function the template function we're going to do a little bit of testing with something that's a little bit more sophisticated so back in the console let's go back to our BOTS and we're going to create a new one here okay we're going to create an instance of this book trip ok book trip London loft same process applies but here we are deploying a pre created template so a pre-existing schema essentially a pre-existing object that defines a set of intense and a set of slot types ok so we're going to deploy that in the background while we do that we're going to jump into another AWS service which is AWS lambda and over here we're going to deploy a new function ok so we're going to deploy a new back-end function if you're not familiar with lambda which is our function execution service there are a set of templates available within lambda when you create a new lambda function is actually a lot of them for web applications for api's for alexa scales ok but there are also templates that correspond to these demo X functions that I was talking about before so we deploy Lex book trip Python into our account the code for which is here which I'll return to in a second okay all we need to do is specify a role that we're going to run this function under which is our lambda basic execution role when you see other name yeah good spot okay that's deployed that's fast an our template function is also deployed so we can build that and you'll see in a second that there is substantially more functionality here but the same configuration details are still present in the console so I still have my sample utterances that you can see here in a second I'll scroll down and show you show you more of the slots as well while that builds let's just take it look at the code that I deployed in lambda so there's quite a long lambda function here which has an intent Rooter in it okay so the first thing that we're going to do when we run our function we're going to receive event context which you can see here is being captured in this event and context variable here and we're going to dispatch the event metadata which is the JSON structure that defines the current attributes of the conversation that's taking place via the conversational interface we're going to dispatch that into this intent Reuter okay so you can see we've got our intent request here and there we have routing logic which reflects the name of the intents that are present within the Lexx console so you'll see these two intents up here match up with the logic in the lambda function so you can see we're gonna check our intent name if our intent is book hotel or book car we're going to dispatch that off to a handler and those handlers are coded here so these are quite long validation functions so to book our car we're going to pull slots out of the intent and we're going to validate whether those slots are valid slots or not this is where we're gonna do things like look at whether we're in a supported City we're going to look at whether our date is actually in the future we're going to look at whether our returned is after our pickup date we're going to validate the age of our driver we're going to validate the type of car that the user is requested so it can build very sophisticated validation logic in the handling function that we create here and that gives us the capability do things like this a book a car okay which city do you want to rent I want to rent in London what did you want to start your rental yesterday tomorrow the driver is 18 now you'll see that this does not work okay so at the moment we haven't connected our code hooks but the dialogue is there okay so we're capable of collecting the information and the dialogue is what you can see in these prompts here if we connect to our I got a really low preload to consult yeah so I've quickly read about the console okay so I'm now going to intercept the dialogue process and I'm gonna feed that dialogue process through that lambda function I've connected to this specific function so I need to build and republish that with the dialogue function hooked in behind the interface just take a second hope somebody can remember the answers that I gave to those questions because I need them for testing okay so I'm gonna test you on that in a second now one of the good things about this system is once you've frozen the front-end and you understand your subtle example or two answers your slots and your default prompts you can then you then don't have to redeploy the the bots to experiment with the validation logic in lambda function once you're pointing at the lambda function it's simply the lambda function that needs to be replaced in order for you to modify the logic that's embedded within the interface and that is a much quicker process actually than that bot rebuild that you've seen there as you may know you can push an overwrite a lambda function in just a couple of seconds so let's do that again book a car where do I want to book on a book in London we do not support Londoners of our destination please specify valid destination so let's go for New York instead when do I want to book I want to start yesterday reservations have to be sheduled at least one day in advance so I'm gonna start tomorrow and I want to return it on Sunday how old is the driver the driver is 18 what type of car do I want I want mid-size so you can see how I've introduced validation logic there okay thanks I've closed to your reservation so I've been able to introduce validation logic by using the dialog handler in the lambda function to validate the slots and return responses when the slots are invalid okay so that's how we build the the richness in the interface for logging obviously the intents not fulfilled in this particular case but for logging purposes the same logging that we use for AWS lambda is used for obviously observing the function establishing how the function is behaving and what operations it's performing so if I jump into my lab watch logs console here you'll see I should have a book trip Python log stream which is here which has got information in about the transaction this is an older one okay let's go back to this one yep this one that's just being generated now yeah it's been generated up to about a minute ago you can see this is the debugging data that comes out of the function now something that you should notice here is there are multiple indications of this lambda function so each time I cycle through that process of interacting with the backend by that lambda function my lambda function is re-involved again I'm receiving information at that point about the state of the dialogue okay and that allows me to move through the validation process iteratively prompting for completion of the missing slots iteratively performing the validation of the data that's in those slots that have just been entered and then once I have my data model and everything is valid I can then execute whatever logic is required to fulfill the function in this case I'm just logging as you can see here logging the data that's been recorded in the validating slots and normally I would dispatch that off public to an external system to actually perform the perform the booking operation what make sense okay good so that's getting started on those samples and getting started with one of those samples is what I did to build this next demo she's not quite finished but it's getting towards being finished this isn't at the BOK called session feedback bar which is intended to be deployed into the Facebook channel I'm going to use this in my team actually to allow my team members to solicit feedback for talks and events via facebook chat so we'll go to go to events like this post the URL for a Facebook page at the end of the session and allow customers that have attended the session to give us ratings and also leave a long form feedback about what we've seen okay so we're gonna try and open up some more interactive channels for discussion with customers you'll see here I've got several intends the reason I've got several intents is I want to have several different pieces of functionality but I also have a specific intent for helped me because on the Facebook platform in order to surpass approvals for Facebook chatter apps you have to provide self starter guide that enables users to understand what your bot does without having to visit a website or page outside of outside of Facebook so we've got help intent which is here I've got a code initialization and validation hook that I'm using you might notice that my CI CD for the function that I'm using is being managed by another AWS service called AWS code star which allows me to establish a build pipeline for my lambda function commit changes via gate and have those changes continuously deployed into production so that's how I'm managing my pipeline and then I have at the moment just one intent which provides functionality which is rate session so and you'll notice that I've got some single words or two answers here it's because identified an issue that single words were been interpreted as request for help so I scoped down my utterances to respond specifically to words like rate and score with the rate session intent okay so this was detected by looking at testing data and establishing that some events were being some intents were being miscategorized I'm able to provide higher resolution make sure mine my intent is properly picked up better have some slots ID session day session location and session score I have a confirmation prompt and I have a lambda function for fulfilment okay yeah yes yep I've nicely texted that but on the book car you can definitely do it for this one if I wanted to respond to several slots at once I would need to create sample utterances that had examples of that so if I created a sample utterance which was I'd like to rate a session from today and then I insert the today or session date slot into the utterance okay so I'd like to rate a session from today that would enable me to pick out that slot from a complete or to instant included it but I'd need to enrich my sample or Torrance's a little bit more than I have done in order to implement that but it will work yes yeah and then the other thing that I've got configured here is a channel and the channel that I have configured is a Facebook Association now you can't see the details of your channel and changed them after you've created it that's for security reasons because there were secrets there so you have a one-time configuration operation that you go through where you enter verify token which is a shared token that you also enter into your Facebook app that's used for verifying transactions to and from the web hooks bi-directionally a page access token which is a token generated by Facebook for validation like a secret key and an abscess re like an like a an access key in AWS terms and then the app secret key which is like our secret key for request signing okay so you enter those things Facebook gives you a callback URL go into that and we give you a callback URL that you enter on the other side and then the applications can communicate with each other or the two sides of the application can communicate with each other using web hooks ok sorry the question for the benefit of this dream that I answered so it was about picking up slots directly from an utterance without having to enter into a dialogue so whether or not it was possible to create a bot which can use this order logic that i just described I'd like to rate the session abc1 from today 4 out of 5 for example pick up those slots in a single utterance without entering into a dialogue in this case I'm not that but I could quite easily build it using the technique that I described so enriching the sample utterances with the slot data okay and then of course I have source code on the back code on the back end which enables me to implement the logic which I'll just quickly show you it's here same kind of structure so I'm receiving the event in lambda handler I have my dispatch intent which is my intent router here that you can see that I've got my three intents so my help me intend is here and it's very simple this one it just immediately returns fulfilled with the content hi there right now I can rate sessions or events where you've seen me speak to recession say I want to rate a session I need to know and it tells you the data that it needs to know and that'll just be immediately echoed back in the session okay the other intents that I have the feedback intent is not implemented yet but the rate session intent is implemented and we'll do a similar thing to that which you saw with the trip booking it will collect the data that's required at the moment it will echo that data into the log so I can see that the data's being collected correctly and in the future what I intend to do here they send the generated JSON object objects into elasticsearch and then build a Cabana dashboard that enables me to visualize the rating distribution for different sessions that will be the data model I use at the end and actually insert the user ID that you can see here which I unpack from the event into the object as well the user ID is unique and it's associated with your Facebook ID so each individual user that communicates with this chat bot from Facebook will have an immutable identifier that is always associated with their particular Facebook identity and I can use that with some logic later on to eliminate duplicate votes for example to enable me to ensure that individual users can only vote once for each session so I'll implement that later on as well in terms of testing well I can test this in the interface here obviously the wrong on the right box so you know I want to rate session which session did you want to write intraplex and you can see the debugging output down here by the bottom this is a new feature so we actually echo the session state in the lower part of the panel here that you can see as well to help with debug what date was the session it was yesterday so this is quite a neat feature with dates that it will allow me to use natural language and resolve them down to eyesore format dates within the system for me so I could say last Thursday and it would do the same thing or next Friday in it would kick in validation error saying that you can't create session in the future obviously took place in London how would you rate the session obviously rate at 5:00 I would wouldn't I yeah so you sure you want to submit yes I'm gonna submit and that's it rated the session my help in 10 also works yeah so right there hi there right now I can rate sessions or events and I can also give feedback I can't take session feedback yeah you notice I spelt feedback wrong but it still corrected that in the knee on that and was able to resolve the intent even though I de typo in my intent it's pretty smart okay and then on the Facebook side of things well the main thing about the Facebook side of stuff is there's no difference okay so it works in exactly the same way it's just the interaction channel that is different okay you need a Facebook page obviously to deploy that but I can do the same thing I can ask for help I'll see the same help message I can say rate session which session do you want to write intro to lunda yes sir what do it was the session on last Monday where the session take place it took place in lips which that's not a valid session location so I've got validation in there okay what I'm going to do is have a dynamodb table that contains a list of places where I've delivered sessions instead the last three months okay I'll use or two expiry on those events to purge them after a three month period so they'll get deleted out okay and I'll then be able to use a little web app to add new locations to that from whatever event I'm at and that won't be where my validation data live some a validation data will ultimately live external to my because I could modify it without having to push new code try different location or tile under yep right the session 3 submit this rotating yes thank you so you've got exactly the same interface but delivered via the Facebook channel the only difference there is every time I interact one of those web hooks is getting fired bi-directionally and that's what's delivering the user experience from Lex into the facebook chat session very very simple to implement can integrate with twilly off SMS I could integrate with with slack and deliver exactly the same experience via the different channels or I could have different aliases for the same function which deliver channel specific functionality if I needed to do so one example of a situation where I might use that is the fact that we have support for cards so we can deliver graphical user elements into Facebook chat using a standard that Facebook have implemented defined that enables us to embed URLs and embed images in responses to messages as well so we may have that functionality only in a test version of our bot that we're using on Facebook pointed at one alias and then we may have other functionality in a production version pointing at another alias for other channels so you have flexibility to route to route have the same bot service by a number of different versions concurrently depending which channel the interactions coming from okay what else - sure I think that's pretty much everything I wanted to show actually I've got about 8 minutes left does anybody have any questions here in the room does anybody have any questions on the stream that they want to ask yeah in what sense so every initial interaction needs to resolve down to either no intend or one one and only one intent okay so the way that we are going to provide access to this for a customer is to connect a customer to a specific bot either using a channel based interface or using attributes in the API call that's made to the Lexx API okay and that will restrict the namespace of available intense to the intents that are defined within that bot so I can't have the same namespace active and therefore have conflict between book a trip and between book a trip and my session written bot okay and I could have logic in my fulfillment functions that allow a user to say make a booking okay and then respond back to them with what would you like to book okay so that's something that I can build in my dialogue hooks essentially if you've got that opportunity for customers to perform the same action on multiple different resources I think is what you're driving at yeah question here somewhere I think you have a question that doesn't seem to be the question is is there a catch-all if you miss an intent there is actually and you can see in my code here so you see this intent with name is not supported well that would be raised as an exception but it would also you could route that back out and speak it or render it back to the client so you can catch undetected event undetected intents and basically say I don't understand or what do you mean that's available as an option both in the console and available as an option in logic that you might build yourself in response to dialog hooks as well yep you can you can log it so you so you can you can't see if the model is conflicted okay so that's not something that's available today but you can of course log the bots so you could build dialog that allowed a customer to abort or drop the session midway through okay and their session will timeout automatically after a predefined period which you can see you actually set within within the console top-level so above the intent so what I would suggest doing to defect to detect that in your workflow is to use things like cloud watch metrics and logging to determine to what extent customers are abandoning sessions midway through and use that as a mechanism for resolving down and trying to identify issues of that type so it's not a component of the service but it's something that you could build by doing analytics around service usage yeah yep you could do that or you can offer the opportunity to cancel yeah typically that takes place at the end of the collection process yep question over here so the question is is the model static and is it the case that there's no way no way in lambda to fill the slots dependent depending on prior choices that the user might have made and the answer to that is no it's not you can assign default values to the slots as part of your application logic okay so in my code here I could go ahead yeah yes so you'd write that in your validation logic my answer still holds true you would write that in your validation logic so I mean let's take an example here say I am booking travel and in my corporate travel policy for certain destinations it's mandatory thy book a hotel whenever I book a flight okay but for other destinations it's not not mandated that I do so so I couldn't book a flight independent of booking a hotel I can create logic that represents that business rule inside my dialog handler okay so I could say for example have an attribute which was do you need to book a hotel okay and then I could evaluate the contents of the destination slot and if the destination slot matches a subset I could assign a very valued to do need to book a hotel to know okay but if that value is unassigned then I could prompt the user for a hotel for the details of a hotel do you follow so you're having conditional logic in your back-end but that is statically defined it's not something that is dynamically defined so the question there is can you assign default values to slots and the answer again is yes you can do that but it would be in your handling function so to do these kinds of advanced or support these kinds of more advanced use cases more advanced logic flows you can't just do that with the simple front-end to collect slot values you're going to have to have a lambda function which implements the kind of logic that you're talking about but yes you can assign default values to slots when you hit the lambda function returning them back to the client in the session attributes and then the client will not attempt to revalidate and reflect those slots again so yes you can do that any other questions in the room we've got two minutes left so I'll take one more go ahead yes yep so the question is how do i rich to the sample utterances have to be and what sort of documentation exists and buddy prompted me on the docs cuz I'm going to show that to close but the some sample utterances the more you create the better the bot will be picking up the intent okay so I've got quite a few here because I identified in debug that I was picking phrases out of my head randomly for rating and the intent was not being detected so I built additional to help resolve the intent more accurately but you might have noticed in the of the demo bot that I showed you the book trip interface the very light I would book a car was over can't make a car reservation so it's very light okay and if you've got intents that could potentially conflict as I've got book of leave a rating and leave feedback they're quite similar then I probably want to have more example or two answers to help me resolve down okay so the last thing that I wanted to show is documentation for this service which i think is something that's really important here you've got just a sample from the documentation which is the response format so if you want to write your own back-end these are the objects that you're going to be dealing with are going to be passed to your lambda function for interpretation and evaluation it's probably the most important part of the lambda of the Amazon Lex Docs for developers that want to build rich validation experiences so understand this schema okay and understand particularly things like fulfillment code hook and dialogue code hook so when you need to fulfill your session will be tagged invocation so source fulfillment code work it means all slots of being filled than you ready to go okay if you pre that state you'll be getting dialogue code hook which means not everything's here yet you need logic to help gather more responses or validation logic to help make sure what you have is valid okay so it's a really important part of the docs and I'd recommend you're going to start working on this with anything sophisticated take a look at that okay we're out of time I think so thank you thanks for joining us on stream and I'll see you next week okay
Info
Channel: Amazon Web Services
Views: 11,029
Rating: 4.9649124 out of 5
Keywords: AWS, Amazon Web Services, Cloud, cloud computing, AWS Cloud
Id: VsvEyQSFfRc
Channel Id: undefined
Length: 50min 57sec (3057 seconds)
Published: Sun Oct 01 2017
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.