ragwatch
ragwatch is a lightweight, zero-friction Python SDK for evaluating, monitoring, and detecting regressions in RAG (Retrieval-Augmented Generation) pipelines.
Think of it as a mini LangSmith or Braintrust — built from scratch.
Features
| Feature | Description |
|---|---|
@monitor decorator |
Drop on any function for instant latency & trace logging |
Evaluator class |
Run evaluations against a golden dataset in one call |
| Regression Detection | Auto-alerts when metrics drop below baseline thresholds |
| SQLite Storage | Human-readable, git-friendly local storage |
| Baseline Promotion | Promote any run to the reference baseline |
Installation
pip install ragwatch
Or install from source (editable mode):
git clone https://github.com/mohammedsohel2052/ragwatch
pip install -e ./ragwatch
Quick Start
1. Zero-Friction Monitoring with @monitor
from ragwatch import monitor
@monitor(project_name="my-rag-bot")
def generate_answer(query, docs):
# Your existing RAG generation code — unchanged
return {"answer": "...", "latency_ms": 120}
Every call now logs a trace to ragwatch.db and prints:
[RAGWatch] ✓ Traced 'generate_answer' | 452ms | project='my-rag-bot'
2. Full Evaluation Pipeline
from ragwatch import Evaluator
evaluator = Evaluator(db_path="eval_results.db", embed_fn=my_embed_fn)
summary = evaluator.evaluate(
golden_dataset=dataset, # list of {"question": ..., "expected_answer": ..., ...}
retrieval_fn=my_retrieval_fn, # fn(query) -> list[dict]
generation_fn=my_generation_fn, # fn(query, docs) -> {"answer": str, "latency_ms": float}
)
3. Regression Detection
# Check current run against the stored baseline
alerts = evaluator.check_regressions(summary)
# If happy with results, promote as the new baseline
evaluator.promote_to_baseline(summary["run_id"])
4. RAGWatch UI Dashboard (Mini-LangSmith)
Visualize your evaluations and live telemetry instantly. From your project root, run:
python -m ragwatch.ui
Then open http://localhost:5050 in your browser.
- Evaluations Tab: Track Precision, Recall, Relevancy, and Faithfulness over time.
- Live Traces Tab: See exactly what your
@monitordecorator is capturing in real-time.
Metrics Explained
| Metric | What it measures |
|---|---|
| Context Precision | Of retrieved chunks, what % were actually relevant? |
| Context Recall | Of all needed chunks, what % did we retrieve? |
| Answer Relevancy | Semantic similarity between generated & expected answer |
| Faithfulness | Did the model hallucinate when it shouldn't have? |
Project Structure
ragwatch/
├── ragwatch/
│ ├── __init__.py # Public API
│ ├── evaluator.py # Main Evaluator class
│ ├── scorer.py # Metric calculation functions
│ ├── storage.py # SQLite persistence (runs + traces)
│ ├── monitor.py # @monitor decorator
│ └── regression.py # Regression alert logic
└── pyproject.toml
Built By
Mohammed Sohel Patwari — GitHub
Inspired by RAGAS, LangSmith, and Braintrust.
Metadata
Release files for ragwatch-sdk 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ragwatch_sdk-0.1.1.tar.gz | 9.1 kB | Without provenance | Details for ragwatch_sdk-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ragwatch_sdk-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for ragwatch_sdk-0.1.1-py3-none-any.whl |
Total release size: 18.3 kB
Release files / ragwatch_sdk-0.1.1.tar.gz
| Download URL | ragwatch_sdk-0.1.1.tar.gz |
|---|---|
| Size | 9.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8c8e4f8ac43b2ce7211cffde15f63f423d4a3be7314803bb036797385771bb01
|
|
BLAKE2b-256 checksum How to use checksums |
a551b25ff6590c43f0a2be5ff6b6725c55917863391ed0982ebc97883f8266c9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.14
|
Release files / ragwatch_sdk-0.1.1-py3-none-any.whl
| Download URL | ragwatch_sdk-0.1.1-py3-none-any.whl |
|---|---|
| Size | 9.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f2730c3fa0c67094db66fe77b6caea7abf52e155c7006e33e824b2c3452b7d88
|
|
BLAKE2b-256 checksum How to use checksums |
9e59ccea303db6bddce41615ef5ac81e248495463f2963f21da6570c4436734c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.14
|
Security for ragwatch-sdk 0.1.1
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.