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

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-1.0.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-1.0.0-py3-none-any.whl (26.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: rag_hub-1.0.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-1.0.0.tar.gz
Algorithm Hash digest
SHA256 cd8d4f72409b0bf10645da1bcd10c82b694ac1597af11acaaab13459dde99b9c
MD5 cf5317e45493f06e8adda421bf589ec8
BLAKE2b-256 8037ce9965fb551f2d25c52408ebe392ca2eedac8caf941cc33466faf0f6add5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: rag_hub-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 26.9 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-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 92f864e67bc78e9a19cbcc29ede53f02b2bb8a58f518967e8e590aec2ab2151b
MD5 b321846ba79b2defac86da6cdc794c9a
BLAKE2b-256 f9d0d330901f32735d60ad16a30c9a44862ae4260b9f3af1d9244cc54174783c

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 files

0.1.0

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