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
390 stars 249 forks source link

LLM reasoning based on multiple text passages #650

Open cristi-constantin opened 10 months ago

cristi-constantin commented 10 months ago

How can I get the QnABot to pass more than one text passage item to the LLM engine?

For example, I have two texts that, whenever I delete one, the other one is picked up as a suitable answer and passed to the LLM. So, both of them are relevant/above the threshold. When both are present, just one is picked up by the OpenSearch and passed to the LLM as context. I don't use Kendra. I want both/several text passages to be passed to the LLM so the LLM can answer questions requiring more than one passage to infer the proper answer. Thank you.

rstrahan commented 10 months ago

Currently QnABot only passes one text passage to the LLM - whichever one has the highest relevance score..

This is so that if the matched text item has additional behavior, such as response card images or buttons, session attribute settings, lambda hooks, etc.. QnAbot will honor and process these.. BUT that can be done only if there is a single text item match used in the answer.

If multiple text passages were allowed, I think the tradeoff would be to disable any/all of that additional capability, and use the text item simply as context for the LLM.. I do expect this is a good tradeoff to offer in return for supporting TopN text item matches for LLM input.

@marcburnie - new feature request?

kroeter commented 9 months ago

We've added this request to our backlog, but it is not currently planned for development in the next 6 months. I'll provide updates on this thread if that changes.