I'm trying to create a chatbot using Amazon Lex to display results from a database. The designed conversational flow is to show 10 results at first, and then provide an option for the user to "See more results?", which would be a Yes/No question. This would give an additional 10 results from the database. I have searched through the documentation and forums on the internet, to understand a way to add this follow-up Yes/No question, and have been unsuccessful. I'm relatively new to LEX and am unable to model this conversational flow. Can someone explain this/direct me to the right documentation?
Any help/links are highly appreciated.
You can create your own Yes/No custom slot type in the Lex Console.
I've built one as an example here:
I named the slot type affirmation
Then I restricted a list of synonyms to equate to either Yes
or No
values.
This allows a user to respond naturally in many different ways and the bot will respond appropriately. All you have to do is build your Lambda handling of any slot that uses this slot type to look for either "Yes" or "No".
You can easily monitor this slot too to log any input that was not on your synonym list in order to expand your list and improve your bot's recognition of affirmations and negations.
I even built a parser for this slot in Lambda to be able to recognize emoji's (thumbs up/down, smiley face, sad face, etc.) correctly as positive or negative answers to these type of questions in my bot.
It might be surprising that Lex doesn't have this built-in like Alexa, but it's not hard to build and you can customize it easily which you cannot do with built-in slot types.
Anyway, after making this SlotType, you can create multiple slots that use it in one intent.
Lets say you create a slot called 'moreResults' and another called 'resultsFeedback'. Both would be set to use this 'affirmation' slotType to detect Yes/No responses.
Then when you ElicitSlot either of these slots in the convo, you can form the question specifically for each slot. And you can check whether the slot is filled with values 'Yes' or 'No' in your Lambda on the next response.