Skip to main content

systemprompt_models/wire/canonical/request/
options.rs

1//! Tool, thinking, response-format and search options of a canonical request.
2//!
3//! Copyright (c) systemprompt.io — Business Source License 1.1.
4//! See <https://systemprompt.io> for licensing details.
5
6use serde_json::Value;
7
8use super::content::CacheControl;
9
10#[derive(Debug, Clone)]
11pub struct CanonicalTool {
12    pub name: String,
13    pub description: Option<String>,
14    pub input_schema: Value,
15    pub cache_control: Option<CacheControl>,
16}
17
18#[derive(Debug, Clone)]
19pub enum CanonicalToolChoice {
20    Auto,
21    Any,
22    None,
23    Required,
24    Tool(String),
25}
26
27#[derive(Debug, Clone, Copy, Default)]
28pub struct ThinkingConfig {
29    pub enabled: bool,
30    pub budget_tokens: Option<u32>,
31}
32
33#[derive(Debug, Clone)]
34pub enum ResponseFormat {
35    JsonObject,
36    JsonSchema {
37        name: String,
38        // JSON: JSON Schema document for structured output (OpenAI / Gemini / Anthropic).
39        schema: Value,
40        strict: bool,
41    },
42}
43
44#[derive(
45    Debug,
46    Clone,
47    Copy,
48    PartialEq,
49    Eq,
50    PartialOrd,
51    Ord,
52    serde::Serialize,
53    serde::Deserialize,
54    schemars::JsonSchema,
55)]
56#[serde(rename_all = "snake_case")]
57pub enum ReasoningEffort {
58    Low,
59    Medium,
60    High,
61}
62
63impl ReasoningEffort {
64    pub const fn as_str(self) -> &'static str {
65        match self {
66            Self::Low => "low",
67            Self::Medium => "medium",
68            Self::High => "high",
69        }
70    }
71}
72
73#[derive(Debug, Clone, Default)]
74pub struct SearchConfig {
75    pub max_uses: Option<u32>,
76    pub context_size: Option<String>,
77    pub urls: Vec<String>,
78}