FR : python3 -m examples.review_roundtrip exporte une ligne synthétique incertaine, applique une annotation humaine simulée et ferme sa revue sans changer le texte ni les probabilités. Pour vos données, jev-codebook-review export puis apply contrôlent les empreintes de la ligne et du codebook, refusent une revue périmée, conservent les colonnes supplémentaires et produisent un journal séparé. Guide FR/EN/ES.
EN: python3 -m examples.review_roundtrip exports one uncertain synthetic row, applies a simulated human annotation and closes review without changing text or probabilities. For your data, jev-codebook-review export then apply check row/codebook fingerprints, reject stale review, retain extra columns and produce a separate audit. FR/EN/ES guide.
ES: python3 -m examples.review_roundtrip exporta una fila sintética incierta, aplica una anotación humana simulada y cierra la revisión sin cambiar texto ni probabilidades. Para sus datos, jev-codebook-review export y apply comprueban huellas de fila/codebook, rechazan revisión caducada, conservan columnas adicionales y generan registro separado. Guía FR/EN/ES.
Run python3 -m examples.review_export to get a CSV of uncertain messages from the synthetic support fixture. The top candidate and probability are hints for a person, not an automatic label. / Exécutez cette commande pour obtenir un CSV des messages synthétiques incertains ; le meilleur candidat reste une aide à la revue, pas une étiquette automatique. / Ejecute este comando para obtener un CSV de mensajes sintéticos inciertos; el candidato principal ayuda a la revisión, no es una etiqueta automática.
Apply a qualitative codebook to open-ended survey answers, reviews or interview excerpts with Jev, and get per-code probabilities, a review queue, frequency tables with confidence intervals and inter-rater reliability against your human coders.
Jev (TypeSafe AI's "System One" model) does not generate text: you send a state and typed questions, it returns probabilities. That fits qualitative coding well: each code becomes one yes/no question with your definition and examples as criteria, and every decision (assign, review, ignore) stays in code with thresholds you can tune on your own labeled data. Runtime is Python 3.11+ standard library only.
git clone https://github.com/gbesse/jev-codebook.git
cd jev-codebook
python3 -m examples.single_mode_demoEN: Five fictional support messages show a bug, a feature request, a billing question, an uncertain message sent to human review, and an explicit none_of_these abstention. The demo needs no package installation or API key and makes no network request after cloning. The probabilities are synthetic fixtures, not measured Jev output.
FR : Cinq messages fictifs montrent un bug, une demande de fonctionnalité, une question de facturation, un cas incertain transmis à un humain et une abstention explicite none_of_these. La démo ne nécessite ni installation du paquet ni clé API et ne fait aucune requête réseau après le clonage. Les probabilités sont fictives et ne mesurent pas Jev.
ES: Cinco mensajes ficticios muestran un fallo, una solicitud de función, una pregunta de facturación, un caso incierto enviado a revisión humana y una abstención explícita none_of_these. La demo no requiere instalar el paquete ni usar una clave API y no hace solicitudes de red después de clonar. Las probabilidades son datos de ejemplo, no mediciones de Jev.
id chosen assigned review
s1 bug bug no
s2 feature feature no
s3 billing billing no
s4 feature none yes
s5 none_of_these none no
The five messages, codebook and probability fixtures are readable files. For the full 40-response workflow, including the review queue, agreement against synthetic human labels and threshold tuning, run python3 -m examples.offline_demo. All figures in both demos are synthetic and illustrate mechanics, not accuracy.
The same flow through the CLI:
pip install -e . # or: export PYTHONPATH=src
jev-codebook validate examples/codebook.json
jev-codebook estimate examples/responses.csv --codebook examples/codebook.json
jev-codebook code examples/responses.csv --codebook examples/codebook.json --out coded.csv --review review.csv --cache .jev-cache.json --fake examples/fixtures.json
jev-codebook agreement coded.csv examples/human.csv --codebook examples/codebook.json
jev-codebook tune coded.csv examples/human.csv --codebook examples/codebook.json --write-codebook tuned.json
jev-codebook report coded.csv --codebook examples/codebook.jsonexport TYPESAFE_API_KEY=... # requests are paid and go to https://api.typesafe.ai/v1/systemone
jev-codebook estimate responses.csv --codebook codebook.json
jev-codebook code responses.csv --codebook codebook.json --out coded.csv --review review.csv --cache .jev-cache.jsonDrop --fake and the client pins jev-1.13.0, checks that the returned model matches, retries only on 429/529 and network errors (bounded, jittered, honoring Retry-After), refuses redirects, and never prints the key. --concurrency (default 8) and --rate-limit (default 1,000 requests/min, under the published 1,200) bound the load. --cache stores validated answers by sha256 of the exact request, so re-running after editing thresholds or resuming an interrupted batch costs nothing; errors are never cached. --out is also the resume journal: ids already present are skipped.
The official SDKs (typesafe-sdk on PyPI, @typesafe-ai/sdk on npm) are an alternative to the built-in client if you already use them; this repository ships its own so you install nothing.
Price list on 21 Sept 2026: USD 0.042 per million input tokens, output free. The response text alone is small: 10,000 answers of ~150 tokens are ~1.5M tokens, about USD 0.06. The codebook questions travel with every request, and for the 6-code example with definitions and examples they weigh ~800 tokens per request, so the same 10,000 answers come to roughly 8M tokens, about USD 0.35. jev-codebook estimate prints the number for your files (chars/4 heuristic). Both figures are estimates from the published price, not a bill.
- Responses: CSV (default) or JSONL (
.jsonl/.ndjson) with anidand atextcolumn (--id-column,--text-column). Blank texts are skipped and counted; duplicate ids are an error. - Codebook: JSON, see
examples/codebook.json:
{
"name": "orbit-lamp-feedback", "version": "1.0", "language": "en", "mode": "multi",
"review_band": [0.4, 0.7],
"codes": [
{ "id": "price_concern", "label": "Price concern",
"definition": "The response says the lamp is expensive, overpriced or questions whether it is worth the money.",
"include_examples": ["Too expensive for a lamp."], "exclude_examples": ["Worth every cent."],
"threshold": 0.7 }
]
}- Coded CSV:
id, text, <code>... (0/1), p_<code>... , review (0/1), request_id.request_idis the first 12 hex chars of the cache key of each request (joined with+when a response needed several). - Human labels:
idplus either one 0/1 column per code or acodescolumn with;-separated ids.
from jev_codebook import JevClient, FakeJev, load_codebook, code_responses
from jev_codebook.cache import ExactInputCache
from jev_codebook.datafiles import read_responses
codebook = load_codebook("codebook.json")
responses = read_responses("responses.csv").responses
provider = JevClient() # reads TYPESAFE_API_KEY; or FakeJev.from_file("fixtures.json")
summary = code_responses(responses, codebook, provider, cache=ExactInputCache(".jev-cache.json"), concurrency=8)
for row in summary.rows:
print(row.id, row.assigned, row.probabilities, row.review)
print(summary.input_tokens, summary.estimated_cost_usd)jev_codebook.stats exposes wilson_interval, cohen_kappa, krippendorff_alpha_nominal, percent_agreement and binary_metrics; jev_codebook.agreement exposes compute_agreement, tune_thresholds and split_ids.
- State is
{"response": "<text>"}and nothing else. Ids, timestamps and metadata are left out on purpose: Jev's accuracy drops with irrelevant state. - Multi mode (a response can carry several codes): one
noulquestion per code, all in one request per response (fan-out), chunked at 40 codes per request. Instructions:Does this response express the code '<label>'?. Criteria:true: { what: <definition>, examples: <include_examples> },false: { what: "The response does not express '<label>': it is about something else, or only mentions a related topic without expressing it.", examples: <exclude_examples> }. - Single mode (exactly one code or none): one
choicequestionWhich single code best describes what this response expresses?over the codes plusnone_of_these. - Assignment (code-owned): multi mode assigns a code when
p >= threshold(default 0.7 per code); the row is flaggedreviewwhen any code'spfalls inreview_band[0.4, 0.7). Single mode assigns the chosen option when its probability clears that code's threshold and flagsreviewwhen the winning probability is below the band's upper bound. agreementcomputes per code: percent agreement, Cohen's kappa, Krippendorff's alpha (nominal, two coders), precision, recall and F1 with Wilson 95% intervals, over the ids present in both files.tunesplits the matched ids 60/40 at random with a fixed seed (--seed 42), picks each code's threshold by F1 on the 60% tuning split only (candidates 0.05 to 0.95), and reports holdout metrics at the current and tuned thresholds. The holdout labels never enter the choice; a test enforces it.reportprints frequencies with Wilson 95% intervals, a co-occurrence matrix and the rows closest to their decision boundary.
Thresholds and the review band are illustrative defaults. Calibrate them on your own labeled sample with tune; they are not guarantees. Details in docs/method.md.
- It does not write, merge or discover codes; it applies the codebook you wrote. Codebook quality drives results: direct definitions, no negations, concrete examples.
- Jev reads instructions literally, cannot count, compares numbers and dates poorly, and is weakest on long irrelevant context and adversarial text (see the model notes linked below). Keep responses short and codes explicit; do arithmetic in code.
- p(A) and p(not A) do not sum to 1 across questions, so multi-mode probabilities are independent judgments, not a distribution over codes. Use single mode when codes are mutually exclusive.
- English gives the best accuracy; other languages work with lower accuracy.
languagein the codebook is informational. - No live benchmark is claimed. The fixture probabilities are synthetic. Whatever accuracy you get is what
agreementshows on your own human-coded sample. --fakeis for tests and demos only; the review queue is the intended human-in-the-loop step, not an optional extra.
pip install -r requirements-dev.txt # editable install, no other dependencies
python -m compileall -q src tests
python -m unittest discover -s tests
python -m examples.offline_demoCI (.github/workflows/test.yml) runs exactly these on Python 3.11 and 3.13. Tests cover codebook validation errors, question construction, chunking beyond 40 codes, CSV round trips, resume, cache hits, kappa/Wilson/alpha against textbook values, tune/holdout separation, the fake provider path, client validation on malformed responses and retries on 429/529. Nothing in CI calls the API.
Opt-in live check (2 paid requests with one synthetic sentence, only when the key is set): TYPESAFE_API_KEY=... python scripts/live_smoke.py.
- Question Forge: write and test Jev questions before putting them in a codebook.
- DecisionPacks: versioned decision rules over Jev answers, if the coded output feeds a downstream workflow.
- Autonomy Meter: measuring how much of a decision pipeline can run without review.
Independent project; not affiliated with TypeSafe AI. API reference: https://docs.typesafe.ai/api. Model notes: https://docs.typesafe.ai/model-jaggedness/jev-1.13.
Français : essayer un cas concret · English: try a concrete case · Español: pruebe un caso concreto.
FR : Le moteur n’admet qu’un nombre de lignes égal à la concurrence configurée (entier 1–64), au lieu de mettre tout le corpus en file. Après un échec, aucune ligne en attente n’est admise ; les lignes déjà en cours peuvent terminer leurs appels et le pool attend leur fin. Les réponses et le codebook sont copiés avant exécution ; identifiants vides ou dupliqués sont refusés avant appel. Ces contrôles ne mesurent pas la qualité du codage humain ou du modèle.
EN: The engine admits only as many rows as configured concurrency (integer 1–64), instead of queueing the whole corpus. After a failure no pending row is admitted; already-running rows may finish their calls and the pool waits for them. Responses and codebook are copied before execution; empty or duplicate IDs are rejected before calls. These checks do not measure human or model coding quality.
ES: El motor admite solo tantas filas como la concurrencia configurada (entero 1–64), en lugar de encolar todo el corpus. Tras un fallo no admite filas pendientes; filas iniciadas pueden terminar sus llamadas y el pool espera su fin. Respuestas y codebook se copian antes de ejecutar; rechaza identificadores vacíos o duplicados antes de llamar. No mide calidad de codificación humana o del modelo.
FR : disagreement_queue(coded,human_labels) trie les désaccords par réponse, sans confondre code non jugé et code négatif. Les identifiants inconnus sont refusés ; texte des réponses absent du rapport, aucun appel fournisseur.
EN: disagreement_queue(coded,human_labels) orders response disagreements without treating unjudged codes as negatives. Unknown IDs rejected; response text omitted from report, no provider calls.
ES: disagreement_queue(coded,human_labels) ordena desacuerdos por respuesta sin tratar códigos no juzgados como negativos. Rechaza identificadores desconocidos; omite texto y no llama proveedor.
FR : Borner les fréquences d’affectation des codes en conservant les revues en attente comme inconnues.
EN: Bound code-assignment frequencies while keeping pending reviews unknown.
ES: Acotar frecuencias de asignación de códigos conservando revisiones pendientes como desconocidas.