jev_bridge/lib.rs
1//! Bridge a generic OpenAI-compatible inference API into a Jev-style decision
2//! scoring service.
3//! Jev-style decisions are not a model format; they are a readout. This crate
4//! implements that readout on top of any runtime that can return next-token log
5//! probabilities:
6//!
7//! 1. render the `direct-options-v1` prompt through the serving runtime's own
8//! chat template, with thinking disabled;
9//! 2. read the log probabilities of the fixed uppercase answer letters at the
10//! final position;
11//! 3. softmax only over the declared options, so no other vocabulary can leak
12//! into the distribution;
13//! 4. answer in the System One wire format with `choice`, `noul` and `score`
14//! questions.
15//!
16//! No model weights are copied and no answer text is generated: a decision
17//! costs one prompt evaluation and zero output tokens.
18//!
19//! # Layout
20//!
21//! * [`strategy`] probes the upstream service and parses the response shapes
22//! different runtimes use for the same distribution.
23//! * [`prompt`] owns the prompt contract, the single-token answer-slot check
24//! and the softmax.
25//! * [`server`] holds [`server::Bridge`] and the HTTP surface.
26//! * [`wire`] validates System One requests and builds their responses.
27//! * [`evaluate`] turns `--score` predictions plus a gold file into offline
28//! calibration metrics (accuracy, NLL, Brier, ECE, reliability curve) and
29//! recomputes a written report for verification.
30//! * [`readout`] runs the startup self-check: a few questions with obvious
31//! answers, read through the same slot channel every request uses, so a
32//! model that is not answering the question at all is visible instead of
33//! silently confident.
34//!
35//! The `jev-bridge` binary is a thin CLI over [`server::Bridge`].
36//!
37//! # Documentation
38//!
39//! Every public item is documented, and the crate builds with
40//! `#![warn(missing_docs)]` so that stays true.
41
42#![warn(missing_docs)]
43
44pub mod evaluate;
45pub mod perturb;
46pub mod prompt;
47pub mod readout;
48pub mod render;
49pub mod server;
50pub mod strategy;
51#[cfg(feature = "local-tokenizer")]
52pub mod tokenizer;
53pub mod wire;