#[non_exhaustive]pub struct ChoiceOf<T> {
pub value: T,
pub answer: ChoiceAnswer,
}Expand description
A choice decoded into your enum, with the distribution it was picked from.
Derefs to the enum, so match *answer { Department::Billing => … } works.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.value: TThe selected option.
answer: ChoiceAnswerThe answer it came from: per-label probabilities and confidence.
Implementations§
Source§impl<T> ChoiceOf<T>
impl<T> ChoiceOf<T>
Sourcepub fn confidence(&self) -> f64
pub fn confidence(&self) -> f64
Certainty derived from the distribution, 0 to 1.
Sourcepub fn into_inner(self) -> T
pub fn into_inner(self) -> T
The selected option.
Source§impl<T: RubricChoice> ChoiceOf<T>
impl<T: RubricChoice> ChoiceOf<T>
Sourcepub fn probability(&self, option: &T) -> Option<f64>
pub fn probability(&self, option: &T) -> Option<f64>
The probability the model gave an option.
Trait Implementations§
Source§impl<T: RubricChoice> ChoiceField for ChoiceOf<T>
impl<T: RubricChoice> ChoiceField for ChoiceOf<T>
Source§fn question(instructions: Value) -> Choice
fn question(instructions: Value) -> Choice
The question, with whatever options the type knows (none, for a plain label).
Source§fn from_choice(answer: &ChoiceAnswer) -> Result<Self, UnknownLabel>
fn from_choice(answer: &ChoiceAnswer) -> Result<Self, UnknownLabel>
Convert the answer.
impl<T: PartialEq> StructuralPartialEq for ChoiceOf<T>
Auto Trait Implementations§
impl<T> Freeze for ChoiceOf<T>where
T: Freeze,
impl<T> RefUnwindSafe for ChoiceOf<T>where
T: RefUnwindSafe,
impl<T> Send for ChoiceOf<T>where
T: Send,
impl<T> Sync for ChoiceOf<T>where
T: Sync,
impl<T> Unpin for ChoiceOf<T>where
T: Unpin,
impl<T> UnsafeUnpin for ChoiceOf<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for ChoiceOf<T>where
T: UnwindSafe,
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