pub enum Answer {
Noul {
noul: f64,
raw_logprobs: BTreeMap<String, f64>,
truncated: bool,
truncated_labels: Vec<String>,
label_mass: f64,
},
Choice {
choice: String,
index: usize,
confidence: f64,
probabilities: Vec<OptionProbability>,
raw_logprobs: BTreeMap<String, f64>,
truncated: bool,
truncated_labels: Vec<String>,
label_mass: f64,
},
Score {
score: u8,
expected_score: f64,
legend: String,
confidence: f64,
probabilities: Vec<LevelProbability>,
raw_logprobs: BTreeMap<String, f64>,
truncated: bool,
truncated_labels: Vec<String>,
label_mass: f64,
},
}Expand description
A typed answer.
Every variant carries raw_logprobs, truncated and truncated_labels so a caller can redo
the normalisation itself — calibration is a convenience here, never a place where information
is lost.
A label in truncated_labels fell outside the host’s reporting window, so its entry in
raw_logprobs is the weakest reported logprob: an upper bound, not an observation.
truncated is true exactly when that list is not empty.
label_mass is how much of the model’s first-token probability fell on the offered labels,
in 0.0..=1.0, counting only labels the host reported. The probabilities are normalised over
the labels alone, so they look just as decisive when the model was about to write something
else entirely and the letters were an afterthought at -8. Near 1 the model answered with a
letter; well below it, the answer was read off tokens the model was not going to produce.
Variants§
Noul
Fields
Choice
Fields
probabilities: Vec<OptionProbability>Every option with its probability, in request order.
Score
Fields
probabilities: Vec<LevelProbability>Implementations§
Source§impl Answer
impl Answer
Sourcepub fn truncated(&self) -> bool
pub fn truncated(&self) -> bool
Whether some label fell outside the host’s top_logprobs window, making its probability
an upper bound rather than an observation.
Sourcepub fn truncated_labels(&self) -> &[String]
pub fn truncated_labels(&self) -> &[String]
The labels whose logprob is a bound rather than an observation. Empty unless
Answer::truncated.
Sourcepub fn label_mass(&self) -> f64
pub fn label_mass(&self) -> f64
How much of the model’s first-token probability fell on the offered labels. See
Answer.
Sourcepub fn confidence(&self) -> Option<f64>
pub fn confidence(&self) -> Option<f64>
How peaked the distribution is, in 0.0..=1.0. See cerno_core::math::confidence.
None for a noul: as in JEV, its probability is already the whole answer.