Skip to main content

gproxy_protocol/claude/common/tools/
choice.rs

1use serde::{Deserialize, Serialize};
2
3#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4#[serde(untagged)]
5#[non_exhaustive]
6pub enum ToolChoice {
7    Auto(ToolChoiceAuto),
8    Any(ToolChoiceAny),
9    Tool(ToolChoiceTool),
10    None(ToolChoiceNone),
11    Unknown(serde_json::Value),
12}
13
14#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
15#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
16pub struct ToolChoiceAuto {
17    #[serde(rename = "type")]
18    pub type_: ToolChoiceAutoType,
19    #[serde(skip_serializing_if = "Option::is_none")]
20    pub disable_parallel_tool_use: Option<bool>,
21    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
22    pub rest: serde_json::Map<String, serde_json::Value>,
23}
24
25#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
26#[non_exhaustive]
27pub enum ToolChoiceAutoType {
28    #[serde(rename = "auto")]
29    Auto,
30}
31
32#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
33#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
34pub struct ToolChoiceAny {
35    #[serde(rename = "type")]
36    pub type_: ToolChoiceAnyType,
37    #[serde(skip_serializing_if = "Option::is_none")]
38    pub disable_parallel_tool_use: Option<bool>,
39    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
40    pub rest: serde_json::Map<String, serde_json::Value>,
41}
42
43#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
44#[non_exhaustive]
45pub enum ToolChoiceAnyType {
46    #[serde(rename = "any")]
47    Any,
48}
49
50#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
51#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
52pub struct ToolChoiceTool {
53    pub name: String,
54    #[serde(rename = "type")]
55    pub type_: ToolChoiceToolType,
56    #[serde(skip_serializing_if = "Option::is_none")]
57    pub disable_parallel_tool_use: Option<bool>,
58    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
59    pub rest: serde_json::Map<String, serde_json::Value>,
60}
61
62#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
63#[non_exhaustive]
64pub enum ToolChoiceToolType {
65    #[serde(rename = "tool")]
66    Tool,
67}
68
69#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
70#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
71pub struct ToolChoiceNone {
72    #[serde(rename = "type")]
73    pub type_: ToolChoiceNoneType,
74    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
75    pub rest: serde_json::Map<String, serde_json::Value>,
76}
77
78#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
79#[non_exhaustive]
80pub enum ToolChoiceNoneType {
81    #[serde(rename = "none")]
82    None,
83}