Skip to main content

RAG Debugger 🔍

Visualize exactly where your RAG pipeline breaks.

Most RAG problems are invisible — wrong chunks retrieved, LLM given bad context, silent failures at retrieval. RAG Debugger makes every step visible so you can fix it fast.

QUERY  "What is the cancellation policy?"

  ✏️  Query Rewriter    success    0.014ms
  🔍  Vector Search     success    0.025ms    3 chunks  top score 0.94
  🤖  GPT-4o            error      0.012ms    ← broke here

💥 Pipeline broke at: llm
   RuntimeError: OpenAI API rate limit exceeded

What It Does

  • Traces every step — query transform, embedding, retrieval, rerank, LLM
  • Shows your chunks — see exactly what context your LLM received
  • Catches breaks — know immediately which stage failed and why
  • Visual UI — pipeline flowchart at localhost:7384, opens automatically
  • Terminal output — rich summary printed after every trace
  • Works with anything — LangChain, LlamaIndex, or raw Python

Install

pip install rag-debugger

With framework support:

pip install rag-debugger[langchain]
pip install rag-debugger[llama-index]
pip install rag-debugger[all]

Quickstart

Generic pipeline (works with anything)

from rag_debugger import init, StepType, Chunk

debugger = init()   # starts UI at localhost:7384

with debugger.trace("What is the refund policy?") as t:

    with debugger.step(StepType.RETRIEVAL, "My Retriever") as s:
        chunks = my_retriever.search(t.query)
        s.chunks = chunks

    with debugger.step(StepType.LLM, "GPT-4o") as s:
        answer = my_llm.generate(t.query, chunks)
        s.model = "gpt-4o"

    t.answer = answer

LangChain

from rag_debugger import init

debugger = init(framework="langchain")

# pass handler to any LangChain component
chain.invoke(
    {"query": "What is the refund policy?"},
    config={"callbacks": [debugger.handler]}
)

Decorator style

from rag_debugger import init, StepType

debugger = init()

@debugger.trace_step(StepType.RETRIEVAL, "My Retriever")
def retrieve(query):
    return vector_store.search(query)

What You See

Terminal

╭─────────────────────────────────────────╮
│  RAG Debugger — Trace a1b2c3d4          │
╰─────────────────────────────────────────╯

QUERY  "What is the refund policy?"

  ✏️   Query Rewriter    success    0.014ms
  🔍   Vector Search     success    0.025ms    3 chunks  top score 0.94
  🤖   GPT-4o            success    0.012ms    312→52 tokens

ANSWER  "You have 30 days to request a refund."

Total: 0.051ms  |  framework: custom  |  steps: 3

Browser UI — localhost:7384

  • Left panel — all traces with status and timing
  • Right panel — full pipeline flowchart
  • Click any step — see chunks, tokens, errors, input/output
  • Live updates — new traces appear instantly as pipeline runs

How It Works

Your RAG pipeline
      │
      ▼
import rag_debugger       ← wraps each stage
      │
      ├── records every step (timing, chunks, tokens, errors)
      │
      ├── terminal summary (rich)
      │
      └── FastAPI server  ← localhost:7384
              │
              └── pipeline flowchart UI

No external services. No API keys. Runs entirely on your machine.


Examples

# see a working pipeline
python examples/basic_usage.py

# see the debugger catching errors
python examples/broken_pipeline.py

Project Structure

rag_debugger/
├── core/           ← tracer, store, models
├── integrations/   ← langchain, llama_index, generic
├── server/         ← fastapi + websocket
├── ui/             ← browser interface
└── cli/            ← terminal output

Contributing

Pull requests welcome. See CONTRIBUTING.md to get started.

Areas that need work:

  • Haystack integration
  • LlamaIndex deeper event coverage
  • Embedding step visualization
  • Trace export to JSON/CSV

License

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rag_hub-0.1.0.tar.gz (22.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rag_hub-0.1.0-py3-none-any.whl (27.2 kB view details)

Uploaded Python 3

File details

Details for the file rag_hub-0.1.0.tar.gz.

File metadata

  • Download URL: rag_hub-0.1.0.tar.gz
  • Upload date:
  • Size: 22.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.4

File hashes

Hashes for rag_hub-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3faaee09a4830d2458b05453699f615583f26d3e3659dbcd32502476c027f4da
MD5 a27ef968669dc7a95934494f83c2ebbe
BLAKE2b-256 5bf6d32ef963733f1aeb6d86f1f094c7a453065ae3f76f2a5853960dc9715965

See more details on using hashes here.

File details

Details for the file rag_hub-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: rag_hub-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 27.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.4

File hashes

Hashes for rag_hub-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2eb5e85885a0576816b6bf1fee93a6ebde2548908b99c770ca18bbf9cd4dc65c
MD5 1de5171ec597d7b79a76fc87be6f1794
BLAKE2b-256 0f999f4787d1147c270b9f9c7e77b116b0689e31f38c37feb891a6c4ba5cbe40

See more details on using hashes here.

Release history Release notifications | RSS feed

1.0.0

2 files

This release

0.1.0 This release

2 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