pub struct Answers { /* private fields */ }Expand description
The answers to one request, with accessors that fail loudly on the wrong id or type.
Reaching for noul("team") when team was a choice is a programming mistake, not a runtime
condition, and the error says which id and which types rather than handing back a default.
Implementations§
Source§impl Answers
impl Answers
pub fn usage(&self) -> Usage
pub fn timing_ms(&self) -> u64
Sourcepub fn index(&self, id: &str) -> Result<usize, Error>
pub fn index(&self, id: &str) -> Result<usize, Error>
The winning option’s position in the request’s options, 0-based.
Sourcepub fn expected_score(&self, id: &str) -> Result<f64, Error>
pub fn expected_score(&self, id: &str) -> Result<f64, Error>
The probability-weighted mean level for id.
Sourcepub fn legend(&self, id: &str) -> Result<&str, Error>
pub fn legend(&self, id: &str) -> Result<&str, Error>
The legend entry the winning level carries.
Sourcepub fn confidence(&self, id: &str) -> Result<f64, Error>
pub fn confidence(&self, id: &str) -> Result<f64, Error>
How peaked the distribution behind id was, in 0.0..=1.0. A noul has none, as in
JEV: its probability is already the whole answer.
Sourcepub fn truncated(&self, id: &str) -> Result<bool, Error>
pub fn truncated(&self, id: &str) -> Result<bool, Error>
Whether some label for id fell outside the host’s reporting window, which makes its
probability an upper bound rather than an observation.
Sourcepub fn label_mass(&self, id: &str) -> Result<f64, Error>
pub fn label_mass(&self, id: &str) -> Result<f64, Error>
How much of the model’s first-token probability fell on the offered labels for id, in
0.0..=1.0. The probabilities are normalised over the labels alone, so this is what tells
an answer the model gave from one read off letters it was not going to write.
Sourcepub fn truncated_labels(&self, id: &str) -> Result<&[String], Error>
pub fn truncated_labels(&self, id: &str) -> Result<&[String], Error>
The labels for id whose logprob is an upper bound rather than an observation. Empty
unless Answers::truncated.
pub fn ids(&self) -> impl Iterator<Item = &str>
pub fn into_inner(self) -> SystemOneResponse
Trait Implementations§
Source§impl From<SystemOneResponse> for Answers
Wrap a response that was obtained some other way — read from a file, replayed from a log, or
parsed by a caller doing its own transport. The accessors are the useful part of this type,
and they should not be reachable only by going over the network.
impl From<SystemOneResponse> for Answers
Wrap a response that was obtained some other way — read from a file, replayed from a log, or parsed by a caller doing its own transport. The accessors are the useful part of this type, and they should not be reachable only by going over the network.