Skip to main content

Local-first retrieval reliability for evaluating, comparing, and debugging multi-stage RAG retrieval

Project description

retobs

PyPI CI

retobs is a local-first retrieval reliability layer for multi-stage RAG pipelines. It helps ML engineers evaluate a retriever, compare a baseline and candidate, and trace a failed query to the operator and candidate transition that actually occurred.

It is not an answer evaluator or a leaderboard. Conclusions are withheld when ground truth, run identity, paired samples, or replay evidence is insufficient.

Five-minute callable quickstart

python -m venv .venv
source .venv/bin/activate
pip install "retrieval-observatory[dashboard]"

Create retrieval_eval.py:

CORPUS = {
    "d1": "Hybrid retrieval combines lexical and dense search.",
    "d2": "A reranker rescores an existing candidate set.",
}
QUERIES = [
    {"query_id": "q1", "text": "What combines lexical and dense search?"},
]
QRELS = {"q1": {"d1": 1}}

def retrieve(query: str) -> list[str]:
    return ["d1", "d2"] if "lexical" in query else ["d2", "d1"]

Evaluate it without YAML:

retobs evaluate retrieval_eval.py:retrieve --format terminal
retobs serve --db .retobs/results.db

The command prints a run ID, evidence health, a conclusion, affected queries, and the next action. Open the printed Run URL to inspect recorded operator and candidate evidence. The same path is available in Python:

import retrieval_observatory as ro
from retrieval_eval import CORPUS, QRELS, QUERIES, retrieve

report = ro.evaluate(retrieve, queries=QUERIES, corpus=CORPUS, qrels=QRELS)
print(report.run_id)
print(report.to_json())

Baseline-to-cause workflow

Run an explicit baseline and candidate, then compare them in that order:

retobs compare BASELINE_RUN CANDIDATE_RUN --db .retobs/results.db --format markdown
retobs inspect-query CANDIDATE_RUN QUERY_ID --db .retobs/results.db

compare first validates query, corpus, qrel, and label identity. An invalid comparison has no winner. Valid comparisons use paired query alignment, Benjamini-Hochberg correction, declared effect thresholds, and power labels. The Query page then shows:

  • query text, dataset, qrels, and label provenance;
  • exact recorded operator spans and terminal/partial status;
  • relevant documents added, promoted, demoted, or dropped;
  • the first measured loss operator when reconstructable;
  • replay separately labeled as exact, observed ablation, or unavailable;
  • an evidence-backed next action and validation link.

Try the deterministic local story:

pip install "retrieval-observatory[demo,dashboard]"
retobs demo --db .retobs/demo/results.db --output-dir .retobs/demo
retobs serve --db .retobs/demo/results.db

It creates one Test Set, a healthy baseline, a regressed candidate, a post-change validation run, and sampled production traces. No API key is required.

Query debugger showing measured relevant-document movement

Watch the short regression-to-validation workflow.

Core capabilities

Task What retobs provides
Evaluate Callable-first or advanced YAML execution with per-query metrics, canonical manifests, complete/partial traces, and reports.
Compare Explicit baseline/candidate orientation, validity gating, corrected paired statistics, config/topology differences, and affected queries.
Debug Query-to-operator-to-candidate evidence with exact and aggregate PipelineGraphV2 views.
Production Sampled traces, drift/hotspot methods, windows, thresholds, denominators, and supporting trace links. Quality is absent without joined ground truth.
Test Sets Corpus-derived stress queries with dataset/query label provenance, validation coverage, exact Run links, and paginated tables.

Primary dashboard navigation is Home, Runs, Compare, Queries, Production, Test Sets. Forge, TraceLens, Advisor, and Benchmarks remain internal/legacy vocabulary rather than separate products.

Integration support

First-class paths are plain Python, HTTP, FastAPI, LangChain, and LlamaIndex. Haystack, DSPy, and OpenAI Agents are supported examples with a narrower maintenance guarantee. See the support matrix and the agent quickstart.

To inspect before changing a project:

retobs integrate . --plan
retobs verify --db .retobs/results.db

Agents can call MCP plan_integration, apply the returned patch, then call verify_integration. A result is ready, partially_instrumented, not_verified, or failed; zero observed runs is never ready.

Trust model

  • Measured means persisted execution, qrel, metric, or candidate-transition evidence.
  • Statistical means a declared paired procedure with sample size, effect, correction, and power state.
  • Replayed means a supported counterfactual under listed assumptions.
  • Heuristic and inferred are visibly labeled and never promoted to causal proof.
  • Unavailable is a first-class result; retobs does not manufacture a delta or quality score.

Wall-clock, critical-path, and operator-sum latency are distinct fields. Production proxy signals are not Recall. Generated/extractive labels are not called gold until validated. Full rules are in Evidence and trust.

Reports and CI

Terminal, JSON, Markdown, and standalone HTML share one report model:

retobs report RUN_ID --format html --output retobs-run.html
retobs compare BASELINE CANDIDATE \
  --format markdown --output retobs-comparison.md \
  --fail-on regression-or-no-decision

See the PR workflow and CI gating reference.

Local-first scope

SQLite and PostgreSQL stores are supported. The dashboard is single-tenant and has no authentication by default; do not expose it directly to an untrusted network. Query text, document identifiers/metadata, traces, and generated Test Set content may be sensitive. See Data and privacy and Security policy.

Documentation

License: MIT.

Project details


Download files

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

Source Distribution

retrieval_observatory-0.5.0.tar.gz (663.6 kB view details)

Uploaded Source

Built Distribution

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

retrieval_observatory-0.5.0-py3-none-any.whl (794.0 kB view details)

Uploaded Python 3

File details

Details for the file retrieval_observatory-0.5.0.tar.gz.

File metadata

  • Download URL: retrieval_observatory-0.5.0.tar.gz
  • Upload date:
  • Size: 663.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for retrieval_observatory-0.5.0.tar.gz
Algorithm Hash digest
SHA256 7154f8ed7e9e4e8da20b116fafb7b70c19833a0c28fe24222fb3cec83a7f0bf5
MD5 2de1e9ee4104eb503aeb1321fad09bf8
BLAKE2b-256 afbfbce77f5ec331c19e023c3f57a56f9775270d3b5e0c3a24810ac43b9e809b

See more details on using hashes here.

Provenance

The following attestation bundles were made for retrieval_observatory-0.5.0.tar.gz:

Publisher: publish.yml on AmeyaKI/retrieval-observatory

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file retrieval_observatory-0.5.0-py3-none-any.whl.

File metadata

File hashes

Hashes for retrieval_observatory-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0a689a2ffca9858283f11c37170257312a7c9baa2f311f8b4857cd943f113da2
MD5 1bf091ee0f007b1907c23b188ec27572
BLAKE2b-256 c12dd2320915502d948ac3433bae3bad5c3b812e0f73e4160c4a649d96c623d6

See more details on using hashes here.

Provenance

The following attestation bundles were made for retrieval_observatory-0.5.0-py3-none-any.whl:

Publisher: publish.yml on AmeyaKI/retrieval-observatory

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page