Retriever that supports multiple embeddings per parent document.
This retriever is designed for scenarios where documents are split into smaller chunks for embedding and vector search, but retrieval returns the original parent documents rather than individual chunks.
It works by:
This pattern is commonly used in RAG pipelines to improve answer grounding while preserving full document context.
Retrieve small chunks then retrieve their parent documents.
When splitting documents for retrieval, there are often conflicting desires:
The ParentDocumentRetriever strikes that balance by splitting and storing small chunks of data. During retrieval, it first fetches the small chunks but then looks up the parent IDs for those chunks and returns those larger documents.
Note that "parent document" refers to the document that a small chunk originated from. This can either be the whole raw document OR a larger chunk.