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 start # runs in the background
wittgenstein autostart enable # optional: start at every login
Then watch your app's answers being checked, in the terminal or in a window:
wittgenstein watch # in the terminal (also works over SSH; --plain for logs)
pip install "wittgenstein-rag[app]" && wittgenstein app # in its own window
wittgenstein status and wittgenstein stop do what they say. Everything runs on your
machine; the first run downloads a small English language model (about 12 MB).
Connect your app
Wittgenstein runs as its own process beside your app. It sees each request and checks the answer afterwards, so it never adds latency or blocks a response.
Any language: the model proxy. Point your model client's base URL at Wittgenstein:
OpenAI-compatible http://127.0.0.1:8100/proxy/openai/v1
Anthropic http://127.0.0.1:8100/proxy/anthropic
Requests go on to the real API unchanged, streamed or not, with your own API key. Use
wittgenstein start --openai-upstream http://localhost:11434 for Ollama or any other
OpenAI-compatible server.
Python, no code changes:
wittgenstein run python app.py
LangChain and LlamaIndex are hooked automatically; nothing is installed into your app's environment.
Or in code:
import wittgenstein.monitor as wm
wm.instrument() # LangChain / LlamaIndex
wm.record(question, retrieved_chunks, answer) # anything else
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.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| wittgenstein_rag-0.3.1-py3-none-any.whl | Python 3 | none | any | Details for wittgenstein_rag-0.3.1-py3-none-any.whl |
Release files / wittgenstein_rag-0.3.1-py3-none-any.whl
| Download URL | wittgenstein_rag-0.3.1-py3-none-any.whl |
|---|---|
| Size | 1.0 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b627ad254a9335eeb9b37fbbdadec747c35e96484e074a0bee5c097cf9d48100
|
|
BLAKE2b-256 checksum How to use checksums |
bc47450bc02c58e3acd6001a5dddd3f5887768b2d80a77f639795dd87ec9f9ed
|
| 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.3.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.