RAG that shows its work.
Upload documents, ask questions, and get answers grounded in retrieved passages — cited to the exact page, or refused when the evidence doesn’t clear the threshold. A typed, testable pipeline from PDF to answer.
from rag_core import RAGPipeline
# index a document
pipeline = RAGPipeline()
pipeline.index_document("report.pdf")
# ask — the answer arrives with citations
answer = pipeline.query("What changed in v2?")
print(answer.answer)
# "Rate limits doubled. [1]"
print(answer.sources)
# [report.pdf · page 4 · 0.82]Every claim comes with a receipt.
A chatbot answers from memory and hopes you don’t check. production-rag retrieves from your corpus, cites the exact passages it used, and refuses when nothing retrieved is good enough.
example session · recorded values · try it yourself on GitHub →
Built like infrastructure, not a demo.
The unglamorous parts — chunking, dedup, retries, thresholds — are done properly. That’s what makes the answers trustworthy.
Page-level citations
Every [n] marker resolves to a file, a page, and a cosine score. Click a marker, read the exact passage the answer used.
Refuses when evidence is thin
If the top score doesn't clear the threshold, the LLM is never called. “I don't know” is designed behavior, not a failure mode.
Re-index without duplicates
SHA-256 content hashes drive deterministic point IDs. Re-uploading is a no-op; deletes leave no orphans.
Providers are configuration
Jina, Groq, OpenRouter — any OpenAI-compatible endpoint. Switching is an env var, not a rewrite.
209 offline tests
Deterministic suites with mocked HTTP transports. Nothing in CI ever touches a paid API.
Embedded or server Qdrant
Zero infrastructure for local work — the same codebase against a Qdrant server in production.
Why not just paste it into a chatbot?
Because a chatbot answers from memory and hopes you don’t check. This one answers from your corpus and shows the evidence — or abstains.
| Generic chatbot | production-rag | |
|---|---|---|
| grounding | Model memory, plus whatever fits in one paste | Your entire corpus, retrieved per query |
| citations | Vague links, if any | Page-level [n] markers with similarity scores |
| no evidence | Confident hallucination | Abstention — the LLM is never called |
| quality control | Trust it | 209 offline tests · eval harness on the roadmap |
Runs where you run.
One codebase, two topologies: an embedded vector store for local work, Qdrant as a server for production.
Embedded mode
Qdrant runs in-process with the API. No containers, no services — your data never leaves the machine.
Server mode
Docker Compose runs Qdrant next to the API — the production topology, one command away.
every stage sits behind an abstract interface — swap embeddings, LLM, or vector store with EMBEDDING_API_KEY, LLM_BASE_URL, VECTOR_STORE_URL
Start building in five minutes.
Two free-tier API keys, one document indexed, and you have a grounded question-answering pipeline.