This Alexa Voice Skill demo shows how bots can ask conversational follow-on questions if the user misses any required variables to solve the intent. This demo uses hard-coded flight status information, source & destination pairs. The flight status can be computed when the bot knows the Flight Carrier and Flight Number when either of the variables isn’t specified in the conversation – the bot asks for the follow-up question requesting the missing variable. On the other side, when the user provides both carrier and flight number, it directly answers the query.
Maintaining the conversational state is achieved by passing the Session Attributes back to the user request which gets piggy-backed with the new response; the Lambda function captures both of them to see if it has all of the variables to respond back with the status, the Session State is kept alive end until this cycle is completed. For the scenario where the user specifies both the variables, the session is set to complete after returning the flight status information.
The above screenshot shows the slots (variables) used to train the Alexa voice skill. Amazon has several pre-configured Slot-Types which can be readily used to interface with the Lambda function, without having the need to keep updating the possible values [Airline]; like when there is a new Airline in the market, we can expect that Amazon would update the slot values and our code can pick up on the new airline with zero changes to the code.
The key point in the overall setup is the usage of Amazon Lambda to process the queries from the Alexa Gateway. All the voice inputs from the end user are captured by Alexa Gateway which translates to the specified intents and slots [Natural Language Processing to Programmable Interface Parameters] and the Gateway calls the Lambda function. Using Lambda brings several advantages to the table like being infinitely scalable, serverless, and pay-for-only-what-is-used.