Skip to main content

defect_llm/wire/
anthropic.rs

1// @generated by defect-llm-codegen — do not edit by hand.
2// Source OAS: crates/llm/oas/anthropic.yaml
3// Re-run via `cargo run -p defect-llm-codegen -- anthropic`.
4#![allow(
5    clippy::manual_async_fn,
6    clippy::needless_return,
7    clippy::single_match,
8    clippy::match_single_binding,
9    clippy::too_many_arguments,
10    clippy::large_enum_variant,
11    clippy::enum_variant_names,
12    dead_code,
13    unused_imports,
14    rustdoc::bare_urls,
15    rustdoc::broken_intra_doc_links
16)]
17
18/// # Anthropic Messages API
19///
20/// 本地版的 Anthropic API OAS。**只裁端点不裁字段**:当前仅
21/// 挂 `/v1/models` 与 `/v1/messages` 两条 defect-llm 实际要走的
22/// 路;这两条端点的 schema 全字段保留(含 citations、cache_control、
23/// image base64+url、document 全 4 种 source、thinking 3 种、
24/// tool_choice 4 种、所有 server tool 与 result 变体、Usage 全
25/// breakdown、SSE 8 类事件)。Anthropic 上游加字段时手动
26/// diff 同步对应 schema。
27///
28/// - **Version:** `2023-06-01`
29pub mod spec {}
30pub mod components {
31    #![allow(deprecated)]
32    #![allow(unreachable_patterns)]
33    #![allow(non_camel_case_types)]
34    #![allow(non_snake_case)]
35    #![allow(clippy::all, clippy::pedantic)]
36    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
37    pub enum ModelInfoType {
38        #[serde(rename = "model")]
39        Model,
40    }
41    impl ::std::fmt::Display for ModelInfoType {
42        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
43            match self {
44                Self::Model => ::std::write!(__f, "model"),
45            }
46        }
47    }
48    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
49    pub struct ModelInfo {
50        pub r#type: ModelInfoType,
51        /// 模型 id,例如 "claude-3-5-sonnet-20241022"。
52        pub id: String,
53        pub display_name: String,
54        pub created_at: String,
55    }
56    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
57    pub struct ListModelsResponse {
58        pub data: Vec<ModelInfo>,
59        pub has_more: bool,
60        #[serde(skip_serializing_if = "Option::is_none")]
61        pub first_id: Option<String>,
62        #[serde(skip_serializing_if = "Option::is_none")]
63        pub last_id: Option<String>,
64    }
65    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
66    pub enum ErrorResponseType {
67        #[serde(rename = "error")]
68        Error,
69    }
70    impl ::std::fmt::Display for ErrorResponseType {
71        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
72            match self {
73                Self::Error => ::std::write!(__f, "error"),
74            }
75        }
76    }
77    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
78    pub struct ErrorResponseError {
79        /// Anthropic 错误分类:invalid_request_error /
80        /// authentication_error / permission_error /
81        /// not_found_error / rate_limit_error /
82        /// api_error / overloaded_error。
83        pub r#type: String,
84        pub message: String,
85    }
86    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
87    pub struct ErrorResponse {
88        pub r#type: ErrorResponseType,
89        pub error: ErrorResponseError,
90    }
91    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
92    pub enum CacheControlEphemeralType {
93        #[serde(rename = "ephemeral")]
94        Ephemeral,
95    }
96    impl ::std::fmt::Display for CacheControlEphemeralType {
97        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
98            match self {
99                Self::Ephemeral => ::std::write!(__f, "ephemeral"),
100            }
101        }
102    }
103    /// 缓存断点 TTL,默认 5m。
104    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
105    pub enum CacheControlEphemeralTtl {
106        #[serde(rename = "5m")]
107        _5m,
108        #[serde(rename = "1h")]
109        _1h,
110    }
111    impl ::std::fmt::Display for CacheControlEphemeralTtl {
112        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
113            match self {
114                Self::_5m => ::std::write!(__f, "5m"),
115                Self::_1h => ::std::write!(__f, "1h"),
116            }
117        }
118    }
119    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
120    /// 在该 content block 上插入缓存断点。
121    pub struct CacheControlEphemeral {
122        pub r#type: CacheControlEphemeralType,
123        #[serde(skip_serializing_if = "Option::is_none")]
124        /// 缓存断点 TTL,默认 5m。
125        pub ttl: Option<CacheControlEphemeralTtl>,
126    }
127    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
128    pub enum ModelVariant0 {
129        #[serde(rename = "claude-opus-4-7")]
130        ClaudeOpus4Minus7,
131        #[serde(rename = "claude-mythos-preview")]
132        ClaudeMythosPreview,
133        #[serde(rename = "claude-opus-4-6")]
134        ClaudeOpus4Minus6,
135        #[serde(rename = "claude-sonnet-4-6")]
136        ClaudeSonnet4Minus6,
137        #[serde(rename = "claude-haiku-4-5")]
138        ClaudeHaiku4Minus5,
139        #[serde(rename = "claude-haiku-4-5-20251001")]
140        ClaudeHaiku4Minus5Minus20251001,
141        #[serde(rename = "claude-opus-4-5")]
142        ClaudeOpus4Minus5,
143        #[serde(rename = "claude-opus-4-5-20251101")]
144        ClaudeOpus4Minus5Minus20251101,
145        #[serde(rename = "claude-sonnet-4-5")]
146        ClaudeSonnet4Minus5,
147        #[serde(rename = "claude-sonnet-4-5-20250929")]
148        ClaudeSonnet4Minus5Minus20250929,
149        #[serde(rename = "claude-opus-4-1")]
150        ClaudeOpus4Minus1,
151        #[serde(rename = "claude-opus-4-1-20250805")]
152        ClaudeOpus4Minus1Minus20250805,
153        #[serde(rename = "claude-opus-4-0")]
154        ClaudeOpus4Minus0,
155        #[serde(rename = "claude-opus-4-20250514")]
156        ClaudeOpus4Minus20250514,
157        #[serde(rename = "claude-sonnet-4-0")]
158        ClaudeSonnet4Minus0,
159        #[serde(rename = "claude-sonnet-4-20250514")]
160        ClaudeSonnet4Minus20250514,
161        #[serde(rename = "claude-3-haiku-20240307")]
162        Claude3Haiku20240307,
163    }
164    impl ::std::fmt::Display for ModelVariant0 {
165        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
166            match self {
167                Self::ClaudeOpus4Minus7 => ::std::write!(__f, "claude-opus-4-7"),
168                Self::ClaudeMythosPreview => ::std::write!(__f, "claude-mythos-preview"),
169                Self::ClaudeOpus4Minus6 => ::std::write!(__f, "claude-opus-4-6"),
170                Self::ClaudeSonnet4Minus6 => ::std::write!(__f, "claude-sonnet-4-6"),
171                Self::ClaudeHaiku4Minus5 => ::std::write!(__f, "claude-haiku-4-5"),
172                Self::ClaudeHaiku4Minus5Minus20251001 => {
173                    ::std::write!(__f, "claude-haiku-4-5-20251001")
174                }
175                Self::ClaudeOpus4Minus5 => ::std::write!(__f, "claude-opus-4-5"),
176                Self::ClaudeOpus4Minus5Minus20251101 => {
177                    ::std::write!(__f, "claude-opus-4-5-20251101")
178                }
179                Self::ClaudeSonnet4Minus5 => ::std::write!(__f, "claude-sonnet-4-5"),
180                Self::ClaudeSonnet4Minus5Minus20250929 => {
181                    ::std::write!(__f, "claude-sonnet-4-5-20250929")
182                }
183                Self::ClaudeOpus4Minus1 => ::std::write!(__f, "claude-opus-4-1"),
184                Self::ClaudeOpus4Minus1Minus20250805 => {
185                    ::std::write!(__f, "claude-opus-4-1-20250805")
186                }
187                Self::ClaudeOpus4Minus0 => ::std::write!(__f, "claude-opus-4-0"),
188                Self::ClaudeOpus4Minus20250514 => {
189                    ::std::write!(__f, "claude-opus-4-20250514")
190                }
191                Self::ClaudeSonnet4Minus0 => ::std::write!(__f, "claude-sonnet-4-0"),
192                Self::ClaudeSonnet4Minus20250514 => {
193                    ::std::write!(__f, "claude-sonnet-4-20250514")
194                }
195                Self::Claude3Haiku20240307 => {
196                    ::std::write!(__f, "claude-3-haiku-20240307")
197                }
198            }
199        }
200    }
201    impl ::std::convert::From<ModelVariant0> for Model {
202        fn from(value: ModelVariant0) -> Self {
203            Model::ModelVariant0(value)
204        }
205    }
206    impl ::std::convert::TryFrom<Model> for ModelVariant0 {
207        type Error = Model;
208        /// # Errors
209        ///
210        /// Returns the original enum value if it does not match the
211        /// `#variant_ident` variant.
212        fn try_from(value: Model) -> ::std::result::Result<Self, Self::Error> {
213            match value {
214                Model::ModelVariant0(inner) => ::std::result::Result::Ok(inner),
215                other => ::std::result::Result::Err(other),
216            }
217        }
218    }
219    impl ::std::convert::From<String> for Model {
220        fn from(value: String) -> Self {
221            Model::ModelVariant1(value)
222        }
223    }
224    impl ::std::convert::TryFrom<Model> for String {
225        type Error = Model;
226        /// # Errors
227        ///
228        /// Returns the original enum value if it does not match the
229        /// `#variant_ident` variant.
230        fn try_from(value: Model) -> ::std::result::Result<Self, Self::Error> {
231            match value {
232                Model::ModelVariant1(inner) => ::std::result::Result::Ok(inner),
233                other => ::std::result::Result::Err(other),
234            }
235        }
236    }
237    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
238    #[serde(untagged)]
239    /// 要使用的模型 id。允许任意字符串以容纳新发布版本,但同时
240    /// 枚举出当前已知的模型名作为 IDE 提示。
241    pub enum Model {
242        ModelVariant0(ModelVariant0),
243        ModelVariant1(String),
244    }
245    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
246    pub enum CitationCharLocationParamType {
247        #[serde(rename = "char_location")]
248        CharLocation,
249    }
250    impl ::std::fmt::Display for CitationCharLocationParamType {
251        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
252            match self {
253                Self::CharLocation => ::std::write!(__f, "char_location"),
254            }
255        }
256    }
257    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
258    pub struct CitationCharLocationParam {
259        pub cited_text: String,
260        pub document_index: i64,
261        pub document_title: String,
262        pub end_char_index: i64,
263        pub start_char_index: i64,
264        pub r#type: CitationCharLocationParamType,
265    }
266    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
267    pub enum CitationPageLocationParamType {
268        #[serde(rename = "page_location")]
269        PageLocation,
270    }
271    impl ::std::fmt::Display for CitationPageLocationParamType {
272        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
273            match self {
274                Self::PageLocation => ::std::write!(__f, "page_location"),
275            }
276        }
277    }
278    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
279    pub struct CitationPageLocationParam {
280        pub cited_text: String,
281        pub document_index: i64,
282        pub document_title: String,
283        pub end_page_number: i64,
284        pub start_page_number: i64,
285        pub r#type: CitationPageLocationParamType,
286    }
287    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
288    pub enum CitationContentBlockLocationParamType {
289        #[serde(rename = "content_block_location")]
290        ContentBlockLocation,
291    }
292    impl ::std::fmt::Display for CitationContentBlockLocationParamType {
293        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
294            match self {
295                Self::ContentBlockLocation => {
296                    ::std::write!(__f, "content_block_location")
297                }
298            }
299        }
300    }
301    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
302    pub struct CitationContentBlockLocationParam {
303        pub cited_text: String,
304        pub document_index: i64,
305        pub document_title: String,
306        pub end_block_index: i64,
307        pub start_block_index: i64,
308        pub r#type: CitationContentBlockLocationParamType,
309    }
310    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
311    pub enum CitationWebSearchResultLocationParamType {
312        #[serde(rename = "web_search_result_location")]
313        WebSearchResultLocation,
314    }
315    impl ::std::fmt::Display for CitationWebSearchResultLocationParamType {
316        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
317            match self {
318                Self::WebSearchResultLocation => {
319                    ::std::write!(__f, "web_search_result_location")
320                }
321            }
322        }
323    }
324    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
325    pub struct CitationWebSearchResultLocationParam {
326        pub cited_text: String,
327        pub encrypted_index: String,
328        pub title: String,
329        pub r#type: CitationWebSearchResultLocationParamType,
330        pub url: String,
331    }
332    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
333    pub enum CitationSearchResultLocationParamType {
334        #[serde(rename = "search_result_location")]
335        SearchResultLocation,
336    }
337    impl ::std::fmt::Display for CitationSearchResultLocationParamType {
338        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
339            match self {
340                Self::SearchResultLocation => {
341                    ::std::write!(__f, "search_result_location")
342                }
343            }
344        }
345    }
346    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
347    pub struct CitationSearchResultLocationParam {
348        pub cited_text: String,
349        pub end_block_index: i64,
350        pub search_result_index: i64,
351        pub source: String,
352        pub start_block_index: i64,
353        pub title: String,
354        pub r#type: CitationSearchResultLocationParamType,
355    }
356    impl ::std::convert::From<CitationCharLocationParam> for TextCitationParam {
357        fn from(value: CitationCharLocationParam) -> Self {
358            TextCitationParam::CitationCharLocationParam(value)
359        }
360    }
361    impl ::std::convert::TryFrom<TextCitationParam> for CitationCharLocationParam {
362        type Error = TextCitationParam;
363        /// # Errors
364        ///
365        /// Returns the original enum value if it does not match the
366        /// `#variant_ident` variant.
367        fn try_from(value: TextCitationParam) -> ::std::result::Result<Self, Self::Error> {
368            match value {
369                TextCitationParam::CitationCharLocationParam(inner) => {
370                    ::std::result::Result::Ok(inner)
371                }
372                other => ::std::result::Result::Err(other),
373            }
374        }
375    }
376    impl ::std::convert::From<CitationPageLocationParam> for TextCitationParam {
377        fn from(value: CitationPageLocationParam) -> Self {
378            TextCitationParam::CitationPageLocationParam(value)
379        }
380    }
381    impl ::std::convert::TryFrom<TextCitationParam> for CitationPageLocationParam {
382        type Error = TextCitationParam;
383        /// # Errors
384        ///
385        /// Returns the original enum value if it does not match the
386        /// `#variant_ident` variant.
387        fn try_from(value: TextCitationParam) -> ::std::result::Result<Self, Self::Error> {
388            match value {
389                TextCitationParam::CitationPageLocationParam(inner) => {
390                    ::std::result::Result::Ok(inner)
391                }
392                other => ::std::result::Result::Err(other),
393            }
394        }
395    }
396    impl ::std::convert::From<CitationContentBlockLocationParam> for TextCitationParam {
397        fn from(value: CitationContentBlockLocationParam) -> Self {
398            TextCitationParam::CitationContentBlockLocationParam(value)
399        }
400    }
401    impl ::std::convert::TryFrom<TextCitationParam> for CitationContentBlockLocationParam {
402        type Error = TextCitationParam;
403        /// # Errors
404        ///
405        /// Returns the original enum value if it does not match the
406        /// `#variant_ident` variant.
407        fn try_from(value: TextCitationParam) -> ::std::result::Result<Self, Self::Error> {
408            match value {
409                TextCitationParam::CitationContentBlockLocationParam(inner) => {
410                    ::std::result::Result::Ok(inner)
411                }
412                other => ::std::result::Result::Err(other),
413            }
414        }
415    }
416    impl ::std::convert::From<CitationWebSearchResultLocationParam> for TextCitationParam {
417        fn from(value: CitationWebSearchResultLocationParam) -> Self {
418            TextCitationParam::CitationWebSearchResultLocationParam(value)
419        }
420    }
421    impl ::std::convert::TryFrom<TextCitationParam> for CitationWebSearchResultLocationParam {
422        type Error = TextCitationParam;
423        /// # Errors
424        ///
425        /// Returns the original enum value if it does not match the
426        /// `#variant_ident` variant.
427        fn try_from(value: TextCitationParam) -> ::std::result::Result<Self, Self::Error> {
428            match value {
429                TextCitationParam::CitationWebSearchResultLocationParam(inner) => {
430                    ::std::result::Result::Ok(inner)
431                }
432                other => ::std::result::Result::Err(other),
433            }
434        }
435    }
436    impl ::std::convert::From<CitationSearchResultLocationParam> for TextCitationParam {
437        fn from(value: CitationSearchResultLocationParam) -> Self {
438            TextCitationParam::CitationSearchResultLocationParam(value)
439        }
440    }
441    impl ::std::convert::TryFrom<TextCitationParam> for CitationSearchResultLocationParam {
442        type Error = TextCitationParam;
443        /// # Errors
444        ///
445        /// Returns the original enum value if it does not match the
446        /// `#variant_ident` variant.
447        fn try_from(value: TextCitationParam) -> ::std::result::Result<Self, Self::Error> {
448            match value {
449                TextCitationParam::CitationSearchResultLocationParam(inner) => {
450                    ::std::result::Result::Ok(inner)
451                }
452                other => ::std::result::Result::Err(other),
453            }
454        }
455    }
456    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
457    #[serde(untagged)]
458    pub enum TextCitationParam {
459        CitationCharLocationParam(CitationCharLocationParam),
460        CitationPageLocationParam(CitationPageLocationParam),
461        CitationContentBlockLocationParam(CitationContentBlockLocationParam),
462        CitationWebSearchResultLocationParam(CitationWebSearchResultLocationParam),
463        CitationSearchResultLocationParam(CitationSearchResultLocationParam),
464    }
465    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
466    pub enum CitationCharLocationType {
467        #[serde(rename = "char_location")]
468        CharLocation,
469    }
470    impl ::std::fmt::Display for CitationCharLocationType {
471        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
472            match self {
473                Self::CharLocation => ::std::write!(__f, "char_location"),
474            }
475        }
476    }
477    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
478    pub struct CitationCharLocation {
479        pub cited_text: String,
480        pub document_index: i64,
481        pub document_title: String,
482        pub end_char_index: i64,
483        pub start_char_index: i64,
484        #[serde(skip_serializing_if = "Option::is_none")]
485        pub file_id: Option<String>,
486        pub r#type: CitationCharLocationType,
487    }
488    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
489    pub enum CitationPageLocationType {
490        #[serde(rename = "page_location")]
491        PageLocation,
492    }
493    impl ::std::fmt::Display for CitationPageLocationType {
494        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
495            match self {
496                Self::PageLocation => ::std::write!(__f, "page_location"),
497            }
498        }
499    }
500    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
501    pub struct CitationPageLocation {
502        pub cited_text: String,
503        pub document_index: i64,
504        pub document_title: String,
505        pub end_page_number: i64,
506        pub start_page_number: i64,
507        #[serde(skip_serializing_if = "Option::is_none")]
508        pub file_id: Option<String>,
509        pub r#type: CitationPageLocationType,
510    }
511    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
512    pub enum CitationContentBlockLocationType {
513        #[serde(rename = "content_block_location")]
514        ContentBlockLocation,
515    }
516    impl ::std::fmt::Display for CitationContentBlockLocationType {
517        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
518            match self {
519                Self::ContentBlockLocation => {
520                    ::std::write!(__f, "content_block_location")
521                }
522            }
523        }
524    }
525    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
526    pub struct CitationContentBlockLocation {
527        pub cited_text: String,
528        pub document_index: i64,
529        pub document_title: String,
530        pub end_block_index: i64,
531        pub start_block_index: i64,
532        #[serde(skip_serializing_if = "Option::is_none")]
533        pub file_id: Option<String>,
534        pub r#type: CitationContentBlockLocationType,
535    }
536    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
537    pub enum CitationsWebSearchResultLocationType {
538        #[serde(rename = "web_search_result_location")]
539        WebSearchResultLocation,
540    }
541    impl ::std::fmt::Display for CitationsWebSearchResultLocationType {
542        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
543            match self {
544                Self::WebSearchResultLocation => {
545                    ::std::write!(__f, "web_search_result_location")
546                }
547            }
548        }
549    }
550    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
551    pub struct CitationsWebSearchResultLocation {
552        pub cited_text: String,
553        pub encrypted_index: String,
554        pub title: String,
555        pub r#type: CitationsWebSearchResultLocationType,
556        pub url: String,
557    }
558    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
559    pub enum CitationsSearchResultLocationType {
560        #[serde(rename = "search_result_location")]
561        SearchResultLocation,
562    }
563    impl ::std::fmt::Display for CitationsSearchResultLocationType {
564        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
565            match self {
566                Self::SearchResultLocation => {
567                    ::std::write!(__f, "search_result_location")
568                }
569            }
570        }
571    }
572    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
573    pub struct CitationsSearchResultLocation {
574        pub cited_text: String,
575        pub end_block_index: i64,
576        pub search_result_index: i64,
577        pub source: String,
578        pub start_block_index: i64,
579        pub title: String,
580        pub r#type: CitationsSearchResultLocationType,
581    }
582    impl ::std::convert::From<CitationCharLocation> for TextCitation {
583        fn from(value: CitationCharLocation) -> Self {
584            TextCitation::CitationCharLocation(value)
585        }
586    }
587    impl ::std::convert::TryFrom<TextCitation> for CitationCharLocation {
588        type Error = TextCitation;
589        /// # Errors
590        ///
591        /// Returns the original enum value if it does not match the
592        /// `#variant_ident` variant.
593        fn try_from(value: TextCitation) -> ::std::result::Result<Self, Self::Error> {
594            match value {
595                TextCitation::CitationCharLocation(inner) => ::std::result::Result::Ok(inner),
596                other => ::std::result::Result::Err(other),
597            }
598        }
599    }
600    impl ::std::convert::From<CitationPageLocation> for TextCitation {
601        fn from(value: CitationPageLocation) -> Self {
602            TextCitation::CitationPageLocation(value)
603        }
604    }
605    impl ::std::convert::TryFrom<TextCitation> for CitationPageLocation {
606        type Error = TextCitation;
607        /// # Errors
608        ///
609        /// Returns the original enum value if it does not match the
610        /// `#variant_ident` variant.
611        fn try_from(value: TextCitation) -> ::std::result::Result<Self, Self::Error> {
612            match value {
613                TextCitation::CitationPageLocation(inner) => ::std::result::Result::Ok(inner),
614                other => ::std::result::Result::Err(other),
615            }
616        }
617    }
618    impl ::std::convert::From<CitationContentBlockLocation> for TextCitation {
619        fn from(value: CitationContentBlockLocation) -> Self {
620            TextCitation::CitationContentBlockLocation(value)
621        }
622    }
623    impl ::std::convert::TryFrom<TextCitation> for CitationContentBlockLocation {
624        type Error = TextCitation;
625        /// # Errors
626        ///
627        /// Returns the original enum value if it does not match the
628        /// `#variant_ident` variant.
629        fn try_from(value: TextCitation) -> ::std::result::Result<Self, Self::Error> {
630            match value {
631                TextCitation::CitationContentBlockLocation(inner) => {
632                    ::std::result::Result::Ok(inner)
633                }
634                other => ::std::result::Result::Err(other),
635            }
636        }
637    }
638    impl ::std::convert::From<CitationsWebSearchResultLocation> for TextCitation {
639        fn from(value: CitationsWebSearchResultLocation) -> Self {
640            TextCitation::CitationsWebSearchResultLocation(value)
641        }
642    }
643    impl ::std::convert::TryFrom<TextCitation> for CitationsWebSearchResultLocation {
644        type Error = TextCitation;
645        /// # Errors
646        ///
647        /// Returns the original enum value if it does not match the
648        /// `#variant_ident` variant.
649        fn try_from(value: TextCitation) -> ::std::result::Result<Self, Self::Error> {
650            match value {
651                TextCitation::CitationsWebSearchResultLocation(inner) => {
652                    ::std::result::Result::Ok(inner)
653                }
654                other => ::std::result::Result::Err(other),
655            }
656        }
657    }
658    impl ::std::convert::From<CitationsSearchResultLocation> for TextCitation {
659        fn from(value: CitationsSearchResultLocation) -> Self {
660            TextCitation::CitationsSearchResultLocation(value)
661        }
662    }
663    impl ::std::convert::TryFrom<TextCitation> for CitationsSearchResultLocation {
664        type Error = TextCitation;
665        /// # Errors
666        ///
667        /// Returns the original enum value if it does not match the
668        /// `#variant_ident` variant.
669        fn try_from(value: TextCitation) -> ::std::result::Result<Self, Self::Error> {
670            match value {
671                TextCitation::CitationsSearchResultLocation(inner) => {
672                    ::std::result::Result::Ok(inner)
673                }
674                other => ::std::result::Result::Err(other),
675            }
676        }
677    }
678    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
679    #[serde(untagged)]
680    pub enum TextCitation {
681        CitationCharLocation(CitationCharLocation),
682        CitationPageLocation(CitationPageLocation),
683        CitationContentBlockLocation(CitationContentBlockLocation),
684        CitationsWebSearchResultLocation(CitationsWebSearchResultLocation),
685        CitationsSearchResultLocation(CitationsSearchResultLocation),
686    }
687    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
688    pub struct CitationsConfigParam {
689        #[serde(skip_serializing_if = "Option::is_none")]
690        pub enabled: Option<bool>,
691    }
692    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
693    pub struct CitationsConfig {
694        pub enabled: bool,
695    }
696    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
697    pub enum DirectCallerType {
698        #[serde(rename = "direct")]
699        Direct,
700    }
701    impl ::std::fmt::Display for DirectCallerType {
702        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
703            match self {
704                Self::Direct => ::std::write!(__f, "direct"),
705            }
706        }
707    }
708    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
709    /// 模型直接调起的工具调用。
710    pub struct DirectCaller {
711        pub r#type: DirectCallerType,
712    }
713    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
714    pub enum ServerToolCallerType {
715        #[serde(rename = "code_execution_20250825")]
716        CodeExecution20250825,
717    }
718    impl ::std::fmt::Display for ServerToolCallerType {
719        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
720            match self {
721                Self::CodeExecution20250825 => {
722                    ::std::write!(__f, "code_execution_20250825")
723                }
724            }
725        }
726    }
727    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
728    /// 由 server-side tool 触发的子调用。
729    pub struct ServerToolCaller {
730        pub tool_id: String,
731        pub r#type: ServerToolCallerType,
732    }
733    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
734    pub enum ServerToolCaller20260120Type {
735        #[serde(rename = "code_execution_20260120")]
736        CodeExecution20260120,
737    }
738    impl ::std::fmt::Display for ServerToolCaller20260120Type {
739        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
740            match self {
741                Self::CodeExecution20260120 => {
742                    ::std::write!(__f, "code_execution_20260120")
743                }
744            }
745        }
746    }
747    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
748    pub struct ServerToolCaller20260120 {
749        pub tool_id: String,
750        pub r#type: ServerToolCaller20260120Type,
751    }
752    impl ::std::convert::From<DirectCaller> for Caller {
753        fn from(value: DirectCaller) -> Self {
754            Caller::DirectCaller(value)
755        }
756    }
757    impl ::std::convert::TryFrom<Caller> for DirectCaller {
758        type Error = Caller;
759        /// # Errors
760        ///
761        /// Returns the original enum value if it does not match the
762        /// `#variant_ident` variant.
763        fn try_from(value: Caller) -> ::std::result::Result<Self, Self::Error> {
764            match value {
765                Caller::DirectCaller(inner) => ::std::result::Result::Ok(inner),
766                other => ::std::result::Result::Err(other),
767            }
768        }
769    }
770    impl ::std::convert::From<ServerToolCaller> for Caller {
771        fn from(value: ServerToolCaller) -> Self {
772            Caller::ServerToolCaller(value)
773        }
774    }
775    impl ::std::convert::TryFrom<Caller> for ServerToolCaller {
776        type Error = Caller;
777        /// # Errors
778        ///
779        /// Returns the original enum value if it does not match the
780        /// `#variant_ident` variant.
781        fn try_from(value: Caller) -> ::std::result::Result<Self, Self::Error> {
782            match value {
783                Caller::ServerToolCaller(inner) => ::std::result::Result::Ok(inner),
784                other => ::std::result::Result::Err(other),
785            }
786        }
787    }
788    impl ::std::convert::From<ServerToolCaller20260120> for Caller {
789        fn from(value: ServerToolCaller20260120) -> Self {
790            Caller::ServerToolCaller20260120(value)
791        }
792    }
793    impl ::std::convert::TryFrom<Caller> for ServerToolCaller20260120 {
794        type Error = Caller;
795        /// # Errors
796        ///
797        /// Returns the original enum value if it does not match the
798        /// `#variant_ident` variant.
799        fn try_from(value: Caller) -> ::std::result::Result<Self, Self::Error> {
800            match value {
801                Caller::ServerToolCaller20260120(inner) => ::std::result::Result::Ok(inner),
802                other => ::std::result::Result::Err(other),
803            }
804        }
805    }
806    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
807    #[serde(untagged)]
808    pub enum Caller {
809        DirectCaller(DirectCaller),
810        ServerToolCaller(ServerToolCaller),
811        ServerToolCaller20260120(ServerToolCaller20260120),
812    }
813    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
814    pub enum Base64ImageSourceMediaType {
815        #[serde(rename = "image/jpeg")]
816        ImageJpeg,
817        #[serde(rename = "image/png")]
818        ImagePng,
819        #[serde(rename = "image/gif")]
820        ImageGif,
821        #[serde(rename = "image/webp")]
822        ImageWebp,
823    }
824    impl ::std::fmt::Display for Base64ImageSourceMediaType {
825        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
826            match self {
827                Self::ImageJpeg => ::std::write!(__f, "image/jpeg"),
828                Self::ImagePng => ::std::write!(__f, "image/png"),
829                Self::ImageGif => ::std::write!(__f, "image/gif"),
830                Self::ImageWebp => ::std::write!(__f, "image/webp"),
831            }
832        }
833    }
834    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
835    pub enum Base64ImageSourceType {
836        #[serde(rename = "base64")]
837        Base64,
838    }
839    impl ::std::fmt::Display for Base64ImageSourceType {
840        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
841            match self {
842                Self::Base64 => ::std::write!(__f, "base64"),
843            }
844        }
845    }
846    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
847    pub struct Base64ImageSource {
848        pub data: String,
849        pub media_type: Base64ImageSourceMediaType,
850        pub r#type: Base64ImageSourceType,
851    }
852    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
853    pub enum UrlImageSourceType {
854        #[serde(rename = "url")]
855        Url,
856    }
857    impl ::std::fmt::Display for UrlImageSourceType {
858        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
859            match self {
860                Self::Url => ::std::write!(__f, "url"),
861            }
862        }
863    }
864    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
865    pub struct UrlImageSource {
866        pub r#type: UrlImageSourceType,
867        pub url: String,
868    }
869    impl ::std::convert::From<Base64ImageSource> for ImageSource {
870        fn from(value: Base64ImageSource) -> Self {
871            ImageSource::Base64ImageSource(value)
872        }
873    }
874    impl ::std::convert::TryFrom<ImageSource> for Base64ImageSource {
875        type Error = ImageSource;
876        /// # Errors
877        ///
878        /// Returns the original enum value if it does not match the
879        /// `#variant_ident` variant.
880        fn try_from(value: ImageSource) -> ::std::result::Result<Self, Self::Error> {
881            match value {
882                ImageSource::Base64ImageSource(inner) => ::std::result::Result::Ok(inner),
883                other => ::std::result::Result::Err(other),
884            }
885        }
886    }
887    impl ::std::convert::From<UrlImageSource> for ImageSource {
888        fn from(value: UrlImageSource) -> Self {
889            ImageSource::UrlImageSource(value)
890        }
891    }
892    impl ::std::convert::TryFrom<ImageSource> for UrlImageSource {
893        type Error = ImageSource;
894        /// # Errors
895        ///
896        /// Returns the original enum value if it does not match the
897        /// `#variant_ident` variant.
898        fn try_from(value: ImageSource) -> ::std::result::Result<Self, Self::Error> {
899            match value {
900                ImageSource::UrlImageSource(inner) => ::std::result::Result::Ok(inner),
901                other => ::std::result::Result::Err(other),
902            }
903        }
904    }
905    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
906    #[serde(untagged)]
907    pub enum ImageSource {
908        Base64ImageSource(Base64ImageSource),
909        #[serde(rename = "URLImageSource")]
910        UrlImageSource(UrlImageSource),
911    }
912    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
913    pub enum Base64PdfSourceMediaType {
914        #[serde(rename = "application/pdf")]
915        ApplicationPdf,
916    }
917    impl ::std::fmt::Display for Base64PdfSourceMediaType {
918        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
919            match self {
920                Self::ApplicationPdf => ::std::write!(__f, "application/pdf"),
921            }
922        }
923    }
924    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
925    pub enum Base64PdfSourceType {
926        #[serde(rename = "base64")]
927        Base64,
928    }
929    impl ::std::fmt::Display for Base64PdfSourceType {
930        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
931            match self {
932                Self::Base64 => ::std::write!(__f, "base64"),
933            }
934        }
935    }
936    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
937    pub struct Base64PdfSource {
938        pub data: String,
939        pub media_type: Base64PdfSourceMediaType,
940        pub r#type: Base64PdfSourceType,
941    }
942    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
943    pub enum PlainTextSourceMediaType {
944        #[serde(rename = "text/plain")]
945        TextPlain,
946    }
947    impl ::std::fmt::Display for PlainTextSourceMediaType {
948        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
949            match self {
950                Self::TextPlain => ::std::write!(__f, "text/plain"),
951            }
952        }
953    }
954    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
955    pub enum PlainTextSourceType {
956        #[serde(rename = "text")]
957        Text,
958    }
959    impl ::std::fmt::Display for PlainTextSourceType {
960        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
961            match self {
962                Self::Text => ::std::write!(__f, "text"),
963            }
964        }
965    }
966    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
967    pub struct PlainTextSource {
968        pub data: String,
969        pub media_type: PlainTextSourceMediaType,
970        pub r#type: PlainTextSourceType,
971    }
972    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
973    pub enum TextBlockParamType {
974        #[serde(rename = "text")]
975        Text,
976    }
977    impl ::std::fmt::Display for TextBlockParamType {
978        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
979            match self {
980                Self::Text => ::std::write!(__f, "text"),
981            }
982        }
983    }
984    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
985    pub struct TextBlockParam {
986        pub text: String,
987        pub r#type: TextBlockParamType,
988        #[serde(skip_serializing_if = "Option::is_none")]
989        pub cache_control: Option<CacheControlEphemeral>,
990        #[serde(skip_serializing_if = "Option::is_none")]
991        pub citations: Option<Vec<TextCitationParam>>,
992    }
993    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
994    pub enum ImageBlockParamType {
995        #[serde(rename = "image")]
996        Image,
997    }
998    impl ::std::fmt::Display for ImageBlockParamType {
999        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
1000            match self {
1001                Self::Image => ::std::write!(__f, "image"),
1002            }
1003        }
1004    }
1005    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
1006    pub struct ImageBlockParam {
1007        pub source: ImageSource,
1008        pub r#type: ImageBlockParamType,
1009        #[serde(skip_serializing_if = "Option::is_none")]
1010        pub cache_control: Option<CacheControlEphemeral>,
1011    }
1012    impl ::std::convert::From<TextBlockParam> for ContentBlockSourceContent {
1013        fn from(value: TextBlockParam) -> Self {
1014            ContentBlockSourceContent::TextBlockParam(value)
1015        }
1016    }
1017    impl ::std::convert::TryFrom<ContentBlockSourceContent> for TextBlockParam {
1018        type Error = ContentBlockSourceContent;
1019        /// # Errors
1020        ///
1021        /// Returns the original enum value if it does not match the
1022        /// `#variant_ident` variant.
1023        fn try_from(value: ContentBlockSourceContent) -> ::std::result::Result<Self, Self::Error> {
1024            match value {
1025                ContentBlockSourceContent::TextBlockParam(inner) => {
1026                    ::std::result::Result::Ok(inner)
1027                }
1028                other => ::std::result::Result::Err(other),
1029            }
1030        }
1031    }
1032    impl ::std::convert::From<ImageBlockParam> for ContentBlockSourceContent {
1033        fn from(value: ImageBlockParam) -> Self {
1034            ContentBlockSourceContent::ImageBlockParam(value)
1035        }
1036    }
1037    impl ::std::convert::TryFrom<ContentBlockSourceContent> for ImageBlockParam {
1038        type Error = ContentBlockSourceContent;
1039        /// # Errors
1040        ///
1041        /// Returns the original enum value if it does not match the
1042        /// `#variant_ident` variant.
1043        fn try_from(value: ContentBlockSourceContent) -> ::std::result::Result<Self, Self::Error> {
1044            match value {
1045                ContentBlockSourceContent::ImageBlockParam(inner) => {
1046                    ::std::result::Result::Ok(inner)
1047                }
1048                other => ::std::result::Result::Err(other),
1049            }
1050        }
1051    }
1052    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
1053    #[serde(untagged)]
1054    pub enum ContentBlockSourceContent {
1055        TextBlockParam(TextBlockParam),
1056        ImageBlockParam(ImageBlockParam),
1057    }
1058    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
1059    #[serde(untagged)]
1060    pub enum ContentBlockSourceContent66 {
1061        ContentBlockSourceContent66Variant0(String),
1062        ContentBlockSourceContent66Variant1(Vec<ContentBlockSourceContent>),
1063    }
1064    impl ::std::convert::From<String> for ContentBlockSourceContent66 {
1065        fn from(value: String) -> Self {
1066            ContentBlockSourceContent66::ContentBlockSourceContent66Variant0(value)
1067        }
1068    }
1069    impl ::std::convert::TryFrom<ContentBlockSourceContent66> for String {
1070        type Error = ContentBlockSourceContent66;
1071        /// # Errors
1072        ///
1073        /// Returns the original enum value if it does not match the
1074        /// `#variant_ident` variant.
1075        fn try_from(
1076            value: ContentBlockSourceContent66,
1077        ) -> ::std::result::Result<Self, Self::Error> {
1078            match value {
1079                ContentBlockSourceContent66::ContentBlockSourceContent66Variant0(inner) => {
1080                    ::std::result::Result::Ok(inner)
1081                }
1082                other => ::std::result::Result::Err(other),
1083            }
1084        }
1085    }
1086    impl ::std::convert::From<Vec<ContentBlockSourceContent>> for ContentBlockSourceContent66 {
1087        fn from(value: Vec<ContentBlockSourceContent>) -> Self {
1088            ContentBlockSourceContent66::ContentBlockSourceContent66Variant1(value)
1089        }
1090    }
1091    impl ::std::convert::TryFrom<ContentBlockSourceContent66> for Vec<ContentBlockSourceContent> {
1092        type Error = ContentBlockSourceContent66;
1093        /// # Errors
1094        ///
1095        /// Returns the original enum value if it does not match the
1096        /// `#variant_ident` variant.
1097        fn try_from(
1098            value: ContentBlockSourceContent66,
1099        ) -> ::std::result::Result<Self, Self::Error> {
1100            match value {
1101                ContentBlockSourceContent66::ContentBlockSourceContent66Variant1(inner) => {
1102                    ::std::result::Result::Ok(inner)
1103                }
1104                other => ::std::result::Result::Err(other),
1105            }
1106        }
1107    }
1108    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
1109    pub enum ContentBlockSourceType {
1110        #[serde(rename = "content")]
1111        Content,
1112    }
1113    impl ::std::fmt::Display for ContentBlockSourceType {
1114        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
1115            match self {
1116                Self::Content => ::std::write!(__f, "content"),
1117            }
1118        }
1119    }
1120    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
1121    pub struct ContentBlockSource {
1122        pub content: ContentBlockSourceContent66,
1123        pub r#type: ContentBlockSourceType,
1124    }
1125    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
1126    pub enum UrlpdfSourceType {
1127        #[serde(rename = "url")]
1128        Url,
1129    }
1130    impl ::std::fmt::Display for UrlpdfSourceType {
1131        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
1132            match self {
1133                Self::Url => ::std::write!(__f, "url"),
1134            }
1135        }
1136    }
1137    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
1138    pub struct UrlpdfSource {
1139        pub r#type: UrlpdfSourceType,
1140        pub url: String,
1141    }
1142    impl ::std::convert::From<Base64PdfSource> for DocumentSource {
1143        fn from(value: Base64PdfSource) -> Self {
1144            DocumentSource::Base64PdfSource(value)
1145        }
1146    }
1147    impl ::std::convert::TryFrom<DocumentSource> for Base64PdfSource {
1148        type Error = DocumentSource;
1149        /// # Errors
1150        ///
1151        /// Returns the original enum value if it does not match the
1152        /// `#variant_ident` variant.
1153        fn try_from(value: DocumentSource) -> ::std::result::Result<Self, Self::Error> {
1154            match value {
1155                DocumentSource::Base64PdfSource(inner) => ::std::result::Result::Ok(inner),
1156                other => ::std::result::Result::Err(other),
1157            }
1158        }
1159    }
1160    impl ::std::convert::From<PlainTextSource> for DocumentSource {
1161        fn from(value: PlainTextSource) -> Self {
1162            DocumentSource::PlainTextSource(value)
1163        }
1164    }
1165    impl ::std::convert::TryFrom<DocumentSource> for PlainTextSource {
1166        type Error = DocumentSource;
1167        /// # Errors
1168        ///
1169        /// Returns the original enum value if it does not match the
1170        /// `#variant_ident` variant.
1171        fn try_from(value: DocumentSource) -> ::std::result::Result<Self, Self::Error> {
1172            match value {
1173                DocumentSource::PlainTextSource(inner) => ::std::result::Result::Ok(inner),
1174                other => ::std::result::Result::Err(other),
1175            }
1176        }
1177    }
1178    impl ::std::convert::From<ContentBlockSource> for DocumentSource {
1179        fn from(value: ContentBlockSource) -> Self {
1180            DocumentSource::ContentBlockSource(value)
1181        }
1182    }
1183    impl ::std::convert::TryFrom<DocumentSource> for ContentBlockSource {
1184        type Error = DocumentSource;
1185        /// # Errors
1186        ///
1187        /// Returns the original enum value if it does not match the
1188        /// `#variant_ident` variant.
1189        fn try_from(value: DocumentSource) -> ::std::result::Result<Self, Self::Error> {
1190            match value {
1191                DocumentSource::ContentBlockSource(inner) => ::std::result::Result::Ok(inner),
1192                other => ::std::result::Result::Err(other),
1193            }
1194        }
1195    }
1196    impl ::std::convert::From<UrlpdfSource> for DocumentSource {
1197        fn from(value: UrlpdfSource) -> Self {
1198            DocumentSource::UrlpdfSource(value)
1199        }
1200    }
1201    impl ::std::convert::TryFrom<DocumentSource> for UrlpdfSource {
1202        type Error = DocumentSource;
1203        /// # Errors
1204        ///
1205        /// Returns the original enum value if it does not match the
1206        /// `#variant_ident` variant.
1207        fn try_from(value: DocumentSource) -> ::std::result::Result<Self, Self::Error> {
1208            match value {
1209                DocumentSource::UrlpdfSource(inner) => ::std::result::Result::Ok(inner),
1210                other => ::std::result::Result::Err(other),
1211            }
1212        }
1213    }
1214    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
1215    #[serde(untagged)]
1216    pub enum DocumentSource {
1217        #[serde(rename = "Base64PDFSource")]
1218        Base64PdfSource(Base64PdfSource),
1219        PlainTextSource(PlainTextSource),
1220        ContentBlockSource(ContentBlockSource),
1221        #[serde(rename = "URLPDFSource")]
1222        UrlpdfSource(UrlpdfSource),
1223    }
1224    impl ::std::convert::From<Base64PdfSource> for WebFetchDocumentSource {
1225        fn from(value: Base64PdfSource) -> Self {
1226            WebFetchDocumentSource::Base64PdfSource(value)
1227        }
1228    }
1229    impl ::std::convert::TryFrom<WebFetchDocumentSource> for Base64PdfSource {
1230        type Error = WebFetchDocumentSource;
1231        /// # Errors
1232        ///
1233        /// Returns the original enum value if it does not match the
1234        /// `#variant_ident` variant.
1235        fn try_from(value: WebFetchDocumentSource) -> ::std::result::Result<Self, Self::Error> {
1236            match value {
1237                WebFetchDocumentSource::Base64PdfSource(inner) => ::std::result::Result::Ok(inner),
1238                other => ::std::result::Result::Err(other),
1239            }
1240        }
1241    }
1242    impl ::std::convert::From<PlainTextSource> for WebFetchDocumentSource {
1243        fn from(value: PlainTextSource) -> Self {
1244            WebFetchDocumentSource::PlainTextSource(value)
1245        }
1246    }
1247    impl ::std::convert::TryFrom<WebFetchDocumentSource> for PlainTextSource {
1248        type Error = WebFetchDocumentSource;
1249        /// # Errors
1250        ///
1251        /// Returns the original enum value if it does not match the
1252        /// `#variant_ident` variant.
1253        fn try_from(value: WebFetchDocumentSource) -> ::std::result::Result<Self, Self::Error> {
1254            match value {
1255                WebFetchDocumentSource::PlainTextSource(inner) => ::std::result::Result::Ok(inner),
1256                other => ::std::result::Result::Err(other),
1257            }
1258        }
1259    }
1260    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
1261    #[serde(untagged)]
1262    pub enum WebFetchDocumentSource {
1263        #[serde(rename = "Base64PDFSource")]
1264        Base64PdfSource(Base64PdfSource),
1265        PlainTextSource(PlainTextSource),
1266    }
1267    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
1268    pub enum DocumentBlockParamType {
1269        #[serde(rename = "document")]
1270        Document,
1271    }
1272    impl ::std::fmt::Display for DocumentBlockParamType {
1273        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
1274            match self {
1275                Self::Document => ::std::write!(__f, "document"),
1276            }
1277        }
1278    }
1279    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
1280    pub struct DocumentBlockParam {
1281        pub source: DocumentSource,
1282        pub r#type: DocumentBlockParamType,
1283        #[serde(skip_serializing_if = "Option::is_none")]
1284        pub cache_control: Option<CacheControlEphemeral>,
1285        #[serde(skip_serializing_if = "Option::is_none")]
1286        pub citations: Option<CitationsConfigParam>,
1287        #[serde(skip_serializing_if = "Option::is_none")]
1288        pub context: Option<String>,
1289        #[serde(skip_serializing_if = "Option::is_none")]
1290        pub title: Option<String>,
1291    }
1292    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
1293    pub enum SearchResultBlockParamType {
1294        #[serde(rename = "search_result")]
1295        SearchResult,
1296    }
1297    impl ::std::fmt::Display for SearchResultBlockParamType {
1298        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
1299            match self {
1300                Self::SearchResult => ::std::write!(__f, "search_result"),
1301            }
1302        }
1303    }
1304    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
1305    pub struct SearchResultBlockParam {
1306        pub content: Vec<TextBlockParam>,
1307        pub source: String,
1308        pub title: String,
1309        pub r#type: SearchResultBlockParamType,
1310        #[serde(skip_serializing_if = "Option::is_none")]
1311        pub cache_control: Option<CacheControlEphemeral>,
1312        #[serde(skip_serializing_if = "Option::is_none")]
1313        pub citations: Option<CitationsConfigParam>,
1314    }
1315    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
1316    pub enum ThinkingBlockParamType {
1317        #[serde(rename = "thinking")]
1318        Thinking,
1319    }
1320    impl ::std::fmt::Display for ThinkingBlockParamType {
1321        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
1322            match self {
1323                Self::Thinking => ::std::write!(__f, "thinking"),
1324            }
1325        }
1326    }
1327    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
1328    pub struct ThinkingBlockParam {
1329        pub signature: String,
1330        pub thinking: String,
1331        pub r#type: ThinkingBlockParamType,
1332    }
1333    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
1334    pub enum RedactedThinkingBlockParamType {
1335        #[serde(rename = "redacted_thinking")]
1336        RedactedThinking,
1337    }
1338    impl ::std::fmt::Display for RedactedThinkingBlockParamType {
1339        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
1340            match self {
1341                Self::RedactedThinking => ::std::write!(__f, "redacted_thinking"),
1342            }
1343        }
1344    }
1345    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
1346    pub struct RedactedThinkingBlockParam {
1347        pub data: String,
1348        pub r#type: RedactedThinkingBlockParamType,
1349    }
1350    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
1351    pub enum ToolUseBlockParamType {
1352        #[serde(rename = "tool_use")]
1353        ToolUse,
1354    }
1355    impl ::std::fmt::Display for ToolUseBlockParamType {
1356        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
1357            match self {
1358                Self::ToolUse => ::std::write!(__f, "tool_use"),
1359            }
1360        }
1361    }
1362    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
1363    pub struct ToolUseBlockParam {
1364        pub id: String,
1365        pub input: ::std::collections::BTreeMap<String, ::serde_json::Value>,
1366        pub name: String,
1367        pub r#type: ToolUseBlockParamType,
1368        #[serde(skip_serializing_if = "Option::is_none")]
1369        pub cache_control: Option<CacheControlEphemeral>,
1370        #[serde(skip_serializing_if = "Option::is_none")]
1371        pub caller: Option<Caller>,
1372    }
1373    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
1374    pub enum ToolReferenceBlockParamType {
1375        #[serde(rename = "tool_reference")]
1376        ToolReference,
1377    }
1378    impl ::std::fmt::Display for ToolReferenceBlockParamType {
1379        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
1380            match self {
1381                Self::ToolReference => ::std::write!(__f, "tool_reference"),
1382            }
1383        }
1384    }
1385    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
1386    /// 可在 tool_result 内容里出现的 tool 引用 block。
1387    pub struct ToolReferenceBlockParam {
1388        pub tool_name: String,
1389        pub r#type: ToolReferenceBlockParamType,
1390        #[serde(skip_serializing_if = "Option::is_none")]
1391        pub cache_control: Option<CacheControlEphemeral>,
1392    }
1393    impl ::std::convert::From<TextBlockParam> for ToolResultBlockParamContent {
1394        fn from(value: TextBlockParam) -> Self {
1395            ToolResultBlockParamContent::TextBlockParam(value)
1396        }
1397    }
1398    impl ::std::convert::TryFrom<ToolResultBlockParamContent> for TextBlockParam {
1399        type Error = ToolResultBlockParamContent;
1400        /// # Errors
1401        ///
1402        /// Returns the original enum value if it does not match the
1403        /// `#variant_ident` variant.
1404        fn try_from(
1405            value: ToolResultBlockParamContent,
1406        ) -> ::std::result::Result<Self, Self::Error> {
1407            match value {
1408                ToolResultBlockParamContent::TextBlockParam(inner) => {
1409                    ::std::result::Result::Ok(inner)
1410                }
1411                other => ::std::result::Result::Err(other),
1412            }
1413        }
1414    }
1415    impl ::std::convert::From<ImageBlockParam> for ToolResultBlockParamContent {
1416        fn from(value: ImageBlockParam) -> Self {
1417            ToolResultBlockParamContent::ImageBlockParam(value)
1418        }
1419    }
1420    impl ::std::convert::TryFrom<ToolResultBlockParamContent> for ImageBlockParam {
1421        type Error = ToolResultBlockParamContent;
1422        /// # Errors
1423        ///
1424        /// Returns the original enum value if it does not match the
1425        /// `#variant_ident` variant.
1426        fn try_from(
1427            value: ToolResultBlockParamContent,
1428        ) -> ::std::result::Result<Self, Self::Error> {
1429            match value {
1430                ToolResultBlockParamContent::ImageBlockParam(inner) => {
1431                    ::std::result::Result::Ok(inner)
1432                }
1433                other => ::std::result::Result::Err(other),
1434            }
1435        }
1436    }
1437    impl ::std::convert::From<SearchResultBlockParam> for ToolResultBlockParamContent {
1438        fn from(value: SearchResultBlockParam) -> Self {
1439            ToolResultBlockParamContent::SearchResultBlockParam(value)
1440        }
1441    }
1442    impl ::std::convert::TryFrom<ToolResultBlockParamContent> for SearchResultBlockParam {
1443        type Error = ToolResultBlockParamContent;
1444        /// # Errors
1445        ///
1446        /// Returns the original enum value if it does not match the
1447        /// `#variant_ident` variant.
1448        fn try_from(
1449            value: ToolResultBlockParamContent,
1450        ) -> ::std::result::Result<Self, Self::Error> {
1451            match value {
1452                ToolResultBlockParamContent::SearchResultBlockParam(inner) => {
1453                    ::std::result::Result::Ok(inner)
1454                }
1455                other => ::std::result::Result::Err(other),
1456            }
1457        }
1458    }
1459    impl ::std::convert::From<DocumentBlockParam> for ToolResultBlockParamContent {
1460        fn from(value: DocumentBlockParam) -> Self {
1461            ToolResultBlockParamContent::DocumentBlockParam(value)
1462        }
1463    }
1464    impl ::std::convert::TryFrom<ToolResultBlockParamContent> for DocumentBlockParam {
1465        type Error = ToolResultBlockParamContent;
1466        /// # Errors
1467        ///
1468        /// Returns the original enum value if it does not match the
1469        /// `#variant_ident` variant.
1470        fn try_from(
1471            value: ToolResultBlockParamContent,
1472        ) -> ::std::result::Result<Self, Self::Error> {
1473            match value {
1474                ToolResultBlockParamContent::DocumentBlockParam(inner) => {
1475                    ::std::result::Result::Ok(inner)
1476                }
1477                other => ::std::result::Result::Err(other),
1478            }
1479        }
1480    }
1481    impl ::std::convert::From<ToolReferenceBlockParam> for ToolResultBlockParamContent {
1482        fn from(value: ToolReferenceBlockParam) -> Self {
1483            ToolResultBlockParamContent::ToolReferenceBlockParam(value)
1484        }
1485    }
1486    impl ::std::convert::TryFrom<ToolResultBlockParamContent> for ToolReferenceBlockParam {
1487        type Error = ToolResultBlockParamContent;
1488        /// # Errors
1489        ///
1490        /// Returns the original enum value if it does not match the
1491        /// `#variant_ident` variant.
1492        fn try_from(
1493            value: ToolResultBlockParamContent,
1494        ) -> ::std::result::Result<Self, Self::Error> {
1495            match value {
1496                ToolResultBlockParamContent::ToolReferenceBlockParam(inner) => {
1497                    ::std::result::Result::Ok(inner)
1498                }
1499                other => ::std::result::Result::Err(other),
1500            }
1501        }
1502    }
1503    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
1504    #[serde(untagged)]
1505    pub enum ToolResultBlockParamContent {
1506        TextBlockParam(TextBlockParam),
1507        ImageBlockParam(ImageBlockParam),
1508        SearchResultBlockParam(SearchResultBlockParam),
1509        DocumentBlockParam(DocumentBlockParam),
1510        ToolReferenceBlockParam(ToolReferenceBlockParam),
1511    }
1512    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
1513    pub enum ToolResultBlockParamType {
1514        #[serde(rename = "tool_result")]
1515        ToolResult,
1516    }
1517    impl ::std::fmt::Display for ToolResultBlockParamType {
1518        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
1519            match self {
1520                Self::ToolResult => ::std::write!(__f, "tool_result"),
1521            }
1522        }
1523    }
1524    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
1525    #[serde(untagged)]
1526    pub enum ToolResultBlockParamContent102 {
1527        ToolResultBlockParamContent102Variant0(String),
1528        ToolResultBlockParamContent102Variant1(Vec<ToolResultBlockParamContent>),
1529    }
1530    impl ::std::convert::From<String> for ToolResultBlockParamContent102 {
1531        fn from(value: String) -> Self {
1532            ToolResultBlockParamContent102::ToolResultBlockParamContent102Variant0(value)
1533        }
1534    }
1535    impl ::std::convert::TryFrom<ToolResultBlockParamContent102> for String {
1536        type Error = ToolResultBlockParamContent102;
1537        /// # Errors
1538        ///
1539        /// Returns the original enum value if it does not match the
1540        /// `#variant_ident` variant.
1541        fn try_from(
1542            value: ToolResultBlockParamContent102,
1543        ) -> ::std::result::Result<Self, Self::Error> {
1544            match value {
1545                ToolResultBlockParamContent102::ToolResultBlockParamContent102Variant0(inner) => {
1546                    ::std::result::Result::Ok(inner)
1547                }
1548                other => ::std::result::Result::Err(other),
1549            }
1550        }
1551    }
1552    impl ::std::convert::From<Vec<ToolResultBlockParamContent>> for ToolResultBlockParamContent102 {
1553        fn from(value: Vec<ToolResultBlockParamContent>) -> Self {
1554            ToolResultBlockParamContent102::ToolResultBlockParamContent102Variant1(value)
1555        }
1556    }
1557    impl ::std::convert::TryFrom<ToolResultBlockParamContent102> for Vec<ToolResultBlockParamContent> {
1558        type Error = ToolResultBlockParamContent102;
1559        /// # Errors
1560        ///
1561        /// Returns the original enum value if it does not match the
1562        /// `#variant_ident` variant.
1563        fn try_from(
1564            value: ToolResultBlockParamContent102,
1565        ) -> ::std::result::Result<Self, Self::Error> {
1566            match value {
1567                ToolResultBlockParamContent102::ToolResultBlockParamContent102Variant1(inner) => {
1568                    ::std::result::Result::Ok(inner)
1569                }
1570                other => ::std::result::Result::Err(other),
1571            }
1572        }
1573    }
1574    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
1575    pub struct ToolResultBlockParam {
1576        pub tool_use_id: String,
1577        pub r#type: ToolResultBlockParamType,
1578        #[serde(skip_serializing_if = "Option::is_none")]
1579        pub cache_control: Option<CacheControlEphemeral>,
1580        #[serde(skip_serializing_if = "Option::is_none")]
1581        pub content: Option<ToolResultBlockParamContent102>,
1582        #[serde(skip_serializing_if = "Option::is_none")]
1583        pub is_error: Option<bool>,
1584    }
1585    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
1586    pub enum ServerToolUseBlockParamName {
1587        #[serde(rename = "web_search")]
1588        WebSearch,
1589        #[serde(rename = "web_fetch")]
1590        WebFetch,
1591        #[serde(rename = "code_execution")]
1592        CodeExecution,
1593        #[serde(rename = "bash_code_execution")]
1594        BashCodeExecution,
1595        #[serde(rename = "text_editor_code_execution")]
1596        TextEditorCodeExecution,
1597        #[serde(rename = "tool_search_tool_regex")]
1598        ToolSearchToolRegex,
1599        #[serde(rename = "tool_search_tool_bm25")]
1600        ToolSearchToolBm25,
1601    }
1602    impl ::std::fmt::Display for ServerToolUseBlockParamName {
1603        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
1604            match self {
1605                Self::WebSearch => ::std::write!(__f, "web_search"),
1606                Self::WebFetch => ::std::write!(__f, "web_fetch"),
1607                Self::CodeExecution => ::std::write!(__f, "code_execution"),
1608                Self::BashCodeExecution => ::std::write!(__f, "bash_code_execution"),
1609                Self::TextEditorCodeExecution => {
1610                    ::std::write!(__f, "text_editor_code_execution")
1611                }
1612                Self::ToolSearchToolRegex => ::std::write!(__f, "tool_search_tool_regex"),
1613                Self::ToolSearchToolBm25 => ::std::write!(__f, "tool_search_tool_bm25"),
1614            }
1615        }
1616    }
1617    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
1618    pub enum ServerToolUseBlockParamType {
1619        #[serde(rename = "server_tool_use")]
1620        ServerToolUse,
1621    }
1622    impl ::std::fmt::Display for ServerToolUseBlockParamType {
1623        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
1624            match self {
1625                Self::ServerToolUse => ::std::write!(__f, "server_tool_use"),
1626            }
1627        }
1628    }
1629    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
1630    pub struct ServerToolUseBlockParam {
1631        pub id: String,
1632        pub input: ::std::collections::BTreeMap<String, ::serde_json::Value>,
1633        pub name: ServerToolUseBlockParamName,
1634        pub r#type: ServerToolUseBlockParamType,
1635        #[serde(skip_serializing_if = "Option::is_none")]
1636        pub cache_control: Option<CacheControlEphemeral>,
1637        #[serde(skip_serializing_if = "Option::is_none")]
1638        pub caller: Option<Caller>,
1639    }
1640    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
1641    pub enum WebSearchResultBlockParamType {
1642        #[serde(rename = "web_search_result")]
1643        WebSearchResult,
1644    }
1645    impl ::std::fmt::Display for WebSearchResultBlockParamType {
1646        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
1647            match self {
1648                Self::WebSearchResult => ::std::write!(__f, "web_search_result"),
1649            }
1650        }
1651    }
1652    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
1653    pub struct WebSearchResultBlockParam {
1654        pub encrypted_content: String,
1655        pub title: String,
1656        pub r#type: WebSearchResultBlockParamType,
1657        pub url: String,
1658        #[serde(skip_serializing_if = "Option::is_none")]
1659        pub page_age: Option<String>,
1660    }
1661    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
1662    pub enum WebSearchToolRequestErrorErrorCode {
1663        #[serde(rename = "invalid_tool_input")]
1664        InvalidToolInput,
1665        #[serde(rename = "unavailable")]
1666        Unavailable,
1667        #[serde(rename = "max_uses_exceeded")]
1668        MaxUsesExceeded,
1669        #[serde(rename = "too_many_requests")]
1670        TooManyRequests,
1671        #[serde(rename = "query_too_long")]
1672        QueryTooLong,
1673        #[serde(rename = "request_too_large")]
1674        RequestTooLarge,
1675    }
1676    impl ::std::fmt::Display for WebSearchToolRequestErrorErrorCode {
1677        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
1678            match self {
1679                Self::InvalidToolInput => ::std::write!(__f, "invalid_tool_input"),
1680                Self::Unavailable => ::std::write!(__f, "unavailable"),
1681                Self::MaxUsesExceeded => ::std::write!(__f, "max_uses_exceeded"),
1682                Self::TooManyRequests => ::std::write!(__f, "too_many_requests"),
1683                Self::QueryTooLong => ::std::write!(__f, "query_too_long"),
1684                Self::RequestTooLarge => ::std::write!(__f, "request_too_large"),
1685            }
1686        }
1687    }
1688    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
1689    pub enum WebSearchToolRequestErrorType {
1690        #[serde(rename = "web_search_tool_result_error")]
1691        WebSearchToolResultError,
1692    }
1693    impl ::std::fmt::Display for WebSearchToolRequestErrorType {
1694        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
1695            match self {
1696                Self::WebSearchToolResultError => {
1697                    ::std::write!(__f, "web_search_tool_result_error")
1698                }
1699            }
1700        }
1701    }
1702    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
1703    pub struct WebSearchToolRequestError {
1704        pub error_code: WebSearchToolRequestErrorErrorCode,
1705        pub r#type: WebSearchToolRequestErrorType,
1706    }
1707    impl ::std::convert::From<Vec<WebSearchResultBlockParam>> for WebSearchToolResultBlockParamContent {
1708        fn from(value: Vec<WebSearchResultBlockParam>) -> Self {
1709            WebSearchToolResultBlockParamContent::WebSearchToolResultBlockParamContentVariant0(
1710                value,
1711            )
1712        }
1713    }
1714    impl ::std::convert::TryFrom<WebSearchToolResultBlockParamContent>
1715        for Vec<WebSearchResultBlockParam>
1716    {
1717        type Error = WebSearchToolResultBlockParamContent;
1718        /// # Errors
1719        ///
1720        /// Returns the original enum value if it does not match the
1721        /// `#variant_ident` variant.
1722        fn try_from(
1723            value: WebSearchToolResultBlockParamContent,
1724        ) -> ::std::result::Result<Self, Self::Error> {
1725            match value {
1726                WebSearchToolResultBlockParamContent::WebSearchToolResultBlockParamContentVariant0(
1727                    inner,
1728                ) => ::std::result::Result::Ok(inner),
1729                other => ::std::result::Result::Err(other),
1730            }
1731        }
1732    }
1733    impl ::std::convert::From<WebSearchToolRequestError> for WebSearchToolResultBlockParamContent {
1734        fn from(value: WebSearchToolRequestError) -> Self {
1735            WebSearchToolResultBlockParamContent::WebSearchToolRequestError(value)
1736        }
1737    }
1738    impl ::std::convert::TryFrom<WebSearchToolResultBlockParamContent> for WebSearchToolRequestError {
1739        type Error = WebSearchToolResultBlockParamContent;
1740        /// # Errors
1741        ///
1742        /// Returns the original enum value if it does not match the
1743        /// `#variant_ident` variant.
1744        fn try_from(
1745            value: WebSearchToolResultBlockParamContent,
1746        ) -> ::std::result::Result<Self, Self::Error> {
1747            match value {
1748                WebSearchToolResultBlockParamContent::WebSearchToolRequestError(inner) => {
1749                    ::std::result::Result::Ok(inner)
1750                }
1751                other => ::std::result::Result::Err(other),
1752            }
1753        }
1754    }
1755    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
1756    #[serde(untagged)]
1757    pub enum WebSearchToolResultBlockParamContent {
1758        WebSearchToolResultBlockParamContentVariant0(Vec<WebSearchResultBlockParam>),
1759        WebSearchToolRequestError(WebSearchToolRequestError),
1760    }
1761    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
1762    pub enum WebSearchToolResultBlockParamType {
1763        #[serde(rename = "web_search_tool_result")]
1764        WebSearchToolResult,
1765    }
1766    impl ::std::fmt::Display for WebSearchToolResultBlockParamType {
1767        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
1768            match self {
1769                Self::WebSearchToolResult => ::std::write!(__f, "web_search_tool_result"),
1770            }
1771        }
1772    }
1773    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
1774    pub struct WebSearchToolResultBlockParam {
1775        pub content: WebSearchToolResultBlockParamContent,
1776        pub tool_use_id: String,
1777        pub r#type: WebSearchToolResultBlockParamType,
1778        #[serde(skip_serializing_if = "Option::is_none")]
1779        pub cache_control: Option<CacheControlEphemeral>,
1780        #[serde(skip_serializing_if = "Option::is_none")]
1781        pub caller: Option<Caller>,
1782    }
1783    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
1784    pub enum WebFetchToolResultErrorBlockParamErrorCode {
1785        #[serde(rename = "invalid_tool_input")]
1786        InvalidToolInput,
1787        #[serde(rename = "url_too_long")]
1788        UrlTooLong,
1789        #[serde(rename = "url_not_allowed")]
1790        UrlNotAllowed,
1791        #[serde(rename = "url_not_accessible")]
1792        UrlNotAccessible,
1793        #[serde(rename = "unsupported_content_type")]
1794        UnsupportedContentType,
1795        #[serde(rename = "too_many_requests")]
1796        TooManyRequests,
1797        #[serde(rename = "max_uses_exceeded")]
1798        MaxUsesExceeded,
1799        #[serde(rename = "unavailable")]
1800        Unavailable,
1801    }
1802    impl ::std::fmt::Display for WebFetchToolResultErrorBlockParamErrorCode {
1803        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
1804            match self {
1805                Self::InvalidToolInput => ::std::write!(__f, "invalid_tool_input"),
1806                Self::UrlTooLong => ::std::write!(__f, "url_too_long"),
1807                Self::UrlNotAllowed => ::std::write!(__f, "url_not_allowed"),
1808                Self::UrlNotAccessible => ::std::write!(__f, "url_not_accessible"),
1809                Self::UnsupportedContentType => {
1810                    ::std::write!(__f, "unsupported_content_type")
1811                }
1812                Self::TooManyRequests => ::std::write!(__f, "too_many_requests"),
1813                Self::MaxUsesExceeded => ::std::write!(__f, "max_uses_exceeded"),
1814                Self::Unavailable => ::std::write!(__f, "unavailable"),
1815            }
1816        }
1817    }
1818    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
1819    pub enum WebFetchToolResultErrorBlockParamType {
1820        #[serde(rename = "web_fetch_tool_result_error")]
1821        WebFetchToolResultError,
1822    }
1823    impl ::std::fmt::Display for WebFetchToolResultErrorBlockParamType {
1824        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
1825            match self {
1826                Self::WebFetchToolResultError => {
1827                    ::std::write!(__f, "web_fetch_tool_result_error")
1828                }
1829            }
1830        }
1831    }
1832    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
1833    pub struct WebFetchToolResultErrorBlockParam {
1834        pub error_code: WebFetchToolResultErrorBlockParamErrorCode,
1835        pub r#type: WebFetchToolResultErrorBlockParamType,
1836    }
1837    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
1838    pub enum WebFetchBlockParamType {
1839        #[serde(rename = "web_fetch_result")]
1840        WebFetchResult,
1841    }
1842    impl ::std::fmt::Display for WebFetchBlockParamType {
1843        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
1844            match self {
1845                Self::WebFetchResult => ::std::write!(__f, "web_fetch_result"),
1846            }
1847        }
1848    }
1849    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
1850    pub struct WebFetchBlockParam {
1851        pub content: DocumentBlockParam,
1852        pub r#type: WebFetchBlockParamType,
1853        /// Fetched content URL
1854        pub url: String,
1855        #[serde(skip_serializing_if = "Option::is_none")]
1856        /// ISO 8601 时间戳
1857        pub retrieved_at: Option<String>,
1858    }
1859    impl ::std::convert::From<WebFetchToolResultErrorBlockParam>
1860        for WebFetchToolResultBlockParamContent
1861    {
1862        fn from(value: WebFetchToolResultErrorBlockParam) -> Self {
1863            WebFetchToolResultBlockParamContent::WebFetchToolResultErrorBlockParam(value)
1864        }
1865    }
1866    impl ::std::convert::TryFrom<WebFetchToolResultBlockParamContent>
1867        for WebFetchToolResultErrorBlockParam
1868    {
1869        type Error = WebFetchToolResultBlockParamContent;
1870        /// # Errors
1871        ///
1872        /// Returns the original enum value if it does not match the
1873        /// `#variant_ident` variant.
1874        fn try_from(
1875            value: WebFetchToolResultBlockParamContent,
1876        ) -> ::std::result::Result<Self, Self::Error> {
1877            match value {
1878                WebFetchToolResultBlockParamContent::WebFetchToolResultErrorBlockParam(inner) => {
1879                    ::std::result::Result::Ok(inner)
1880                }
1881                other => ::std::result::Result::Err(other),
1882            }
1883        }
1884    }
1885    impl ::std::convert::From<WebFetchBlockParam> for WebFetchToolResultBlockParamContent {
1886        fn from(value: WebFetchBlockParam) -> Self {
1887            WebFetchToolResultBlockParamContent::WebFetchBlockParam(value)
1888        }
1889    }
1890    impl ::std::convert::TryFrom<WebFetchToolResultBlockParamContent> for WebFetchBlockParam {
1891        type Error = WebFetchToolResultBlockParamContent;
1892        /// # Errors
1893        ///
1894        /// Returns the original enum value if it does not match the
1895        /// `#variant_ident` variant.
1896        fn try_from(
1897            value: WebFetchToolResultBlockParamContent,
1898        ) -> ::std::result::Result<Self, Self::Error> {
1899            match value {
1900                WebFetchToolResultBlockParamContent::WebFetchBlockParam(inner) => {
1901                    ::std::result::Result::Ok(inner)
1902                }
1903                other => ::std::result::Result::Err(other),
1904            }
1905        }
1906    }
1907    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
1908    #[serde(untagged)]
1909    pub enum WebFetchToolResultBlockParamContent {
1910        WebFetchToolResultErrorBlockParam(WebFetchToolResultErrorBlockParam),
1911        WebFetchBlockParam(WebFetchBlockParam),
1912    }
1913    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
1914    pub enum WebFetchToolResultBlockParamType {
1915        #[serde(rename = "web_fetch_tool_result")]
1916        WebFetchToolResult,
1917    }
1918    impl ::std::fmt::Display for WebFetchToolResultBlockParamType {
1919        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
1920            match self {
1921                Self::WebFetchToolResult => ::std::write!(__f, "web_fetch_tool_result"),
1922            }
1923        }
1924    }
1925    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
1926    pub struct WebFetchToolResultBlockParam {
1927        pub content: WebFetchToolResultBlockParamContent,
1928        pub tool_use_id: String,
1929        pub r#type: WebFetchToolResultBlockParamType,
1930        #[serde(skip_serializing_if = "Option::is_none")]
1931        pub cache_control: Option<CacheControlEphemeral>,
1932        #[serde(skip_serializing_if = "Option::is_none")]
1933        pub caller: Option<Caller>,
1934    }
1935    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
1936    pub enum CodeExecutionOutputBlockParamType {
1937        #[serde(rename = "code_execution_output")]
1938        CodeExecutionOutput,
1939    }
1940    impl ::std::fmt::Display for CodeExecutionOutputBlockParamType {
1941        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
1942            match self {
1943                Self::CodeExecutionOutput => ::std::write!(__f, "code_execution_output"),
1944            }
1945        }
1946    }
1947    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
1948    pub struct CodeExecutionOutputBlockParam {
1949        pub file_id: String,
1950        pub r#type: CodeExecutionOutputBlockParamType,
1951    }
1952    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
1953    pub enum CodeExecutionToolResultErrorParamErrorCode {
1954        #[serde(rename = "invalid_tool_input")]
1955        InvalidToolInput,
1956        #[serde(rename = "unavailable")]
1957        Unavailable,
1958        #[serde(rename = "too_many_requests")]
1959        TooManyRequests,
1960        #[serde(rename = "execution_time_exceeded")]
1961        ExecutionTimeExceeded,
1962    }
1963    impl ::std::fmt::Display for CodeExecutionToolResultErrorParamErrorCode {
1964        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
1965            match self {
1966                Self::InvalidToolInput => ::std::write!(__f, "invalid_tool_input"),
1967                Self::Unavailable => ::std::write!(__f, "unavailable"),
1968                Self::TooManyRequests => ::std::write!(__f, "too_many_requests"),
1969                Self::ExecutionTimeExceeded => {
1970                    ::std::write!(__f, "execution_time_exceeded")
1971                }
1972            }
1973        }
1974    }
1975    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
1976    pub enum CodeExecutionToolResultErrorParamType {
1977        #[serde(rename = "code_execution_tool_result_error")]
1978        CodeExecutionToolResultError,
1979    }
1980    impl ::std::fmt::Display for CodeExecutionToolResultErrorParamType {
1981        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
1982            match self {
1983                Self::CodeExecutionToolResultError => {
1984                    ::std::write!(__f, "code_execution_tool_result_error")
1985                }
1986            }
1987        }
1988    }
1989    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
1990    pub struct CodeExecutionToolResultErrorParam {
1991        pub error_code: CodeExecutionToolResultErrorParamErrorCode,
1992        pub r#type: CodeExecutionToolResultErrorParamType,
1993    }
1994    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
1995    pub enum CodeExecutionResultBlockParamType {
1996        #[serde(rename = "code_execution_result")]
1997        CodeExecutionResult,
1998    }
1999    impl ::std::fmt::Display for CodeExecutionResultBlockParamType {
2000        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
2001            match self {
2002                Self::CodeExecutionResult => ::std::write!(__f, "code_execution_result"),
2003            }
2004        }
2005    }
2006    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
2007    pub struct CodeExecutionResultBlockParam {
2008        pub content: Vec<CodeExecutionOutputBlockParam>,
2009        pub return_code: i64,
2010        pub stderr: String,
2011        pub stdout: String,
2012        pub r#type: CodeExecutionResultBlockParamType,
2013    }
2014    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
2015    pub enum EncryptedCodeExecutionResultBlockParamType {
2016        #[serde(rename = "encrypted_code_execution_result")]
2017        EncryptedCodeExecutionResult,
2018    }
2019    impl ::std::fmt::Display for EncryptedCodeExecutionResultBlockParamType {
2020        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
2021            match self {
2022                Self::EncryptedCodeExecutionResult => {
2023                    ::std::write!(__f, "encrypted_code_execution_result")
2024                }
2025            }
2026        }
2027    }
2028    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
2029    /// PFC + web_search 加密 stdout 的代码执行结果。
2030    pub struct EncryptedCodeExecutionResultBlockParam {
2031        pub content: Vec<CodeExecutionOutputBlockParam>,
2032        pub encrypted_stdout: String,
2033        pub return_code: i64,
2034        pub stderr: String,
2035        pub r#type: EncryptedCodeExecutionResultBlockParamType,
2036    }
2037    impl ::std::convert::From<CodeExecutionToolResultErrorParam>
2038        for CodeExecutionToolResultBlockParamContent
2039    {
2040        fn from(value: CodeExecutionToolResultErrorParam) -> Self {
2041            CodeExecutionToolResultBlockParamContent::CodeExecutionToolResultErrorParam(value)
2042        }
2043    }
2044    impl ::std::convert::TryFrom<CodeExecutionToolResultBlockParamContent>
2045        for CodeExecutionToolResultErrorParam
2046    {
2047        type Error = CodeExecutionToolResultBlockParamContent;
2048        /// # Errors
2049        ///
2050        /// Returns the original enum value if it does not match the
2051        /// `#variant_ident` variant.
2052        fn try_from(
2053            value: CodeExecutionToolResultBlockParamContent,
2054        ) -> ::std::result::Result<Self, Self::Error> {
2055            match value {
2056                CodeExecutionToolResultBlockParamContent::CodeExecutionToolResultErrorParam(
2057                    inner,
2058                ) => ::std::result::Result::Ok(inner),
2059                other => ::std::result::Result::Err(other),
2060            }
2061        }
2062    }
2063    impl ::std::convert::From<CodeExecutionResultBlockParam>
2064        for CodeExecutionToolResultBlockParamContent
2065    {
2066        fn from(value: CodeExecutionResultBlockParam) -> Self {
2067            CodeExecutionToolResultBlockParamContent::CodeExecutionResultBlockParam(value)
2068        }
2069    }
2070    impl ::std::convert::TryFrom<CodeExecutionToolResultBlockParamContent>
2071        for CodeExecutionResultBlockParam
2072    {
2073        type Error = CodeExecutionToolResultBlockParamContent;
2074        /// # Errors
2075        ///
2076        /// Returns the original enum value if it does not match the
2077        /// `#variant_ident` variant.
2078        fn try_from(
2079            value: CodeExecutionToolResultBlockParamContent,
2080        ) -> ::std::result::Result<Self, Self::Error> {
2081            match value {
2082                CodeExecutionToolResultBlockParamContent::CodeExecutionResultBlockParam(inner) => {
2083                    ::std::result::Result::Ok(inner)
2084                }
2085                other => ::std::result::Result::Err(other),
2086            }
2087        }
2088    }
2089    impl ::std::convert::From<EncryptedCodeExecutionResultBlockParam>
2090        for CodeExecutionToolResultBlockParamContent
2091    {
2092        fn from(value: EncryptedCodeExecutionResultBlockParam) -> Self {
2093            CodeExecutionToolResultBlockParamContent::EncryptedCodeExecutionResultBlockParam(value)
2094        }
2095    }
2096    impl ::std::convert::TryFrom<CodeExecutionToolResultBlockParamContent>
2097        for EncryptedCodeExecutionResultBlockParam
2098    {
2099        type Error = CodeExecutionToolResultBlockParamContent;
2100        /// # Errors
2101        ///
2102        /// Returns the original enum value if it does not match the
2103        /// `#variant_ident` variant.
2104        fn try_from(
2105            value: CodeExecutionToolResultBlockParamContent,
2106        ) -> ::std::result::Result<Self, Self::Error> {
2107            match value {
2108                CodeExecutionToolResultBlockParamContent::EncryptedCodeExecutionResultBlockParam(
2109                    inner,
2110                ) => ::std::result::Result::Ok(inner),
2111                other => ::std::result::Result::Err(other),
2112            }
2113        }
2114    }
2115    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
2116    #[serde(untagged)]
2117    pub enum CodeExecutionToolResultBlockParamContent {
2118        CodeExecutionToolResultErrorParam(CodeExecutionToolResultErrorParam),
2119        CodeExecutionResultBlockParam(CodeExecutionResultBlockParam),
2120        EncryptedCodeExecutionResultBlockParam(EncryptedCodeExecutionResultBlockParam),
2121    }
2122    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
2123    pub enum CodeExecutionToolResultBlockParamType {
2124        #[serde(rename = "code_execution_tool_result")]
2125        CodeExecutionToolResult,
2126    }
2127    impl ::std::fmt::Display for CodeExecutionToolResultBlockParamType {
2128        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
2129            match self {
2130                Self::CodeExecutionToolResult => {
2131                    ::std::write!(__f, "code_execution_tool_result")
2132                }
2133            }
2134        }
2135    }
2136    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
2137    pub struct CodeExecutionToolResultBlockParam {
2138        pub content: CodeExecutionToolResultBlockParamContent,
2139        pub tool_use_id: String,
2140        pub r#type: CodeExecutionToolResultBlockParamType,
2141        #[serde(skip_serializing_if = "Option::is_none")]
2142        pub cache_control: Option<CacheControlEphemeral>,
2143    }
2144    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
2145    pub enum BashCodeExecutionOutputBlockParamType {
2146        #[serde(rename = "bash_code_execution_output")]
2147        BashCodeExecutionOutput,
2148    }
2149    impl ::std::fmt::Display for BashCodeExecutionOutputBlockParamType {
2150        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
2151            match self {
2152                Self::BashCodeExecutionOutput => {
2153                    ::std::write!(__f, "bash_code_execution_output")
2154                }
2155            }
2156        }
2157    }
2158    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
2159    pub struct BashCodeExecutionOutputBlockParam {
2160        pub file_id: String,
2161        pub r#type: BashCodeExecutionOutputBlockParamType,
2162    }
2163    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
2164    pub enum BashCodeExecutionToolResultErrorParamErrorCode {
2165        #[serde(rename = "invalid_tool_input")]
2166        InvalidToolInput,
2167        #[serde(rename = "unavailable")]
2168        Unavailable,
2169        #[serde(rename = "too_many_requests")]
2170        TooManyRequests,
2171        #[serde(rename = "execution_time_exceeded")]
2172        ExecutionTimeExceeded,
2173        #[serde(rename = "output_file_too_large")]
2174        OutputFileTooLarge,
2175    }
2176    impl ::std::fmt::Display for BashCodeExecutionToolResultErrorParamErrorCode {
2177        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
2178            match self {
2179                Self::InvalidToolInput => ::std::write!(__f, "invalid_tool_input"),
2180                Self::Unavailable => ::std::write!(__f, "unavailable"),
2181                Self::TooManyRequests => ::std::write!(__f, "too_many_requests"),
2182                Self::ExecutionTimeExceeded => {
2183                    ::std::write!(__f, "execution_time_exceeded")
2184                }
2185                Self::OutputFileTooLarge => ::std::write!(__f, "output_file_too_large"),
2186            }
2187        }
2188    }
2189    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
2190    pub enum BashCodeExecutionToolResultErrorParamType {
2191        #[serde(rename = "bash_code_execution_tool_result_error")]
2192        BashCodeExecutionToolResultError,
2193    }
2194    impl ::std::fmt::Display for BashCodeExecutionToolResultErrorParamType {
2195        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
2196            match self {
2197                Self::BashCodeExecutionToolResultError => {
2198                    ::std::write!(__f, "bash_code_execution_tool_result_error")
2199                }
2200            }
2201        }
2202    }
2203    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
2204    pub struct BashCodeExecutionToolResultErrorParam {
2205        pub error_code: BashCodeExecutionToolResultErrorParamErrorCode,
2206        pub r#type: BashCodeExecutionToolResultErrorParamType,
2207    }
2208    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
2209    pub enum BashCodeExecutionResultBlockParamType {
2210        #[serde(rename = "bash_code_execution_result")]
2211        BashCodeExecutionResult,
2212    }
2213    impl ::std::fmt::Display for BashCodeExecutionResultBlockParamType {
2214        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
2215            match self {
2216                Self::BashCodeExecutionResult => {
2217                    ::std::write!(__f, "bash_code_execution_result")
2218                }
2219            }
2220        }
2221    }
2222    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
2223    pub struct BashCodeExecutionResultBlockParam {
2224        pub content: Vec<BashCodeExecutionOutputBlockParam>,
2225        pub return_code: i64,
2226        pub stderr: String,
2227        pub stdout: String,
2228        pub r#type: BashCodeExecutionResultBlockParamType,
2229    }
2230    impl ::std::convert::From<BashCodeExecutionToolResultErrorParam>
2231        for BashCodeExecutionToolResultBlockParamContent
2232    {
2233        fn from(value: BashCodeExecutionToolResultErrorParam) -> Self {
2234            BashCodeExecutionToolResultBlockParamContent::BashCodeExecutionToolResultErrorParam(
2235                value,
2236            )
2237        }
2238    }
2239    impl ::std::convert::TryFrom<BashCodeExecutionToolResultBlockParamContent>
2240        for BashCodeExecutionToolResultErrorParam
2241    {
2242        type Error = BashCodeExecutionToolResultBlockParamContent;
2243        /// # Errors
2244        ///
2245        /// Returns the original enum value if it does not match the
2246        /// `#variant_ident` variant.
2247        fn try_from(
2248            value: BashCodeExecutionToolResultBlockParamContent,
2249        ) -> ::std::result::Result<Self, Self::Error> {
2250            match value {
2251                BashCodeExecutionToolResultBlockParamContent::BashCodeExecutionToolResultErrorParam(
2252                    inner,
2253                ) => ::std::result::Result::Ok(inner),
2254                other => ::std::result::Result::Err(other),
2255            }
2256        }
2257    }
2258    impl ::std::convert::From<BashCodeExecutionResultBlockParam>
2259        for BashCodeExecutionToolResultBlockParamContent
2260    {
2261        fn from(value: BashCodeExecutionResultBlockParam) -> Self {
2262            BashCodeExecutionToolResultBlockParamContent::BashCodeExecutionResultBlockParam(value)
2263        }
2264    }
2265    impl ::std::convert::TryFrom<BashCodeExecutionToolResultBlockParamContent>
2266        for BashCodeExecutionResultBlockParam
2267    {
2268        type Error = BashCodeExecutionToolResultBlockParamContent;
2269        /// # Errors
2270        ///
2271        /// Returns the original enum value if it does not match the
2272        /// `#variant_ident` variant.
2273        fn try_from(
2274            value: BashCodeExecutionToolResultBlockParamContent,
2275        ) -> ::std::result::Result<Self, Self::Error> {
2276            match value {
2277                BashCodeExecutionToolResultBlockParamContent::BashCodeExecutionResultBlockParam(
2278                    inner,
2279                ) => ::std::result::Result::Ok(inner),
2280                other => ::std::result::Result::Err(other),
2281            }
2282        }
2283    }
2284    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
2285    #[serde(untagged)]
2286    pub enum BashCodeExecutionToolResultBlockParamContent {
2287        BashCodeExecutionToolResultErrorParam(BashCodeExecutionToolResultErrorParam),
2288        BashCodeExecutionResultBlockParam(BashCodeExecutionResultBlockParam),
2289    }
2290    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
2291    pub enum BashCodeExecutionToolResultBlockParamType {
2292        #[serde(rename = "bash_code_execution_tool_result")]
2293        BashCodeExecutionToolResult,
2294    }
2295    impl ::std::fmt::Display for BashCodeExecutionToolResultBlockParamType {
2296        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
2297            match self {
2298                Self::BashCodeExecutionToolResult => {
2299                    ::std::write!(__f, "bash_code_execution_tool_result")
2300                }
2301            }
2302        }
2303    }
2304    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
2305    pub struct BashCodeExecutionToolResultBlockParam {
2306        pub content: BashCodeExecutionToolResultBlockParamContent,
2307        pub tool_use_id: String,
2308        pub r#type: BashCodeExecutionToolResultBlockParamType,
2309        #[serde(skip_serializing_if = "Option::is_none")]
2310        pub cache_control: Option<CacheControlEphemeral>,
2311    }
2312    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
2313    pub enum TextEditorCodeExecutionToolResultErrorParamErrorCode {
2314        #[serde(rename = "invalid_tool_input")]
2315        InvalidToolInput,
2316        #[serde(rename = "unavailable")]
2317        Unavailable,
2318        #[serde(rename = "too_many_requests")]
2319        TooManyRequests,
2320        #[serde(rename = "execution_time_exceeded")]
2321        ExecutionTimeExceeded,
2322        #[serde(rename = "file_not_found")]
2323        FileNotFound,
2324    }
2325    impl ::std::fmt::Display for TextEditorCodeExecutionToolResultErrorParamErrorCode {
2326        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
2327            match self {
2328                Self::InvalidToolInput => ::std::write!(__f, "invalid_tool_input"),
2329                Self::Unavailable => ::std::write!(__f, "unavailable"),
2330                Self::TooManyRequests => ::std::write!(__f, "too_many_requests"),
2331                Self::ExecutionTimeExceeded => {
2332                    ::std::write!(__f, "execution_time_exceeded")
2333                }
2334                Self::FileNotFound => ::std::write!(__f, "file_not_found"),
2335            }
2336        }
2337    }
2338    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
2339    pub enum TextEditorCodeExecutionToolResultErrorParamType {
2340        #[serde(rename = "text_editor_code_execution_tool_result_error")]
2341        TextEditorCodeExecutionToolResultError,
2342    }
2343    impl ::std::fmt::Display for TextEditorCodeExecutionToolResultErrorParamType {
2344        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
2345            match self {
2346                Self::TextEditorCodeExecutionToolResultError => {
2347                    ::std::write!(__f, "text_editor_code_execution_tool_result_error")
2348                }
2349            }
2350        }
2351    }
2352    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
2353    pub struct TextEditorCodeExecutionToolResultErrorParam {
2354        pub error_code: TextEditorCodeExecutionToolResultErrorParamErrorCode,
2355        pub r#type: TextEditorCodeExecutionToolResultErrorParamType,
2356        #[serde(skip_serializing_if = "Option::is_none")]
2357        pub error_message: Option<String>,
2358    }
2359    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
2360    pub enum TextEditorCodeExecutionViewResultBlockParamFileType {
2361        #[serde(rename = "text")]
2362        Text,
2363        #[serde(rename = "image")]
2364        Image,
2365        #[serde(rename = "pdf")]
2366        Pdf,
2367    }
2368    impl ::std::fmt::Display for TextEditorCodeExecutionViewResultBlockParamFileType {
2369        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
2370            match self {
2371                Self::Text => ::std::write!(__f, "text"),
2372                Self::Image => ::std::write!(__f, "image"),
2373                Self::Pdf => ::std::write!(__f, "pdf"),
2374            }
2375        }
2376    }
2377    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
2378    pub enum TextEditorCodeExecutionViewResultBlockParamType {
2379        #[serde(rename = "text_editor_code_execution_view_result")]
2380        TextEditorCodeExecutionViewResult,
2381    }
2382    impl ::std::fmt::Display for TextEditorCodeExecutionViewResultBlockParamType {
2383        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
2384            match self {
2385                Self::TextEditorCodeExecutionViewResult => {
2386                    ::std::write!(__f, "text_editor_code_execution_view_result")
2387                }
2388            }
2389        }
2390    }
2391    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
2392    pub struct TextEditorCodeExecutionViewResultBlockParam {
2393        pub content: String,
2394        pub file_type: TextEditorCodeExecutionViewResultBlockParamFileType,
2395        pub r#type: TextEditorCodeExecutionViewResultBlockParamType,
2396        #[serde(skip_serializing_if = "Option::is_none")]
2397        pub num_lines: Option<i64>,
2398        #[serde(skip_serializing_if = "Option::is_none")]
2399        pub start_line: Option<i64>,
2400        #[serde(skip_serializing_if = "Option::is_none")]
2401        pub total_lines: Option<i64>,
2402    }
2403    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
2404    pub enum TextEditorCodeExecutionCreateResultBlockParamType {
2405        #[serde(rename = "text_editor_code_execution_create_result")]
2406        TextEditorCodeExecutionCreateResult,
2407    }
2408    impl ::std::fmt::Display for TextEditorCodeExecutionCreateResultBlockParamType {
2409        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
2410            match self {
2411                Self::TextEditorCodeExecutionCreateResult => {
2412                    ::std::write!(__f, "text_editor_code_execution_create_result")
2413                }
2414            }
2415        }
2416    }
2417    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
2418    pub struct TextEditorCodeExecutionCreateResultBlockParam {
2419        pub is_file_update: bool,
2420        pub r#type: TextEditorCodeExecutionCreateResultBlockParamType,
2421    }
2422    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
2423    pub enum TextEditorCodeExecutionStrReplaceResultBlockParamType {
2424        #[serde(rename = "text_editor_code_execution_str_replace_result")]
2425        TextEditorCodeExecutionStrReplaceResult,
2426    }
2427    impl ::std::fmt::Display for TextEditorCodeExecutionStrReplaceResultBlockParamType {
2428        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
2429            match self {
2430                Self::TextEditorCodeExecutionStrReplaceResult => {
2431                    ::std::write!(__f, "text_editor_code_execution_str_replace_result")
2432                }
2433            }
2434        }
2435    }
2436    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
2437    pub struct TextEditorCodeExecutionStrReplaceResultBlockParam {
2438        pub r#type: TextEditorCodeExecutionStrReplaceResultBlockParamType,
2439        #[serde(skip_serializing_if = "Option::is_none")]
2440        pub lines: Option<Vec<String>>,
2441        #[serde(skip_serializing_if = "Option::is_none")]
2442        pub new_lines: Option<i64>,
2443        #[serde(skip_serializing_if = "Option::is_none")]
2444        pub new_start: Option<i64>,
2445        #[serde(skip_serializing_if = "Option::is_none")]
2446        pub old_lines: Option<i64>,
2447        #[serde(skip_serializing_if = "Option::is_none")]
2448        pub old_start: Option<i64>,
2449    }
2450    impl ::std::convert::From<TextEditorCodeExecutionToolResultErrorParam>
2451        for TextEditorCodeExecutionToolResultBlockParamContent
2452    {
2453        fn from(value: TextEditorCodeExecutionToolResultErrorParam) -> Self {
2454            TextEditorCodeExecutionToolResultBlockParamContent::TextEditorCodeExecutionToolResultErrorParam(
2455                value,
2456            )
2457        }
2458    }
2459    impl ::std::convert::TryFrom<TextEditorCodeExecutionToolResultBlockParamContent>
2460        for TextEditorCodeExecutionToolResultErrorParam
2461    {
2462        type Error = TextEditorCodeExecutionToolResultBlockParamContent;
2463        /// # Errors
2464        ///
2465        /// Returns the original enum value if it does not match the
2466        /// `#variant_ident` variant.
2467        fn try_from(
2468            value: TextEditorCodeExecutionToolResultBlockParamContent,
2469        ) -> ::std::result::Result<Self, Self::Error> {
2470            match value {
2471                TextEditorCodeExecutionToolResultBlockParamContent::TextEditorCodeExecutionToolResultErrorParam(
2472                    inner,
2473                ) => ::std::result::Result::Ok(inner),
2474                other => ::std::result::Result::Err(other),
2475            }
2476        }
2477    }
2478    impl ::std::convert::From<TextEditorCodeExecutionViewResultBlockParam>
2479        for TextEditorCodeExecutionToolResultBlockParamContent
2480    {
2481        fn from(value: TextEditorCodeExecutionViewResultBlockParam) -> Self {
2482            TextEditorCodeExecutionToolResultBlockParamContent::TextEditorCodeExecutionViewResultBlockParam(
2483                value,
2484            )
2485        }
2486    }
2487    impl ::std::convert::TryFrom<TextEditorCodeExecutionToolResultBlockParamContent>
2488        for TextEditorCodeExecutionViewResultBlockParam
2489    {
2490        type Error = TextEditorCodeExecutionToolResultBlockParamContent;
2491        /// # Errors
2492        ///
2493        /// Returns the original enum value if it does not match the
2494        /// `#variant_ident` variant.
2495        fn try_from(
2496            value: TextEditorCodeExecutionToolResultBlockParamContent,
2497        ) -> ::std::result::Result<Self, Self::Error> {
2498            match value {
2499                TextEditorCodeExecutionToolResultBlockParamContent::TextEditorCodeExecutionViewResultBlockParam(
2500                    inner,
2501                ) => ::std::result::Result::Ok(inner),
2502                other => ::std::result::Result::Err(other),
2503            }
2504        }
2505    }
2506    impl ::std::convert::From<TextEditorCodeExecutionCreateResultBlockParam>
2507        for TextEditorCodeExecutionToolResultBlockParamContent
2508    {
2509        fn from(value: TextEditorCodeExecutionCreateResultBlockParam) -> Self {
2510            TextEditorCodeExecutionToolResultBlockParamContent::TextEditorCodeExecutionCreateResultBlockParam(
2511                value,
2512            )
2513        }
2514    }
2515    impl ::std::convert::TryFrom<TextEditorCodeExecutionToolResultBlockParamContent>
2516        for TextEditorCodeExecutionCreateResultBlockParam
2517    {
2518        type Error = TextEditorCodeExecutionToolResultBlockParamContent;
2519        /// # Errors
2520        ///
2521        /// Returns the original enum value if it does not match the
2522        /// `#variant_ident` variant.
2523        fn try_from(
2524            value: TextEditorCodeExecutionToolResultBlockParamContent,
2525        ) -> ::std::result::Result<Self, Self::Error> {
2526            match value {
2527                TextEditorCodeExecutionToolResultBlockParamContent::TextEditorCodeExecutionCreateResultBlockParam(
2528                    inner,
2529                ) => ::std::result::Result::Ok(inner),
2530                other => ::std::result::Result::Err(other),
2531            }
2532        }
2533    }
2534    impl ::std::convert::From<TextEditorCodeExecutionStrReplaceResultBlockParam>
2535        for TextEditorCodeExecutionToolResultBlockParamContent
2536    {
2537        fn from(value: TextEditorCodeExecutionStrReplaceResultBlockParam) -> Self {
2538            TextEditorCodeExecutionToolResultBlockParamContent::TextEditorCodeExecutionStrReplaceResultBlockParam(
2539                value,
2540            )
2541        }
2542    }
2543    impl ::std::convert::TryFrom<TextEditorCodeExecutionToolResultBlockParamContent>
2544        for TextEditorCodeExecutionStrReplaceResultBlockParam
2545    {
2546        type Error = TextEditorCodeExecutionToolResultBlockParamContent;
2547        /// # Errors
2548        ///
2549        /// Returns the original enum value if it does not match the
2550        /// `#variant_ident` variant.
2551        fn try_from(
2552            value: TextEditorCodeExecutionToolResultBlockParamContent,
2553        ) -> ::std::result::Result<Self, Self::Error> {
2554            match value {
2555                TextEditorCodeExecutionToolResultBlockParamContent::TextEditorCodeExecutionStrReplaceResultBlockParam(
2556                    inner,
2557                ) => ::std::result::Result::Ok(inner),
2558                other => ::std::result::Result::Err(other),
2559            }
2560        }
2561    }
2562    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
2563    #[serde(untagged)]
2564    pub enum TextEditorCodeExecutionToolResultBlockParamContent {
2565        TextEditorCodeExecutionToolResultErrorParam(TextEditorCodeExecutionToolResultErrorParam),
2566        TextEditorCodeExecutionViewResultBlockParam(TextEditorCodeExecutionViewResultBlockParam),
2567        TextEditorCodeExecutionCreateResultBlockParam(
2568            TextEditorCodeExecutionCreateResultBlockParam,
2569        ),
2570        TextEditorCodeExecutionStrReplaceResultBlockParam(
2571            TextEditorCodeExecutionStrReplaceResultBlockParam,
2572        ),
2573    }
2574    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
2575    pub enum TextEditorCodeExecutionToolResultBlockParamType {
2576        #[serde(rename = "text_editor_code_execution_tool_result")]
2577        TextEditorCodeExecutionToolResult,
2578    }
2579    impl ::std::fmt::Display for TextEditorCodeExecutionToolResultBlockParamType {
2580        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
2581            match self {
2582                Self::TextEditorCodeExecutionToolResult => {
2583                    ::std::write!(__f, "text_editor_code_execution_tool_result")
2584                }
2585            }
2586        }
2587    }
2588    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
2589    pub struct TextEditorCodeExecutionToolResultBlockParam {
2590        pub content: TextEditorCodeExecutionToolResultBlockParamContent,
2591        pub tool_use_id: String,
2592        pub r#type: TextEditorCodeExecutionToolResultBlockParamType,
2593        #[serde(skip_serializing_if = "Option::is_none")]
2594        pub cache_control: Option<CacheControlEphemeral>,
2595    }
2596    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
2597    pub enum ToolSearchToolResultErrorParamErrorCode {
2598        #[serde(rename = "invalid_tool_input")]
2599        InvalidToolInput,
2600        #[serde(rename = "unavailable")]
2601        Unavailable,
2602        #[serde(rename = "too_many_requests")]
2603        TooManyRequests,
2604        #[serde(rename = "execution_time_exceeded")]
2605        ExecutionTimeExceeded,
2606    }
2607    impl ::std::fmt::Display for ToolSearchToolResultErrorParamErrorCode {
2608        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
2609            match self {
2610                Self::InvalidToolInput => ::std::write!(__f, "invalid_tool_input"),
2611                Self::Unavailable => ::std::write!(__f, "unavailable"),
2612                Self::TooManyRequests => ::std::write!(__f, "too_many_requests"),
2613                Self::ExecutionTimeExceeded => {
2614                    ::std::write!(__f, "execution_time_exceeded")
2615                }
2616            }
2617        }
2618    }
2619    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
2620    pub enum ToolSearchToolResultErrorParamType {
2621        #[serde(rename = "tool_search_tool_result_error")]
2622        ToolSearchToolResultError,
2623    }
2624    impl ::std::fmt::Display for ToolSearchToolResultErrorParamType {
2625        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
2626            match self {
2627                Self::ToolSearchToolResultError => {
2628                    ::std::write!(__f, "tool_search_tool_result_error")
2629                }
2630            }
2631        }
2632    }
2633    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
2634    pub struct ToolSearchToolResultErrorParam {
2635        pub error_code: ToolSearchToolResultErrorParamErrorCode,
2636        pub r#type: ToolSearchToolResultErrorParamType,
2637    }
2638    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
2639    pub enum ToolSearchToolSearchResultBlockParamType {
2640        #[serde(rename = "tool_search_tool_search_result")]
2641        ToolSearchToolSearchResult,
2642    }
2643    impl ::std::fmt::Display for ToolSearchToolSearchResultBlockParamType {
2644        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
2645            match self {
2646                Self::ToolSearchToolSearchResult => {
2647                    ::std::write!(__f, "tool_search_tool_search_result")
2648                }
2649            }
2650        }
2651    }
2652    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
2653    pub struct ToolSearchToolSearchResultBlockParam {
2654        pub tool_references: Vec<ToolReferenceBlockParam>,
2655        pub r#type: ToolSearchToolSearchResultBlockParamType,
2656    }
2657    impl ::std::convert::From<ToolSearchToolResultErrorParam>
2658        for ToolSearchToolResultBlockParamContent
2659    {
2660        fn from(value: ToolSearchToolResultErrorParam) -> Self {
2661            ToolSearchToolResultBlockParamContent::ToolSearchToolResultErrorParam(value)
2662        }
2663    }
2664    impl ::std::convert::TryFrom<ToolSearchToolResultBlockParamContent>
2665        for ToolSearchToolResultErrorParam
2666    {
2667        type Error = ToolSearchToolResultBlockParamContent;
2668        /// # Errors
2669        ///
2670        /// Returns the original enum value if it does not match the
2671        /// `#variant_ident` variant.
2672        fn try_from(
2673            value: ToolSearchToolResultBlockParamContent,
2674        ) -> ::std::result::Result<Self, Self::Error> {
2675            match value {
2676                ToolSearchToolResultBlockParamContent::ToolSearchToolResultErrorParam(inner) => {
2677                    ::std::result::Result::Ok(inner)
2678                }
2679                other => ::std::result::Result::Err(other),
2680            }
2681        }
2682    }
2683    impl ::std::convert::From<ToolSearchToolSearchResultBlockParam>
2684        for ToolSearchToolResultBlockParamContent
2685    {
2686        fn from(value: ToolSearchToolSearchResultBlockParam) -> Self {
2687            ToolSearchToolResultBlockParamContent::ToolSearchToolSearchResultBlockParam(value)
2688        }
2689    }
2690    impl ::std::convert::TryFrom<ToolSearchToolResultBlockParamContent>
2691        for ToolSearchToolSearchResultBlockParam
2692    {
2693        type Error = ToolSearchToolResultBlockParamContent;
2694        /// # Errors
2695        ///
2696        /// Returns the original enum value if it does not match the
2697        /// `#variant_ident` variant.
2698        fn try_from(
2699            value: ToolSearchToolResultBlockParamContent,
2700        ) -> ::std::result::Result<Self, Self::Error> {
2701            match value {
2702                ToolSearchToolResultBlockParamContent::ToolSearchToolSearchResultBlockParam(
2703                    inner,
2704                ) => ::std::result::Result::Ok(inner),
2705                other => ::std::result::Result::Err(other),
2706            }
2707        }
2708    }
2709    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
2710    #[serde(untagged)]
2711    pub enum ToolSearchToolResultBlockParamContent {
2712        ToolSearchToolResultErrorParam(ToolSearchToolResultErrorParam),
2713        ToolSearchToolSearchResultBlockParam(ToolSearchToolSearchResultBlockParam),
2714    }
2715    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
2716    pub enum ToolSearchToolResultBlockParamType {
2717        #[serde(rename = "tool_search_tool_result")]
2718        ToolSearchToolResult,
2719    }
2720    impl ::std::fmt::Display for ToolSearchToolResultBlockParamType {
2721        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
2722            match self {
2723                Self::ToolSearchToolResult => {
2724                    ::std::write!(__f, "tool_search_tool_result")
2725                }
2726            }
2727        }
2728    }
2729    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
2730    pub struct ToolSearchToolResultBlockParam {
2731        pub content: ToolSearchToolResultBlockParamContent,
2732        pub tool_use_id: String,
2733        pub r#type: ToolSearchToolResultBlockParamType,
2734        #[serde(skip_serializing_if = "Option::is_none")]
2735        pub cache_control: Option<CacheControlEphemeral>,
2736    }
2737    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
2738    pub enum ContainerUploadBlockParamType {
2739        #[serde(rename = "container_upload")]
2740        ContainerUpload,
2741    }
2742    impl ::std::fmt::Display for ContainerUploadBlockParamType {
2743        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
2744            match self {
2745                Self::ContainerUpload => ::std::write!(__f, "container_upload"),
2746            }
2747        }
2748    }
2749    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
2750    /// 上传到容器的文件占位 block。
2751    pub struct ContainerUploadBlockParam {
2752        pub file_id: String,
2753        pub r#type: ContainerUploadBlockParamType,
2754        #[serde(skip_serializing_if = "Option::is_none")]
2755        pub cache_control: Option<CacheControlEphemeral>,
2756    }
2757    impl ::std::convert::From<TextBlockParam> for ContentBlockParam {
2758        fn from(value: TextBlockParam) -> Self {
2759            ContentBlockParam::TextBlockParam(value)
2760        }
2761    }
2762    impl ::std::convert::TryFrom<ContentBlockParam> for TextBlockParam {
2763        type Error = ContentBlockParam;
2764        /// # Errors
2765        ///
2766        /// Returns the original enum value if it does not match the
2767        /// `#variant_ident` variant.
2768        fn try_from(value: ContentBlockParam) -> ::std::result::Result<Self, Self::Error> {
2769            match value {
2770                ContentBlockParam::TextBlockParam(inner) => ::std::result::Result::Ok(inner),
2771                other => ::std::result::Result::Err(other),
2772            }
2773        }
2774    }
2775    impl ::std::convert::From<ImageBlockParam> for ContentBlockParam {
2776        fn from(value: ImageBlockParam) -> Self {
2777            ContentBlockParam::ImageBlockParam(value)
2778        }
2779    }
2780    impl ::std::convert::TryFrom<ContentBlockParam> for ImageBlockParam {
2781        type Error = ContentBlockParam;
2782        /// # Errors
2783        ///
2784        /// Returns the original enum value if it does not match the
2785        /// `#variant_ident` variant.
2786        fn try_from(value: ContentBlockParam) -> ::std::result::Result<Self, Self::Error> {
2787            match value {
2788                ContentBlockParam::ImageBlockParam(inner) => ::std::result::Result::Ok(inner),
2789                other => ::std::result::Result::Err(other),
2790            }
2791        }
2792    }
2793    impl ::std::convert::From<DocumentBlockParam> for ContentBlockParam {
2794        fn from(value: DocumentBlockParam) -> Self {
2795            ContentBlockParam::DocumentBlockParam(value)
2796        }
2797    }
2798    impl ::std::convert::TryFrom<ContentBlockParam> for DocumentBlockParam {
2799        type Error = ContentBlockParam;
2800        /// # Errors
2801        ///
2802        /// Returns the original enum value if it does not match the
2803        /// `#variant_ident` variant.
2804        fn try_from(value: ContentBlockParam) -> ::std::result::Result<Self, Self::Error> {
2805            match value {
2806                ContentBlockParam::DocumentBlockParam(inner) => ::std::result::Result::Ok(inner),
2807                other => ::std::result::Result::Err(other),
2808            }
2809        }
2810    }
2811    impl ::std::convert::From<SearchResultBlockParam> for ContentBlockParam {
2812        fn from(value: SearchResultBlockParam) -> Self {
2813            ContentBlockParam::SearchResultBlockParam(value)
2814        }
2815    }
2816    impl ::std::convert::TryFrom<ContentBlockParam> for SearchResultBlockParam {
2817        type Error = ContentBlockParam;
2818        /// # Errors
2819        ///
2820        /// Returns the original enum value if it does not match the
2821        /// `#variant_ident` variant.
2822        fn try_from(value: ContentBlockParam) -> ::std::result::Result<Self, Self::Error> {
2823            match value {
2824                ContentBlockParam::SearchResultBlockParam(inner) => {
2825                    ::std::result::Result::Ok(inner)
2826                }
2827                other => ::std::result::Result::Err(other),
2828            }
2829        }
2830    }
2831    impl ::std::convert::From<ThinkingBlockParam> for ContentBlockParam {
2832        fn from(value: ThinkingBlockParam) -> Self {
2833            ContentBlockParam::ThinkingBlockParam(value)
2834        }
2835    }
2836    impl ::std::convert::TryFrom<ContentBlockParam> for ThinkingBlockParam {
2837        type Error = ContentBlockParam;
2838        /// # Errors
2839        ///
2840        /// Returns the original enum value if it does not match the
2841        /// `#variant_ident` variant.
2842        fn try_from(value: ContentBlockParam) -> ::std::result::Result<Self, Self::Error> {
2843            match value {
2844                ContentBlockParam::ThinkingBlockParam(inner) => ::std::result::Result::Ok(inner),
2845                other => ::std::result::Result::Err(other),
2846            }
2847        }
2848    }
2849    impl ::std::convert::From<RedactedThinkingBlockParam> for ContentBlockParam {
2850        fn from(value: RedactedThinkingBlockParam) -> Self {
2851            ContentBlockParam::RedactedThinkingBlockParam(value)
2852        }
2853    }
2854    impl ::std::convert::TryFrom<ContentBlockParam> for RedactedThinkingBlockParam {
2855        type Error = ContentBlockParam;
2856        /// # Errors
2857        ///
2858        /// Returns the original enum value if it does not match the
2859        /// `#variant_ident` variant.
2860        fn try_from(value: ContentBlockParam) -> ::std::result::Result<Self, Self::Error> {
2861            match value {
2862                ContentBlockParam::RedactedThinkingBlockParam(inner) => {
2863                    ::std::result::Result::Ok(inner)
2864                }
2865                other => ::std::result::Result::Err(other),
2866            }
2867        }
2868    }
2869    impl ::std::convert::From<ToolUseBlockParam> for ContentBlockParam {
2870        fn from(value: ToolUseBlockParam) -> Self {
2871            ContentBlockParam::ToolUseBlockParam(value)
2872        }
2873    }
2874    impl ::std::convert::TryFrom<ContentBlockParam> for ToolUseBlockParam {
2875        type Error = ContentBlockParam;
2876        /// # Errors
2877        ///
2878        /// Returns the original enum value if it does not match the
2879        /// `#variant_ident` variant.
2880        fn try_from(value: ContentBlockParam) -> ::std::result::Result<Self, Self::Error> {
2881            match value {
2882                ContentBlockParam::ToolUseBlockParam(inner) => ::std::result::Result::Ok(inner),
2883                other => ::std::result::Result::Err(other),
2884            }
2885        }
2886    }
2887    impl ::std::convert::From<ToolResultBlockParam> for ContentBlockParam {
2888        fn from(value: ToolResultBlockParam) -> Self {
2889            ContentBlockParam::ToolResultBlockParam(value)
2890        }
2891    }
2892    impl ::std::convert::TryFrom<ContentBlockParam> for ToolResultBlockParam {
2893        type Error = ContentBlockParam;
2894        /// # Errors
2895        ///
2896        /// Returns the original enum value if it does not match the
2897        /// `#variant_ident` variant.
2898        fn try_from(value: ContentBlockParam) -> ::std::result::Result<Self, Self::Error> {
2899            match value {
2900                ContentBlockParam::ToolResultBlockParam(inner) => ::std::result::Result::Ok(inner),
2901                other => ::std::result::Result::Err(other),
2902            }
2903        }
2904    }
2905    impl ::std::convert::From<ServerToolUseBlockParam> for ContentBlockParam {
2906        fn from(value: ServerToolUseBlockParam) -> Self {
2907            ContentBlockParam::ServerToolUseBlockParam(value)
2908        }
2909    }
2910    impl ::std::convert::TryFrom<ContentBlockParam> for ServerToolUseBlockParam {
2911        type Error = ContentBlockParam;
2912        /// # Errors
2913        ///
2914        /// Returns the original enum value if it does not match the
2915        /// `#variant_ident` variant.
2916        fn try_from(value: ContentBlockParam) -> ::std::result::Result<Self, Self::Error> {
2917            match value {
2918                ContentBlockParam::ServerToolUseBlockParam(inner) => {
2919                    ::std::result::Result::Ok(inner)
2920                }
2921                other => ::std::result::Result::Err(other),
2922            }
2923        }
2924    }
2925    impl ::std::convert::From<WebSearchToolResultBlockParam> for ContentBlockParam {
2926        fn from(value: WebSearchToolResultBlockParam) -> Self {
2927            ContentBlockParam::WebSearchToolResultBlockParam(value)
2928        }
2929    }
2930    impl ::std::convert::TryFrom<ContentBlockParam> for WebSearchToolResultBlockParam {
2931        type Error = ContentBlockParam;
2932        /// # Errors
2933        ///
2934        /// Returns the original enum value if it does not match the
2935        /// `#variant_ident` variant.
2936        fn try_from(value: ContentBlockParam) -> ::std::result::Result<Self, Self::Error> {
2937            match value {
2938                ContentBlockParam::WebSearchToolResultBlockParam(inner) => {
2939                    ::std::result::Result::Ok(inner)
2940                }
2941                other => ::std::result::Result::Err(other),
2942            }
2943        }
2944    }
2945    impl ::std::convert::From<WebFetchToolResultBlockParam> for ContentBlockParam {
2946        fn from(value: WebFetchToolResultBlockParam) -> Self {
2947            ContentBlockParam::WebFetchToolResultBlockParam(value)
2948        }
2949    }
2950    impl ::std::convert::TryFrom<ContentBlockParam> for WebFetchToolResultBlockParam {
2951        type Error = ContentBlockParam;
2952        /// # Errors
2953        ///
2954        /// Returns the original enum value if it does not match the
2955        /// `#variant_ident` variant.
2956        fn try_from(value: ContentBlockParam) -> ::std::result::Result<Self, Self::Error> {
2957            match value {
2958                ContentBlockParam::WebFetchToolResultBlockParam(inner) => {
2959                    ::std::result::Result::Ok(inner)
2960                }
2961                other => ::std::result::Result::Err(other),
2962            }
2963        }
2964    }
2965    impl ::std::convert::From<CodeExecutionToolResultBlockParam> for ContentBlockParam {
2966        fn from(value: CodeExecutionToolResultBlockParam) -> Self {
2967            ContentBlockParam::CodeExecutionToolResultBlockParam(value)
2968        }
2969    }
2970    impl ::std::convert::TryFrom<ContentBlockParam> for CodeExecutionToolResultBlockParam {
2971        type Error = ContentBlockParam;
2972        /// # Errors
2973        ///
2974        /// Returns the original enum value if it does not match the
2975        /// `#variant_ident` variant.
2976        fn try_from(value: ContentBlockParam) -> ::std::result::Result<Self, Self::Error> {
2977            match value {
2978                ContentBlockParam::CodeExecutionToolResultBlockParam(inner) => {
2979                    ::std::result::Result::Ok(inner)
2980                }
2981                other => ::std::result::Result::Err(other),
2982            }
2983        }
2984    }
2985    impl ::std::convert::From<BashCodeExecutionToolResultBlockParam> for ContentBlockParam {
2986        fn from(value: BashCodeExecutionToolResultBlockParam) -> Self {
2987            ContentBlockParam::BashCodeExecutionToolResultBlockParam(value)
2988        }
2989    }
2990    impl ::std::convert::TryFrom<ContentBlockParam> for BashCodeExecutionToolResultBlockParam {
2991        type Error = ContentBlockParam;
2992        /// # Errors
2993        ///
2994        /// Returns the original enum value if it does not match the
2995        /// `#variant_ident` variant.
2996        fn try_from(value: ContentBlockParam) -> ::std::result::Result<Self, Self::Error> {
2997            match value {
2998                ContentBlockParam::BashCodeExecutionToolResultBlockParam(inner) => {
2999                    ::std::result::Result::Ok(inner)
3000                }
3001                other => ::std::result::Result::Err(other),
3002            }
3003        }
3004    }
3005    impl ::std::convert::From<TextEditorCodeExecutionToolResultBlockParam> for ContentBlockParam {
3006        fn from(value: TextEditorCodeExecutionToolResultBlockParam) -> Self {
3007            ContentBlockParam::TextEditorCodeExecutionToolResultBlockParam(value)
3008        }
3009    }
3010    impl ::std::convert::TryFrom<ContentBlockParam> for TextEditorCodeExecutionToolResultBlockParam {
3011        type Error = ContentBlockParam;
3012        /// # Errors
3013        ///
3014        /// Returns the original enum value if it does not match the
3015        /// `#variant_ident` variant.
3016        fn try_from(value: ContentBlockParam) -> ::std::result::Result<Self, Self::Error> {
3017            match value {
3018                ContentBlockParam::TextEditorCodeExecutionToolResultBlockParam(inner) => {
3019                    ::std::result::Result::Ok(inner)
3020                }
3021                other => ::std::result::Result::Err(other),
3022            }
3023        }
3024    }
3025    impl ::std::convert::From<ToolSearchToolResultBlockParam> for ContentBlockParam {
3026        fn from(value: ToolSearchToolResultBlockParam) -> Self {
3027            ContentBlockParam::ToolSearchToolResultBlockParam(value)
3028        }
3029    }
3030    impl ::std::convert::TryFrom<ContentBlockParam> for ToolSearchToolResultBlockParam {
3031        type Error = ContentBlockParam;
3032        /// # Errors
3033        ///
3034        /// Returns the original enum value if it does not match the
3035        /// `#variant_ident` variant.
3036        fn try_from(value: ContentBlockParam) -> ::std::result::Result<Self, Self::Error> {
3037            match value {
3038                ContentBlockParam::ToolSearchToolResultBlockParam(inner) => {
3039                    ::std::result::Result::Ok(inner)
3040                }
3041                other => ::std::result::Result::Err(other),
3042            }
3043        }
3044    }
3045    impl ::std::convert::From<ContainerUploadBlockParam> for ContentBlockParam {
3046        fn from(value: ContainerUploadBlockParam) -> Self {
3047            ContentBlockParam::ContainerUploadBlockParam(value)
3048        }
3049    }
3050    impl ::std::convert::TryFrom<ContentBlockParam> for ContainerUploadBlockParam {
3051        type Error = ContentBlockParam;
3052        /// # Errors
3053        ///
3054        /// Returns the original enum value if it does not match the
3055        /// `#variant_ident` variant.
3056        fn try_from(value: ContentBlockParam) -> ::std::result::Result<Self, Self::Error> {
3057            match value {
3058                ContentBlockParam::ContainerUploadBlockParam(inner) => {
3059                    ::std::result::Result::Ok(inner)
3060                }
3061                other => ::std::result::Result::Err(other),
3062            }
3063        }
3064    }
3065    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3066    #[serde(untagged)]
3067    pub enum ContentBlockParam {
3068        TextBlockParam(TextBlockParam),
3069        ImageBlockParam(ImageBlockParam),
3070        DocumentBlockParam(DocumentBlockParam),
3071        SearchResultBlockParam(SearchResultBlockParam),
3072        ThinkingBlockParam(ThinkingBlockParam),
3073        RedactedThinkingBlockParam(RedactedThinkingBlockParam),
3074        ToolUseBlockParam(ToolUseBlockParam),
3075        ToolResultBlockParam(ToolResultBlockParam),
3076        ServerToolUseBlockParam(ServerToolUseBlockParam),
3077        WebSearchToolResultBlockParam(WebSearchToolResultBlockParam),
3078        WebFetchToolResultBlockParam(WebFetchToolResultBlockParam),
3079        CodeExecutionToolResultBlockParam(CodeExecutionToolResultBlockParam),
3080        BashCodeExecutionToolResultBlockParam(BashCodeExecutionToolResultBlockParam),
3081        TextEditorCodeExecutionToolResultBlockParam(TextEditorCodeExecutionToolResultBlockParam),
3082        ToolSearchToolResultBlockParam(ToolSearchToolResultBlockParam),
3083        ContainerUploadBlockParam(ContainerUploadBlockParam),
3084    }
3085    impl ::std::convert::From<String> for MessageParamContent {
3086        fn from(value: String) -> Self {
3087            MessageParamContent::MessageParamContentVariant0(value)
3088        }
3089    }
3090    impl ::std::convert::TryFrom<MessageParamContent> for String {
3091        type Error = MessageParamContent;
3092        /// # Errors
3093        ///
3094        /// Returns the original enum value if it does not match the
3095        /// `#variant_ident` variant.
3096        fn try_from(value: MessageParamContent) -> ::std::result::Result<Self, Self::Error> {
3097            match value {
3098                MessageParamContent::MessageParamContentVariant0(inner) => {
3099                    ::std::result::Result::Ok(inner)
3100                }
3101                other => ::std::result::Result::Err(other),
3102            }
3103        }
3104    }
3105    impl ::std::convert::From<Vec<ContentBlockParam>> for MessageParamContent {
3106        fn from(value: Vec<ContentBlockParam>) -> Self {
3107            MessageParamContent::MessageParamContentVariant1(value)
3108        }
3109    }
3110    impl ::std::convert::TryFrom<MessageParamContent> for Vec<ContentBlockParam> {
3111        type Error = MessageParamContent;
3112        /// # Errors
3113        ///
3114        /// Returns the original enum value if it does not match the
3115        /// `#variant_ident` variant.
3116        fn try_from(value: MessageParamContent) -> ::std::result::Result<Self, Self::Error> {
3117            match value {
3118                MessageParamContent::MessageParamContentVariant1(inner) => {
3119                    ::std::result::Result::Ok(inner)
3120                }
3121                other => ::std::result::Result::Err(other),
3122            }
3123        }
3124    }
3125    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3126    #[serde(untagged)]
3127    pub enum MessageParamContent {
3128        MessageParamContentVariant0(String),
3129        MessageParamContentVariant1(Vec<ContentBlockParam>),
3130    }
3131    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
3132    pub enum MessageParamRole {
3133        #[serde(rename = "user")]
3134        User,
3135        #[serde(rename = "assistant")]
3136        Assistant,
3137    }
3138    impl ::std::fmt::Display for MessageParamRole {
3139        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
3140            match self {
3141                Self::User => ::std::write!(__f, "user"),
3142                Self::Assistant => ::std::write!(__f, "assistant"),
3143            }
3144        }
3145    }
3146    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3147    pub struct MessageParam {
3148        pub role: MessageParamRole,
3149        pub content: MessageParamContent,
3150    }
3151    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3152    pub struct Metadata {
3153        #[serde(skip_serializing_if = "Option::is_none")]
3154        /// 用户外部标识(uuid / hash),不要塞 PII。
3155        pub user_id: Option<String>,
3156    }
3157    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
3158    pub enum JsonOutputFormatType {
3159        #[serde(rename = "json_schema")]
3160        JsonSchema,
3161    }
3162    impl ::std::fmt::Display for JsonOutputFormatType {
3163        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
3164            match self {
3165                Self::JsonSchema => ::std::write!(__f, "json_schema"),
3166            }
3167        }
3168    }
3169    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3170    pub struct JsonOutputFormat {
3171        /// 输出格式的 JSON schema。
3172        pub schema: ::std::collections::BTreeMap<String, ::serde_json::Value>,
3173        pub r#type: JsonOutputFormatType,
3174    }
3175    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
3176    pub enum OutputConfigEffort {
3177        #[serde(rename = "low")]
3178        Low,
3179        #[serde(rename = "medium")]
3180        Medium,
3181        #[serde(rename = "high")]
3182        High,
3183        #[serde(rename = "xhigh")]
3184        Xhigh,
3185        #[serde(rename = "max")]
3186        Max,
3187    }
3188    impl ::std::fmt::Display for OutputConfigEffort {
3189        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
3190            match self {
3191                Self::Low => ::std::write!(__f, "low"),
3192                Self::Medium => ::std::write!(__f, "medium"),
3193                Self::High => ::std::write!(__f, "high"),
3194                Self::Xhigh => ::std::write!(__f, "xhigh"),
3195                Self::Max => ::std::write!(__f, "max"),
3196            }
3197        }
3198    }
3199    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3200    pub struct OutputConfig {
3201        #[serde(skip_serializing_if = "Option::is_none")]
3202        pub effort: Option<OutputConfigEffort>,
3203        #[serde(skip_serializing_if = "Option::is_none")]
3204        pub format: Option<JsonOutputFormat>,
3205    }
3206    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
3207    pub enum ThinkingConfigEnabledType {
3208        #[serde(rename = "enabled")]
3209        Enabled,
3210    }
3211    impl ::std::fmt::Display for ThinkingConfigEnabledType {
3212        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
3213            match self {
3214                Self::Enabled => ::std::write!(__f, "enabled"),
3215            }
3216        }
3217    }
3218    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
3219    pub enum ThinkingConfigEnabledDisplay {
3220        #[serde(rename = "summarized")]
3221        Summarized,
3222        #[serde(rename = "omitted")]
3223        Omitted,
3224    }
3225    impl ::std::fmt::Display for ThinkingConfigEnabledDisplay {
3226        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
3227            match self {
3228                Self::Summarized => ::std::write!(__f, "summarized"),
3229                Self::Omitted => ::std::write!(__f, "omitted"),
3230            }
3231        }
3232    }
3233    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3234    pub struct ThinkingConfigEnabled {
3235        /// 必须 ≥1024 且 < max_tokens。
3236        pub budget_tokens: i64,
3237        pub r#type: ThinkingConfigEnabledType,
3238        #[serde(skip_serializing_if = "Option::is_none")]
3239        pub display: Option<ThinkingConfigEnabledDisplay>,
3240    }
3241    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
3242    pub enum ThinkingConfigDisabledType {
3243        #[serde(rename = "disabled")]
3244        Disabled,
3245    }
3246    impl ::std::fmt::Display for ThinkingConfigDisabledType {
3247        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
3248            match self {
3249                Self::Disabled => ::std::write!(__f, "disabled"),
3250            }
3251        }
3252    }
3253    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3254    pub struct ThinkingConfigDisabled {
3255        pub r#type: ThinkingConfigDisabledType,
3256    }
3257    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
3258    pub enum ThinkingConfigAdaptiveType {
3259        #[serde(rename = "adaptive")]
3260        Adaptive,
3261    }
3262    impl ::std::fmt::Display for ThinkingConfigAdaptiveType {
3263        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
3264            match self {
3265                Self::Adaptive => ::std::write!(__f, "adaptive"),
3266            }
3267        }
3268    }
3269    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
3270    pub enum ThinkingConfigAdaptiveDisplay {
3271        #[serde(rename = "summarized")]
3272        Summarized,
3273        #[serde(rename = "omitted")]
3274        Omitted,
3275    }
3276    impl ::std::fmt::Display for ThinkingConfigAdaptiveDisplay {
3277        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
3278            match self {
3279                Self::Summarized => ::std::write!(__f, "summarized"),
3280                Self::Omitted => ::std::write!(__f, "omitted"),
3281            }
3282        }
3283    }
3284    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3285    pub struct ThinkingConfigAdaptive {
3286        pub r#type: ThinkingConfigAdaptiveType,
3287        #[serde(skip_serializing_if = "Option::is_none")]
3288        pub display: Option<ThinkingConfigAdaptiveDisplay>,
3289    }
3290    impl ::std::convert::From<ThinkingConfigEnabled> for ThinkingConfigParam {
3291        fn from(value: ThinkingConfigEnabled) -> Self {
3292            ThinkingConfigParam::ThinkingConfigEnabled(value)
3293        }
3294    }
3295    impl ::std::convert::TryFrom<ThinkingConfigParam> for ThinkingConfigEnabled {
3296        type Error = ThinkingConfigParam;
3297        /// # Errors
3298        ///
3299        /// Returns the original enum value if it does not match the
3300        /// `#variant_ident` variant.
3301        fn try_from(value: ThinkingConfigParam) -> ::std::result::Result<Self, Self::Error> {
3302            match value {
3303                ThinkingConfigParam::ThinkingConfigEnabled(inner) => {
3304                    ::std::result::Result::Ok(inner)
3305                }
3306                other => ::std::result::Result::Err(other),
3307            }
3308        }
3309    }
3310    impl ::std::convert::From<ThinkingConfigDisabled> for ThinkingConfigParam {
3311        fn from(value: ThinkingConfigDisabled) -> Self {
3312            ThinkingConfigParam::ThinkingConfigDisabled(value)
3313        }
3314    }
3315    impl ::std::convert::TryFrom<ThinkingConfigParam> for ThinkingConfigDisabled {
3316        type Error = ThinkingConfigParam;
3317        /// # Errors
3318        ///
3319        /// Returns the original enum value if it does not match the
3320        /// `#variant_ident` variant.
3321        fn try_from(value: ThinkingConfigParam) -> ::std::result::Result<Self, Self::Error> {
3322            match value {
3323                ThinkingConfigParam::ThinkingConfigDisabled(inner) => {
3324                    ::std::result::Result::Ok(inner)
3325                }
3326                other => ::std::result::Result::Err(other),
3327            }
3328        }
3329    }
3330    impl ::std::convert::From<ThinkingConfigAdaptive> for ThinkingConfigParam {
3331        fn from(value: ThinkingConfigAdaptive) -> Self {
3332            ThinkingConfigParam::ThinkingConfigAdaptive(value)
3333        }
3334    }
3335    impl ::std::convert::TryFrom<ThinkingConfigParam> for ThinkingConfigAdaptive {
3336        type Error = ThinkingConfigParam;
3337        /// # Errors
3338        ///
3339        /// Returns the original enum value if it does not match the
3340        /// `#variant_ident` variant.
3341        fn try_from(value: ThinkingConfigParam) -> ::std::result::Result<Self, Self::Error> {
3342            match value {
3343                ThinkingConfigParam::ThinkingConfigAdaptive(inner) => {
3344                    ::std::result::Result::Ok(inner)
3345                }
3346                other => ::std::result::Result::Err(other),
3347            }
3348        }
3349    }
3350    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3351    #[serde(untagged)]
3352    pub enum ThinkingConfigParam {
3353        ThinkingConfigEnabled(ThinkingConfigEnabled),
3354        ThinkingConfigDisabled(ThinkingConfigDisabled),
3355        ThinkingConfigAdaptive(ThinkingConfigAdaptive),
3356    }
3357    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
3358    pub enum ToolChoiceAutoType {
3359        #[serde(rename = "auto")]
3360        Auto,
3361    }
3362    impl ::std::fmt::Display for ToolChoiceAutoType {
3363        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
3364            match self {
3365                Self::Auto => ::std::write!(__f, "auto"),
3366            }
3367        }
3368    }
3369    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3370    pub struct ToolChoiceAuto {
3371        pub r#type: ToolChoiceAutoType,
3372        #[serde(skip_serializing_if = "Option::is_none")]
3373        pub disable_parallel_tool_use: Option<bool>,
3374    }
3375    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
3376    pub enum ToolChoiceAnyType {
3377        #[serde(rename = "any")]
3378        Any,
3379    }
3380    impl ::std::fmt::Display for ToolChoiceAnyType {
3381        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
3382            match self {
3383                Self::Any => ::std::write!(__f, "any"),
3384            }
3385        }
3386    }
3387    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3388    pub struct ToolChoiceAny {
3389        pub r#type: ToolChoiceAnyType,
3390        #[serde(skip_serializing_if = "Option::is_none")]
3391        pub disable_parallel_tool_use: Option<bool>,
3392    }
3393    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
3394    pub enum ToolChoiceToolType {
3395        #[serde(rename = "tool")]
3396        Tool,
3397    }
3398    impl ::std::fmt::Display for ToolChoiceToolType {
3399        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
3400            match self {
3401                Self::Tool => ::std::write!(__f, "tool"),
3402            }
3403        }
3404    }
3405    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3406    pub struct ToolChoiceTool {
3407        pub name: String,
3408        pub r#type: ToolChoiceToolType,
3409        #[serde(skip_serializing_if = "Option::is_none")]
3410        pub disable_parallel_tool_use: Option<bool>,
3411    }
3412    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
3413    pub enum ToolChoiceNoneType {
3414        #[serde(rename = "none")]
3415        None,
3416    }
3417    impl ::std::fmt::Display for ToolChoiceNoneType {
3418        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
3419            match self {
3420                Self::None => ::std::write!(__f, "none"),
3421            }
3422        }
3423    }
3424    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3425    pub struct ToolChoiceNone {
3426        pub r#type: ToolChoiceNoneType,
3427    }
3428    impl ::std::convert::From<ToolChoiceAuto> for ToolChoice {
3429        fn from(value: ToolChoiceAuto) -> Self {
3430            ToolChoice::ToolChoiceAuto(value)
3431        }
3432    }
3433    impl ::std::convert::TryFrom<ToolChoice> for ToolChoiceAuto {
3434        type Error = ToolChoice;
3435        /// # Errors
3436        ///
3437        /// Returns the original enum value if it does not match the
3438        /// `#variant_ident` variant.
3439        fn try_from(value: ToolChoice) -> ::std::result::Result<Self, Self::Error> {
3440            match value {
3441                ToolChoice::ToolChoiceAuto(inner) => ::std::result::Result::Ok(inner),
3442                other => ::std::result::Result::Err(other),
3443            }
3444        }
3445    }
3446    impl ::std::convert::From<ToolChoiceAny> for ToolChoice {
3447        fn from(value: ToolChoiceAny) -> Self {
3448            ToolChoice::ToolChoiceAny(value)
3449        }
3450    }
3451    impl ::std::convert::TryFrom<ToolChoice> for ToolChoiceAny {
3452        type Error = ToolChoice;
3453        /// # Errors
3454        ///
3455        /// Returns the original enum value if it does not match the
3456        /// `#variant_ident` variant.
3457        fn try_from(value: ToolChoice) -> ::std::result::Result<Self, Self::Error> {
3458            match value {
3459                ToolChoice::ToolChoiceAny(inner) => ::std::result::Result::Ok(inner),
3460                other => ::std::result::Result::Err(other),
3461            }
3462        }
3463    }
3464    impl ::std::convert::From<ToolChoiceTool> for ToolChoice {
3465        fn from(value: ToolChoiceTool) -> Self {
3466            ToolChoice::ToolChoiceTool(value)
3467        }
3468    }
3469    impl ::std::convert::TryFrom<ToolChoice> for ToolChoiceTool {
3470        type Error = ToolChoice;
3471        /// # Errors
3472        ///
3473        /// Returns the original enum value if it does not match the
3474        /// `#variant_ident` variant.
3475        fn try_from(value: ToolChoice) -> ::std::result::Result<Self, Self::Error> {
3476            match value {
3477                ToolChoice::ToolChoiceTool(inner) => ::std::result::Result::Ok(inner),
3478                other => ::std::result::Result::Err(other),
3479            }
3480        }
3481    }
3482    impl ::std::convert::From<ToolChoiceNone> for ToolChoice {
3483        fn from(value: ToolChoiceNone) -> Self {
3484            ToolChoice::ToolChoiceNone(value)
3485        }
3486    }
3487    impl ::std::convert::TryFrom<ToolChoice> for ToolChoiceNone {
3488        type Error = ToolChoice;
3489        /// # Errors
3490        ///
3491        /// Returns the original enum value if it does not match the
3492        /// `#variant_ident` variant.
3493        fn try_from(value: ToolChoice) -> ::std::result::Result<Self, Self::Error> {
3494            match value {
3495                ToolChoice::ToolChoiceNone(inner) => ::std::result::Result::Ok(inner),
3496                other => ::std::result::Result::Err(other),
3497            }
3498        }
3499    }
3500    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3501    #[serde(untagged)]
3502    pub enum ToolChoice {
3503        ToolChoiceAuto(ToolChoiceAuto),
3504        ToolChoiceAny(ToolChoiceAny),
3505        ToolChoiceTool(ToolChoiceTool),
3506        ToolChoiceNone(ToolChoiceNone),
3507    }
3508    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
3509    pub enum AllowedCallersItem {
3510        #[serde(rename = "direct")]
3511        Direct,
3512        #[serde(rename = "code_execution_20250825")]
3513        CodeExecution20250825,
3514        #[serde(rename = "code_execution_20260120")]
3515        CodeExecution20260120,
3516    }
3517    impl ::std::fmt::Display for AllowedCallersItem {
3518        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
3519            match self {
3520                Self::Direct => ::std::write!(__f, "direct"),
3521                Self::CodeExecution20250825 => {
3522                    ::std::write!(__f, "code_execution_20250825")
3523                }
3524                Self::CodeExecution20260120 => {
3525                    ::std::write!(__f, "code_execution_20260120")
3526                }
3527            }
3528        }
3529    }
3530    pub type AllowedCallers = Vec<AllowedCallersItem>;
3531    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
3532    pub enum ToolInputSchemaType {
3533        #[serde(rename = "object")]
3534        Object,
3535    }
3536    impl ::std::fmt::Display for ToolInputSchemaType {
3537        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
3538            match self {
3539                Self::Object => ::std::write!(__f, "object"),
3540            }
3541        }
3542    }
3543    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3544    /// 工具入参 JSON schema。
3545    pub struct ToolInputSchema {
3546        pub r#type: ToolInputSchemaType,
3547        #[serde(skip_serializing_if = "Option::is_none")]
3548        pub properties: Option<::std::collections::BTreeMap<String, ::serde_json::Value>>,
3549        #[serde(skip_serializing_if = "Option::is_none")]
3550        pub required: Option<Vec<String>>,
3551    }
3552    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
3553    pub enum ToolType {
3554        #[serde(rename = "custom")]
3555        Custom,
3556    }
3557    impl ::std::fmt::Display for ToolType {
3558        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
3559            match self {
3560                Self::Custom => ::std::write!(__f, "custom"),
3561            }
3562        }
3563    }
3564    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3565    pub struct Tool {
3566        /// 工具入参 JSON schema。
3567        pub input_schema: ToolInputSchema,
3568        pub name: String,
3569        #[serde(skip_serializing_if = "Option::is_none")]
3570        pub allowed_callers: Option<AllowedCallers>,
3571        #[serde(skip_serializing_if = "Option::is_none")]
3572        pub cache_control: Option<CacheControlEphemeral>,
3573        #[serde(skip_serializing_if = "Option::is_none")]
3574        pub defer_loading: Option<bool>,
3575        #[serde(skip_serializing_if = "Option::is_none")]
3576        pub description: Option<String>,
3577        #[serde(skip_serializing_if = "Option::is_none")]
3578        pub eager_input_streaming: Option<bool>,
3579        #[serde(skip_serializing_if = "Option::is_none")]
3580        pub input_examples: Option<Vec<::std::collections::BTreeMap<String, ::serde_json::Value>>>,
3581        #[serde(skip_serializing_if = "Option::is_none")]
3582        pub strict: Option<bool>,
3583        #[serde(skip_serializing_if = "Option::is_none")]
3584        pub r#type: Option<ToolType>,
3585    }
3586    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
3587    pub enum ToolBash20250124Name {
3588        #[serde(rename = "bash")]
3589        Bash,
3590    }
3591    impl ::std::fmt::Display for ToolBash20250124Name {
3592        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
3593            match self {
3594                Self::Bash => ::std::write!(__f, "bash"),
3595            }
3596        }
3597    }
3598    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
3599    pub enum ToolBash20250124Type {
3600        #[serde(rename = "bash_20250124")]
3601        Bash20250124,
3602    }
3603    impl ::std::fmt::Display for ToolBash20250124Type {
3604        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
3605            match self {
3606                Self::Bash20250124 => ::std::write!(__f, "bash_20250124"),
3607            }
3608        }
3609    }
3610    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3611    pub struct ToolBash20250124 {
3612        pub name: ToolBash20250124Name,
3613        pub r#type: ToolBash20250124Type,
3614        #[serde(skip_serializing_if = "Option::is_none")]
3615        pub allowed_callers: Option<AllowedCallers>,
3616        #[serde(skip_serializing_if = "Option::is_none")]
3617        pub cache_control: Option<CacheControlEphemeral>,
3618        #[serde(skip_serializing_if = "Option::is_none")]
3619        pub defer_loading: Option<bool>,
3620        #[serde(skip_serializing_if = "Option::is_none")]
3621        pub input_examples: Option<Vec<::std::collections::BTreeMap<String, ::serde_json::Value>>>,
3622        #[serde(skip_serializing_if = "Option::is_none")]
3623        pub strict: Option<bool>,
3624    }
3625    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
3626    pub enum CodeExecutionTool20250522Name {
3627        #[serde(rename = "code_execution")]
3628        CodeExecution,
3629    }
3630    impl ::std::fmt::Display for CodeExecutionTool20250522Name {
3631        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
3632            match self {
3633                Self::CodeExecution => ::std::write!(__f, "code_execution"),
3634            }
3635        }
3636    }
3637    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
3638    pub enum CodeExecutionTool20250522Type {
3639        #[serde(rename = "code_execution_20250522")]
3640        CodeExecution20250522,
3641    }
3642    impl ::std::fmt::Display for CodeExecutionTool20250522Type {
3643        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
3644            match self {
3645                Self::CodeExecution20250522 => {
3646                    ::std::write!(__f, "code_execution_20250522")
3647                }
3648            }
3649        }
3650    }
3651    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3652    pub struct CodeExecutionTool20250522 {
3653        pub name: CodeExecutionTool20250522Name,
3654        pub r#type: CodeExecutionTool20250522Type,
3655        #[serde(skip_serializing_if = "Option::is_none")]
3656        pub allowed_callers: Option<AllowedCallers>,
3657        #[serde(skip_serializing_if = "Option::is_none")]
3658        pub cache_control: Option<CacheControlEphemeral>,
3659        #[serde(skip_serializing_if = "Option::is_none")]
3660        pub defer_loading: Option<bool>,
3661        #[serde(skip_serializing_if = "Option::is_none")]
3662        pub strict: Option<bool>,
3663    }
3664    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
3665    pub enum CodeExecutionTool20250825Name {
3666        #[serde(rename = "code_execution")]
3667        CodeExecution,
3668    }
3669    impl ::std::fmt::Display for CodeExecutionTool20250825Name {
3670        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
3671            match self {
3672                Self::CodeExecution => ::std::write!(__f, "code_execution"),
3673            }
3674        }
3675    }
3676    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
3677    pub enum CodeExecutionTool20250825Type {
3678        #[serde(rename = "code_execution_20250825")]
3679        CodeExecution20250825,
3680    }
3681    impl ::std::fmt::Display for CodeExecutionTool20250825Type {
3682        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
3683            match self {
3684                Self::CodeExecution20250825 => {
3685                    ::std::write!(__f, "code_execution_20250825")
3686                }
3687            }
3688        }
3689    }
3690    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3691    pub struct CodeExecutionTool20250825 {
3692        pub name: CodeExecutionTool20250825Name,
3693        pub r#type: CodeExecutionTool20250825Type,
3694        #[serde(skip_serializing_if = "Option::is_none")]
3695        pub allowed_callers: Option<AllowedCallers>,
3696        #[serde(skip_serializing_if = "Option::is_none")]
3697        pub cache_control: Option<CacheControlEphemeral>,
3698        #[serde(skip_serializing_if = "Option::is_none")]
3699        pub defer_loading: Option<bool>,
3700        #[serde(skip_serializing_if = "Option::is_none")]
3701        pub strict: Option<bool>,
3702    }
3703    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
3704    pub enum CodeExecutionTool20260120Name {
3705        #[serde(rename = "code_execution")]
3706        CodeExecution,
3707    }
3708    impl ::std::fmt::Display for CodeExecutionTool20260120Name {
3709        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
3710            match self {
3711                Self::CodeExecution => ::std::write!(__f, "code_execution"),
3712            }
3713        }
3714    }
3715    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
3716    pub enum CodeExecutionTool20260120Type {
3717        #[serde(rename = "code_execution_20260120")]
3718        CodeExecution20260120,
3719    }
3720    impl ::std::fmt::Display for CodeExecutionTool20260120Type {
3721        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
3722            match self {
3723                Self::CodeExecution20260120 => {
3724                    ::std::write!(__f, "code_execution_20260120")
3725                }
3726            }
3727        }
3728    }
3729    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3730    /// 带 REPL 状态持久化的 code execution(daemon + gVisor checkpoint)。
3731    pub struct CodeExecutionTool20260120 {
3732        pub name: CodeExecutionTool20260120Name,
3733        pub r#type: CodeExecutionTool20260120Type,
3734        #[serde(skip_serializing_if = "Option::is_none")]
3735        pub allowed_callers: Option<AllowedCallers>,
3736        #[serde(skip_serializing_if = "Option::is_none")]
3737        pub cache_control: Option<CacheControlEphemeral>,
3738        #[serde(skip_serializing_if = "Option::is_none")]
3739        pub defer_loading: Option<bool>,
3740        #[serde(skip_serializing_if = "Option::is_none")]
3741        pub strict: Option<bool>,
3742    }
3743    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
3744    pub enum MemoryTool20250818Name {
3745        #[serde(rename = "memory")]
3746        Memory,
3747    }
3748    impl ::std::fmt::Display for MemoryTool20250818Name {
3749        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
3750            match self {
3751                Self::Memory => ::std::write!(__f, "memory"),
3752            }
3753        }
3754    }
3755    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
3756    pub enum MemoryTool20250818Type {
3757        #[serde(rename = "memory_20250818")]
3758        Memory20250818,
3759    }
3760    impl ::std::fmt::Display for MemoryTool20250818Type {
3761        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
3762            match self {
3763                Self::Memory20250818 => ::std::write!(__f, "memory_20250818"),
3764            }
3765        }
3766    }
3767    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3768    pub struct MemoryTool20250818 {
3769        pub name: MemoryTool20250818Name,
3770        pub r#type: MemoryTool20250818Type,
3771        #[serde(skip_serializing_if = "Option::is_none")]
3772        pub allowed_callers: Option<AllowedCallers>,
3773        #[serde(skip_serializing_if = "Option::is_none")]
3774        pub cache_control: Option<CacheControlEphemeral>,
3775        #[serde(skip_serializing_if = "Option::is_none")]
3776        pub defer_loading: Option<bool>,
3777        #[serde(skip_serializing_if = "Option::is_none")]
3778        pub input_examples: Option<Vec<::std::collections::BTreeMap<String, ::serde_json::Value>>>,
3779        #[serde(skip_serializing_if = "Option::is_none")]
3780        pub strict: Option<bool>,
3781    }
3782    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
3783    pub enum ToolTextEditor20250124Name {
3784        #[serde(rename = "str_replace_editor")]
3785        StrReplaceEditor,
3786    }
3787    impl ::std::fmt::Display for ToolTextEditor20250124Name {
3788        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
3789            match self {
3790                Self::StrReplaceEditor => ::std::write!(__f, "str_replace_editor"),
3791            }
3792        }
3793    }
3794    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
3795    pub enum ToolTextEditor20250124Type {
3796        #[serde(rename = "text_editor_20250124")]
3797        TextEditor20250124,
3798    }
3799    impl ::std::fmt::Display for ToolTextEditor20250124Type {
3800        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
3801            match self {
3802                Self::TextEditor20250124 => ::std::write!(__f, "text_editor_20250124"),
3803            }
3804        }
3805    }
3806    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3807    pub struct ToolTextEditor20250124 {
3808        pub name: ToolTextEditor20250124Name,
3809        pub r#type: ToolTextEditor20250124Type,
3810        #[serde(skip_serializing_if = "Option::is_none")]
3811        pub allowed_callers: Option<AllowedCallers>,
3812        #[serde(skip_serializing_if = "Option::is_none")]
3813        pub cache_control: Option<CacheControlEphemeral>,
3814        #[serde(skip_serializing_if = "Option::is_none")]
3815        pub defer_loading: Option<bool>,
3816        #[serde(skip_serializing_if = "Option::is_none")]
3817        pub input_examples: Option<Vec<::std::collections::BTreeMap<String, ::serde_json::Value>>>,
3818        #[serde(skip_serializing_if = "Option::is_none")]
3819        pub strict: Option<bool>,
3820    }
3821    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
3822    pub enum ToolTextEditor20250429Name {
3823        #[serde(rename = "str_replace_based_edit_tool")]
3824        StrReplaceBasedEditTool,
3825    }
3826    impl ::std::fmt::Display for ToolTextEditor20250429Name {
3827        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
3828            match self {
3829                Self::StrReplaceBasedEditTool => {
3830                    ::std::write!(__f, "str_replace_based_edit_tool")
3831                }
3832            }
3833        }
3834    }
3835    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
3836    pub enum ToolTextEditor20250429Type {
3837        #[serde(rename = "text_editor_20250429")]
3838        TextEditor20250429,
3839    }
3840    impl ::std::fmt::Display for ToolTextEditor20250429Type {
3841        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
3842            match self {
3843                Self::TextEditor20250429 => ::std::write!(__f, "text_editor_20250429"),
3844            }
3845        }
3846    }
3847    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3848    pub struct ToolTextEditor20250429 {
3849        pub name: ToolTextEditor20250429Name,
3850        pub r#type: ToolTextEditor20250429Type,
3851        #[serde(skip_serializing_if = "Option::is_none")]
3852        pub allowed_callers: Option<AllowedCallers>,
3853        #[serde(skip_serializing_if = "Option::is_none")]
3854        pub cache_control: Option<CacheControlEphemeral>,
3855        #[serde(skip_serializing_if = "Option::is_none")]
3856        pub defer_loading: Option<bool>,
3857        #[serde(skip_serializing_if = "Option::is_none")]
3858        pub input_examples: Option<Vec<::std::collections::BTreeMap<String, ::serde_json::Value>>>,
3859        #[serde(skip_serializing_if = "Option::is_none")]
3860        pub strict: Option<bool>,
3861    }
3862    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
3863    pub enum ToolTextEditor20250728Name {
3864        #[serde(rename = "str_replace_based_edit_tool")]
3865        StrReplaceBasedEditTool,
3866    }
3867    impl ::std::fmt::Display for ToolTextEditor20250728Name {
3868        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
3869            match self {
3870                Self::StrReplaceBasedEditTool => {
3871                    ::std::write!(__f, "str_replace_based_edit_tool")
3872                }
3873            }
3874        }
3875    }
3876    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
3877    pub enum ToolTextEditor20250728Type {
3878        #[serde(rename = "text_editor_20250728")]
3879        TextEditor20250728,
3880    }
3881    impl ::std::fmt::Display for ToolTextEditor20250728Type {
3882        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
3883            match self {
3884                Self::TextEditor20250728 => ::std::write!(__f, "text_editor_20250728"),
3885            }
3886        }
3887    }
3888    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3889    pub struct ToolTextEditor20250728 {
3890        pub name: ToolTextEditor20250728Name,
3891        pub r#type: ToolTextEditor20250728Type,
3892        #[serde(skip_serializing_if = "Option::is_none")]
3893        pub allowed_callers: Option<AllowedCallers>,
3894        #[serde(skip_serializing_if = "Option::is_none")]
3895        pub cache_control: Option<CacheControlEphemeral>,
3896        #[serde(skip_serializing_if = "Option::is_none")]
3897        pub defer_loading: Option<bool>,
3898        #[serde(skip_serializing_if = "Option::is_none")]
3899        pub input_examples: Option<Vec<::std::collections::BTreeMap<String, ::serde_json::Value>>>,
3900        #[serde(skip_serializing_if = "Option::is_none")]
3901        /// 查看文件时显示的最大字符数。
3902        pub max_characters: Option<i64>,
3903        #[serde(skip_serializing_if = "Option::is_none")]
3904        pub strict: Option<bool>,
3905    }
3906    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
3907    pub enum UserLocationType {
3908        #[serde(rename = "approximate")]
3909        Approximate,
3910    }
3911    impl ::std::fmt::Display for UserLocationType {
3912        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
3913            match self {
3914                Self::Approximate => ::std::write!(__f, "approximate"),
3915            }
3916        }
3917    }
3918    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3919    pub struct UserLocation {
3920        pub r#type: UserLocationType,
3921        #[serde(skip_serializing_if = "Option::is_none")]
3922        pub city: Option<String>,
3923        #[serde(skip_serializing_if = "Option::is_none")]
3924        /// ISO 3166-1 alpha-2 双字母国家码。
3925        pub country: Option<String>,
3926        #[serde(skip_serializing_if = "Option::is_none")]
3927        pub region: Option<String>,
3928        #[serde(skip_serializing_if = "Option::is_none")]
3929        /// IANA 时区。
3930        pub timezone: Option<String>,
3931    }
3932    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
3933    pub enum WebSearchTool20250305Name {
3934        #[serde(rename = "web_search")]
3935        WebSearch,
3936    }
3937    impl ::std::fmt::Display for WebSearchTool20250305Name {
3938        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
3939            match self {
3940                Self::WebSearch => ::std::write!(__f, "web_search"),
3941            }
3942        }
3943    }
3944    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
3945    pub enum WebSearchTool20250305Type {
3946        #[serde(rename = "web_search_20250305")]
3947        WebSearch20250305,
3948    }
3949    impl ::std::fmt::Display for WebSearchTool20250305Type {
3950        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
3951            match self {
3952                Self::WebSearch20250305 => ::std::write!(__f, "web_search_20250305"),
3953            }
3954        }
3955    }
3956    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3957    pub struct WebSearchTool20250305 {
3958        pub name: WebSearchTool20250305Name,
3959        pub r#type: WebSearchTool20250305Type,
3960        #[serde(skip_serializing_if = "Option::is_none")]
3961        pub allowed_callers: Option<AllowedCallers>,
3962        #[serde(skip_serializing_if = "Option::is_none")]
3963        pub allowed_domains: Option<Vec<String>>,
3964        #[serde(skip_serializing_if = "Option::is_none")]
3965        pub blocked_domains: Option<Vec<String>>,
3966        #[serde(skip_serializing_if = "Option::is_none")]
3967        pub cache_control: Option<CacheControlEphemeral>,
3968        #[serde(skip_serializing_if = "Option::is_none")]
3969        pub defer_loading: Option<bool>,
3970        #[serde(skip_serializing_if = "Option::is_none")]
3971        pub max_uses: Option<i64>,
3972        #[serde(skip_serializing_if = "Option::is_none")]
3973        pub strict: Option<bool>,
3974        #[serde(skip_serializing_if = "Option::is_none")]
3975        pub user_location: Option<UserLocation>,
3976    }
3977    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
3978    pub enum WebSearchTool20260209Name {
3979        #[serde(rename = "web_search")]
3980        WebSearch,
3981    }
3982    impl ::std::fmt::Display for WebSearchTool20260209Name {
3983        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
3984            match self {
3985                Self::WebSearch => ::std::write!(__f, "web_search"),
3986            }
3987        }
3988    }
3989    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
3990    pub enum WebSearchTool20260209Type {
3991        #[serde(rename = "web_search_20260209")]
3992        WebSearch20260209,
3993    }
3994    impl ::std::fmt::Display for WebSearchTool20260209Type {
3995        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
3996            match self {
3997                Self::WebSearch20260209 => ::std::write!(__f, "web_search_20260209"),
3998            }
3999        }
4000    }
4001    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
4002    pub struct WebSearchTool20260209 {
4003        pub name: WebSearchTool20260209Name,
4004        pub r#type: WebSearchTool20260209Type,
4005        #[serde(skip_serializing_if = "Option::is_none")]
4006        pub allowed_callers: Option<AllowedCallers>,
4007        #[serde(skip_serializing_if = "Option::is_none")]
4008        pub allowed_domains: Option<Vec<String>>,
4009        #[serde(skip_serializing_if = "Option::is_none")]
4010        pub blocked_domains: Option<Vec<String>>,
4011        #[serde(skip_serializing_if = "Option::is_none")]
4012        pub cache_control: Option<CacheControlEphemeral>,
4013        #[serde(skip_serializing_if = "Option::is_none")]
4014        pub defer_loading: Option<bool>,
4015        #[serde(skip_serializing_if = "Option::is_none")]
4016        pub max_uses: Option<i64>,
4017        #[serde(skip_serializing_if = "Option::is_none")]
4018        pub strict: Option<bool>,
4019        #[serde(skip_serializing_if = "Option::is_none")]
4020        pub user_location: Option<UserLocation>,
4021    }
4022    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
4023    pub enum WebFetchTool20250910Name {
4024        #[serde(rename = "web_fetch")]
4025        WebFetch,
4026    }
4027    impl ::std::fmt::Display for WebFetchTool20250910Name {
4028        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
4029            match self {
4030                Self::WebFetch => ::std::write!(__f, "web_fetch"),
4031            }
4032        }
4033    }
4034    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
4035    pub enum WebFetchTool20250910Type {
4036        #[serde(rename = "web_fetch_20250910")]
4037        WebFetch20250910,
4038    }
4039    impl ::std::fmt::Display for WebFetchTool20250910Type {
4040        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
4041            match self {
4042                Self::WebFetch20250910 => ::std::write!(__f, "web_fetch_20250910"),
4043            }
4044        }
4045    }
4046    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
4047    pub struct WebFetchTool20250910 {
4048        pub name: WebFetchTool20250910Name,
4049        pub r#type: WebFetchTool20250910Type,
4050        #[serde(skip_serializing_if = "Option::is_none")]
4051        pub allowed_callers: Option<AllowedCallers>,
4052        #[serde(skip_serializing_if = "Option::is_none")]
4053        pub allowed_domains: Option<Vec<String>>,
4054        #[serde(skip_serializing_if = "Option::is_none")]
4055        pub blocked_domains: Option<Vec<String>>,
4056        #[serde(skip_serializing_if = "Option::is_none")]
4057        pub cache_control: Option<CacheControlEphemeral>,
4058        #[serde(skip_serializing_if = "Option::is_none")]
4059        pub citations: Option<CitationsConfigParam>,
4060        #[serde(skip_serializing_if = "Option::is_none")]
4061        pub defer_loading: Option<bool>,
4062        #[serde(skip_serializing_if = "Option::is_none")]
4063        pub max_content_tokens: Option<i64>,
4064        #[serde(skip_serializing_if = "Option::is_none")]
4065        pub max_uses: Option<i64>,
4066        #[serde(skip_serializing_if = "Option::is_none")]
4067        pub strict: Option<bool>,
4068    }
4069    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
4070    pub enum WebFetchTool20260209Name {
4071        #[serde(rename = "web_fetch")]
4072        WebFetch,
4073    }
4074    impl ::std::fmt::Display for WebFetchTool20260209Name {
4075        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
4076            match self {
4077                Self::WebFetch => ::std::write!(__f, "web_fetch"),
4078            }
4079        }
4080    }
4081    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
4082    pub enum WebFetchTool20260209Type {
4083        #[serde(rename = "web_fetch_20260209")]
4084        WebFetch20260209,
4085    }
4086    impl ::std::fmt::Display for WebFetchTool20260209Type {
4087        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
4088            match self {
4089                Self::WebFetch20260209 => ::std::write!(__f, "web_fetch_20260209"),
4090            }
4091        }
4092    }
4093    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
4094    pub struct WebFetchTool20260209 {
4095        pub name: WebFetchTool20260209Name,
4096        pub r#type: WebFetchTool20260209Type,
4097        #[serde(skip_serializing_if = "Option::is_none")]
4098        pub allowed_callers: Option<AllowedCallers>,
4099        #[serde(skip_serializing_if = "Option::is_none")]
4100        pub allowed_domains: Option<Vec<String>>,
4101        #[serde(skip_serializing_if = "Option::is_none")]
4102        pub blocked_domains: Option<Vec<String>>,
4103        #[serde(skip_serializing_if = "Option::is_none")]
4104        pub cache_control: Option<CacheControlEphemeral>,
4105        #[serde(skip_serializing_if = "Option::is_none")]
4106        pub citations: Option<CitationsConfigParam>,
4107        #[serde(skip_serializing_if = "Option::is_none")]
4108        pub defer_loading: Option<bool>,
4109        #[serde(skip_serializing_if = "Option::is_none")]
4110        pub max_content_tokens: Option<i64>,
4111        #[serde(skip_serializing_if = "Option::is_none")]
4112        pub max_uses: Option<i64>,
4113        #[serde(skip_serializing_if = "Option::is_none")]
4114        pub strict: Option<bool>,
4115    }
4116    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
4117    pub enum WebFetchTool20260309Name {
4118        #[serde(rename = "web_fetch")]
4119        WebFetch,
4120    }
4121    impl ::std::fmt::Display for WebFetchTool20260309Name {
4122        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
4123            match self {
4124                Self::WebFetch => ::std::write!(__f, "web_fetch"),
4125            }
4126        }
4127    }
4128    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
4129    pub enum WebFetchTool20260309Type {
4130        #[serde(rename = "web_fetch_20260309")]
4131        WebFetch20260309,
4132    }
4133    impl ::std::fmt::Display for WebFetchTool20260309Type {
4134        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
4135            match self {
4136                Self::WebFetch20260309 => ::std::write!(__f, "web_fetch_20260309"),
4137            }
4138        }
4139    }
4140    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
4141    /// 多了 use_cache 参数(绕过缓存内容)。
4142    pub struct WebFetchTool20260309 {
4143        pub name: WebFetchTool20260309Name,
4144        pub r#type: WebFetchTool20260309Type,
4145        #[serde(skip_serializing_if = "Option::is_none")]
4146        pub allowed_callers: Option<AllowedCallers>,
4147        #[serde(skip_serializing_if = "Option::is_none")]
4148        pub allowed_domains: Option<Vec<String>>,
4149        #[serde(skip_serializing_if = "Option::is_none")]
4150        pub blocked_domains: Option<Vec<String>>,
4151        #[serde(skip_serializing_if = "Option::is_none")]
4152        pub cache_control: Option<CacheControlEphemeral>,
4153        #[serde(skip_serializing_if = "Option::is_none")]
4154        pub citations: Option<CitationsConfigParam>,
4155        #[serde(skip_serializing_if = "Option::is_none")]
4156        pub defer_loading: Option<bool>,
4157        #[serde(skip_serializing_if = "Option::is_none")]
4158        pub max_content_tokens: Option<i64>,
4159        #[serde(skip_serializing_if = "Option::is_none")]
4160        pub max_uses: Option<i64>,
4161        #[serde(skip_serializing_if = "Option::is_none")]
4162        pub strict: Option<bool>,
4163        #[serde(skip_serializing_if = "Option::is_none")]
4164        pub use_cache: Option<bool>,
4165    }
4166    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
4167    pub enum ToolSearchToolBm2520251119Name {
4168        #[serde(rename = "tool_search_tool_bm25")]
4169        ToolSearchToolBm25,
4170    }
4171    impl ::std::fmt::Display for ToolSearchToolBm2520251119Name {
4172        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
4173            match self {
4174                Self::ToolSearchToolBm25 => ::std::write!(__f, "tool_search_tool_bm25"),
4175            }
4176        }
4177    }
4178    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
4179    pub enum ToolSearchToolBm2520251119Type {
4180        #[serde(rename = "tool_search_tool_bm25_20251119")]
4181        ToolSearchToolBm2520251119,
4182        #[serde(rename = "tool_search_tool_bm25")]
4183        ToolSearchToolBm25,
4184    }
4185    impl ::std::fmt::Display for ToolSearchToolBm2520251119Type {
4186        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
4187            match self {
4188                Self::ToolSearchToolBm2520251119 => {
4189                    ::std::write!(__f, "tool_search_tool_bm25_20251119")
4190                }
4191                Self::ToolSearchToolBm25 => ::std::write!(__f, "tool_search_tool_bm25"),
4192            }
4193        }
4194    }
4195    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
4196    pub struct ToolSearchToolBm2520251119 {
4197        pub name: ToolSearchToolBm2520251119Name,
4198        pub r#type: ToolSearchToolBm2520251119Type,
4199        #[serde(skip_serializing_if = "Option::is_none")]
4200        pub allowed_callers: Option<AllowedCallers>,
4201        #[serde(skip_serializing_if = "Option::is_none")]
4202        pub cache_control: Option<CacheControlEphemeral>,
4203        #[serde(skip_serializing_if = "Option::is_none")]
4204        pub defer_loading: Option<bool>,
4205        #[serde(skip_serializing_if = "Option::is_none")]
4206        pub strict: Option<bool>,
4207    }
4208    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
4209    pub enum ToolSearchToolRegex20251119Name {
4210        #[serde(rename = "tool_search_tool_regex")]
4211        ToolSearchToolRegex,
4212    }
4213    impl ::std::fmt::Display for ToolSearchToolRegex20251119Name {
4214        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
4215            match self {
4216                Self::ToolSearchToolRegex => ::std::write!(__f, "tool_search_tool_regex"),
4217            }
4218        }
4219    }
4220    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
4221    pub enum ToolSearchToolRegex20251119Type {
4222        #[serde(rename = "tool_search_tool_regex_20251119")]
4223        ToolSearchToolRegex20251119,
4224        #[serde(rename = "tool_search_tool_regex")]
4225        ToolSearchToolRegex,
4226    }
4227    impl ::std::fmt::Display for ToolSearchToolRegex20251119Type {
4228        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
4229            match self {
4230                Self::ToolSearchToolRegex20251119 => {
4231                    ::std::write!(__f, "tool_search_tool_regex_20251119")
4232                }
4233                Self::ToolSearchToolRegex => ::std::write!(__f, "tool_search_tool_regex"),
4234            }
4235        }
4236    }
4237    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
4238    pub struct ToolSearchToolRegex20251119 {
4239        pub name: ToolSearchToolRegex20251119Name,
4240        pub r#type: ToolSearchToolRegex20251119Type,
4241        #[serde(skip_serializing_if = "Option::is_none")]
4242        pub allowed_callers: Option<AllowedCallers>,
4243        #[serde(skip_serializing_if = "Option::is_none")]
4244        pub cache_control: Option<CacheControlEphemeral>,
4245        #[serde(skip_serializing_if = "Option::is_none")]
4246        pub defer_loading: Option<bool>,
4247        #[serde(skip_serializing_if = "Option::is_none")]
4248        pub strict: Option<bool>,
4249    }
4250    impl ::std::convert::From<Tool> for ToolUnion {
4251        fn from(value: Tool) -> Self {
4252            ToolUnion::Tool(value)
4253        }
4254    }
4255    impl ::std::convert::TryFrom<ToolUnion> for Tool {
4256        type Error = ToolUnion;
4257        /// # Errors
4258        ///
4259        /// Returns the original enum value if it does not match the
4260        /// `#variant_ident` variant.
4261        fn try_from(value: ToolUnion) -> ::std::result::Result<Self, Self::Error> {
4262            match value {
4263                ToolUnion::Tool(inner) => ::std::result::Result::Ok(inner),
4264                other => ::std::result::Result::Err(other),
4265            }
4266        }
4267    }
4268    impl ::std::convert::From<ToolBash20250124> for ToolUnion {
4269        fn from(value: ToolBash20250124) -> Self {
4270            ToolUnion::ToolBash20250124(value)
4271        }
4272    }
4273    impl ::std::convert::TryFrom<ToolUnion> for ToolBash20250124 {
4274        type Error = ToolUnion;
4275        /// # Errors
4276        ///
4277        /// Returns the original enum value if it does not match the
4278        /// `#variant_ident` variant.
4279        fn try_from(value: ToolUnion) -> ::std::result::Result<Self, Self::Error> {
4280            match value {
4281                ToolUnion::ToolBash20250124(inner) => ::std::result::Result::Ok(inner),
4282                other => ::std::result::Result::Err(other),
4283            }
4284        }
4285    }
4286    impl ::std::convert::From<CodeExecutionTool20250522> for ToolUnion {
4287        fn from(value: CodeExecutionTool20250522) -> Self {
4288            ToolUnion::CodeExecutionTool20250522(value)
4289        }
4290    }
4291    impl ::std::convert::TryFrom<ToolUnion> for CodeExecutionTool20250522 {
4292        type Error = ToolUnion;
4293        /// # Errors
4294        ///
4295        /// Returns the original enum value if it does not match the
4296        /// `#variant_ident` variant.
4297        fn try_from(value: ToolUnion) -> ::std::result::Result<Self, Self::Error> {
4298            match value {
4299                ToolUnion::CodeExecutionTool20250522(inner) => ::std::result::Result::Ok(inner),
4300                other => ::std::result::Result::Err(other),
4301            }
4302        }
4303    }
4304    impl ::std::convert::From<CodeExecutionTool20250825> for ToolUnion {
4305        fn from(value: CodeExecutionTool20250825) -> Self {
4306            ToolUnion::CodeExecutionTool20250825(value)
4307        }
4308    }
4309    impl ::std::convert::TryFrom<ToolUnion> for CodeExecutionTool20250825 {
4310        type Error = ToolUnion;
4311        /// # Errors
4312        ///
4313        /// Returns the original enum value if it does not match the
4314        /// `#variant_ident` variant.
4315        fn try_from(value: ToolUnion) -> ::std::result::Result<Self, Self::Error> {
4316            match value {
4317                ToolUnion::CodeExecutionTool20250825(inner) => ::std::result::Result::Ok(inner),
4318                other => ::std::result::Result::Err(other),
4319            }
4320        }
4321    }
4322    impl ::std::convert::From<CodeExecutionTool20260120> for ToolUnion {
4323        fn from(value: CodeExecutionTool20260120) -> Self {
4324            ToolUnion::CodeExecutionTool20260120(value)
4325        }
4326    }
4327    impl ::std::convert::TryFrom<ToolUnion> for CodeExecutionTool20260120 {
4328        type Error = ToolUnion;
4329        /// # Errors
4330        ///
4331        /// Returns the original enum value if it does not match the
4332        /// `#variant_ident` variant.
4333        fn try_from(value: ToolUnion) -> ::std::result::Result<Self, Self::Error> {
4334            match value {
4335                ToolUnion::CodeExecutionTool20260120(inner) => ::std::result::Result::Ok(inner),
4336                other => ::std::result::Result::Err(other),
4337            }
4338        }
4339    }
4340    impl ::std::convert::From<MemoryTool20250818> for ToolUnion {
4341        fn from(value: MemoryTool20250818) -> Self {
4342            ToolUnion::MemoryTool20250818(value)
4343        }
4344    }
4345    impl ::std::convert::TryFrom<ToolUnion> for MemoryTool20250818 {
4346        type Error = ToolUnion;
4347        /// # Errors
4348        ///
4349        /// Returns the original enum value if it does not match the
4350        /// `#variant_ident` variant.
4351        fn try_from(value: ToolUnion) -> ::std::result::Result<Self, Self::Error> {
4352            match value {
4353                ToolUnion::MemoryTool20250818(inner) => ::std::result::Result::Ok(inner),
4354                other => ::std::result::Result::Err(other),
4355            }
4356        }
4357    }
4358    impl ::std::convert::From<ToolTextEditor20250124> for ToolUnion {
4359        fn from(value: ToolTextEditor20250124) -> Self {
4360            ToolUnion::ToolTextEditor20250124(value)
4361        }
4362    }
4363    impl ::std::convert::TryFrom<ToolUnion> for ToolTextEditor20250124 {
4364        type Error = ToolUnion;
4365        /// # Errors
4366        ///
4367        /// Returns the original enum value if it does not match the
4368        /// `#variant_ident` variant.
4369        fn try_from(value: ToolUnion) -> ::std::result::Result<Self, Self::Error> {
4370            match value {
4371                ToolUnion::ToolTextEditor20250124(inner) => ::std::result::Result::Ok(inner),
4372                other => ::std::result::Result::Err(other),
4373            }
4374        }
4375    }
4376    impl ::std::convert::From<ToolTextEditor20250429> for ToolUnion {
4377        fn from(value: ToolTextEditor20250429) -> Self {
4378            ToolUnion::ToolTextEditor20250429(value)
4379        }
4380    }
4381    impl ::std::convert::TryFrom<ToolUnion> for ToolTextEditor20250429 {
4382        type Error = ToolUnion;
4383        /// # Errors
4384        ///
4385        /// Returns the original enum value if it does not match the
4386        /// `#variant_ident` variant.
4387        fn try_from(value: ToolUnion) -> ::std::result::Result<Self, Self::Error> {
4388            match value {
4389                ToolUnion::ToolTextEditor20250429(inner) => ::std::result::Result::Ok(inner),
4390                other => ::std::result::Result::Err(other),
4391            }
4392        }
4393    }
4394    impl ::std::convert::From<ToolTextEditor20250728> for ToolUnion {
4395        fn from(value: ToolTextEditor20250728) -> Self {
4396            ToolUnion::ToolTextEditor20250728(value)
4397        }
4398    }
4399    impl ::std::convert::TryFrom<ToolUnion> for ToolTextEditor20250728 {
4400        type Error = ToolUnion;
4401        /// # Errors
4402        ///
4403        /// Returns the original enum value if it does not match the
4404        /// `#variant_ident` variant.
4405        fn try_from(value: ToolUnion) -> ::std::result::Result<Self, Self::Error> {
4406            match value {
4407                ToolUnion::ToolTextEditor20250728(inner) => ::std::result::Result::Ok(inner),
4408                other => ::std::result::Result::Err(other),
4409            }
4410        }
4411    }
4412    impl ::std::convert::From<WebSearchTool20250305> for ToolUnion {
4413        fn from(value: WebSearchTool20250305) -> Self {
4414            ToolUnion::WebSearchTool20250305(value)
4415        }
4416    }
4417    impl ::std::convert::TryFrom<ToolUnion> for WebSearchTool20250305 {
4418        type Error = ToolUnion;
4419        /// # Errors
4420        ///
4421        /// Returns the original enum value if it does not match the
4422        /// `#variant_ident` variant.
4423        fn try_from(value: ToolUnion) -> ::std::result::Result<Self, Self::Error> {
4424            match value {
4425                ToolUnion::WebSearchTool20250305(inner) => ::std::result::Result::Ok(inner),
4426                other => ::std::result::Result::Err(other),
4427            }
4428        }
4429    }
4430    impl ::std::convert::From<WebSearchTool20260209> for ToolUnion {
4431        fn from(value: WebSearchTool20260209) -> Self {
4432            ToolUnion::WebSearchTool20260209(value)
4433        }
4434    }
4435    impl ::std::convert::TryFrom<ToolUnion> for WebSearchTool20260209 {
4436        type Error = ToolUnion;
4437        /// # Errors
4438        ///
4439        /// Returns the original enum value if it does not match the
4440        /// `#variant_ident` variant.
4441        fn try_from(value: ToolUnion) -> ::std::result::Result<Self, Self::Error> {
4442            match value {
4443                ToolUnion::WebSearchTool20260209(inner) => ::std::result::Result::Ok(inner),
4444                other => ::std::result::Result::Err(other),
4445            }
4446        }
4447    }
4448    impl ::std::convert::From<WebFetchTool20250910> for ToolUnion {
4449        fn from(value: WebFetchTool20250910) -> Self {
4450            ToolUnion::WebFetchTool20250910(value)
4451        }
4452    }
4453    impl ::std::convert::TryFrom<ToolUnion> for WebFetchTool20250910 {
4454        type Error = ToolUnion;
4455        /// # Errors
4456        ///
4457        /// Returns the original enum value if it does not match the
4458        /// `#variant_ident` variant.
4459        fn try_from(value: ToolUnion) -> ::std::result::Result<Self, Self::Error> {
4460            match value {
4461                ToolUnion::WebFetchTool20250910(inner) => ::std::result::Result::Ok(inner),
4462                other => ::std::result::Result::Err(other),
4463            }
4464        }
4465    }
4466    impl ::std::convert::From<WebFetchTool20260209> for ToolUnion {
4467        fn from(value: WebFetchTool20260209) -> Self {
4468            ToolUnion::WebFetchTool20260209(value)
4469        }
4470    }
4471    impl ::std::convert::TryFrom<ToolUnion> for WebFetchTool20260209 {
4472        type Error = ToolUnion;
4473        /// # Errors
4474        ///
4475        /// Returns the original enum value if it does not match the
4476        /// `#variant_ident` variant.
4477        fn try_from(value: ToolUnion) -> ::std::result::Result<Self, Self::Error> {
4478            match value {
4479                ToolUnion::WebFetchTool20260209(inner) => ::std::result::Result::Ok(inner),
4480                other => ::std::result::Result::Err(other),
4481            }
4482        }
4483    }
4484    impl ::std::convert::From<WebFetchTool20260309> for ToolUnion {
4485        fn from(value: WebFetchTool20260309) -> Self {
4486            ToolUnion::WebFetchTool20260309(value)
4487        }
4488    }
4489    impl ::std::convert::TryFrom<ToolUnion> for WebFetchTool20260309 {
4490        type Error = ToolUnion;
4491        /// # Errors
4492        ///
4493        /// Returns the original enum value if it does not match the
4494        /// `#variant_ident` variant.
4495        fn try_from(value: ToolUnion) -> ::std::result::Result<Self, Self::Error> {
4496            match value {
4497                ToolUnion::WebFetchTool20260309(inner) => ::std::result::Result::Ok(inner),
4498                other => ::std::result::Result::Err(other),
4499            }
4500        }
4501    }
4502    impl ::std::convert::From<ToolSearchToolBm2520251119> for ToolUnion {
4503        fn from(value: ToolSearchToolBm2520251119) -> Self {
4504            ToolUnion::ToolSearchToolBm2520251119(value)
4505        }
4506    }
4507    impl ::std::convert::TryFrom<ToolUnion> for ToolSearchToolBm2520251119 {
4508        type Error = ToolUnion;
4509        /// # Errors
4510        ///
4511        /// Returns the original enum value if it does not match the
4512        /// `#variant_ident` variant.
4513        fn try_from(value: ToolUnion) -> ::std::result::Result<Self, Self::Error> {
4514            match value {
4515                ToolUnion::ToolSearchToolBm2520251119(inner) => ::std::result::Result::Ok(inner),
4516                other => ::std::result::Result::Err(other),
4517            }
4518        }
4519    }
4520    impl ::std::convert::From<ToolSearchToolRegex20251119> for ToolUnion {
4521        fn from(value: ToolSearchToolRegex20251119) -> Self {
4522            ToolUnion::ToolSearchToolRegex20251119(value)
4523        }
4524    }
4525    impl ::std::convert::TryFrom<ToolUnion> for ToolSearchToolRegex20251119 {
4526        type Error = ToolUnion;
4527        /// # Errors
4528        ///
4529        /// Returns the original enum value if it does not match the
4530        /// `#variant_ident` variant.
4531        fn try_from(value: ToolUnion) -> ::std::result::Result<Self, Self::Error> {
4532            match value {
4533                ToolUnion::ToolSearchToolRegex20251119(inner) => ::std::result::Result::Ok(inner),
4534                other => ::std::result::Result::Err(other),
4535            }
4536        }
4537    }
4538    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
4539    #[serde(untagged)]
4540    pub enum ToolUnion {
4541        Tool(Tool),
4542        ToolBash20250124(ToolBash20250124),
4543        CodeExecutionTool20250522(CodeExecutionTool20250522),
4544        CodeExecutionTool20250825(CodeExecutionTool20250825),
4545        CodeExecutionTool20260120(CodeExecutionTool20260120),
4546        MemoryTool20250818(MemoryTool20250818),
4547        ToolTextEditor20250124(ToolTextEditor20250124),
4548        ToolTextEditor20250429(ToolTextEditor20250429),
4549        ToolTextEditor20250728(ToolTextEditor20250728),
4550        WebSearchTool20250305(WebSearchTool20250305),
4551        WebSearchTool20260209(WebSearchTool20260209),
4552        WebFetchTool20250910(WebFetchTool20250910),
4553        WebFetchTool20260209(WebFetchTool20260209),
4554        WebFetchTool20260309(WebFetchTool20260309),
4555        #[serde(rename = "ToolSearchToolBm25_20251119")]
4556        ToolSearchToolBm2520251119(ToolSearchToolBm2520251119),
4557        ToolSearchToolRegex20251119(ToolSearchToolRegex20251119),
4558    }
4559    impl ::std::convert::From<String> for SystemPrompt {
4560        fn from(value: String) -> Self {
4561            SystemPrompt::SystemPromptVariant0(value)
4562        }
4563    }
4564    impl ::std::convert::TryFrom<SystemPrompt> for String {
4565        type Error = SystemPrompt;
4566        /// # Errors
4567        ///
4568        /// Returns the original enum value if it does not match the
4569        /// `#variant_ident` variant.
4570        fn try_from(value: SystemPrompt) -> ::std::result::Result<Self, Self::Error> {
4571            match value {
4572                SystemPrompt::SystemPromptVariant0(inner) => ::std::result::Result::Ok(inner),
4573                other => ::std::result::Result::Err(other),
4574            }
4575        }
4576    }
4577    impl ::std::convert::From<Vec<TextBlockParam>> for SystemPrompt {
4578        fn from(value: Vec<TextBlockParam>) -> Self {
4579            SystemPrompt::SystemPromptVariant1(value)
4580        }
4581    }
4582    impl ::std::convert::TryFrom<SystemPrompt> for Vec<TextBlockParam> {
4583        type Error = SystemPrompt;
4584        /// # Errors
4585        ///
4586        /// Returns the original enum value if it does not match the
4587        /// `#variant_ident` variant.
4588        fn try_from(value: SystemPrompt) -> ::std::result::Result<Self, Self::Error> {
4589            match value {
4590                SystemPrompt::SystemPromptVariant1(inner) => ::std::result::Result::Ok(inner),
4591                other => ::std::result::Result::Err(other),
4592            }
4593        }
4594    }
4595    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
4596    #[serde(untagged)]
4597    pub enum SystemPrompt {
4598        SystemPromptVariant0(String),
4599        SystemPromptVariant1(Vec<TextBlockParam>),
4600    }
4601    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
4602    pub enum CreateMessageParamsServiceTier {
4603        #[serde(rename = "auto")]
4604        Auto,
4605        #[serde(rename = "standard_only")]
4606        StandardOnly,
4607    }
4608    impl ::std::fmt::Display for CreateMessageParamsServiceTier {
4609        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
4610            match self {
4611                Self::Auto => ::std::write!(__f, "auto"),
4612                Self::StandardOnly => ::std::write!(__f, "standard_only"),
4613            }
4614        }
4615    }
4616    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
4617    pub struct CreateMessageParams {
4618        /// 生成停止前的最大 token 数。设 0 时仅 prewarm prompt cache,
4619        /// 不产生回复。不同模型上限不同。
4620        pub max_tokens: i64,
4621        pub messages: Vec<MessageParam>,
4622        pub model: Model,
4623        #[serde(skip_serializing_if = "Option::is_none")]
4624        pub cache_control: Option<CacheControlEphemeral>,
4625        #[serde(skip_serializing_if = "Option::is_none")]
4626        /// 跨请求复用的 container id。
4627        pub container: Option<String>,
4628        #[serde(skip_serializing_if = "Option::is_none")]
4629        /// 指定推理地理区域;不传则用 workspace 的 default_inference_geo。
4630        pub inference_geo: Option<String>,
4631        #[serde(skip_serializing_if = "Option::is_none")]
4632        pub metadata: Option<Metadata>,
4633        #[serde(skip_serializing_if = "Option::is_none")]
4634        pub output_config: Option<OutputConfig>,
4635        #[serde(skip_serializing_if = "Option::is_none")]
4636        pub service_tier: Option<CreateMessageParamsServiceTier>,
4637        #[serde(skip_serializing_if = "Option::is_none")]
4638        pub stop_sequences: Option<Vec<String>>,
4639        #[serde(skip_serializing_if = "Option::is_none")]
4640        /// 是否走 SSE 流。
4641        pub stream: Option<bool>,
4642        #[serde(skip_serializing_if = "Option::is_none")]
4643        pub system: Option<SystemPrompt>,
4644        #[serde(skip_serializing_if = "Option::is_none")]
4645        pub temperature: Option<f32>,
4646        #[serde(skip_serializing_if = "Option::is_none")]
4647        pub thinking: Option<ThinkingConfigParam>,
4648        #[serde(skip_serializing_if = "Option::is_none")]
4649        pub tool_choice: Option<ToolChoice>,
4650        #[serde(skip_serializing_if = "Option::is_none")]
4651        pub tools: Option<Vec<ToolUnion>>,
4652        #[serde(skip_serializing_if = "Option::is_none")]
4653        pub top_k: Option<i64>,
4654        #[serde(skip_serializing_if = "Option::is_none")]
4655        pub top_p: Option<f32>,
4656    }
4657    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
4658    pub enum TextBlockType {
4659        #[serde(rename = "text")]
4660        Text,
4661    }
4662    impl ::std::fmt::Display for TextBlockType {
4663        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
4664            match self {
4665                Self::Text => ::std::write!(__f, "text"),
4666            }
4667        }
4668    }
4669    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
4670    pub struct TextBlock {
4671        #[serde(default)]
4672        pub citations: Vec<TextCitation>,
4673        pub text: String,
4674        pub r#type: TextBlockType,
4675    }
4676    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
4677    pub enum ThinkingBlockType {
4678        #[serde(rename = "thinking")]
4679        Thinking,
4680    }
4681    impl ::std::fmt::Display for ThinkingBlockType {
4682        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
4683            match self {
4684                Self::Thinking => ::std::write!(__f, "thinking"),
4685            }
4686        }
4687    }
4688    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
4689    pub struct ThinkingBlock {
4690        pub signature: String,
4691        pub thinking: String,
4692        pub r#type: ThinkingBlockType,
4693    }
4694    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
4695    pub enum RedactedThinkingBlockType {
4696        #[serde(rename = "redacted_thinking")]
4697        RedactedThinking,
4698    }
4699    impl ::std::fmt::Display for RedactedThinkingBlockType {
4700        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
4701            match self {
4702                Self::RedactedThinking => ::std::write!(__f, "redacted_thinking"),
4703            }
4704        }
4705    }
4706    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
4707    pub struct RedactedThinkingBlock {
4708        pub data: String,
4709        pub r#type: RedactedThinkingBlockType,
4710    }
4711    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
4712    pub enum ToolUseBlockType {
4713        #[serde(rename = "tool_use")]
4714        ToolUse,
4715    }
4716    impl ::std::fmt::Display for ToolUseBlockType {
4717        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
4718            match self {
4719                Self::ToolUse => ::std::write!(__f, "tool_use"),
4720            }
4721        }
4722    }
4723    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
4724    pub struct ToolUseBlock {
4725        pub id: String,
4726        #[serde(skip_serializing_if = "Option::is_none")]
4727        pub caller: Option<Caller>,
4728        pub input: ::std::collections::BTreeMap<String, ::serde_json::Value>,
4729        pub name: String,
4730        pub r#type: ToolUseBlockType,
4731    }
4732    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
4733    pub enum ServerToolUseBlockName {
4734        #[serde(rename = "web_search")]
4735        WebSearch,
4736        #[serde(rename = "web_fetch")]
4737        WebFetch,
4738        #[serde(rename = "code_execution")]
4739        CodeExecution,
4740        #[serde(rename = "bash_code_execution")]
4741        BashCodeExecution,
4742        #[serde(rename = "text_editor_code_execution")]
4743        TextEditorCodeExecution,
4744        #[serde(rename = "tool_search_tool_regex")]
4745        ToolSearchToolRegex,
4746        #[serde(rename = "tool_search_tool_bm25")]
4747        ToolSearchToolBm25,
4748    }
4749    impl ::std::fmt::Display for ServerToolUseBlockName {
4750        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
4751            match self {
4752                Self::WebSearch => ::std::write!(__f, "web_search"),
4753                Self::WebFetch => ::std::write!(__f, "web_fetch"),
4754                Self::CodeExecution => ::std::write!(__f, "code_execution"),
4755                Self::BashCodeExecution => ::std::write!(__f, "bash_code_execution"),
4756                Self::TextEditorCodeExecution => {
4757                    ::std::write!(__f, "text_editor_code_execution")
4758                }
4759                Self::ToolSearchToolRegex => ::std::write!(__f, "tool_search_tool_regex"),
4760                Self::ToolSearchToolBm25 => ::std::write!(__f, "tool_search_tool_bm25"),
4761            }
4762        }
4763    }
4764    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
4765    pub enum ServerToolUseBlockType {
4766        #[serde(rename = "server_tool_use")]
4767        ServerToolUse,
4768    }
4769    impl ::std::fmt::Display for ServerToolUseBlockType {
4770        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
4771            match self {
4772                Self::ServerToolUse => ::std::write!(__f, "server_tool_use"),
4773            }
4774        }
4775    }
4776    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
4777    pub struct ServerToolUseBlock {
4778        pub id: String,
4779        #[serde(skip_serializing_if = "Option::is_none")]
4780        pub caller: Option<Caller>,
4781        pub input: ::std::collections::BTreeMap<String, ::serde_json::Value>,
4782        pub name: ServerToolUseBlockName,
4783        pub r#type: ServerToolUseBlockType,
4784    }
4785    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
4786    pub enum WebSearchResultBlockType {
4787        #[serde(rename = "web_search_result")]
4788        WebSearchResult,
4789    }
4790    impl ::std::fmt::Display for WebSearchResultBlockType {
4791        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
4792            match self {
4793                Self::WebSearchResult => ::std::write!(__f, "web_search_result"),
4794            }
4795        }
4796    }
4797    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
4798    pub struct WebSearchResultBlock {
4799        pub encrypted_content: String,
4800        pub page_age: String,
4801        pub title: String,
4802        pub r#type: WebSearchResultBlockType,
4803        pub url: String,
4804    }
4805    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
4806    pub enum WebSearchToolResultErrorErrorCode {
4807        #[serde(rename = "invalid_tool_input")]
4808        InvalidToolInput,
4809        #[serde(rename = "unavailable")]
4810        Unavailable,
4811        #[serde(rename = "max_uses_exceeded")]
4812        MaxUsesExceeded,
4813        #[serde(rename = "too_many_requests")]
4814        TooManyRequests,
4815        #[serde(rename = "query_too_long")]
4816        QueryTooLong,
4817        #[serde(rename = "request_too_large")]
4818        RequestTooLarge,
4819    }
4820    impl ::std::fmt::Display for WebSearchToolResultErrorErrorCode {
4821        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
4822            match self {
4823                Self::InvalidToolInput => ::std::write!(__f, "invalid_tool_input"),
4824                Self::Unavailable => ::std::write!(__f, "unavailable"),
4825                Self::MaxUsesExceeded => ::std::write!(__f, "max_uses_exceeded"),
4826                Self::TooManyRequests => ::std::write!(__f, "too_many_requests"),
4827                Self::QueryTooLong => ::std::write!(__f, "query_too_long"),
4828                Self::RequestTooLarge => ::std::write!(__f, "request_too_large"),
4829            }
4830        }
4831    }
4832    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
4833    pub enum WebSearchToolResultErrorType {
4834        #[serde(rename = "web_search_tool_result_error")]
4835        WebSearchToolResultError,
4836    }
4837    impl ::std::fmt::Display for WebSearchToolResultErrorType {
4838        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
4839            match self {
4840                Self::WebSearchToolResultError => {
4841                    ::std::write!(__f, "web_search_tool_result_error")
4842                }
4843            }
4844        }
4845    }
4846    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
4847    pub struct WebSearchToolResultError {
4848        pub error_code: WebSearchToolResultErrorErrorCode,
4849        pub r#type: WebSearchToolResultErrorType,
4850    }
4851    impl ::std::convert::From<WebSearchToolResultError> for WebSearchToolResultBlockContent {
4852        fn from(value: WebSearchToolResultError) -> Self {
4853            WebSearchToolResultBlockContent::WebSearchToolResultError(value)
4854        }
4855    }
4856    impl ::std::convert::TryFrom<WebSearchToolResultBlockContent> for WebSearchToolResultError {
4857        type Error = WebSearchToolResultBlockContent;
4858        /// # Errors
4859        ///
4860        /// Returns the original enum value if it does not match the
4861        /// `#variant_ident` variant.
4862        fn try_from(
4863            value: WebSearchToolResultBlockContent,
4864        ) -> ::std::result::Result<Self, Self::Error> {
4865            match value {
4866                WebSearchToolResultBlockContent::WebSearchToolResultError(inner) => {
4867                    ::std::result::Result::Ok(inner)
4868                }
4869                other => ::std::result::Result::Err(other),
4870            }
4871        }
4872    }
4873    impl ::std::convert::From<Vec<WebSearchResultBlock>> for WebSearchToolResultBlockContent {
4874        fn from(value: Vec<WebSearchResultBlock>) -> Self {
4875            WebSearchToolResultBlockContent::WebSearchToolResultBlockContentVariant1(value)
4876        }
4877    }
4878    impl ::std::convert::TryFrom<WebSearchToolResultBlockContent> for Vec<WebSearchResultBlock> {
4879        type Error = WebSearchToolResultBlockContent;
4880        /// # Errors
4881        ///
4882        /// Returns the original enum value if it does not match the
4883        /// `#variant_ident` variant.
4884        fn try_from(
4885            value: WebSearchToolResultBlockContent,
4886        ) -> ::std::result::Result<Self, Self::Error> {
4887            match value {
4888                WebSearchToolResultBlockContent::WebSearchToolResultBlockContentVariant1(inner) => {
4889                    ::std::result::Result::Ok(inner)
4890                }
4891                other => ::std::result::Result::Err(other),
4892            }
4893        }
4894    }
4895    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
4896    #[serde(untagged)]
4897    pub enum WebSearchToolResultBlockContent {
4898        WebSearchToolResultError(WebSearchToolResultError),
4899        WebSearchToolResultBlockContentVariant1(Vec<WebSearchResultBlock>),
4900    }
4901    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
4902    pub enum WebSearchToolResultBlockType {
4903        #[serde(rename = "web_search_tool_result")]
4904        WebSearchToolResult,
4905    }
4906    impl ::std::fmt::Display for WebSearchToolResultBlockType {
4907        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
4908            match self {
4909                Self::WebSearchToolResult => ::std::write!(__f, "web_search_tool_result"),
4910            }
4911        }
4912    }
4913    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
4914    pub struct WebSearchToolResultBlock {
4915        #[serde(skip_serializing_if = "Option::is_none")]
4916        pub caller: Option<Caller>,
4917        pub content: WebSearchToolResultBlockContent,
4918        pub tool_use_id: String,
4919        pub r#type: WebSearchToolResultBlockType,
4920    }
4921    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
4922    pub enum WebFetchToolResultErrorBlockErrorCode {
4923        #[serde(rename = "invalid_tool_input")]
4924        InvalidToolInput,
4925        #[serde(rename = "url_too_long")]
4926        UrlTooLong,
4927        #[serde(rename = "url_not_allowed")]
4928        UrlNotAllowed,
4929        #[serde(rename = "url_not_accessible")]
4930        UrlNotAccessible,
4931        #[serde(rename = "unsupported_content_type")]
4932        UnsupportedContentType,
4933        #[serde(rename = "too_many_requests")]
4934        TooManyRequests,
4935        #[serde(rename = "max_uses_exceeded")]
4936        MaxUsesExceeded,
4937        #[serde(rename = "unavailable")]
4938        Unavailable,
4939    }
4940    impl ::std::fmt::Display for WebFetchToolResultErrorBlockErrorCode {
4941        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
4942            match self {
4943                Self::InvalidToolInput => ::std::write!(__f, "invalid_tool_input"),
4944                Self::UrlTooLong => ::std::write!(__f, "url_too_long"),
4945                Self::UrlNotAllowed => ::std::write!(__f, "url_not_allowed"),
4946                Self::UrlNotAccessible => ::std::write!(__f, "url_not_accessible"),
4947                Self::UnsupportedContentType => {
4948                    ::std::write!(__f, "unsupported_content_type")
4949                }
4950                Self::TooManyRequests => ::std::write!(__f, "too_many_requests"),
4951                Self::MaxUsesExceeded => ::std::write!(__f, "max_uses_exceeded"),
4952                Self::Unavailable => ::std::write!(__f, "unavailable"),
4953            }
4954        }
4955    }
4956    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
4957    pub enum WebFetchToolResultErrorBlockType {
4958        #[serde(rename = "web_fetch_tool_result_error")]
4959        WebFetchToolResultError,
4960    }
4961    impl ::std::fmt::Display for WebFetchToolResultErrorBlockType {
4962        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
4963            match self {
4964                Self::WebFetchToolResultError => {
4965                    ::std::write!(__f, "web_fetch_tool_result_error")
4966                }
4967            }
4968        }
4969    }
4970    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
4971    pub struct WebFetchToolResultErrorBlock {
4972        pub error_code: WebFetchToolResultErrorBlockErrorCode,
4973        pub r#type: WebFetchToolResultErrorBlockType,
4974    }
4975    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
4976    pub enum DocumentBlockType {
4977        #[serde(rename = "document")]
4978        Document,
4979    }
4980    impl ::std::fmt::Display for DocumentBlockType {
4981        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
4982            match self {
4983                Self::Document => ::std::write!(__f, "document"),
4984            }
4985        }
4986    }
4987    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
4988    pub struct DocumentBlock {
4989        pub citations: CitationsConfig,
4990        pub source: WebFetchDocumentSource,
4991        pub title: String,
4992        pub r#type: DocumentBlockType,
4993    }
4994    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
4995    pub enum WebFetchBlockType {
4996        #[serde(rename = "web_fetch_result")]
4997        WebFetchResult,
4998    }
4999    impl ::std::fmt::Display for WebFetchBlockType {
5000        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
5001            match self {
5002                Self::WebFetchResult => ::std::write!(__f, "web_fetch_result"),
5003            }
5004        }
5005    }
5006    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
5007    pub struct WebFetchBlock {
5008        pub content: DocumentBlock,
5009        pub retrieved_at: String,
5010        pub r#type: WebFetchBlockType,
5011        pub url: String,
5012    }
5013    impl ::std::convert::From<WebFetchToolResultErrorBlock> for WebFetchToolResultBlockContent {
5014        fn from(value: WebFetchToolResultErrorBlock) -> Self {
5015            WebFetchToolResultBlockContent::WebFetchToolResultErrorBlock(value)
5016        }
5017    }
5018    impl ::std::convert::TryFrom<WebFetchToolResultBlockContent> for WebFetchToolResultErrorBlock {
5019        type Error = WebFetchToolResultBlockContent;
5020        /// # Errors
5021        ///
5022        /// Returns the original enum value if it does not match the
5023        /// `#variant_ident` variant.
5024        fn try_from(
5025            value: WebFetchToolResultBlockContent,
5026        ) -> ::std::result::Result<Self, Self::Error> {
5027            match value {
5028                WebFetchToolResultBlockContent::WebFetchToolResultErrorBlock(inner) => {
5029                    ::std::result::Result::Ok(inner)
5030                }
5031                other => ::std::result::Result::Err(other),
5032            }
5033        }
5034    }
5035    impl ::std::convert::From<WebFetchBlock> for WebFetchToolResultBlockContent {
5036        fn from(value: WebFetchBlock) -> Self {
5037            WebFetchToolResultBlockContent::WebFetchBlock(value)
5038        }
5039    }
5040    impl ::std::convert::TryFrom<WebFetchToolResultBlockContent> for WebFetchBlock {
5041        type Error = WebFetchToolResultBlockContent;
5042        /// # Errors
5043        ///
5044        /// Returns the original enum value if it does not match the
5045        /// `#variant_ident` variant.
5046        fn try_from(
5047            value: WebFetchToolResultBlockContent,
5048        ) -> ::std::result::Result<Self, Self::Error> {
5049            match value {
5050                WebFetchToolResultBlockContent::WebFetchBlock(inner) => {
5051                    ::std::result::Result::Ok(inner)
5052                }
5053                other => ::std::result::Result::Err(other),
5054            }
5055        }
5056    }
5057    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
5058    #[serde(untagged)]
5059    pub enum WebFetchToolResultBlockContent {
5060        WebFetchToolResultErrorBlock(WebFetchToolResultErrorBlock),
5061        WebFetchBlock(WebFetchBlock),
5062    }
5063    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
5064    pub enum WebFetchToolResultBlockType {
5065        #[serde(rename = "web_fetch_tool_result")]
5066        WebFetchToolResult,
5067    }
5068    impl ::std::fmt::Display for WebFetchToolResultBlockType {
5069        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
5070            match self {
5071                Self::WebFetchToolResult => ::std::write!(__f, "web_fetch_tool_result"),
5072            }
5073        }
5074    }
5075    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
5076    pub struct WebFetchToolResultBlock {
5077        #[serde(skip_serializing_if = "Option::is_none")]
5078        pub caller: Option<Caller>,
5079        pub content: WebFetchToolResultBlockContent,
5080        pub tool_use_id: String,
5081        pub r#type: WebFetchToolResultBlockType,
5082    }
5083    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
5084    pub enum CodeExecutionOutputBlockType {
5085        #[serde(rename = "code_execution_output")]
5086        CodeExecutionOutput,
5087    }
5088    impl ::std::fmt::Display for CodeExecutionOutputBlockType {
5089        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
5090            match self {
5091                Self::CodeExecutionOutput => ::std::write!(__f, "code_execution_output"),
5092            }
5093        }
5094    }
5095    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
5096    pub struct CodeExecutionOutputBlock {
5097        pub file_id: String,
5098        pub r#type: CodeExecutionOutputBlockType,
5099    }
5100    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
5101    pub enum CodeExecutionToolResultErrorErrorCode {
5102        #[serde(rename = "invalid_tool_input")]
5103        InvalidToolInput,
5104        #[serde(rename = "unavailable")]
5105        Unavailable,
5106        #[serde(rename = "too_many_requests")]
5107        TooManyRequests,
5108        #[serde(rename = "execution_time_exceeded")]
5109        ExecutionTimeExceeded,
5110    }
5111    impl ::std::fmt::Display for CodeExecutionToolResultErrorErrorCode {
5112        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
5113            match self {
5114                Self::InvalidToolInput => ::std::write!(__f, "invalid_tool_input"),
5115                Self::Unavailable => ::std::write!(__f, "unavailable"),
5116                Self::TooManyRequests => ::std::write!(__f, "too_many_requests"),
5117                Self::ExecutionTimeExceeded => {
5118                    ::std::write!(__f, "execution_time_exceeded")
5119                }
5120            }
5121        }
5122    }
5123    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
5124    pub enum CodeExecutionToolResultErrorType {
5125        #[serde(rename = "code_execution_tool_result_error")]
5126        CodeExecutionToolResultError,
5127    }
5128    impl ::std::fmt::Display for CodeExecutionToolResultErrorType {
5129        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
5130            match self {
5131                Self::CodeExecutionToolResultError => {
5132                    ::std::write!(__f, "code_execution_tool_result_error")
5133                }
5134            }
5135        }
5136    }
5137    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
5138    pub struct CodeExecutionToolResultError {
5139        pub error_code: CodeExecutionToolResultErrorErrorCode,
5140        pub r#type: CodeExecutionToolResultErrorType,
5141    }
5142    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
5143    pub enum CodeExecutionResultBlockType {
5144        #[serde(rename = "code_execution_result")]
5145        CodeExecutionResult,
5146    }
5147    impl ::std::fmt::Display for CodeExecutionResultBlockType {
5148        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
5149            match self {
5150                Self::CodeExecutionResult => ::std::write!(__f, "code_execution_result"),
5151            }
5152        }
5153    }
5154    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
5155    pub struct CodeExecutionResultBlock {
5156        pub content: Vec<CodeExecutionOutputBlock>,
5157        pub return_code: i64,
5158        pub stderr: String,
5159        pub stdout: String,
5160        pub r#type: CodeExecutionResultBlockType,
5161    }
5162    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
5163    pub enum EncryptedCodeExecutionResultBlockType {
5164        #[serde(rename = "encrypted_code_execution_result")]
5165        EncryptedCodeExecutionResult,
5166    }
5167    impl ::std::fmt::Display for EncryptedCodeExecutionResultBlockType {
5168        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
5169            match self {
5170                Self::EncryptedCodeExecutionResult => {
5171                    ::std::write!(__f, "encrypted_code_execution_result")
5172                }
5173            }
5174        }
5175    }
5176    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
5177    pub struct EncryptedCodeExecutionResultBlock {
5178        pub content: Vec<CodeExecutionOutputBlock>,
5179        pub encrypted_stdout: String,
5180        pub return_code: i64,
5181        pub stderr: String,
5182        pub r#type: EncryptedCodeExecutionResultBlockType,
5183    }
5184    impl ::std::convert::From<CodeExecutionToolResultError> for CodeExecutionToolResultBlockContent {
5185        fn from(value: CodeExecutionToolResultError) -> Self {
5186            CodeExecutionToolResultBlockContent::CodeExecutionToolResultError(value)
5187        }
5188    }
5189    impl ::std::convert::TryFrom<CodeExecutionToolResultBlockContent> for CodeExecutionToolResultError {
5190        type Error = CodeExecutionToolResultBlockContent;
5191        /// # Errors
5192        ///
5193        /// Returns the original enum value if it does not match the
5194        /// `#variant_ident` variant.
5195        fn try_from(
5196            value: CodeExecutionToolResultBlockContent,
5197        ) -> ::std::result::Result<Self, Self::Error> {
5198            match value {
5199                CodeExecutionToolResultBlockContent::CodeExecutionToolResultError(inner) => {
5200                    ::std::result::Result::Ok(inner)
5201                }
5202                other => ::std::result::Result::Err(other),
5203            }
5204        }
5205    }
5206    impl ::std::convert::From<CodeExecutionResultBlock> for CodeExecutionToolResultBlockContent {
5207        fn from(value: CodeExecutionResultBlock) -> Self {
5208            CodeExecutionToolResultBlockContent::CodeExecutionResultBlock(value)
5209        }
5210    }
5211    impl ::std::convert::TryFrom<CodeExecutionToolResultBlockContent> for CodeExecutionResultBlock {
5212        type Error = CodeExecutionToolResultBlockContent;
5213        /// # Errors
5214        ///
5215        /// Returns the original enum value if it does not match the
5216        /// `#variant_ident` variant.
5217        fn try_from(
5218            value: CodeExecutionToolResultBlockContent,
5219        ) -> ::std::result::Result<Self, Self::Error> {
5220            match value {
5221                CodeExecutionToolResultBlockContent::CodeExecutionResultBlock(inner) => {
5222                    ::std::result::Result::Ok(inner)
5223                }
5224                other => ::std::result::Result::Err(other),
5225            }
5226        }
5227    }
5228    impl ::std::convert::From<EncryptedCodeExecutionResultBlock>
5229        for CodeExecutionToolResultBlockContent
5230    {
5231        fn from(value: EncryptedCodeExecutionResultBlock) -> Self {
5232            CodeExecutionToolResultBlockContent::EncryptedCodeExecutionResultBlock(value)
5233        }
5234    }
5235    impl ::std::convert::TryFrom<CodeExecutionToolResultBlockContent>
5236        for EncryptedCodeExecutionResultBlock
5237    {
5238        type Error = CodeExecutionToolResultBlockContent;
5239        /// # Errors
5240        ///
5241        /// Returns the original enum value if it does not match the
5242        /// `#variant_ident` variant.
5243        fn try_from(
5244            value: CodeExecutionToolResultBlockContent,
5245        ) -> ::std::result::Result<Self, Self::Error> {
5246            match value {
5247                CodeExecutionToolResultBlockContent::EncryptedCodeExecutionResultBlock(inner) => {
5248                    ::std::result::Result::Ok(inner)
5249                }
5250                other => ::std::result::Result::Err(other),
5251            }
5252        }
5253    }
5254    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
5255    #[serde(untagged)]
5256    pub enum CodeExecutionToolResultBlockContent {
5257        CodeExecutionToolResultError(CodeExecutionToolResultError),
5258        CodeExecutionResultBlock(CodeExecutionResultBlock),
5259        EncryptedCodeExecutionResultBlock(EncryptedCodeExecutionResultBlock),
5260    }
5261    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
5262    pub enum CodeExecutionToolResultBlockType {
5263        #[serde(rename = "code_execution_tool_result")]
5264        CodeExecutionToolResult,
5265    }
5266    impl ::std::fmt::Display for CodeExecutionToolResultBlockType {
5267        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
5268            match self {
5269                Self::CodeExecutionToolResult => {
5270                    ::std::write!(__f, "code_execution_tool_result")
5271                }
5272            }
5273        }
5274    }
5275    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
5276    pub struct CodeExecutionToolResultBlock {
5277        pub content: CodeExecutionToolResultBlockContent,
5278        pub tool_use_id: String,
5279        pub r#type: CodeExecutionToolResultBlockType,
5280    }
5281    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
5282    pub enum BashCodeExecutionOutputBlockType {
5283        #[serde(rename = "bash_code_execution_output")]
5284        BashCodeExecutionOutput,
5285    }
5286    impl ::std::fmt::Display for BashCodeExecutionOutputBlockType {
5287        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
5288            match self {
5289                Self::BashCodeExecutionOutput => {
5290                    ::std::write!(__f, "bash_code_execution_output")
5291                }
5292            }
5293        }
5294    }
5295    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
5296    pub struct BashCodeExecutionOutputBlock {
5297        pub file_id: String,
5298        pub r#type: BashCodeExecutionOutputBlockType,
5299    }
5300    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
5301    pub enum BashCodeExecutionToolResultErrorErrorCode {
5302        #[serde(rename = "invalid_tool_input")]
5303        InvalidToolInput,
5304        #[serde(rename = "unavailable")]
5305        Unavailable,
5306        #[serde(rename = "too_many_requests")]
5307        TooManyRequests,
5308        #[serde(rename = "execution_time_exceeded")]
5309        ExecutionTimeExceeded,
5310        #[serde(rename = "output_file_too_large")]
5311        OutputFileTooLarge,
5312    }
5313    impl ::std::fmt::Display for BashCodeExecutionToolResultErrorErrorCode {
5314        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
5315            match self {
5316                Self::InvalidToolInput => ::std::write!(__f, "invalid_tool_input"),
5317                Self::Unavailable => ::std::write!(__f, "unavailable"),
5318                Self::TooManyRequests => ::std::write!(__f, "too_many_requests"),
5319                Self::ExecutionTimeExceeded => {
5320                    ::std::write!(__f, "execution_time_exceeded")
5321                }
5322                Self::OutputFileTooLarge => ::std::write!(__f, "output_file_too_large"),
5323            }
5324        }
5325    }
5326    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
5327    pub enum BashCodeExecutionToolResultErrorType {
5328        #[serde(rename = "bash_code_execution_tool_result_error")]
5329        BashCodeExecutionToolResultError,
5330    }
5331    impl ::std::fmt::Display for BashCodeExecutionToolResultErrorType {
5332        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
5333            match self {
5334                Self::BashCodeExecutionToolResultError => {
5335                    ::std::write!(__f, "bash_code_execution_tool_result_error")
5336                }
5337            }
5338        }
5339    }
5340    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
5341    pub struct BashCodeExecutionToolResultError {
5342        pub error_code: BashCodeExecutionToolResultErrorErrorCode,
5343        pub r#type: BashCodeExecutionToolResultErrorType,
5344    }
5345    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
5346    pub enum BashCodeExecutionResultBlockType {
5347        #[serde(rename = "bash_code_execution_result")]
5348        BashCodeExecutionResult,
5349    }
5350    impl ::std::fmt::Display for BashCodeExecutionResultBlockType {
5351        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
5352            match self {
5353                Self::BashCodeExecutionResult => {
5354                    ::std::write!(__f, "bash_code_execution_result")
5355                }
5356            }
5357        }
5358    }
5359    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
5360    pub struct BashCodeExecutionResultBlock {
5361        pub content: Vec<BashCodeExecutionOutputBlock>,
5362        pub return_code: i64,
5363        pub stderr: String,
5364        pub stdout: String,
5365        pub r#type: BashCodeExecutionResultBlockType,
5366    }
5367    impl ::std::convert::From<BashCodeExecutionToolResultError>
5368        for BashCodeExecutionToolResultBlockContent
5369    {
5370        fn from(value: BashCodeExecutionToolResultError) -> Self {
5371            BashCodeExecutionToolResultBlockContent::BashCodeExecutionToolResultError(value)
5372        }
5373    }
5374    impl ::std::convert::TryFrom<BashCodeExecutionToolResultBlockContent>
5375        for BashCodeExecutionToolResultError
5376    {
5377        type Error = BashCodeExecutionToolResultBlockContent;
5378        /// # Errors
5379        ///
5380        /// Returns the original enum value if it does not match the
5381        /// `#variant_ident` variant.
5382        fn try_from(
5383            value: BashCodeExecutionToolResultBlockContent,
5384        ) -> ::std::result::Result<Self, Self::Error> {
5385            match value {
5386                BashCodeExecutionToolResultBlockContent::BashCodeExecutionToolResultError(
5387                    inner,
5388                ) => ::std::result::Result::Ok(inner),
5389                other => ::std::result::Result::Err(other),
5390            }
5391        }
5392    }
5393    impl ::std::convert::From<BashCodeExecutionResultBlock>
5394        for BashCodeExecutionToolResultBlockContent
5395    {
5396        fn from(value: BashCodeExecutionResultBlock) -> Self {
5397            BashCodeExecutionToolResultBlockContent::BashCodeExecutionResultBlock(value)
5398        }
5399    }
5400    impl ::std::convert::TryFrom<BashCodeExecutionToolResultBlockContent>
5401        for BashCodeExecutionResultBlock
5402    {
5403        type Error = BashCodeExecutionToolResultBlockContent;
5404        /// # Errors
5405        ///
5406        /// Returns the original enum value if it does not match the
5407        /// `#variant_ident` variant.
5408        fn try_from(
5409            value: BashCodeExecutionToolResultBlockContent,
5410        ) -> ::std::result::Result<Self, Self::Error> {
5411            match value {
5412                BashCodeExecutionToolResultBlockContent::BashCodeExecutionResultBlock(inner) => {
5413                    ::std::result::Result::Ok(inner)
5414                }
5415                other => ::std::result::Result::Err(other),
5416            }
5417        }
5418    }
5419    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
5420    #[serde(untagged)]
5421    pub enum BashCodeExecutionToolResultBlockContent {
5422        BashCodeExecutionToolResultError(BashCodeExecutionToolResultError),
5423        BashCodeExecutionResultBlock(BashCodeExecutionResultBlock),
5424    }
5425    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
5426    pub enum BashCodeExecutionToolResultBlockType {
5427        #[serde(rename = "bash_code_execution_tool_result")]
5428        BashCodeExecutionToolResult,
5429    }
5430    impl ::std::fmt::Display for BashCodeExecutionToolResultBlockType {
5431        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
5432            match self {
5433                Self::BashCodeExecutionToolResult => {
5434                    ::std::write!(__f, "bash_code_execution_tool_result")
5435                }
5436            }
5437        }
5438    }
5439    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
5440    pub struct BashCodeExecutionToolResultBlock {
5441        pub content: BashCodeExecutionToolResultBlockContent,
5442        pub tool_use_id: String,
5443        pub r#type: BashCodeExecutionToolResultBlockType,
5444    }
5445    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
5446    pub enum TextEditorCodeExecutionToolResultErrorErrorCode {
5447        #[serde(rename = "invalid_tool_input")]
5448        InvalidToolInput,
5449        #[serde(rename = "unavailable")]
5450        Unavailable,
5451        #[serde(rename = "too_many_requests")]
5452        TooManyRequests,
5453        #[serde(rename = "execution_time_exceeded")]
5454        ExecutionTimeExceeded,
5455        #[serde(rename = "file_not_found")]
5456        FileNotFound,
5457    }
5458    impl ::std::fmt::Display for TextEditorCodeExecutionToolResultErrorErrorCode {
5459        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
5460            match self {
5461                Self::InvalidToolInput => ::std::write!(__f, "invalid_tool_input"),
5462                Self::Unavailable => ::std::write!(__f, "unavailable"),
5463                Self::TooManyRequests => ::std::write!(__f, "too_many_requests"),
5464                Self::ExecutionTimeExceeded => {
5465                    ::std::write!(__f, "execution_time_exceeded")
5466                }
5467                Self::FileNotFound => ::std::write!(__f, "file_not_found"),
5468            }
5469        }
5470    }
5471    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
5472    pub enum TextEditorCodeExecutionToolResultErrorType {
5473        #[serde(rename = "text_editor_code_execution_tool_result_error")]
5474        TextEditorCodeExecutionToolResultError,
5475    }
5476    impl ::std::fmt::Display for TextEditorCodeExecutionToolResultErrorType {
5477        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
5478            match self {
5479                Self::TextEditorCodeExecutionToolResultError => {
5480                    ::std::write!(__f, "text_editor_code_execution_tool_result_error")
5481                }
5482            }
5483        }
5484    }
5485    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
5486    pub struct TextEditorCodeExecutionToolResultError {
5487        pub error_code: TextEditorCodeExecutionToolResultErrorErrorCode,
5488        pub error_message: String,
5489        pub r#type: TextEditorCodeExecutionToolResultErrorType,
5490    }
5491    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
5492    pub enum TextEditorCodeExecutionViewResultBlockFileType {
5493        #[serde(rename = "text")]
5494        Text,
5495        #[serde(rename = "image")]
5496        Image,
5497        #[serde(rename = "pdf")]
5498        Pdf,
5499    }
5500    impl ::std::fmt::Display for TextEditorCodeExecutionViewResultBlockFileType {
5501        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
5502            match self {
5503                Self::Text => ::std::write!(__f, "text"),
5504                Self::Image => ::std::write!(__f, "image"),
5505                Self::Pdf => ::std::write!(__f, "pdf"),
5506            }
5507        }
5508    }
5509    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
5510    pub enum TextEditorCodeExecutionViewResultBlockType {
5511        #[serde(rename = "text_editor_code_execution_view_result")]
5512        TextEditorCodeExecutionViewResult,
5513    }
5514    impl ::std::fmt::Display for TextEditorCodeExecutionViewResultBlockType {
5515        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
5516            match self {
5517                Self::TextEditorCodeExecutionViewResult => {
5518                    ::std::write!(__f, "text_editor_code_execution_view_result")
5519                }
5520            }
5521        }
5522    }
5523    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
5524    pub struct TextEditorCodeExecutionViewResultBlock {
5525        pub content: String,
5526        pub file_type: TextEditorCodeExecutionViewResultBlockFileType,
5527        pub num_lines: i64,
5528        pub start_line: i64,
5529        pub total_lines: i64,
5530        pub r#type: TextEditorCodeExecutionViewResultBlockType,
5531    }
5532    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
5533    pub enum TextEditorCodeExecutionCreateResultBlockType {
5534        #[serde(rename = "text_editor_code_execution_create_result")]
5535        TextEditorCodeExecutionCreateResult,
5536    }
5537    impl ::std::fmt::Display for TextEditorCodeExecutionCreateResultBlockType {
5538        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
5539            match self {
5540                Self::TextEditorCodeExecutionCreateResult => {
5541                    ::std::write!(__f, "text_editor_code_execution_create_result")
5542                }
5543            }
5544        }
5545    }
5546    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
5547    pub struct TextEditorCodeExecutionCreateResultBlock {
5548        pub is_file_update: bool,
5549        pub r#type: TextEditorCodeExecutionCreateResultBlockType,
5550    }
5551    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
5552    pub enum TextEditorCodeExecutionStrReplaceResultBlockType {
5553        #[serde(rename = "text_editor_code_execution_str_replace_result")]
5554        TextEditorCodeExecutionStrReplaceResult,
5555    }
5556    impl ::std::fmt::Display for TextEditorCodeExecutionStrReplaceResultBlockType {
5557        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
5558            match self {
5559                Self::TextEditorCodeExecutionStrReplaceResult => {
5560                    ::std::write!(__f, "text_editor_code_execution_str_replace_result")
5561                }
5562            }
5563        }
5564    }
5565    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
5566    pub struct TextEditorCodeExecutionStrReplaceResultBlock {
5567        pub lines: Vec<String>,
5568        pub new_lines: i64,
5569        pub new_start: i64,
5570        pub old_lines: i64,
5571        pub old_start: i64,
5572        pub r#type: TextEditorCodeExecutionStrReplaceResultBlockType,
5573    }
5574    impl ::std::convert::From<TextEditorCodeExecutionToolResultError>
5575        for TextEditorCodeExecutionToolResultBlockContent
5576    {
5577        fn from(value: TextEditorCodeExecutionToolResultError) -> Self {
5578            TextEditorCodeExecutionToolResultBlockContent::TextEditorCodeExecutionToolResultError(
5579                value,
5580            )
5581        }
5582    }
5583    impl ::std::convert::TryFrom<TextEditorCodeExecutionToolResultBlockContent>
5584        for TextEditorCodeExecutionToolResultError
5585    {
5586        type Error = TextEditorCodeExecutionToolResultBlockContent;
5587        /// # Errors
5588        ///
5589        /// Returns the original enum value if it does not match the
5590        /// `#variant_ident` variant.
5591        fn try_from(
5592            value: TextEditorCodeExecutionToolResultBlockContent,
5593        ) -> ::std::result::Result<Self, Self::Error> {
5594            match value {
5595                TextEditorCodeExecutionToolResultBlockContent::TextEditorCodeExecutionToolResultError(
5596                    inner,
5597                ) => ::std::result::Result::Ok(inner),
5598                other => ::std::result::Result::Err(other),
5599            }
5600        }
5601    }
5602    impl ::std::convert::From<TextEditorCodeExecutionViewResultBlock>
5603        for TextEditorCodeExecutionToolResultBlockContent
5604    {
5605        fn from(value: TextEditorCodeExecutionViewResultBlock) -> Self {
5606            TextEditorCodeExecutionToolResultBlockContent::TextEditorCodeExecutionViewResultBlock(
5607                value,
5608            )
5609        }
5610    }
5611    impl ::std::convert::TryFrom<TextEditorCodeExecutionToolResultBlockContent>
5612        for TextEditorCodeExecutionViewResultBlock
5613    {
5614        type Error = TextEditorCodeExecutionToolResultBlockContent;
5615        /// # Errors
5616        ///
5617        /// Returns the original enum value if it does not match the
5618        /// `#variant_ident` variant.
5619        fn try_from(
5620            value: TextEditorCodeExecutionToolResultBlockContent,
5621        ) -> ::std::result::Result<Self, Self::Error> {
5622            match value {
5623                TextEditorCodeExecutionToolResultBlockContent::TextEditorCodeExecutionViewResultBlock(
5624                    inner,
5625                ) => ::std::result::Result::Ok(inner),
5626                other => ::std::result::Result::Err(other),
5627            }
5628        }
5629    }
5630    impl ::std::convert::From<TextEditorCodeExecutionCreateResultBlock>
5631        for TextEditorCodeExecutionToolResultBlockContent
5632    {
5633        fn from(value: TextEditorCodeExecutionCreateResultBlock) -> Self {
5634            TextEditorCodeExecutionToolResultBlockContent::TextEditorCodeExecutionCreateResultBlock(
5635                value,
5636            )
5637        }
5638    }
5639    impl ::std::convert::TryFrom<TextEditorCodeExecutionToolResultBlockContent>
5640        for TextEditorCodeExecutionCreateResultBlock
5641    {
5642        type Error = TextEditorCodeExecutionToolResultBlockContent;
5643        /// # Errors
5644        ///
5645        /// Returns the original enum value if it does not match the
5646        /// `#variant_ident` variant.
5647        fn try_from(
5648            value: TextEditorCodeExecutionToolResultBlockContent,
5649        ) -> ::std::result::Result<Self, Self::Error> {
5650            match value {
5651                TextEditorCodeExecutionToolResultBlockContent::TextEditorCodeExecutionCreateResultBlock(
5652                    inner,
5653                ) => ::std::result::Result::Ok(inner),
5654                other => ::std::result::Result::Err(other),
5655            }
5656        }
5657    }
5658    impl ::std::convert::From<TextEditorCodeExecutionStrReplaceResultBlock>
5659        for TextEditorCodeExecutionToolResultBlockContent
5660    {
5661        fn from(value: TextEditorCodeExecutionStrReplaceResultBlock) -> Self {
5662            TextEditorCodeExecutionToolResultBlockContent::TextEditorCodeExecutionStrReplaceResultBlock(
5663                value,
5664            )
5665        }
5666    }
5667    impl ::std::convert::TryFrom<TextEditorCodeExecutionToolResultBlockContent>
5668        for TextEditorCodeExecutionStrReplaceResultBlock
5669    {
5670        type Error = TextEditorCodeExecutionToolResultBlockContent;
5671        /// # Errors
5672        ///
5673        /// Returns the original enum value if it does not match the
5674        /// `#variant_ident` variant.
5675        fn try_from(
5676            value: TextEditorCodeExecutionToolResultBlockContent,
5677        ) -> ::std::result::Result<Self, Self::Error> {
5678            match value {
5679                TextEditorCodeExecutionToolResultBlockContent::TextEditorCodeExecutionStrReplaceResultBlock(
5680                    inner,
5681                ) => ::std::result::Result::Ok(inner),
5682                other => ::std::result::Result::Err(other),
5683            }
5684        }
5685    }
5686    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
5687    #[serde(untagged)]
5688    pub enum TextEditorCodeExecutionToolResultBlockContent {
5689        TextEditorCodeExecutionToolResultError(TextEditorCodeExecutionToolResultError),
5690        TextEditorCodeExecutionViewResultBlock(TextEditorCodeExecutionViewResultBlock),
5691        TextEditorCodeExecutionCreateResultBlock(TextEditorCodeExecutionCreateResultBlock),
5692        TextEditorCodeExecutionStrReplaceResultBlock(TextEditorCodeExecutionStrReplaceResultBlock),
5693    }
5694    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
5695    pub enum TextEditorCodeExecutionToolResultBlockType {
5696        #[serde(rename = "text_editor_code_execution_tool_result")]
5697        TextEditorCodeExecutionToolResult,
5698    }
5699    impl ::std::fmt::Display for TextEditorCodeExecutionToolResultBlockType {
5700        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
5701            match self {
5702                Self::TextEditorCodeExecutionToolResult => {
5703                    ::std::write!(__f, "text_editor_code_execution_tool_result")
5704                }
5705            }
5706        }
5707    }
5708    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
5709    pub struct TextEditorCodeExecutionToolResultBlock {
5710        pub content: TextEditorCodeExecutionToolResultBlockContent,
5711        pub tool_use_id: String,
5712        pub r#type: TextEditorCodeExecutionToolResultBlockType,
5713    }
5714    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
5715    pub enum ToolReferenceBlockType {
5716        #[serde(rename = "tool_reference")]
5717        ToolReference,
5718    }
5719    impl ::std::fmt::Display for ToolReferenceBlockType {
5720        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
5721            match self {
5722                Self::ToolReference => ::std::write!(__f, "tool_reference"),
5723            }
5724        }
5725    }
5726    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
5727    pub struct ToolReferenceBlock {
5728        pub tool_name: String,
5729        pub r#type: ToolReferenceBlockType,
5730    }
5731    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
5732    pub enum ToolSearchToolResultErrorErrorCode {
5733        #[serde(rename = "invalid_tool_input")]
5734        InvalidToolInput,
5735        #[serde(rename = "unavailable")]
5736        Unavailable,
5737        #[serde(rename = "too_many_requests")]
5738        TooManyRequests,
5739        #[serde(rename = "execution_time_exceeded")]
5740        ExecutionTimeExceeded,
5741    }
5742    impl ::std::fmt::Display for ToolSearchToolResultErrorErrorCode {
5743        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
5744            match self {
5745                Self::InvalidToolInput => ::std::write!(__f, "invalid_tool_input"),
5746                Self::Unavailable => ::std::write!(__f, "unavailable"),
5747                Self::TooManyRequests => ::std::write!(__f, "too_many_requests"),
5748                Self::ExecutionTimeExceeded => {
5749                    ::std::write!(__f, "execution_time_exceeded")
5750                }
5751            }
5752        }
5753    }
5754    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
5755    pub enum ToolSearchToolResultErrorType {
5756        #[serde(rename = "tool_search_tool_result_error")]
5757        ToolSearchToolResultError,
5758    }
5759    impl ::std::fmt::Display for ToolSearchToolResultErrorType {
5760        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
5761            match self {
5762                Self::ToolSearchToolResultError => {
5763                    ::std::write!(__f, "tool_search_tool_result_error")
5764                }
5765            }
5766        }
5767    }
5768    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
5769    pub struct ToolSearchToolResultError {
5770        pub error_code: ToolSearchToolResultErrorErrorCode,
5771        pub error_message: String,
5772        pub r#type: ToolSearchToolResultErrorType,
5773    }
5774    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
5775    pub enum ToolSearchToolSearchResultBlockType {
5776        #[serde(rename = "tool_search_tool_search_result")]
5777        ToolSearchToolSearchResult,
5778    }
5779    impl ::std::fmt::Display for ToolSearchToolSearchResultBlockType {
5780        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
5781            match self {
5782                Self::ToolSearchToolSearchResult => {
5783                    ::std::write!(__f, "tool_search_tool_search_result")
5784                }
5785            }
5786        }
5787    }
5788    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
5789    pub struct ToolSearchToolSearchResultBlock {
5790        pub tool_references: Vec<ToolReferenceBlock>,
5791        pub r#type: ToolSearchToolSearchResultBlockType,
5792    }
5793    impl ::std::convert::From<ToolSearchToolResultError> for ToolSearchToolResultBlockContent {
5794        fn from(value: ToolSearchToolResultError) -> Self {
5795            ToolSearchToolResultBlockContent::ToolSearchToolResultError(value)
5796        }
5797    }
5798    impl ::std::convert::TryFrom<ToolSearchToolResultBlockContent> for ToolSearchToolResultError {
5799        type Error = ToolSearchToolResultBlockContent;
5800        /// # Errors
5801        ///
5802        /// Returns the original enum value if it does not match the
5803        /// `#variant_ident` variant.
5804        fn try_from(
5805            value: ToolSearchToolResultBlockContent,
5806        ) -> ::std::result::Result<Self, Self::Error> {
5807            match value {
5808                ToolSearchToolResultBlockContent::ToolSearchToolResultError(inner) => {
5809                    ::std::result::Result::Ok(inner)
5810                }
5811                other => ::std::result::Result::Err(other),
5812            }
5813        }
5814    }
5815    impl ::std::convert::From<ToolSearchToolSearchResultBlock> for ToolSearchToolResultBlockContent {
5816        fn from(value: ToolSearchToolSearchResultBlock) -> Self {
5817            ToolSearchToolResultBlockContent::ToolSearchToolSearchResultBlock(value)
5818        }
5819    }
5820    impl ::std::convert::TryFrom<ToolSearchToolResultBlockContent> for ToolSearchToolSearchResultBlock {
5821        type Error = ToolSearchToolResultBlockContent;
5822        /// # Errors
5823        ///
5824        /// Returns the original enum value if it does not match the
5825        /// `#variant_ident` variant.
5826        fn try_from(
5827            value: ToolSearchToolResultBlockContent,
5828        ) -> ::std::result::Result<Self, Self::Error> {
5829            match value {
5830                ToolSearchToolResultBlockContent::ToolSearchToolSearchResultBlock(inner) => {
5831                    ::std::result::Result::Ok(inner)
5832                }
5833                other => ::std::result::Result::Err(other),
5834            }
5835        }
5836    }
5837    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
5838    #[serde(untagged)]
5839    pub enum ToolSearchToolResultBlockContent {
5840        ToolSearchToolResultError(ToolSearchToolResultError),
5841        ToolSearchToolSearchResultBlock(ToolSearchToolSearchResultBlock),
5842    }
5843    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
5844    pub enum ToolSearchToolResultBlockType {
5845        #[serde(rename = "tool_search_tool_result")]
5846        ToolSearchToolResult,
5847    }
5848    impl ::std::fmt::Display for ToolSearchToolResultBlockType {
5849        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
5850            match self {
5851                Self::ToolSearchToolResult => {
5852                    ::std::write!(__f, "tool_search_tool_result")
5853                }
5854            }
5855        }
5856    }
5857    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
5858    pub struct ToolSearchToolResultBlock {
5859        pub content: ToolSearchToolResultBlockContent,
5860        pub tool_use_id: String,
5861        pub r#type: ToolSearchToolResultBlockType,
5862    }
5863    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
5864    pub enum ContainerUploadBlockType {
5865        #[serde(rename = "container_upload")]
5866        ContainerUpload,
5867    }
5868    impl ::std::fmt::Display for ContainerUploadBlockType {
5869        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
5870            match self {
5871                Self::ContainerUpload => ::std::write!(__f, "container_upload"),
5872            }
5873        }
5874    }
5875    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
5876    pub struct ContainerUploadBlock {
5877        pub file_id: String,
5878        pub r#type: ContainerUploadBlockType,
5879    }
5880    impl ::std::convert::From<TextBlock> for ContentBlock {
5881        fn from(value: TextBlock) -> Self {
5882            ContentBlock::TextBlock(value)
5883        }
5884    }
5885    impl ::std::convert::TryFrom<ContentBlock> for TextBlock {
5886        type Error = ContentBlock;
5887        /// # Errors
5888        ///
5889        /// Returns the original enum value if it does not match the
5890        /// `#variant_ident` variant.
5891        fn try_from(value: ContentBlock) -> ::std::result::Result<Self, Self::Error> {
5892            match value {
5893                ContentBlock::TextBlock(inner) => ::std::result::Result::Ok(inner),
5894                other => ::std::result::Result::Err(other),
5895            }
5896        }
5897    }
5898    impl ::std::convert::From<ThinkingBlock> for ContentBlock {
5899        fn from(value: ThinkingBlock) -> Self {
5900            ContentBlock::ThinkingBlock(value)
5901        }
5902    }
5903    impl ::std::convert::TryFrom<ContentBlock> for ThinkingBlock {
5904        type Error = ContentBlock;
5905        /// # Errors
5906        ///
5907        /// Returns the original enum value if it does not match the
5908        /// `#variant_ident` variant.
5909        fn try_from(value: ContentBlock) -> ::std::result::Result<Self, Self::Error> {
5910            match value {
5911                ContentBlock::ThinkingBlock(inner) => ::std::result::Result::Ok(inner),
5912                other => ::std::result::Result::Err(other),
5913            }
5914        }
5915    }
5916    impl ::std::convert::From<RedactedThinkingBlock> for ContentBlock {
5917        fn from(value: RedactedThinkingBlock) -> Self {
5918            ContentBlock::RedactedThinkingBlock(value)
5919        }
5920    }
5921    impl ::std::convert::TryFrom<ContentBlock> for RedactedThinkingBlock {
5922        type Error = ContentBlock;
5923        /// # Errors
5924        ///
5925        /// Returns the original enum value if it does not match the
5926        /// `#variant_ident` variant.
5927        fn try_from(value: ContentBlock) -> ::std::result::Result<Self, Self::Error> {
5928            match value {
5929                ContentBlock::RedactedThinkingBlock(inner) => ::std::result::Result::Ok(inner),
5930                other => ::std::result::Result::Err(other),
5931            }
5932        }
5933    }
5934    impl ::std::convert::From<ToolUseBlock> for ContentBlock {
5935        fn from(value: ToolUseBlock) -> Self {
5936            ContentBlock::ToolUseBlock(value)
5937        }
5938    }
5939    impl ::std::convert::TryFrom<ContentBlock> for ToolUseBlock {
5940        type Error = ContentBlock;
5941        /// # Errors
5942        ///
5943        /// Returns the original enum value if it does not match the
5944        /// `#variant_ident` variant.
5945        fn try_from(value: ContentBlock) -> ::std::result::Result<Self, Self::Error> {
5946            match value {
5947                ContentBlock::ToolUseBlock(inner) => ::std::result::Result::Ok(inner),
5948                other => ::std::result::Result::Err(other),
5949            }
5950        }
5951    }
5952    impl ::std::convert::From<ServerToolUseBlock> for ContentBlock {
5953        fn from(value: ServerToolUseBlock) -> Self {
5954            ContentBlock::ServerToolUseBlock(value)
5955        }
5956    }
5957    impl ::std::convert::TryFrom<ContentBlock> for ServerToolUseBlock {
5958        type Error = ContentBlock;
5959        /// # Errors
5960        ///
5961        /// Returns the original enum value if it does not match the
5962        /// `#variant_ident` variant.
5963        fn try_from(value: ContentBlock) -> ::std::result::Result<Self, Self::Error> {
5964            match value {
5965                ContentBlock::ServerToolUseBlock(inner) => ::std::result::Result::Ok(inner),
5966                other => ::std::result::Result::Err(other),
5967            }
5968        }
5969    }
5970    impl ::std::convert::From<WebSearchToolResultBlock> for ContentBlock {
5971        fn from(value: WebSearchToolResultBlock) -> Self {
5972            ContentBlock::WebSearchToolResultBlock(value)
5973        }
5974    }
5975    impl ::std::convert::TryFrom<ContentBlock> for WebSearchToolResultBlock {
5976        type Error = ContentBlock;
5977        /// # Errors
5978        ///
5979        /// Returns the original enum value if it does not match the
5980        /// `#variant_ident` variant.
5981        fn try_from(value: ContentBlock) -> ::std::result::Result<Self, Self::Error> {
5982            match value {
5983                ContentBlock::WebSearchToolResultBlock(inner) => ::std::result::Result::Ok(inner),
5984                other => ::std::result::Result::Err(other),
5985            }
5986        }
5987    }
5988    impl ::std::convert::From<WebFetchToolResultBlock> for ContentBlock {
5989        fn from(value: WebFetchToolResultBlock) -> Self {
5990            ContentBlock::WebFetchToolResultBlock(value)
5991        }
5992    }
5993    impl ::std::convert::TryFrom<ContentBlock> for WebFetchToolResultBlock {
5994        type Error = ContentBlock;
5995        /// # Errors
5996        ///
5997        /// Returns the original enum value if it does not match the
5998        /// `#variant_ident` variant.
5999        fn try_from(value: ContentBlock) -> ::std::result::Result<Self, Self::Error> {
6000            match value {
6001                ContentBlock::WebFetchToolResultBlock(inner) => ::std::result::Result::Ok(inner),
6002                other => ::std::result::Result::Err(other),
6003            }
6004        }
6005    }
6006    impl ::std::convert::From<CodeExecutionToolResultBlock> for ContentBlock {
6007        fn from(value: CodeExecutionToolResultBlock) -> Self {
6008            ContentBlock::CodeExecutionToolResultBlock(value)
6009        }
6010    }
6011    impl ::std::convert::TryFrom<ContentBlock> for CodeExecutionToolResultBlock {
6012        type Error = ContentBlock;
6013        /// # Errors
6014        ///
6015        /// Returns the original enum value if it does not match the
6016        /// `#variant_ident` variant.
6017        fn try_from(value: ContentBlock) -> ::std::result::Result<Self, Self::Error> {
6018            match value {
6019                ContentBlock::CodeExecutionToolResultBlock(inner) => {
6020                    ::std::result::Result::Ok(inner)
6021                }
6022                other => ::std::result::Result::Err(other),
6023            }
6024        }
6025    }
6026    impl ::std::convert::From<BashCodeExecutionToolResultBlock> for ContentBlock {
6027        fn from(value: BashCodeExecutionToolResultBlock) -> Self {
6028            ContentBlock::BashCodeExecutionToolResultBlock(value)
6029        }
6030    }
6031    impl ::std::convert::TryFrom<ContentBlock> for BashCodeExecutionToolResultBlock {
6032        type Error = ContentBlock;
6033        /// # Errors
6034        ///
6035        /// Returns the original enum value if it does not match the
6036        /// `#variant_ident` variant.
6037        fn try_from(value: ContentBlock) -> ::std::result::Result<Self, Self::Error> {
6038            match value {
6039                ContentBlock::BashCodeExecutionToolResultBlock(inner) => {
6040                    ::std::result::Result::Ok(inner)
6041                }
6042                other => ::std::result::Result::Err(other),
6043            }
6044        }
6045    }
6046    impl ::std::convert::From<TextEditorCodeExecutionToolResultBlock> for ContentBlock {
6047        fn from(value: TextEditorCodeExecutionToolResultBlock) -> Self {
6048            ContentBlock::TextEditorCodeExecutionToolResultBlock(value)
6049        }
6050    }
6051    impl ::std::convert::TryFrom<ContentBlock> for TextEditorCodeExecutionToolResultBlock {
6052        type Error = ContentBlock;
6053        /// # Errors
6054        ///
6055        /// Returns the original enum value if it does not match the
6056        /// `#variant_ident` variant.
6057        fn try_from(value: ContentBlock) -> ::std::result::Result<Self, Self::Error> {
6058            match value {
6059                ContentBlock::TextEditorCodeExecutionToolResultBlock(inner) => {
6060                    ::std::result::Result::Ok(inner)
6061                }
6062                other => ::std::result::Result::Err(other),
6063            }
6064        }
6065    }
6066    impl ::std::convert::From<ToolSearchToolResultBlock> for ContentBlock {
6067        fn from(value: ToolSearchToolResultBlock) -> Self {
6068            ContentBlock::ToolSearchToolResultBlock(value)
6069        }
6070    }
6071    impl ::std::convert::TryFrom<ContentBlock> for ToolSearchToolResultBlock {
6072        type Error = ContentBlock;
6073        /// # Errors
6074        ///
6075        /// Returns the original enum value if it does not match the
6076        /// `#variant_ident` variant.
6077        fn try_from(value: ContentBlock) -> ::std::result::Result<Self, Self::Error> {
6078            match value {
6079                ContentBlock::ToolSearchToolResultBlock(inner) => ::std::result::Result::Ok(inner),
6080                other => ::std::result::Result::Err(other),
6081            }
6082        }
6083    }
6084    impl ::std::convert::From<ContainerUploadBlock> for ContentBlock {
6085        fn from(value: ContainerUploadBlock) -> Self {
6086            ContentBlock::ContainerUploadBlock(value)
6087        }
6088    }
6089    impl ::std::convert::TryFrom<ContentBlock> for ContainerUploadBlock {
6090        type Error = ContentBlock;
6091        /// # Errors
6092        ///
6093        /// Returns the original enum value if it does not match the
6094        /// `#variant_ident` variant.
6095        fn try_from(value: ContentBlock) -> ::std::result::Result<Self, Self::Error> {
6096            match value {
6097                ContentBlock::ContainerUploadBlock(inner) => ::std::result::Result::Ok(inner),
6098                other => ::std::result::Result::Err(other),
6099            }
6100        }
6101    }
6102    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
6103    #[serde(untagged)]
6104    pub enum ContentBlock {
6105        TextBlock(TextBlock),
6106        ThinkingBlock(ThinkingBlock),
6107        RedactedThinkingBlock(RedactedThinkingBlock),
6108        ToolUseBlock(ToolUseBlock),
6109        ServerToolUseBlock(ServerToolUseBlock),
6110        WebSearchToolResultBlock(WebSearchToolResultBlock),
6111        WebFetchToolResultBlock(WebFetchToolResultBlock),
6112        CodeExecutionToolResultBlock(CodeExecutionToolResultBlock),
6113        BashCodeExecutionToolResultBlock(BashCodeExecutionToolResultBlock),
6114        TextEditorCodeExecutionToolResultBlock(TextEditorCodeExecutionToolResultBlock),
6115        ToolSearchToolResultBlock(ToolSearchToolResultBlock),
6116        ContainerUploadBlock(ContainerUploadBlock),
6117    }
6118    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
6119    /// 代码执行容器信息(仅在用了 code execution tool 时返回)。
6120    pub struct Container {
6121        pub id: String,
6122        pub expires_at: String,
6123    }
6124    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
6125    pub enum RefusalStopDetailsCategory {
6126        #[serde(rename = "cyber")]
6127        Cyber,
6128        #[serde(rename = "bio")]
6129        Bio,
6130    }
6131    impl ::std::fmt::Display for RefusalStopDetailsCategory {
6132        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
6133            match self {
6134                Self::Cyber => ::std::write!(__f, "cyber"),
6135                Self::Bio => ::std::write!(__f, "bio"),
6136            }
6137        }
6138    }
6139    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
6140    pub enum RefusalStopDetailsType {
6141        #[serde(rename = "refusal")]
6142        Refusal,
6143    }
6144    impl ::std::fmt::Display for RefusalStopDetailsType {
6145        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
6146            match self {
6147                Self::Refusal => ::std::write!(__f, "refusal"),
6148            }
6149        }
6150    }
6151    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
6152    /// 结构化 refusal 信息。
6153    pub struct RefusalStopDetails {
6154        #[serde(skip_serializing_if = "Option::is_none")]
6155        pub category: Option<RefusalStopDetailsCategory>,
6156        #[serde(skip_serializing_if = "Option::is_none")]
6157        pub explanation: Option<String>,
6158        pub r#type: RefusalStopDetailsType,
6159    }
6160    impl ::std::fmt::Display for StopReason {
6161        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
6162            match self {
6163                Self::EndTurn => ::std::write!(__f, "end_turn"),
6164                Self::MaxTokens => ::std::write!(__f, "max_tokens"),
6165                Self::StopSequence => ::std::write!(__f, "stop_sequence"),
6166                Self::ToolUse => ::std::write!(__f, "tool_use"),
6167                Self::PauseTurn => ::std::write!(__f, "pause_turn"),
6168                Self::Refusal => ::std::write!(__f, "refusal"),
6169            }
6170        }
6171    }
6172    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
6173    pub enum StopReason {
6174        #[serde(rename = "end_turn")]
6175        EndTurn,
6176        #[serde(rename = "max_tokens")]
6177        MaxTokens,
6178        #[serde(rename = "stop_sequence")]
6179        StopSequence,
6180        #[serde(rename = "tool_use")]
6181        ToolUse,
6182        #[serde(rename = "pause_turn")]
6183        PauseTurn,
6184        #[serde(rename = "refusal")]
6185        Refusal,
6186    }
6187    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
6188    pub struct CacheCreation {
6189        pub ephemeral_1h_input_tokens: i64,
6190        pub ephemeral_5m_input_tokens: i64,
6191    }
6192    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
6193    pub struct ServerToolUsage {
6194        pub web_fetch_requests: i64,
6195        pub web_search_requests: i64,
6196    }
6197    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
6198    pub enum UsageServiceTier {
6199        #[serde(rename = "standard")]
6200        Standard,
6201        #[serde(rename = "priority")]
6202        Priority,
6203        #[serde(rename = "batch")]
6204        Batch,
6205    }
6206    impl ::std::fmt::Display for UsageServiceTier {
6207        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
6208            match self {
6209                Self::Standard => ::std::write!(__f, "standard"),
6210                Self::Priority => ::std::write!(__f, "priority"),
6211                Self::Batch => ::std::write!(__f, "batch"),
6212            }
6213        }
6214    }
6215    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
6216    /// 计费/限流相关的 token 用量。
6217    pub struct Usage {
6218        #[serde(skip_serializing_if = "Option::is_none")]
6219        pub cache_creation: Option<CacheCreation>,
6220        #[serde(skip_serializing_if = "Option::is_none")]
6221        pub cache_creation_input_tokens: Option<i64>,
6222        #[serde(skip_serializing_if = "Option::is_none")]
6223        pub cache_read_input_tokens: Option<i64>,
6224        #[serde(skip_serializing_if = "Option::is_none")]
6225        pub inference_geo: Option<String>,
6226        pub input_tokens: i64,
6227        pub output_tokens: i64,
6228        #[serde(skip_serializing_if = "Option::is_none")]
6229        pub server_tool_use: Option<ServerToolUsage>,
6230        #[serde(skip_serializing_if = "Option::is_none")]
6231        pub service_tier: Option<UsageServiceTier>,
6232    }
6233    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
6234    pub enum MessageRole {
6235        #[serde(rename = "assistant")]
6236        Assistant,
6237    }
6238    impl ::std::fmt::Display for MessageRole {
6239        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
6240            match self {
6241                Self::Assistant => ::std::write!(__f, "assistant"),
6242            }
6243        }
6244    }
6245    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
6246    pub enum MessageType {
6247        #[serde(rename = "message")]
6248        Message,
6249    }
6250    impl ::std::fmt::Display for MessageType {
6251        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
6252            match self {
6253                Self::Message => ::std::write!(__f, "message"),
6254            }
6255        }
6256    }
6257    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
6258    pub struct Message {
6259        pub id: String,
6260        #[serde(skip_serializing_if = "Option::is_none")]
6261        pub container: Option<Container>,
6262        pub content: Vec<ContentBlock>,
6263        pub model: Model,
6264        pub role: MessageRole,
6265        #[serde(skip_serializing_if = "Option::is_none")]
6266        pub stop_details: Option<RefusalStopDetails>,
6267        pub stop_reason: StopReason,
6268        #[serde(skip_serializing_if = "Option::is_none")]
6269        pub stop_sequence: Option<String>,
6270        pub r#type: MessageType,
6271        pub usage: Usage,
6272    }
6273    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
6274    pub enum MessageStartEventMessageType {
6275        #[serde(rename = "message")]
6276        Message,
6277    }
6278    impl ::std::fmt::Display for MessageStartEventMessageType {
6279        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
6280            match self {
6281                Self::Message => ::std::write!(__f, "message"),
6282            }
6283        }
6284    }
6285    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
6286    pub enum MessageStartEventMessageRole {
6287        #[serde(rename = "assistant")]
6288        Assistant,
6289    }
6290    impl ::std::fmt::Display for MessageStartEventMessageRole {
6291        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
6292            match self {
6293                Self::Assistant => ::std::write!(__f, "assistant"),
6294            }
6295        }
6296    }
6297    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
6298    /// message_start 事件携带的 Message 体;与 /v1/messages 同步返回的
6299    /// Message 几乎相同,但 content 总是空数组(在后续 content_block_*
6300    /// 事件里逐步填充),且 stop_reason / stop_details / stop_sequence
6301    /// 为 null。usage 在此事件里只有 input_tokens / output_tokens 是
6302    /// 有效的,其余字段在 message_delta 时再补。
6303    pub struct MessageStartEventMessage {
6304        pub id: String,
6305        pub r#type: MessageStartEventMessageType,
6306        pub role: MessageStartEventMessageRole,
6307        pub content: Vec<ContentBlock>,
6308        pub model: Model,
6309        #[serde(skip_serializing_if = "Option::is_none")]
6310        pub stop_reason: Option<StopReason>,
6311        #[serde(skip_serializing_if = "Option::is_none")]
6312        pub stop_sequence: Option<String>,
6313        pub usage: Usage,
6314    }
6315    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
6316    pub enum MessageStartEventType {
6317        #[serde(rename = "message_start")]
6318        MessageStart,
6319    }
6320    impl ::std::fmt::Display for MessageStartEventType {
6321        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
6322            match self {
6323                Self::MessageStart => ::std::write!(__f, "message_start"),
6324            }
6325        }
6326    }
6327    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
6328    pub struct MessageStartEvent {
6329        pub r#type: MessageStartEventType,
6330        pub message: MessageStartEventMessage,
6331    }
6332    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
6333    pub enum ContentBlockStartEventType {
6334        #[serde(rename = "content_block_start")]
6335        ContentBlockStart,
6336    }
6337    impl ::std::fmt::Display for ContentBlockStartEventType {
6338        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
6339            match self {
6340                Self::ContentBlockStart => ::std::write!(__f, "content_block_start"),
6341            }
6342        }
6343    }
6344    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
6345    pub struct ContentBlockStartEvent {
6346        pub r#type: ContentBlockStartEventType,
6347        pub index: i64,
6348        pub content_block: ContentBlock,
6349    }
6350    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
6351    pub enum TextDeltaType {
6352        #[serde(rename = "text_delta")]
6353        TextDelta,
6354    }
6355    impl ::std::fmt::Display for TextDeltaType {
6356        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
6357            match self {
6358                Self::TextDelta => ::std::write!(__f, "text_delta"),
6359            }
6360        }
6361    }
6362    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
6363    pub struct TextDelta {
6364        pub r#type: TextDeltaType,
6365        pub text: String,
6366    }
6367    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
6368    pub enum InputJsonDeltaType {
6369        #[serde(rename = "input_json_delta")]
6370        InputJsonDelta,
6371    }
6372    impl ::std::fmt::Display for InputJsonDeltaType {
6373        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
6374            match self {
6375                Self::InputJsonDelta => ::std::write!(__f, "input_json_delta"),
6376            }
6377        }
6378    }
6379    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
6380    /// tool_use input 的 partial JSON(字符串形式逐段流出)。
6381    pub struct InputJsonDelta {
6382        pub r#type: InputJsonDeltaType,
6383        pub partial_json: String,
6384    }
6385    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
6386    pub enum ThinkingDeltaType {
6387        #[serde(rename = "thinking_delta")]
6388        ThinkingDelta,
6389    }
6390    impl ::std::fmt::Display for ThinkingDeltaType {
6391        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
6392            match self {
6393                Self::ThinkingDelta => ::std::write!(__f, "thinking_delta"),
6394            }
6395        }
6396    }
6397    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
6398    pub struct ThinkingDelta {
6399        pub r#type: ThinkingDeltaType,
6400        pub thinking: String,
6401    }
6402    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
6403    pub enum SignatureDeltaType {
6404        #[serde(rename = "signature_delta")]
6405        SignatureDelta,
6406    }
6407    impl ::std::fmt::Display for SignatureDeltaType {
6408        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
6409            match self {
6410                Self::SignatureDelta => ::std::write!(__f, "signature_delta"),
6411            }
6412        }
6413    }
6414    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
6415    pub struct SignatureDelta {
6416        pub r#type: SignatureDeltaType,
6417        pub signature: String,
6418    }
6419    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
6420    pub enum CitationsDeltaType {
6421        #[serde(rename = "citations_delta")]
6422        CitationsDelta,
6423    }
6424    impl ::std::fmt::Display for CitationsDeltaType {
6425        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
6426            match self {
6427                Self::CitationsDelta => ::std::write!(__f, "citations_delta"),
6428            }
6429        }
6430    }
6431    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
6432    /// citation_delta 事件:每个 delta 携带一条新增的 TextCitation
6433    /// (响应版,含 file_id),追加到对应文本块的 citations 数组。
6434    pub struct CitationsDelta {
6435        pub r#type: CitationsDeltaType,
6436        pub citation: TextCitation,
6437    }
6438    impl ::std::convert::From<TextDelta> for ContentBlockDelta {
6439        fn from(value: TextDelta) -> Self {
6440            ContentBlockDelta::TextDelta(value)
6441        }
6442    }
6443    impl ::std::convert::TryFrom<ContentBlockDelta> for TextDelta {
6444        type Error = ContentBlockDelta;
6445        /// # Errors
6446        ///
6447        /// Returns the original enum value if it does not match the
6448        /// `#variant_ident` variant.
6449        fn try_from(value: ContentBlockDelta) -> ::std::result::Result<Self, Self::Error> {
6450            match value {
6451                ContentBlockDelta::TextDelta(inner) => ::std::result::Result::Ok(inner),
6452                other => ::std::result::Result::Err(other),
6453            }
6454        }
6455    }
6456    impl ::std::convert::From<InputJsonDelta> for ContentBlockDelta {
6457        fn from(value: InputJsonDelta) -> Self {
6458            ContentBlockDelta::InputJsonDelta(value)
6459        }
6460    }
6461    impl ::std::convert::TryFrom<ContentBlockDelta> for InputJsonDelta {
6462        type Error = ContentBlockDelta;
6463        /// # Errors
6464        ///
6465        /// Returns the original enum value if it does not match the
6466        /// `#variant_ident` variant.
6467        fn try_from(value: ContentBlockDelta) -> ::std::result::Result<Self, Self::Error> {
6468            match value {
6469                ContentBlockDelta::InputJsonDelta(inner) => ::std::result::Result::Ok(inner),
6470                other => ::std::result::Result::Err(other),
6471            }
6472        }
6473    }
6474    impl ::std::convert::From<ThinkingDelta> for ContentBlockDelta {
6475        fn from(value: ThinkingDelta) -> Self {
6476            ContentBlockDelta::ThinkingDelta(value)
6477        }
6478    }
6479    impl ::std::convert::TryFrom<ContentBlockDelta> for ThinkingDelta {
6480        type Error = ContentBlockDelta;
6481        /// # Errors
6482        ///
6483        /// Returns the original enum value if it does not match the
6484        /// `#variant_ident` variant.
6485        fn try_from(value: ContentBlockDelta) -> ::std::result::Result<Self, Self::Error> {
6486            match value {
6487                ContentBlockDelta::ThinkingDelta(inner) => ::std::result::Result::Ok(inner),
6488                other => ::std::result::Result::Err(other),
6489            }
6490        }
6491    }
6492    impl ::std::convert::From<SignatureDelta> for ContentBlockDelta {
6493        fn from(value: SignatureDelta) -> Self {
6494            ContentBlockDelta::SignatureDelta(value)
6495        }
6496    }
6497    impl ::std::convert::TryFrom<ContentBlockDelta> for SignatureDelta {
6498        type Error = ContentBlockDelta;
6499        /// # Errors
6500        ///
6501        /// Returns the original enum value if it does not match the
6502        /// `#variant_ident` variant.
6503        fn try_from(value: ContentBlockDelta) -> ::std::result::Result<Self, Self::Error> {
6504            match value {
6505                ContentBlockDelta::SignatureDelta(inner) => ::std::result::Result::Ok(inner),
6506                other => ::std::result::Result::Err(other),
6507            }
6508        }
6509    }
6510    impl ::std::convert::From<CitationsDelta> for ContentBlockDelta {
6511        fn from(value: CitationsDelta) -> Self {
6512            ContentBlockDelta::CitationsDelta(value)
6513        }
6514    }
6515    impl ::std::convert::TryFrom<ContentBlockDelta> for CitationsDelta {
6516        type Error = ContentBlockDelta;
6517        /// # Errors
6518        ///
6519        /// Returns the original enum value if it does not match the
6520        /// `#variant_ident` variant.
6521        fn try_from(value: ContentBlockDelta) -> ::std::result::Result<Self, Self::Error> {
6522            match value {
6523                ContentBlockDelta::CitationsDelta(inner) => ::std::result::Result::Ok(inner),
6524                other => ::std::result::Result::Err(other),
6525            }
6526        }
6527    }
6528    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
6529    #[serde(untagged)]
6530    pub enum ContentBlockDelta {
6531        TextDelta(TextDelta),
6532        InputJsonDelta(InputJsonDelta),
6533        ThinkingDelta(ThinkingDelta),
6534        SignatureDelta(SignatureDelta),
6535        CitationsDelta(CitationsDelta),
6536    }
6537    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
6538    pub enum ContentBlockDeltaEventType {
6539        #[serde(rename = "content_block_delta")]
6540        ContentBlockDelta,
6541    }
6542    impl ::std::fmt::Display for ContentBlockDeltaEventType {
6543        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
6544            match self {
6545                Self::ContentBlockDelta => ::std::write!(__f, "content_block_delta"),
6546            }
6547        }
6548    }
6549    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
6550    pub struct ContentBlockDeltaEvent {
6551        pub r#type: ContentBlockDeltaEventType,
6552        pub index: i64,
6553        pub delta: ContentBlockDelta,
6554    }
6555    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
6556    pub enum ContentBlockStopEventType {
6557        #[serde(rename = "content_block_stop")]
6558        ContentBlockStop,
6559    }
6560    impl ::std::fmt::Display for ContentBlockStopEventType {
6561        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
6562            match self {
6563                Self::ContentBlockStop => ::std::write!(__f, "content_block_stop"),
6564            }
6565        }
6566    }
6567    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
6568    pub struct ContentBlockStopEvent {
6569        pub r#type: ContentBlockStopEventType,
6570        pub index: i64,
6571    }
6572    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
6573    /// message_delta 事件携带的 message 顶层增量。stop_reason 在 turn
6574    /// 收尾时必填;stop_sequence 仅在因 stop_sequences 命中而停止时填,
6575    /// 其余情况上游回 null(不传字段或传 null 都视为"未命中")。
6576    pub struct MessageDeltaUpdate {
6577        pub stop_reason: StopReason,
6578        #[serde(skip_serializing_if = "Option::is_none")]
6579        pub stop_sequence: Option<String>,
6580        #[serde(skip_serializing_if = "Option::is_none")]
6581        pub stop_details: Option<RefusalStopDetails>,
6582        #[serde(skip_serializing_if = "Option::is_none")]
6583        pub container: Option<Container>,
6584    }
6585    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
6586    pub enum MessageDeltaUsageServiceTier {
6587        #[serde(rename = "standard")]
6588        Standard,
6589        #[serde(rename = "priority")]
6590        Priority,
6591        #[serde(rename = "batch")]
6592        Batch,
6593    }
6594    impl ::std::fmt::Display for MessageDeltaUsageServiceTier {
6595        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
6596            match self {
6597                Self::Standard => ::std::write!(__f, "standard"),
6598                Self::Priority => ::std::write!(__f, "priority"),
6599                Self::Batch => ::std::write!(__f, "batch"),
6600            }
6601        }
6602    }
6603    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
6604    /// message_delta.usage 累积值(注意:是累积,不是增量)。其它
6605    /// 字段(cache_*、server_tool_use 等)在收尾时也可能填充。
6606    pub struct MessageDeltaUsage {
6607        #[serde(skip_serializing_if = "Option::is_none")]
6608        pub cache_creation: Option<CacheCreation>,
6609        #[serde(skip_serializing_if = "Option::is_none")]
6610        pub cache_creation_input_tokens: Option<i64>,
6611        #[serde(skip_serializing_if = "Option::is_none")]
6612        pub cache_read_input_tokens: Option<i64>,
6613        #[serde(skip_serializing_if = "Option::is_none")]
6614        pub input_tokens: Option<i64>,
6615        pub output_tokens: i64,
6616        #[serde(skip_serializing_if = "Option::is_none")]
6617        pub server_tool_use: Option<ServerToolUsage>,
6618        #[serde(skip_serializing_if = "Option::is_none")]
6619        pub service_tier: Option<MessageDeltaUsageServiceTier>,
6620    }
6621    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
6622    pub enum MessageDeltaEventType {
6623        #[serde(rename = "message_delta")]
6624        MessageDelta,
6625    }
6626    impl ::std::fmt::Display for MessageDeltaEventType {
6627        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
6628            match self {
6629                Self::MessageDelta => ::std::write!(__f, "message_delta"),
6630            }
6631        }
6632    }
6633    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
6634    pub struct MessageDeltaEvent {
6635        pub r#type: MessageDeltaEventType,
6636        pub delta: MessageDeltaUpdate,
6637        pub usage: MessageDeltaUsage,
6638    }
6639    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
6640    pub enum MessageStopEventType {
6641        #[serde(rename = "message_stop")]
6642        MessageStop,
6643    }
6644    impl ::std::fmt::Display for MessageStopEventType {
6645        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
6646            match self {
6647                Self::MessageStop => ::std::write!(__f, "message_stop"),
6648            }
6649        }
6650    }
6651    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
6652    pub struct MessageStopEvent {
6653        pub r#type: MessageStopEventType,
6654    }
6655    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
6656    pub enum PingEventType {
6657        #[serde(rename = "ping")]
6658        Ping,
6659    }
6660    impl ::std::fmt::Display for PingEventType {
6661        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
6662            match self {
6663                Self::Ping => ::std::write!(__f, "ping"),
6664            }
6665        }
6666    }
6667    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
6668    pub struct PingEvent {
6669        pub r#type: PingEventType,
6670    }
6671    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
6672    pub struct StreamErrorPayload {
6673        /// 常见值:overloaded_error / api_error / invalid_request_error。
6674        pub r#type: String,
6675        pub message: String,
6676    }
6677    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
6678    pub enum ErrorEventType {
6679        #[serde(rename = "error")]
6680        Error,
6681    }
6682    impl ::std::fmt::Display for ErrorEventType {
6683        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
6684            match self {
6685                Self::Error => ::std::write!(__f, "error"),
6686            }
6687        }
6688    }
6689    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
6690    pub struct ErrorEvent {
6691        pub r#type: ErrorEventType,
6692        pub error: StreamErrorPayload,
6693    }
6694    impl ::std::convert::From<MessageStartEvent> for MessageStreamEvent {
6695        fn from(value: MessageStartEvent) -> Self {
6696            MessageStreamEvent::MessageStartEvent(value)
6697        }
6698    }
6699    impl ::std::convert::TryFrom<MessageStreamEvent> for MessageStartEvent {
6700        type Error = MessageStreamEvent;
6701        /// # Errors
6702        ///
6703        /// Returns the original enum value if it does not match the
6704        /// `#variant_ident` variant.
6705        fn try_from(value: MessageStreamEvent) -> ::std::result::Result<Self, Self::Error> {
6706            match value {
6707                MessageStreamEvent::MessageStartEvent(inner) => ::std::result::Result::Ok(inner),
6708                other => ::std::result::Result::Err(other),
6709            }
6710        }
6711    }
6712    impl ::std::convert::From<ContentBlockStartEvent> for MessageStreamEvent {
6713        fn from(value: ContentBlockStartEvent) -> Self {
6714            MessageStreamEvent::ContentBlockStartEvent(value)
6715        }
6716    }
6717    impl ::std::convert::TryFrom<MessageStreamEvent> for ContentBlockStartEvent {
6718        type Error = MessageStreamEvent;
6719        /// # Errors
6720        ///
6721        /// Returns the original enum value if it does not match the
6722        /// `#variant_ident` variant.
6723        fn try_from(value: MessageStreamEvent) -> ::std::result::Result<Self, Self::Error> {
6724            match value {
6725                MessageStreamEvent::ContentBlockStartEvent(inner) => {
6726                    ::std::result::Result::Ok(inner)
6727                }
6728                other => ::std::result::Result::Err(other),
6729            }
6730        }
6731    }
6732    impl ::std::convert::From<ContentBlockDeltaEvent> for MessageStreamEvent {
6733        fn from(value: ContentBlockDeltaEvent) -> Self {
6734            MessageStreamEvent::ContentBlockDeltaEvent(value)
6735        }
6736    }
6737    impl ::std::convert::TryFrom<MessageStreamEvent> for ContentBlockDeltaEvent {
6738        type Error = MessageStreamEvent;
6739        /// # Errors
6740        ///
6741        /// Returns the original enum value if it does not match the
6742        /// `#variant_ident` variant.
6743        fn try_from(value: MessageStreamEvent) -> ::std::result::Result<Self, Self::Error> {
6744            match value {
6745                MessageStreamEvent::ContentBlockDeltaEvent(inner) => {
6746                    ::std::result::Result::Ok(inner)
6747                }
6748                other => ::std::result::Result::Err(other),
6749            }
6750        }
6751    }
6752    impl ::std::convert::From<ContentBlockStopEvent> for MessageStreamEvent {
6753        fn from(value: ContentBlockStopEvent) -> Self {
6754            MessageStreamEvent::ContentBlockStopEvent(value)
6755        }
6756    }
6757    impl ::std::convert::TryFrom<MessageStreamEvent> for ContentBlockStopEvent {
6758        type Error = MessageStreamEvent;
6759        /// # Errors
6760        ///
6761        /// Returns the original enum value if it does not match the
6762        /// `#variant_ident` variant.
6763        fn try_from(value: MessageStreamEvent) -> ::std::result::Result<Self, Self::Error> {
6764            match value {
6765                MessageStreamEvent::ContentBlockStopEvent(inner) => {
6766                    ::std::result::Result::Ok(inner)
6767                }
6768                other => ::std::result::Result::Err(other),
6769            }
6770        }
6771    }
6772    impl ::std::convert::From<MessageDeltaEvent> for MessageStreamEvent {
6773        fn from(value: MessageDeltaEvent) -> Self {
6774            MessageStreamEvent::MessageDeltaEvent(value)
6775        }
6776    }
6777    impl ::std::convert::TryFrom<MessageStreamEvent> for MessageDeltaEvent {
6778        type Error = MessageStreamEvent;
6779        /// # Errors
6780        ///
6781        /// Returns the original enum value if it does not match the
6782        /// `#variant_ident` variant.
6783        fn try_from(value: MessageStreamEvent) -> ::std::result::Result<Self, Self::Error> {
6784            match value {
6785                MessageStreamEvent::MessageDeltaEvent(inner) => ::std::result::Result::Ok(inner),
6786                other => ::std::result::Result::Err(other),
6787            }
6788        }
6789    }
6790    impl ::std::convert::From<MessageStopEvent> for MessageStreamEvent {
6791        fn from(value: MessageStopEvent) -> Self {
6792            MessageStreamEvent::MessageStopEvent(value)
6793        }
6794    }
6795    impl ::std::convert::TryFrom<MessageStreamEvent> for MessageStopEvent {
6796        type Error = MessageStreamEvent;
6797        /// # Errors
6798        ///
6799        /// Returns the original enum value if it does not match the
6800        /// `#variant_ident` variant.
6801        fn try_from(value: MessageStreamEvent) -> ::std::result::Result<Self, Self::Error> {
6802            match value {
6803                MessageStreamEvent::MessageStopEvent(inner) => ::std::result::Result::Ok(inner),
6804                other => ::std::result::Result::Err(other),
6805            }
6806        }
6807    }
6808    impl ::std::convert::From<PingEvent> for MessageStreamEvent {
6809        fn from(value: PingEvent) -> Self {
6810            MessageStreamEvent::PingEvent(value)
6811        }
6812    }
6813    impl ::std::convert::TryFrom<MessageStreamEvent> for PingEvent {
6814        type Error = MessageStreamEvent;
6815        /// # Errors
6816        ///
6817        /// Returns the original enum value if it does not match the
6818        /// `#variant_ident` variant.
6819        fn try_from(value: MessageStreamEvent) -> ::std::result::Result<Self, Self::Error> {
6820            match value {
6821                MessageStreamEvent::PingEvent(inner) => ::std::result::Result::Ok(inner),
6822                other => ::std::result::Result::Err(other),
6823            }
6824        }
6825    }
6826    impl ::std::convert::From<ErrorEvent> for MessageStreamEvent {
6827        fn from(value: ErrorEvent) -> Self {
6828            MessageStreamEvent::ErrorEvent(value)
6829        }
6830    }
6831    impl ::std::convert::TryFrom<MessageStreamEvent> for ErrorEvent {
6832        type Error = MessageStreamEvent;
6833        /// # Errors
6834        ///
6835        /// Returns the original enum value if it does not match the
6836        /// `#variant_ident` variant.
6837        fn try_from(value: MessageStreamEvent) -> ::std::result::Result<Self, Self::Error> {
6838            match value {
6839                MessageStreamEvent::ErrorEvent(inner) => ::std::result::Result::Ok(inner),
6840                other => ::std::result::Result::Err(other),
6841            }
6842        }
6843    }
6844    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
6845    #[serde(untagged)]
6846    /// Anthropic SSE 流的单个事件载荷(去掉 SSE 框架后的 JSON)。所有
6847    /// 变体共享 `type` 字段做 discriminator。客户端必须能容忍未知
6848    /// type(按 versioning policy,未来会新增)。
6849    pub enum MessageStreamEvent {
6850        MessageStartEvent(MessageStartEvent),
6851        ContentBlockStartEvent(ContentBlockStartEvent),
6852        ContentBlockDeltaEvent(ContentBlockDeltaEvent),
6853        ContentBlockStopEvent(ContentBlockStopEvent),
6854        MessageDeltaEvent(MessageDeltaEvent),
6855        MessageStopEvent(MessageStopEvent),
6856        PingEvent(PingEvent),
6857        ErrorEvent(ErrorEvent),
6858    }
6859}
6860pub mod operations {
6861    #![allow(deprecated)]
6862    #![allow(unreachable_patterns)]
6863    #![allow(non_camel_case_types)]
6864    #![allow(non_snake_case)]
6865    #![allow(clippy::all, clippy::pedantic)]
6866    pub mod v1 {
6867        pub mod models {
6868            pub mod get {
6869                #[derive(Debug, Clone, PartialEq)]
6870                /// # List available models
6871                /// 返回当前 API key 可见的全部模型清单。分页字段 v0 不用。
6872                pub struct Request {
6873                    pub before_id: Option<String>,
6874                    pub after_id: Option<String>,
6875                    pub limit: Option<i64>,
6876                }
6877                impl Request {
6878                    /// `GET /v1/models`
6879                    /// Operation ID: `listModels`.
6880                    pub const METHOD: ::http::Method = ::http::Method::GET;
6881                    /// URL path template, with `{name}` placeholders for path
6882                    /// parameters. Rendering into a concrete URL is the caller's
6883                    /// responsibility.
6884                    pub const PATH_TEMPLATE: &'static str = "/v1/models";
6885                    /// Security requirement declared by the spec for this
6886                    /// operation. Outer slice encodes OR alternatives; inner
6887                    /// slice encodes AND requirements within one alternative.
6888                    /// Empty outer slice means "public, no auth required".
6889                    pub const SECURITY: &'static [&'static [&'static str]] = &[&["ApiKeyAuth"]];
6890                    /// Wraps this request with an `Accept` header override.
6891                    ///
6892                    /// The generated [`::toac::MakeRequest`] impl auto-emits an
6893                    /// `Accept` header listing every response media type
6894                    /// declared in the spec. Use this method to steer content
6895                    /// negotiation to one specific type (for example, asking
6896                    /// for `text/event-stream` to land on a streaming branch).
6897                    pub fn with_accept(
6898                        self,
6899                        accept: ::http::HeaderValue,
6900                    ) -> ::toac::WithAccept<Self> {
6901                        ::toac::WithAccept::new(self, accept)
6902                    }
6903                }
6904                impl ::toac::MakeRequest for Request {
6905                    type Error = ::toac::EncodeRequestError;
6906                    fn make_request(
6907                        self,
6908                    ) -> impl ::std::future::Future<
6909                        Output = ::std::result::Result<::toac::Request, Self::Error>,
6910                    > + Send {
6911                        async move {
6912                            let mut __path = ::std::string::String::new();
6913                            __path.push_str("/v1/models");
6914                            let mut __query_first = true;
6915                            if let ::std::option::Option::Some(__value) = &self.before_id {
6916                                ::toac::request::parameter::encode_serialized(
6917                                    &mut __path,
6918                                    "before_id",
6919                                    __value,
6920                                    ::toac::request::parameter::ParameterStyle::Form,
6921                                    true,
6922                                    ::toac::request::parameter::ParameterIn::Query,
6923                                    &mut __query_first,
6924                                )
6925                                .map_err(::toac::EncodeRequestError::new)?;
6926                            }
6927                            if let ::std::option::Option::Some(__value) = &self.after_id {
6928                                ::toac::request::parameter::encode_serialized(
6929                                    &mut __path,
6930                                    "after_id",
6931                                    __value,
6932                                    ::toac::request::parameter::ParameterStyle::Form,
6933                                    true,
6934                                    ::toac::request::parameter::ParameterIn::Query,
6935                                    &mut __query_first,
6936                                )
6937                                .map_err(::toac::EncodeRequestError::new)?;
6938                            }
6939                            if let ::std::option::Option::Some(__value) = &self.limit {
6940                                ::toac::request::parameter::encode_serialized(
6941                                    &mut __path,
6942                                    "limit",
6943                                    __value,
6944                                    ::toac::request::parameter::ParameterStyle::Form,
6945                                    true,
6946                                    ::toac::request::parameter::ParameterIn::Query,
6947                                    &mut __query_first,
6948                                )
6949                                .map_err(::toac::EncodeRequestError::new)?;
6950                            }
6951                            let mut __builder = ::http::Request::builder()
6952                                .method(::http::Method::GET)
6953                                .uri(__path);
6954                            __builder = __builder.header(
6955                                ::http::header::ACCEPT,
6956                                ::http::HeaderValue::from_static("application/json"),
6957                            );
6958                            let mut __request = __builder
6959                                .body(::toac::body::Body::empty())
6960                                .expect("valid generated HTTP request");
6961                            __request
6962                                .extensions_mut()
6963                                .insert(::toac::OperationSecurity(&[&["ApiKeyAuth"]]));
6964                            ::std::result::Result::Ok(__request)
6965                        }
6966                    }
6967                }
6968                #[derive(Debug, Clone, PartialEq)]
6969                pub enum ResponseBody {
6970                    ///OK
6971                    Status200(crate::wire::anthropic::components::ListModelsResponse),
6972                    ///Bad request
6973                    Status400(crate::wire::anthropic::components::ErrorResponse),
6974                    ///Authentication failed
6975                    Status401(crate::wire::anthropic::components::ErrorResponse),
6976                    ///Rate limited
6977                    Status429(crate::wire::anthropic::components::ErrorResponse),
6978                    ///Server error
6979                    Status500(crate::wire::anthropic::components::ErrorResponse),
6980                }
6981                #[derive(Debug, Clone, PartialEq)]
6982                pub struct Response {
6983                    /// Response headers as received from the wire.
6984                    pub headers: ::http::HeaderMap,
6985                    /// Decoded body, dispatched by status (and Content-Type
6986                    /// when the spec declares multiple codecs per status).
6987                    pub body: ResponseBody,
6988                }
6989                impl ::toac::ParseResponse for Response {
6990                    type Error = ::toac::DecodeError;
6991                    fn parse_response<__B>(
6992                        response: ::http::Response<__B>,
6993                    ) -> impl ::std::future::Future<
6994                        Output = ::std::result::Result<Self, Self::Error>,
6995                    > + ::std::marker::Send
6996                    where
6997                        __B: ::http_body::Body<Data = ::bytes::Bytes>
6998                            + ::std::marker::Send
6999                            + ::std::marker::Sync
7000                            + 'static,
7001                        __B::Error: ::std::convert::Into<::toac::BoxError>,
7002                    {
7003                        async move {
7004                            let (__parts, __body) = response.into_parts();
7005                            let __status = __parts.status;
7006                            let __headers = __parts.headers;
7007                            match __status.as_u16() {
7008                                200u16 => {
7009                                    let __decoder = <::toac::body::codec::json::JsonDecoder as ::std::default::Default>::default();
7010                                    let __value =
7011                                        ::toac::body::codec::decode_body(&__decoder, __body)
7012                                            .await
7013                                            .map_err(|e| {
7014                                                ::toac::DecodeError::Codec(
7015                                                    ::std::convert::Into::into(e),
7016                                                )
7017                                            })?;
7018                                    return ::std::result::Result::Ok(Self {
7019                                        headers: __headers,
7020                                        body: ResponseBody::Status200(__value),
7021                                    });
7022                                }
7023                                400u16 => {
7024                                    let __decoder = <::toac::body::codec::json::JsonDecoder as ::std::default::Default>::default();
7025                                    let __value =
7026                                        ::toac::body::codec::decode_body(&__decoder, __body)
7027                                            .await
7028                                            .map_err(|e| {
7029                                                ::toac::DecodeError::Codec(
7030                                                    ::std::convert::Into::into(e),
7031                                                )
7032                                            })?;
7033                                    return ::std::result::Result::Ok(Self {
7034                                        headers: __headers,
7035                                        body: ResponseBody::Status400(__value),
7036                                    });
7037                                }
7038                                401u16 => {
7039                                    let __decoder = <::toac::body::codec::json::JsonDecoder as ::std::default::Default>::default();
7040                                    let __value =
7041                                        ::toac::body::codec::decode_body(&__decoder, __body)
7042                                            .await
7043                                            .map_err(|e| {
7044                                                ::toac::DecodeError::Codec(
7045                                                    ::std::convert::Into::into(e),
7046                                                )
7047                                            })?;
7048                                    return ::std::result::Result::Ok(Self {
7049                                        headers: __headers,
7050                                        body: ResponseBody::Status401(__value),
7051                                    });
7052                                }
7053                                429u16 => {
7054                                    let __decoder = <::toac::body::codec::json::JsonDecoder as ::std::default::Default>::default();
7055                                    let __value =
7056                                        ::toac::body::codec::decode_body(&__decoder, __body)
7057                                            .await
7058                                            .map_err(|e| {
7059                                                ::toac::DecodeError::Codec(
7060                                                    ::std::convert::Into::into(e),
7061                                                )
7062                                            })?;
7063                                    return ::std::result::Result::Ok(Self {
7064                                        headers: __headers,
7065                                        body: ResponseBody::Status429(__value),
7066                                    });
7067                                }
7068                                500u16 => {
7069                                    let __decoder = <::toac::body::codec::json::JsonDecoder as ::std::default::Default>::default();
7070                                    let __value =
7071                                        ::toac::body::codec::decode_body(&__decoder, __body)
7072                                            .await
7073                                            .map_err(|e| {
7074                                                ::toac::DecodeError::Codec(
7075                                                    ::std::convert::Into::into(e),
7076                                                )
7077                                            })?;
7078                                    return ::std::result::Result::Ok(Self {
7079                                        headers: __headers,
7080                                        body: ResponseBody::Status500(__value),
7081                                    });
7082                                }
7083                                _ => {}
7084                            }
7085                            ::std::mem::drop(__body);
7086                            return ::std::result::Result::Err(
7087                                ::toac::DecodeError::UnexpectedStatus(__status),
7088                            );
7089                        }
7090                    }
7091                }
7092                impl ::toac::Operation for Request {
7093                    type Response = Response;
7094                }
7095            }
7096        }
7097        pub mod messages {
7098            pub mod post {
7099                #[derive(Debug, Clone, PartialEq)]
7100                /// # Create a Message
7101                /// 发送一组 user/assistant 消息,让模型生成下一条消息。当 `stream=false`
7102                /// 时同步返回完整 `Message`;`stream=true` 时返回 SSE 流(按 8 类
7103                /// 事件序列拼出最终 Message)。客户端通过 `Accept` 头 (`application/json`
7104                /// vs `text/event-stream`) 选择 200 响应分支——见 `Request::with_accept`。
7105                pub struct Request {
7106                    pub body: crate::wire::anthropic::components::CreateMessageParams,
7107                }
7108                impl Request {
7109                    /// `POST /v1/messages`
7110                    /// Operation ID: `createMessage`.
7111                    pub const METHOD: ::http::Method = ::http::Method::POST;
7112                    /// URL path template, with `{name}` placeholders for path
7113                    /// parameters. Rendering into a concrete URL is the caller's
7114                    /// responsibility.
7115                    pub const PATH_TEMPLATE: &'static str = "/v1/messages";
7116                    /// Security requirement declared by the spec for this
7117                    /// operation. Outer slice encodes OR alternatives; inner
7118                    /// slice encodes AND requirements within one alternative.
7119                    /// Empty outer slice means "public, no auth required".
7120                    pub const SECURITY: &'static [&'static [&'static str]] = &[&["ApiKeyAuth"]];
7121                    /// Wraps this request with an `Accept` header override.
7122                    ///
7123                    /// The generated [`::toac::MakeRequest`] impl auto-emits an
7124                    /// `Accept` header listing every response media type
7125                    /// declared in the spec. Use this method to steer content
7126                    /// negotiation to one specific type (for example, asking
7127                    /// for `text/event-stream` to land on a streaming branch).
7128                    pub fn with_accept(
7129                        self,
7130                        accept: ::http::HeaderValue,
7131                    ) -> ::toac::WithAccept<Self> {
7132                        ::toac::WithAccept::new(self, accept)
7133                    }
7134                }
7135                impl ::toac::MakeRequest for Request {
7136                    type Error = ::serde_json::Error;
7137                    fn make_request(
7138                        self,
7139                    ) -> impl ::std::future::Future<
7140                        Output = ::std::result::Result<::toac::Request, Self::Error>,
7141                    > + Send {
7142                        async move {
7143                            let mut __path = ::std::string::String::new();
7144                            __path.push_str("/v1/messages");
7145                            let mut __builder = ::http::Request::builder()
7146                                .method(::http::Method::POST)
7147                                .uri(__path);
7148                            __builder = __builder.header(
7149                                ::http::header::ACCEPT,
7150                                ::http::HeaderValue::from_static(
7151                                    "application/json, text/event-stream",
7152                                ),
7153                            );
7154                            let mut __request = __builder
7155                                .body(::toac::body::Body::empty())
7156                                .expect("valid generated HTTP request");
7157                            __request
7158                                .extensions_mut()
7159                                .insert(::toac::OperationSecurity(&[&["ApiKeyAuth"]]));
7160                            {
7161                                let __payload = &self.body;
7162                                ::toac::body::codec::encode_body(
7163                                    &<::toac::body::codec::json::JsonEncoder as ::std::default::Default>::default(),
7164                                    __payload,
7165                                    __request,
7166                                )
7167                            }
7168                        }
7169                    }
7170                }
7171                pub enum ResponseBody {
7172                    ///OK
7173                    Status200Json(crate::wire::anthropic::components::Message),
7174                    ///OK
7175                    Status200Sse(::toac::body::codec::sse::SseEventStream),
7176                    ///Bad request
7177                    Status400(crate::wire::anthropic::components::ErrorResponse),
7178                    ///Authentication failed
7179                    Status401(crate::wire::anthropic::components::ErrorResponse),
7180                    ///Forbidden
7181                    Status403(crate::wire::anthropic::components::ErrorResponse),
7182                    ///Not found
7183                    Status404(crate::wire::anthropic::components::ErrorResponse),
7184                    ///Request too large
7185                    Status413(crate::wire::anthropic::components::ErrorResponse),
7186                    ///Rate limited
7187                    Status429(crate::wire::anthropic::components::ErrorResponse),
7188                    ///Server error
7189                    Status500(crate::wire::anthropic::components::ErrorResponse),
7190                    ///Overloaded
7191                    Status529(crate::wire::anthropic::components::ErrorResponse),
7192                }
7193                pub struct Response {
7194                    /// Response headers as received from the wire.
7195                    pub headers: ::http::HeaderMap,
7196                    /// Decoded body, dispatched by status (and Content-Type
7197                    /// when the spec declares multiple codecs per status).
7198                    pub body: ResponseBody,
7199                }
7200                impl ::toac::ParseResponse for Response {
7201                    type Error = ::toac::DecodeError;
7202                    fn parse_response<__B>(
7203                        response: ::http::Response<__B>,
7204                    ) -> impl ::std::future::Future<
7205                        Output = ::std::result::Result<Self, Self::Error>,
7206                    > + ::std::marker::Send
7207                    where
7208                        __B: ::http_body::Body<Data = ::bytes::Bytes>
7209                            + ::std::marker::Send
7210                            + ::std::marker::Sync
7211                            + 'static,
7212                        __B::Error: ::std::convert::Into<::toac::BoxError>,
7213                    {
7214                        async move {
7215                            let (__parts, __body) = response.into_parts();
7216                            let __status = __parts.status;
7217                            let __headers = __parts.headers;
7218                            let __content_type = __headers
7219                                .get(::http::header::CONTENT_TYPE)
7220                                .and_then(|v| v.to_str().ok())
7221                                .map(|s| {
7222                                    s.split(';').next().unwrap_or(s).trim().to_ascii_lowercase()
7223                                });
7224                            match __status.as_u16() {
7225                                200u16 => match __content_type.as_deref() {
7226                                    ::std::option::Option::Some(__ct)
7227                                        if __ct == "application/json" =>
7228                                    {
7229                                        let __decoder = <::toac::body::codec::json::JsonDecoder as ::std::default::Default>::default();
7230                                        let __value =
7231                                            ::toac::body::codec::decode_body(&__decoder, __body)
7232                                                .await
7233                                                .map_err(|e| {
7234                                                    ::toac::DecodeError::Codec(
7235                                                        ::std::convert::Into::into(e),
7236                                                    )
7237                                                })?;
7238                                        return ::std::result::Result::Ok(Self {
7239                                            headers: __headers,
7240                                            body: ResponseBody::Status200Json(__value),
7241                                        });
7242                                    }
7243                                    ::std::option::Option::Some(__ct)
7244                                        if __ct == "text/event-stream" =>
7245                                    {
7246                                        let __decoder = <::toac::body::codec::sse::SseDecoder as ::std::default::Default>::default();
7247                                        let __value =
7248                                            ::toac::body::codec::decode_body(&__decoder, __body)
7249                                                .await
7250                                                .map_err(|e| {
7251                                                    ::toac::DecodeError::Codec(
7252                                                        ::std::convert::Into::into(e),
7253                                                    )
7254                                                })?;
7255                                        return ::std::result::Result::Ok(Self {
7256                                            headers: __headers,
7257                                            body: ResponseBody::Status200Sse(__value),
7258                                        });
7259                                    }
7260                                    _ => {
7261                                        let __decoder = <::toac::body::codec::json::JsonDecoder as ::std::default::Default>::default();
7262                                        let __value =
7263                                            ::toac::body::codec::decode_body(&__decoder, __body)
7264                                                .await
7265                                                .map_err(|e| {
7266                                                    ::toac::DecodeError::Codec(
7267                                                        ::std::convert::Into::into(e),
7268                                                    )
7269                                                })?;
7270                                        return ::std::result::Result::Ok(Self {
7271                                            headers: __headers,
7272                                            body: ResponseBody::Status200Json(__value),
7273                                        });
7274                                    }
7275                                },
7276                                400u16 => {
7277                                    let __decoder = <::toac::body::codec::json::JsonDecoder as ::std::default::Default>::default();
7278                                    let __value =
7279                                        ::toac::body::codec::decode_body(&__decoder, __body)
7280                                            .await
7281                                            .map_err(|e| {
7282                                                ::toac::DecodeError::Codec(
7283                                                    ::std::convert::Into::into(e),
7284                                                )
7285                                            })?;
7286                                    return ::std::result::Result::Ok(Self {
7287                                        headers: __headers,
7288                                        body: ResponseBody::Status400(__value),
7289                                    });
7290                                }
7291                                401u16 => {
7292                                    let __decoder = <::toac::body::codec::json::JsonDecoder as ::std::default::Default>::default();
7293                                    let __value =
7294                                        ::toac::body::codec::decode_body(&__decoder, __body)
7295                                            .await
7296                                            .map_err(|e| {
7297                                                ::toac::DecodeError::Codec(
7298                                                    ::std::convert::Into::into(e),
7299                                                )
7300                                            })?;
7301                                    return ::std::result::Result::Ok(Self {
7302                                        headers: __headers,
7303                                        body: ResponseBody::Status401(__value),
7304                                    });
7305                                }
7306                                403u16 => {
7307                                    let __decoder = <::toac::body::codec::json::JsonDecoder as ::std::default::Default>::default();
7308                                    let __value =
7309                                        ::toac::body::codec::decode_body(&__decoder, __body)
7310                                            .await
7311                                            .map_err(|e| {
7312                                                ::toac::DecodeError::Codec(
7313                                                    ::std::convert::Into::into(e),
7314                                                )
7315                                            })?;
7316                                    return ::std::result::Result::Ok(Self {
7317                                        headers: __headers,
7318                                        body: ResponseBody::Status403(__value),
7319                                    });
7320                                }
7321                                404u16 => {
7322                                    let __decoder = <::toac::body::codec::json::JsonDecoder as ::std::default::Default>::default();
7323                                    let __value =
7324                                        ::toac::body::codec::decode_body(&__decoder, __body)
7325                                            .await
7326                                            .map_err(|e| {
7327                                                ::toac::DecodeError::Codec(
7328                                                    ::std::convert::Into::into(e),
7329                                                )
7330                                            })?;
7331                                    return ::std::result::Result::Ok(Self {
7332                                        headers: __headers,
7333                                        body: ResponseBody::Status404(__value),
7334                                    });
7335                                }
7336                                413u16 => {
7337                                    let __decoder = <::toac::body::codec::json::JsonDecoder as ::std::default::Default>::default();
7338                                    let __value =
7339                                        ::toac::body::codec::decode_body(&__decoder, __body)
7340                                            .await
7341                                            .map_err(|e| {
7342                                                ::toac::DecodeError::Codec(
7343                                                    ::std::convert::Into::into(e),
7344                                                )
7345                                            })?;
7346                                    return ::std::result::Result::Ok(Self {
7347                                        headers: __headers,
7348                                        body: ResponseBody::Status413(__value),
7349                                    });
7350                                }
7351                                429u16 => {
7352                                    let __decoder = <::toac::body::codec::json::JsonDecoder as ::std::default::Default>::default();
7353                                    let __value =
7354                                        ::toac::body::codec::decode_body(&__decoder, __body)
7355                                            .await
7356                                            .map_err(|e| {
7357                                                ::toac::DecodeError::Codec(
7358                                                    ::std::convert::Into::into(e),
7359                                                )
7360                                            })?;
7361                                    return ::std::result::Result::Ok(Self {
7362                                        headers: __headers,
7363                                        body: ResponseBody::Status429(__value),
7364                                    });
7365                                }
7366                                500u16 => {
7367                                    let __decoder = <::toac::body::codec::json::JsonDecoder as ::std::default::Default>::default();
7368                                    let __value =
7369                                        ::toac::body::codec::decode_body(&__decoder, __body)
7370                                            .await
7371                                            .map_err(|e| {
7372                                                ::toac::DecodeError::Codec(
7373                                                    ::std::convert::Into::into(e),
7374                                                )
7375                                            })?;
7376                                    return ::std::result::Result::Ok(Self {
7377                                        headers: __headers,
7378                                        body: ResponseBody::Status500(__value),
7379                                    });
7380                                }
7381                                529u16 => {
7382                                    let __decoder = <::toac::body::codec::json::JsonDecoder as ::std::default::Default>::default();
7383                                    let __value =
7384                                        ::toac::body::codec::decode_body(&__decoder, __body)
7385                                            .await
7386                                            .map_err(|e| {
7387                                                ::toac::DecodeError::Codec(
7388                                                    ::std::convert::Into::into(e),
7389                                                )
7390                                            })?;
7391                                    return ::std::result::Result::Ok(Self {
7392                                        headers: __headers,
7393                                        body: ResponseBody::Status529(__value),
7394                                    });
7395                                }
7396                                _ => {}
7397                            }
7398                            ::std::mem::drop(__body);
7399                            return ::std::result::Result::Err(
7400                                ::toac::DecodeError::UnexpectedStatus(__status),
7401                            );
7402                        }
7403                    }
7404                }
7405                impl ::toac::Operation for Request {
7406                    type Response = Response;
7407                }
7408            }
7409        }
7410    }
7411}
7412pub mod servers {
7413    #![allow(deprecated)]
7414    #![allow(unreachable_patterns)]
7415    #![allow(non_camel_case_types)]
7416    #![allow(non_snake_case)]
7417    #![allow(clippy::all, clippy::pedantic)]
7418    /// `https://api.anthropic.com`
7419    /// Anthropic 官方 API endpoint。base_url 由 provider 在运行期通过
7420    /// `ANTHROPIC_BASE_URL` env 覆盖(codegen 不参与)。
7421    #[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
7422    pub struct ServerOption0;
7423    impl ::toac::Server for ServerOption0 {
7424        fn base_url(&self) -> ::std::borrow::Cow<'_, str> {
7425            ::std::borrow::Cow::Borrowed("https://api.anthropic.com")
7426        }
7427    }
7428    pub type ApiServer = ServerOption0;
7429}
7430pub mod security {
7431    #![allow(deprecated)]
7432    #![allow(unreachable_patterns)]
7433    #![allow(non_camel_case_types)]
7434    #![allow(non_snake_case)]
7435    #![allow(clippy::all, clippy::pedantic)]
7436    /// API-key credential. The value is sent verbatim in the
7437    /// header / query / cookie slot declared by the spec.
7438    #[derive(Debug, Clone)]
7439    pub struct ApiKeyAuthCredential {
7440        pub value: ::std::string::String,
7441    }
7442    impl ApiKeyAuthCredential {
7443        /// Builds a credential from a raw key value.
7444        pub fn new<V: ::std::convert::Into<::std::string::String>>(value: V) -> Self {
7445            Self {
7446                value: value.into(),
7447            }
7448        }
7449        /// Projects into the runtime's concrete credential.
7450        fn as_runtime(&self) -> ::toac::security::ApiKeyCredential {
7451            ::toac::security::ApiKeyCredential {
7452                name: "x-api-key",
7453                location: ::toac::security::ApiKeyLocation::Header,
7454                value: self.value.clone(),
7455            }
7456        }
7457    }
7458    impl ::toac::SecurityCredential for ApiKeyAuthCredential {
7459        fn apply(
7460            &self,
7461            req: ::toac::Request,
7462        ) -> impl ::std::future::Future<
7463            Output = ::std::result::Result<::toac::Request, ::toac::BoxError>,
7464        > + ::std::marker::Send {
7465            let __cred = self.as_runtime();
7466            async move { ::toac::SecurityCredential::apply(&__cred, req).await }
7467        }
7468    }
7469    /// Aggregate of every credential the spec's security schemes
7470    /// might need. Each field is optional — callers populate only
7471    /// the schemes they actually use. Build through
7472    /// [`AuthConfig::builder`].
7473    #[derive(Debug, Clone, Default)]
7474    pub struct AuthConfig {
7475        pub api_key_auth: ::std::option::Option<ApiKeyAuthCredential>,
7476    }
7477    impl AuthConfig {
7478        /// Starts a fluent builder for [`AuthConfig`]. Each setter
7479        /// is named after the scheme's key in
7480        /// `components.securitySchemes`, normalised to snake_case.
7481        pub fn builder() -> AuthConfigBuilder {
7482            <AuthConfigBuilder as ::std::default::Default>::default()
7483        }
7484    }
7485    #[derive(Debug, Clone, Default)]
7486    pub struct AuthConfigBuilder {
7487        api_key_auth: ::std::option::Option<ApiKeyAuthCredential>,
7488    }
7489    impl AuthConfigBuilder {
7490        /// Provides the API-key credential for this scheme.
7491        pub fn api_key_auth<V>(mut self, value: V) -> Self
7492        where
7493            V: ::std::convert::Into<::std::string::String>,
7494        {
7495            self.api_key_auth = ::std::option::Option::Some(ApiKeyAuthCredential::new(value));
7496            self
7497        }
7498        /// Finalises into an [`AuthConfig`].
7499        pub fn build(self) -> AuthConfig {
7500            let Self { api_key_auth } = self;
7501            AuthConfig { api_key_auth }
7502        }
7503    }
7504    impl ::toac::AuthSelector for AuthConfig {
7505        fn apply_for(
7506            &self,
7507            req: ::toac::Request,
7508            requirements: &'static [&'static [&'static str]],
7509        ) -> ::toac::security::AuthFuture<'_> {
7510            ::std::boxed::Box::pin(async move {
7511                if requirements.is_empty() {
7512                    return ::std::result::Result::Ok(req);
7513                }
7514                let mut __chosen: ::std::option::Option<&'static [&'static str]> =
7515                    ::std::option::Option::None;
7516                for __alt in requirements {
7517                    let mut __can_satisfy = true;
7518                    let mut __matched_any = false;
7519                    for __scheme in __alt.iter().copied() {
7520                        if __scheme == "ApiKeyAuth" {
7521                            let ::std::option::Option::Some(_) = &self.api_key_auth else {
7522                                __can_satisfy = false;
7523                                break;
7524                            };
7525                            __matched_any = true;
7526                            continue;
7527                        }
7528                        let _ = __matched_any;
7529                        __can_satisfy = false;
7530                        break;
7531                    }
7532                    if __can_satisfy && __matched_any {
7533                        __chosen = ::std::option::Option::Some(__alt);
7534                        break;
7535                    }
7536                }
7537                let ::std::option::Option::Some(__alt) = __chosen else {
7538                    return ::std::result::Result::Err(::std::convert::Into::into(::std::format!(
7539                        "no configured credentials satisfy {:?}",
7540                        requirements,
7541                    )));
7542                };
7543                let mut __req = req;
7544                for __scheme in __alt.iter().copied() {
7545                    if __scheme == "ApiKeyAuth" {
7546                        let ::std::option::Option::Some(__cred) = &self.api_key_auth else {
7547                            continue;
7548                        };
7549                        __req = ::toac::SecurityCredential::apply(__cred, __req).await?;
7550                        continue;
7551                    }
7552                }
7553                ::std::result::Result::Ok(__req)
7554            })
7555        }
7556    }
7557}