Skip to main content

RAG Hub 🔍

Visualize exactly where your RAG pipeline breaks.

Most RAG problems are invisible — wrong chunks retrieved, LLM given bad context, silent failures at retrieval. RAG Hub 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-hub

With framework support:

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

Quickstart

Generic pipeline (works with anything)

from rag_hub 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_hub 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_hub 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 Hub — 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_hub       ← 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_hub/
├── 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

Metadata

Release files for rag-hub 1.0.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-hub 1.0.0
File Size Uploaded
rag_hub-1.0.0.tar.gz 22.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for rag-hub 1.0.0
File Interpreter ABI Platform
rag_hub-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 49.2 kB

Release files / rag_hub-1.0.0.tar.gz

Download URL rag_hub-1.0.0.tar.gz
Size 22.3 kB
Tags Source
SHA-256 checksum
How to use checksums
cd8d4f72409b0bf10645da1bcd10c82b694ac1597af11acaaab13459dde99b9c
BLAKE2b-256 checksum
How to use checksums
8037ce9965fb551f2d25c52408ebe392ca2eedac8caf941cc33466faf0f6add5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.4

Release files / rag_hub-1.0.0-py3-none-any.whl

Download URL rag_hub-1.0.0-py3-none-any.whl
Size 26.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
92f864e67bc78e9a19cbcc29ede53f02b2bb8a58f518967e8e590aec2ab2151b
BLAKE2b-256 checksum
How to use checksums
f9d0d330901f32735d60ad16a30c9a44862ae4260b9f3af1d9244cc54174783c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.4

Release history Release notifications | RSS feed

This release

1.0.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