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.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file causa_rag_client-0.1.1.tar.gz.
File metadata
- Download URL: causa_rag_client-0.1.1.tar.gz
- Upload date:
- Size: 22.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0b096781ff10c894d7004bb75c427790f973520de4e529f35aeaf247b7e9c12e
|
|
| MD5 |
c649d0af44a494defa75485ef5f203c1
|
|
| BLAKE2b-256 |
e1287398f4e89a6c6333a7475dd1b83e0cee29d705c17113e830f2d797209b92
|
File details
Details for the file causa_rag_client-0.1.1-py3-none-any.whl.
File metadata
- Download URL: causa_rag_client-0.1.1-py3-none-any.whl
- Upload date:
- Size: 16.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
818eb57eeb1a44a9a96b8b2d519d691b611c344dc0eb3aefa74e40e5a92c24ef
|
|
| MD5 |
6ad3f1438193afb479375d3a9993d7cd
|
|
| BLAKE2b-256 |
0ac11f27227c4727beca375c1aa4f7c015c3891592631b07b3d1b6b9fd603c7a
|