aws-solutions / qnabot-on-aws

AWS QnABot is a multi-channel, multi-language conversational interface (chatbot) that responds to your customer's questions, answers, and feedback. The solution allows you to deploy a fully functional chatbot across multiple channels including chat, voice, SMS and Amazon Alexa.
https://aws.amazon.com/solutions/implementations/aws-qnabot
Apache License 2.0
401 stars 253 forks source link

Unusual behaviour of invalid slot input #696

Closed dangollayan closed 7 months ago

dangollayan commented 9 months ago

Describe the Issue: We are encountering intermittent responses when inputting invalid values into a slot. Occasionally, the response originates from the ELICIT_RESPONSE_RETRY_MESSAGE, image while at other times, it stems directly from the slot message within the bot. image

Please refer to this sample: image

Steps to Reproduce:

  1. Initially, a custom responseBot was created. You can refer to this extracted bot JSON QNAName_Bot-DRAFT-JYGSKBYNQI-LexJson(1).zip

  2. The content of this responseBot solely comprises the sample utterance and a slot with the type AMAZON.FirstName. image

  3. Integration was established with a question from the QnA Bot Designer. image

Expected behavior: N/A

Please complete the following information about the solution:

dougtoppin commented 9 months ago

@dangollayan Thank you for your report. We will investigate and get back to you.

fhoueto-amz commented 7 months ago

Hi @dangollayan This is the expected behavior. Please to https://docs.aws.amazon.com/lexv2/latest/dg/built-in-intent-fallback.html. As stated "Amazon Lex V2 matches the fallback intent in these situations:

The user's input to an intent doesn't match the input that the bot expects

Audio input is noise, or text input isn't recognized as words.

The user's input is ambiguous and Amazon Lex V2 can't determine which intent to invoke."

So when your input is not recognized as words, the main bot Fallback is invoked right away. When your input is recognized as words, the qna main bot intent is invoked which passes the input to your elicit bot which then tries to match the name and will fall back if not recognizing a name. So the intent match is what is playing out here. Even with the same input, as previous context of the conversation are passed through the intent match may vary i.e. the same intent can match a slot in a given context but not in another context.