Skip to main content

Wittgenstein

A review layer for retrieval-augmented generation (RAG). It runs beside the pipeline you already have, checks every answer against the passages it came from, and points a person to the few sentences worth a look: a dose that isn't in the source, a patient group or condition that was dropped, a citation to the wrong passage, an answer that says nothing at all.

It also knows the pipeline it is watching: how the documents were split, what the search returned, and what never reached the model. So a flag can say whether the model misread a passage or was never given the right one.

Install and run

pip install wittgenstein-rag
wittgenstein serve          # opens the local interface at http://127.0.0.1:8100

Add --demo to see a few example answers first. Everything runs on your machine; the first run downloads a small English language model (about 12 MB).

Connect your pipeline

Add two lines where your app starts:

import wittgenstein.monitor as wm
wm.instrument()

LangChain and LlamaIndex pipelines are detected and hooked automatically, with no other code changes. Every answer then appears in the local interface with what was retrieved, what went into the prompt, and what needs checking. For any other pipeline, report each answer yourself:

wm.record(question, retrieved_chunks, answer, prompt=prompt_text)

Reporting happens in the background and never slows or breaks your pipeline.

Or call the API

curl -X POST http://127.0.0.1:8100/v1/check -H "content-type: application/json" -d '{
  "query": "What is the starting dose of metformin extended-release?",
  "candidates": [{"id": "c1", "text": "The recommended starting dosage is 500 mg once daily with the evening meal."}],
  "answer": "Start at 850 mg once daily. [1]"
}'

summary.needs_review in the response says whether a person should look, and each flagged sentence says why. Full documentation is in the running app under API.

Limits

Flags mean "a person should look", not "this is wrong". The checks are tuned on drug labels; citation, empty-answer, document and context checks work in any domain. See the repository for the evaluation behind it.

Supported by a grant from the Cosmos Institute.

Metadata

Release files for wittgenstein-rag 0.2.0

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

Built distribution (wheel)

Table of built distributions (wheels) for wittgenstein-rag 0.2.0
File Interpreter ABI Platform Actions
wittgenstein_rag-0.2.0-py3-none-any.whl Python 3 none any Details for wittgenstein_rag-0.2.0-py3-none-any.whl

Release files / wittgenstein_rag-0.2.0-py3-none-any.whl

Download URL wittgenstein_rag-0.2.0-py3-none-any.whl
Size 1.0 MB
Tags Python 3
SHA-256 checksum
How to use checksums
73b6aef609acff6f18e76656cd981fb5a69558d54cfe64b4d56924a6ac433337
BLAKE2b-256 checksum
How to use checksums
7c9ccdb884d11dc6b5d57f9b92072d9cfdc3f8b17bcf39eee5c791576a533edd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for wittgenstein-rag 0.2.0

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.

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