Skip to main content

systemprompt_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    // JSON: Anthropic native-tool definitions retain provider-specific fields verbatim.
14    pub anthropic_definition: Option<Value>,
15    pub description: Option<String>,
16    pub input_schema: Value,
17    pub cache_control: Option<CacheControl>,
18}
19
20#[derive(Debug, Clone)]
21pub enum CanonicalToolChoice {
22    Auto,
23    Any,
24    None,
25    Required,
26    Tool(String),
27}
28
29#[derive(Debug, Clone, Copy, Default)]
30pub struct ThinkingConfig {
31    pub enabled: bool,
32    pub budget_tokens: Option<u32>,
33}
34
35#[derive(Debug, Clone)]
36pub enum ResponseFormat {
37    JsonObject,
38    JsonSchema {
39        name: String,
40        // JSON: JSON Schema document for structured output (OpenAI / Gemini / Anthropic).
41        schema: Value,
42        strict: bool,
43    },
44}
45
46#[derive(
47    Debug,
48    Clone,
49    Copy,
50    PartialEq,
51    Eq,
52    PartialOrd,
53    Ord,
54    serde::Serialize,
55    serde::Deserialize,
56    schemars::JsonSchema,
57)]
58#[serde(rename_all = "snake_case")]
59pub enum ReasoningEffort {
60    Low,
61    Medium,
62    High,
63}
64
65impl ReasoningEffort {
66    pub const fn as_str(self) -> &'static str {
67        match self {
68            Self::Low => "low",
69            Self::Medium => "medium",
70            Self::High => "high",
71        }
72    }
73}
74
75#[derive(Debug, Clone, Default)]
76pub struct SearchConfig {
77    pub max_uses: Option<u32>,
78    pub context_size: Option<String>,
79    pub urls: Vec<String>,
80}