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 start               # runs in the background; feed at http://127.0.0.1:8100/#/pipeline
wittgenstein autostart enable    # optional: start at every login

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.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.3.0
File Interpreter ABI Platform Actions
wittgenstein_rag-0.3.0-py3-none-any.whl Python 3 none any Details for wittgenstein_rag-0.3.0-py3-none-any.whl

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

Download URL wittgenstein_rag-0.3.0-py3-none-any.whl
Size 1.0 MB
Tags Python 3
SHA-256 checksum
How to use checksums
134221e18bc9e1fe4a6841e6cee26b1c07c0cc70915873eb65fb60f6ca2f0734
BLAKE2b-256 checksum
How to use checksums
f6cd5465e5d743431dccd899f71496dceb66b5650070560609abb038f88f9d44
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.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