open-source retrieval pipeline

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.

shell
$pip install prod-rag
209 deterministic tests0 paid APIs in CIMIT · PyPI: prod-rag
quickstart.py
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]
evidence

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.

production-rag — playground
Sources

example session · recorded values · try it yourself on GitHub →

design decisions

Built like infrastructure, not a demo.

The unglamorous parts — chunking, dedup, retries, thresholds — are done properly. That’s what makes the answers trustworthy.

grounding & citations

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.

abstention

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.

idempotency

Re-index without duplicates

SHA-256 content hashes drive deterministic point IDs. Re-uploading is a no-op; deletes leave no orphans.

portability

Providers are configuration

Jina, Groq, OpenRouter — any OpenAI-compatible endpoint. Switching is an env var, not a rewrite.

engineering

209 offline tests

Deterministic suites with mocked HTTP transports. Nothing in CI ever touches a paid API.

deployment

Embedded or server Qdrant

Zero infrastructure for local work — the same codebase against a Qdrant server in production.

the difference

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 chatbotproduction-rag
groundingModel memory, plus whatever fits in one pasteYour entire corpus, retrieved per query
citationsVague links, if anyPage-level [n] markers with similarity scores
no evidenceConfident hallucinationAbstention — the LLM is never called
quality controlTrust it209 offline tests · eval harness on the roadmap
deploy

Runs where you run.

One codebase, two topologies: an embedded vector store for local work, Qdrant as a server for production.

local development

Embedded mode

Qdrant runs in-process with the API. No containers, no services — your data never leaves the machine.

$uvicorn backend.app.main:app --reload
production

Server mode

Docker Compose runs Qdrant next to the API — the production topology, one command away.

$docker compose up --build

every stage sits behind an abstract interface — swap embeddings, LLM, or vector store with EMBEDDING_API_KEY, LLM_BASE_URL, VECTOR_STORE_URL

on the roadmap
hybrid searchbm25 + denseneural rerankingretrieval eval harness
the eval harness generates its own questions, answers them against the index, and scores retrieval quality — a RAG system that grades itself.

Start building in five minutes.

Two free-tier API keys, one document indexed, and you have a grounded question-answering pipeline.

shell
$pip install prod-rag