0212GitHub
daf-jev
A Python toolkit: question builders, confidence gates and calibration.
docxology/daf-jevREADME ↗
# daf-jev [](https://doi.org/10.5281/zenodo.22816187) [](pyproject.toml) [](LICENSE) [](https://zenodo.org/records/22817425) Modular, composable Python client and decision toolkit for the **TypeSafe Jev (System One) API**. One HTTP endpoint, three question primitives, and a set of pure-logic composition patterns built on top of the answers — plus a concurrent batch evaluation harness, an MCP server, a figure registry, and a reproducible manuscript pipeline. ## What it provides - **Primitives** — `noul` (yes/no), `choice` (pick an option from a probability distribution), `score` (rated on ordered levels). Build questions with `noul()` / `choice()` / `score()` and group them in a `QuestionSet`; batch any number of questions into a single API call. - **Client** — `JevClient` / `AsyncJevClient` wrapping `POST https://api.typesafe.ai/v1/systemone`, with retries (429/529, exponential backoff, `Retry-After`), typed error mapping, and a `models()` listing. Retry policy, default timeout, and default model resolve from the environment (see [Configuration](#configuration)); every `ask` call also accepts a per-call `timeout` override and extra `request_headers` (merged over the defaults for that call only). - **Composition patterns** — pure functions over answers: `composite_score` (probability-weighted expected value over score levels), `confidence_gate` (auto-escalate low-confidence answers), `route` / `pick` (intent routing by choice). - **Evaluation** — `Evaluator` runs a fixed question set over many states concurrently (thread pool for `JevClient`, `asyncio` semaphore for `AsyncJevClient`) without aborting the batch: per-state failures are captured in `EvaluationRecord.error`. `summary()` aggregates per-question means/p95s; `to_json()` seria