Show HN: Smart Router Kit – Prevent "Garbage in" for RAG Using Pydantic and LLMs (github.com)

🤖 AI Summary
Part 2 of the "Smart Ingest" series unveils a Smart Router Kit that stops blind chunk-and-embed pipelines by inserting a lightweight LLM decision step before ingestion. Instead of dumping every document into one vector store, a small model classifies each item and returns a Pydantic-validated RoutingDecision (target_collection, chunking_strategy: "standard"|"table_aware"|"vision", confidence, reasoning). A demo (pip install pydantic; python examples/demo_routing.py) shows how this “Ingestion Traffic Controller” routes documents to domain-specific semantic collections (finance, tech, etc.) and picks the optimal processing strategy for tables, images, or text. This matters for RAG systems because mixed-content collections degrade retrieval quality—“Garbage In, Garbage Out.” The kit makes routing explicit, auditable, and type-safe (thanks to Pydantic), enabling better embeddings, lower noise, and more efficient downstream retrieval. Technically, you connect a DocumentRouter to an Ollama or OpenAI client to perform the small LLM pass, then apply specialized chunkers/embedders per collection. Implications include improved accuracy, reduced cost/latency by avoiding unnecessary processing, and easier governance or confidence-thresholding based on the decision’s confidence and reasoning.
Loading comments...
loading comments...