cd /news/ai-tools/i-built-a-python-sdk-to-debug-rag-pi… · home topics ai-tools article
[ARTICLE · art-130206] src=github.com ↗ pub= topic=ai-tools verified=true sentiment=↑ positive

I Built a Python SDK to Debug RAG Pipelines

A developer released rag-debugger, an open-source MIT-licensed Python SDK that intercepts and inspects retrieval-augmented generation (RAG) pipelines to surface missing knowledge-base coverage. The tool, installable via "pip install rag-debugger-amine," decomposes queries into atomic sub-intents, scores each independently, and routes borderline scores between 0.60 and 0.75 through a reranker LLM call; its GapDetector defaults to a 0.65 threshold. rag-debugger uses Google Gemini by default with the gemini-3.5-flash-lite LLM and gemini-embedding-001 embeddings, supports LangChain, LlamaIndex, and custom retrievers, and ships a local dashboard at http://localhost:7842 that auto-refreshes every 10 seconds.

read2 min views3 publishedSep 15, 2026
I Built a Python SDK to Debug RAG Pipelines
Image: Michielbdejong (auto-discovered)

Intercept, inspect, and fix your RAG retrieval pipeline.

Most RAG bugs aren't in your code — they're in your retrieval. Wrong chunks get selected, knowledge gaps go undetected, and you find out when users complain. rag-debugger gives you visibility into exactly what your vector DB returned, why it won, and what's missing from your knowledge base.

pip install rag-debugger-amine

For the local dashboard:

pip install rag-debugger-amine[dashboard]
python
import rag_debugger as rd

rd.init(project="my-rag-app")
retriever = rd.wrap_retriever(your_retriever)

Find what your knowledge base is missing before your users do:

from rag_debugger import GeminiClient, GapDetector

client = GeminiClient()  # set GEMINI_API_KEY env var
detector = GapDetector(client)  # default threshold is 0.65

chunks = your_retriever.get_relevant_documents(query)
report = detector.analyze(query, [{"content": c.page_content} for c in chunks])

print(report)

A query like "cancel my iOS subscription and get a refund" is really four questions. Standard RAG scores the whole query — if cancellation chunks score high, the query looks covered. rag-debugger decomposes it into atomic sub-intents and scores each one independently, so a missing refund policy is always caught even when the cancellation docs are excellent.

Borderline scores (0.60–0.75) are passed through a reranker — a lightweight LLM call that asks "does this chunk actually answer this question?" — so semantically similar but irrelevant chunks don't pass as covered.

Group multi-turn conversations under a single session to get a summary of retrieval quality across the whole interaction:

with rd.session(id="conv-123", user="user-42") as s:
    retriever.get_relevant_documents("first query")
    retriever.get_relevant_documents("follow-up query")

summary = s.summary()
print(summary)

Sessions are thread-safe — concurrent requests in a web app won't bleed into each other.

Visualize retrieval events, chunk scores, and gap flags in a local web UI:

rd.dashboard()  # opens http://localhost:7842

The dashboard shows:

  • Per-session summary — avg score, worst score, gap count
  • Per-event chunk score bars with content preview
  • Gap flags with missing topics and fix suggestions
  • Auto-refreshes every 10 seconds

Works with LangChain, LlamaIndex, and any custom pipeline:

retriever = rd.wrap_retriever(vectorstore.as_retriever(), label="docs")

retriever = rd.wrap_retriever(index.as_retriever())

retriever = rd.wrap_retriever(my_retriever, method="fetch_docs")

rag-debugger uses Google Gemini by default (free tier via Google AI Studio):

from rag_debugger import GeminiClient
client = GeminiClient(api_key="...")  # or set GEMINI_API_KEY env var

Models used:

  • LLM: gemini-3.5-flash-lite
  • Embeddings: gemini-embedding-001

MIT

── more in #ai-tools 4 stories · sorted by recency
── more on @rag-debugger 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
Live at https://your-agent.zahid.host
Get free account → Pricing
from €0/mo · no card required
LIVE [news/i-built-a-python-sdk…] indexed:0 read:2min 2026-09-15 ·