Skip to main content

causa-rag-client

The Python client for Causa RAG, a diagnostic bench for retrieval-augmented generation.

Point the bench at a RAG system you already run, and it will score every question in a golden set separately, name the pipeline stage that failed, and compare two runs question by question — so the effect of a configuration change is visible instead of assumed.

This package is the thin end: it drives an existing REST API and computes nothing itself. Evaluation always happens on the platform.

Install

pip install causa-rag-client            # the client alone (httpx)
pip install causa-rag-client[serve]     # plus serve(), which needs fastapi and uvicorn

Two roles

Connecting your RAG. serve() wraps your own functions in the platform's HTTP contract and returns an app; run_server() runs it, so you do not write an HTTP server by hand. Retrieval alone is enough to be measured — pass a generator too and the bench can score the answers as well:

from causa_rag_client import serve, run_server

def retrieve(question: str, top_k: int) -> list[dict]:
    ...   # your retrieval
    return [{"doc_id": d, "chunk_text": t, "score": s} for d, t, s in hits]

def generate(question: str, sources: list[dict]) -> str:
    ...   # your generation, optional
    return answer

run_server(serve(retrieve, generate), port=8000)

A third parameter, corpus_id, is passed to retrieve only if its signature asks for it: a two-argument function keeps working untouched.

Driving the bench. RagPlatformClient registers that endpoint, uploads a dataset, runs an experiment and fetches the result:

from causa_rag_client import RagPlatformClient

client = RagPlatformClient("http://localhost:8081")
rag = client.register_rag(name="my-rag", url="http://localhost:8000", realm_id="demo")
run = client.run_experiment(
    name="first run", dataset_name="golden.v1", rag_id=rag["id"], top_k=10,
)
print(client.get_results(run["run_id"]))

Two version numbers, and which one to read

The package has its own version, and the HTTP contract it speaks has another. They are not the same number, and an earlier release of this README said they were. CONTRACT_VERSION inside the package is the contract's; the version on the package page is the library's.

The contract is at version 1 and holds while all of this holds:

  • no field is removed or renamed;
  • no optional field becomes required;
  • the meaning of an existing field does not change;
  • new fields are additive and optional.

The client checks the platform's reported contract version before sending anything. A different major version raises ContractVersionMismatch instead of sending a request the platform cannot parse; a different minor version only warns, because the platform bumps the minor part for additions that older clients can ignore.

Not in Python?

The contract is ordinary JSON over HTTP and needs no client at all. The field-by-field reference is docs/external-rag-contract.md; adding two endpoints to a service you already run is the whole integration.

Licence

Apache-2.0. Copyright 2026 Alexander Laputski.

Metadata

Release files for causa-rag-client 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for causa-rag-client 0.1.1
File Size Uploaded Provenance Actions
causa_rag_client-0.1.1.tar.gz 22.1 kB Without provenance Details for causa_rag_client-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for causa-rag-client 0.1.1
File Interpreter ABI Platform Actions
causa_rag_client-0.1.1-py3-none-any.whl Python 3 none any Details for causa_rag_client-0.1.1-py3-none-any.whl

Total release size: 38.8 kB

Release files / causa_rag_client-0.1.1.tar.gz

Download URL causa_rag_client-0.1.1.tar.gz
Size 22.1 kB
Tags Source
SHA-256 checksum
How to use checksums
0b096781ff10c894d7004bb75c427790f973520de4e529f35aeaf247b7e9c12e
BLAKE2b-256 checksum
How to use checksums
e1287398f4e89a6c6333a7475dd1b83e0cee29d705c17113e830f2d797209b92
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5

Release files / causa_rag_client-0.1.1-py3-none-any.whl

Download URL causa_rag_client-0.1.1-py3-none-any.whl
Size 16.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
818eb57eeb1a44a9a96b8b2d519d691b611c344dc0eb3aefa74e40e5a92c24ef
BLAKE2b-256 checksum
How to use checksums
0ac11f27227c4727beca375c1aa4f7c015c3891592631b07b3d1b6b9fd603c7a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5

Security for causa-rag-client 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.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

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