working_enhanced_retriever

Working Enhanced MCP Retriever - Parent-Child + Self-Query Combined.

This demonstrates the key pattern: metadata on child chunks enables self-query filtering while returning full parent documents.

Classes

WorkingEnhancedRetriever

Working implementation of combined parent-child + self-query retriever.

Functions

main()

Run working example.

Module Contents

class working_enhanced_retriever.WorkingEnhancedRetriever

Working implementation of combined parent-child + self-query retriever.

create_self_query_on_chunks(llm, query: str, k: int = 5)

Create self-query retriever that operates on child chunks.

async enhanced_query(llm, query: str, k: int = 5)

The magic: Use self-query on chunks, return parent documents.

setup()

Set up the enhanced retriever.

child_vectorstore = None
doc_loader
embeddings
parent_retriever = None
parent_store
async working_enhanced_retriever.main()

Run working example.