pub enum Answer {
Choice {
choice: String,
probabilities: Vec<(String, f64)>,
confidence: f64,
act_probability: f64,
},
Score {
score: f64,
legend: Vec<Value>,
probabilities: Vec<f64>,
confidence: f64,
act_probability: f64,
},
Noul {
noul: f64,
confidence: f64,
act_probability: f64,
},
}Expand description
One question’s answer.
Variants§
Choice
A choice question.
Fields
Score
A score question.
Fields
§
act_probability: f64See Answer::Choice.
Noul
A noul question.
Implementations§
Source§impl Answer
impl Answer
Sourcepub fn to_jev_json(&self, precision: Option<u32>, entropy: bool) -> Value
pub fn to_jev_json(&self, precision: Option<u32>, entropy: bool) -> Value
The answer in Jev’s JSON shape, from spec/03-api.md: probabilities rounded to precision
places so that they still sum to exactly 1, scores and confidences rounded the same way,
no action block, and no confidence on a noul answer. None keeps the raw values.
entropy picks Laya’s normalized entropy confidence over Jev’s formula.
Trait Implementations§
impl StructuralPartialEq for Answer
Auto Trait Implementations§
impl Freeze for Answer
impl RefUnwindSafe for Answer
impl Send for Answer
impl Sync for Answer
impl Unpin for Answer
impl UnsafeUnpin for Answer
impl UnwindSafe for Answer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more