返回 CodeWhale
auto_route_evidence.rs
根目录 / crates / models / src / auto_route_evidence.rs
1 use std::collections::BTreeMap;
2
3 use serde::{Deserialize, Serialize};
4
5 /// What a decision model answered and what it cost. Probabilities are basis
6 /// points (0..=10000) so the receipt stays `Eq` and never re-renders floats.
7 #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
8 pub struct AutoRouteDecisionEvidence {
9 /// The tier the decision model chose (`fast` | `strong`).
10 pub choice: String,
11 pub probabilities_bp: BTreeMap<String, u16>,
12 pub confidence_bp: u16,
13 pub min_confidence_bp: u16,
14 #[serde(default, skip_serializing_if = "Vec::is_empty")]
15 pub abstained_questions: Vec<String>,
16 /// `[auto] cost_saving` kept the fast tier because the strong tier's
17 /// probability was below the cost-saving floor.
18 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
19 pub cost_saving_kept_fast: bool,
20 /// The reasoning effort the decision applied, if any.
21 #[serde(default, skip_serializing_if = "Option::is_none")]
22 pub thinking: Option<String>,
23 /// `usage.cost` exactly as the provider reported it (USD decimal).
24 #[serde(default, skip_serializing_if = "Option::is_none")]
25 pub provider_reported_cost_usd: Option<String>,
26 pub latency_ms: u64,
27 /// The dated model snapshot the provider echoed, when present.
28 #[serde(default, skip_serializing_if = "Option::is_none")]
29 pub response_model: Option<String>,
30 }
31
31 lines RUST