1use schemars::JsonSchema;
4use serde::{Deserialize, Serialize};
5
6#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
11#[schemars(
12 title = "QuestionItem",
13 description = "One clarification question emitted by the assistant protocol payload. Keep \
14 each item focused to one actionable decision."
15)]
16pub struct QuestionItem {
17 #[serde(default)]
19 #[schemars(
20 title = "options",
21 description = "Predefined answer choices the user can select from. Keep this list focused \
22 to 1-3 likely answers, put the recommended choice first, and omit deferral \
23 or non-answer choices. Defaults to an empty list when omitted."
24 )]
25 pub options: Vec<String>,
26 #[schemars(
28 title = "text",
29 description = "Human-readable markdown text for this question. Ask one specific \
30 actionable question instead of bundling multiple decisions into one item."
31 )]
32 pub text: String,
33}
34
35impl QuestionItem {
36 pub fn new(text: impl Into<String>) -> Self {
39 Self {
40 options: Vec::new(),
41 text: text.into(),
42 }
43 }
44
45 pub fn with_options(text: impl Into<String>, options: Vec<String>) -> Self {
47 Self {
48 options,
49 text: text.into(),
50 }
51 }
52}