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
391 stars 250 forks source link

The reply of the qna bot is sometimes null/blank (intermittent) #759

Open dangollayan opened 1 month ago

dangollayan commented 1 month ago

Describe the bug The qna bot sometimes replies a blank reply/ null when using lambda hook. image

To Reproduce Create an agent with knowledgebase/action group as a lambda hook then attached it to no hits intent image

Expected behavior The bot should be able to reply with what the lambdah hook returned

Please complete the following information about the solution:

Screenshots no errors in fulfillment lambda as well image

dangollayan commented 1 month ago

Hi, I've just finished troubleshooting and noticed that if the Lambda hook process exceeds 30 seconds, it returns a blank reply. Can anyone help with this issue?

bobpskier commented 1 month ago

@dangollayan If I'm not mistaken, LexV2 has a 30 second timeout on RecognizeText fulfillment. If the QnABot fulfillment processing exceeds this time (including lambda hook) then LexV2 will timeout the request. I believe there are some default messages that can be configured for this case in LexV2. Also, depending on your lexv2 client, the calls to LexV2 might be able to send in a streaming based request although I'm not sure how QnABot would handle this. I think the default for a timeout can be longer using streaming. I've never experimented with streaming for example from the LexWebUi AWS sample to QnABot but perhaps this would give you a chance to stream some messages while the processing is taking place on the back end lambda hook.

dangollayan commented 1 month ago

@dangollayan If I'm not mistaken, LexV2 has a 30 second timeout on RecognizeText fulfillment. If the QnABot fulfillment processing exceeds this time (including lambda hook) then LexV2 will timeout the request. I believe there are some default messages that can be configured for this case in LexV2. Also, depending on your lexv2 client, the calls to LexV2 might be able to send in a streaming based request although I'm not sure how QnABot would handle this. I think the default for a timeout can be longer using streaming. I've never experimented with streaming for example from the LexWebUi AWS sample to QnABot but perhaps this would give you a chance to stream some messages while the processing is taking place on the back end lambda hook.

thanks for your thoughts @bobpskier!

fhoueto-amz commented 1 month ago

Hi @dangollayan Here is the link to the documentation of the timeout limit https://docs.aws.amazon.com/lexv2/latest/APIReference/API_runtime_RecognizeText.html. We will clarify in our documentation

dangollayan commented 4 weeks ago

Hi @dangollayan Here is the link to the documentation of the timeout limit https://docs.aws.amazon.com/lexv2/latest/APIReference/API_runtime_RecognizeText.html. We will clarify in our documentation

hi @fhoueto-amz, can you elaborate how can we configure the time out to QNA bot setup?

As per checking the document, it has this image

michaelin-96 commented 4 days ago

@dangollayan

I would start here for the Lex API reference docs: https://docs.aws.amazon.com/lexv2/latest/dg/streaming-progress.html#progress-updates. Seems like you can specify a timeout length of up to 15 minutes (900 seconds)

dangollayan commented 3 days ago

@dangollayan

I would start here for the Lex API reference docs: https://docs.aws.amazon.com/lexv2/latest/dg/streaming-progress.html#progress-updates. Seems like you can specify a timeout length of up to 15 minutes (900 seconds)

Doesn't work with the solution

abhirpat commented 2 days ago

Hi @dangollayan ,

To answer your questions, I'd suggest to try post-processing lambda hook and examine the input event to the lambda. In that input event, you can modify sessionState as needed to set timeToLive. Before implementing this solution, you will want to evaluate if there is negative impact of this change in terms of concurrency and lambda 15 min timeout .

For more information on post-processing lambda hooks, please see Lambda Hooks

Best, Abhishek