pub enum Question {
Choice {
instructions: String,
criteria: BTreeMap<String, String>,
},
Score {
instructions: String,
levels: Vec<(String, String)>,
},
Noul {
instructions: String,
},
}Expand description
One question asked of state. Three shapes, because a classifier is
asked three kinds of thing: pick one of a named set
(Question::Choice), place on an ordered scale
(Question::Score), or answer yes or no (Question::Noul).
Not #[non_exhaustive]: an adapter matches on this exhaustively to
render each shape into its provider’s request, and a new shape should
be a compile error in every adapter until it is handled, not a silent
fallthrough.
Variants§
Choice
Pick one of the named criteria. The map is criterion name -> what that criterion means, because the provider only sees the words it
is given; the keys are also the labels the answer’s probabilities
are keyed by.
Score
Place state on an ordered scale, in order: each level is
(name, what that level means). The level names are the labels
the answer’s probabilities are keyed by.
Noul
A yes/no question, answered as true or false.
Implementations§
Source§impl Question
impl Question
Sourcepub fn instructions(&self) -> &str
pub fn instructions(&self) -> &str
The instruction every shape carries — the part the adapter turns into its provider’s prompt or class descriptions.
Sourcepub fn kind(&self) -> &'static str
pub fn kind(&self) -> &'static str
Which shape this is, named for logs and provider payloads:
"choice", "score" or "noul".
Sourcepub fn labels(&self) -> Vec<&str>
pub fn labels(&self) -> Vec<&str>
The labels an answer to this question is keyed by: the criteria
names, the level names, or ["true", "false"].
Answer::probabilities and Answer::confidence are per these.
Trait Implementations§
impl Eq for Question
impl StructuralPartialEq for Question
Auto Trait Implementations§
impl Freeze for Question
impl RefUnwindSafe for Question
impl Send for Question
impl Sync for Question
impl Unpin for Question
impl UnsafeUnpin for Question
impl UnwindSafe for Question
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.