pub struct Decision {
pub answers: BTreeMap<String, Answer>,
pub model: String,
pub provider: String,
pub calibrated: bool,
pub input_tokens: Option<u64>,
pub output_tokens: Option<u64>,
pub usd_micros: Option<u64>,
pub latency_ms: u64,
}Expand description
A validated answer set plus its provenance (proposal §2 rule 4).
Fields§
§answers: BTreeMap<String, Answer>§model: StringAs served, e.g. "jev-1.13.0".
provider: StringSpec name, e.g. "typesafe", "cloudflare", "cmd", "llm".
calibrated: bool§input_tokens: Option<u64>§output_tokens: Option<u64>§usd_micros: Option<u64>The provider-reported price of this decision (usage.cost, USD, as
OpenRouter-style gateways report it) in micro-dollars, rounded UP so
a sum of sub-micro calls never under-charges a budget. None when
the provider reported no cost — never estimated from tokens.
latency_ms: u64Implementations§
Source§impl Decision
impl Decision
Sourcepub fn to_json(&self) -> Value
pub fn to_json(&self) -> Value
The wire response plus provenance: {model, answers, usage?, provider, calibrated, latency_ms} — what areev decide and the bindings print.
usage carries usd_micros when the provider reported a cost.
Sourcepub fn from_wire(
req: &DecideRequest,
body: &Value,
provider: &str,
default_model: &str,
calibrated: bool,
started: Instant,
) -> Result<Decision, DecideError>
pub fn from_wire( req: &DecideRequest, body: &Value, provider: &str, default_model: &str, calibrated: bool, started: Instant, ) -> Result<Decision, DecideError>
Build from a wire response body ({model?, answers, usage?}),
validating it strictly against the request’s questions
(parse_wire_answers). model falls back to default_model when
the body names none; latency_ms is measured from started. The
constructor every HTTP and command adapter shares.