Skip to main content

rag-debugger

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.

Install

pip install rag-debugger-amine

For the local dashboard:

pip install rag-debugger-amine[dashboard]

Quickstart

import rag_debugger as rd

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

Gap detection

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)
# [GAP DETECTED] coverage=50%  worst_score=0.64  priority=0.50
#   Missing: refund policy, iOS-specific cancellation
#   Fix: Add docs covering refund eligibility and iOS cancellation flow.
#     ✓ [0.71] how to cancel
#     ✗ [0.64] how to get a refund

Why sub-intent decomposition

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.

Session grouping

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)
# Session conv-123
#   duration:    430ms
#   events:      2
#   avg score:   0.741
#   worst score: 0.677
#   gaps:        0 / 2

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

Local dashboard

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

Integrations

Works with LangChain, LlamaIndex, and any custom pipeline:

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

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

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

LLM & embedding backend

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

License

MIT

Release files for rag-debugger-amine 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rag-debugger-amine 0.2.0
File Size Uploaded
rag_debugger_amine-0.2.0.tar.gz 25.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for rag-debugger-amine 0.2.0
File Interpreter ABI Platform
rag_debugger_amine-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size:44.5 kB

Release files / rag_debugger_amine-0.2.0.tar.gz

Download URL rag_debugger_amine-0.2.0.tar.gz
Size 25.4 kB
Tags Source
SHA-256 checksum
How to use checksums
dfd802bdc75be7fb4fa0e7515e406c1d04d915d5ba06c8bebc6a3b90ed21a5da
BLAKE2b-256 checksum
How to use checksums
f3a95a7595d7e88729a2750115782b07413a77e7a6de870c39b423708ba8a279
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 14, 2026.

Transparency log

Release files / rag_debugger_amine-0.2.0-py3-none-any.whl

Download URL rag_debugger_amine-0.2.0-py3-none-any.whl
Size 19.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9a22a70c7424b00887149e69d0cdd18b6071703216a510a3f451cc97cbf83d64
BLAKE2b-256 checksum
How to use checksums
a4c600d19236d7068ba964793487d12f756c694c2bf99a1d067d3fb77642e219
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 14, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page