kernel-memory
kernel-memory copied to clipboard
DiversitySampling with Memory for DocumentQA
Moved from semantic-kernel
For document QA, when using Memory and filtering solely by relevance_score, you end up with results that are mostly from similar sections of the same document. However, when a comprehensive answer considering the overall content is necessary, utilizing various parts from diverse documents rather than just including sections from a single document in the prompt can be beneficial.
After reading the provided link, I found it to be a good idea and propose integrating it as a feature used in conjunction with Memory.
This post introduces the concepts of DiversityRanker and LostInTheMiddleRanker. The concept of LostInTheMiddleRanker is closely related to the overall structure of prompts, so I didn't include it in this proposal for now, as it might be challenging to integrate solely with Memory.
Implementation code in haystack is here