- Newest
- Most votes
- Most comments
At the end of an intent, if you want to confirm that the customer wants to proceed with a booking, I would recommend that you do not switch intents, instead use a slot to determine if they want to continue or not. If they choose to continue you fulfill the intent with a lambda.
You can create a custom slot that can handle yes/no/repeat/main menu (or if you only ned yes/no, then you can use the built in confirmation slot type) At the end of the intent you elicit for this slot and route based on the response
To create separate prompts from no-input vs no-match you will have to use lambda. Check the inout transcript. If it is empty you have a no-input. If it contains input, but the slot does not contain a resolved value, then you have a no-match
To handle your scenario effectively, you can use a combination of intent confidence scores and a fallback intent in Amazon Lex. Here's an approach you can consider:
-
Define specific intents: Create separate intents for YES, NO, REPEAT, and MAIN MENU with clear, distinct utterances for each.
-
Use confidence scores: Amazon Lex V2 provides confidence scores for intents. You can compare these scores to determine the most likely intent when the user responds. For example, if the YES intent has a significantly higher confidence score than the others, you can proceed with the booking.
-
Implement a fallback intent: Add an AMAZON.FallbackIntent to your bot. This will be triggered when Lex can't confidently match the user's input to any of your defined intents.
-
Custom Lambda function: Use a Lambda function as a dialog code hook to handle the logic for intent selection and fallback scenarios. In this function, you can:
- Check the confidence scores of the recognized intents
- Implement custom logic to choose the appropriate intent based on the context of the conversation
- Handle no-input and no-match cases by checking for the fallback intent
-
Retry prompts: In your Lambda function, keep track of the number of retry attempts for no-input and no-match cases. You can use session attributes to store this information. Based on the retry count, you can provide custom prompts or take appropriate actions (like transferring to a human agent).
-
Clarification prompts: Configure clarification prompts in your Lex bot to handle ambiguous inputs. These prompts will be used when Lex can't confidently determine the user's intent.
By combining these techniques, you can create a more controlled flow for intent recognition in your specific confirmation scenario, while still maintaining flexibility for these intents to be used in other parts of your bot. This approach allows you to handle the conditional intent restriction and fallback cases effectively without relying solely on context scoping.
Sources
AMAZON.FallbackIntent - Amazon Lex V1
Using intent confidence scores to improve intent selection with Lex V2 - Amazon Lex
Relevant content
- AWS OFFICIALUpdated 4 years ago

Thanks for your response. I have a question regarding the use of the slot-based approach. Suppose I have a custom slot with the value "Yes" and multiple synonyms mapped to it. For instance, in response to the question “Can I proceed with the booking?”, a user might say something like “please do the booking,” which should ideally be interpreted as “Yes.”
Is it considered good practice to include longer phrases—say, 4 to 5 words—as synonyms in the slot definition? Or is there a better approach to handle such responses?