pub enum Question {
Noul(NoulQuestion),
Choice(ChoiceQuestion),
Score(ScoreQuestion),
Raw(Value),
}Expand description
A question, tagged by type on the wire.
Variants§
Noul(NoulQuestion)
A yes/no question.
Choice(ChoiceQuestion)
A choice between labels.
Score(ScoreQuestion)
A score from an ordered rubric.
Raw(Value)
A question this crate does not model, sent as written.
The escape hatch both official SDKs document: a question type the API
gains before this crate does can be sent today, as long as the JSON
carries its own type.
use kunobi_decision::{Question, Questions};
use serde_json::json;
let mut questions = Questions::new();
questions.insert(
"ranking",
Question::raw(json!({"type": "rank", "instructions": "Order these", "criteria": ["a", "b"]})),
);Implementations§
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Question
impl<'de> Deserialize<'de> for Question
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<ChoiceQuestion> for Question
impl From<ChoiceQuestion> for Question
Source§fn from(question: ChoiceQuestion) -> Self
fn from(question: ChoiceQuestion) -> Self
Converts to this type from the input type.
Source§impl From<NoulQuestion> for Question
impl From<NoulQuestion> for Question
Source§fn from(question: NoulQuestion) -> Self
fn from(question: NoulQuestion) -> Self
Converts to this type from the input type.
Source§impl From<ScoreQuestion> for Question
impl From<ScoreQuestion> for Question
Source§fn from(question: ScoreQuestion) -> Self
fn from(question: ScoreQuestion) -> Self
Converts to this type from the input type.
Source§impl<L: Labels> From<TypedChoice<L>> for Question
impl<L: Labels> From<TypedChoice<L>> for Question
Source§fn from(question: TypedChoice<L>) -> Self
fn from(question: TypedChoice<L>) -> Self
Converts to this type from the input type.
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
Mutably borrows from an owned value. Read more