Find answers from the community

Updated last year

I have a collection of long documents

I have a collection of long documents, which I am trying to chunk and index with a SentenceSplitter. How can I help to ensure that RAG retrieval returns results at a document level?

To be clear, what I mean is, I want to index chunks, but when I perform a search like, "find me conversations with rude speakers", that I get back a list of the best matching documents and not just the best matching nodes as the latter may result in just returning 10 segments/nodes from the same 'very rude conversation'.

The chunking helps with search, but does llama-index provide any sort of built in mechanism to facilitate the retrieval filtering?

Ideally my goal is to support things like "find me the rudest conversations from last week" or something along those lines. I'm close but this document-level post-filter has got me stuck.
L
c
7 comments
You can write a custom node-postprocessor to iterate over retrieved nodes, and use node.ref_doc_id or the node metadata to find the parent document
@Logan M thanks, but I guess this would still require me to filter the responses, as opposed to incorporating this concept into the retrieval and scoring process itself?
I'm using OpenSearch as the backend and I was hoping to do something similar to what is supportedin Elastic, where the vector search response can return the top K documents directly instead of just the top K segments
The issue I"m trying to overcome is if I retrieve the 'top 5' hits but all five hits come from the same document, then I end up only looking at 1 conversation.
I guess for now I can just increase N to very large number and iterate though.
Yea that would be the workaround

Under the hood, that's basically exactly what I would implement in the library if I was to add this feature πŸ˜†
Add a reply
Sign up and join the conversation on Discord