Skip to main content

inference_gateway_sdk/generated/
schemas.rs

1// @generated - DO NOT EDIT.
2// Regenerate with `task generate-types` (or `cargo run -p gen-types --release`).
3// Source: openapi.yaml (components.schemas).
4
5#![allow(clippy::all)]
6#![allow(missing_docs)]
7#![allow(unused_imports)]
8#![allow(non_camel_case_types)]
9#![allow(dead_code)]
10
11/// Error types.
12pub mod error {
13    /// Error from a `TryFrom` or `FromStr` implementation.
14    pub struct ConversionError(::std::borrow::Cow<'static, str>);
15    impl ::std::error::Error for ConversionError {}
16    impl ::std::fmt::Display for ConversionError {
17        fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> Result<(), ::std::fmt::Error> {
18            ::std::fmt::Display::fmt(&self.0, f)
19        }
20    }
21    impl ::std::fmt::Debug for ConversionError {
22        fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> Result<(), ::std::fmt::Error> {
23            ::std::fmt::Debug::fmt(&self.0, f)
24        }
25    }
26    impl From<&'static str> for ConversionError {
27        fn from(value: &'static str) -> Self {
28            Self(value.into())
29        }
30    }
31    impl From<String> for ConversionError {
32        fn from(value: String) -> Self {
33            Self(value.into())
34        }
35    }
36}
37/**Cache control settings for prompt caching. Currently only
38`ephemeral` caching is supported.
39*/
40///
41/// <details><summary>JSON schema</summary>
42///
43/// ```json
44///{
45///  "description": "Cache control settings for prompt caching. Currently only\n`ephemeral` caching is supported.\n",
46///  "type": "object",
47///  "required": [
48///    "type"
49///  ],
50///  "properties": {
51///    "type": {
52///      "description": "The cache control type. Currently only `ephemeral`.",
53///      "type": "string",
54///      "enum": [
55///        "ephemeral"
56///      ]
57///    }
58///  }
59///}
60/// ```
61/// </details>
62#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
63pub struct CacheControl {
64    ///The cache control type. Currently only `ephemeral`.
65    #[serde(rename = "type")]
66    pub type_: CacheControlType,
67}
68///The cache control type. Currently only `ephemeral`.
69///
70/// <details><summary>JSON schema</summary>
71///
72/// ```json
73///{
74///  "description": "The cache control type. Currently only `ephemeral`.",
75///  "type": "string",
76///  "enum": [
77///    "ephemeral"
78///  ]
79///}
80/// ```
81/// </details>
82#[derive(
83    ::serde::Deserialize,
84    ::serde::Serialize,
85    Clone,
86    Copy,
87    Debug,
88    Eq,
89    Hash,
90    Ord,
91    PartialEq,
92    PartialOrd,
93)]
94pub enum CacheControlType {
95    #[serde(rename = "ephemeral")]
96    Ephemeral,
97}
98impl ::std::fmt::Display for CacheControlType {
99    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
100        match *self {
101            Self::Ephemeral => f.write_str("ephemeral"),
102        }
103    }
104}
105impl ::std::str::FromStr for CacheControlType {
106    type Err = self::error::ConversionError;
107    fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
108        match value {
109            "ephemeral" => Ok(Self::Ephemeral),
110            _ => Err("invalid value".into()),
111        }
112    }
113}
114impl ::std::convert::TryFrom<&str> for CacheControlType {
115    type Error = self::error::ConversionError;
116    fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
117        value.parse()
118    }
119}
120impl ::std::convert::TryFrom<&::std::string::String> for CacheControlType {
121    type Error = self::error::ConversionError;
122    fn try_from(
123        value: &::std::string::String,
124    ) -> ::std::result::Result<Self, self::error::ConversionError> {
125        value.parse()
126    }
127}
128impl ::std::convert::TryFrom<::std::string::String> for CacheControlType {
129    type Error = self::error::ConversionError;
130    fn try_from(
131        value: ::std::string::String,
132    ) -> ::std::result::Result<Self, self::error::ConversionError> {
133        value.parse()
134    }
135}
136///`ChatCompletionChoice`
137///
138/// <details><summary>JSON schema</summary>
139///
140/// ```json
141///{
142///  "type": "object",
143///  "required": [
144///    "finish_reason",
145///    "index",
146///    "message"
147///  ],
148///  "properties": {
149///    "finish_reason": {
150///      "$ref": "#/definitions/FinishReason"
151///    },
152///    "index": {
153///      "description": "The index of the choice in the list of choices.",
154///      "type": "integer"
155///    },
156///    "logprobs": {
157///      "description": "Log probability information for the choice.",
158///      "type": "object",
159///      "required": [
160///        "content",
161///        "refusal"
162///      ],
163///      "properties": {
164///        "content": {
165///          "description": "A list of message content tokens with log probability information.",
166///          "type": "array",
167///          "items": {
168///            "$ref": "#/definitions/ChatCompletionTokenLogprob"
169///          }
170///        },
171///        "refusal": {
172///          "description": "A list of message refusal tokens with log probability information.",
173///          "type": "array",
174///          "items": {
175///            "$ref": "#/definitions/ChatCompletionTokenLogprob"
176///          }
177///        }
178///      },
179///      "nullable": true
180///    },
181///    "message": {
182///      "$ref": "#/definitions/Message"
183///    }
184///  }
185///}
186/// ```
187/// </details>
188#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
189pub struct ChatCompletionChoice {
190    pub finish_reason: FinishReason,
191    ///The index of the choice in the list of choices.
192    pub index: i64,
193    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
194    pub logprobs: ::std::option::Option<ChatCompletionChoiceLogprobs>,
195    pub message: Message,
196}
197///Log probability information for the choice.
198///
199/// <details><summary>JSON schema</summary>
200///
201/// ```json
202///{
203///  "description": "Log probability information for the choice.",
204///  "type": "object",
205///  "required": [
206///    "content",
207///    "refusal"
208///  ],
209///  "properties": {
210///    "content": {
211///      "description": "A list of message content tokens with log probability information.",
212///      "type": "array",
213///      "items": {
214///        "$ref": "#/definitions/ChatCompletionTokenLogprob"
215///      }
216///    },
217///    "refusal": {
218///      "description": "A list of message refusal tokens with log probability information.",
219///      "type": "array",
220///      "items": {
221///        "$ref": "#/definitions/ChatCompletionTokenLogprob"
222///      }
223///    }
224///  },
225///  "nullable": true
226///}
227/// ```
228/// </details>
229#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
230pub struct ChatCompletionChoiceLogprobs {
231    ///A list of message content tokens with log probability information.
232    pub content: ::std::vec::Vec<ChatCompletionTokenLogprob>,
233    ///A list of message refusal tokens with log probability information.
234    pub refusal: ::std::vec::Vec<ChatCompletionTokenLogprob>,
235}
236///`ChatCompletionMessageToolCall`
237///
238/// <details><summary>JSON schema</summary>
239///
240/// ```json
241///{
242///  "type": "object",
243///  "required": [
244///    "function",
245///    "id",
246///    "type"
247///  ],
248///  "properties": {
249///    "extra_content": {
250///      "$ref": "#/definitions/ToolCallExtraContent"
251///    },
252///    "function": {
253///      "$ref": "#/definitions/ChatCompletionMessageToolCallFunction"
254///    },
255///    "id": {
256///      "description": "The ID of the tool call.",
257///      "type": "string"
258///    },
259///    "type": {
260///      "$ref": "#/definitions/ChatCompletionToolType"
261///    }
262///  }
263///}
264/// ```
265/// </details>
266#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
267pub struct ChatCompletionMessageToolCall {
268    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
269    pub extra_content: ::std::option::Option<ToolCallExtraContent>,
270    pub function: ChatCompletionMessageToolCallFunction,
271    ///The ID of the tool call.
272    pub id: ::std::string::String,
273    #[serde(rename = "type")]
274    pub type_: ChatCompletionToolType,
275}
276///`ChatCompletionMessageToolCallChunk`
277///
278/// <details><summary>JSON schema</summary>
279///
280/// ```json
281///{
282///  "type": "object",
283///  "required": [
284///    "index"
285///  ],
286///  "properties": {
287///    "extra_content": {
288///      "$ref": "#/definitions/ToolCallExtraContent"
289///    },
290///    "function": {
291///      "$ref": "#/definitions/ChatCompletionMessageToolCallFunction"
292///    },
293///    "id": {
294///      "description": "The ID of the tool call.",
295///      "type": "string"
296///    },
297///    "index": {
298///      "type": "integer"
299///    },
300///    "type": {
301///      "description": "The type of the tool. Currently, only `function` is supported.",
302///      "type": "string"
303///    }
304///  }
305///}
306/// ```
307/// </details>
308#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
309pub struct ChatCompletionMessageToolCallChunk {
310    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
311    pub extra_content: ::std::option::Option<ToolCallExtraContent>,
312    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
313    pub function: ::std::option::Option<ChatCompletionMessageToolCallFunction>,
314    ///The ID of the tool call.
315    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
316    pub id: ::std::option::Option<::std::string::String>,
317    pub index: i64,
318    ///The type of the tool. Currently, only `function` is supported.
319    #[serde(
320        rename = "type",
321        default,
322        skip_serializing_if = "::std::option::Option::is_none"
323    )]
324    pub type_: ::std::option::Option<::std::string::String>,
325}
326///The function that the model called.
327///
328/// <details><summary>JSON schema</summary>
329///
330/// ```json
331///{
332///  "description": "The function that the model called.",
333///  "type": "object",
334///  "required": [
335///    "arguments",
336///    "name"
337///  ],
338///  "properties": {
339///    "arguments": {
340///      "description": "The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function.",
341///      "type": "string"
342///    },
343///    "name": {
344///      "description": "The name of the function to call.",
345///      "type": "string"
346///    }
347///  }
348///}
349/// ```
350/// </details>
351#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
352pub struct ChatCompletionMessageToolCallFunction {
353    ///The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function.
354    pub arguments: ::std::string::String,
355    ///The name of the function to call.
356    pub name: ::std::string::String,
357}
358/**Specifies a tool the model should use. Use to force the model to call a specific function.
359*/
360///
361/// <details><summary>JSON schema</summary>
362///
363/// ```json
364///{
365///  "description": "Specifies a tool the model should use. Use to force the model to call a specific function.\n",
366///  "type": "object",
367///  "required": [
368///    "function",
369///    "type"
370///  ],
371///  "properties": {
372///    "function": {
373///      "type": "object",
374///      "required": [
375///        "name"
376///      ],
377///      "properties": {
378///        "name": {
379///          "description": "The name of the function to call.",
380///          "type": "string"
381///        }
382///      }
383///    },
384///    "type": {
385///      "$ref": "#/definitions/ChatCompletionToolType"
386///    }
387///  }
388///}
389/// ```
390/// </details>
391#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
392pub struct ChatCompletionNamedToolChoice {
393    pub function: ChatCompletionNamedToolChoiceFunction,
394    #[serde(rename = "type")]
395    pub type_: ChatCompletionToolType,
396}
397///`ChatCompletionNamedToolChoiceFunction`
398///
399/// <details><summary>JSON schema</summary>
400///
401/// ```json
402///{
403///  "type": "object",
404///  "required": [
405///    "name"
406///  ],
407///  "properties": {
408///    "name": {
409///      "description": "The name of the function to call.",
410///      "type": "string"
411///    }
412///  }
413///}
414/// ```
415/// </details>
416#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
417pub struct ChatCompletionNamedToolChoiceFunction {
418    ///The name of the function to call.
419    pub name: ::std::string::String,
420}
421///`ChatCompletionStreamChoice`
422///
423/// <details><summary>JSON schema</summary>
424///
425/// ```json
426///{
427///  "type": "object",
428///  "required": [
429///    "delta",
430///    "index"
431///  ],
432///  "properties": {
433///    "delta": {
434///      "$ref": "#/definitions/ChatCompletionStreamResponseDelta"
435///    },
436///    "finish_reason": {
437///      "$ref": "#/definitions/FinishReason"
438///    },
439///    "index": {
440///      "description": "The index of the choice in the list of choices.",
441///      "type": "integer"
442///    },
443///    "logprobs": {
444///      "description": "Log probability information for the choice.",
445///      "type": "object",
446///      "required": [
447///        "content",
448///        "refusal"
449///      ],
450///      "properties": {
451///        "content": {
452///          "description": "A list of message content tokens with log probability information.",
453///          "type": "array",
454///          "items": {
455///            "$ref": "#/definitions/ChatCompletionTokenLogprob"
456///          }
457///        },
458///        "refusal": {
459///          "description": "A list of message refusal tokens with log probability information.",
460///          "type": "array",
461///          "items": {
462///            "$ref": "#/definitions/ChatCompletionTokenLogprob"
463///          }
464///        }
465///      }
466///    }
467///  }
468///}
469/// ```
470/// </details>
471#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
472pub struct ChatCompletionStreamChoice {
473    pub delta: ChatCompletionStreamResponseDelta,
474    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
475    pub finish_reason: ::std::option::Option<FinishReason>,
476    ///The index of the choice in the list of choices.
477    pub index: i64,
478    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
479    pub logprobs: ::std::option::Option<ChatCompletionStreamChoiceLogprobs>,
480}
481///Log probability information for the choice.
482///
483/// <details><summary>JSON schema</summary>
484///
485/// ```json
486///{
487///  "description": "Log probability information for the choice.",
488///  "type": "object",
489///  "required": [
490///    "content",
491///    "refusal"
492///  ],
493///  "properties": {
494///    "content": {
495///      "description": "A list of message content tokens with log probability information.",
496///      "type": "array",
497///      "items": {
498///        "$ref": "#/definitions/ChatCompletionTokenLogprob"
499///      }
500///    },
501///    "refusal": {
502///      "description": "A list of message refusal tokens with log probability information.",
503///      "type": "array",
504///      "items": {
505///        "$ref": "#/definitions/ChatCompletionTokenLogprob"
506///      }
507///    }
508///  }
509///}
510/// ```
511/// </details>
512#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
513pub struct ChatCompletionStreamChoiceLogprobs {
514    ///A list of message content tokens with log probability information.
515    pub content: ::std::vec::Vec<ChatCompletionTokenLogprob>,
516    ///A list of message refusal tokens with log probability information.
517    pub refusal: ::std::vec::Vec<ChatCompletionTokenLogprob>,
518}
519/**Options for streaming response. Only set this when you set `stream: true`.
520*/
521///
522/// <details><summary>JSON schema</summary>
523///
524/// ```json
525///{
526///  "description": "Options for streaming response. Only set this when you set `stream: true`.\n",
527///  "type": "object",
528///  "required": [
529///    "include_usage"
530///  ],
531///  "properties": {
532///    "include_usage": {
533///      "description": "If set, an additional chunk will be streamed before the `data: [DONE]` message. The `usage` field on this chunk shows the token usage statistics for the entire request, and the `choices` field will always be an empty array. All other chunks will also include a `usage` field, but with a null value.\n",
534///      "type": "boolean"
535///    }
536///  }
537///}
538/// ```
539/// </details>
540#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
541pub struct ChatCompletionStreamOptions {
542    /**If set, an additional chunk will be streamed before the `data: [DONE]` message. The `usage` field on this chunk shows the token usage statistics for the entire request, and the `choices` field will always be an empty array. All other chunks will also include a `usage` field, but with a null value.
543     */
544    pub include_usage: bool,
545}
546///A chat completion delta generated by streamed model responses.
547///
548/// <details><summary>JSON schema</summary>
549///
550/// ```json
551///{
552///  "description": "A chat completion delta generated by streamed model responses.",
553///  "type": "object",
554///  "properties": {
555///    "content": {
556///      "description": "The contents of the chunk message.",
557///      "type": "string"
558///    },
559///    "reasoning": {
560///      "description": "The reasoning of the chunk message. Same as reasoning_content.",
561///      "type": "string"
562///    },
563///    "reasoning_content": {
564///      "description": "The reasoning content of the chunk message.",
565///      "type": "string"
566///    },
567///    "refusal": {
568///      "description": "The refusal message generated by the model.",
569///      "type": "string"
570///    },
571///    "role": {
572///      "$ref": "#/definitions/MessageRole"
573///    },
574///    "tool_calls": {
575///      "type": "array",
576///      "items": {
577///        "$ref": "#/definitions/ChatCompletionMessageToolCallChunk"
578///      }
579///    }
580///  }
581///}
582/// ```
583/// </details>
584#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
585pub struct ChatCompletionStreamResponseDelta {
586    ///The contents of the chunk message.
587    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
588    pub content: ::std::option::Option<::std::string::String>,
589    ///The reasoning of the chunk message. Same as reasoning_content.
590    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
591    pub reasoning: ::std::option::Option<::std::string::String>,
592    ///The reasoning content of the chunk message.
593    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
594    pub reasoning_content: ::std::option::Option<::std::string::String>,
595    ///The refusal message generated by the model.
596    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
597    pub refusal: ::std::option::Option<::std::string::String>,
598    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
599    pub role: ::std::option::Option<MessageRole>,
600    #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
601    pub tool_calls: ::std::vec::Vec<ChatCompletionMessageToolCallChunk>,
602}
603impl ::std::default::Default for ChatCompletionStreamResponseDelta {
604    fn default() -> Self {
605        Self {
606            content: Default::default(),
607            reasoning: Default::default(),
608            reasoning_content: Default::default(),
609            refusal: Default::default(),
610            role: Default::default(),
611            tool_calls: Default::default(),
612        }
613    }
614}
615///`ChatCompletionTokenLogprob`
616///
617/// <details><summary>JSON schema</summary>
618///
619/// ```json
620///{
621///  "type": "object",
622///  "required": [
623///    "bytes",
624///    "logprob",
625///    "token",
626///    "top_logprobs"
627///  ],
628///  "properties": {
629///    "bytes": {
630///      "description": "A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be `null` if there is no bytes representation for the token.",
631///      "type": "array",
632///      "items": {
633///        "type": "integer"
634///      }
635///    },
636///    "logprob": {
637///      "description": "The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value `-9999.0` is used to signify that the token is very unlikely.",
638///      "type": "number"
639///    },
640///    "token": {
641///      "description": "The token.",
642///      "type": "string"
643///    },
644///    "top_logprobs": {
645///      "description": "List of the most likely tokens and their log probability, at this token position. In rare cases, there may be fewer than the number of requested `top_logprobs` returned.",
646///      "type": "array",
647///      "items": {
648///        "type": "object",
649///        "required": [
650///          "bytes",
651///          "logprob",
652///          "token"
653///        ],
654///        "properties": {
655///          "bytes": {
656///            "description": "A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be `null` if there is no bytes representation for the token.",
657///            "type": "array",
658///            "items": {
659///              "type": "integer"
660///            }
661///          },
662///          "logprob": {
663///            "description": "The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value `-9999.0` is used to signify that the token is very unlikely.",
664///            "type": "number"
665///          },
666///          "token": {
667///            "description": "The token.",
668///            "type": "string"
669///          }
670///        }
671///      }
672///    }
673///  }
674///}
675/// ```
676/// </details>
677#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
678pub struct ChatCompletionTokenLogprob {
679    ///A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be `null` if there is no bytes representation for the token.
680    pub bytes: ::std::vec::Vec<i64>,
681    ///The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value `-9999.0` is used to signify that the token is very unlikely.
682    pub logprob: f64,
683    ///The token.
684    pub token: ::std::string::String,
685    ///List of the most likely tokens and their log probability, at this token position. In rare cases, there may be fewer than the number of requested `top_logprobs` returned.
686    pub top_logprobs: ::std::vec::Vec<ChatCompletionTokenLogprobTopLogprobsItem>,
687}
688///`ChatCompletionTokenLogprobTopLogprobsItem`
689///
690/// <details><summary>JSON schema</summary>
691///
692/// ```json
693///{
694///  "type": "object",
695///  "required": [
696///    "bytes",
697///    "logprob",
698///    "token"
699///  ],
700///  "properties": {
701///    "bytes": {
702///      "description": "A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be `null` if there is no bytes representation for the token.",
703///      "type": "array",
704///      "items": {
705///        "type": "integer"
706///      }
707///    },
708///    "logprob": {
709///      "description": "The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value `-9999.0` is used to signify that the token is very unlikely.",
710///      "type": "number"
711///    },
712///    "token": {
713///      "description": "The token.",
714///      "type": "string"
715///    }
716///  }
717///}
718/// ```
719/// </details>
720#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
721pub struct ChatCompletionTokenLogprobTopLogprobsItem {
722    ///A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be `null` if there is no bytes representation for the token.
723    pub bytes: ::std::vec::Vec<i64>,
724    ///The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value `-9999.0` is used to signify that the token is very unlikely.
725    pub logprob: f64,
726    ///The token.
727    pub token: ::std::string::String,
728}
729///`ChatCompletionTool`
730///
731/// <details><summary>JSON schema</summary>
732///
733/// ```json
734///{
735///  "type": "object",
736///  "required": [
737///    "function",
738///    "type"
739///  ],
740///  "properties": {
741///    "function": {
742///      "$ref": "#/definitions/FunctionObject"
743///    },
744///    "type": {
745///      "$ref": "#/definitions/ChatCompletionToolType"
746///    }
747///  }
748///}
749/// ```
750/// </details>
751#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
752pub struct ChatCompletionTool {
753    pub function: FunctionObject,
754    #[serde(rename = "type")]
755    pub type_: ChatCompletionToolType,
756}
757/**Controls which (if any) tool is called by the model. `none` means the model will not call any tool and instead generates a message. `auto` means the model can pick between generating a message or calling one or more tools. `required` means the model must call one or more tools. Specifying a particular tool via `{"type": "function", "function": {"name": "my_function"}}` forces the model to call that tool.
758`none` is the default when no tools are present. `auto` is the default if tools are present.
759*/
760///
761/// <details><summary>JSON schema</summary>
762///
763/// ```json
764///{
765///  "description": "Controls which (if any) tool is called by the model. `none` means the model will not call any tool and instead generates a message. `auto` means the model can pick between generating a message or calling one or more tools. `required` means the model must call one or more tools. Specifying a particular tool via `{\"type\": \"function\", \"function\": {\"name\": \"my_function\"}}` forces the model to call that tool.\n`none` is the default when no tools are present. `auto` is the default if tools are present.\n",
766///  "oneOf": [
767///    {
768///      "description": "`none` means the model will not call any tool and instead generates a message. `auto` means the model can pick between generating a message or calling one or more tools. `required` means the model must call one or more tools.\n",
769///      "type": "string",
770///      "enum": [
771///        "none",
772///        "auto",
773///        "required"
774///      ]
775///    },
776///    {
777///      "$ref": "#/definitions/ChatCompletionNamedToolChoice"
778///    }
779///  ]
780///}
781/// ```
782/// </details>
783#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
784#[serde(untagged)]
785pub enum ChatCompletionToolChoiceOption {
786    String(ChatCompletionToolChoiceOptionString),
787    ChatCompletionNamedToolChoice(ChatCompletionNamedToolChoice),
788}
789impl ::std::convert::From<ChatCompletionToolChoiceOptionString> for ChatCompletionToolChoiceOption {
790    fn from(value: ChatCompletionToolChoiceOptionString) -> Self {
791        Self::String(value)
792    }
793}
794impl ::std::convert::From<ChatCompletionNamedToolChoice> for ChatCompletionToolChoiceOption {
795    fn from(value: ChatCompletionNamedToolChoice) -> Self {
796        Self::ChatCompletionNamedToolChoice(value)
797    }
798}
799/**`none` means the model will not call any tool and instead generates a message. `auto` means the model can pick between generating a message or calling one or more tools. `required` means the model must call one or more tools.
800*/
801///
802/// <details><summary>JSON schema</summary>
803///
804/// ```json
805///{
806///  "description": "`none` means the model will not call any tool and instead generates a message. `auto` means the model can pick between generating a message or calling one or more tools. `required` means the model must call one or more tools.\n",
807///  "type": "string",
808///  "enum": [
809///    "none",
810///    "auto",
811///    "required"
812///  ]
813///}
814/// ```
815/// </details>
816#[derive(
817    ::serde::Deserialize,
818    ::serde::Serialize,
819    Clone,
820    Copy,
821    Debug,
822    Eq,
823    Hash,
824    Ord,
825    PartialEq,
826    PartialOrd,
827)]
828pub enum ChatCompletionToolChoiceOptionString {
829    #[serde(rename = "none")]
830    None,
831    #[serde(rename = "auto")]
832    Auto,
833    #[serde(rename = "required")]
834    Required,
835}
836impl ::std::fmt::Display for ChatCompletionToolChoiceOptionString {
837    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
838        match *self {
839            Self::None => f.write_str("none"),
840            Self::Auto => f.write_str("auto"),
841            Self::Required => f.write_str("required"),
842        }
843    }
844}
845impl ::std::str::FromStr for ChatCompletionToolChoiceOptionString {
846    type Err = self::error::ConversionError;
847    fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
848        match value {
849            "none" => Ok(Self::None),
850            "auto" => Ok(Self::Auto),
851            "required" => Ok(Self::Required),
852            _ => Err("invalid value".into()),
853        }
854    }
855}
856impl ::std::convert::TryFrom<&str> for ChatCompletionToolChoiceOptionString {
857    type Error = self::error::ConversionError;
858    fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
859        value.parse()
860    }
861}
862impl ::std::convert::TryFrom<&::std::string::String> for ChatCompletionToolChoiceOptionString {
863    type Error = self::error::ConversionError;
864    fn try_from(
865        value: &::std::string::String,
866    ) -> ::std::result::Result<Self, self::error::ConversionError> {
867        value.parse()
868    }
869}
870impl ::std::convert::TryFrom<::std::string::String> for ChatCompletionToolChoiceOptionString {
871    type Error = self::error::ConversionError;
872    fn try_from(
873        value: ::std::string::String,
874    ) -> ::std::result::Result<Self, self::error::ConversionError> {
875        value.parse()
876    }
877}
878///The type of the tool. Currently, only `function` is supported.
879///
880/// <details><summary>JSON schema</summary>
881///
882/// ```json
883///{
884///  "description": "The type of the tool. Currently, only `function` is supported.",
885///  "type": "string",
886///  "enum": [
887///    "function"
888///  ]
889///}
890/// ```
891/// </details>
892#[derive(
893    ::serde::Deserialize,
894    ::serde::Serialize,
895    Clone,
896    Copy,
897    Debug,
898    Eq,
899    Hash,
900    Ord,
901    PartialEq,
902    PartialOrd,
903)]
904pub enum ChatCompletionToolType {
905    #[serde(rename = "function")]
906    Function,
907}
908impl ::std::fmt::Display for ChatCompletionToolType {
909    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
910        match *self {
911            Self::Function => f.write_str("function"),
912        }
913    }
914}
915impl ::std::str::FromStr for ChatCompletionToolType {
916    type Err = self::error::ConversionError;
917    fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
918        match value {
919            "function" => Ok(Self::Function),
920            _ => Err("invalid value".into()),
921        }
922    }
923}
924impl ::std::convert::TryFrom<&str> for ChatCompletionToolType {
925    type Error = self::error::ConversionError;
926    fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
927        value.parse()
928    }
929}
930impl ::std::convert::TryFrom<&::std::string::String> for ChatCompletionToolType {
931    type Error = self::error::ConversionError;
932    fn try_from(
933        value: &::std::string::String,
934    ) -> ::std::result::Result<Self, self::error::ConversionError> {
935        value.parse()
936    }
937}
938impl ::std::convert::TryFrom<::std::string::String> for ChatCompletionToolType {
939    type Error = self::error::ConversionError;
940    fn try_from(
941        value: ::std::string::String,
942    ) -> ::std::result::Result<Self, self::error::ConversionError> {
943        value.parse()
944    }
945}
946///Usage statistics for the completion request.
947///
948/// <details><summary>JSON schema</summary>
949///
950/// ```json
951///{
952///  "description": "Usage statistics for the completion request.",
953///  "type": "object",
954///  "required": [
955///    "completion_tokens",
956///    "prompt_tokens",
957///    "total_tokens"
958///  ],
959///  "properties": {
960///    "completion_tokens": {
961///      "description": "Number of tokens in the generated completion.",
962///      "default": 0,
963///      "type": "integer",
964///      "format": "int64"
965///    },
966///    "completion_tokens_details": {
967///      "description": "Breakdown of tokens used in a completion.",
968///      "type": "object",
969///      "properties": {
970///        "accepted_prediction_tokens": {
971///          "description": "When using Predicted Outputs, the number of tokens in the prediction that appeared in the completion.",
972///          "default": 0,
973///          "type": "integer",
974///          "format": "int64"
975///        },
976///        "audio_tokens": {
977///          "description": "Audio input tokens generated by the model.",
978///          "default": 0,
979///          "type": "integer",
980///          "format": "int64"
981///        },
982///        "reasoning_tokens": {
983///          "description": "Tokens generated by the model for reasoning.",
984///          "default": 0,
985///          "type": "integer",
986///          "format": "int64"
987///        },
988///        "rejected_prediction_tokens": {
989///          "description": "When using Predicted Outputs, the number of tokens in the prediction that did not appear in the completion. However, like reasoning tokens, these tokens are still counted in the total completion tokens for purposes of billing, output, and context window limits.",
990///          "default": 0,
991///          "type": "integer",
992///          "format": "int64"
993///        }
994///      }
995///    },
996///    "prompt_tokens": {
997///      "description": "Number of tokens in the prompt.",
998///      "default": 0,
999///      "type": "integer",
1000///      "format": "int64"
1001///    },
1002///    "prompt_tokens_details": {
1003///      "description": "Breakdown of tokens used in the prompt.",
1004///      "type": "object",
1005///      "properties": {
1006///        "audio_tokens": {
1007///          "description": "Audio input tokens present in the prompt.",
1008///          "default": 0,
1009///          "type": "integer",
1010///          "format": "int64"
1011///        },
1012///        "cached_tokens": {
1013///          "description": "Cached tokens present in the prompt.",
1014///          "default": 0,
1015///          "type": "integer",
1016///          "format": "int64"
1017///        }
1018///      }
1019///    },
1020///    "total_tokens": {
1021///      "description": "Total number of tokens used in the request (prompt + completion).",
1022///      "default": 0,
1023///      "type": "integer",
1024///      "format": "int64"
1025///    }
1026///  }
1027///}
1028/// ```
1029/// </details>
1030#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
1031pub struct CompletionUsage {
1032    ///Number of tokens in the generated completion.
1033    pub completion_tokens: i64,
1034    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1035    pub completion_tokens_details: ::std::option::Option<CompletionUsageCompletionTokensDetails>,
1036    ///Number of tokens in the prompt.
1037    pub prompt_tokens: i64,
1038    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1039    pub prompt_tokens_details: ::std::option::Option<CompletionUsagePromptTokensDetails>,
1040    ///Total number of tokens used in the request (prompt + completion).
1041    pub total_tokens: i64,
1042}
1043///Breakdown of tokens used in a completion.
1044///
1045/// <details><summary>JSON schema</summary>
1046///
1047/// ```json
1048///{
1049///  "description": "Breakdown of tokens used in a completion.",
1050///  "type": "object",
1051///  "properties": {
1052///    "accepted_prediction_tokens": {
1053///      "description": "When using Predicted Outputs, the number of tokens in the prediction that appeared in the completion.",
1054///      "default": 0,
1055///      "type": "integer",
1056///      "format": "int64"
1057///    },
1058///    "audio_tokens": {
1059///      "description": "Audio input tokens generated by the model.",
1060///      "default": 0,
1061///      "type": "integer",
1062///      "format": "int64"
1063///    },
1064///    "reasoning_tokens": {
1065///      "description": "Tokens generated by the model for reasoning.",
1066///      "default": 0,
1067///      "type": "integer",
1068///      "format": "int64"
1069///    },
1070///    "rejected_prediction_tokens": {
1071///      "description": "When using Predicted Outputs, the number of tokens in the prediction that did not appear in the completion. However, like reasoning tokens, these tokens are still counted in the total completion tokens for purposes of billing, output, and context window limits.",
1072///      "default": 0,
1073///      "type": "integer",
1074///      "format": "int64"
1075///    }
1076///  }
1077///}
1078/// ```
1079/// </details>
1080#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
1081pub struct CompletionUsageCompletionTokensDetails {
1082    ///When using Predicted Outputs, the number of tokens in the prediction that appeared in the completion.
1083    #[serde(default)]
1084    pub accepted_prediction_tokens: i64,
1085    ///Audio input tokens generated by the model.
1086    #[serde(default)]
1087    pub audio_tokens: i64,
1088    ///Tokens generated by the model for reasoning.
1089    #[serde(default)]
1090    pub reasoning_tokens: i64,
1091    ///When using Predicted Outputs, the number of tokens in the prediction that did not appear in the completion. However, like reasoning tokens, these tokens are still counted in the total completion tokens for purposes of billing, output, and context window limits.
1092    #[serde(default)]
1093    pub rejected_prediction_tokens: i64,
1094}
1095impl ::std::default::Default for CompletionUsageCompletionTokensDetails {
1096    fn default() -> Self {
1097        Self {
1098            accepted_prediction_tokens: Default::default(),
1099            audio_tokens: Default::default(),
1100            reasoning_tokens: Default::default(),
1101            rejected_prediction_tokens: Default::default(),
1102        }
1103    }
1104}
1105///Breakdown of tokens used in the prompt.
1106///
1107/// <details><summary>JSON schema</summary>
1108///
1109/// ```json
1110///{
1111///  "description": "Breakdown of tokens used in the prompt.",
1112///  "type": "object",
1113///  "properties": {
1114///    "audio_tokens": {
1115///      "description": "Audio input tokens present in the prompt.",
1116///      "default": 0,
1117///      "type": "integer",
1118///      "format": "int64"
1119///    },
1120///    "cached_tokens": {
1121///      "description": "Cached tokens present in the prompt.",
1122///      "default": 0,
1123///      "type": "integer",
1124///      "format": "int64"
1125///    }
1126///  }
1127///}
1128/// ```
1129/// </details>
1130#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
1131pub struct CompletionUsagePromptTokensDetails {
1132    ///Audio input tokens present in the prompt.
1133    #[serde(default)]
1134    pub audio_tokens: i64,
1135    ///Cached tokens present in the prompt.
1136    #[serde(default)]
1137    pub cached_tokens: i64,
1138}
1139impl ::std::default::Default for CompletionUsagePromptTokensDetails {
1140    fn default() -> Self {
1141        Self {
1142            audio_tokens: Default::default(),
1143            cached_tokens: Default::default(),
1144        }
1145    }
1146}
1147///`Config`
1148///
1149/// <details><summary>JSON schema</summary>
1150///
1151/// ```json
1152///{}
1153/// ```
1154/// </details>
1155#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
1156#[serde(transparent)]
1157pub struct Config(pub ::serde_json::Value);
1158impl ::std::ops::Deref for Config {
1159    type Target = ::serde_json::Value;
1160    fn deref(&self) -> &::serde_json::Value {
1161        &self.0
1162    }
1163}
1164impl ::std::convert::From<Config> for ::serde_json::Value {
1165    fn from(value: Config) -> Self {
1166        value.0
1167    }
1168}
1169impl ::std::convert::From<::serde_json::Value> for Config {
1170    fn from(value: ::serde_json::Value) -> Self {
1171        Self(value)
1172    }
1173}
1174///A content part within a multimodal message
1175///
1176/// <details><summary>JSON schema</summary>
1177///
1178/// ```json
1179///{
1180///  "description": "A content part within a multimodal message",
1181///  "type": "object",
1182///  "oneOf": [
1183///    {
1184///      "$ref": "#/definitions/TextContentPart"
1185///    },
1186///    {
1187///      "$ref": "#/definitions/ImageContentPart"
1188///    }
1189///  ]
1190///}
1191/// ```
1192/// </details>
1193#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
1194#[serde(untagged)]
1195pub enum ContentPart {
1196    TextContentPart(TextContentPart),
1197    ImageContentPart(ImageContentPart),
1198}
1199impl ::std::convert::From<TextContentPart> for ContentPart {
1200    fn from(value: TextContentPart) -> Self {
1201        Self::TextContentPart(value)
1202    }
1203}
1204impl ::std::convert::From<ImageContentPart> for ContentPart {
1205    fn from(value: ImageContentPart) -> Self {
1206        Self::ImageContentPart(value)
1207    }
1208}
1209///Context window information for a model
1210///
1211/// <details><summary>JSON schema</summary>
1212///
1213/// ```json
1214///{
1215///  "description": "Context window information for a model",
1216///  "type": "object",
1217///  "required": [
1218///    "source",
1219///    "tokens"
1220///  ],
1221///  "properties": {
1222///    "source": {
1223///      "description": "Source of the context window information",
1224///      "type": "string",
1225///      "enum": [
1226///        "runtime",
1227///        "provider",
1228///        "community"
1229///      ]
1230///    },
1231///    "tokens": {
1232///      "description": "Maximum number of tokens the model can process in a single request",
1233///      "type": "integer"
1234///    }
1235///  }
1236///}
1237/// ```
1238/// </details>
1239#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
1240pub struct ContextWindow {
1241    ///Source of the context window information
1242    pub source: ContextWindowSource,
1243    ///Maximum number of tokens the model can process in a single request
1244    pub tokens: i64,
1245}
1246///Source of the context window information
1247///
1248/// <details><summary>JSON schema</summary>
1249///
1250/// ```json
1251///{
1252///  "description": "Source of the context window information",
1253///  "type": "string",
1254///  "enum": [
1255///    "runtime",
1256///    "provider",
1257///    "community"
1258///  ]
1259///}
1260/// ```
1261/// </details>
1262#[derive(
1263    ::serde::Deserialize,
1264    ::serde::Serialize,
1265    Clone,
1266    Copy,
1267    Debug,
1268    Eq,
1269    Hash,
1270    Ord,
1271    PartialEq,
1272    PartialOrd,
1273)]
1274pub enum ContextWindowSource {
1275    #[serde(rename = "runtime")]
1276    Runtime,
1277    #[serde(rename = "provider")]
1278    Provider,
1279    #[serde(rename = "community")]
1280    Community,
1281}
1282impl ::std::fmt::Display for ContextWindowSource {
1283    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
1284        match *self {
1285            Self::Runtime => f.write_str("runtime"),
1286            Self::Provider => f.write_str("provider"),
1287            Self::Community => f.write_str("community"),
1288        }
1289    }
1290}
1291impl ::std::str::FromStr for ContextWindowSource {
1292    type Err = self::error::ConversionError;
1293    fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
1294        match value {
1295            "runtime" => Ok(Self::Runtime),
1296            "provider" => Ok(Self::Provider),
1297            "community" => Ok(Self::Community),
1298            _ => Err("invalid value".into()),
1299        }
1300    }
1301}
1302impl ::std::convert::TryFrom<&str> for ContextWindowSource {
1303    type Error = self::error::ConversionError;
1304    fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
1305        value.parse()
1306    }
1307}
1308impl ::std::convert::TryFrom<&::std::string::String> for ContextWindowSource {
1309    type Error = self::error::ConversionError;
1310    fn try_from(
1311        value: &::std::string::String,
1312    ) -> ::std::result::Result<Self, self::error::ConversionError> {
1313        value.parse()
1314    }
1315}
1316impl ::std::convert::TryFrom<::std::string::String> for ContextWindowSource {
1317    type Error = self::error::ConversionError;
1318    fn try_from(
1319        value: ::std::string::String,
1320    ) -> ::std::result::Result<Self, self::error::ConversionError> {
1321        value.parse()
1322    }
1323}
1324///`CreateChatCompletionRequest`
1325///
1326/// <details><summary>JSON schema</summary>
1327///
1328/// ```json
1329///{
1330///  "type": "object",
1331///  "required": [
1332///    "messages",
1333///    "model"
1334///  ],
1335///  "properties": {
1336///    "frequency_penalty": {
1337///      "description": "Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim.\n",
1338///      "default": 0,
1339///      "type": "number",
1340///      "maximum": 2.0,
1341///      "minimum": -2.0
1342///    },
1343///    "logit_bias": {
1344///      "description": "Modify the likelihood of specified tokens appearing in the completion. Accepts a JSON object that maps tokens (specified by their token ID in the tokenizer) to an associated bias value from -100 to 100. The bias is added to the logits generated by the model prior to sampling.\n",
1345///      "type": "object",
1346///      "additionalProperties": {
1347///        "type": "integer"
1348///      }
1349///    },
1350///    "logprobs": {
1351///      "description": "Whether to return log probabilities of the output tokens or not. If true, returns the log probabilities of each output token returned in the `content` of `message`.\n",
1352///      "default": false,
1353///      "type": "boolean"
1354///    },
1355///    "max_completion_tokens": {
1356///      "description": "An upper bound for the number of tokens that can be generated for a completion, including visible output tokens and reasoning tokens.\n",
1357///      "type": "integer"
1358///    },
1359///    "max_tokens": {
1360///      "description": "The maximum number of tokens that can be generated in the chat completion. This value can be used to control costs for text generated via API. This value is now deprecated in favor of `max_completion_tokens`, and is not compatible with o-series models.\n",
1361///      "deprecated": true,
1362///      "type": "integer"
1363///    },
1364///    "messages": {
1365///      "description": "A list of messages comprising the conversation so far.\n",
1366///      "type": "array",
1367///      "items": {
1368///        "$ref": "#/definitions/Message"
1369///      },
1370///      "minItems": 1
1371///    },
1372///    "model": {
1373///      "description": "Model ID to use",
1374///      "type": "string"
1375///    },
1376///    "n": {
1377///      "description": "How many chat completion choices to generate for each input message.\n",
1378///      "default": 1,
1379///      "type": "integer",
1380///      "maximum": 128.0,
1381///      "minimum": 1.0
1382///    },
1383///    "parallel_tool_calls": {
1384///      "description": "Whether to enable parallel function calling during tool use.\n",
1385///      "default": true,
1386///      "type": "boolean"
1387///    },
1388///    "presence_penalty": {
1389///      "description": "Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics.\n",
1390///      "default": 0,
1391///      "type": "number",
1392///      "maximum": 2.0,
1393///      "minimum": -2.0
1394///    },
1395///    "reasoning_effort": {
1396///      "description": "Constrains effort on reasoning for reasoning models. Currently supported values are `minimal`, `low`, `medium`, and `high`. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response.\n",
1397///      "type": "string",
1398///      "enum": [
1399///        "minimal",
1400///        "low",
1401///        "medium",
1402///        "high"
1403///      ]
1404///    },
1405///    "reasoning_format": {
1406///      "description": "The format of the reasoning content. Can be `raw` or `parsed`.\nWhen specified as raw some reasoning models will output <think /> tags. When specified as parsed the model will output the reasoning under `reasoning` or `reasoning_content` attribute.\n",
1407///      "type": "string"
1408///    },
1409///    "response_format": {
1410///      "description": "An object specifying the format that the model must output. Setting to `{ \"type\": \"json_schema\", \"json_schema\": {...} }` enables Structured Outputs which guarantees the model will match your supplied JSON schema. Setting to `{ \"type\": \"json_object\" }` enables the older JSON mode, which ensures the message the model generates is valid JSON.\n",
1411///      "oneOf": [
1412///        {
1413///          "$ref": "#/definitions/ResponseFormatText"
1414///        },
1415///        {
1416///          "$ref": "#/definitions/ResponseFormatJsonSchema"
1417///        },
1418///        {
1419///          "$ref": "#/definitions/ResponseFormatJsonObject"
1420///        }
1421///      ]
1422///    },
1423///    "seed": {
1424///      "description": "If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same `seed` and parameters should return the same result. Determinism is not guaranteed, and you should refer to the `system_fingerprint` response parameter to monitor changes in the backend.\n",
1425///      "type": "integer"
1426///    },
1427///    "stop": {
1428///      "description": "Up to 4 sequences where the API will stop generating further tokens.\n",
1429///      "oneOf": [
1430///        {
1431///          "type": "string"
1432///        },
1433///        {
1434///          "type": "array",
1435///          "items": {
1436///            "type": "string"
1437///          },
1438///          "maxItems": 4,
1439///          "minItems": 1
1440///        }
1441///      ]
1442///    },
1443///    "stream": {
1444///      "description": "If set to true, the model response data will be streamed to the client as it is generated using [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format).\n",
1445///      "default": false,
1446///      "type": "boolean"
1447///    },
1448///    "stream_options": {
1449///      "$ref": "#/definitions/ChatCompletionStreamOptions"
1450///    },
1451///    "temperature": {
1452///      "description": "What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.\n",
1453///      "default": 1,
1454///      "type": "number",
1455///      "maximum": 2.0,
1456///      "minimum": 0.0
1457///    },
1458///    "tool_choice": {
1459///      "$ref": "#/definitions/ChatCompletionToolChoiceOption"
1460///    },
1461///    "tools": {
1462///      "description": "A list of tools the model may call. Currently, only functions are supported as a tool. Use this to provide a list of functions the model may generate JSON inputs for. A max of 128 functions are supported.\n",
1463///      "type": "array",
1464///      "items": {
1465///        "$ref": "#/definitions/ChatCompletionTool"
1466///      }
1467///    },
1468///    "top_logprobs": {
1469///      "description": "An integer between 0 and 20 specifying the number of most likely tokens to return at each token position, each with an associated log probability. `logprobs` must be set to `true` if this parameter is used.\n",
1470///      "type": "integer",
1471///      "maximum": 20.0,
1472///      "minimum": 0.0
1473///    },
1474///    "top_p": {
1475///      "description": "An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass.\n",
1476///      "default": 1,
1477///      "type": "number",
1478///      "maximum": 1.0,
1479///      "minimum": 0.0
1480///    },
1481///    "user": {
1482///      "description": "A unique identifier representing your end-user, which can help to monitor and detect abuse.\n",
1483///      "type": "string"
1484///    }
1485///  }
1486///}
1487/// ```
1488/// </details>
1489#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
1490pub struct CreateChatCompletionRequest {
1491    /**Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim.
1492     */
1493    #[serde(default = "defaults::create_chat_completion_request_frequency_penalty")]
1494    pub frequency_penalty: f64,
1495    /**Modify the likelihood of specified tokens appearing in the completion. Accepts a JSON object that maps tokens (specified by their token ID in the tokenizer) to an associated bias value from -100 to 100. The bias is added to the logits generated by the model prior to sampling.
1496     */
1497    #[serde(
1498        default,
1499        skip_serializing_if = ":: std :: collections :: HashMap::is_empty"
1500    )]
1501    pub logit_bias: ::std::collections::HashMap<::std::string::String, i64>,
1502    /**Whether to return log probabilities of the output tokens or not. If true, returns the log probabilities of each output token returned in the `content` of `message`.
1503     */
1504    #[serde(default)]
1505    pub logprobs: bool,
1506    /**An upper bound for the number of tokens that can be generated for a completion, including visible output tokens and reasoning tokens.
1507     */
1508    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1509    pub max_completion_tokens: ::std::option::Option<i64>,
1510    /**The maximum number of tokens that can be generated in the chat completion. This value can be used to control costs for text generated via API. This value is now deprecated in favor of `max_completion_tokens`, and is not compatible with o-series models.
1511     */
1512    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1513    pub max_tokens: ::std::option::Option<i64>,
1514    /**A list of messages comprising the conversation so far.
1515     */
1516    pub messages: ::std::vec::Vec<Message>,
1517    ///Model ID to use
1518    pub model: ::std::string::String,
1519    /**How many chat completion choices to generate for each input message.
1520     */
1521    #[serde(default = "defaults::default_nzu64::<::std::num::NonZeroU64, 1>")]
1522    pub n: ::std::num::NonZeroU64,
1523    /**Whether to enable parallel function calling during tool use.
1524     */
1525    #[serde(default = "defaults::default_bool::<true>")]
1526    pub parallel_tool_calls: bool,
1527    /**Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics.
1528     */
1529    #[serde(default = "defaults::create_chat_completion_request_presence_penalty")]
1530    pub presence_penalty: f64,
1531    /**Constrains effort on reasoning for reasoning models. Currently supported values are `minimal`, `low`, `medium`, and `high`. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response.
1532     */
1533    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1534    pub reasoning_effort: ::std::option::Option<CreateChatCompletionRequestReasoningEffort>,
1535    /**The format of the reasoning content. Can be `raw` or `parsed`.
1536    When specified as raw some reasoning models will output <think /> tags. When specified as parsed the model will output the reasoning under `reasoning` or `reasoning_content` attribute.
1537    */
1538    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1539    pub reasoning_format: ::std::option::Option<::std::string::String>,
1540    /**An object specifying the format that the model must output. Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured Outputs which guarantees the model will match your supplied JSON schema. Setting to `{ "type": "json_object" }` enables the older JSON mode, which ensures the message the model generates is valid JSON.
1541     */
1542    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1543    pub response_format: ::std::option::Option<CreateChatCompletionRequestResponseFormat>,
1544    /**If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same `seed` and parameters should return the same result. Determinism is not guaranteed, and you should refer to the `system_fingerprint` response parameter to monitor changes in the backend.
1545     */
1546    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1547    pub seed: ::std::option::Option<i64>,
1548    /**Up to 4 sequences where the API will stop generating further tokens.
1549     */
1550    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1551    pub stop: ::std::option::Option<CreateChatCompletionRequestStop>,
1552    /**If set to true, the model response data will be streamed to the client as it is generated using [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format).
1553     */
1554    #[serde(default)]
1555    pub stream: bool,
1556    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1557    pub stream_options: ::std::option::Option<ChatCompletionStreamOptions>,
1558    /**What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.
1559     */
1560    #[serde(default = "defaults::create_chat_completion_request_temperature")]
1561    pub temperature: f64,
1562    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1563    pub tool_choice: ::std::option::Option<ChatCompletionToolChoiceOption>,
1564    /**A list of tools the model may call. Currently, only functions are supported as a tool. Use this to provide a list of functions the model may generate JSON inputs for. A max of 128 functions are supported.
1565     */
1566    #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
1567    pub tools: ::std::vec::Vec<ChatCompletionTool>,
1568    /**An integer between 0 and 20 specifying the number of most likely tokens to return at each token position, each with an associated log probability. `logprobs` must be set to `true` if this parameter is used.
1569     */
1570    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1571    pub top_logprobs: ::std::option::Option<i64>,
1572    /**An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass.
1573     */
1574    #[serde(default = "defaults::create_chat_completion_request_top_p")]
1575    pub top_p: f64,
1576    /**A unique identifier representing your end-user, which can help to monitor and detect abuse.
1577     */
1578    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1579    pub user: ::std::option::Option<::std::string::String>,
1580}
1581/**Constrains effort on reasoning for reasoning models. Currently supported values are `minimal`, `low`, `medium`, and `high`. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response.
1582*/
1583///
1584/// <details><summary>JSON schema</summary>
1585///
1586/// ```json
1587///{
1588///  "description": "Constrains effort on reasoning for reasoning models. Currently supported values are `minimal`, `low`, `medium`, and `high`. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response.\n",
1589///  "type": "string",
1590///  "enum": [
1591///    "minimal",
1592///    "low",
1593///    "medium",
1594///    "high"
1595///  ]
1596///}
1597/// ```
1598/// </details>
1599#[derive(
1600    ::serde::Deserialize,
1601    ::serde::Serialize,
1602    Clone,
1603    Copy,
1604    Debug,
1605    Eq,
1606    Hash,
1607    Ord,
1608    PartialEq,
1609    PartialOrd,
1610)]
1611pub enum CreateChatCompletionRequestReasoningEffort {
1612    #[serde(rename = "minimal")]
1613    Minimal,
1614    #[serde(rename = "low")]
1615    Low,
1616    #[serde(rename = "medium")]
1617    Medium,
1618    #[serde(rename = "high")]
1619    High,
1620}
1621impl ::std::fmt::Display for CreateChatCompletionRequestReasoningEffort {
1622    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
1623        match *self {
1624            Self::Minimal => f.write_str("minimal"),
1625            Self::Low => f.write_str("low"),
1626            Self::Medium => f.write_str("medium"),
1627            Self::High => f.write_str("high"),
1628        }
1629    }
1630}
1631impl ::std::str::FromStr for CreateChatCompletionRequestReasoningEffort {
1632    type Err = self::error::ConversionError;
1633    fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
1634        match value {
1635            "minimal" => Ok(Self::Minimal),
1636            "low" => Ok(Self::Low),
1637            "medium" => Ok(Self::Medium),
1638            "high" => Ok(Self::High),
1639            _ => Err("invalid value".into()),
1640        }
1641    }
1642}
1643impl ::std::convert::TryFrom<&str> for CreateChatCompletionRequestReasoningEffort {
1644    type Error = self::error::ConversionError;
1645    fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
1646        value.parse()
1647    }
1648}
1649impl ::std::convert::TryFrom<&::std::string::String>
1650    for CreateChatCompletionRequestReasoningEffort
1651{
1652    type Error = self::error::ConversionError;
1653    fn try_from(
1654        value: &::std::string::String,
1655    ) -> ::std::result::Result<Self, self::error::ConversionError> {
1656        value.parse()
1657    }
1658}
1659impl ::std::convert::TryFrom<::std::string::String> for CreateChatCompletionRequestReasoningEffort {
1660    type Error = self::error::ConversionError;
1661    fn try_from(
1662        value: ::std::string::String,
1663    ) -> ::std::result::Result<Self, self::error::ConversionError> {
1664        value.parse()
1665    }
1666}
1667/**An object specifying the format that the model must output. Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured Outputs which guarantees the model will match your supplied JSON schema. Setting to `{ "type": "json_object" }` enables the older JSON mode, which ensures the message the model generates is valid JSON.
1668*/
1669///
1670/// <details><summary>JSON schema</summary>
1671///
1672/// ```json
1673///{
1674///  "description": "An object specifying the format that the model must output. Setting to `{ \"type\": \"json_schema\", \"json_schema\": {...} }` enables Structured Outputs which guarantees the model will match your supplied JSON schema. Setting to `{ \"type\": \"json_object\" }` enables the older JSON mode, which ensures the message the model generates is valid JSON.\n",
1675///  "oneOf": [
1676///    {
1677///      "$ref": "#/definitions/ResponseFormatText"
1678///    },
1679///    {
1680///      "$ref": "#/definitions/ResponseFormatJsonSchema"
1681///    },
1682///    {
1683///      "$ref": "#/definitions/ResponseFormatJsonObject"
1684///    }
1685///  ]
1686///}
1687/// ```
1688/// </details>
1689#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
1690#[serde(untagged)]
1691pub enum CreateChatCompletionRequestResponseFormat {
1692    Text(ResponseFormatText),
1693    JsonSchema(ResponseFormatJsonSchema),
1694    JsonObject(ResponseFormatJsonObject),
1695}
1696impl ::std::convert::From<ResponseFormatText> for CreateChatCompletionRequestResponseFormat {
1697    fn from(value: ResponseFormatText) -> Self {
1698        Self::Text(value)
1699    }
1700}
1701impl ::std::convert::From<ResponseFormatJsonSchema> for CreateChatCompletionRequestResponseFormat {
1702    fn from(value: ResponseFormatJsonSchema) -> Self {
1703        Self::JsonSchema(value)
1704    }
1705}
1706impl ::std::convert::From<ResponseFormatJsonObject> for CreateChatCompletionRequestResponseFormat {
1707    fn from(value: ResponseFormatJsonObject) -> Self {
1708        Self::JsonObject(value)
1709    }
1710}
1711/**Up to 4 sequences where the API will stop generating further tokens.
1712*/
1713///
1714/// <details><summary>JSON schema</summary>
1715///
1716/// ```json
1717///{
1718///  "description": "Up to 4 sequences where the API will stop generating further tokens.\n",
1719///  "oneOf": [
1720///    {
1721///      "type": "string"
1722///    },
1723///    {
1724///      "type": "array",
1725///      "items": {
1726///        "type": "string"
1727///      },
1728///      "maxItems": 4,
1729///      "minItems": 1
1730///    }
1731///  ]
1732///}
1733/// ```
1734/// </details>
1735#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
1736#[serde(untagged)]
1737pub enum CreateChatCompletionRequestStop {
1738    String(::std::string::String),
1739    Array(::std::vec::Vec<::std::string::String>),
1740}
1741impl ::std::convert::From<::std::vec::Vec<::std::string::String>>
1742    for CreateChatCompletionRequestStop
1743{
1744    fn from(value: ::std::vec::Vec<::std::string::String>) -> Self {
1745        Self::Array(value)
1746    }
1747}
1748///Represents a chat completion response returned by model, based on the provided input.
1749///
1750/// <details><summary>JSON schema</summary>
1751///
1752/// ```json
1753///{
1754///  "description": "Represents a chat completion response returned by model, based on the provided input.",
1755///  "type": "object",
1756///  "required": [
1757///    "choices",
1758///    "created",
1759///    "id",
1760///    "model",
1761///    "object"
1762///  ],
1763///  "properties": {
1764///    "choices": {
1765///      "description": "A list of chat completion choices. Can be more than one if `n` is greater than 1.",
1766///      "type": "array",
1767///      "items": {
1768///        "$ref": "#/definitions/ChatCompletionChoice"
1769///      }
1770///    },
1771///    "created": {
1772///      "description": "The Unix timestamp (in seconds) of when the chat completion was created.",
1773///      "type": "integer"
1774///    },
1775///    "id": {
1776///      "description": "A unique identifier for the chat completion.",
1777///      "type": "string"
1778///    },
1779///    "model": {
1780///      "description": "The model used for the chat completion.",
1781///      "type": "string"
1782///    },
1783///    "object": {
1784///      "description": "The object type, which is always `chat.completion`.",
1785///      "type": "string"
1786///    },
1787///    "usage": {
1788///      "$ref": "#/definitions/CompletionUsage"
1789///    }
1790///  }
1791///}
1792/// ```
1793/// </details>
1794#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
1795pub struct CreateChatCompletionResponse {
1796    ///A list of chat completion choices. Can be more than one if `n` is greater than 1.
1797    pub choices: ::std::vec::Vec<ChatCompletionChoice>,
1798    ///The Unix timestamp (in seconds) of when the chat completion was created.
1799    pub created: i64,
1800    ///A unique identifier for the chat completion.
1801    pub id: ::std::string::String,
1802    ///The model used for the chat completion.
1803    pub model: ::std::string::String,
1804    ///The object type, which is always `chat.completion`.
1805    pub object: ::std::string::String,
1806    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1807    pub usage: ::std::option::Option<CompletionUsage>,
1808}
1809/**Represents a streamed chunk of a chat completion response returned
1810by the model, based on the provided input.
1811*/
1812///
1813/// <details><summary>JSON schema</summary>
1814///
1815/// ```json
1816///{
1817///  "description": "Represents a streamed chunk of a chat completion response returned\nby the model, based on the provided input.\n",
1818///  "type": "object",
1819///  "required": [
1820///    "choices",
1821///    "created",
1822///    "id",
1823///    "model",
1824///    "object"
1825///  ],
1826///  "properties": {
1827///    "choices": {
1828///      "description": "A list of chat completion choices. Can contain more than one elements if `n` is greater than 1. Can also be empty for the\nlast chunk if you set `stream_options: {\"include_usage\": true}`.\n",
1829///      "type": "array",
1830///      "items": {
1831///        "$ref": "#/definitions/ChatCompletionStreamChoice"
1832///      }
1833///    },
1834///    "created": {
1835///      "description": "The Unix timestamp (in seconds) of when the chat completion was created. Each chunk has the same timestamp.",
1836///      "type": "integer"
1837///    },
1838///    "id": {
1839///      "description": "A unique identifier for the chat completion. Each chunk has the same ID.",
1840///      "type": "string"
1841///    },
1842///    "model": {
1843///      "description": "The model to generate the completion.",
1844///      "type": "string"
1845///    },
1846///    "object": {
1847///      "description": "The object type, which is always `chat.completion.chunk`.",
1848///      "type": "string"
1849///    },
1850///    "reasoning_format": {
1851///      "description": "The format of the reasoning content. Can be `raw` or `parsed`.\nWhen specified as raw some reasoning models will output <think /> tags. When specified as parsed the model will output the reasoning under reasoning_content.\n",
1852///      "type": "string"
1853///    },
1854///    "system_fingerprint": {
1855///      "description": "This fingerprint represents the backend configuration that the model runs with.\nCan be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism.\n",
1856///      "type": "string"
1857///    },
1858///    "usage": {
1859///      "$ref": "#/definitions/CompletionUsage"
1860///    }
1861///  }
1862///}
1863/// ```
1864/// </details>
1865#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
1866pub struct CreateChatCompletionStreamResponse {
1867    /**A list of chat completion choices. Can contain more than one elements if `n` is greater than 1. Can also be empty for the
1868    last chunk if you set `stream_options: {"include_usage": true}`.
1869    */
1870    pub choices: ::std::vec::Vec<ChatCompletionStreamChoice>,
1871    ///The Unix timestamp (in seconds) of when the chat completion was created. Each chunk has the same timestamp.
1872    pub created: i64,
1873    ///A unique identifier for the chat completion. Each chunk has the same ID.
1874    pub id: ::std::string::String,
1875    ///The model to generate the completion.
1876    pub model: ::std::string::String,
1877    ///The object type, which is always `chat.completion.chunk`.
1878    pub object: ::std::string::String,
1879    /**The format of the reasoning content. Can be `raw` or `parsed`.
1880    When specified as raw some reasoning models will output <think /> tags. When specified as parsed the model will output the reasoning under reasoning_content.
1881    */
1882    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1883    pub reasoning_format: ::std::option::Option<::std::string::String>,
1884    /**This fingerprint represents the backend configuration that the model runs with.
1885    Can be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism.
1886    */
1887    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1888    pub system_fingerprint: ::std::option::Option<::std::string::String>,
1889    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1890    pub usage: ::std::option::Option<CompletionUsage>,
1891}
1892/**Request body for creating an image via the OpenAI-compatible Images API.
1893*/
1894///
1895/// <details><summary>JSON schema</summary>
1896///
1897/// ```json
1898///{
1899///  "description": "Request body for creating an image via the OpenAI-compatible Images API.\n",
1900///  "type": "object",
1901///  "required": [
1902///    "prompt"
1903///  ],
1904///  "properties": {
1905///    "model": {
1906///      "description": "Model ID to use for image generation.",
1907///      "type": "string"
1908///    },
1909///    "n": {
1910///      "description": "Number of images to generate.",
1911///      "default": 1,
1912///      "type": "integer",
1913///      "maximum": 10.0,
1914///      "minimum": 1.0
1915///    },
1916///    "prompt": {
1917///      "description": "A text description of the desired image.",
1918///      "type": "string"
1919///    },
1920///    "quality": {
1921///      "description": "The quality of the image. `auto` selects the best quality for\nthe model. The GPT image models support `low`, `medium`, and\n`high`; `dall-e-3` supports `standard` and `hd`; `dall-e-2`\nsupports only `standard`.\n",
1922///      "type": "string",
1923///      "enum": [
1924///        "auto",
1925///        "standard",
1926///        "hd",
1927///        "low",
1928///        "medium",
1929///        "high"
1930///      ]
1931///    },
1932///    "response_format": {
1933///      "description": "The format in which the generated images are returned. Must be\none of `url` or `b64_json`.\n",
1934///      "default": "url",
1935///      "type": "string",
1936///      "enum": [
1937///        "url",
1938///        "b64_json"
1939///      ]
1940///    },
1941///    "size": {
1942///      "$ref": "#/definitions/ImageSize"
1943///    }
1944///  }
1945///}
1946/// ```
1947/// </details>
1948#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
1949pub struct CreateImageRequest {
1950    ///Model ID to use for image generation.
1951    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1952    pub model: ::std::option::Option<::std::string::String>,
1953    ///Number of images to generate.
1954    #[serde(default = "defaults::default_nzu64::<::std::num::NonZeroU64, 1>")]
1955    pub n: ::std::num::NonZeroU64,
1956    ///A text description of the desired image.
1957    pub prompt: ::std::string::String,
1958    /**The quality of the image. `auto` selects the best quality for
1959    the model. The GPT image models support `low`, `medium`, and
1960    `high`; `dall-e-3` supports `standard` and `hd`; `dall-e-2`
1961    supports only `standard`.
1962    */
1963    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1964    pub quality: ::std::option::Option<CreateImageRequestQuality>,
1965    /**The format in which the generated images are returned. Must be
1966    one of `url` or `b64_json`.
1967    */
1968    #[serde(default = "defaults::create_image_request_response_format")]
1969    pub response_format: CreateImageRequestResponseFormat,
1970    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1971    pub size: ::std::option::Option<ImageSize>,
1972}
1973/**The quality of the image. `auto` selects the best quality for
1974the model. The GPT image models support `low`, `medium`, and
1975`high`; `dall-e-3` supports `standard` and `hd`; `dall-e-2`
1976supports only `standard`.
1977*/
1978///
1979/// <details><summary>JSON schema</summary>
1980///
1981/// ```json
1982///{
1983///  "description": "The quality of the image. `auto` selects the best quality for\nthe model. The GPT image models support `low`, `medium`, and\n`high`; `dall-e-3` supports `standard` and `hd`; `dall-e-2`\nsupports only `standard`.\n",
1984///  "type": "string",
1985///  "enum": [
1986///    "auto",
1987///    "standard",
1988///    "hd",
1989///    "low",
1990///    "medium",
1991///    "high"
1992///  ]
1993///}
1994/// ```
1995/// </details>
1996#[derive(
1997    ::serde::Deserialize,
1998    ::serde::Serialize,
1999    Clone,
2000    Copy,
2001    Debug,
2002    Eq,
2003    Hash,
2004    Ord,
2005    PartialEq,
2006    PartialOrd,
2007)]
2008pub enum CreateImageRequestQuality {
2009    #[serde(rename = "auto")]
2010    Auto,
2011    #[serde(rename = "standard")]
2012    Standard,
2013    #[serde(rename = "hd")]
2014    Hd,
2015    #[serde(rename = "low")]
2016    Low,
2017    #[serde(rename = "medium")]
2018    Medium,
2019    #[serde(rename = "high")]
2020    High,
2021}
2022impl ::std::fmt::Display for CreateImageRequestQuality {
2023    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
2024        match *self {
2025            Self::Auto => f.write_str("auto"),
2026            Self::Standard => f.write_str("standard"),
2027            Self::Hd => f.write_str("hd"),
2028            Self::Low => f.write_str("low"),
2029            Self::Medium => f.write_str("medium"),
2030            Self::High => f.write_str("high"),
2031        }
2032    }
2033}
2034impl ::std::str::FromStr for CreateImageRequestQuality {
2035    type Err = self::error::ConversionError;
2036    fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
2037        match value {
2038            "auto" => Ok(Self::Auto),
2039            "standard" => Ok(Self::Standard),
2040            "hd" => Ok(Self::Hd),
2041            "low" => Ok(Self::Low),
2042            "medium" => Ok(Self::Medium),
2043            "high" => Ok(Self::High),
2044            _ => Err("invalid value".into()),
2045        }
2046    }
2047}
2048impl ::std::convert::TryFrom<&str> for CreateImageRequestQuality {
2049    type Error = self::error::ConversionError;
2050    fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
2051        value.parse()
2052    }
2053}
2054impl ::std::convert::TryFrom<&::std::string::String> for CreateImageRequestQuality {
2055    type Error = self::error::ConversionError;
2056    fn try_from(
2057        value: &::std::string::String,
2058    ) -> ::std::result::Result<Self, self::error::ConversionError> {
2059        value.parse()
2060    }
2061}
2062impl ::std::convert::TryFrom<::std::string::String> for CreateImageRequestQuality {
2063    type Error = self::error::ConversionError;
2064    fn try_from(
2065        value: ::std::string::String,
2066    ) -> ::std::result::Result<Self, self::error::ConversionError> {
2067        value.parse()
2068    }
2069}
2070/**The format in which the generated images are returned. Must be
2071one of `url` or `b64_json`.
2072*/
2073///
2074/// <details><summary>JSON schema</summary>
2075///
2076/// ```json
2077///{
2078///  "description": "The format in which the generated images are returned. Must be\none of `url` or `b64_json`.\n",
2079///  "default": "url",
2080///  "type": "string",
2081///  "enum": [
2082///    "url",
2083///    "b64_json"
2084///  ]
2085///}
2086/// ```
2087/// </details>
2088#[derive(
2089    ::serde::Deserialize,
2090    ::serde::Serialize,
2091    Clone,
2092    Copy,
2093    Debug,
2094    Eq,
2095    Hash,
2096    Ord,
2097    PartialEq,
2098    PartialOrd,
2099)]
2100pub enum CreateImageRequestResponseFormat {
2101    #[serde(rename = "url")]
2102    Url,
2103    #[serde(rename = "b64_json")]
2104    B64Json,
2105}
2106impl ::std::fmt::Display for CreateImageRequestResponseFormat {
2107    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
2108        match *self {
2109            Self::Url => f.write_str("url"),
2110            Self::B64Json => f.write_str("b64_json"),
2111        }
2112    }
2113}
2114impl ::std::str::FromStr for CreateImageRequestResponseFormat {
2115    type Err = self::error::ConversionError;
2116    fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
2117        match value {
2118            "url" => Ok(Self::Url),
2119            "b64_json" => Ok(Self::B64Json),
2120            _ => Err("invalid value".into()),
2121        }
2122    }
2123}
2124impl ::std::convert::TryFrom<&str> for CreateImageRequestResponseFormat {
2125    type Error = self::error::ConversionError;
2126    fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
2127        value.parse()
2128    }
2129}
2130impl ::std::convert::TryFrom<&::std::string::String> for CreateImageRequestResponseFormat {
2131    type Error = self::error::ConversionError;
2132    fn try_from(
2133        value: &::std::string::String,
2134    ) -> ::std::result::Result<Self, self::error::ConversionError> {
2135        value.parse()
2136    }
2137}
2138impl ::std::convert::TryFrom<::std::string::String> for CreateImageRequestResponseFormat {
2139    type Error = self::error::ConversionError;
2140    fn try_from(
2141        value: ::std::string::String,
2142    ) -> ::std::result::Result<Self, self::error::ConversionError> {
2143        value.parse()
2144    }
2145}
2146impl ::std::default::Default for CreateImageRequestResponseFormat {
2147    fn default() -> Self {
2148        CreateImageRequestResponseFormat::Url
2149    }
2150}
2151/**Request body for creating a message via the Anthropic-compatible
2152Messages API.
2153*/
2154///
2155/// <details><summary>JSON schema</summary>
2156///
2157/// ```json
2158///{
2159///  "description": "Request body for creating a message via the Anthropic-compatible\nMessages API.\n",
2160///  "type": "object",
2161///  "required": [
2162///    "max_tokens",
2163///    "messages",
2164///    "model"
2165///  ],
2166///  "properties": {
2167///    "max_tokens": {
2168///      "description": "The maximum number of tokens to generate before stopping.\n",
2169///      "type": "integer"
2170///    },
2171///    "messages": {
2172///      "description": "The messages to generate a response for. Each message has a\n`role` (user or assistant) and `content`.\n",
2173///      "type": "array",
2174///      "items": {
2175///        "$ref": "#/definitions/MessagesMessage"
2176///      }
2177///    },
2178///    "metadata": {
2179///      "$ref": "#/definitions/MessagesMetadata"
2180///    },
2181///    "model": {
2182///      "description": "The model to use for generating the message.",
2183///      "type": "string"
2184///    },
2185///    "output_config": {
2186///      "$ref": "#/definitions/MessagesOutputConfig"
2187///    },
2188///    "stop_sequences": {
2189///      "description": "Custom text sequences that will cause the model to stop\ngenerating.\n",
2190///      "type": "array",
2191///      "items": {
2192///        "type": "string"
2193///      }
2194///    },
2195///    "stream": {
2196///      "description": "Whether to stream the response using server-sent events.\n",
2197///      "default": false,
2198///      "type": "boolean"
2199///    },
2200///    "system": {
2201///      "description": "The system prompt. Can be a string or an array of system content\nblocks (for prompt caching).\n",
2202///      "oneOf": [
2203///        {
2204///          "description": "System prompt as a string.",
2205///          "type": "string"
2206///        },
2207///        {
2208///          "type": "array",
2209///          "items": {
2210///            "$ref": "#/definitions/MessagesTextBlock"
2211///          }
2212///        }
2213///      ]
2214///    },
2215///    "temperature": {
2216///      "description": "Amount of randomness injected into the response. Ranges from\n0.0 to 1.0. Use closer to 0 for analytical / multiple choice,\ncloser to 1 for creative and generative tasks.\n",
2217///      "type": "number",
2218///      "format": "float"
2219///    },
2220///    "thinking": {
2221///      "description": "Configuration for extended thinking.\n",
2222///      "type": "object",
2223///      "required": [
2224///        "budget_tokens",
2225///        "type"
2226///      ],
2227///      "properties": {
2228///        "budget_tokens": {
2229///          "description": "The maximum number of tokens the model is allowed to use\nfor thinking.\n",
2230///          "type": "integer"
2231///        },
2232///        "type": {
2233///          "description": "Always `enabled`.",
2234///          "type": "string",
2235///          "enum": [
2236///            "enabled"
2237///          ]
2238///        }
2239///      }
2240///    },
2241///    "tool_choice": {
2242///      "$ref": "#/definitions/MessagesToolChoice"
2243///    },
2244///    "tools": {
2245///      "description": "Definitions of tools the model may call. Each tool can include\n`cache_control` for prompt caching.\n",
2246///      "type": "array",
2247///      "items": {
2248///        "$ref": "#/definitions/MessagesTool"
2249///      }
2250///    },
2251///    "top_k": {
2252///      "description": "Only sample from the top K options for each subsequent token.\n",
2253///      "type": "integer"
2254///    },
2255///    "top_p": {
2256///      "description": "Use nucleus sampling. Only consider the tokens with top_p\nprobability mass.\n",
2257///      "type": "number",
2258///      "format": "float"
2259///    }
2260///  }
2261///}
2262/// ```
2263/// </details>
2264#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
2265pub struct CreateMessagesRequest {
2266    /**The maximum number of tokens to generate before stopping.
2267     */
2268    pub max_tokens: i64,
2269    /**The messages to generate a response for. Each message has a
2270    `role` (user or assistant) and `content`.
2271    */
2272    pub messages: ::std::vec::Vec<MessagesMessage>,
2273    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
2274    pub metadata: ::std::option::Option<MessagesMetadata>,
2275    ///The model to use for generating the message.
2276    pub model: ::std::string::String,
2277    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
2278    pub output_config: ::std::option::Option<MessagesOutputConfig>,
2279    /**Custom text sequences that will cause the model to stop
2280    generating.
2281    */
2282    #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
2283    pub stop_sequences: ::std::vec::Vec<::std::string::String>,
2284    /**Whether to stream the response using server-sent events.
2285     */
2286    #[serde(default)]
2287    pub stream: bool,
2288    /**The system prompt. Can be a string or an array of system content
2289    blocks (for prompt caching).
2290    */
2291    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
2292    pub system: ::std::option::Option<CreateMessagesRequestSystem>,
2293    /**Amount of randomness injected into the response. Ranges from
2294    0.0 to 1.0. Use closer to 0 for analytical / multiple choice,
2295    closer to 1 for creative and generative tasks.
2296    */
2297    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
2298    pub temperature: ::std::option::Option<f32>,
2299    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
2300    pub thinking: ::std::option::Option<CreateMessagesRequestThinking>,
2301    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
2302    pub tool_choice: ::std::option::Option<MessagesToolChoice>,
2303    /**Definitions of tools the model may call. Each tool can include
2304    `cache_control` for prompt caching.
2305    */
2306    #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
2307    pub tools: ::std::vec::Vec<MessagesTool>,
2308    /**Only sample from the top K options for each subsequent token.
2309     */
2310    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
2311    pub top_k: ::std::option::Option<i64>,
2312    /**Use nucleus sampling. Only consider the tokens with top_p
2313    probability mass.
2314    */
2315    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
2316    pub top_p: ::std::option::Option<f32>,
2317}
2318/**The system prompt. Can be a string or an array of system content
2319blocks (for prompt caching).
2320*/
2321///
2322/// <details><summary>JSON schema</summary>
2323///
2324/// ```json
2325///{
2326///  "description": "The system prompt. Can be a string or an array of system content\nblocks (for prompt caching).\n",
2327///  "oneOf": [
2328///    {
2329///      "description": "System prompt as a string.",
2330///      "type": "string"
2331///    },
2332///    {
2333///      "type": "array",
2334///      "items": {
2335///        "$ref": "#/definitions/MessagesTextBlock"
2336///      }
2337///    }
2338///  ]
2339///}
2340/// ```
2341/// </details>
2342#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
2343#[serde(untagged)]
2344pub enum CreateMessagesRequestSystem {
2345    String(::std::string::String),
2346    Array(::std::vec::Vec<MessagesTextBlock>),
2347}
2348impl ::std::convert::From<::std::vec::Vec<MessagesTextBlock>> for CreateMessagesRequestSystem {
2349    fn from(value: ::std::vec::Vec<MessagesTextBlock>) -> Self {
2350        Self::Array(value)
2351    }
2352}
2353/**Configuration for extended thinking.
2354*/
2355///
2356/// <details><summary>JSON schema</summary>
2357///
2358/// ```json
2359///{
2360///  "description": "Configuration for extended thinking.\n",
2361///  "type": "object",
2362///  "required": [
2363///    "budget_tokens",
2364///    "type"
2365///  ],
2366///  "properties": {
2367///    "budget_tokens": {
2368///      "description": "The maximum number of tokens the model is allowed to use\nfor thinking.\n",
2369///      "type": "integer"
2370///    },
2371///    "type": {
2372///      "description": "Always `enabled`.",
2373///      "type": "string",
2374///      "enum": [
2375///        "enabled"
2376///      ]
2377///    }
2378///  }
2379///}
2380/// ```
2381/// </details>
2382#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
2383pub struct CreateMessagesRequestThinking {
2384    /**The maximum number of tokens the model is allowed to use
2385    for thinking.
2386    */
2387    pub budget_tokens: i64,
2388    ///Always `enabled`.
2389    #[serde(rename = "type")]
2390    pub type_: CreateMessagesRequestThinkingType,
2391}
2392///Always `enabled`.
2393///
2394/// <details><summary>JSON schema</summary>
2395///
2396/// ```json
2397///{
2398///  "description": "Always `enabled`.",
2399///  "type": "string",
2400///  "enum": [
2401///    "enabled"
2402///  ]
2403///}
2404/// ```
2405/// </details>
2406#[derive(
2407    ::serde::Deserialize,
2408    ::serde::Serialize,
2409    Clone,
2410    Copy,
2411    Debug,
2412    Eq,
2413    Hash,
2414    Ord,
2415    PartialEq,
2416    PartialOrd,
2417)]
2418pub enum CreateMessagesRequestThinkingType {
2419    #[serde(rename = "enabled")]
2420    Enabled,
2421}
2422impl ::std::fmt::Display for CreateMessagesRequestThinkingType {
2423    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
2424        match *self {
2425            Self::Enabled => f.write_str("enabled"),
2426        }
2427    }
2428}
2429impl ::std::str::FromStr for CreateMessagesRequestThinkingType {
2430    type Err = self::error::ConversionError;
2431    fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
2432        match value {
2433            "enabled" => Ok(Self::Enabled),
2434            _ => Err("invalid value".into()),
2435        }
2436    }
2437}
2438impl ::std::convert::TryFrom<&str> for CreateMessagesRequestThinkingType {
2439    type Error = self::error::ConversionError;
2440    fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
2441        value.parse()
2442    }
2443}
2444impl ::std::convert::TryFrom<&::std::string::String> for CreateMessagesRequestThinkingType {
2445    type Error = self::error::ConversionError;
2446    fn try_from(
2447        value: &::std::string::String,
2448    ) -> ::std::result::Result<Self, self::error::ConversionError> {
2449        value.parse()
2450    }
2451}
2452impl ::std::convert::TryFrom<::std::string::String> for CreateMessagesRequestThinkingType {
2453    type Error = self::error::ConversionError;
2454    fn try_from(
2455        value: ::std::string::String,
2456    ) -> ::std::result::Result<Self, self::error::ConversionError> {
2457        value.parse()
2458    }
2459}
2460/**Request body for creating a model response via the Responses API.
2461*/
2462///
2463/// <details><summary>JSON schema</summary>
2464///
2465/// ```json
2466///{
2467///  "description": "Request body for creating a model response via the Responses API.\n",
2468///  "type": "object",
2469///  "required": [
2470///    "input",
2471///    "model"
2472///  ],
2473///  "properties": {
2474///    "background": {
2475///      "description": "Whether to run the model response in the background. Useful for long-running or batched requests.\n",
2476///      "default": false,
2477///      "type": "boolean"
2478///    },
2479///    "input": {
2480///      "$ref": "#/definitions/ResponseInput"
2481///    },
2482///    "instructions": {
2483///      "description": "A system (or developer) message inserted into the model's context. When used with `previous_response_id`, instructions from previous responses are not carried over.\n",
2484///      "type": "string",
2485///      "nullable": true
2486///    },
2487///    "max_output_tokens": {
2488///      "description": "An upper bound for the number of tokens that can be generated for a response, including visible output tokens and reasoning tokens.\n",
2489///      "type": "integer",
2490///      "nullable": true
2491///    },
2492///    "metadata": {
2493///      "description": "Set of up to 16 key-value pairs that can be attached to the object and returned when retrieving the response.\n",
2494///      "type": "object",
2495///      "additionalProperties": {
2496///        "type": "string"
2497///      }
2498///    },
2499///    "model": {
2500///      "description": "Model ID used to generate the response.",
2501///      "type": "string"
2502///    },
2503///    "parallel_tool_calls": {
2504///      "description": "Whether to allow the model to run tool calls in parallel.",
2505///      "default": true,
2506///      "type": "boolean"
2507///    },
2508///    "previous_response_id": {
2509///      "description": "The unique ID of the previous response to the model. Use this to create multi-turn conversations.\n",
2510///      "type": "string",
2511///      "nullable": true
2512///    },
2513///    "reasoning": {
2514///      "$ref": "#/definitions/ResponseReasoning"
2515///    },
2516///    "store": {
2517///      "description": "Whether to store the generated model response for later retrieval.\n",
2518///      "default": true,
2519///      "type": "boolean"
2520///    },
2521///    "stream": {
2522///      "description": "If set to true, the model response data is streamed to the client as it is generated using [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format).\n",
2523///      "default": false,
2524///      "type": "boolean"
2525///    },
2526///    "temperature": {
2527///      "description": "What sampling temperature to use, between 0 and 2. Higher values make the output more random; lower values make it more focused.\n",
2528///      "default": 1,
2529///      "type": "number",
2530///      "format": "float",
2531///      "nullable": true
2532///    },
2533///    "text": {
2534///      "$ref": "#/definitions/ResponseTextConfig"
2535///    },
2536///    "tool_choice": {
2537///      "$ref": "#/definitions/ResponseToolChoice"
2538///    },
2539///    "tools": {
2540///      "description": "An array of tools the model may call while generating a response.\n",
2541///      "type": "array",
2542///      "items": {
2543///        "$ref": "#/definitions/ResponseTool"
2544///      }
2545///    },
2546///    "top_p": {
2547///      "description": "An alternative to sampling with temperature, called nucleus sampling, where the model considers the tokens with `top_p` probability mass.\n",
2548///      "default": 1,
2549///      "type": "number",
2550///      "format": "float",
2551///      "nullable": true
2552///    },
2553///    "user": {
2554///      "description": "A stable identifier for your end-users, used to help detect and prevent abuse.\n",
2555///      "type": "string"
2556///    }
2557///  }
2558///}
2559/// ```
2560/// </details>
2561#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
2562pub struct CreateResponseRequest {
2563    /**Whether to run the model response in the background. Useful for long-running or batched requests.
2564     */
2565    #[serde(default)]
2566    pub background: bool,
2567    pub input: ResponseInput,
2568    /**A system (or developer) message inserted into the model's context. When used with `previous_response_id`, instructions from previous responses are not carried over.
2569     */
2570    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
2571    pub instructions: ::std::option::Option<::std::string::String>,
2572    /**An upper bound for the number of tokens that can be generated for a response, including visible output tokens and reasoning tokens.
2573     */
2574    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
2575    pub max_output_tokens: ::std::option::Option<i64>,
2576    /**Set of up to 16 key-value pairs that can be attached to the object and returned when retrieving the response.
2577     */
2578    #[serde(
2579        default,
2580        skip_serializing_if = ":: std :: collections :: HashMap::is_empty"
2581    )]
2582    pub metadata: ::std::collections::HashMap<::std::string::String, ::std::string::String>,
2583    ///Model ID used to generate the response.
2584    pub model: ::std::string::String,
2585    ///Whether to allow the model to run tool calls in parallel.
2586    #[serde(default = "defaults::default_bool::<true>")]
2587    pub parallel_tool_calls: bool,
2588    /**The unique ID of the previous response to the model. Use this to create multi-turn conversations.
2589     */
2590    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
2591    pub previous_response_id: ::std::option::Option<::std::string::String>,
2592    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
2593    pub reasoning: ::std::option::Option<ResponseReasoning>,
2594    /**Whether to store the generated model response for later retrieval.
2595     */
2596    #[serde(default = "defaults::default_bool::<true>")]
2597    pub store: bool,
2598    /**If set to true, the model response data is streamed to the client as it is generated using [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format).
2599     */
2600    #[serde(default)]
2601    pub stream: bool,
2602    /**What sampling temperature to use, between 0 and 2. Higher values make the output more random; lower values make it more focused.
2603     */
2604    #[serde(default = "defaults::create_response_request_temperature")]
2605    pub temperature: f32,
2606    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
2607    pub text: ::std::option::Option<ResponseTextConfig>,
2608    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
2609    pub tool_choice: ::std::option::Option<ResponseToolChoice>,
2610    /**An array of tools the model may call while generating a response.
2611     */
2612    #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
2613    pub tools: ::std::vec::Vec<ResponseTool>,
2614    /**An alternative to sampling with temperature, called nucleus sampling, where the model considers the tokens with `top_p` probability mass.
2615     */
2616    #[serde(default = "defaults::create_response_request_top_p")]
2617    pub top_p: f32,
2618    /**A stable identifier for your end-users, used to help detect and prevent abuse.
2619     */
2620    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
2621    pub user: ::std::option::Option<::std::string::String>,
2622}
2623/**Request body for generating speech audio via the OpenAI-compatible
2624Audio API.
2625*/
2626///
2627/// <details><summary>JSON schema</summary>
2628///
2629/// ```json
2630///{
2631///  "description": "Request body for generating speech audio via the OpenAI-compatible\nAudio API.\n",
2632///  "type": "object",
2633///  "required": [
2634///    "input",
2635///    "model",
2636///    "voice"
2637///  ],
2638///  "properties": {
2639///    "input": {
2640///      "description": "The text to synthesize into audio (4096 characters maximum).",
2641///      "type": "string",
2642///      "maxLength": 4096
2643///    },
2644///    "instructions": {
2645///      "description": "Control the voice of your generated audio with additional instructions. Does not work with `tts-1` or `tts-1-hd`.\n",
2646///      "type": "string",
2647///      "maxLength": 4096
2648///    },
2649///    "language": {
2650///      "description": "ISO 639-1 code for the language of the generated speech.\nNon-standard extension: OpenAI's speech API has no language field\n(the name matches its transcription API). Forwarded to the\nprovider as-is; the gateway's built-in local engine\n(`local/qwen3-tts`) supports `zh`, `en`, `de`, `it`, `pt`, `es`,\n`ja`, `ko`, `fr` and `ru`, and rejects other codes.",
2651///      "default": "en",
2652///      "type": "string",
2653///      "pattern": "^[a-z]{2}$"
2654///    },
2655///    "model": {
2656///      "description": "Model ID to use for speech synthesis (e.g. `gpt-4o-mini-tts` or `tts-1`).",
2657///      "type": "string"
2658///    },
2659///    "reference_audio": {
2660///      "description": "Base64-encoded audio sample for zero-shot voice cloning. The\ngenerated speech mimics the voice in the sample. Best results with\na clean mono recording between 1 and 30 seconds; WAV is the safest\ncontainer. Forwarded to the provider as-is - only providers with\nvoice-cloning support honor it (e.g. Qwen3-TTS-compatible\nbackends); others ignore or reject it. Not supported by OpenAI.",
2661///      "type": "string",
2662///      "format": "byte"
2663///    },
2664///    "response_format": {
2665///      "description": "The audio format of the response.",
2666///      "default": "mp3",
2667///      "type": "string",
2668///      "enum": [
2669///        "mp3",
2670///        "opus",
2671///        "aac",
2672///        "flac",
2673///        "wav",
2674///        "pcm"
2675///      ]
2676///    },
2677///    "speed": {
2678///      "description": "The speed of the generated audio.",
2679///      "default": 1,
2680///      "type": "number",
2681///      "maximum": 4.0,
2682///      "minimum": 0.25
2683///    },
2684///    "voice": {
2685///      "description": "The voice to use when generating the audio. OpenAI built-in voices\nare `alloy`, `ash`, `ballad`, `coral`, `echo`, `fable`, `onyx`,\n`nova`, `sage`, `shimmer`, `verse`, `marin`, and `cedar`. Other\nproviders accept their own voice identifiers.",
2686///      "type": "string"
2687///    }
2688///  }
2689///}
2690/// ```
2691/// </details>
2692#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
2693pub struct CreateSpeechRequest {
2694    ///The text to synthesize into audio (4096 characters maximum).
2695    pub input: CreateSpeechRequestInput,
2696    /**Control the voice of your generated audio with additional instructions. Does not work with `tts-1` or `tts-1-hd`.
2697     */
2698    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
2699    pub instructions: ::std::option::Option<CreateSpeechRequestInstructions>,
2700    /**ISO 639-1 code for the language of the generated speech.
2701    Non-standard extension: OpenAI's speech API has no language field
2702    (the name matches its transcription API). Forwarded to the
2703    provider as-is; the gateway's built-in local engine
2704    (`local/qwen3-tts`) supports `zh`, `en`, `de`, `it`, `pt`, `es`,
2705    `ja`, `ko`, `fr` and `ru`, and rejects other codes.*/
2706    #[serde(default = "defaults::create_speech_request_language")]
2707    pub language: CreateSpeechRequestLanguage,
2708    ///Model ID to use for speech synthesis (e.g. `gpt-4o-mini-tts` or `tts-1`).
2709    pub model: ::std::string::String,
2710    /**Base64-encoded audio sample for zero-shot voice cloning. The
2711    generated speech mimics the voice in the sample. Best results with
2712    a clean mono recording between 1 and 30 seconds; WAV is the safest
2713    container. Forwarded to the provider as-is - only providers with
2714    voice-cloning support honor it (e.g. Qwen3-TTS-compatible
2715    backends); others ignore or reject it. Not supported by OpenAI.*/
2716    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
2717    pub reference_audio: ::std::option::Option<::std::string::String>,
2718    ///The audio format of the response.
2719    #[serde(default = "defaults::create_speech_request_response_format")]
2720    pub response_format: CreateSpeechRequestResponseFormat,
2721    ///The speed of the generated audio.
2722    #[serde(default = "defaults::create_speech_request_speed")]
2723    pub speed: f64,
2724    /**The voice to use when generating the audio. OpenAI built-in voices
2725    are `alloy`, `ash`, `ballad`, `coral`, `echo`, `fable`, `onyx`,
2726    `nova`, `sage`, `shimmer`, `verse`, `marin`, and `cedar`. Other
2727    providers accept their own voice identifiers.*/
2728    pub voice: ::std::string::String,
2729}
2730///The text to synthesize into audio (4096 characters maximum).
2731///
2732/// <details><summary>JSON schema</summary>
2733///
2734/// ```json
2735///{
2736///  "description": "The text to synthesize into audio (4096 characters maximum).",
2737///  "type": "string",
2738///  "maxLength": 4096
2739///}
2740/// ```
2741/// </details>
2742#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
2743#[serde(transparent)]
2744pub struct CreateSpeechRequestInput(::std::string::String);
2745impl ::std::ops::Deref for CreateSpeechRequestInput {
2746    type Target = ::std::string::String;
2747    fn deref(&self) -> &::std::string::String {
2748        &self.0
2749    }
2750}
2751impl ::std::convert::From<CreateSpeechRequestInput> for ::std::string::String {
2752    fn from(value: CreateSpeechRequestInput) -> Self {
2753        value.0
2754    }
2755}
2756impl ::std::str::FromStr for CreateSpeechRequestInput {
2757    type Err = self::error::ConversionError;
2758    fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
2759        if value.chars().count() > 4096usize {
2760            return Err("longer than 4096 characters".into());
2761        }
2762        Ok(Self(value.to_string()))
2763    }
2764}
2765impl ::std::convert::TryFrom<&str> for CreateSpeechRequestInput {
2766    type Error = self::error::ConversionError;
2767    fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
2768        value.parse()
2769    }
2770}
2771impl ::std::convert::TryFrom<&::std::string::String> for CreateSpeechRequestInput {
2772    type Error = self::error::ConversionError;
2773    fn try_from(
2774        value: &::std::string::String,
2775    ) -> ::std::result::Result<Self, self::error::ConversionError> {
2776        value.parse()
2777    }
2778}
2779impl ::std::convert::TryFrom<::std::string::String> for CreateSpeechRequestInput {
2780    type Error = self::error::ConversionError;
2781    fn try_from(
2782        value: ::std::string::String,
2783    ) -> ::std::result::Result<Self, self::error::ConversionError> {
2784        value.parse()
2785    }
2786}
2787impl<'de> ::serde::Deserialize<'de> for CreateSpeechRequestInput {
2788    fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
2789    where
2790        D: ::serde::Deserializer<'de>,
2791    {
2792        ::std::string::String::deserialize(deserializer)?
2793            .parse()
2794            .map_err(|e: self::error::ConversionError| {
2795                <D::Error as ::serde::de::Error>::custom(e.to_string())
2796            })
2797    }
2798}
2799/**Control the voice of your generated audio with additional instructions. Does not work with `tts-1` or `tts-1-hd`.
2800*/
2801///
2802/// <details><summary>JSON schema</summary>
2803///
2804/// ```json
2805///{
2806///  "description": "Control the voice of your generated audio with additional instructions. Does not work with `tts-1` or `tts-1-hd`.\n",
2807///  "type": "string",
2808///  "maxLength": 4096
2809///}
2810/// ```
2811/// </details>
2812#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
2813#[serde(transparent)]
2814pub struct CreateSpeechRequestInstructions(::std::string::String);
2815impl ::std::ops::Deref for CreateSpeechRequestInstructions {
2816    type Target = ::std::string::String;
2817    fn deref(&self) -> &::std::string::String {
2818        &self.0
2819    }
2820}
2821impl ::std::convert::From<CreateSpeechRequestInstructions> for ::std::string::String {
2822    fn from(value: CreateSpeechRequestInstructions) -> Self {
2823        value.0
2824    }
2825}
2826impl ::std::str::FromStr for CreateSpeechRequestInstructions {
2827    type Err = self::error::ConversionError;
2828    fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
2829        if value.chars().count() > 4096usize {
2830            return Err("longer than 4096 characters".into());
2831        }
2832        Ok(Self(value.to_string()))
2833    }
2834}
2835impl ::std::convert::TryFrom<&str> for CreateSpeechRequestInstructions {
2836    type Error = self::error::ConversionError;
2837    fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
2838        value.parse()
2839    }
2840}
2841impl ::std::convert::TryFrom<&::std::string::String> for CreateSpeechRequestInstructions {
2842    type Error = self::error::ConversionError;
2843    fn try_from(
2844        value: &::std::string::String,
2845    ) -> ::std::result::Result<Self, self::error::ConversionError> {
2846        value.parse()
2847    }
2848}
2849impl ::std::convert::TryFrom<::std::string::String> for CreateSpeechRequestInstructions {
2850    type Error = self::error::ConversionError;
2851    fn try_from(
2852        value: ::std::string::String,
2853    ) -> ::std::result::Result<Self, self::error::ConversionError> {
2854        value.parse()
2855    }
2856}
2857impl<'de> ::serde::Deserialize<'de> for CreateSpeechRequestInstructions {
2858    fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
2859    where
2860        D: ::serde::Deserializer<'de>,
2861    {
2862        ::std::string::String::deserialize(deserializer)?
2863            .parse()
2864            .map_err(|e: self::error::ConversionError| {
2865                <D::Error as ::serde::de::Error>::custom(e.to_string())
2866            })
2867    }
2868}
2869/**ISO 639-1 code for the language of the generated speech.
2870Non-standard extension: OpenAI's speech API has no language field
2871(the name matches its transcription API). Forwarded to the
2872provider as-is; the gateway's built-in local engine
2873(`local/qwen3-tts`) supports `zh`, `en`, `de`, `it`, `pt`, `es`,
2874`ja`, `ko`, `fr` and `ru`, and rejects other codes.*/
2875///
2876/// <details><summary>JSON schema</summary>
2877///
2878/// ```json
2879///{
2880///  "description": "ISO 639-1 code for the language of the generated speech.\nNon-standard extension: OpenAI's speech API has no language field\n(the name matches its transcription API). Forwarded to the\nprovider as-is; the gateway's built-in local engine\n(`local/qwen3-tts`) supports `zh`, `en`, `de`, `it`, `pt`, `es`,\n`ja`, `ko`, `fr` and `ru`, and rejects other codes.",
2881///  "default": "en",
2882///  "type": "string",
2883///  "pattern": "^[a-z]{2}$"
2884///}
2885/// ```
2886/// </details>
2887#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
2888#[serde(transparent)]
2889pub struct CreateSpeechRequestLanguage(::std::string::String);
2890impl ::std::ops::Deref for CreateSpeechRequestLanguage {
2891    type Target = ::std::string::String;
2892    fn deref(&self) -> &::std::string::String {
2893        &self.0
2894    }
2895}
2896impl ::std::convert::From<CreateSpeechRequestLanguage> for ::std::string::String {
2897    fn from(value: CreateSpeechRequestLanguage) -> Self {
2898        value.0
2899    }
2900}
2901impl ::std::default::Default for CreateSpeechRequestLanguage {
2902    fn default() -> Self {
2903        CreateSpeechRequestLanguage("en".to_string())
2904    }
2905}
2906impl ::std::str::FromStr for CreateSpeechRequestLanguage {
2907    type Err = self::error::ConversionError;
2908    fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
2909        static PATTERN: ::std::sync::LazyLock<::regress::Regex> =
2910            ::std::sync::LazyLock::new(|| ::regress::Regex::new("^[a-z]{2}$").unwrap());
2911        if PATTERN.find(value).is_none() {
2912            return Err("doesn't match pattern \"^[a-z]{2}$\"".into());
2913        }
2914        Ok(Self(value.to_string()))
2915    }
2916}
2917impl ::std::convert::TryFrom<&str> for CreateSpeechRequestLanguage {
2918    type Error = self::error::ConversionError;
2919    fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
2920        value.parse()
2921    }
2922}
2923impl ::std::convert::TryFrom<&::std::string::String> for CreateSpeechRequestLanguage {
2924    type Error = self::error::ConversionError;
2925    fn try_from(
2926        value: &::std::string::String,
2927    ) -> ::std::result::Result<Self, self::error::ConversionError> {
2928        value.parse()
2929    }
2930}
2931impl ::std::convert::TryFrom<::std::string::String> for CreateSpeechRequestLanguage {
2932    type Error = self::error::ConversionError;
2933    fn try_from(
2934        value: ::std::string::String,
2935    ) -> ::std::result::Result<Self, self::error::ConversionError> {
2936        value.parse()
2937    }
2938}
2939impl<'de> ::serde::Deserialize<'de> for CreateSpeechRequestLanguage {
2940    fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
2941    where
2942        D: ::serde::Deserializer<'de>,
2943    {
2944        ::std::string::String::deserialize(deserializer)?
2945            .parse()
2946            .map_err(|e: self::error::ConversionError| {
2947                <D::Error as ::serde::de::Error>::custom(e.to_string())
2948            })
2949    }
2950}
2951///The audio format of the response.
2952///
2953/// <details><summary>JSON schema</summary>
2954///
2955/// ```json
2956///{
2957///  "description": "The audio format of the response.",
2958///  "default": "mp3",
2959///  "type": "string",
2960///  "enum": [
2961///    "mp3",
2962///    "opus",
2963///    "aac",
2964///    "flac",
2965///    "wav",
2966///    "pcm"
2967///  ]
2968///}
2969/// ```
2970/// </details>
2971#[derive(
2972    ::serde::Deserialize,
2973    ::serde::Serialize,
2974    Clone,
2975    Copy,
2976    Debug,
2977    Eq,
2978    Hash,
2979    Ord,
2980    PartialEq,
2981    PartialOrd,
2982)]
2983pub enum CreateSpeechRequestResponseFormat {
2984    #[serde(rename = "mp3")]
2985    Mp3,
2986    #[serde(rename = "opus")]
2987    Opus,
2988    #[serde(rename = "aac")]
2989    Aac,
2990    #[serde(rename = "flac")]
2991    Flac,
2992    #[serde(rename = "wav")]
2993    Wav,
2994    #[serde(rename = "pcm")]
2995    Pcm,
2996}
2997impl ::std::fmt::Display for CreateSpeechRequestResponseFormat {
2998    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
2999        match *self {
3000            Self::Mp3 => f.write_str("mp3"),
3001            Self::Opus => f.write_str("opus"),
3002            Self::Aac => f.write_str("aac"),
3003            Self::Flac => f.write_str("flac"),
3004            Self::Wav => f.write_str("wav"),
3005            Self::Pcm => f.write_str("pcm"),
3006        }
3007    }
3008}
3009impl ::std::str::FromStr for CreateSpeechRequestResponseFormat {
3010    type Err = self::error::ConversionError;
3011    fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
3012        match value {
3013            "mp3" => Ok(Self::Mp3),
3014            "opus" => Ok(Self::Opus),
3015            "aac" => Ok(Self::Aac),
3016            "flac" => Ok(Self::Flac),
3017            "wav" => Ok(Self::Wav),
3018            "pcm" => Ok(Self::Pcm),
3019            _ => Err("invalid value".into()),
3020        }
3021    }
3022}
3023impl ::std::convert::TryFrom<&str> for CreateSpeechRequestResponseFormat {
3024    type Error = self::error::ConversionError;
3025    fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
3026        value.parse()
3027    }
3028}
3029impl ::std::convert::TryFrom<&::std::string::String> for CreateSpeechRequestResponseFormat {
3030    type Error = self::error::ConversionError;
3031    fn try_from(
3032        value: &::std::string::String,
3033    ) -> ::std::result::Result<Self, self::error::ConversionError> {
3034        value.parse()
3035    }
3036}
3037impl ::std::convert::TryFrom<::std::string::String> for CreateSpeechRequestResponseFormat {
3038    type Error = self::error::ConversionError;
3039    fn try_from(
3040        value: ::std::string::String,
3041    ) -> ::std::result::Result<Self, self::error::ConversionError> {
3042        value.parse()
3043    }
3044}
3045impl ::std::default::Default for CreateSpeechRequestResponseFormat {
3046    fn default() -> Self {
3047        CreateSpeechRequestResponseFormat::Mp3
3048    }
3049}
3050///`Endpoints`
3051///
3052/// <details><summary>JSON schema</summary>
3053///
3054/// ```json
3055///{
3056///  "type": "object",
3057///  "required": [
3058///    "chat",
3059///    "models"
3060///  ],
3061///  "properties": {
3062///    "chat": {
3063///      "type": "string"
3064///    },
3065///    "images": {
3066///      "type": "string"
3067///    },
3068///    "images_edits": {
3069///      "type": "string"
3070///    },
3071///    "images_variations": {
3072///      "type": "string"
3073///    },
3074///    "models": {
3075///      "type": "string"
3076///    },
3077///    "responses": {
3078///      "type": "string"
3079///    },
3080///    "speech": {
3081///      "type": "string"
3082///    }
3083///  }
3084///}
3085/// ```
3086/// </details>
3087#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
3088pub struct Endpoints {
3089    pub chat: ::std::string::String,
3090    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
3091    pub images: ::std::option::Option<::std::string::String>,
3092    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
3093    pub images_edits: ::std::option::Option<::std::string::String>,
3094    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
3095    pub images_variations: ::std::option::Option<::std::string::String>,
3096    pub models: ::std::string::String,
3097    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
3098    pub responses: ::std::option::Option<::std::string::String>,
3099    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
3100    pub speech: ::std::option::Option<::std::string::String>,
3101}
3102///`Error`
3103///
3104/// <details><summary>JSON schema</summary>
3105///
3106/// ```json
3107///{
3108///  "type": "object",
3109///  "properties": {
3110///    "error": {
3111///      "type": "string"
3112///    }
3113///  }
3114///}
3115/// ```
3116/// </details>
3117#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
3118pub struct Error {
3119    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
3120    pub error: ::std::option::Option<::std::string::String>,
3121}
3122impl ::std::default::Default for Error {
3123    fn default() -> Self {
3124        Self {
3125            error: Default::default(),
3126        }
3127    }
3128}
3129/**The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence,
3130`length` if the maximum number of tokens specified in the request was reached,
3131`content_filter` if content was omitted due to a flag from our content filters,
3132`tool_calls` if the model called a tool.
3133*/
3134///
3135/// <details><summary>JSON schema</summary>
3136///
3137/// ```json
3138///{
3139///  "description": "The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence,\n`length` if the maximum number of tokens specified in the request was reached,\n`content_filter` if content was omitted due to a flag from our content filters,\n`tool_calls` if the model called a tool.\n",
3140///  "type": "string",
3141///  "enum": [
3142///    "stop",
3143///    "length",
3144///    "tool_calls",
3145///    "content_filter",
3146///    "function_call"
3147///  ]
3148///}
3149/// ```
3150/// </details>
3151#[derive(
3152    ::serde::Deserialize,
3153    ::serde::Serialize,
3154    Clone,
3155    Copy,
3156    Debug,
3157    Eq,
3158    Hash,
3159    Ord,
3160    PartialEq,
3161    PartialOrd,
3162)]
3163pub enum FinishReason {
3164    #[serde(rename = "stop")]
3165    Stop,
3166    #[serde(rename = "length")]
3167    Length,
3168    #[serde(rename = "tool_calls")]
3169    ToolCalls,
3170    #[serde(rename = "content_filter")]
3171    ContentFilter,
3172    #[serde(rename = "function_call")]
3173    FunctionCall,
3174}
3175impl ::std::fmt::Display for FinishReason {
3176    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
3177        match *self {
3178            Self::Stop => f.write_str("stop"),
3179            Self::Length => f.write_str("length"),
3180            Self::ToolCalls => f.write_str("tool_calls"),
3181            Self::ContentFilter => f.write_str("content_filter"),
3182            Self::FunctionCall => f.write_str("function_call"),
3183        }
3184    }
3185}
3186impl ::std::str::FromStr for FinishReason {
3187    type Err = self::error::ConversionError;
3188    fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
3189        match value {
3190            "stop" => Ok(Self::Stop),
3191            "length" => Ok(Self::Length),
3192            "tool_calls" => Ok(Self::ToolCalls),
3193            "content_filter" => Ok(Self::ContentFilter),
3194            "function_call" => Ok(Self::FunctionCall),
3195            _ => Err("invalid value".into()),
3196        }
3197    }
3198}
3199impl ::std::convert::TryFrom<&str> for FinishReason {
3200    type Error = self::error::ConversionError;
3201    fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
3202        value.parse()
3203    }
3204}
3205impl ::std::convert::TryFrom<&::std::string::String> for FinishReason {
3206    type Error = self::error::ConversionError;
3207    fn try_from(
3208        value: &::std::string::String,
3209    ) -> ::std::result::Result<Self, self::error::ConversionError> {
3210        value.parse()
3211    }
3212}
3213impl ::std::convert::TryFrom<::std::string::String> for FinishReason {
3214    type Error = self::error::ConversionError;
3215    fn try_from(
3216        value: ::std::string::String,
3217    ) -> ::std::result::Result<Self, self::error::ConversionError> {
3218        value.parse()
3219    }
3220}
3221///`FunctionObject`
3222///
3223/// <details><summary>JSON schema</summary>
3224///
3225/// ```json
3226///{
3227///  "type": "object",
3228///  "required": [
3229///    "name"
3230///  ],
3231///  "properties": {
3232///    "description": {
3233///      "description": "A description of what the function does, used by the model to choose when and how to call the function.",
3234///      "type": "string"
3235///    },
3236///    "name": {
3237///      "description": "The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.",
3238///      "type": "string"
3239///    },
3240///    "parameters": {
3241///      "$ref": "#/definitions/FunctionParameters"
3242///    },
3243///    "strict": {
3244///      "description": "Whether to enable strict schema adherence when generating the function call. If set to true, the model will follow the exact schema defined in the `parameters` field. Only a subset of JSON Schema is supported when `strict` is `true`. Learn more about Structured Outputs in the [function calling guide](docs/guides/function-calling).",
3245///      "default": false,
3246///      "type": "boolean"
3247///    }
3248///  }
3249///}
3250/// ```
3251/// </details>
3252#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
3253pub struct FunctionObject {
3254    ///A description of what the function does, used by the model to choose when and how to call the function.
3255    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
3256    pub description: ::std::option::Option<::std::string::String>,
3257    ///The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.
3258    pub name: ::std::string::String,
3259    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
3260    pub parameters: ::std::option::Option<FunctionParameters>,
3261    ///Whether to enable strict schema adherence when generating the function call. If set to true, the model will follow the exact schema defined in the `parameters` field. Only a subset of JSON Schema is supported when `strict` is `true`. Learn more about Structured Outputs in the [function calling guide](docs/guides/function-calling).
3262    #[serde(default)]
3263    pub strict: bool,
3264}
3265/**The parameters the functions accepts, described as a JSON Schema object. See the [guide](/docs/guides/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format.
3266Omitting `parameters` defines a function with an empty parameter list.*/
3267///
3268/// <details><summary>JSON schema</summary>
3269///
3270/// ```json
3271///{
3272///  "description": "The parameters the functions accepts, described as a JSON Schema object. See the [guide](/docs/guides/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format. \nOmitting `parameters` defines a function with an empty parameter list.",
3273///  "type": "object",
3274///  "additionalProperties": true
3275///}
3276/// ```
3277/// </details>
3278#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
3279#[serde(transparent)]
3280pub struct FunctionParameters(pub ::serde_json::Map<::std::string::String, ::serde_json::Value>);
3281impl ::std::ops::Deref for FunctionParameters {
3282    type Target = ::serde_json::Map<::std::string::String, ::serde_json::Value>;
3283    fn deref(&self) -> &::serde_json::Map<::std::string::String, ::serde_json::Value> {
3284        &self.0
3285    }
3286}
3287impl ::std::convert::From<FunctionParameters>
3288    for ::serde_json::Map<::std::string::String, ::serde_json::Value>
3289{
3290    fn from(value: FunctionParameters) -> Self {
3291        value.0
3292    }
3293}
3294impl ::std::convert::From<::serde_json::Map<::std::string::String, ::serde_json::Value>>
3295    for FunctionParameters
3296{
3297    fn from(value: ::serde_json::Map<::std::string::String, ::serde_json::Value>) -> Self {
3298        Self(value)
3299    }
3300}
3301///Represents the url or the content of an image generated by the Images API.
3302///
3303/// <details><summary>JSON schema</summary>
3304///
3305/// ```json
3306///{
3307///  "description": "Represents the url or the content of an image generated by the Images API.",
3308///  "type": "object",
3309///  "properties": {
3310///    "b64_json": {
3311///      "description": "The base64-encoded JSON of the generated image, if\n`response_format` is `b64_json`.\n",
3312///      "type": "string"
3313///    },
3314///    "revised_prompt": {
3315///      "description": "The prompt that was used to generate the image, if there was any\nrevision to the prompt.\n",
3316///      "type": "string"
3317///    },
3318///    "url": {
3319///      "description": "The URL of the generated image, if `response_format` is `url`\n(default).\n",
3320///      "type": "string"
3321///    }
3322///  }
3323///}
3324/// ```
3325/// </details>
3326#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
3327pub struct Image {
3328    /**The base64-encoded JSON of the generated image, if
3329    `response_format` is `b64_json`.
3330    */
3331    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
3332    pub b64_json: ::std::option::Option<::std::string::String>,
3333    /**The prompt that was used to generate the image, if there was any
3334    revision to the prompt.
3335    */
3336    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
3337    pub revised_prompt: ::std::option::Option<::std::string::String>,
3338    /**The URL of the generated image, if `response_format` is `url`
3339    (default).
3340    */
3341    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
3342    pub url: ::std::option::Option<::std::string::String>,
3343}
3344impl ::std::default::Default for Image {
3345    fn default() -> Self {
3346        Self {
3347            b64_json: Default::default(),
3348            revised_prompt: Default::default(),
3349            url: Default::default(),
3350        }
3351    }
3352}
3353///Image content part
3354///
3355/// <details><summary>JSON schema</summary>
3356///
3357/// ```json
3358///{
3359///  "description": "Image content part",
3360///  "type": "object",
3361///  "required": [
3362///    "image_url",
3363///    "type"
3364///  ],
3365///  "properties": {
3366///    "image_url": {
3367///      "$ref": "#/definitions/ImageURL"
3368///    },
3369///    "type": {
3370///      "description": "Content type identifier",
3371///      "type": "string",
3372///      "enum": [
3373///        "image_url"
3374///      ]
3375///    }
3376///  }
3377///}
3378/// ```
3379/// </details>
3380#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
3381pub struct ImageContentPart {
3382    pub image_url: ImageUrl,
3383    ///Content type identifier
3384    #[serde(rename = "type")]
3385    pub type_: ImageContentPartType,
3386}
3387///Content type identifier
3388///
3389/// <details><summary>JSON schema</summary>
3390///
3391/// ```json
3392///{
3393///  "description": "Content type identifier",
3394///  "type": "string",
3395///  "enum": [
3396///    "image_url"
3397///  ]
3398///}
3399/// ```
3400/// </details>
3401#[derive(
3402    ::serde::Deserialize,
3403    ::serde::Serialize,
3404    Clone,
3405    Copy,
3406    Debug,
3407    Eq,
3408    Hash,
3409    Ord,
3410    PartialEq,
3411    PartialOrd,
3412)]
3413pub enum ImageContentPartType {
3414    #[serde(rename = "image_url")]
3415    ImageUrl,
3416}
3417impl ::std::fmt::Display for ImageContentPartType {
3418    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
3419        match *self {
3420            Self::ImageUrl => f.write_str("image_url"),
3421        }
3422    }
3423}
3424impl ::std::str::FromStr for ImageContentPartType {
3425    type Err = self::error::ConversionError;
3426    fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
3427        match value {
3428            "image_url" => Ok(Self::ImageUrl),
3429            _ => Err("invalid value".into()),
3430        }
3431    }
3432}
3433impl ::std::convert::TryFrom<&str> for ImageContentPartType {
3434    type Error = self::error::ConversionError;
3435    fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
3436        value.parse()
3437    }
3438}
3439impl ::std::convert::TryFrom<&::std::string::String> for ImageContentPartType {
3440    type Error = self::error::ConversionError;
3441    fn try_from(
3442        value: &::std::string::String,
3443    ) -> ::std::result::Result<Self, self::error::ConversionError> {
3444        value.parse()
3445    }
3446}
3447impl ::std::convert::TryFrom<::std::string::String> for ImageContentPartType {
3448    type Error = self::error::ConversionError;
3449    fn try_from(
3450        value: ::std::string::String,
3451    ) -> ::std::result::Result<Self, self::error::ConversionError> {
3452        value.parse()
3453    }
3454}
3455/**The size of the generated images. The GPT image models support
3456`1024x1024`, `1536x1024`, `1024x1536`, and `auto`; `gpt-image-2`
3457also accepts arbitrary `WIDTHxHEIGHT` values such as `1536x864`.
3458`dall-e-2` supports `256x256`, `512x512`, and `1024x1024`;
3459`dall-e-3` supports `1024x1024`, `1792x1024`, and `1024x1792`.
3460*/
3461///
3462/// <details><summary>JSON schema</summary>
3463///
3464/// ```json
3465///{
3466///  "description": "The size of the generated images. The GPT image models support\n`1024x1024`, `1536x1024`, `1024x1536`, and `auto`; `gpt-image-2`\nalso accepts arbitrary `WIDTHxHEIGHT` values such as `1536x864`.\n`dall-e-2` supports `256x256`, `512x512`, and `1024x1024`;\n`dall-e-3` supports `1024x1024`, `1792x1024`, and `1024x1792`.\n",
3467///  "type": "string",
3468///  "enum": [
3469///    "auto",
3470///    "256x256",
3471///    "512x512",
3472///    "1024x1024",
3473///    "1536x1024",
3474///    "1024x1536",
3475///    "1792x1024",
3476///    "1024x1792"
3477///  ]
3478///}
3479/// ```
3480/// </details>
3481#[derive(
3482    ::serde::Deserialize,
3483    ::serde::Serialize,
3484    Clone,
3485    Copy,
3486    Debug,
3487    Eq,
3488    Hash,
3489    Ord,
3490    PartialEq,
3491    PartialOrd,
3492)]
3493pub enum ImageSize {
3494    #[serde(rename = "auto")]
3495    Auto,
3496    #[serde(rename = "256x256")]
3497    X256x256,
3498    #[serde(rename = "512x512")]
3499    X512x512,
3500    #[serde(rename = "1024x1024")]
3501    X1024x1024,
3502    #[serde(rename = "1536x1024")]
3503    X1536x1024,
3504    #[serde(rename = "1024x1536")]
3505    X1024x1536,
3506    #[serde(rename = "1792x1024")]
3507    X1792x1024,
3508    #[serde(rename = "1024x1792")]
3509    X1024x1792,
3510}
3511impl ::std::fmt::Display for ImageSize {
3512    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
3513        match *self {
3514            Self::Auto => f.write_str("auto"),
3515            Self::X256x256 => f.write_str("256x256"),
3516            Self::X512x512 => f.write_str("512x512"),
3517            Self::X1024x1024 => f.write_str("1024x1024"),
3518            Self::X1536x1024 => f.write_str("1536x1024"),
3519            Self::X1024x1536 => f.write_str("1024x1536"),
3520            Self::X1792x1024 => f.write_str("1792x1024"),
3521            Self::X1024x1792 => f.write_str("1024x1792"),
3522        }
3523    }
3524}
3525impl ::std::str::FromStr for ImageSize {
3526    type Err = self::error::ConversionError;
3527    fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
3528        match value {
3529            "auto" => Ok(Self::Auto),
3530            "256x256" => Ok(Self::X256x256),
3531            "512x512" => Ok(Self::X512x512),
3532            "1024x1024" => Ok(Self::X1024x1024),
3533            "1536x1024" => Ok(Self::X1536x1024),
3534            "1024x1536" => Ok(Self::X1024x1536),
3535            "1792x1024" => Ok(Self::X1792x1024),
3536            "1024x1792" => Ok(Self::X1024x1792),
3537            _ => Err("invalid value".into()),
3538        }
3539    }
3540}
3541impl ::std::convert::TryFrom<&str> for ImageSize {
3542    type Error = self::error::ConversionError;
3543    fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
3544        value.parse()
3545    }
3546}
3547impl ::std::convert::TryFrom<&::std::string::String> for ImageSize {
3548    type Error = self::error::ConversionError;
3549    fn try_from(
3550        value: &::std::string::String,
3551    ) -> ::std::result::Result<Self, self::error::ConversionError> {
3552        value.parse()
3553    }
3554}
3555impl ::std::convert::TryFrom<::std::string::String> for ImageSize {
3556    type Error = self::error::ConversionError;
3557    fn try_from(
3558        value: ::std::string::String,
3559    ) -> ::std::result::Result<Self, self::error::ConversionError> {
3560        value.parse()
3561    }
3562}
3563///Image URL configuration
3564///
3565/// <details><summary>JSON schema</summary>
3566///
3567/// ```json
3568///{
3569///  "description": "Image URL configuration",
3570///  "type": "object",
3571///  "required": [
3572///    "url"
3573///  ],
3574///  "properties": {
3575///    "detail": {
3576///      "description": "Image detail level for vision processing",
3577///      "default": "auto",
3578///      "type": "string",
3579///      "enum": [
3580///        "auto",
3581///        "low",
3582///        "high"
3583///      ]
3584///    },
3585///    "url": {
3586///      "description": "URL of the image (data URLs supported)",
3587///      "type": "string"
3588///    }
3589///  }
3590///}
3591/// ```
3592/// </details>
3593#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
3594pub struct ImageUrl {
3595    ///Image detail level for vision processing
3596    #[serde(default = "defaults::image_url_detail")]
3597    pub detail: ImageUrlDetail,
3598    ///URL of the image (data URLs supported)
3599    pub url: ::std::string::String,
3600}
3601///Image detail level for vision processing
3602///
3603/// <details><summary>JSON schema</summary>
3604///
3605/// ```json
3606///{
3607///  "description": "Image detail level for vision processing",
3608///  "default": "auto",
3609///  "type": "string",
3610///  "enum": [
3611///    "auto",
3612///    "low",
3613///    "high"
3614///  ]
3615///}
3616/// ```
3617/// </details>
3618#[derive(
3619    ::serde::Deserialize,
3620    ::serde::Serialize,
3621    Clone,
3622    Copy,
3623    Debug,
3624    Eq,
3625    Hash,
3626    Ord,
3627    PartialEq,
3628    PartialOrd,
3629)]
3630pub enum ImageUrlDetail {
3631    #[serde(rename = "auto")]
3632    Auto,
3633    #[serde(rename = "low")]
3634    Low,
3635    #[serde(rename = "high")]
3636    High,
3637}
3638impl ::std::fmt::Display for ImageUrlDetail {
3639    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
3640        match *self {
3641            Self::Auto => f.write_str("auto"),
3642            Self::Low => f.write_str("low"),
3643            Self::High => f.write_str("high"),
3644        }
3645    }
3646}
3647impl ::std::str::FromStr for ImageUrlDetail {
3648    type Err = self::error::ConversionError;
3649    fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
3650        match value {
3651            "auto" => Ok(Self::Auto),
3652            "low" => Ok(Self::Low),
3653            "high" => Ok(Self::High),
3654            _ => Err("invalid value".into()),
3655        }
3656    }
3657}
3658impl ::std::convert::TryFrom<&str> for ImageUrlDetail {
3659    type Error = self::error::ConversionError;
3660    fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
3661        value.parse()
3662    }
3663}
3664impl ::std::convert::TryFrom<&::std::string::String> for ImageUrlDetail {
3665    type Error = self::error::ConversionError;
3666    fn try_from(
3667        value: &::std::string::String,
3668    ) -> ::std::result::Result<Self, self::error::ConversionError> {
3669        value.parse()
3670    }
3671}
3672impl ::std::convert::TryFrom<::std::string::String> for ImageUrlDetail {
3673    type Error = self::error::ConversionError;
3674    fn try_from(
3675        value: ::std::string::String,
3676    ) -> ::std::result::Result<Self, self::error::ConversionError> {
3677        value.parse()
3678    }
3679}
3680impl ::std::default::Default for ImageUrlDetail {
3681    fn default() -> Self {
3682        ImageUrlDetail::Auto
3683    }
3684}
3685///Represents the result of an image generation request.
3686///
3687/// <details><summary>JSON schema</summary>
3688///
3689/// ```json
3690///{
3691///  "description": "Represents the result of an image generation request.",
3692///  "type": "object",
3693///  "required": [
3694///    "created",
3695///    "data"
3696///  ],
3697///  "properties": {
3698///    "created": {
3699///      "description": "The Unix timestamp (in seconds) of when the image was created.",
3700///      "type": "integer",
3701///      "format": "int64"
3702///    },
3703///    "data": {
3704///      "description": "The generated images.",
3705///      "type": "array",
3706///      "items": {
3707///        "$ref": "#/definitions/Image"
3708///      }
3709///    },
3710///    "usage": {
3711///      "description": "Usage statistics for the image generation request.",
3712///      "type": "object",
3713///      "properties": {
3714///        "input_tokens": {
3715///          "description": "Number of input tokens.",
3716///          "default": 0,
3717///          "type": "integer",
3718///          "format": "int64"
3719///        },
3720///        "input_tokens_details": {
3721///          "description": "A detailed breakdown of the input tokens.",
3722///          "type": "object",
3723///          "properties": {
3724///            "cached_tokens": {
3725///              "description": "The number of tokens retrieved from the cache.",
3726///              "default": 0,
3727///              "type": "integer",
3728///              "format": "int64"
3729///            }
3730///          }
3731///        },
3732///        "output_tokens": {
3733///          "description": "Number of output tokens.",
3734///          "default": 0,
3735///          "type": "integer",
3736///          "format": "int64"
3737///        },
3738///        "total_tokens": {
3739///          "description": "Total number of tokens used.",
3740///          "default": 0,
3741///          "type": "integer",
3742///          "format": "int64"
3743///        }
3744///      }
3745///    }
3746///  }
3747///}
3748/// ```
3749/// </details>
3750#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
3751pub struct ImagesResponse {
3752    ///The Unix timestamp (in seconds) of when the image was created.
3753    pub created: i64,
3754    ///The generated images.
3755    pub data: ::std::vec::Vec<Image>,
3756    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
3757    pub usage: ::std::option::Option<ImagesResponseUsage>,
3758}
3759///Usage statistics for the image generation request.
3760///
3761/// <details><summary>JSON schema</summary>
3762///
3763/// ```json
3764///{
3765///  "description": "Usage statistics for the image generation request.",
3766///  "type": "object",
3767///  "properties": {
3768///    "input_tokens": {
3769///      "description": "Number of input tokens.",
3770///      "default": 0,
3771///      "type": "integer",
3772///      "format": "int64"
3773///    },
3774///    "input_tokens_details": {
3775///      "description": "A detailed breakdown of the input tokens.",
3776///      "type": "object",
3777///      "properties": {
3778///        "cached_tokens": {
3779///          "description": "The number of tokens retrieved from the cache.",
3780///          "default": 0,
3781///          "type": "integer",
3782///          "format": "int64"
3783///        }
3784///      }
3785///    },
3786///    "output_tokens": {
3787///      "description": "Number of output tokens.",
3788///      "default": 0,
3789///      "type": "integer",
3790///      "format": "int64"
3791///    },
3792///    "total_tokens": {
3793///      "description": "Total number of tokens used.",
3794///      "default": 0,
3795///      "type": "integer",
3796///      "format": "int64"
3797///    }
3798///  }
3799///}
3800/// ```
3801/// </details>
3802#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
3803pub struct ImagesResponseUsage {
3804    ///Number of input tokens.
3805    #[serde(default)]
3806    pub input_tokens: i64,
3807    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
3808    pub input_tokens_details: ::std::option::Option<ImagesResponseUsageInputTokensDetails>,
3809    ///Number of output tokens.
3810    #[serde(default)]
3811    pub output_tokens: i64,
3812    ///Total number of tokens used.
3813    #[serde(default)]
3814    pub total_tokens: i64,
3815}
3816impl ::std::default::Default for ImagesResponseUsage {
3817    fn default() -> Self {
3818        Self {
3819            input_tokens: Default::default(),
3820            input_tokens_details: Default::default(),
3821            output_tokens: Default::default(),
3822            total_tokens: Default::default(),
3823        }
3824    }
3825}
3826///A detailed breakdown of the input tokens.
3827///
3828/// <details><summary>JSON schema</summary>
3829///
3830/// ```json
3831///{
3832///  "description": "A detailed breakdown of the input tokens.",
3833///  "type": "object",
3834///  "properties": {
3835///    "cached_tokens": {
3836///      "description": "The number of tokens retrieved from the cache.",
3837///      "default": 0,
3838///      "type": "integer",
3839///      "format": "int64"
3840///    }
3841///  }
3842///}
3843/// ```
3844/// </details>
3845#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
3846pub struct ImagesResponseUsageInputTokensDetails {
3847    ///The number of tokens retrieved from the cache.
3848    #[serde(default)]
3849    pub cached_tokens: i64,
3850}
3851impl ::std::default::Default for ImagesResponseUsageInputTokensDetails {
3852    fn default() -> Self {
3853        Self {
3854            cached_tokens: Default::default(),
3855        }
3856    }
3857}
3858///Response structure for listing models
3859///
3860/// <details><summary>JSON schema</summary>
3861///
3862/// ```json
3863///{
3864///  "description": "Response structure for listing models",
3865///  "type": "object",
3866///  "required": [
3867///    "data",
3868///    "object"
3869///  ],
3870///  "properties": {
3871///    "data": {
3872///      "default": [],
3873///      "type": "array",
3874///      "items": {
3875///        "$ref": "#/definitions/Model"
3876///      }
3877///    },
3878///    "object": {
3879///      "type": "string"
3880///    },
3881///    "provider": {
3882///      "$ref": "#/definitions/Provider"
3883///    }
3884///  }
3885///}
3886/// ```
3887/// </details>
3888#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
3889pub struct ListModelsResponse {
3890    pub data: ::std::vec::Vec<Model>,
3891    pub object: ::std::string::String,
3892    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
3893    pub provider: ::std::option::Option<Provider>,
3894}
3895///Response structure for listing MCP tools
3896///
3897/// <details><summary>JSON schema</summary>
3898///
3899/// ```json
3900///{
3901///  "description": "Response structure for listing MCP tools",
3902///  "type": "object",
3903///  "required": [
3904///    "data",
3905///    "object"
3906///  ],
3907///  "properties": {
3908///    "data": {
3909///      "description": "Array of available MCP tools",
3910///      "default": [],
3911///      "type": "array",
3912///      "items": {
3913///        "$ref": "#/definitions/MCPTool"
3914///      }
3915///    },
3916///    "object": {
3917///      "description": "Always \"list\"",
3918///      "type": "string"
3919///    }
3920///  }
3921///}
3922/// ```
3923/// </details>
3924#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
3925pub struct ListToolsResponse {
3926    ///Array of available MCP tools
3927    pub data: ::std::vec::Vec<McpTool>,
3928    ///Always "list"
3929    pub object: ::std::string::String,
3930}
3931///An MCP tool definition
3932///
3933/// <details><summary>JSON schema</summary>
3934///
3935/// ```json
3936///{
3937///  "description": "An MCP tool definition",
3938///  "type": "object",
3939///  "required": [
3940///    "description",
3941///    "name",
3942///    "server"
3943///  ],
3944///  "properties": {
3945///    "description": {
3946///      "description": "A description of what the tool does",
3947///      "type": "string"
3948///    },
3949///    "input_schema": {
3950///      "description": "JSON schema for the tool's input parameters",
3951///      "type": "object",
3952///      "additionalProperties": true
3953///    },
3954///    "name": {
3955///      "description": "The name of the tool",
3956///      "type": "string"
3957///    },
3958///    "server": {
3959///      "description": "The MCP server that provides this tool",
3960///      "type": "string"
3961///    }
3962///  }
3963///}
3964/// ```
3965/// </details>
3966#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
3967pub struct McpTool {
3968    ///A description of what the tool does
3969    pub description: ::std::string::String,
3970    ///JSON schema for the tool's input parameters
3971    #[serde(default, skip_serializing_if = "::serde_json::Map::is_empty")]
3972    pub input_schema: ::serde_json::Map<::std::string::String, ::serde_json::Value>,
3973    ///The name of the tool
3974    pub name: ::std::string::String,
3975    ///The MCP server that provides this tool
3976    pub server: ::std::string::String,
3977}
3978///Message structure for provider requests
3979///
3980/// <details><summary>JSON schema</summary>
3981///
3982/// ```json
3983///{
3984///  "description": "Message structure for provider requests",
3985///  "type": "object",
3986///  "required": [
3987///    "content",
3988///    "role"
3989///  ],
3990///  "properties": {
3991///    "content": {
3992///      "$ref": "#/definitions/MessageContent"
3993///    },
3994///    "reasoning": {
3995///      "description": "The reasoning of the chunk message. Same as reasoning_content.",
3996///      "type": "string"
3997///    },
3998///    "reasoning_content": {
3999///      "description": "The reasoning content of the chunk message.",
4000///      "type": "string"
4001///    },
4002///    "role": {
4003///      "$ref": "#/definitions/MessageRole"
4004///    },
4005///    "tool_call_id": {
4006///      "type": "string"
4007///    },
4008///    "tool_calls": {
4009///      "type": "array",
4010///      "items": {
4011///        "$ref": "#/definitions/ChatCompletionMessageToolCall"
4012///      }
4013///    }
4014///  }
4015///}
4016/// ```
4017/// </details>
4018#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
4019pub struct Message {
4020    pub content: MessageContent,
4021    ///The reasoning of the chunk message. Same as reasoning_content.
4022    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
4023    pub reasoning: ::std::option::Option<::std::string::String>,
4024    ///The reasoning content of the chunk message.
4025    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
4026    pub reasoning_content: ::std::option::Option<::std::string::String>,
4027    pub role: MessageRole,
4028    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
4029    pub tool_call_id: ::std::option::Option<::std::string::String>,
4030    #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
4031    pub tool_calls: ::std::vec::Vec<ChatCompletionMessageToolCall>,
4032}
4033///Message content - either text or multimodal content parts
4034///
4035/// <details><summary>JSON schema</summary>
4036///
4037/// ```json
4038///{
4039///  "description": "Message content - either text or multimodal content parts",
4040///  "oneOf": [
4041///    {
4042///      "description": "Text content (backward compatibility)",
4043///      "type": "string"
4044///    },
4045///    {
4046///      "description": "Array of content parts for multimodal messages",
4047///      "type": "array",
4048///      "items": {
4049///        "$ref": "#/definitions/ContentPart"
4050///      }
4051///    }
4052///  ]
4053///}
4054/// ```
4055/// </details>
4056#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
4057#[serde(untagged)]
4058pub enum MessageContent {
4059    String(::std::string::String),
4060    Array(::std::vec::Vec<ContentPart>),
4061}
4062impl ::std::convert::From<::std::vec::Vec<ContentPart>> for MessageContent {
4063    fn from(value: ::std::vec::Vec<ContentPart>) -> Self {
4064        Self::Array(value)
4065    }
4066}
4067///Role of the message sender
4068///
4069/// <details><summary>JSON schema</summary>
4070///
4071/// ```json
4072///{
4073///  "description": "Role of the message sender",
4074///  "type": "string",
4075///  "enum": [
4076///    "system",
4077///    "user",
4078///    "assistant",
4079///    "tool"
4080///  ]
4081///}
4082/// ```
4083/// </details>
4084#[derive(
4085    ::serde::Deserialize,
4086    ::serde::Serialize,
4087    Clone,
4088    Copy,
4089    Debug,
4090    Eq,
4091    Hash,
4092    Ord,
4093    PartialEq,
4094    PartialOrd,
4095)]
4096pub enum MessageRole {
4097    #[serde(rename = "system")]
4098    System,
4099    #[serde(rename = "user")]
4100    User,
4101    #[serde(rename = "assistant")]
4102    Assistant,
4103    #[serde(rename = "tool")]
4104    Tool,
4105}
4106impl ::std::fmt::Display for MessageRole {
4107    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
4108        match *self {
4109            Self::System => f.write_str("system"),
4110            Self::User => f.write_str("user"),
4111            Self::Assistant => f.write_str("assistant"),
4112            Self::Tool => f.write_str("tool"),
4113        }
4114    }
4115}
4116impl ::std::str::FromStr for MessageRole {
4117    type Err = self::error::ConversionError;
4118    fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
4119        match value {
4120            "system" => Ok(Self::System),
4121            "user" => Ok(Self::User),
4122            "assistant" => Ok(Self::Assistant),
4123            "tool" => Ok(Self::Tool),
4124            _ => Err("invalid value".into()),
4125        }
4126    }
4127}
4128impl ::std::convert::TryFrom<&str> for MessageRole {
4129    type Error = self::error::ConversionError;
4130    fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
4131        value.parse()
4132    }
4133}
4134impl ::std::convert::TryFrom<&::std::string::String> for MessageRole {
4135    type Error = self::error::ConversionError;
4136    fn try_from(
4137        value: &::std::string::String,
4138    ) -> ::std::result::Result<Self, self::error::ConversionError> {
4139        value.parse()
4140    }
4141}
4142impl ::std::convert::TryFrom<::std::string::String> for MessageRole {
4143    type Error = self::error::ConversionError;
4144    fn try_from(
4145        value: ::std::string::String,
4146    ) -> ::std::result::Result<Self, self::error::ConversionError> {
4147        value.parse()
4148    }
4149}
4150///A document content block in a Messages API request.
4151///
4152/// <details><summary>JSON schema</summary>
4153///
4154/// ```json
4155///{
4156///  "description": "A document content block in a Messages API request.",
4157///  "type": "object",
4158///  "required": [
4159///    "source",
4160///    "type"
4161///  ],
4162///  "properties": {
4163///    "cache_control": {
4164///      "$ref": "#/definitions/CacheControl"
4165///    },
4166///    "source": {
4167///      "$ref": "#/definitions/MessagesDocumentSource"
4168///    },
4169///    "type": {
4170///      "description": "Content type identifier. Always `document`.",
4171///      "type": "string",
4172///      "enum": [
4173///        "document"
4174///      ]
4175///    }
4176///  }
4177///}
4178/// ```
4179/// </details>
4180#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
4181pub struct MessagesDocumentBlock {
4182    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
4183    pub cache_control: ::std::option::Option<CacheControl>,
4184    pub source: MessagesDocumentSource,
4185    ///Content type identifier. Always `document`.
4186    #[serde(rename = "type")]
4187    pub type_: MessagesDocumentBlockType,
4188}
4189///Content type identifier. Always `document`.
4190///
4191/// <details><summary>JSON schema</summary>
4192///
4193/// ```json
4194///{
4195///  "description": "Content type identifier. Always `document`.",
4196///  "type": "string",
4197///  "enum": [
4198///    "document"
4199///  ]
4200///}
4201/// ```
4202/// </details>
4203#[derive(
4204    ::serde::Deserialize,
4205    ::serde::Serialize,
4206    Clone,
4207    Copy,
4208    Debug,
4209    Eq,
4210    Hash,
4211    Ord,
4212    PartialEq,
4213    PartialOrd,
4214)]
4215pub enum MessagesDocumentBlockType {
4216    #[serde(rename = "document")]
4217    Document,
4218}
4219impl ::std::fmt::Display for MessagesDocumentBlockType {
4220    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
4221        match *self {
4222            Self::Document => f.write_str("document"),
4223        }
4224    }
4225}
4226impl ::std::str::FromStr for MessagesDocumentBlockType {
4227    type Err = self::error::ConversionError;
4228    fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
4229        match value {
4230            "document" => Ok(Self::Document),
4231            _ => Err("invalid value".into()),
4232        }
4233    }
4234}
4235impl ::std::convert::TryFrom<&str> for MessagesDocumentBlockType {
4236    type Error = self::error::ConversionError;
4237    fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
4238        value.parse()
4239    }
4240}
4241impl ::std::convert::TryFrom<&::std::string::String> for MessagesDocumentBlockType {
4242    type Error = self::error::ConversionError;
4243    fn try_from(
4244        value: &::std::string::String,
4245    ) -> ::std::result::Result<Self, self::error::ConversionError> {
4246        value.parse()
4247    }
4248}
4249impl ::std::convert::TryFrom<::std::string::String> for MessagesDocumentBlockType {
4250    type Error = self::error::ConversionError;
4251    fn try_from(
4252        value: ::std::string::String,
4253    ) -> ::std::result::Result<Self, self::error::ConversionError> {
4254        value.parse()
4255    }
4256}
4257/**The source of a document content block. Can be a base64-encoded
4258document or a URL.
4259*/
4260///
4261/// <details><summary>JSON schema</summary>
4262///
4263/// ```json
4264///{
4265///  "description": "The source of a document content block. Can be a base64-encoded\ndocument or a URL.\n",
4266///  "type": "object",
4267///  "required": [
4268///    "type"
4269///  ],
4270///  "properties": {
4271///    "data": {
4272///      "description": "Base64-encoded document data. Required when `type` is `base64`.\n",
4273///      "type": "string"
4274///    },
4275///    "media_type": {
4276///      "description": "The media type of the document (e.g. `application/pdf`).\nRequired when `type` is `base64`.\n",
4277///      "type": "string"
4278///    },
4279///    "type": {
4280///      "description": "The source type.",
4281///      "type": "string",
4282///      "enum": [
4283///        "base64",
4284///        "url"
4285///      ]
4286///    },
4287///    "url": {
4288///      "description": "URL of the document. Required when `type` is `url`.\n",
4289///      "type": "string"
4290///    }
4291///  }
4292///}
4293/// ```
4294/// </details>
4295#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
4296pub struct MessagesDocumentSource {
4297    /**Base64-encoded document data. Required when `type` is `base64`.
4298     */
4299    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
4300    pub data: ::std::option::Option<::std::string::String>,
4301    /**The media type of the document (e.g. `application/pdf`).
4302    Required when `type` is `base64`.
4303    */
4304    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
4305    pub media_type: ::std::option::Option<::std::string::String>,
4306    ///The source type.
4307    #[serde(rename = "type")]
4308    pub type_: MessagesDocumentSourceType,
4309    /**URL of the document. Required when `type` is `url`.
4310     */
4311    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
4312    pub url: ::std::option::Option<::std::string::String>,
4313}
4314///The source type.
4315///
4316/// <details><summary>JSON schema</summary>
4317///
4318/// ```json
4319///{
4320///  "description": "The source type.",
4321///  "type": "string",
4322///  "enum": [
4323///    "base64",
4324///    "url"
4325///  ]
4326///}
4327/// ```
4328/// </details>
4329#[derive(
4330    ::serde::Deserialize,
4331    ::serde::Serialize,
4332    Clone,
4333    Copy,
4334    Debug,
4335    Eq,
4336    Hash,
4337    Ord,
4338    PartialEq,
4339    PartialOrd,
4340)]
4341pub enum MessagesDocumentSourceType {
4342    #[serde(rename = "base64")]
4343    Base64,
4344    #[serde(rename = "url")]
4345    Url,
4346}
4347impl ::std::fmt::Display for MessagesDocumentSourceType {
4348    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
4349        match *self {
4350            Self::Base64 => f.write_str("base64"),
4351            Self::Url => f.write_str("url"),
4352        }
4353    }
4354}
4355impl ::std::str::FromStr for MessagesDocumentSourceType {
4356    type Err = self::error::ConversionError;
4357    fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
4358        match value {
4359            "base64" => Ok(Self::Base64),
4360            "url" => Ok(Self::Url),
4361            _ => Err("invalid value".into()),
4362        }
4363    }
4364}
4365impl ::std::convert::TryFrom<&str> for MessagesDocumentSourceType {
4366    type Error = self::error::ConversionError;
4367    fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
4368        value.parse()
4369    }
4370}
4371impl ::std::convert::TryFrom<&::std::string::String> for MessagesDocumentSourceType {
4372    type Error = self::error::ConversionError;
4373    fn try_from(
4374        value: &::std::string::String,
4375    ) -> ::std::result::Result<Self, self::error::ConversionError> {
4376        value.parse()
4377    }
4378}
4379impl ::std::convert::TryFrom<::std::string::String> for MessagesDocumentSourceType {
4380    type Error = self::error::ConversionError;
4381    fn try_from(
4382        value: ::std::string::String,
4383    ) -> ::std::result::Result<Self, self::error::ConversionError> {
4384        value.parse()
4385    }
4386}
4387/**An error response in the Anthropic error format.
4388*/
4389///
4390/// <details><summary>JSON schema</summary>
4391///
4392/// ```json
4393///{
4394///  "description": "An error response in the Anthropic error format.\n",
4395///  "type": "object",
4396///  "required": [
4397///    "error",
4398///    "type"
4399///  ],
4400///  "properties": {
4401///    "error": {
4402///      "description": "The error details.",
4403///      "type": "object",
4404///      "required": [
4405///        "message",
4406///        "type"
4407///      ],
4408///      "properties": {
4409///        "message": {
4410///          "description": "A human-readable error message.",
4411///          "type": "string"
4412///        },
4413///        "type": {
4414///          "description": "The error type (e.g. `invalid_request_error`, `api_error`).",
4415///          "type": "string"
4416///        }
4417///      }
4418///    },
4419///    "type": {
4420///      "description": "Always `error`.",
4421///      "type": "string",
4422///      "enum": [
4423///        "error"
4424///      ]
4425///    }
4426///  }
4427///}
4428/// ```
4429/// </details>
4430#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
4431pub struct MessagesError {
4432    pub error: MessagesErrorError,
4433    ///Always `error`.
4434    #[serde(rename = "type")]
4435    pub type_: MessagesErrorType,
4436}
4437///The error details.
4438///
4439/// <details><summary>JSON schema</summary>
4440///
4441/// ```json
4442///{
4443///  "description": "The error details.",
4444///  "type": "object",
4445///  "required": [
4446///    "message",
4447///    "type"
4448///  ],
4449///  "properties": {
4450///    "message": {
4451///      "description": "A human-readable error message.",
4452///      "type": "string"
4453///    },
4454///    "type": {
4455///      "description": "The error type (e.g. `invalid_request_error`, `api_error`).",
4456///      "type": "string"
4457///    }
4458///  }
4459///}
4460/// ```
4461/// </details>
4462#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
4463pub struct MessagesErrorError {
4464    ///A human-readable error message.
4465    pub message: ::std::string::String,
4466    ///The error type (e.g. `invalid_request_error`, `api_error`).
4467    #[serde(rename = "type")]
4468    pub type_: ::std::string::String,
4469}
4470///Always `error`.
4471///
4472/// <details><summary>JSON schema</summary>
4473///
4474/// ```json
4475///{
4476///  "description": "Always `error`.",
4477///  "type": "string",
4478///  "enum": [
4479///    "error"
4480///  ]
4481///}
4482/// ```
4483/// </details>
4484#[derive(
4485    ::serde::Deserialize,
4486    ::serde::Serialize,
4487    Clone,
4488    Copy,
4489    Debug,
4490    Eq,
4491    Hash,
4492    Ord,
4493    PartialEq,
4494    PartialOrd,
4495)]
4496pub enum MessagesErrorType {
4497    #[serde(rename = "error")]
4498    Error,
4499}
4500impl ::std::fmt::Display for MessagesErrorType {
4501    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
4502        match *self {
4503            Self::Error => f.write_str("error"),
4504        }
4505    }
4506}
4507impl ::std::str::FromStr for MessagesErrorType {
4508    type Err = self::error::ConversionError;
4509    fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
4510        match value {
4511            "error" => Ok(Self::Error),
4512            _ => Err("invalid value".into()),
4513        }
4514    }
4515}
4516impl ::std::convert::TryFrom<&str> for MessagesErrorType {
4517    type Error = self::error::ConversionError;
4518    fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
4519        value.parse()
4520    }
4521}
4522impl ::std::convert::TryFrom<&::std::string::String> for MessagesErrorType {
4523    type Error = self::error::ConversionError;
4524    fn try_from(
4525        value: &::std::string::String,
4526    ) -> ::std::result::Result<Self, self::error::ConversionError> {
4527        value.parse()
4528    }
4529}
4530impl ::std::convert::TryFrom<::std::string::String> for MessagesErrorType {
4531    type Error = self::error::ConversionError;
4532    fn try_from(
4533        value: ::std::string::String,
4534    ) -> ::std::result::Result<Self, self::error::ConversionError> {
4535        value.parse()
4536    }
4537}
4538///An image content block in a Messages API request.
4539///
4540/// <details><summary>JSON schema</summary>
4541///
4542/// ```json
4543///{
4544///  "description": "An image content block in a Messages API request.",
4545///  "type": "object",
4546///  "required": [
4547///    "source",
4548///    "type"
4549///  ],
4550///  "properties": {
4551///    "cache_control": {
4552///      "$ref": "#/definitions/CacheControl"
4553///    },
4554///    "source": {
4555///      "$ref": "#/definitions/MessagesImageSource"
4556///    },
4557///    "type": {
4558///      "description": "Content type identifier. Always `image`.",
4559///      "type": "string",
4560///      "enum": [
4561///        "image"
4562///      ]
4563///    }
4564///  }
4565///}
4566/// ```
4567/// </details>
4568#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
4569pub struct MessagesImageBlock {
4570    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
4571    pub cache_control: ::std::option::Option<CacheControl>,
4572    pub source: MessagesImageSource,
4573    ///Content type identifier. Always `image`.
4574    #[serde(rename = "type")]
4575    pub type_: MessagesImageBlockType,
4576}
4577///Content type identifier. Always `image`.
4578///
4579/// <details><summary>JSON schema</summary>
4580///
4581/// ```json
4582///{
4583///  "description": "Content type identifier. Always `image`.",
4584///  "type": "string",
4585///  "enum": [
4586///    "image"
4587///  ]
4588///}
4589/// ```
4590/// </details>
4591#[derive(
4592    ::serde::Deserialize,
4593    ::serde::Serialize,
4594    Clone,
4595    Copy,
4596    Debug,
4597    Eq,
4598    Hash,
4599    Ord,
4600    PartialEq,
4601    PartialOrd,
4602)]
4603pub enum MessagesImageBlockType {
4604    #[serde(rename = "image")]
4605    Image,
4606}
4607impl ::std::fmt::Display for MessagesImageBlockType {
4608    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
4609        match *self {
4610            Self::Image => f.write_str("image"),
4611        }
4612    }
4613}
4614impl ::std::str::FromStr for MessagesImageBlockType {
4615    type Err = self::error::ConversionError;
4616    fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
4617        match value {
4618            "image" => Ok(Self::Image),
4619            _ => Err("invalid value".into()),
4620        }
4621    }
4622}
4623impl ::std::convert::TryFrom<&str> for MessagesImageBlockType {
4624    type Error = self::error::ConversionError;
4625    fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
4626        value.parse()
4627    }
4628}
4629impl ::std::convert::TryFrom<&::std::string::String> for MessagesImageBlockType {
4630    type Error = self::error::ConversionError;
4631    fn try_from(
4632        value: &::std::string::String,
4633    ) -> ::std::result::Result<Self, self::error::ConversionError> {
4634        value.parse()
4635    }
4636}
4637impl ::std::convert::TryFrom<::std::string::String> for MessagesImageBlockType {
4638    type Error = self::error::ConversionError;
4639    fn try_from(
4640        value: ::std::string::String,
4641    ) -> ::std::result::Result<Self, self::error::ConversionError> {
4642        value.parse()
4643    }
4644}
4645/**The source of an image content block. Can be a base64-encoded
4646image or a URL.
4647*/
4648///
4649/// <details><summary>JSON schema</summary>
4650///
4651/// ```json
4652///{
4653///  "description": "The source of an image content block. Can be a base64-encoded\nimage or a URL.\n",
4654///  "type": "object",
4655///  "required": [
4656///    "type"
4657///  ],
4658///  "properties": {
4659///    "data": {
4660///      "description": "Base64-encoded image data. Required when `type` is `base64`.\n",
4661///      "type": "string"
4662///    },
4663///    "media_type": {
4664///      "description": "The media type of the image (e.g. `image/jpeg`, `image/png`,\n`image/gif`, `image/webp`). Required when `type` is `base64`.\n",
4665///      "type": "string"
4666///    },
4667///    "type": {
4668///      "description": "The source type.",
4669///      "type": "string",
4670///      "enum": [
4671///        "base64",
4672///        "url"
4673///      ]
4674///    },
4675///    "url": {
4676///      "description": "URL of the image. Required when `type` is `url`.\n",
4677///      "type": "string"
4678///    }
4679///  }
4680///}
4681/// ```
4682/// </details>
4683#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
4684pub struct MessagesImageSource {
4685    /**Base64-encoded image data. Required when `type` is `base64`.
4686     */
4687    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
4688    pub data: ::std::option::Option<::std::string::String>,
4689    /**The media type of the image (e.g. `image/jpeg`, `image/png`,
4690    `image/gif`, `image/webp`). Required when `type` is `base64`.
4691    */
4692    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
4693    pub media_type: ::std::option::Option<::std::string::String>,
4694    ///The source type.
4695    #[serde(rename = "type")]
4696    pub type_: MessagesImageSourceType,
4697    /**URL of the image. Required when `type` is `url`.
4698     */
4699    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
4700    pub url: ::std::option::Option<::std::string::String>,
4701}
4702///The source type.
4703///
4704/// <details><summary>JSON schema</summary>
4705///
4706/// ```json
4707///{
4708///  "description": "The source type.",
4709///  "type": "string",
4710///  "enum": [
4711///    "base64",
4712///    "url"
4713///  ]
4714///}
4715/// ```
4716/// </details>
4717#[derive(
4718    ::serde::Deserialize,
4719    ::serde::Serialize,
4720    Clone,
4721    Copy,
4722    Debug,
4723    Eq,
4724    Hash,
4725    Ord,
4726    PartialEq,
4727    PartialOrd,
4728)]
4729pub enum MessagesImageSourceType {
4730    #[serde(rename = "base64")]
4731    Base64,
4732    #[serde(rename = "url")]
4733    Url,
4734}
4735impl ::std::fmt::Display for MessagesImageSourceType {
4736    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
4737        match *self {
4738            Self::Base64 => f.write_str("base64"),
4739            Self::Url => f.write_str("url"),
4740        }
4741    }
4742}
4743impl ::std::str::FromStr for MessagesImageSourceType {
4744    type Err = self::error::ConversionError;
4745    fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
4746        match value {
4747            "base64" => Ok(Self::Base64),
4748            "url" => Ok(Self::Url),
4749            _ => Err("invalid value".into()),
4750        }
4751    }
4752}
4753impl ::std::convert::TryFrom<&str> for MessagesImageSourceType {
4754    type Error = self::error::ConversionError;
4755    fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
4756        value.parse()
4757    }
4758}
4759impl ::std::convert::TryFrom<&::std::string::String> for MessagesImageSourceType {
4760    type Error = self::error::ConversionError;
4761    fn try_from(
4762        value: &::std::string::String,
4763    ) -> ::std::result::Result<Self, self::error::ConversionError> {
4764        value.parse()
4765    }
4766}
4767impl ::std::convert::TryFrom<::std::string::String> for MessagesImageSourceType {
4768    type Error = self::error::ConversionError;
4769    fn try_from(
4770        value: ::std::string::String,
4771    ) -> ::std::result::Result<Self, self::error::ConversionError> {
4772        value.parse()
4773    }
4774}
4775///A message in a Messages API request.
4776///
4777/// <details><summary>JSON schema</summary>
4778///
4779/// ```json
4780///{
4781///  "description": "A message in a Messages API request.",
4782///  "type": "object",
4783///  "required": [
4784///    "content",
4785///    "role"
4786///  ],
4787///  "properties": {
4788///    "content": {
4789///      "description": "The content of the message. Can be a string or an array of\ncontent blocks.\n",
4790///      "oneOf": [
4791///        {
4792///          "description": "Text content.",
4793///          "type": "string"
4794///        },
4795///        {
4796///          "type": "array",
4797///          "items": {
4798///            "$ref": "#/definitions/MessagesRequestContentBlock"
4799///          }
4800///        }
4801///      ]
4802///    },
4803///    "role": {
4804///      "description": "The role of the message sender.",
4805///      "type": "string",
4806///      "enum": [
4807///        "user",
4808///        "assistant"
4809///      ]
4810///    }
4811///  }
4812///}
4813/// ```
4814/// </details>
4815#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
4816pub struct MessagesMessage {
4817    /**The content of the message. Can be a string or an array of
4818    content blocks.
4819    */
4820    pub content: MessagesMessageContent,
4821    ///The role of the message sender.
4822    pub role: MessagesMessageRole,
4823}
4824/**The content of the message. Can be a string or an array of
4825content blocks.
4826*/
4827///
4828/// <details><summary>JSON schema</summary>
4829///
4830/// ```json
4831///{
4832///  "description": "The content of the message. Can be a string or an array of\ncontent blocks.\n",
4833///  "oneOf": [
4834///    {
4835///      "description": "Text content.",
4836///      "type": "string"
4837///    },
4838///    {
4839///      "type": "array",
4840///      "items": {
4841///        "$ref": "#/definitions/MessagesRequestContentBlock"
4842///      }
4843///    }
4844///  ]
4845///}
4846/// ```
4847/// </details>
4848#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
4849#[serde(untagged)]
4850pub enum MessagesMessageContent {
4851    String(::std::string::String),
4852    Array(::std::vec::Vec<MessagesRequestContentBlock>),
4853}
4854impl ::std::convert::From<::std::vec::Vec<MessagesRequestContentBlock>> for MessagesMessageContent {
4855    fn from(value: ::std::vec::Vec<MessagesRequestContentBlock>) -> Self {
4856        Self::Array(value)
4857    }
4858}
4859///The role of the message sender.
4860///
4861/// <details><summary>JSON schema</summary>
4862///
4863/// ```json
4864///{
4865///  "description": "The role of the message sender.",
4866///  "type": "string",
4867///  "enum": [
4868///    "user",
4869///    "assistant"
4870///  ]
4871///}
4872/// ```
4873/// </details>
4874#[derive(
4875    ::serde::Deserialize,
4876    ::serde::Serialize,
4877    Clone,
4878    Copy,
4879    Debug,
4880    Eq,
4881    Hash,
4882    Ord,
4883    PartialEq,
4884    PartialOrd,
4885)]
4886pub enum MessagesMessageRole {
4887    #[serde(rename = "user")]
4888    User,
4889    #[serde(rename = "assistant")]
4890    Assistant,
4891}
4892impl ::std::fmt::Display for MessagesMessageRole {
4893    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
4894        match *self {
4895            Self::User => f.write_str("user"),
4896            Self::Assistant => f.write_str("assistant"),
4897        }
4898    }
4899}
4900impl ::std::str::FromStr for MessagesMessageRole {
4901    type Err = self::error::ConversionError;
4902    fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
4903        match value {
4904            "user" => Ok(Self::User),
4905            "assistant" => Ok(Self::Assistant),
4906            _ => Err("invalid value".into()),
4907        }
4908    }
4909}
4910impl ::std::convert::TryFrom<&str> for MessagesMessageRole {
4911    type Error = self::error::ConversionError;
4912    fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
4913        value.parse()
4914    }
4915}
4916impl ::std::convert::TryFrom<&::std::string::String> for MessagesMessageRole {
4917    type Error = self::error::ConversionError;
4918    fn try_from(
4919        value: &::std::string::String,
4920    ) -> ::std::result::Result<Self, self::error::ConversionError> {
4921        value.parse()
4922    }
4923}
4924impl ::std::convert::TryFrom<::std::string::String> for MessagesMessageRole {
4925    type Error = self::error::ConversionError;
4926    fn try_from(
4927        value: ::std::string::String,
4928    ) -> ::std::result::Result<Self, self::error::ConversionError> {
4929        value.parse()
4930    }
4931}
4932///Metadata for a Messages API request.
4933///
4934/// <details><summary>JSON schema</summary>
4935///
4936/// ```json
4937///{
4938///  "description": "Metadata for a Messages API request.",
4939///  "type": "object",
4940///  "properties": {
4941///    "user_id": {
4942///      "description": "An external identifier for the user.",
4943///      "type": "string"
4944///    }
4945///  }
4946///}
4947/// ```
4948/// </details>
4949#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
4950pub struct MessagesMetadata {
4951    ///An external identifier for the user.
4952    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
4953    pub user_id: ::std::option::Option<::std::string::String>,
4954}
4955impl ::std::default::Default for MessagesMetadata {
4956    fn default() -> Self {
4957        Self {
4958            user_id: Default::default(),
4959        }
4960    }
4961}
4962/**Output configuration for a Messages API request.
4963*/
4964///
4965/// <details><summary>JSON schema</summary>
4966///
4967/// ```json
4968///{
4969///  "description": "Output configuration for a Messages API request.\n",
4970///  "type": "object",
4971///  "properties": {
4972///    "effort": {
4973///      "description": "Constrains how much effort the model spends on reasoning.\nLower effort yields faster responses and fewer reasoning\ntokens.\n",
4974///      "type": "string",
4975///      "enum": [
4976///        "low",
4977///        "medium",
4978///        "high",
4979///        "xhigh",
4980///        "max"
4981///      ]
4982///    }
4983///  }
4984///}
4985/// ```
4986/// </details>
4987#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
4988pub struct MessagesOutputConfig {
4989    /**Constrains how much effort the model spends on reasoning.
4990    Lower effort yields faster responses and fewer reasoning
4991    tokens.
4992    */
4993    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
4994    pub effort: ::std::option::Option<MessagesOutputConfigEffort>,
4995}
4996impl ::std::default::Default for MessagesOutputConfig {
4997    fn default() -> Self {
4998        Self {
4999            effort: Default::default(),
5000        }
5001    }
5002}
5003/**Constrains how much effort the model spends on reasoning.
5004Lower effort yields faster responses and fewer reasoning
5005tokens.
5006*/
5007///
5008/// <details><summary>JSON schema</summary>
5009///
5010/// ```json
5011///{
5012///  "description": "Constrains how much effort the model spends on reasoning.\nLower effort yields faster responses and fewer reasoning\ntokens.\n",
5013///  "type": "string",
5014///  "enum": [
5015///    "low",
5016///    "medium",
5017///    "high",
5018///    "xhigh",
5019///    "max"
5020///  ]
5021///}
5022/// ```
5023/// </details>
5024#[derive(
5025    ::serde::Deserialize,
5026    ::serde::Serialize,
5027    Clone,
5028    Copy,
5029    Debug,
5030    Eq,
5031    Hash,
5032    Ord,
5033    PartialEq,
5034    PartialOrd,
5035)]
5036pub enum MessagesOutputConfigEffort {
5037    #[serde(rename = "low")]
5038    Low,
5039    #[serde(rename = "medium")]
5040    Medium,
5041    #[serde(rename = "high")]
5042    High,
5043    #[serde(rename = "xhigh")]
5044    Xhigh,
5045    #[serde(rename = "max")]
5046    Max,
5047}
5048impl ::std::fmt::Display for MessagesOutputConfigEffort {
5049    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
5050        match *self {
5051            Self::Low => f.write_str("low"),
5052            Self::Medium => f.write_str("medium"),
5053            Self::High => f.write_str("high"),
5054            Self::Xhigh => f.write_str("xhigh"),
5055            Self::Max => f.write_str("max"),
5056        }
5057    }
5058}
5059impl ::std::str::FromStr for MessagesOutputConfigEffort {
5060    type Err = self::error::ConversionError;
5061    fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
5062        match value {
5063            "low" => Ok(Self::Low),
5064            "medium" => Ok(Self::Medium),
5065            "high" => Ok(Self::High),
5066            "xhigh" => Ok(Self::Xhigh),
5067            "max" => Ok(Self::Max),
5068            _ => Err("invalid value".into()),
5069        }
5070    }
5071}
5072impl ::std::convert::TryFrom<&str> for MessagesOutputConfigEffort {
5073    type Error = self::error::ConversionError;
5074    fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
5075        value.parse()
5076    }
5077}
5078impl ::std::convert::TryFrom<&::std::string::String> for MessagesOutputConfigEffort {
5079    type Error = self::error::ConversionError;
5080    fn try_from(
5081        value: &::std::string::String,
5082    ) -> ::std::result::Result<Self, self::error::ConversionError> {
5083        value.parse()
5084    }
5085}
5086impl ::std::convert::TryFrom<::std::string::String> for MessagesOutputConfigEffort {
5087    type Error = self::error::ConversionError;
5088    fn try_from(
5089        value: ::std::string::String,
5090    ) -> ::std::result::Result<Self, self::error::ConversionError> {
5091        value.parse()
5092    }
5093}
5094/**A redacted thinking content block in a Messages API request or
5095response. Emitted when thinking content is encrypted for safety
5096reasons; must be passed back unchanged in multi-turn conversations.
5097*/
5098///
5099/// <details><summary>JSON schema</summary>
5100///
5101/// ```json
5102///{
5103///  "description": "A redacted thinking content block in a Messages API request or\nresponse. Emitted when thinking content is encrypted for safety\nreasons; must be passed back unchanged in multi-turn conversations.\n",
5104///  "type": "object",
5105///  "required": [
5106///    "data",
5107///    "type"
5108///  ],
5109///  "properties": {
5110///    "data": {
5111///      "description": "The encrypted thinking content.",
5112///      "type": "string"
5113///    },
5114///    "type": {
5115///      "description": "Content type identifier. Always `redacted_thinking`.",
5116///      "type": "string",
5117///      "enum": [
5118///        "redacted_thinking"
5119///      ]
5120///    }
5121///  }
5122///}
5123/// ```
5124/// </details>
5125#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
5126pub struct MessagesRedactedThinkingBlock {
5127    ///The encrypted thinking content.
5128    pub data: ::std::string::String,
5129    ///Content type identifier. Always `redacted_thinking`.
5130    #[serde(rename = "type")]
5131    pub type_: MessagesRedactedThinkingBlockType,
5132}
5133///Content type identifier. Always `redacted_thinking`.
5134///
5135/// <details><summary>JSON schema</summary>
5136///
5137/// ```json
5138///{
5139///  "description": "Content type identifier. Always `redacted_thinking`.",
5140///  "type": "string",
5141///  "enum": [
5142///    "redacted_thinking"
5143///  ]
5144///}
5145/// ```
5146/// </details>
5147#[derive(
5148    ::serde::Deserialize,
5149    ::serde::Serialize,
5150    Clone,
5151    Copy,
5152    Debug,
5153    Eq,
5154    Hash,
5155    Ord,
5156    PartialEq,
5157    PartialOrd,
5158)]
5159pub enum MessagesRedactedThinkingBlockType {
5160    #[serde(rename = "redacted_thinking")]
5161    RedactedThinking,
5162}
5163impl ::std::fmt::Display for MessagesRedactedThinkingBlockType {
5164    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
5165        match *self {
5166            Self::RedactedThinking => f.write_str("redacted_thinking"),
5167        }
5168    }
5169}
5170impl ::std::str::FromStr for MessagesRedactedThinkingBlockType {
5171    type Err = self::error::ConversionError;
5172    fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
5173        match value {
5174            "redacted_thinking" => Ok(Self::RedactedThinking),
5175            _ => Err("invalid value".into()),
5176        }
5177    }
5178}
5179impl ::std::convert::TryFrom<&str> for MessagesRedactedThinkingBlockType {
5180    type Error = self::error::ConversionError;
5181    fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
5182        value.parse()
5183    }
5184}
5185impl ::std::convert::TryFrom<&::std::string::String> for MessagesRedactedThinkingBlockType {
5186    type Error = self::error::ConversionError;
5187    fn try_from(
5188        value: &::std::string::String,
5189    ) -> ::std::result::Result<Self, self::error::ConversionError> {
5190        value.parse()
5191    }
5192}
5193impl ::std::convert::TryFrom<::std::string::String> for MessagesRedactedThinkingBlockType {
5194    type Error = self::error::ConversionError;
5195    fn try_from(
5196        value: ::std::string::String,
5197    ) -> ::std::result::Result<Self, self::error::ConversionError> {
5198        value.parse()
5199    }
5200}
5201///A content block within a Messages API request message.
5202///
5203/// <details><summary>JSON schema</summary>
5204///
5205/// ```json
5206///{
5207///  "description": "A content block within a Messages API request message.",
5208///  "type": "object",
5209///  "oneOf": [
5210///    {
5211///      "$ref": "#/definitions/MessagesTextBlock"
5212///    },
5213///    {
5214///      "$ref": "#/definitions/MessagesImageBlock"
5215///    },
5216///    {
5217///      "$ref": "#/definitions/MessagesToolUseBlock"
5218///    },
5219///    {
5220///      "$ref": "#/definitions/MessagesToolResultBlock"
5221///    },
5222///    {
5223///      "$ref": "#/definitions/MessagesDocumentBlock"
5224///    },
5225///    {
5226///      "$ref": "#/definitions/MessagesThinkingBlock"
5227///    },
5228///    {
5229///      "$ref": "#/definitions/MessagesRedactedThinkingBlock"
5230///    }
5231///  ]
5232///}
5233/// ```
5234/// </details>
5235#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
5236#[serde(untagged)]
5237pub enum MessagesRequestContentBlock {
5238    TextBlock(MessagesTextBlock),
5239    ImageBlock(MessagesImageBlock),
5240    ToolUseBlock(MessagesToolUseBlock),
5241    ToolResultBlock(MessagesToolResultBlock),
5242    DocumentBlock(MessagesDocumentBlock),
5243    ThinkingBlock(MessagesThinkingBlock),
5244    RedactedThinkingBlock(MessagesRedactedThinkingBlock),
5245}
5246impl ::std::convert::From<MessagesTextBlock> for MessagesRequestContentBlock {
5247    fn from(value: MessagesTextBlock) -> Self {
5248        Self::TextBlock(value)
5249    }
5250}
5251impl ::std::convert::From<MessagesImageBlock> for MessagesRequestContentBlock {
5252    fn from(value: MessagesImageBlock) -> Self {
5253        Self::ImageBlock(value)
5254    }
5255}
5256impl ::std::convert::From<MessagesToolUseBlock> for MessagesRequestContentBlock {
5257    fn from(value: MessagesToolUseBlock) -> Self {
5258        Self::ToolUseBlock(value)
5259    }
5260}
5261impl ::std::convert::From<MessagesToolResultBlock> for MessagesRequestContentBlock {
5262    fn from(value: MessagesToolResultBlock) -> Self {
5263        Self::ToolResultBlock(value)
5264    }
5265}
5266impl ::std::convert::From<MessagesDocumentBlock> for MessagesRequestContentBlock {
5267    fn from(value: MessagesDocumentBlock) -> Self {
5268        Self::DocumentBlock(value)
5269    }
5270}
5271impl ::std::convert::From<MessagesThinkingBlock> for MessagesRequestContentBlock {
5272    fn from(value: MessagesThinkingBlock) -> Self {
5273        Self::ThinkingBlock(value)
5274    }
5275}
5276impl ::std::convert::From<MessagesRedactedThinkingBlock> for MessagesRequestContentBlock {
5277    fn from(value: MessagesRedactedThinkingBlock) -> Self {
5278        Self::RedactedThinkingBlock(value)
5279    }
5280}
5281/**A message response from the Anthropic-compatible Messages API.
5282*/
5283///
5284/// <details><summary>JSON schema</summary>
5285///
5286/// ```json
5287///{
5288///  "description": "A message response from the Anthropic-compatible Messages API.\n",
5289///  "type": "object",
5290///  "required": [
5291///    "content",
5292///    "id",
5293///    "model",
5294///    "role",
5295///    "stop_reason",
5296///    "type",
5297///    "usage"
5298///  ],
5299///  "properties": {
5300///    "content": {
5301///      "description": "The content blocks generated by the model.",
5302///      "type": "array",
5303///      "items": {
5304///        "$ref": "#/definitions/MessagesResponseContentBlock"
5305///      }
5306///    },
5307///    "id": {
5308///      "description": "Unique identifier for this message.",
5309///      "type": "string"
5310///    },
5311///    "model": {
5312///      "description": "The model used to generate the message.",
5313///      "type": "string"
5314///    },
5315///    "role": {
5316///      "description": "Always `assistant`.",
5317///      "type": "string",
5318///      "enum": [
5319///        "assistant"
5320///      ]
5321///    },
5322///    "stop_reason": {
5323///      "description": "The reason the model stopped generating.\n",
5324///      "type": "string",
5325///      "enum": [
5326///        "end_turn",
5327///        "max_tokens",
5328///        "stop_sequence",
5329///        "tool_use",
5330///        "pause_turn",
5331///        "refusal"
5332///      ]
5333///    },
5334///    "stop_sequence": {
5335///      "description": "The stop sequence that caused the model to stop, if any.\n",
5336///      "type": "string",
5337///      "nullable": true
5338///    },
5339///    "type": {
5340///      "description": "Always `message`.",
5341///      "type": "string",
5342///      "enum": [
5343///        "message"
5344///      ]
5345///    },
5346///    "usage": {
5347///      "$ref": "#/definitions/MessagesUsage"
5348///    }
5349///  }
5350///}
5351/// ```
5352/// </details>
5353#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
5354pub struct MessagesResponse {
5355    ///The content blocks generated by the model.
5356    pub content: ::std::vec::Vec<MessagesResponseContentBlock>,
5357    ///Unique identifier for this message.
5358    pub id: ::std::string::String,
5359    ///The model used to generate the message.
5360    pub model: ::std::string::String,
5361    ///Always `assistant`.
5362    pub role: MessagesResponseRole,
5363    /**The reason the model stopped generating.
5364     */
5365    pub stop_reason: MessagesResponseStopReason,
5366    /**The stop sequence that caused the model to stop, if any.
5367     */
5368    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
5369    pub stop_sequence: ::std::option::Option<::std::string::String>,
5370    ///Always `message`.
5371    #[serde(rename = "type")]
5372    pub type_: MessagesResponseType,
5373    pub usage: MessagesUsage,
5374}
5375///A content block within a Messages API response.
5376///
5377/// <details><summary>JSON schema</summary>
5378///
5379/// ```json
5380///{
5381///  "description": "A content block within a Messages API response.",
5382///  "type": "object",
5383///  "oneOf": [
5384///    {
5385///      "$ref": "#/definitions/MessagesTextBlock"
5386///    },
5387///    {
5388///      "$ref": "#/definitions/MessagesToolUseBlock"
5389///    },
5390///    {
5391///      "$ref": "#/definitions/MessagesThinkingBlock"
5392///    },
5393///    {
5394///      "$ref": "#/definitions/MessagesRedactedThinkingBlock"
5395///    }
5396///  ]
5397///}
5398/// ```
5399/// </details>
5400#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
5401#[serde(untagged)]
5402pub enum MessagesResponseContentBlock {
5403    TextBlock(MessagesTextBlock),
5404    ToolUseBlock(MessagesToolUseBlock),
5405    ThinkingBlock(MessagesThinkingBlock),
5406    RedactedThinkingBlock(MessagesRedactedThinkingBlock),
5407}
5408impl ::std::convert::From<MessagesTextBlock> for MessagesResponseContentBlock {
5409    fn from(value: MessagesTextBlock) -> Self {
5410        Self::TextBlock(value)
5411    }
5412}
5413impl ::std::convert::From<MessagesToolUseBlock> for MessagesResponseContentBlock {
5414    fn from(value: MessagesToolUseBlock) -> Self {
5415        Self::ToolUseBlock(value)
5416    }
5417}
5418impl ::std::convert::From<MessagesThinkingBlock> for MessagesResponseContentBlock {
5419    fn from(value: MessagesThinkingBlock) -> Self {
5420        Self::ThinkingBlock(value)
5421    }
5422}
5423impl ::std::convert::From<MessagesRedactedThinkingBlock> for MessagesResponseContentBlock {
5424    fn from(value: MessagesRedactedThinkingBlock) -> Self {
5425        Self::RedactedThinkingBlock(value)
5426    }
5427}
5428///Always `assistant`.
5429///
5430/// <details><summary>JSON schema</summary>
5431///
5432/// ```json
5433///{
5434///  "description": "Always `assistant`.",
5435///  "type": "string",
5436///  "enum": [
5437///    "assistant"
5438///  ]
5439///}
5440/// ```
5441/// </details>
5442#[derive(
5443    ::serde::Deserialize,
5444    ::serde::Serialize,
5445    Clone,
5446    Copy,
5447    Debug,
5448    Eq,
5449    Hash,
5450    Ord,
5451    PartialEq,
5452    PartialOrd,
5453)]
5454pub enum MessagesResponseRole {
5455    #[serde(rename = "assistant")]
5456    Assistant,
5457}
5458impl ::std::fmt::Display for MessagesResponseRole {
5459    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
5460        match *self {
5461            Self::Assistant => f.write_str("assistant"),
5462        }
5463    }
5464}
5465impl ::std::str::FromStr for MessagesResponseRole {
5466    type Err = self::error::ConversionError;
5467    fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
5468        match value {
5469            "assistant" => Ok(Self::Assistant),
5470            _ => Err("invalid value".into()),
5471        }
5472    }
5473}
5474impl ::std::convert::TryFrom<&str> for MessagesResponseRole {
5475    type Error = self::error::ConversionError;
5476    fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
5477        value.parse()
5478    }
5479}
5480impl ::std::convert::TryFrom<&::std::string::String> for MessagesResponseRole {
5481    type Error = self::error::ConversionError;
5482    fn try_from(
5483        value: &::std::string::String,
5484    ) -> ::std::result::Result<Self, self::error::ConversionError> {
5485        value.parse()
5486    }
5487}
5488impl ::std::convert::TryFrom<::std::string::String> for MessagesResponseRole {
5489    type Error = self::error::ConversionError;
5490    fn try_from(
5491        value: ::std::string::String,
5492    ) -> ::std::result::Result<Self, self::error::ConversionError> {
5493        value.parse()
5494    }
5495}
5496/**The reason the model stopped generating.
5497*/
5498///
5499/// <details><summary>JSON schema</summary>
5500///
5501/// ```json
5502///{
5503///  "description": "The reason the model stopped generating.\n",
5504///  "type": "string",
5505///  "enum": [
5506///    "end_turn",
5507///    "max_tokens",
5508///    "stop_sequence",
5509///    "tool_use",
5510///    "pause_turn",
5511///    "refusal"
5512///  ]
5513///}
5514/// ```
5515/// </details>
5516#[derive(
5517    ::serde::Deserialize,
5518    ::serde::Serialize,
5519    Clone,
5520    Copy,
5521    Debug,
5522    Eq,
5523    Hash,
5524    Ord,
5525    PartialEq,
5526    PartialOrd,
5527)]
5528pub enum MessagesResponseStopReason {
5529    #[serde(rename = "end_turn")]
5530    EndTurn,
5531    #[serde(rename = "max_tokens")]
5532    MaxTokens,
5533    #[serde(rename = "stop_sequence")]
5534    StopSequence,
5535    #[serde(rename = "tool_use")]
5536    ToolUse,
5537    #[serde(rename = "pause_turn")]
5538    PauseTurn,
5539    #[serde(rename = "refusal")]
5540    Refusal,
5541}
5542impl ::std::fmt::Display for MessagesResponseStopReason {
5543    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
5544        match *self {
5545            Self::EndTurn => f.write_str("end_turn"),
5546            Self::MaxTokens => f.write_str("max_tokens"),
5547            Self::StopSequence => f.write_str("stop_sequence"),
5548            Self::ToolUse => f.write_str("tool_use"),
5549            Self::PauseTurn => f.write_str("pause_turn"),
5550            Self::Refusal => f.write_str("refusal"),
5551        }
5552    }
5553}
5554impl ::std::str::FromStr for MessagesResponseStopReason {
5555    type Err = self::error::ConversionError;
5556    fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
5557        match value {
5558            "end_turn" => Ok(Self::EndTurn),
5559            "max_tokens" => Ok(Self::MaxTokens),
5560            "stop_sequence" => Ok(Self::StopSequence),
5561            "tool_use" => Ok(Self::ToolUse),
5562            "pause_turn" => Ok(Self::PauseTurn),
5563            "refusal" => Ok(Self::Refusal),
5564            _ => Err("invalid value".into()),
5565        }
5566    }
5567}
5568impl ::std::convert::TryFrom<&str> for MessagesResponseStopReason {
5569    type Error = self::error::ConversionError;
5570    fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
5571        value.parse()
5572    }
5573}
5574impl ::std::convert::TryFrom<&::std::string::String> for MessagesResponseStopReason {
5575    type Error = self::error::ConversionError;
5576    fn try_from(
5577        value: &::std::string::String,
5578    ) -> ::std::result::Result<Self, self::error::ConversionError> {
5579        value.parse()
5580    }
5581}
5582impl ::std::convert::TryFrom<::std::string::String> for MessagesResponseStopReason {
5583    type Error = self::error::ConversionError;
5584    fn try_from(
5585        value: ::std::string::String,
5586    ) -> ::std::result::Result<Self, self::error::ConversionError> {
5587        value.parse()
5588    }
5589}
5590///Always `message`.
5591///
5592/// <details><summary>JSON schema</summary>
5593///
5594/// ```json
5595///{
5596///  "description": "Always `message`.",
5597///  "type": "string",
5598///  "enum": [
5599///    "message"
5600///  ]
5601///}
5602/// ```
5603/// </details>
5604#[derive(
5605    ::serde::Deserialize,
5606    ::serde::Serialize,
5607    Clone,
5608    Copy,
5609    Debug,
5610    Eq,
5611    Hash,
5612    Ord,
5613    PartialEq,
5614    PartialOrd,
5615)]
5616pub enum MessagesResponseType {
5617    #[serde(rename = "message")]
5618    Message,
5619}
5620impl ::std::fmt::Display for MessagesResponseType {
5621    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
5622        match *self {
5623            Self::Message => f.write_str("message"),
5624        }
5625    }
5626}
5627impl ::std::str::FromStr for MessagesResponseType {
5628    type Err = self::error::ConversionError;
5629    fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
5630        match value {
5631            "message" => Ok(Self::Message),
5632            _ => Err("invalid value".into()),
5633        }
5634    }
5635}
5636impl ::std::convert::TryFrom<&str> for MessagesResponseType {
5637    type Error = self::error::ConversionError;
5638    fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
5639        value.parse()
5640    }
5641}
5642impl ::std::convert::TryFrom<&::std::string::String> for MessagesResponseType {
5643    type Error = self::error::ConversionError;
5644    fn try_from(
5645        value: &::std::string::String,
5646    ) -> ::std::result::Result<Self, self::error::ConversionError> {
5647        value.parse()
5648    }
5649}
5650impl ::std::convert::TryFrom<::std::string::String> for MessagesResponseType {
5651    type Error = self::error::ConversionError;
5652    fn try_from(
5653        value: ::std::string::String,
5654    ) -> ::std::result::Result<Self, self::error::ConversionError> {
5655        value.parse()
5656    }
5657}
5658/**A server-sent event emitted while streaming a Messages API response.
5659The Anthropic Messages API emits a sequence of typed events
5660(`message_start`, `content_block_start`, `content_block_delta`,
5661`content_block_stop`, `message_delta`, `message_stop`, `ping`).
5662*/
5663///
5664/// <details><summary>JSON schema</summary>
5665///
5666/// ```json
5667///{
5668///  "description": "A server-sent event emitted while streaming a Messages API response.\nThe Anthropic Messages API emits a sequence of typed events\n(`message_start`, `content_block_start`, `content_block_delta`,\n`content_block_stop`, `message_delta`, `message_stop`, `ping`).\n",
5669///  "type": "object",
5670///  "required": [
5671///    "type"
5672///  ],
5673///  "properties": {
5674///    "content_block": {
5675///      "description": "Present in `content_block_start` events. Contains the content\nblock.\n",
5676///      "$ref": "#/definitions/MessagesResponseContentBlock"
5677///    },
5678///    "delta": {
5679///      "description": "Present in `content_block_delta` and `message_delta` events.\nContains the incremental update.\n",
5680///      "type": "object",
5681///      "properties": {
5682///        "partial_json": {
5683///          "description": "The incremental JSON string of the tool input\n(for `input_json_delta`).\n",
5684///          "type": "string"
5685///        },
5686///        "signature": {
5687///          "description": "The thinking signature (for `signature_delta`).",
5688///          "type": "string"
5689///        },
5690///        "stop_reason": {
5691///          "description": "The stop reason (for `message_delta`).",
5692///          "type": "string"
5693///        },
5694///        "stop_sequence": {
5695///          "description": "The stop sequence (for `message_delta`).",
5696///          "type": "string",
5697///          "nullable": true
5698///        },
5699///        "text": {
5700///          "description": "The incremental text (for `text_delta`).",
5701///          "type": "string"
5702///        },
5703///        "thinking": {
5704///          "description": "The incremental thinking content (for `thinking_delta`).",
5705///          "type": "string"
5706///        },
5707///        "type": {
5708///          "description": "The type of delta. For text deltas this is `text_delta`,\nfor streamed tool inputs this is `input_json_delta`, for\nthinking deltas this is `thinking_delta`, for thinking\nsignatures this is `signature_delta`.\n",
5709///          "type": "string"
5710///        }
5711///      }
5712///    },
5713///    "error": {
5714///      "description": "Present in `error` events. Contains the error details.\n",
5715///      "$ref": "#/definitions/MessagesError"
5716///    },
5717///    "index": {
5718///      "description": "Present in `content_block_*` events. The index of the content\nblock.\n",
5719///      "type": "integer"
5720///    },
5721///    "message": {
5722///      "description": "Present in `message_start` events. Contains the initial message.\n",
5723///      "$ref": "#/definitions/MessagesResponse"
5724///    },
5725///    "type": {
5726///      "description": "The type of the streamed event.",
5727///      "type": "string",
5728///      "enum": [
5729///        "message_start",
5730///        "content_block_start",
5731///        "content_block_delta",
5732///        "content_block_stop",
5733///        "message_delta",
5734///        "message_stop",
5735///        "ping",
5736///        "error"
5737///      ]
5738///    },
5739///    "usage": {
5740///      "description": "Present in `message_delta` events as a sibling of `delta`.\nContains cumulative usage for the message.\n",
5741///      "$ref": "#/definitions/MessagesUsage"
5742///    }
5743///  }
5744///}
5745/// ```
5746/// </details>
5747#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
5748pub struct MessagesStreamEvent {
5749    /**Present in `content_block_start` events. Contains the content
5750    block.
5751    */
5752    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
5753    pub content_block: ::std::option::Option<MessagesResponseContentBlock>,
5754    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
5755    pub delta: ::std::option::Option<MessagesStreamEventDelta>,
5756    /**Present in `error` events. Contains the error details.
5757     */
5758    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
5759    pub error: ::std::option::Option<MessagesError>,
5760    /**Present in `content_block_*` events. The index of the content
5761    block.
5762    */
5763    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
5764    pub index: ::std::option::Option<i64>,
5765    /**Present in `message_start` events. Contains the initial message.
5766     */
5767    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
5768    pub message: ::std::option::Option<MessagesResponse>,
5769    ///The type of the streamed event.
5770    #[serde(rename = "type")]
5771    pub type_: MessagesStreamEventType,
5772    /**Present in `message_delta` events as a sibling of `delta`.
5773    Contains cumulative usage for the message.
5774    */
5775    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
5776    pub usage: ::std::option::Option<MessagesUsage>,
5777}
5778/**Present in `content_block_delta` and `message_delta` events.
5779Contains the incremental update.
5780*/
5781///
5782/// <details><summary>JSON schema</summary>
5783///
5784/// ```json
5785///{
5786///  "description": "Present in `content_block_delta` and `message_delta` events.\nContains the incremental update.\n",
5787///  "type": "object",
5788///  "properties": {
5789///    "partial_json": {
5790///      "description": "The incremental JSON string of the tool input\n(for `input_json_delta`).\n",
5791///      "type": "string"
5792///    },
5793///    "signature": {
5794///      "description": "The thinking signature (for `signature_delta`).",
5795///      "type": "string"
5796///    },
5797///    "stop_reason": {
5798///      "description": "The stop reason (for `message_delta`).",
5799///      "type": "string"
5800///    },
5801///    "stop_sequence": {
5802///      "description": "The stop sequence (for `message_delta`).",
5803///      "type": "string",
5804///      "nullable": true
5805///    },
5806///    "text": {
5807///      "description": "The incremental text (for `text_delta`).",
5808///      "type": "string"
5809///    },
5810///    "thinking": {
5811///      "description": "The incremental thinking content (for `thinking_delta`).",
5812///      "type": "string"
5813///    },
5814///    "type": {
5815///      "description": "The type of delta. For text deltas this is `text_delta`,\nfor streamed tool inputs this is `input_json_delta`, for\nthinking deltas this is `thinking_delta`, for thinking\nsignatures this is `signature_delta`.\n",
5816///      "type": "string"
5817///    }
5818///  }
5819///}
5820/// ```
5821/// </details>
5822#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
5823pub struct MessagesStreamEventDelta {
5824    /**The incremental JSON string of the tool input
5825    (for `input_json_delta`).
5826    */
5827    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
5828    pub partial_json: ::std::option::Option<::std::string::String>,
5829    ///The thinking signature (for `signature_delta`).
5830    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
5831    pub signature: ::std::option::Option<::std::string::String>,
5832    ///The stop reason (for `message_delta`).
5833    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
5834    pub stop_reason: ::std::option::Option<::std::string::String>,
5835    ///The stop sequence (for `message_delta`).
5836    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
5837    pub stop_sequence: ::std::option::Option<::std::string::String>,
5838    ///The incremental text (for `text_delta`).
5839    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
5840    pub text: ::std::option::Option<::std::string::String>,
5841    ///The incremental thinking content (for `thinking_delta`).
5842    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
5843    pub thinking: ::std::option::Option<::std::string::String>,
5844    /**The type of delta. For text deltas this is `text_delta`,
5845    for streamed tool inputs this is `input_json_delta`, for
5846    thinking deltas this is `thinking_delta`, for thinking
5847    signatures this is `signature_delta`.
5848    */
5849    #[serde(
5850        rename = "type",
5851        default,
5852        skip_serializing_if = "::std::option::Option::is_none"
5853    )]
5854    pub type_: ::std::option::Option<::std::string::String>,
5855}
5856impl ::std::default::Default for MessagesStreamEventDelta {
5857    fn default() -> Self {
5858        Self {
5859            partial_json: Default::default(),
5860            signature: Default::default(),
5861            stop_reason: Default::default(),
5862            stop_sequence: Default::default(),
5863            text: Default::default(),
5864            thinking: Default::default(),
5865            type_: Default::default(),
5866        }
5867    }
5868}
5869///The type of the streamed event.
5870///
5871/// <details><summary>JSON schema</summary>
5872///
5873/// ```json
5874///{
5875///  "description": "The type of the streamed event.",
5876///  "type": "string",
5877///  "enum": [
5878///    "message_start",
5879///    "content_block_start",
5880///    "content_block_delta",
5881///    "content_block_stop",
5882///    "message_delta",
5883///    "message_stop",
5884///    "ping",
5885///    "error"
5886///  ]
5887///}
5888/// ```
5889/// </details>
5890#[derive(
5891    ::serde::Deserialize,
5892    ::serde::Serialize,
5893    Clone,
5894    Copy,
5895    Debug,
5896    Eq,
5897    Hash,
5898    Ord,
5899    PartialEq,
5900    PartialOrd,
5901)]
5902pub enum MessagesStreamEventType {
5903    #[serde(rename = "message_start")]
5904    MessageStart,
5905    #[serde(rename = "content_block_start")]
5906    ContentBlockStart,
5907    #[serde(rename = "content_block_delta")]
5908    ContentBlockDelta,
5909    #[serde(rename = "content_block_stop")]
5910    ContentBlockStop,
5911    #[serde(rename = "message_delta")]
5912    MessageDelta,
5913    #[serde(rename = "message_stop")]
5914    MessageStop,
5915    #[serde(rename = "ping")]
5916    Ping,
5917    #[serde(rename = "error")]
5918    Error,
5919}
5920impl ::std::fmt::Display for MessagesStreamEventType {
5921    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
5922        match *self {
5923            Self::MessageStart => f.write_str("message_start"),
5924            Self::ContentBlockStart => f.write_str("content_block_start"),
5925            Self::ContentBlockDelta => f.write_str("content_block_delta"),
5926            Self::ContentBlockStop => f.write_str("content_block_stop"),
5927            Self::MessageDelta => f.write_str("message_delta"),
5928            Self::MessageStop => f.write_str("message_stop"),
5929            Self::Ping => f.write_str("ping"),
5930            Self::Error => f.write_str("error"),
5931        }
5932    }
5933}
5934impl ::std::str::FromStr for MessagesStreamEventType {
5935    type Err = self::error::ConversionError;
5936    fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
5937        match value {
5938            "message_start" => Ok(Self::MessageStart),
5939            "content_block_start" => Ok(Self::ContentBlockStart),
5940            "content_block_delta" => Ok(Self::ContentBlockDelta),
5941            "content_block_stop" => Ok(Self::ContentBlockStop),
5942            "message_delta" => Ok(Self::MessageDelta),
5943            "message_stop" => Ok(Self::MessageStop),
5944            "ping" => Ok(Self::Ping),
5945            "error" => Ok(Self::Error),
5946            _ => Err("invalid value".into()),
5947        }
5948    }
5949}
5950impl ::std::convert::TryFrom<&str> for MessagesStreamEventType {
5951    type Error = self::error::ConversionError;
5952    fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
5953        value.parse()
5954    }
5955}
5956impl ::std::convert::TryFrom<&::std::string::String> for MessagesStreamEventType {
5957    type Error = self::error::ConversionError;
5958    fn try_from(
5959        value: &::std::string::String,
5960    ) -> ::std::result::Result<Self, self::error::ConversionError> {
5961        value.parse()
5962    }
5963}
5964impl ::std::convert::TryFrom<::std::string::String> for MessagesStreamEventType {
5965    type Error = self::error::ConversionError;
5966    fn try_from(
5967        value: ::std::string::String,
5968    ) -> ::std::result::Result<Self, self::error::ConversionError> {
5969        value.parse()
5970    }
5971}
5972///A text content block in a Messages API request or response.
5973///
5974/// <details><summary>JSON schema</summary>
5975///
5976/// ```json
5977///{
5978///  "description": "A text content block in a Messages API request or response.",
5979///  "type": "object",
5980///  "required": [
5981///    "text",
5982///    "type"
5983///  ],
5984///  "properties": {
5985///    "cache_control": {
5986///      "$ref": "#/definitions/CacheControl"
5987///    },
5988///    "text": {
5989///      "description": "The text content.",
5990///      "type": "string"
5991///    },
5992///    "type": {
5993///      "description": "Content type identifier. Always `text`.",
5994///      "type": "string",
5995///      "enum": [
5996///        "text"
5997///      ]
5998///    }
5999///  }
6000///}
6001/// ```
6002/// </details>
6003#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
6004pub struct MessagesTextBlock {
6005    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
6006    pub cache_control: ::std::option::Option<CacheControl>,
6007    ///The text content.
6008    pub text: ::std::string::String,
6009    ///Content type identifier. Always `text`.
6010    #[serde(rename = "type")]
6011    pub type_: MessagesTextBlockType,
6012}
6013///Content type identifier. Always `text`.
6014///
6015/// <details><summary>JSON schema</summary>
6016///
6017/// ```json
6018///{
6019///  "description": "Content type identifier. Always `text`.",
6020///  "type": "string",
6021///  "enum": [
6022///    "text"
6023///  ]
6024///}
6025/// ```
6026/// </details>
6027#[derive(
6028    ::serde::Deserialize,
6029    ::serde::Serialize,
6030    Clone,
6031    Copy,
6032    Debug,
6033    Eq,
6034    Hash,
6035    Ord,
6036    PartialEq,
6037    PartialOrd,
6038)]
6039pub enum MessagesTextBlockType {
6040    #[serde(rename = "text")]
6041    Text,
6042}
6043impl ::std::fmt::Display for MessagesTextBlockType {
6044    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
6045        match *self {
6046            Self::Text => f.write_str("text"),
6047        }
6048    }
6049}
6050impl ::std::str::FromStr for MessagesTextBlockType {
6051    type Err = self::error::ConversionError;
6052    fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
6053        match value {
6054            "text" => Ok(Self::Text),
6055            _ => Err("invalid value".into()),
6056        }
6057    }
6058}
6059impl ::std::convert::TryFrom<&str> for MessagesTextBlockType {
6060    type Error = self::error::ConversionError;
6061    fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
6062        value.parse()
6063    }
6064}
6065impl ::std::convert::TryFrom<&::std::string::String> for MessagesTextBlockType {
6066    type Error = self::error::ConversionError;
6067    fn try_from(
6068        value: &::std::string::String,
6069    ) -> ::std::result::Result<Self, self::error::ConversionError> {
6070        value.parse()
6071    }
6072}
6073impl ::std::convert::TryFrom<::std::string::String> for MessagesTextBlockType {
6074    type Error = self::error::ConversionError;
6075    fn try_from(
6076        value: ::std::string::String,
6077    ) -> ::std::result::Result<Self, self::error::ConversionError> {
6078        value.parse()
6079    }
6080}
6081///A thinking content block in a Messages API request or response.
6082///
6083/// <details><summary>JSON schema</summary>
6084///
6085/// ```json
6086///{
6087///  "description": "A thinking content block in a Messages API request or response.",
6088///  "type": "object",
6089///  "required": [
6090///    "signature",
6091///    "thinking",
6092///    "type"
6093///  ],
6094///  "properties": {
6095///    "signature": {
6096///      "description": "The signature for verifying the thinking content. Must be\npassed back when continuing a conversation with extended thinking.\n",
6097///      "type": "string"
6098///    },
6099///    "thinking": {
6100///      "description": "The thinking content.",
6101///      "type": "string"
6102///    },
6103///    "type": {
6104///      "description": "Content type identifier. Always `thinking`.",
6105///      "type": "string",
6106///      "enum": [
6107///        "thinking"
6108///      ]
6109///    }
6110///  }
6111///}
6112/// ```
6113/// </details>
6114#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
6115pub struct MessagesThinkingBlock {
6116    /**The signature for verifying the thinking content. Must be
6117    passed back when continuing a conversation with extended thinking.
6118    */
6119    pub signature: ::std::string::String,
6120    ///The thinking content.
6121    pub thinking: ::std::string::String,
6122    ///Content type identifier. Always `thinking`.
6123    #[serde(rename = "type")]
6124    pub type_: MessagesThinkingBlockType,
6125}
6126///Content type identifier. Always `thinking`.
6127///
6128/// <details><summary>JSON schema</summary>
6129///
6130/// ```json
6131///{
6132///  "description": "Content type identifier. Always `thinking`.",
6133///  "type": "string",
6134///  "enum": [
6135///    "thinking"
6136///  ]
6137///}
6138/// ```
6139/// </details>
6140#[derive(
6141    ::serde::Deserialize,
6142    ::serde::Serialize,
6143    Clone,
6144    Copy,
6145    Debug,
6146    Eq,
6147    Hash,
6148    Ord,
6149    PartialEq,
6150    PartialOrd,
6151)]
6152pub enum MessagesThinkingBlockType {
6153    #[serde(rename = "thinking")]
6154    Thinking,
6155}
6156impl ::std::fmt::Display for MessagesThinkingBlockType {
6157    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
6158        match *self {
6159            Self::Thinking => f.write_str("thinking"),
6160        }
6161    }
6162}
6163impl ::std::str::FromStr for MessagesThinkingBlockType {
6164    type Err = self::error::ConversionError;
6165    fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
6166        match value {
6167            "thinking" => Ok(Self::Thinking),
6168            _ => Err("invalid value".into()),
6169        }
6170    }
6171}
6172impl ::std::convert::TryFrom<&str> for MessagesThinkingBlockType {
6173    type Error = self::error::ConversionError;
6174    fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
6175        value.parse()
6176    }
6177}
6178impl ::std::convert::TryFrom<&::std::string::String> for MessagesThinkingBlockType {
6179    type Error = self::error::ConversionError;
6180    fn try_from(
6181        value: &::std::string::String,
6182    ) -> ::std::result::Result<Self, self::error::ConversionError> {
6183        value.parse()
6184    }
6185}
6186impl ::std::convert::TryFrom<::std::string::String> for MessagesThinkingBlockType {
6187    type Error = self::error::ConversionError;
6188    fn try_from(
6189        value: ::std::string::String,
6190    ) -> ::std::result::Result<Self, self::error::ConversionError> {
6191        value.parse()
6192    }
6193}
6194/**A tool definition in the Messages API format. Uses the same
6195function tool shape as the Responses API but with an optional
6196`cache_control` field for prompt caching.
6197*/
6198///
6199/// <details><summary>JSON schema</summary>
6200///
6201/// ```json
6202///{
6203///  "description": "A tool definition in the Messages API format. Uses the same\nfunction tool shape as the Responses API but with an optional\n`cache_control` field for prompt caching.\n",
6204///  "type": "object",
6205///  "required": [
6206///    "input_schema",
6207///    "name"
6208///  ],
6209///  "properties": {
6210///    "cache_control": {
6211///      "$ref": "#/definitions/CacheControl"
6212///    },
6213///    "description": {
6214///      "description": "A description of what the tool does.",
6215///      "type": "string"
6216///    },
6217///    "input_schema": {
6218///      "$ref": "#/definitions/FunctionParameters"
6219///    },
6220///    "name": {
6221///      "description": "The name of the tool.",
6222///      "type": "string"
6223///    }
6224///  }
6225///}
6226/// ```
6227/// </details>
6228#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
6229pub struct MessagesTool {
6230    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
6231    pub cache_control: ::std::option::Option<CacheControl>,
6232    ///A description of what the tool does.
6233    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
6234    pub description: ::std::option::Option<::std::string::String>,
6235    pub input_schema: FunctionParameters,
6236    ///The name of the tool.
6237    pub name: ::std::string::String,
6238}
6239/**Controls which (if any) tool is called by the model. `auto` means
6240the model can decide, `any` means the model must use a tool, and
6241`tool` forces a specific tool.
6242*/
6243///
6244/// <details><summary>JSON schema</summary>
6245///
6246/// ```json
6247///{
6248///  "description": "Controls which (if any) tool is called by the model. `auto` means\nthe model can decide, `any` means the model must use a tool, and\n`tool` forces a specific tool.\n",
6249///  "oneOf": [
6250///    {
6251///      "description": "The tool choice mode.",
6252///      "type": "string",
6253///      "enum": [
6254///        "auto",
6255///        "any"
6256///      ]
6257///    },
6258///    {
6259///      "description": "Forces the model to use a specific tool.",
6260///      "type": "object",
6261///      "required": [
6262///        "name",
6263///        "type"
6264///      ],
6265///      "properties": {
6266///        "name": {
6267///          "description": "The name of the tool to use.",
6268///          "type": "string"
6269///        },
6270///        "type": {
6271///          "description": "Always `tool`.",
6272///          "type": "string",
6273///          "enum": [
6274///            "tool"
6275///          ]
6276///        }
6277///      }
6278///    }
6279///  ]
6280///}
6281/// ```
6282/// </details>
6283#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
6284#[serde(untagged)]
6285pub enum MessagesToolChoice {
6286    String(MessagesToolChoiceString),
6287    Object {
6288        ///The name of the tool to use.
6289        name: ::std::string::String,
6290        ///Always `tool`.
6291        #[serde(rename = "type")]
6292        type_: MessagesToolChoiceObjectType,
6293    },
6294}
6295impl ::std::convert::From<MessagesToolChoiceString> for MessagesToolChoice {
6296    fn from(value: MessagesToolChoiceString) -> Self {
6297        Self::String(value)
6298    }
6299}
6300///Always `tool`.
6301///
6302/// <details><summary>JSON schema</summary>
6303///
6304/// ```json
6305///{
6306///  "description": "Always `tool`.",
6307///  "type": "string",
6308///  "enum": [
6309///    "tool"
6310///  ]
6311///}
6312/// ```
6313/// </details>
6314#[derive(
6315    ::serde::Deserialize,
6316    ::serde::Serialize,
6317    Clone,
6318    Copy,
6319    Debug,
6320    Eq,
6321    Hash,
6322    Ord,
6323    PartialEq,
6324    PartialOrd,
6325)]
6326pub enum MessagesToolChoiceObjectType {
6327    #[serde(rename = "tool")]
6328    Tool,
6329}
6330impl ::std::fmt::Display for MessagesToolChoiceObjectType {
6331    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
6332        match *self {
6333            Self::Tool => f.write_str("tool"),
6334        }
6335    }
6336}
6337impl ::std::str::FromStr for MessagesToolChoiceObjectType {
6338    type Err = self::error::ConversionError;
6339    fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
6340        match value {
6341            "tool" => Ok(Self::Tool),
6342            _ => Err("invalid value".into()),
6343        }
6344    }
6345}
6346impl ::std::convert::TryFrom<&str> for MessagesToolChoiceObjectType {
6347    type Error = self::error::ConversionError;
6348    fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
6349        value.parse()
6350    }
6351}
6352impl ::std::convert::TryFrom<&::std::string::String> for MessagesToolChoiceObjectType {
6353    type Error = self::error::ConversionError;
6354    fn try_from(
6355        value: &::std::string::String,
6356    ) -> ::std::result::Result<Self, self::error::ConversionError> {
6357        value.parse()
6358    }
6359}
6360impl ::std::convert::TryFrom<::std::string::String> for MessagesToolChoiceObjectType {
6361    type Error = self::error::ConversionError;
6362    fn try_from(
6363        value: ::std::string::String,
6364    ) -> ::std::result::Result<Self, self::error::ConversionError> {
6365        value.parse()
6366    }
6367}
6368///The tool choice mode.
6369///
6370/// <details><summary>JSON schema</summary>
6371///
6372/// ```json
6373///{
6374///  "description": "The tool choice mode.",
6375///  "type": "string",
6376///  "enum": [
6377///    "auto",
6378///    "any"
6379///  ]
6380///}
6381/// ```
6382/// </details>
6383#[derive(
6384    ::serde::Deserialize,
6385    ::serde::Serialize,
6386    Clone,
6387    Copy,
6388    Debug,
6389    Eq,
6390    Hash,
6391    Ord,
6392    PartialEq,
6393    PartialOrd,
6394)]
6395pub enum MessagesToolChoiceString {
6396    #[serde(rename = "auto")]
6397    Auto,
6398    #[serde(rename = "any")]
6399    Any,
6400}
6401impl ::std::fmt::Display for MessagesToolChoiceString {
6402    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
6403        match *self {
6404            Self::Auto => f.write_str("auto"),
6405            Self::Any => f.write_str("any"),
6406        }
6407    }
6408}
6409impl ::std::str::FromStr for MessagesToolChoiceString {
6410    type Err = self::error::ConversionError;
6411    fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
6412        match value {
6413            "auto" => Ok(Self::Auto),
6414            "any" => Ok(Self::Any),
6415            _ => Err("invalid value".into()),
6416        }
6417    }
6418}
6419impl ::std::convert::TryFrom<&str> for MessagesToolChoiceString {
6420    type Error = self::error::ConversionError;
6421    fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
6422        value.parse()
6423    }
6424}
6425impl ::std::convert::TryFrom<&::std::string::String> for MessagesToolChoiceString {
6426    type Error = self::error::ConversionError;
6427    fn try_from(
6428        value: &::std::string::String,
6429    ) -> ::std::result::Result<Self, self::error::ConversionError> {
6430        value.parse()
6431    }
6432}
6433impl ::std::convert::TryFrom<::std::string::String> for MessagesToolChoiceString {
6434    type Error = self::error::ConversionError;
6435    fn try_from(
6436        value: ::std::string::String,
6437    ) -> ::std::result::Result<Self, self::error::ConversionError> {
6438        value.parse()
6439    }
6440}
6441///A tool result content block in a Messages API request.
6442///
6443/// <details><summary>JSON schema</summary>
6444///
6445/// ```json
6446///{
6447///  "description": "A tool result content block in a Messages API request.",
6448///  "type": "object",
6449///  "required": [
6450///    "tool_use_id",
6451///    "type"
6452///  ],
6453///  "properties": {
6454///    "cache_control": {
6455///      "$ref": "#/definitions/CacheControl"
6456///    },
6457///    "content": {
6458///      "description": "The result content. Can be a string or an array of content blocks.\n",
6459///      "oneOf": [
6460///        {
6461///          "description": "Text result content.",
6462///          "type": "string"
6463///        },
6464///        {
6465///          "type": "array",
6466///          "items": {
6467///            "$ref": "#/definitions/MessagesTextBlock"
6468///          }
6469///        }
6470///      ]
6471///    },
6472///    "is_error": {
6473///      "description": "Whether the tool execution resulted in an error.",
6474///      "type": "boolean"
6475///    },
6476///    "tool_use_id": {
6477///      "description": "The ID of the tool use this result is for.",
6478///      "type": "string"
6479///    },
6480///    "type": {
6481///      "description": "Content type identifier. Always `tool_result`.",
6482///      "type": "string",
6483///      "enum": [
6484///        "tool_result"
6485///      ]
6486///    }
6487///  }
6488///}
6489/// ```
6490/// </details>
6491#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
6492pub struct MessagesToolResultBlock {
6493    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
6494    pub cache_control: ::std::option::Option<CacheControl>,
6495    /**The result content. Can be a string or an array of content blocks.
6496     */
6497    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
6498    pub content: ::std::option::Option<MessagesToolResultBlockContent>,
6499    ///Whether the tool execution resulted in an error.
6500    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
6501    pub is_error: ::std::option::Option<bool>,
6502    ///The ID of the tool use this result is for.
6503    pub tool_use_id: ::std::string::String,
6504    ///Content type identifier. Always `tool_result`.
6505    #[serde(rename = "type")]
6506    pub type_: MessagesToolResultBlockType,
6507}
6508/**The result content. Can be a string or an array of content blocks.
6509*/
6510///
6511/// <details><summary>JSON schema</summary>
6512///
6513/// ```json
6514///{
6515///  "description": "The result content. Can be a string or an array of content blocks.\n",
6516///  "oneOf": [
6517///    {
6518///      "description": "Text result content.",
6519///      "type": "string"
6520///    },
6521///    {
6522///      "type": "array",
6523///      "items": {
6524///        "$ref": "#/definitions/MessagesTextBlock"
6525///      }
6526///    }
6527///  ]
6528///}
6529/// ```
6530/// </details>
6531#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
6532#[serde(untagged)]
6533pub enum MessagesToolResultBlockContent {
6534    String(::std::string::String),
6535    Array(::std::vec::Vec<MessagesTextBlock>),
6536}
6537impl ::std::convert::From<::std::vec::Vec<MessagesTextBlock>> for MessagesToolResultBlockContent {
6538    fn from(value: ::std::vec::Vec<MessagesTextBlock>) -> Self {
6539        Self::Array(value)
6540    }
6541}
6542///Content type identifier. Always `tool_result`.
6543///
6544/// <details><summary>JSON schema</summary>
6545///
6546/// ```json
6547///{
6548///  "description": "Content type identifier. Always `tool_result`.",
6549///  "type": "string",
6550///  "enum": [
6551///    "tool_result"
6552///  ]
6553///}
6554/// ```
6555/// </details>
6556#[derive(
6557    ::serde::Deserialize,
6558    ::serde::Serialize,
6559    Clone,
6560    Copy,
6561    Debug,
6562    Eq,
6563    Hash,
6564    Ord,
6565    PartialEq,
6566    PartialOrd,
6567)]
6568pub enum MessagesToolResultBlockType {
6569    #[serde(rename = "tool_result")]
6570    ToolResult,
6571}
6572impl ::std::fmt::Display for MessagesToolResultBlockType {
6573    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
6574        match *self {
6575            Self::ToolResult => f.write_str("tool_result"),
6576        }
6577    }
6578}
6579impl ::std::str::FromStr for MessagesToolResultBlockType {
6580    type Err = self::error::ConversionError;
6581    fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
6582        match value {
6583            "tool_result" => Ok(Self::ToolResult),
6584            _ => Err("invalid value".into()),
6585        }
6586    }
6587}
6588impl ::std::convert::TryFrom<&str> for MessagesToolResultBlockType {
6589    type Error = self::error::ConversionError;
6590    fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
6591        value.parse()
6592    }
6593}
6594impl ::std::convert::TryFrom<&::std::string::String> for MessagesToolResultBlockType {
6595    type Error = self::error::ConversionError;
6596    fn try_from(
6597        value: &::std::string::String,
6598    ) -> ::std::result::Result<Self, self::error::ConversionError> {
6599        value.parse()
6600    }
6601}
6602impl ::std::convert::TryFrom<::std::string::String> for MessagesToolResultBlockType {
6603    type Error = self::error::ConversionError;
6604    fn try_from(
6605        value: ::std::string::String,
6606    ) -> ::std::result::Result<Self, self::error::ConversionError> {
6607        value.parse()
6608    }
6609}
6610///A tool use content block in a Messages API request or response.
6611///
6612/// <details><summary>JSON schema</summary>
6613///
6614/// ```json
6615///{
6616///  "description": "A tool use content block in a Messages API request or response.",
6617///  "type": "object",
6618///  "required": [
6619///    "id",
6620///    "input",
6621///    "name",
6622///    "type"
6623///  ],
6624///  "properties": {
6625///    "id": {
6626///      "description": "The unique identifier for this tool use block.",
6627///      "type": "string"
6628///    },
6629///    "input": {
6630///      "description": "The input parameters for the tool.",
6631///      "type": "object",
6632///      "additionalProperties": true
6633///    },
6634///    "name": {
6635///      "description": "The name of the tool being called.",
6636///      "type": "string"
6637///    },
6638///    "type": {
6639///      "description": "Content type identifier. Always `tool_use`.",
6640///      "type": "string",
6641///      "enum": [
6642///        "tool_use"
6643///      ]
6644///    }
6645///  }
6646///}
6647/// ```
6648/// </details>
6649#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
6650pub struct MessagesToolUseBlock {
6651    ///The unique identifier for this tool use block.
6652    pub id: ::std::string::String,
6653    ///The input parameters for the tool.
6654    pub input: ::serde_json::Map<::std::string::String, ::serde_json::Value>,
6655    ///The name of the tool being called.
6656    pub name: ::std::string::String,
6657    ///Content type identifier. Always `tool_use`.
6658    #[serde(rename = "type")]
6659    pub type_: MessagesToolUseBlockType,
6660}
6661///Content type identifier. Always `tool_use`.
6662///
6663/// <details><summary>JSON schema</summary>
6664///
6665/// ```json
6666///{
6667///  "description": "Content type identifier. Always `tool_use`.",
6668///  "type": "string",
6669///  "enum": [
6670///    "tool_use"
6671///  ]
6672///}
6673/// ```
6674/// </details>
6675#[derive(
6676    ::serde::Deserialize,
6677    ::serde::Serialize,
6678    Clone,
6679    Copy,
6680    Debug,
6681    Eq,
6682    Hash,
6683    Ord,
6684    PartialEq,
6685    PartialOrd,
6686)]
6687pub enum MessagesToolUseBlockType {
6688    #[serde(rename = "tool_use")]
6689    ToolUse,
6690}
6691impl ::std::fmt::Display for MessagesToolUseBlockType {
6692    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
6693        match *self {
6694            Self::ToolUse => f.write_str("tool_use"),
6695        }
6696    }
6697}
6698impl ::std::str::FromStr for MessagesToolUseBlockType {
6699    type Err = self::error::ConversionError;
6700    fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
6701        match value {
6702            "tool_use" => Ok(Self::ToolUse),
6703            _ => Err("invalid value".into()),
6704        }
6705    }
6706}
6707impl ::std::convert::TryFrom<&str> for MessagesToolUseBlockType {
6708    type Error = self::error::ConversionError;
6709    fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
6710        value.parse()
6711    }
6712}
6713impl ::std::convert::TryFrom<&::std::string::String> for MessagesToolUseBlockType {
6714    type Error = self::error::ConversionError;
6715    fn try_from(
6716        value: &::std::string::String,
6717    ) -> ::std::result::Result<Self, self::error::ConversionError> {
6718        value.parse()
6719    }
6720}
6721impl ::std::convert::TryFrom<::std::string::String> for MessagesToolUseBlockType {
6722    type Error = self::error::ConversionError;
6723    fn try_from(
6724        value: ::std::string::String,
6725    ) -> ::std::result::Result<Self, self::error::ConversionError> {
6726        value.parse()
6727    }
6728}
6729/**Token usage statistics for a Messages API response, including
6730cache metrics.
6731*/
6732///
6733/// <details><summary>JSON schema</summary>
6734///
6735/// ```json
6736///{
6737///  "description": "Token usage statistics for a Messages API response, including\ncache metrics.\n",
6738///  "type": "object",
6739///  "required": [
6740///    "input_tokens",
6741///    "output_tokens"
6742///  ],
6743///  "properties": {
6744///    "cache_creation_input_tokens": {
6745///      "description": "The number of tokens used for cache creation.\n",
6746///      "default": 0,
6747///      "type": "integer",
6748///      "format": "int64"
6749///    },
6750///    "cache_read_input_tokens": {
6751///      "description": "The number of tokens read from the cache.\n",
6752///      "default": 0,
6753///      "type": "integer",
6754///      "format": "int64"
6755///    },
6756///    "input_tokens": {
6757///      "description": "The number of input tokens.",
6758///      "default": 0,
6759///      "type": "integer",
6760///      "format": "int64"
6761///    },
6762///    "output_tokens": {
6763///      "description": "The number of output tokens.",
6764///      "default": 0,
6765///      "type": "integer",
6766///      "format": "int64"
6767///    }
6768///  }
6769///}
6770/// ```
6771/// </details>
6772#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
6773pub struct MessagesUsage {
6774    /**The number of tokens used for cache creation.
6775     */
6776    #[serde(default)]
6777    pub cache_creation_input_tokens: i64,
6778    /**The number of tokens read from the cache.
6779     */
6780    #[serde(default)]
6781    pub cache_read_input_tokens: i64,
6782    ///The number of input tokens.
6783    pub input_tokens: i64,
6784    ///The number of output tokens.
6785    pub output_tokens: i64,
6786}
6787///A single input or output modality
6788///
6789/// <details><summary>JSON schema</summary>
6790///
6791/// ```json
6792///{
6793///  "description": "A single input or output modality",
6794///  "type": "string",
6795///  "enum": [
6796///    "text",
6797///    "image",
6798///    "audio",
6799///    "video"
6800///  ]
6801///}
6802/// ```
6803/// </details>
6804#[derive(
6805    ::serde::Deserialize,
6806    ::serde::Serialize,
6807    Clone,
6808    Copy,
6809    Debug,
6810    Eq,
6811    Hash,
6812    Ord,
6813    PartialEq,
6814    PartialOrd,
6815)]
6816pub enum Modality {
6817    #[serde(rename = "text")]
6818    Text,
6819    #[serde(rename = "image")]
6820    Image,
6821    #[serde(rename = "audio")]
6822    Audio,
6823    #[serde(rename = "video")]
6824    Video,
6825}
6826impl ::std::fmt::Display for Modality {
6827    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
6828        match *self {
6829            Self::Text => f.write_str("text"),
6830            Self::Image => f.write_str("image"),
6831            Self::Audio => f.write_str("audio"),
6832            Self::Video => f.write_str("video"),
6833        }
6834    }
6835}
6836impl ::std::str::FromStr for Modality {
6837    type Err = self::error::ConversionError;
6838    fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
6839        match value {
6840            "text" => Ok(Self::Text),
6841            "image" => Ok(Self::Image),
6842            "audio" => Ok(Self::Audio),
6843            "video" => Ok(Self::Video),
6844            _ => Err("invalid value".into()),
6845        }
6846    }
6847}
6848impl ::std::convert::TryFrom<&str> for Modality {
6849    type Error = self::error::ConversionError;
6850    fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
6851        value.parse()
6852    }
6853}
6854impl ::std::convert::TryFrom<&::std::string::String> for Modality {
6855    type Error = self::error::ConversionError;
6856    fn try_from(
6857        value: &::std::string::String,
6858    ) -> ::std::result::Result<Self, self::error::ConversionError> {
6859        value.parse()
6860    }
6861}
6862impl ::std::convert::TryFrom<::std::string::String> for Modality {
6863    type Error = self::error::ConversionError;
6864    fn try_from(
6865        value: ::std::string::String,
6866    ) -> ::std::result::Result<Self, self::error::ConversionError> {
6867        value.parse()
6868    }
6869}
6870///Common model information
6871///
6872/// <details><summary>JSON schema</summary>
6873///
6874/// ```json
6875///{
6876///  "description": "Common model information",
6877///  "type": "object",
6878///  "required": [
6879///    "created",
6880///    "id",
6881///    "object",
6882///    "owned_by",
6883///    "served_by"
6884///  ],
6885///  "properties": {
6886///    "context_window": {
6887///      "description": "Context window information for the model (included when `include=context_window`)",
6888///      "oneOf": [
6889///        {
6890///          "$ref": "#/definitions/ContextWindow"
6891///        },
6892///        {
6893///          "type": "null"
6894///        }
6895///      ]
6896///    },
6897///    "created": {
6898///      "type": "integer",
6899///      "format": "int64"
6900///    },
6901///    "id": {
6902///      "type": "string"
6903///    },
6904///    "modalities": {
6905///      "description": "The input and output modalities of the model (included when `include=modalities`)",
6906///      "oneOf": [
6907///        {
6908///          "$ref": "#/definitions/ModelModalities"
6909///        },
6910///        {
6911///          "type": "null"
6912///        }
6913///      ]
6914///    },
6915///    "object": {
6916///      "type": "string"
6917///    },
6918///    "owned_by": {
6919///      "type": "string"
6920///    },
6921///    "pricing": {
6922///      "description": "Pricing information for the model (included when `include=pricing`)",
6923///      "oneOf": [
6924///        {
6925///          "$ref": "#/definitions/Pricing"
6926///        },
6927///        {
6928///          "type": "null"
6929///        }
6930///      ]
6931///    },
6932///    "served_by": {
6933///      "$ref": "#/definitions/Provider"
6934///    }
6935///  }
6936///}
6937/// ```
6938/// </details>
6939#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
6940pub struct Model {
6941    ///Context window information for the model (included when `include=context_window`)
6942    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
6943    pub context_window: ::std::option::Option<ContextWindow>,
6944    pub created: i64,
6945    pub id: ::std::string::String,
6946    ///The input and output modalities of the model (included when `include=modalities`)
6947    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
6948    pub modalities: ::std::option::Option<ModelModalities>,
6949    pub object: ::std::string::String,
6950    pub owned_by: ::std::string::String,
6951    ///Pricing information for the model (included when `include=pricing`)
6952    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
6953    pub pricing: ::std::option::Option<Pricing>,
6954    pub served_by: Provider,
6955}
6956///The input and output modalities of a model, mirroring the models.dev dataset shape. Vision models accept `image` in `input`; image-generation models list `image` in `output` - when `output` carries `image` but not `text`, the model only generates images and cannot chat.
6957///
6958/// <details><summary>JSON schema</summary>
6959///
6960/// ```json
6961///{
6962///  "description": "The input and output modalities of a model, mirroring the models.dev dataset shape. Vision models accept `image` in `input`; image-generation models list `image` in `output` - when `output` carries `image` but not `text`, the model only generates images and cannot chat.",
6963///  "type": "object",
6964///  "required": [
6965///    "input",
6966///    "output"
6967///  ],
6968///  "properties": {
6969///    "input": {
6970///      "type": "array",
6971///      "items": {
6972///        "$ref": "#/definitions/Modality"
6973///      }
6974///    },
6975///    "output": {
6976///      "type": "array",
6977///      "items": {
6978///        "$ref": "#/definitions/Modality"
6979///      }
6980///    }
6981///  }
6982///}
6983/// ```
6984/// </details>
6985#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
6986pub struct ModelModalities {
6987    pub input: ::std::vec::Vec<Modality>,
6988    pub output: ::std::vec::Vec<Modality>,
6989}
6990///Pricing information for a model
6991///
6992/// <details><summary>JSON schema</summary>
6993///
6994/// ```json
6995///{
6996///  "description": "Pricing information for a model",
6997///  "type": "object",
6998///  "required": [
6999///    "currency",
7000///    "input_per_token",
7001///    "output_per_token",
7002///    "source",
7003///    "updated_at"
7004///  ],
7005///  "properties": {
7006///    "cache_read_per_token": {
7007///      "description": "Price per cached input token read",
7008///      "type": "string"
7009///    },
7010///    "cache_write_per_token": {
7011///      "description": "Price per cached input token write",
7012///      "type": "string"
7013///    },
7014///    "currency": {
7015///      "description": "Currency code for the pricing (e.g. USD)",
7016///      "type": "string"
7017///    },
7018///    "input_per_token": {
7019///      "description": "Price per input token",
7020///      "type": "string"
7021///    },
7022///    "output_per_token": {
7023///      "description": "Price per output token",
7024///      "type": "string"
7025///    },
7026///    "source": {
7027///      "description": "Source of the pricing information",
7028///      "type": "string",
7029///      "enum": [
7030///        "provider",
7031///        "community"
7032///      ]
7033///    },
7034///    "subscription": {
7035///      "description": "Model has no per-token price but is gated behind a paid subscription",
7036///      "default": false,
7037///      "type": "boolean"
7038///    },
7039///    "updated_at": {
7040///      "description": "Timestamp when the pricing was last updated",
7041///      "type": "string",
7042///      "format": "date-time"
7043///    }
7044///  }
7045///}
7046/// ```
7047/// </details>
7048#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
7049pub struct Pricing {
7050    ///Price per cached input token read
7051    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
7052    pub cache_read_per_token: ::std::option::Option<::std::string::String>,
7053    ///Price per cached input token write
7054    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
7055    pub cache_write_per_token: ::std::option::Option<::std::string::String>,
7056    ///Currency code for the pricing (e.g. USD)
7057    pub currency: ::std::string::String,
7058    ///Price per input token
7059    pub input_per_token: ::std::string::String,
7060    ///Price per output token
7061    pub output_per_token: ::std::string::String,
7062    ///Source of the pricing information
7063    pub source: PricingSource,
7064    ///Model has no per-token price but is gated behind a paid subscription
7065    #[serde(default)]
7066    pub subscription: bool,
7067    ///Timestamp when the pricing was last updated
7068    pub updated_at: ::chrono::DateTime<::chrono::offset::Utc>,
7069}
7070///Source of the pricing information
7071///
7072/// <details><summary>JSON schema</summary>
7073///
7074/// ```json
7075///{
7076///  "description": "Source of the pricing information",
7077///  "type": "string",
7078///  "enum": [
7079///    "provider",
7080///    "community"
7081///  ]
7082///}
7083/// ```
7084/// </details>
7085#[derive(
7086    ::serde::Deserialize,
7087    ::serde::Serialize,
7088    Clone,
7089    Copy,
7090    Debug,
7091    Eq,
7092    Hash,
7093    Ord,
7094    PartialEq,
7095    PartialOrd,
7096)]
7097pub enum PricingSource {
7098    #[serde(rename = "provider")]
7099    Provider,
7100    #[serde(rename = "community")]
7101    Community,
7102}
7103impl ::std::fmt::Display for PricingSource {
7104    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
7105        match *self {
7106            Self::Provider => f.write_str("provider"),
7107            Self::Community => f.write_str("community"),
7108        }
7109    }
7110}
7111impl ::std::str::FromStr for PricingSource {
7112    type Err = self::error::ConversionError;
7113    fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
7114        match value {
7115            "provider" => Ok(Self::Provider),
7116            "community" => Ok(Self::Community),
7117            _ => Err("invalid value".into()),
7118        }
7119    }
7120}
7121impl ::std::convert::TryFrom<&str> for PricingSource {
7122    type Error = self::error::ConversionError;
7123    fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
7124        value.parse()
7125    }
7126}
7127impl ::std::convert::TryFrom<&::std::string::String> for PricingSource {
7128    type Error = self::error::ConversionError;
7129    fn try_from(
7130        value: &::std::string::String,
7131    ) -> ::std::result::Result<Self, self::error::ConversionError> {
7132        value.parse()
7133    }
7134}
7135impl ::std::convert::TryFrom<::std::string::String> for PricingSource {
7136    type Error = self::error::ConversionError;
7137    fn try_from(
7138        value: ::std::string::String,
7139    ) -> ::std::result::Result<Self, self::error::ConversionError> {
7140        value.parse()
7141    }
7142}
7143///`Provider`
7144///
7145/// <details><summary>JSON schema</summary>
7146///
7147/// ```json
7148///{
7149///  "type": "string",
7150///  "enum": [
7151///    "ollama",
7152///    "ollama_cloud",
7153///    "groq",
7154///    "llamacpp",
7155///    "openai",
7156///    "cloudflare",
7157///    "cohere",
7158///    "anthropic",
7159///    "deepseek",
7160///    "google",
7161///    "mistral",
7162///    "minimax",
7163///    "moonshot",
7164///    "nvidia",
7165///    "zai"
7166///  ]
7167///}
7168/// ```
7169/// </details>
7170#[derive(
7171    ::serde::Deserialize,
7172    ::serde::Serialize,
7173    Clone,
7174    Copy,
7175    Debug,
7176    Eq,
7177    Hash,
7178    Ord,
7179    PartialEq,
7180    PartialOrd,
7181)]
7182pub enum Provider {
7183    #[serde(rename = "ollama")]
7184    Ollama,
7185    #[serde(rename = "ollama_cloud")]
7186    OllamaCloud,
7187    #[serde(rename = "groq")]
7188    Groq,
7189    #[serde(rename = "llamacpp")]
7190    Llamacpp,
7191    #[serde(rename = "openai")]
7192    Openai,
7193    #[serde(rename = "cloudflare")]
7194    Cloudflare,
7195    #[serde(rename = "cohere")]
7196    Cohere,
7197    #[serde(rename = "anthropic")]
7198    Anthropic,
7199    #[serde(rename = "deepseek")]
7200    Deepseek,
7201    #[serde(rename = "google")]
7202    Google,
7203    #[serde(rename = "mistral")]
7204    Mistral,
7205    #[serde(rename = "minimax")]
7206    Minimax,
7207    #[serde(rename = "moonshot")]
7208    Moonshot,
7209    #[serde(rename = "nvidia")]
7210    Nvidia,
7211    #[serde(rename = "zai")]
7212    Zai,
7213}
7214impl ::std::fmt::Display for Provider {
7215    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
7216        match *self {
7217            Self::Ollama => f.write_str("ollama"),
7218            Self::OllamaCloud => f.write_str("ollama_cloud"),
7219            Self::Groq => f.write_str("groq"),
7220            Self::Llamacpp => f.write_str("llamacpp"),
7221            Self::Openai => f.write_str("openai"),
7222            Self::Cloudflare => f.write_str("cloudflare"),
7223            Self::Cohere => f.write_str("cohere"),
7224            Self::Anthropic => f.write_str("anthropic"),
7225            Self::Deepseek => f.write_str("deepseek"),
7226            Self::Google => f.write_str("google"),
7227            Self::Mistral => f.write_str("mistral"),
7228            Self::Minimax => f.write_str("minimax"),
7229            Self::Moonshot => f.write_str("moonshot"),
7230            Self::Nvidia => f.write_str("nvidia"),
7231            Self::Zai => f.write_str("zai"),
7232        }
7233    }
7234}
7235impl ::std::str::FromStr for Provider {
7236    type Err = self::error::ConversionError;
7237    fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
7238        match value {
7239            "ollama" => Ok(Self::Ollama),
7240            "ollama_cloud" => Ok(Self::OllamaCloud),
7241            "groq" => Ok(Self::Groq),
7242            "llamacpp" => Ok(Self::Llamacpp),
7243            "openai" => Ok(Self::Openai),
7244            "cloudflare" => Ok(Self::Cloudflare),
7245            "cohere" => Ok(Self::Cohere),
7246            "anthropic" => Ok(Self::Anthropic),
7247            "deepseek" => Ok(Self::Deepseek),
7248            "google" => Ok(Self::Google),
7249            "mistral" => Ok(Self::Mistral),
7250            "minimax" => Ok(Self::Minimax),
7251            "moonshot" => Ok(Self::Moonshot),
7252            "nvidia" => Ok(Self::Nvidia),
7253            "zai" => Ok(Self::Zai),
7254            _ => Err("invalid value".into()),
7255        }
7256    }
7257}
7258impl ::std::convert::TryFrom<&str> for Provider {
7259    type Error = self::error::ConversionError;
7260    fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
7261        value.parse()
7262    }
7263}
7264impl ::std::convert::TryFrom<&::std::string::String> for Provider {
7265    type Error = self::error::ConversionError;
7266    fn try_from(
7267        value: &::std::string::String,
7268    ) -> ::std::result::Result<Self, self::error::ConversionError> {
7269        value.parse()
7270    }
7271}
7272impl ::std::convert::TryFrom<::std::string::String> for Provider {
7273    type Error = self::error::ConversionError;
7274    fn try_from(
7275        value: ::std::string::String,
7276    ) -> ::std::result::Result<Self, self::error::ConversionError> {
7277        value.parse()
7278    }
7279}
7280///Authentication type for providers
7281///
7282/// <details><summary>JSON schema</summary>
7283///
7284/// ```json
7285///{
7286///  "description": "Authentication type for providers",
7287///  "type": "string",
7288///  "enum": [
7289///    "bearer",
7290///    "xheader",
7291///    "query",
7292///    "none"
7293///  ]
7294///}
7295/// ```
7296/// </details>
7297#[derive(
7298    ::serde::Deserialize,
7299    ::serde::Serialize,
7300    Clone,
7301    Copy,
7302    Debug,
7303    Eq,
7304    Hash,
7305    Ord,
7306    PartialEq,
7307    PartialOrd,
7308)]
7309pub enum ProviderAuthType {
7310    #[serde(rename = "bearer")]
7311    Bearer,
7312    #[serde(rename = "xheader")]
7313    Xheader,
7314    #[serde(rename = "query")]
7315    Query,
7316    #[serde(rename = "none")]
7317    None,
7318}
7319impl ::std::fmt::Display for ProviderAuthType {
7320    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
7321        match *self {
7322            Self::Bearer => f.write_str("bearer"),
7323            Self::Xheader => f.write_str("xheader"),
7324            Self::Query => f.write_str("query"),
7325            Self::None => f.write_str("none"),
7326        }
7327    }
7328}
7329impl ::std::str::FromStr for ProviderAuthType {
7330    type Err = self::error::ConversionError;
7331    fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
7332        match value {
7333            "bearer" => Ok(Self::Bearer),
7334            "xheader" => Ok(Self::Xheader),
7335            "query" => Ok(Self::Query),
7336            "none" => Ok(Self::None),
7337            _ => Err("invalid value".into()),
7338        }
7339    }
7340}
7341impl ::std::convert::TryFrom<&str> for ProviderAuthType {
7342    type Error = self::error::ConversionError;
7343    fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
7344        value.parse()
7345    }
7346}
7347impl ::std::convert::TryFrom<&::std::string::String> for ProviderAuthType {
7348    type Error = self::error::ConversionError;
7349    fn try_from(
7350        value: &::std::string::String,
7351    ) -> ::std::result::Result<Self, self::error::ConversionError> {
7352        value.parse()
7353    }
7354}
7355impl ::std::convert::TryFrom<::std::string::String> for ProviderAuthType {
7356    type Error = self::error::ConversionError;
7357    fn try_from(
7358        value: ::std::string::String,
7359    ) -> ::std::result::Result<Self, self::error::ConversionError> {
7360        value.parse()
7361    }
7362}
7363/**Provider-specific response format. Examples:
7364
7365OpenAI GET /v1/models?provider=openai response:
7366```json
7367{
7368  "provider": "openai",
7369  "object": "list",
7370  "data": [
7371    {
7372      "id": "gpt-4",
7373      "object": "model",
7374      "created": 1687882410,
7375      "owned_by": "openai",
7376      "served_by": "openai"
7377    }
7378  ]
7379}
7380```
7381
7382Anthropic GET /v1/models?provider=anthropic response:
7383```json
7384{
7385  "provider": "anthropic",
7386  "object": "list",
7387  "data": [
7388    {
7389      "id": "gpt-4",
7390      "object": "model",
7391      "created": 1687882410,
7392      "owned_by": "openai",
7393      "served_by": "openai"
7394    }
7395  ]
7396}
7397```
7398*/
7399///
7400/// <details><summary>JSON schema</summary>
7401///
7402/// ```json
7403///{
7404///  "description": "Provider-specific response format. Examples:\n\nOpenAI GET /v1/models?provider=openai response:\n```json\n{\n  \"provider\": \"openai\",\n  \"object\": \"list\",\n  \"data\": [\n    {\n      \"id\": \"gpt-4\",\n      \"object\": \"model\",\n      \"created\": 1687882410,\n      \"owned_by\": \"openai\",\n      \"served_by\": \"openai\"\n    }\n  ]\n}\n```\n\nAnthropic GET /v1/models?provider=anthropic response:\n```json\n{\n  \"provider\": \"anthropic\",\n  \"object\": \"list\",\n  \"data\": [\n    {\n      \"id\": \"gpt-4\",\n      \"object\": \"model\",\n      \"created\": 1687882410,\n      \"owned_by\": \"openai\",\n      \"served_by\": \"openai\"\n    }\n  ]\n}\n```\n",
7405///  "type": "object"
7406///}
7407/// ```
7408/// </details>
7409#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
7410#[serde(transparent)]
7411pub struct ProviderSpecificResponse(
7412    pub ::serde_json::Map<::std::string::String, ::serde_json::Value>,
7413);
7414impl ::std::ops::Deref for ProviderSpecificResponse {
7415    type Target = ::serde_json::Map<::std::string::String, ::serde_json::Value>;
7416    fn deref(&self) -> &::serde_json::Map<::std::string::String, ::serde_json::Value> {
7417        &self.0
7418    }
7419}
7420impl ::std::convert::From<ProviderSpecificResponse>
7421    for ::serde_json::Map<::std::string::String, ::serde_json::Value>
7422{
7423    fn from(value: ProviderSpecificResponse) -> Self {
7424        value.0
7425    }
7426}
7427impl ::std::convert::From<::serde_json::Map<::std::string::String, ::serde_json::Value>>
7428    for ProviderSpecificResponse
7429{
7430    fn from(value: ::serde_json::Map<::std::string::String, ::serde_json::Value>) -> Self {
7431        Self(value)
7432    }
7433}
7434///Represents a model response returned by the Responses API.
7435///
7436/// <details><summary>JSON schema</summary>
7437///
7438/// ```json
7439///{
7440///  "description": "Represents a model response returned by the Responses API.",
7441///  "type": "object",
7442///  "required": [
7443///    "created_at",
7444///    "id",
7445///    "model",
7446///    "object",
7447///    "output",
7448///    "status"
7449///  ],
7450///  "properties": {
7451///    "created_at": {
7452///      "description": "Unix timestamp (in seconds) of when the response was created.",
7453///      "type": "integer",
7454///      "format": "int64"
7455///    },
7456///    "error": {
7457///      "$ref": "#/definitions/ResponseError"
7458///    },
7459///    "id": {
7460///      "description": "Unique identifier for this response.",
7461///      "type": "string"
7462///    },
7463///    "incomplete_details": {
7464///      "$ref": "#/definitions/ResponseIncompleteDetails"
7465///    },
7466///    "instructions": {
7467///      "description": "The system/developer message used to generate the response.",
7468///      "type": "string",
7469///      "nullable": true
7470///    },
7471///    "max_output_tokens": {
7472///      "description": "An upper bound for the number of generated tokens.",
7473///      "type": "integer",
7474///      "nullable": true
7475///    },
7476///    "metadata": {
7477///      "type": "object",
7478///      "additionalProperties": {
7479///        "type": "string"
7480///      }
7481///    },
7482///    "model": {
7483///      "description": "The model used to generate the response.",
7484///      "type": "string"
7485///    },
7486///    "object": {
7487///      "description": "The object type, which is always `response`.",
7488///      "type": "string"
7489///    },
7490///    "output": {
7491///      "description": "An array of content items generated by the model.",
7492///      "type": "array",
7493///      "items": {
7494///        "$ref": "#/definitions/ResponseOutputItem"
7495///      }
7496///    },
7497///    "previous_response_id": {
7498///      "description": "The unique ID of the previous response, if any.",
7499///      "type": "string",
7500///      "nullable": true
7501///    },
7502///    "reasoning": {
7503///      "$ref": "#/definitions/ResponseReasoning"
7504///    },
7505///    "status": {
7506///      "$ref": "#/definitions/ResponseStatus"
7507///    },
7508///    "temperature": {
7509///      "type": "number",
7510///      "format": "float",
7511///      "nullable": true
7512///    },
7513///    "text": {
7514///      "$ref": "#/definitions/ResponseTextConfig"
7515///    },
7516///    "tool_choice": {
7517///      "$ref": "#/definitions/ResponseToolChoice"
7518///    },
7519///    "tools": {
7520///      "type": "array",
7521///      "items": {
7522///        "$ref": "#/definitions/ResponseTool"
7523///      }
7524///    },
7525///    "top_p": {
7526///      "type": "number",
7527///      "format": "float",
7528///      "nullable": true
7529///    },
7530///    "usage": {
7531///      "$ref": "#/definitions/ResponseUsage"
7532///    }
7533///  }
7534///}
7535/// ```
7536/// </details>
7537#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
7538pub struct Response {
7539    ///Unix timestamp (in seconds) of when the response was created.
7540    pub created_at: i64,
7541    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
7542    pub error: ::std::option::Option<ResponseError>,
7543    ///Unique identifier for this response.
7544    pub id: ::std::string::String,
7545    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
7546    pub incomplete_details: ::std::option::Option<ResponseIncompleteDetails>,
7547    ///The system/developer message used to generate the response.
7548    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
7549    pub instructions: ::std::option::Option<::std::string::String>,
7550    ///An upper bound for the number of generated tokens.
7551    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
7552    pub max_output_tokens: ::std::option::Option<i64>,
7553    #[serde(
7554        default,
7555        skip_serializing_if = ":: std :: collections :: HashMap::is_empty"
7556    )]
7557    pub metadata: ::std::collections::HashMap<::std::string::String, ::std::string::String>,
7558    ///The model used to generate the response.
7559    pub model: ::std::string::String,
7560    ///The object type, which is always `response`.
7561    pub object: ::std::string::String,
7562    ///An array of content items generated by the model.
7563    pub output: ::std::vec::Vec<ResponseOutputItem>,
7564    ///The unique ID of the previous response, if any.
7565    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
7566    pub previous_response_id: ::std::option::Option<::std::string::String>,
7567    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
7568    pub reasoning: ::std::option::Option<ResponseReasoning>,
7569    pub status: ResponseStatus,
7570    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
7571    pub temperature: ::std::option::Option<f32>,
7572    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
7573    pub text: ::std::option::Option<ResponseTextConfig>,
7574    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
7575    pub tool_choice: ::std::option::Option<ResponseToolChoice>,
7576    #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
7577    pub tools: ::std::vec::Vec<ResponseTool>,
7578    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
7579    pub top_p: ::std::option::Option<f32>,
7580    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
7581    pub usage: ::std::option::Option<ResponseUsage>,
7582}
7583///An error object returned when the model fails to generate a response.
7584///
7585/// <details><summary>JSON schema</summary>
7586///
7587/// ```json
7588///{
7589///  "description": "An error object returned when the model fails to generate a response.",
7590///  "type": "object",
7591///  "required": [
7592///    "code",
7593///    "message"
7594///  ],
7595///  "properties": {
7596///    "code": {
7597///      "description": "The error code for the response.",
7598///      "type": "string"
7599///    },
7600///    "message": {
7601///      "description": "A human-readable description of the error.",
7602///      "type": "string"
7603///    }
7604///  },
7605///  "nullable": true
7606///}
7607/// ```
7608/// </details>
7609#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
7610pub struct ResponseError {
7611    ///The error code for the response.
7612    pub code: ::std::string::String,
7613    ///A human-readable description of the error.
7614    pub message: ::std::string::String,
7615}
7616/**JSON object response format. An older method of generating JSON responses. Using `json_schema` is recommended for models that support it. Note that the model will not generate JSON without a system or user message instructing it to do so.
7617*/
7618///
7619/// <details><summary>JSON schema</summary>
7620///
7621/// ```json
7622///{
7623///  "description": "JSON object response format. An older method of generating JSON responses. Using `json_schema` is recommended for models that support it. Note that the model will not generate JSON without a system or user message instructing it to do so.\n",
7624///  "type": "object",
7625///  "required": [
7626///    "type"
7627///  ],
7628///  "properties": {
7629///    "type": {
7630///      "description": "The type of response format being defined. Always `json_object`.",
7631///      "type": "string",
7632///      "enum": [
7633///        "json_object"
7634///      ]
7635///    }
7636///  }
7637///}
7638/// ```
7639/// </details>
7640#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
7641pub struct ResponseFormatJsonObject {
7642    ///The type of response format being defined. Always `json_object`.
7643    #[serde(rename = "type")]
7644    pub type_: ResponseFormatJsonObjectType,
7645}
7646///The type of response format being defined. Always `json_object`.
7647///
7648/// <details><summary>JSON schema</summary>
7649///
7650/// ```json
7651///{
7652///  "description": "The type of response format being defined. Always `json_object`.",
7653///  "type": "string",
7654///  "enum": [
7655///    "json_object"
7656///  ]
7657///}
7658/// ```
7659/// </details>
7660#[derive(
7661    ::serde::Deserialize,
7662    ::serde::Serialize,
7663    Clone,
7664    Copy,
7665    Debug,
7666    Eq,
7667    Hash,
7668    Ord,
7669    PartialEq,
7670    PartialOrd,
7671)]
7672pub enum ResponseFormatJsonObjectType {
7673    #[serde(rename = "json_object")]
7674    JsonObject,
7675}
7676impl ::std::fmt::Display for ResponseFormatJsonObjectType {
7677    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
7678        match *self {
7679            Self::JsonObject => f.write_str("json_object"),
7680        }
7681    }
7682}
7683impl ::std::str::FromStr for ResponseFormatJsonObjectType {
7684    type Err = self::error::ConversionError;
7685    fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
7686        match value {
7687            "json_object" => Ok(Self::JsonObject),
7688            _ => Err("invalid value".into()),
7689        }
7690    }
7691}
7692impl ::std::convert::TryFrom<&str> for ResponseFormatJsonObjectType {
7693    type Error = self::error::ConversionError;
7694    fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
7695        value.parse()
7696    }
7697}
7698impl ::std::convert::TryFrom<&::std::string::String> for ResponseFormatJsonObjectType {
7699    type Error = self::error::ConversionError;
7700    fn try_from(
7701        value: &::std::string::String,
7702    ) -> ::std::result::Result<Self, self::error::ConversionError> {
7703        value.parse()
7704    }
7705}
7706impl ::std::convert::TryFrom<::std::string::String> for ResponseFormatJsonObjectType {
7707    type Error = self::error::ConversionError;
7708    fn try_from(
7709        value: ::std::string::String,
7710    ) -> ::std::result::Result<Self, self::error::ConversionError> {
7711        value.parse()
7712    }
7713}
7714/**JSON Schema response format. Used to generate structured JSON responses.
7715*/
7716///
7717/// <details><summary>JSON schema</summary>
7718///
7719/// ```json
7720///{
7721///  "description": "JSON Schema response format. Used to generate structured JSON responses.\n",
7722///  "type": "object",
7723///  "required": [
7724///    "json_schema",
7725///    "type"
7726///  ],
7727///  "properties": {
7728///    "json_schema": {
7729///      "description": "Structured Outputs configuration options, including a JSON Schema.",
7730///      "type": "object",
7731///      "required": [
7732///        "name"
7733///      ],
7734///      "properties": {
7735///        "description": {
7736///          "description": "A description of what the response format is for, used by the model to determine how to respond in the format.\n",
7737///          "type": "string"
7738///        },
7739///        "name": {
7740///          "description": "The name of the response format. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.\n",
7741///          "type": "string"
7742///        },
7743///        "schema": {
7744///          "$ref": "#/definitions/ResponseFormatJsonSchemaSchema"
7745///        },
7746///        "strict": {
7747///          "description": "Whether to enable strict schema adherence when generating the output. If set to true, the model will always follow the exact schema defined in the `schema` field. Only a subset of JSON Schema is supported when `strict` is `true`.\n",
7748///          "default": false,
7749///          "type": "boolean"
7750///        }
7751///      }
7752///    },
7753///    "type": {
7754///      "description": "The type of response format being defined. Always `json_schema`.",
7755///      "type": "string",
7756///      "enum": [
7757///        "json_schema"
7758///      ]
7759///    }
7760///  }
7761///}
7762/// ```
7763/// </details>
7764#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
7765pub struct ResponseFormatJsonSchema {
7766    pub json_schema: ResponseFormatJsonSchemaJsonSchema,
7767    ///The type of response format being defined. Always `json_schema`.
7768    #[serde(rename = "type")]
7769    pub type_: ResponseFormatJsonSchemaType,
7770}
7771///Structured Outputs configuration options, including a JSON Schema.
7772///
7773/// <details><summary>JSON schema</summary>
7774///
7775/// ```json
7776///{
7777///  "description": "Structured Outputs configuration options, including a JSON Schema.",
7778///  "type": "object",
7779///  "required": [
7780///    "name"
7781///  ],
7782///  "properties": {
7783///    "description": {
7784///      "description": "A description of what the response format is for, used by the model to determine how to respond in the format.\n",
7785///      "type": "string"
7786///    },
7787///    "name": {
7788///      "description": "The name of the response format. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.\n",
7789///      "type": "string"
7790///    },
7791///    "schema": {
7792///      "$ref": "#/definitions/ResponseFormatJsonSchemaSchema"
7793///    },
7794///    "strict": {
7795///      "description": "Whether to enable strict schema adherence when generating the output. If set to true, the model will always follow the exact schema defined in the `schema` field. Only a subset of JSON Schema is supported when `strict` is `true`.\n",
7796///      "default": false,
7797///      "type": "boolean"
7798///    }
7799///  }
7800///}
7801/// ```
7802/// </details>
7803#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
7804pub struct ResponseFormatJsonSchemaJsonSchema {
7805    /**A description of what the response format is for, used by the model to determine how to respond in the format.
7806     */
7807    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
7808    pub description: ::std::option::Option<::std::string::String>,
7809    /**The name of the response format. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.
7810     */
7811    pub name: ::std::string::String,
7812    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
7813    pub schema: ::std::option::Option<ResponseFormatJsonSchemaSchema>,
7814    /**Whether to enable strict schema adherence when generating the output. If set to true, the model will always follow the exact schema defined in the `schema` field. Only a subset of JSON Schema is supported when `strict` is `true`.
7815     */
7816    #[serde(default)]
7817    pub strict: bool,
7818}
7819/**The schema for the response format, described as a JSON Schema object.
7820*/
7821///
7822/// <details><summary>JSON schema</summary>
7823///
7824/// ```json
7825///{
7826///  "description": "The schema for the response format, described as a JSON Schema object.\n",
7827///  "type": "object",
7828///  "additionalProperties": true
7829///}
7830/// ```
7831/// </details>
7832#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
7833#[serde(transparent)]
7834pub struct ResponseFormatJsonSchemaSchema(
7835    pub ::serde_json::Map<::std::string::String, ::serde_json::Value>,
7836);
7837impl ::std::ops::Deref for ResponseFormatJsonSchemaSchema {
7838    type Target = ::serde_json::Map<::std::string::String, ::serde_json::Value>;
7839    fn deref(&self) -> &::serde_json::Map<::std::string::String, ::serde_json::Value> {
7840        &self.0
7841    }
7842}
7843impl ::std::convert::From<ResponseFormatJsonSchemaSchema>
7844    for ::serde_json::Map<::std::string::String, ::serde_json::Value>
7845{
7846    fn from(value: ResponseFormatJsonSchemaSchema) -> Self {
7847        value.0
7848    }
7849}
7850impl ::std::convert::From<::serde_json::Map<::std::string::String, ::serde_json::Value>>
7851    for ResponseFormatJsonSchemaSchema
7852{
7853    fn from(value: ::serde_json::Map<::std::string::String, ::serde_json::Value>) -> Self {
7854        Self(value)
7855    }
7856}
7857///The type of response format being defined. Always `json_schema`.
7858///
7859/// <details><summary>JSON schema</summary>
7860///
7861/// ```json
7862///{
7863///  "description": "The type of response format being defined. Always `json_schema`.",
7864///  "type": "string",
7865///  "enum": [
7866///    "json_schema"
7867///  ]
7868///}
7869/// ```
7870/// </details>
7871#[derive(
7872    ::serde::Deserialize,
7873    ::serde::Serialize,
7874    Clone,
7875    Copy,
7876    Debug,
7877    Eq,
7878    Hash,
7879    Ord,
7880    PartialEq,
7881    PartialOrd,
7882)]
7883pub enum ResponseFormatJsonSchemaType {
7884    #[serde(rename = "json_schema")]
7885    JsonSchema,
7886}
7887impl ::std::fmt::Display for ResponseFormatJsonSchemaType {
7888    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
7889        match *self {
7890            Self::JsonSchema => f.write_str("json_schema"),
7891        }
7892    }
7893}
7894impl ::std::str::FromStr for ResponseFormatJsonSchemaType {
7895    type Err = self::error::ConversionError;
7896    fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
7897        match value {
7898            "json_schema" => Ok(Self::JsonSchema),
7899            _ => Err("invalid value".into()),
7900        }
7901    }
7902}
7903impl ::std::convert::TryFrom<&str> for ResponseFormatJsonSchemaType {
7904    type Error = self::error::ConversionError;
7905    fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
7906        value.parse()
7907    }
7908}
7909impl ::std::convert::TryFrom<&::std::string::String> for ResponseFormatJsonSchemaType {
7910    type Error = self::error::ConversionError;
7911    fn try_from(
7912        value: &::std::string::String,
7913    ) -> ::std::result::Result<Self, self::error::ConversionError> {
7914        value.parse()
7915    }
7916}
7917impl ::std::convert::TryFrom<::std::string::String> for ResponseFormatJsonSchemaType {
7918    type Error = self::error::ConversionError;
7919    fn try_from(
7920        value: ::std::string::String,
7921    ) -> ::std::result::Result<Self, self::error::ConversionError> {
7922        value.parse()
7923    }
7924}
7925///Default response format. Used to generate text responses.
7926///
7927/// <details><summary>JSON schema</summary>
7928///
7929/// ```json
7930///{
7931///  "description": "Default response format. Used to generate text responses.",
7932///  "type": "object",
7933///  "required": [
7934///    "type"
7935///  ],
7936///  "properties": {
7937///    "type": {
7938///      "description": "The type of response format being defined. Always `text`.",
7939///      "type": "string",
7940///      "enum": [
7941///        "text"
7942///      ]
7943///    }
7944///  }
7945///}
7946/// ```
7947/// </details>
7948#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
7949pub struct ResponseFormatText {
7950    ///The type of response format being defined. Always `text`.
7951    #[serde(rename = "type")]
7952    pub type_: ResponseFormatTextType,
7953}
7954///The type of response format being defined. Always `text`.
7955///
7956/// <details><summary>JSON schema</summary>
7957///
7958/// ```json
7959///{
7960///  "description": "The type of response format being defined. Always `text`.",
7961///  "type": "string",
7962///  "enum": [
7963///    "text"
7964///  ]
7965///}
7966/// ```
7967/// </details>
7968#[derive(
7969    ::serde::Deserialize,
7970    ::serde::Serialize,
7971    Clone,
7972    Copy,
7973    Debug,
7974    Eq,
7975    Hash,
7976    Ord,
7977    PartialEq,
7978    PartialOrd,
7979)]
7980pub enum ResponseFormatTextType {
7981    #[serde(rename = "text")]
7982    Text,
7983}
7984impl ::std::fmt::Display for ResponseFormatTextType {
7985    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
7986        match *self {
7987            Self::Text => f.write_str("text"),
7988        }
7989    }
7990}
7991impl ::std::str::FromStr for ResponseFormatTextType {
7992    type Err = self::error::ConversionError;
7993    fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
7994        match value {
7995            "text" => Ok(Self::Text),
7996            _ => Err("invalid value".into()),
7997        }
7998    }
7999}
8000impl ::std::convert::TryFrom<&str> for ResponseFormatTextType {
8001    type Error = self::error::ConversionError;
8002    fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
8003        value.parse()
8004    }
8005}
8006impl ::std::convert::TryFrom<&::std::string::String> for ResponseFormatTextType {
8007    type Error = self::error::ConversionError;
8008    fn try_from(
8009        value: &::std::string::String,
8010    ) -> ::std::result::Result<Self, self::error::ConversionError> {
8011        value.parse()
8012    }
8013}
8014impl ::std::convert::TryFrom<::std::string::String> for ResponseFormatTextType {
8015    type Error = self::error::ConversionError;
8016    fn try_from(
8017        value: ::std::string::String,
8018    ) -> ::std::result::Result<Self, self::error::ConversionError> {
8019        value.parse()
8020    }
8021}
8022///A tool call to a function generated by the model.
8023///
8024/// <details><summary>JSON schema</summary>
8025///
8026/// ```json
8027///{
8028///  "description": "A tool call to a function generated by the model.",
8029///  "type": "object",
8030///  "required": [
8031///    "arguments",
8032///    "call_id",
8033///    "name",
8034///    "type"
8035///  ],
8036///  "properties": {
8037///    "arguments": {
8038///      "description": "A JSON string of the arguments to pass to the function.",
8039///      "type": "string"
8040///    },
8041///    "call_id": {
8042///      "description": "The unique ID of the function tool call generated by the model, used to associate the call with its output.\n",
8043///      "type": "string"
8044///    },
8045///    "id": {
8046///      "description": "The unique ID of the function tool call.",
8047///      "type": "string"
8048///    },
8049///    "name": {
8050///      "description": "The name of the function to run.",
8051///      "type": "string"
8052///    },
8053///    "status": {
8054///      "description": "The status of the function tool call.",
8055///      "type": "string",
8056///      "enum": [
8057///        "in_progress",
8058///        "completed",
8059///        "incomplete"
8060///      ]
8061///    },
8062///    "type": {
8063///      "description": "The type of the output item. Always `function_call`.",
8064///      "type": "string",
8065///      "enum": [
8066///        "function_call"
8067///      ]
8068///    }
8069///  }
8070///}
8071/// ```
8072/// </details>
8073#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
8074pub struct ResponseFunctionToolCall {
8075    ///A JSON string of the arguments to pass to the function.
8076    pub arguments: ::std::string::String,
8077    /**The unique ID of the function tool call generated by the model, used to associate the call with its output.
8078     */
8079    pub call_id: ::std::string::String,
8080    ///The unique ID of the function tool call.
8081    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
8082    pub id: ::std::option::Option<::std::string::String>,
8083    ///The name of the function to run.
8084    pub name: ::std::string::String,
8085    ///The status of the function tool call.
8086    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
8087    pub status: ::std::option::Option<ResponseFunctionToolCallStatus>,
8088    ///The type of the output item. Always `function_call`.
8089    #[serde(rename = "type")]
8090    pub type_: ResponseFunctionToolCallType,
8091}
8092///The status of the function tool call.
8093///
8094/// <details><summary>JSON schema</summary>
8095///
8096/// ```json
8097///{
8098///  "description": "The status of the function tool call.",
8099///  "type": "string",
8100///  "enum": [
8101///    "in_progress",
8102///    "completed",
8103///    "incomplete"
8104///  ]
8105///}
8106/// ```
8107/// </details>
8108#[derive(
8109    ::serde::Deserialize,
8110    ::serde::Serialize,
8111    Clone,
8112    Copy,
8113    Debug,
8114    Eq,
8115    Hash,
8116    Ord,
8117    PartialEq,
8118    PartialOrd,
8119)]
8120pub enum ResponseFunctionToolCallStatus {
8121    #[serde(rename = "in_progress")]
8122    InProgress,
8123    #[serde(rename = "completed")]
8124    Completed,
8125    #[serde(rename = "incomplete")]
8126    Incomplete,
8127}
8128impl ::std::fmt::Display for ResponseFunctionToolCallStatus {
8129    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
8130        match *self {
8131            Self::InProgress => f.write_str("in_progress"),
8132            Self::Completed => f.write_str("completed"),
8133            Self::Incomplete => f.write_str("incomplete"),
8134        }
8135    }
8136}
8137impl ::std::str::FromStr for ResponseFunctionToolCallStatus {
8138    type Err = self::error::ConversionError;
8139    fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
8140        match value {
8141            "in_progress" => Ok(Self::InProgress),
8142            "completed" => Ok(Self::Completed),
8143            "incomplete" => Ok(Self::Incomplete),
8144            _ => Err("invalid value".into()),
8145        }
8146    }
8147}
8148impl ::std::convert::TryFrom<&str> for ResponseFunctionToolCallStatus {
8149    type Error = self::error::ConversionError;
8150    fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
8151        value.parse()
8152    }
8153}
8154impl ::std::convert::TryFrom<&::std::string::String> for ResponseFunctionToolCallStatus {
8155    type Error = self::error::ConversionError;
8156    fn try_from(
8157        value: &::std::string::String,
8158    ) -> ::std::result::Result<Self, self::error::ConversionError> {
8159        value.parse()
8160    }
8161}
8162impl ::std::convert::TryFrom<::std::string::String> for ResponseFunctionToolCallStatus {
8163    type Error = self::error::ConversionError;
8164    fn try_from(
8165        value: ::std::string::String,
8166    ) -> ::std::result::Result<Self, self::error::ConversionError> {
8167        value.parse()
8168    }
8169}
8170///The type of the output item. Always `function_call`.
8171///
8172/// <details><summary>JSON schema</summary>
8173///
8174/// ```json
8175///{
8176///  "description": "The type of the output item. Always `function_call`.",
8177///  "type": "string",
8178///  "enum": [
8179///    "function_call"
8180///  ]
8181///}
8182/// ```
8183/// </details>
8184#[derive(
8185    ::serde::Deserialize,
8186    ::serde::Serialize,
8187    Clone,
8188    Copy,
8189    Debug,
8190    Eq,
8191    Hash,
8192    Ord,
8193    PartialEq,
8194    PartialOrd,
8195)]
8196pub enum ResponseFunctionToolCallType {
8197    #[serde(rename = "function_call")]
8198    FunctionCall,
8199}
8200impl ::std::fmt::Display for ResponseFunctionToolCallType {
8201    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
8202        match *self {
8203            Self::FunctionCall => f.write_str("function_call"),
8204        }
8205    }
8206}
8207impl ::std::str::FromStr for ResponseFunctionToolCallType {
8208    type Err = self::error::ConversionError;
8209    fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
8210        match value {
8211            "function_call" => Ok(Self::FunctionCall),
8212            _ => Err("invalid value".into()),
8213        }
8214    }
8215}
8216impl ::std::convert::TryFrom<&str> for ResponseFunctionToolCallType {
8217    type Error = self::error::ConversionError;
8218    fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
8219        value.parse()
8220    }
8221}
8222impl ::std::convert::TryFrom<&::std::string::String> for ResponseFunctionToolCallType {
8223    type Error = self::error::ConversionError;
8224    fn try_from(
8225        value: &::std::string::String,
8226    ) -> ::std::result::Result<Self, self::error::ConversionError> {
8227        value.parse()
8228    }
8229}
8230impl ::std::convert::TryFrom<::std::string::String> for ResponseFunctionToolCallType {
8231    type Error = self::error::ConversionError;
8232    fn try_from(
8233        value: ::std::string::String,
8234    ) -> ::std::result::Result<Self, self::error::ConversionError> {
8235        value.parse()
8236    }
8237}
8238///Details about why the response is incomplete.
8239///
8240/// <details><summary>JSON schema</summary>
8241///
8242/// ```json
8243///{
8244///  "description": "Details about why the response is incomplete.",
8245///  "type": "object",
8246///  "properties": {
8247///    "reason": {
8248///      "description": "The reason why the response is incomplete.",
8249///      "type": "string"
8250///    }
8251///  },
8252///  "nullable": true
8253///}
8254/// ```
8255/// </details>
8256#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
8257pub struct ResponseIncompleteDetails {
8258    ///The reason why the response is incomplete.
8259    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
8260    pub reason: ::std::option::Option<::std::string::String>,
8261}
8262impl ::std::default::Default for ResponseIncompleteDetails {
8263    fn default() -> Self {
8264        Self {
8265            reason: Default::default(),
8266        }
8267    }
8268}
8269/**Text, image, or file inputs to the model. Either a single text prompt or a list of input items representing a (possibly batched) conversation.
8270*/
8271///
8272/// <details><summary>JSON schema</summary>
8273///
8274/// ```json
8275///{
8276///  "description": "Text, image, or file inputs to the model. Either a single text prompt or a list of input items representing a (possibly batched) conversation.\n",
8277///  "oneOf": [
8278///    {
8279///      "description": "A text input to the model, equivalent to a user message.",
8280///      "type": "string"
8281///    },
8282///    {
8283///      "description": "A list of input items.",
8284///      "type": "array",
8285///      "items": {
8286///        "$ref": "#/definitions/ResponseInputItem"
8287///      }
8288///    }
8289///  ]
8290///}
8291/// ```
8292/// </details>
8293#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
8294#[serde(untagged)]
8295pub enum ResponseInput {
8296    String(::std::string::String),
8297    Array(::std::vec::Vec<ResponseInputItem>),
8298}
8299impl ::std::convert::From<::std::vec::Vec<ResponseInputItem>> for ResponseInput {
8300    fn from(value: ::std::vec::Vec<ResponseInputItem>) -> Self {
8301        Self::Array(value)
8302    }
8303}
8304///A content part within an input message.
8305///
8306/// <details><summary>JSON schema</summary>
8307///
8308/// ```json
8309///{
8310///  "description": "A content part within an input message.",
8311///  "type": "object",
8312///  "oneOf": [
8313///    {
8314///      "$ref": "#/definitions/ResponseInputText"
8315///    },
8316///    {
8317///      "$ref": "#/definitions/ResponseInputImage"
8318///    }
8319///  ]
8320///}
8321/// ```
8322/// </details>
8323#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
8324#[serde(untagged)]
8325pub enum ResponseInputContentPart {
8326    Text(ResponseInputText),
8327    Image(ResponseInputImage),
8328}
8329impl ::std::convert::From<ResponseInputText> for ResponseInputContentPart {
8330    fn from(value: ResponseInputText) -> Self {
8331        Self::Text(value)
8332    }
8333}
8334impl ::std::convert::From<ResponseInputImage> for ResponseInputContentPart {
8335    fn from(value: ResponseInputImage) -> Self {
8336        Self::Image(value)
8337    }
8338}
8339///An image input to the model.
8340///
8341/// <details><summary>JSON schema</summary>
8342///
8343/// ```json
8344///{
8345///  "description": "An image input to the model.",
8346///  "type": "object",
8347///  "required": [
8348///    "type"
8349///  ],
8350///  "properties": {
8351///    "detail": {
8352///      "description": "The detail level of the image to send to the model.",
8353///      "default": "auto",
8354///      "type": "string",
8355///      "enum": [
8356///        "auto",
8357///        "low",
8358///        "high"
8359///      ]
8360///    },
8361///    "image_url": {
8362///      "description": "The URL of the image (data URLs supported).",
8363///      "type": "string"
8364///    },
8365///    "type": {
8366///      "description": "The type of the input item. Always `input_image`.",
8367///      "type": "string",
8368///      "enum": [
8369///        "input_image"
8370///      ]
8371///    }
8372///  }
8373///}
8374/// ```
8375/// </details>
8376#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
8377pub struct ResponseInputImage {
8378    ///The detail level of the image to send to the model.
8379    #[serde(default = "defaults::response_input_image_detail")]
8380    pub detail: ResponseInputImageDetail,
8381    ///The URL of the image (data URLs supported).
8382    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
8383    pub image_url: ::std::option::Option<::std::string::String>,
8384    ///The type of the input item. Always `input_image`.
8385    #[serde(rename = "type")]
8386    pub type_: ResponseInputImageType,
8387}
8388///The detail level of the image to send to the model.
8389///
8390/// <details><summary>JSON schema</summary>
8391///
8392/// ```json
8393///{
8394///  "description": "The detail level of the image to send to the model.",
8395///  "default": "auto",
8396///  "type": "string",
8397///  "enum": [
8398///    "auto",
8399///    "low",
8400///    "high"
8401///  ]
8402///}
8403/// ```
8404/// </details>
8405#[derive(
8406    ::serde::Deserialize,
8407    ::serde::Serialize,
8408    Clone,
8409    Copy,
8410    Debug,
8411    Eq,
8412    Hash,
8413    Ord,
8414    PartialEq,
8415    PartialOrd,
8416)]
8417pub enum ResponseInputImageDetail {
8418    #[serde(rename = "auto")]
8419    Auto,
8420    #[serde(rename = "low")]
8421    Low,
8422    #[serde(rename = "high")]
8423    High,
8424}
8425impl ::std::fmt::Display for ResponseInputImageDetail {
8426    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
8427        match *self {
8428            Self::Auto => f.write_str("auto"),
8429            Self::Low => f.write_str("low"),
8430            Self::High => f.write_str("high"),
8431        }
8432    }
8433}
8434impl ::std::str::FromStr for ResponseInputImageDetail {
8435    type Err = self::error::ConversionError;
8436    fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
8437        match value {
8438            "auto" => Ok(Self::Auto),
8439            "low" => Ok(Self::Low),
8440            "high" => Ok(Self::High),
8441            _ => Err("invalid value".into()),
8442        }
8443    }
8444}
8445impl ::std::convert::TryFrom<&str> for ResponseInputImageDetail {
8446    type Error = self::error::ConversionError;
8447    fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
8448        value.parse()
8449    }
8450}
8451impl ::std::convert::TryFrom<&::std::string::String> for ResponseInputImageDetail {
8452    type Error = self::error::ConversionError;
8453    fn try_from(
8454        value: &::std::string::String,
8455    ) -> ::std::result::Result<Self, self::error::ConversionError> {
8456        value.parse()
8457    }
8458}
8459impl ::std::convert::TryFrom<::std::string::String> for ResponseInputImageDetail {
8460    type Error = self::error::ConversionError;
8461    fn try_from(
8462        value: ::std::string::String,
8463    ) -> ::std::result::Result<Self, self::error::ConversionError> {
8464        value.parse()
8465    }
8466}
8467impl ::std::default::Default for ResponseInputImageDetail {
8468    fn default() -> Self {
8469        ResponseInputImageDetail::Auto
8470    }
8471}
8472///The type of the input item. Always `input_image`.
8473///
8474/// <details><summary>JSON schema</summary>
8475///
8476/// ```json
8477///{
8478///  "description": "The type of the input item. Always `input_image`.",
8479///  "type": "string",
8480///  "enum": [
8481///    "input_image"
8482///  ]
8483///}
8484/// ```
8485/// </details>
8486#[derive(
8487    ::serde::Deserialize,
8488    ::serde::Serialize,
8489    Clone,
8490    Copy,
8491    Debug,
8492    Eq,
8493    Hash,
8494    Ord,
8495    PartialEq,
8496    PartialOrd,
8497)]
8498pub enum ResponseInputImageType {
8499    #[serde(rename = "input_image")]
8500    InputImage,
8501}
8502impl ::std::fmt::Display for ResponseInputImageType {
8503    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
8504        match *self {
8505            Self::InputImage => f.write_str("input_image"),
8506        }
8507    }
8508}
8509impl ::std::str::FromStr for ResponseInputImageType {
8510    type Err = self::error::ConversionError;
8511    fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
8512        match value {
8513            "input_image" => Ok(Self::InputImage),
8514            _ => Err("invalid value".into()),
8515        }
8516    }
8517}
8518impl ::std::convert::TryFrom<&str> for ResponseInputImageType {
8519    type Error = self::error::ConversionError;
8520    fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
8521        value.parse()
8522    }
8523}
8524impl ::std::convert::TryFrom<&::std::string::String> for ResponseInputImageType {
8525    type Error = self::error::ConversionError;
8526    fn try_from(
8527        value: &::std::string::String,
8528    ) -> ::std::result::Result<Self, self::error::ConversionError> {
8529        value.parse()
8530    }
8531}
8532impl ::std::convert::TryFrom<::std::string::String> for ResponseInputImageType {
8533    type Error = self::error::ConversionError;
8534    fn try_from(
8535        value: ::std::string::String,
8536    ) -> ::std::result::Result<Self, self::error::ConversionError> {
8537        value.parse()
8538    }
8539}
8540/**A single input item. Most commonly an input message with a role and content.
8541*/
8542///
8543/// <details><summary>JSON schema</summary>
8544///
8545/// ```json
8546///{
8547///  "description": "A single input item. Most commonly an input message with a role and content.\n",
8548///  "type": "object",
8549///  "required": [
8550///    "content",
8551///    "role"
8552///  ],
8553///  "properties": {
8554///    "content": {
8555///      "$ref": "#/definitions/ResponseInputMessageContent"
8556///    },
8557///    "role": {
8558///      "$ref": "#/definitions/ResponseRole"
8559///    },
8560///    "type": {
8561///      "description": "The type of the input item. Defaults to `message`.",
8562///      "default": "message",
8563///      "type": "string"
8564///    }
8565///  }
8566///}
8567/// ```
8568/// </details>
8569#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
8570pub struct ResponseInputItem {
8571    pub content: ResponseInputMessageContent,
8572    pub role: ResponseRole,
8573    ///The type of the input item. Defaults to `message`.
8574    #[serde(rename = "type", default = "defaults::response_input_item_type")]
8575    pub type_: ::std::string::String,
8576}
8577/**Text or multimodal content for an input message. Either a string or a list of content parts.
8578*/
8579///
8580/// <details><summary>JSON schema</summary>
8581///
8582/// ```json
8583///{
8584///  "description": "Text or multimodal content for an input message. Either a string or a list of content parts.\n",
8585///  "oneOf": [
8586///    {
8587///      "description": "A text input to the model.",
8588///      "type": "string"
8589///    },
8590///    {
8591///      "type": "array",
8592///      "items": {
8593///        "$ref": "#/definitions/ResponseInputContentPart"
8594///      }
8595///    }
8596///  ]
8597///}
8598/// ```
8599/// </details>
8600#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
8601#[serde(untagged)]
8602pub enum ResponseInputMessageContent {
8603    String(::std::string::String),
8604    Array(::std::vec::Vec<ResponseInputContentPart>),
8605}
8606impl ::std::convert::From<::std::vec::Vec<ResponseInputContentPart>>
8607    for ResponseInputMessageContent
8608{
8609    fn from(value: ::std::vec::Vec<ResponseInputContentPart>) -> Self {
8610        Self::Array(value)
8611    }
8612}
8613///A text input to the model.
8614///
8615/// <details><summary>JSON schema</summary>
8616///
8617/// ```json
8618///{
8619///  "description": "A text input to the model.",
8620///  "type": "object",
8621///  "required": [
8622///    "text",
8623///    "type"
8624///  ],
8625///  "properties": {
8626///    "text": {
8627///      "description": "The text input to the model.",
8628///      "type": "string"
8629///    },
8630///    "type": {
8631///      "description": "The type of the input item. Always `input_text`.",
8632///      "type": "string",
8633///      "enum": [
8634///        "input_text"
8635///      ]
8636///    }
8637///  }
8638///}
8639/// ```
8640/// </details>
8641#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
8642pub struct ResponseInputText {
8643    ///The text input to the model.
8644    pub text: ::std::string::String,
8645    ///The type of the input item. Always `input_text`.
8646    #[serde(rename = "type")]
8647    pub type_: ResponseInputTextType,
8648}
8649///The type of the input item. Always `input_text`.
8650///
8651/// <details><summary>JSON schema</summary>
8652///
8653/// ```json
8654///{
8655///  "description": "The type of the input item. Always `input_text`.",
8656///  "type": "string",
8657///  "enum": [
8658///    "input_text"
8659///  ]
8660///}
8661/// ```
8662/// </details>
8663#[derive(
8664    ::serde::Deserialize,
8665    ::serde::Serialize,
8666    Clone,
8667    Copy,
8668    Debug,
8669    Eq,
8670    Hash,
8671    Ord,
8672    PartialEq,
8673    PartialOrd,
8674)]
8675pub enum ResponseInputTextType {
8676    #[serde(rename = "input_text")]
8677    InputText,
8678}
8679impl ::std::fmt::Display for ResponseInputTextType {
8680    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
8681        match *self {
8682            Self::InputText => f.write_str("input_text"),
8683        }
8684    }
8685}
8686impl ::std::str::FromStr for ResponseInputTextType {
8687    type Err = self::error::ConversionError;
8688    fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
8689        match value {
8690            "input_text" => Ok(Self::InputText),
8691            _ => Err("invalid value".into()),
8692        }
8693    }
8694}
8695impl ::std::convert::TryFrom<&str> for ResponseInputTextType {
8696    type Error = self::error::ConversionError;
8697    fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
8698        value.parse()
8699    }
8700}
8701impl ::std::convert::TryFrom<&::std::string::String> for ResponseInputTextType {
8702    type Error = self::error::ConversionError;
8703    fn try_from(
8704        value: &::std::string::String,
8705    ) -> ::std::result::Result<Self, self::error::ConversionError> {
8706        value.parse()
8707    }
8708}
8709impl ::std::convert::TryFrom<::std::string::String> for ResponseInputTextType {
8710    type Error = self::error::ConversionError;
8711    fn try_from(
8712        value: ::std::string::String,
8713    ) -> ::std::result::Result<Self, self::error::ConversionError> {
8714        value.parse()
8715    }
8716}
8717///A content part of an output message.
8718///
8719/// <details><summary>JSON schema</summary>
8720///
8721/// ```json
8722///{
8723///  "description": "A content part of an output message.",
8724///  "type": "object",
8725///  "oneOf": [
8726///    {
8727///      "$ref": "#/definitions/ResponseOutputText"
8728///    },
8729///    {
8730///      "$ref": "#/definitions/ResponseOutputRefusal"
8731///    }
8732///  ]
8733///}
8734/// ```
8735/// </details>
8736#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
8737#[serde(untagged)]
8738pub enum ResponseOutputContent {
8739    Text(ResponseOutputText),
8740    Refusal(ResponseOutputRefusal),
8741}
8742impl ::std::convert::From<ResponseOutputText> for ResponseOutputContent {
8743    fn from(value: ResponseOutputText) -> Self {
8744        Self::Text(value)
8745    }
8746}
8747impl ::std::convert::From<ResponseOutputRefusal> for ResponseOutputContent {
8748    fn from(value: ResponseOutputRefusal) -> Self {
8749        Self::Refusal(value)
8750    }
8751}
8752/**An output item generated by the model: an output message, a function tool call, or a reasoning item.
8753*/
8754///
8755/// <details><summary>JSON schema</summary>
8756///
8757/// ```json
8758///{
8759///  "description": "An output item generated by the model: an output message, a function tool call, or a reasoning item.\n",
8760///  "type": "object",
8761///  "oneOf": [
8762///    {
8763///      "$ref": "#/definitions/ResponseOutputMessage"
8764///    },
8765///    {
8766///      "$ref": "#/definitions/ResponseFunctionToolCall"
8767///    },
8768///    {
8769///      "$ref": "#/definitions/ResponseReasoningItem"
8770///    }
8771///  ]
8772///}
8773/// ```
8774/// </details>
8775#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
8776#[serde(untagged)]
8777pub enum ResponseOutputItem {
8778    OutputMessage(ResponseOutputMessage),
8779    FunctionToolCall(ResponseFunctionToolCall),
8780    ReasoningItem(ResponseReasoningItem),
8781}
8782impl ::std::convert::From<ResponseOutputMessage> for ResponseOutputItem {
8783    fn from(value: ResponseOutputMessage) -> Self {
8784        Self::OutputMessage(value)
8785    }
8786}
8787impl ::std::convert::From<ResponseFunctionToolCall> for ResponseOutputItem {
8788    fn from(value: ResponseFunctionToolCall) -> Self {
8789        Self::FunctionToolCall(value)
8790    }
8791}
8792impl ::std::convert::From<ResponseReasoningItem> for ResponseOutputItem {
8793    fn from(value: ResponseReasoningItem) -> Self {
8794        Self::ReasoningItem(value)
8795    }
8796}
8797///An output message from the model.
8798///
8799/// <details><summary>JSON schema</summary>
8800///
8801/// ```json
8802///{
8803///  "description": "An output message from the model.",
8804///  "type": "object",
8805///  "required": [
8806///    "content",
8807///    "id",
8808///    "role",
8809///    "type"
8810///  ],
8811///  "properties": {
8812///    "content": {
8813///      "type": "array",
8814///      "items": {
8815///        "$ref": "#/definitions/ResponseOutputContent"
8816///      }
8817///    },
8818///    "id": {
8819///      "description": "The unique ID of the output message.",
8820///      "type": "string"
8821///    },
8822///    "role": {
8823///      "description": "The role of the output message. Always `assistant`.",
8824///      "type": "string",
8825///      "enum": [
8826///        "assistant"
8827///      ]
8828///    },
8829///    "status": {
8830///      "description": "The status of the message.",
8831///      "type": "string",
8832///      "enum": [
8833///        "in_progress",
8834///        "completed",
8835///        "incomplete"
8836///      ]
8837///    },
8838///    "type": {
8839///      "description": "The type of the output item. Always `message`.",
8840///      "type": "string",
8841///      "enum": [
8842///        "message"
8843///      ]
8844///    }
8845///  }
8846///}
8847/// ```
8848/// </details>
8849#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
8850pub struct ResponseOutputMessage {
8851    pub content: ::std::vec::Vec<ResponseOutputContent>,
8852    ///The unique ID of the output message.
8853    pub id: ::std::string::String,
8854    ///The role of the output message. Always `assistant`.
8855    pub role: ResponseOutputMessageRole,
8856    ///The status of the message.
8857    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
8858    pub status: ::std::option::Option<ResponseOutputMessageStatus>,
8859    ///The type of the output item. Always `message`.
8860    #[serde(rename = "type")]
8861    pub type_: ResponseOutputMessageType,
8862}
8863///The role of the output message. Always `assistant`.
8864///
8865/// <details><summary>JSON schema</summary>
8866///
8867/// ```json
8868///{
8869///  "description": "The role of the output message. Always `assistant`.",
8870///  "type": "string",
8871///  "enum": [
8872///    "assistant"
8873///  ]
8874///}
8875/// ```
8876/// </details>
8877#[derive(
8878    ::serde::Deserialize,
8879    ::serde::Serialize,
8880    Clone,
8881    Copy,
8882    Debug,
8883    Eq,
8884    Hash,
8885    Ord,
8886    PartialEq,
8887    PartialOrd,
8888)]
8889pub enum ResponseOutputMessageRole {
8890    #[serde(rename = "assistant")]
8891    Assistant,
8892}
8893impl ::std::fmt::Display for ResponseOutputMessageRole {
8894    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
8895        match *self {
8896            Self::Assistant => f.write_str("assistant"),
8897        }
8898    }
8899}
8900impl ::std::str::FromStr for ResponseOutputMessageRole {
8901    type Err = self::error::ConversionError;
8902    fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
8903        match value {
8904            "assistant" => Ok(Self::Assistant),
8905            _ => Err("invalid value".into()),
8906        }
8907    }
8908}
8909impl ::std::convert::TryFrom<&str> for ResponseOutputMessageRole {
8910    type Error = self::error::ConversionError;
8911    fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
8912        value.parse()
8913    }
8914}
8915impl ::std::convert::TryFrom<&::std::string::String> for ResponseOutputMessageRole {
8916    type Error = self::error::ConversionError;
8917    fn try_from(
8918        value: &::std::string::String,
8919    ) -> ::std::result::Result<Self, self::error::ConversionError> {
8920        value.parse()
8921    }
8922}
8923impl ::std::convert::TryFrom<::std::string::String> for ResponseOutputMessageRole {
8924    type Error = self::error::ConversionError;
8925    fn try_from(
8926        value: ::std::string::String,
8927    ) -> ::std::result::Result<Self, self::error::ConversionError> {
8928        value.parse()
8929    }
8930}
8931///The status of the message.
8932///
8933/// <details><summary>JSON schema</summary>
8934///
8935/// ```json
8936///{
8937///  "description": "The status of the message.",
8938///  "type": "string",
8939///  "enum": [
8940///    "in_progress",
8941///    "completed",
8942///    "incomplete"
8943///  ]
8944///}
8945/// ```
8946/// </details>
8947#[derive(
8948    ::serde::Deserialize,
8949    ::serde::Serialize,
8950    Clone,
8951    Copy,
8952    Debug,
8953    Eq,
8954    Hash,
8955    Ord,
8956    PartialEq,
8957    PartialOrd,
8958)]
8959pub enum ResponseOutputMessageStatus {
8960    #[serde(rename = "in_progress")]
8961    InProgress,
8962    #[serde(rename = "completed")]
8963    Completed,
8964    #[serde(rename = "incomplete")]
8965    Incomplete,
8966}
8967impl ::std::fmt::Display for ResponseOutputMessageStatus {
8968    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
8969        match *self {
8970            Self::InProgress => f.write_str("in_progress"),
8971            Self::Completed => f.write_str("completed"),
8972            Self::Incomplete => f.write_str("incomplete"),
8973        }
8974    }
8975}
8976impl ::std::str::FromStr for ResponseOutputMessageStatus {
8977    type Err = self::error::ConversionError;
8978    fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
8979        match value {
8980            "in_progress" => Ok(Self::InProgress),
8981            "completed" => Ok(Self::Completed),
8982            "incomplete" => Ok(Self::Incomplete),
8983            _ => Err("invalid value".into()),
8984        }
8985    }
8986}
8987impl ::std::convert::TryFrom<&str> for ResponseOutputMessageStatus {
8988    type Error = self::error::ConversionError;
8989    fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
8990        value.parse()
8991    }
8992}
8993impl ::std::convert::TryFrom<&::std::string::String> for ResponseOutputMessageStatus {
8994    type Error = self::error::ConversionError;
8995    fn try_from(
8996        value: &::std::string::String,
8997    ) -> ::std::result::Result<Self, self::error::ConversionError> {
8998        value.parse()
8999    }
9000}
9001impl ::std::convert::TryFrom<::std::string::String> for ResponseOutputMessageStatus {
9002    type Error = self::error::ConversionError;
9003    fn try_from(
9004        value: ::std::string::String,
9005    ) -> ::std::result::Result<Self, self::error::ConversionError> {
9006        value.parse()
9007    }
9008}
9009///The type of the output item. Always `message`.
9010///
9011/// <details><summary>JSON schema</summary>
9012///
9013/// ```json
9014///{
9015///  "description": "The type of the output item. Always `message`.",
9016///  "type": "string",
9017///  "enum": [
9018///    "message"
9019///  ]
9020///}
9021/// ```
9022/// </details>
9023#[derive(
9024    ::serde::Deserialize,
9025    ::serde::Serialize,
9026    Clone,
9027    Copy,
9028    Debug,
9029    Eq,
9030    Hash,
9031    Ord,
9032    PartialEq,
9033    PartialOrd,
9034)]
9035pub enum ResponseOutputMessageType {
9036    #[serde(rename = "message")]
9037    Message,
9038}
9039impl ::std::fmt::Display for ResponseOutputMessageType {
9040    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
9041        match *self {
9042            Self::Message => f.write_str("message"),
9043        }
9044    }
9045}
9046impl ::std::str::FromStr for ResponseOutputMessageType {
9047    type Err = self::error::ConversionError;
9048    fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
9049        match value {
9050            "message" => Ok(Self::Message),
9051            _ => Err("invalid value".into()),
9052        }
9053    }
9054}
9055impl ::std::convert::TryFrom<&str> for ResponseOutputMessageType {
9056    type Error = self::error::ConversionError;
9057    fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
9058        value.parse()
9059    }
9060}
9061impl ::std::convert::TryFrom<&::std::string::String> for ResponseOutputMessageType {
9062    type Error = self::error::ConversionError;
9063    fn try_from(
9064        value: &::std::string::String,
9065    ) -> ::std::result::Result<Self, self::error::ConversionError> {
9066        value.parse()
9067    }
9068}
9069impl ::std::convert::TryFrom<::std::string::String> for ResponseOutputMessageType {
9070    type Error = self::error::ConversionError;
9071    fn try_from(
9072        value: ::std::string::String,
9073    ) -> ::std::result::Result<Self, self::error::ConversionError> {
9074        value.parse()
9075    }
9076}
9077///A refusal generated by the model.
9078///
9079/// <details><summary>JSON schema</summary>
9080///
9081/// ```json
9082///{
9083///  "description": "A refusal generated by the model.",
9084///  "type": "object",
9085///  "required": [
9086///    "refusal",
9087///    "type"
9088///  ],
9089///  "properties": {
9090///    "refusal": {
9091///      "description": "The refusal explanation from the model.",
9092///      "type": "string"
9093///    },
9094///    "type": {
9095///      "description": "The type of the refusal. Always `refusal`.",
9096///      "type": "string",
9097///      "enum": [
9098///        "refusal"
9099///      ]
9100///    }
9101///  }
9102///}
9103/// ```
9104/// </details>
9105#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
9106pub struct ResponseOutputRefusal {
9107    ///The refusal explanation from the model.
9108    pub refusal: ::std::string::String,
9109    ///The type of the refusal. Always `refusal`.
9110    #[serde(rename = "type")]
9111    pub type_: ResponseOutputRefusalType,
9112}
9113///The type of the refusal. Always `refusal`.
9114///
9115/// <details><summary>JSON schema</summary>
9116///
9117/// ```json
9118///{
9119///  "description": "The type of the refusal. Always `refusal`.",
9120///  "type": "string",
9121///  "enum": [
9122///    "refusal"
9123///  ]
9124///}
9125/// ```
9126/// </details>
9127#[derive(
9128    ::serde::Deserialize,
9129    ::serde::Serialize,
9130    Clone,
9131    Copy,
9132    Debug,
9133    Eq,
9134    Hash,
9135    Ord,
9136    PartialEq,
9137    PartialOrd,
9138)]
9139pub enum ResponseOutputRefusalType {
9140    #[serde(rename = "refusal")]
9141    Refusal,
9142}
9143impl ::std::fmt::Display for ResponseOutputRefusalType {
9144    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
9145        match *self {
9146            Self::Refusal => f.write_str("refusal"),
9147        }
9148    }
9149}
9150impl ::std::str::FromStr for ResponseOutputRefusalType {
9151    type Err = self::error::ConversionError;
9152    fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
9153        match value {
9154            "refusal" => Ok(Self::Refusal),
9155            _ => Err("invalid value".into()),
9156        }
9157    }
9158}
9159impl ::std::convert::TryFrom<&str> for ResponseOutputRefusalType {
9160    type Error = self::error::ConversionError;
9161    fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
9162        value.parse()
9163    }
9164}
9165impl ::std::convert::TryFrom<&::std::string::String> for ResponseOutputRefusalType {
9166    type Error = self::error::ConversionError;
9167    fn try_from(
9168        value: &::std::string::String,
9169    ) -> ::std::result::Result<Self, self::error::ConversionError> {
9170        value.parse()
9171    }
9172}
9173impl ::std::convert::TryFrom<::std::string::String> for ResponseOutputRefusalType {
9174    type Error = self::error::ConversionError;
9175    fn try_from(
9176        value: ::std::string::String,
9177    ) -> ::std::result::Result<Self, self::error::ConversionError> {
9178        value.parse()
9179    }
9180}
9181///A text output from the model.
9182///
9183/// <details><summary>JSON schema</summary>
9184///
9185/// ```json
9186///{
9187///  "description": "A text output from the model.",
9188///  "type": "object",
9189///  "required": [
9190///    "text",
9191///    "type"
9192///  ],
9193///  "properties": {
9194///    "text": {
9195///      "description": "The text output from the model.",
9196///      "type": "string"
9197///    },
9198///    "type": {
9199///      "description": "The type of the output text. Always `output_text`.",
9200///      "type": "string",
9201///      "enum": [
9202///        "output_text"
9203///      ]
9204///    }
9205///  }
9206///}
9207/// ```
9208/// </details>
9209#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
9210pub struct ResponseOutputText {
9211    ///The text output from the model.
9212    pub text: ::std::string::String,
9213    ///The type of the output text. Always `output_text`.
9214    #[serde(rename = "type")]
9215    pub type_: ResponseOutputTextType,
9216}
9217///The type of the output text. Always `output_text`.
9218///
9219/// <details><summary>JSON schema</summary>
9220///
9221/// ```json
9222///{
9223///  "description": "The type of the output text. Always `output_text`.",
9224///  "type": "string",
9225///  "enum": [
9226///    "output_text"
9227///  ]
9228///}
9229/// ```
9230/// </details>
9231#[derive(
9232    ::serde::Deserialize,
9233    ::serde::Serialize,
9234    Clone,
9235    Copy,
9236    Debug,
9237    Eq,
9238    Hash,
9239    Ord,
9240    PartialEq,
9241    PartialOrd,
9242)]
9243pub enum ResponseOutputTextType {
9244    #[serde(rename = "output_text")]
9245    OutputText,
9246}
9247impl ::std::fmt::Display for ResponseOutputTextType {
9248    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
9249        match *self {
9250            Self::OutputText => f.write_str("output_text"),
9251        }
9252    }
9253}
9254impl ::std::str::FromStr for ResponseOutputTextType {
9255    type Err = self::error::ConversionError;
9256    fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
9257        match value {
9258            "output_text" => Ok(Self::OutputText),
9259            _ => Err("invalid value".into()),
9260        }
9261    }
9262}
9263impl ::std::convert::TryFrom<&str> for ResponseOutputTextType {
9264    type Error = self::error::ConversionError;
9265    fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
9266        value.parse()
9267    }
9268}
9269impl ::std::convert::TryFrom<&::std::string::String> for ResponseOutputTextType {
9270    type Error = self::error::ConversionError;
9271    fn try_from(
9272        value: &::std::string::String,
9273    ) -> ::std::result::Result<Self, self::error::ConversionError> {
9274        value.parse()
9275    }
9276}
9277impl ::std::convert::TryFrom<::std::string::String> for ResponseOutputTextType {
9278    type Error = self::error::ConversionError;
9279    fn try_from(
9280        value: ::std::string::String,
9281    ) -> ::std::result::Result<Self, self::error::ConversionError> {
9282        value.parse()
9283    }
9284}
9285///Configuration options for reasoning models.
9286///
9287/// <details><summary>JSON schema</summary>
9288///
9289/// ```json
9290///{
9291///  "description": "Configuration options for reasoning models.",
9292///  "type": "object",
9293///  "properties": {
9294///    "effort": {
9295///      "description": "Constrains the effort on reasoning for reasoning models. Reducing effort can result in faster responses and fewer reasoning tokens.\n",
9296///      "default": "medium",
9297///      "type": "string",
9298///      "enum": [
9299///        "minimal",
9300///        "low",
9301///        "medium",
9302///        "high"
9303///      ],
9304///      "nullable": true
9305///    },
9306///    "summary": {
9307///      "description": "A summary of the reasoning performed by the model, useful for debugging and understanding the model's reasoning process.\n",
9308///      "type": "string",
9309///      "enum": [
9310///        "auto",
9311///        "concise",
9312///        "detailed"
9313///      ],
9314///      "nullable": true
9315///    }
9316///  }
9317///}
9318/// ```
9319/// </details>
9320#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
9321pub struct ResponseReasoning {
9322    /**Constrains the effort on reasoning for reasoning models. Reducing effort can result in faster responses and fewer reasoning tokens.
9323     */
9324    #[serde(default = "defaults::response_reasoning_effort")]
9325    pub effort: ResponseReasoningEffort,
9326    /**A summary of the reasoning performed by the model, useful for debugging and understanding the model's reasoning process.
9327     */
9328    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
9329    pub summary: ::std::option::Option<ResponseReasoningSummary>,
9330}
9331impl ::std::default::Default for ResponseReasoning {
9332    fn default() -> Self {
9333        Self {
9334            effort: defaults::response_reasoning_effort(),
9335            summary: Default::default(),
9336        }
9337    }
9338}
9339/**Constrains the effort on reasoning for reasoning models. Reducing effort can result in faster responses and fewer reasoning tokens.
9340*/
9341///
9342/// <details><summary>JSON schema</summary>
9343///
9344/// ```json
9345///{
9346///  "description": "Constrains the effort on reasoning for reasoning models. Reducing effort can result in faster responses and fewer reasoning tokens.\n",
9347///  "default": "medium",
9348///  "type": "string",
9349///  "enum": [
9350///    "minimal",
9351///    "low",
9352///    "medium",
9353///    "high"
9354///  ],
9355///  "nullable": true
9356///}
9357/// ```
9358/// </details>
9359#[derive(
9360    ::serde::Deserialize,
9361    ::serde::Serialize,
9362    Clone,
9363    Copy,
9364    Debug,
9365    Eq,
9366    Hash,
9367    Ord,
9368    PartialEq,
9369    PartialOrd,
9370)]
9371pub enum ResponseReasoningEffort {
9372    #[serde(rename = "minimal")]
9373    Minimal,
9374    #[serde(rename = "low")]
9375    Low,
9376    #[serde(rename = "medium")]
9377    Medium,
9378    #[serde(rename = "high")]
9379    High,
9380}
9381impl ::std::fmt::Display for ResponseReasoningEffort {
9382    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
9383        match *self {
9384            Self::Minimal => f.write_str("minimal"),
9385            Self::Low => f.write_str("low"),
9386            Self::Medium => f.write_str("medium"),
9387            Self::High => f.write_str("high"),
9388        }
9389    }
9390}
9391impl ::std::str::FromStr for ResponseReasoningEffort {
9392    type Err = self::error::ConversionError;
9393    fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
9394        match value {
9395            "minimal" => Ok(Self::Minimal),
9396            "low" => Ok(Self::Low),
9397            "medium" => Ok(Self::Medium),
9398            "high" => Ok(Self::High),
9399            _ => Err("invalid value".into()),
9400        }
9401    }
9402}
9403impl ::std::convert::TryFrom<&str> for ResponseReasoningEffort {
9404    type Error = self::error::ConversionError;
9405    fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
9406        value.parse()
9407    }
9408}
9409impl ::std::convert::TryFrom<&::std::string::String> for ResponseReasoningEffort {
9410    type Error = self::error::ConversionError;
9411    fn try_from(
9412        value: &::std::string::String,
9413    ) -> ::std::result::Result<Self, self::error::ConversionError> {
9414        value.parse()
9415    }
9416}
9417impl ::std::convert::TryFrom<::std::string::String> for ResponseReasoningEffort {
9418    type Error = self::error::ConversionError;
9419    fn try_from(
9420        value: ::std::string::String,
9421    ) -> ::std::result::Result<Self, self::error::ConversionError> {
9422        value.parse()
9423    }
9424}
9425impl ::std::default::Default for ResponseReasoningEffort {
9426    fn default() -> Self {
9427        ResponseReasoningEffort::Medium
9428    }
9429}
9430///A reasoning item describing the model's chain of thought.
9431///
9432/// <details><summary>JSON schema</summary>
9433///
9434/// ```json
9435///{
9436///  "description": "A reasoning item describing the model's chain of thought.",
9437///  "type": "object",
9438///  "required": [
9439///    "id",
9440///    "summary",
9441///    "type"
9442///  ],
9443///  "properties": {
9444///    "id": {
9445///      "description": "The unique ID of the reasoning item.",
9446///      "type": "string"
9447///    },
9448///    "status": {
9449///      "description": "The status of the reasoning item.",
9450///      "type": "string",
9451///      "enum": [
9452///        "in_progress",
9453///        "completed",
9454///        "incomplete"
9455///      ]
9456///    },
9457///    "summary": {
9458///      "description": "Reasoning summary content.",
9459///      "type": "array",
9460///      "items": {
9461///        "$ref": "#/definitions/ResponseReasoningSummaryPart"
9462///      }
9463///    },
9464///    "type": {
9465///      "description": "The type of the output item. Always `reasoning`.",
9466///      "type": "string",
9467///      "enum": [
9468///        "reasoning"
9469///      ]
9470///    }
9471///  }
9472///}
9473/// ```
9474/// </details>
9475#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
9476pub struct ResponseReasoningItem {
9477    ///The unique ID of the reasoning item.
9478    pub id: ::std::string::String,
9479    ///The status of the reasoning item.
9480    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
9481    pub status: ::std::option::Option<ResponseReasoningItemStatus>,
9482    ///Reasoning summary content.
9483    pub summary: ::std::vec::Vec<ResponseReasoningSummaryPart>,
9484    ///The type of the output item. Always `reasoning`.
9485    #[serde(rename = "type")]
9486    pub type_: ResponseReasoningItemType,
9487}
9488///The status of the reasoning item.
9489///
9490/// <details><summary>JSON schema</summary>
9491///
9492/// ```json
9493///{
9494///  "description": "The status of the reasoning item.",
9495///  "type": "string",
9496///  "enum": [
9497///    "in_progress",
9498///    "completed",
9499///    "incomplete"
9500///  ]
9501///}
9502/// ```
9503/// </details>
9504#[derive(
9505    ::serde::Deserialize,
9506    ::serde::Serialize,
9507    Clone,
9508    Copy,
9509    Debug,
9510    Eq,
9511    Hash,
9512    Ord,
9513    PartialEq,
9514    PartialOrd,
9515)]
9516pub enum ResponseReasoningItemStatus {
9517    #[serde(rename = "in_progress")]
9518    InProgress,
9519    #[serde(rename = "completed")]
9520    Completed,
9521    #[serde(rename = "incomplete")]
9522    Incomplete,
9523}
9524impl ::std::fmt::Display for ResponseReasoningItemStatus {
9525    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
9526        match *self {
9527            Self::InProgress => f.write_str("in_progress"),
9528            Self::Completed => f.write_str("completed"),
9529            Self::Incomplete => f.write_str("incomplete"),
9530        }
9531    }
9532}
9533impl ::std::str::FromStr for ResponseReasoningItemStatus {
9534    type Err = self::error::ConversionError;
9535    fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
9536        match value {
9537            "in_progress" => Ok(Self::InProgress),
9538            "completed" => Ok(Self::Completed),
9539            "incomplete" => Ok(Self::Incomplete),
9540            _ => Err("invalid value".into()),
9541        }
9542    }
9543}
9544impl ::std::convert::TryFrom<&str> for ResponseReasoningItemStatus {
9545    type Error = self::error::ConversionError;
9546    fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
9547        value.parse()
9548    }
9549}
9550impl ::std::convert::TryFrom<&::std::string::String> for ResponseReasoningItemStatus {
9551    type Error = self::error::ConversionError;
9552    fn try_from(
9553        value: &::std::string::String,
9554    ) -> ::std::result::Result<Self, self::error::ConversionError> {
9555        value.parse()
9556    }
9557}
9558impl ::std::convert::TryFrom<::std::string::String> for ResponseReasoningItemStatus {
9559    type Error = self::error::ConversionError;
9560    fn try_from(
9561        value: ::std::string::String,
9562    ) -> ::std::result::Result<Self, self::error::ConversionError> {
9563        value.parse()
9564    }
9565}
9566///The type of the output item. Always `reasoning`.
9567///
9568/// <details><summary>JSON schema</summary>
9569///
9570/// ```json
9571///{
9572///  "description": "The type of the output item. Always `reasoning`.",
9573///  "type": "string",
9574///  "enum": [
9575///    "reasoning"
9576///  ]
9577///}
9578/// ```
9579/// </details>
9580#[derive(
9581    ::serde::Deserialize,
9582    ::serde::Serialize,
9583    Clone,
9584    Copy,
9585    Debug,
9586    Eq,
9587    Hash,
9588    Ord,
9589    PartialEq,
9590    PartialOrd,
9591)]
9592pub enum ResponseReasoningItemType {
9593    #[serde(rename = "reasoning")]
9594    Reasoning,
9595}
9596impl ::std::fmt::Display for ResponseReasoningItemType {
9597    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
9598        match *self {
9599            Self::Reasoning => f.write_str("reasoning"),
9600        }
9601    }
9602}
9603impl ::std::str::FromStr for ResponseReasoningItemType {
9604    type Err = self::error::ConversionError;
9605    fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
9606        match value {
9607            "reasoning" => Ok(Self::Reasoning),
9608            _ => Err("invalid value".into()),
9609        }
9610    }
9611}
9612impl ::std::convert::TryFrom<&str> for ResponseReasoningItemType {
9613    type Error = self::error::ConversionError;
9614    fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
9615        value.parse()
9616    }
9617}
9618impl ::std::convert::TryFrom<&::std::string::String> for ResponseReasoningItemType {
9619    type Error = self::error::ConversionError;
9620    fn try_from(
9621        value: &::std::string::String,
9622    ) -> ::std::result::Result<Self, self::error::ConversionError> {
9623        value.parse()
9624    }
9625}
9626impl ::std::convert::TryFrom<::std::string::String> for ResponseReasoningItemType {
9627    type Error = self::error::ConversionError;
9628    fn try_from(
9629        value: ::std::string::String,
9630    ) -> ::std::result::Result<Self, self::error::ConversionError> {
9631        value.parse()
9632    }
9633}
9634/**A summary of the reasoning performed by the model, useful for debugging and understanding the model's reasoning process.
9635*/
9636///
9637/// <details><summary>JSON schema</summary>
9638///
9639/// ```json
9640///{
9641///  "description": "A summary of the reasoning performed by the model, useful for debugging and understanding the model's reasoning process.\n",
9642///  "type": "string",
9643///  "enum": [
9644///    "auto",
9645///    "concise",
9646///    "detailed"
9647///  ],
9648///  "nullable": true
9649///}
9650/// ```
9651/// </details>
9652#[derive(
9653    ::serde::Deserialize,
9654    ::serde::Serialize,
9655    Clone,
9656    Copy,
9657    Debug,
9658    Eq,
9659    Hash,
9660    Ord,
9661    PartialEq,
9662    PartialOrd,
9663)]
9664pub enum ResponseReasoningSummary {
9665    #[serde(rename = "auto")]
9666    Auto,
9667    #[serde(rename = "concise")]
9668    Concise,
9669    #[serde(rename = "detailed")]
9670    Detailed,
9671}
9672impl ::std::fmt::Display for ResponseReasoningSummary {
9673    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
9674        match *self {
9675            Self::Auto => f.write_str("auto"),
9676            Self::Concise => f.write_str("concise"),
9677            Self::Detailed => f.write_str("detailed"),
9678        }
9679    }
9680}
9681impl ::std::str::FromStr for ResponseReasoningSummary {
9682    type Err = self::error::ConversionError;
9683    fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
9684        match value {
9685            "auto" => Ok(Self::Auto),
9686            "concise" => Ok(Self::Concise),
9687            "detailed" => Ok(Self::Detailed),
9688            _ => Err("invalid value".into()),
9689        }
9690    }
9691}
9692impl ::std::convert::TryFrom<&str> for ResponseReasoningSummary {
9693    type Error = self::error::ConversionError;
9694    fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
9695        value.parse()
9696    }
9697}
9698impl ::std::convert::TryFrom<&::std::string::String> for ResponseReasoningSummary {
9699    type Error = self::error::ConversionError;
9700    fn try_from(
9701        value: &::std::string::String,
9702    ) -> ::std::result::Result<Self, self::error::ConversionError> {
9703        value.parse()
9704    }
9705}
9706impl ::std::convert::TryFrom<::std::string::String> for ResponseReasoningSummary {
9707    type Error = self::error::ConversionError;
9708    fn try_from(
9709        value: ::std::string::String,
9710    ) -> ::std::result::Result<Self, self::error::ConversionError> {
9711        value.parse()
9712    }
9713}
9714///A summary part of a reasoning item.
9715///
9716/// <details><summary>JSON schema</summary>
9717///
9718/// ```json
9719///{
9720///  "description": "A summary part of a reasoning item.",
9721///  "type": "object",
9722///  "required": [
9723///    "text",
9724///    "type"
9725///  ],
9726///  "properties": {
9727///    "text": {
9728///      "description": "A summary of the reasoning output from the model.",
9729///      "type": "string"
9730///    },
9731///    "type": {
9732///      "description": "The type of the summary. Always `summary_text`.",
9733///      "type": "string",
9734///      "enum": [
9735///        "summary_text"
9736///      ]
9737///    }
9738///  }
9739///}
9740/// ```
9741/// </details>
9742#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
9743pub struct ResponseReasoningSummaryPart {
9744    ///A summary of the reasoning output from the model.
9745    pub text: ::std::string::String,
9746    ///The type of the summary. Always `summary_text`.
9747    #[serde(rename = "type")]
9748    pub type_: ResponseReasoningSummaryPartType,
9749}
9750///The type of the summary. Always `summary_text`.
9751///
9752/// <details><summary>JSON schema</summary>
9753///
9754/// ```json
9755///{
9756///  "description": "The type of the summary. Always `summary_text`.",
9757///  "type": "string",
9758///  "enum": [
9759///    "summary_text"
9760///  ]
9761///}
9762/// ```
9763/// </details>
9764#[derive(
9765    ::serde::Deserialize,
9766    ::serde::Serialize,
9767    Clone,
9768    Copy,
9769    Debug,
9770    Eq,
9771    Hash,
9772    Ord,
9773    PartialEq,
9774    PartialOrd,
9775)]
9776pub enum ResponseReasoningSummaryPartType {
9777    #[serde(rename = "summary_text")]
9778    SummaryText,
9779}
9780impl ::std::fmt::Display for ResponseReasoningSummaryPartType {
9781    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
9782        match *self {
9783            Self::SummaryText => f.write_str("summary_text"),
9784        }
9785    }
9786}
9787impl ::std::str::FromStr for ResponseReasoningSummaryPartType {
9788    type Err = self::error::ConversionError;
9789    fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
9790        match value {
9791            "summary_text" => Ok(Self::SummaryText),
9792            _ => Err("invalid value".into()),
9793        }
9794    }
9795}
9796impl ::std::convert::TryFrom<&str> for ResponseReasoningSummaryPartType {
9797    type Error = self::error::ConversionError;
9798    fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
9799        value.parse()
9800    }
9801}
9802impl ::std::convert::TryFrom<&::std::string::String> for ResponseReasoningSummaryPartType {
9803    type Error = self::error::ConversionError;
9804    fn try_from(
9805        value: &::std::string::String,
9806    ) -> ::std::result::Result<Self, self::error::ConversionError> {
9807        value.parse()
9808    }
9809}
9810impl ::std::convert::TryFrom<::std::string::String> for ResponseReasoningSummaryPartType {
9811    type Error = self::error::ConversionError;
9812    fn try_from(
9813        value: ::std::string::String,
9814    ) -> ::std::result::Result<Self, self::error::ConversionError> {
9815        value.parse()
9816    }
9817}
9818///The role of the message input.
9819///
9820/// <details><summary>JSON schema</summary>
9821///
9822/// ```json
9823///{
9824///  "description": "The role of the message input.",
9825///  "type": "string",
9826///  "enum": [
9827///    "user",
9828///    "assistant",
9829///    "system",
9830///    "developer"
9831///  ]
9832///}
9833/// ```
9834/// </details>
9835#[derive(
9836    ::serde::Deserialize,
9837    ::serde::Serialize,
9838    Clone,
9839    Copy,
9840    Debug,
9841    Eq,
9842    Hash,
9843    Ord,
9844    PartialEq,
9845    PartialOrd,
9846)]
9847pub enum ResponseRole {
9848    #[serde(rename = "user")]
9849    User,
9850    #[serde(rename = "assistant")]
9851    Assistant,
9852    #[serde(rename = "system")]
9853    System,
9854    #[serde(rename = "developer")]
9855    Developer,
9856}
9857impl ::std::fmt::Display for ResponseRole {
9858    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
9859        match *self {
9860            Self::User => f.write_str("user"),
9861            Self::Assistant => f.write_str("assistant"),
9862            Self::System => f.write_str("system"),
9863            Self::Developer => f.write_str("developer"),
9864        }
9865    }
9866}
9867impl ::std::str::FromStr for ResponseRole {
9868    type Err = self::error::ConversionError;
9869    fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
9870        match value {
9871            "user" => Ok(Self::User),
9872            "assistant" => Ok(Self::Assistant),
9873            "system" => Ok(Self::System),
9874            "developer" => Ok(Self::Developer),
9875            _ => Err("invalid value".into()),
9876        }
9877    }
9878}
9879impl ::std::convert::TryFrom<&str> for ResponseRole {
9880    type Error = self::error::ConversionError;
9881    fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
9882        value.parse()
9883    }
9884}
9885impl ::std::convert::TryFrom<&::std::string::String> for ResponseRole {
9886    type Error = self::error::ConversionError;
9887    fn try_from(
9888        value: &::std::string::String,
9889    ) -> ::std::result::Result<Self, self::error::ConversionError> {
9890        value.parse()
9891    }
9892}
9893impl ::std::convert::TryFrom<::std::string::String> for ResponseRole {
9894    type Error = self::error::ConversionError;
9895    fn try_from(
9896        value: ::std::string::String,
9897    ) -> ::std::result::Result<Self, self::error::ConversionError> {
9898        value.parse()
9899    }
9900}
9901///The status of the response generation.
9902///
9903/// <details><summary>JSON schema</summary>
9904///
9905/// ```json
9906///{
9907///  "description": "The status of the response generation.",
9908///  "type": "string",
9909///  "enum": [
9910///    "completed",
9911///    "failed",
9912///    "in_progress",
9913///    "cancelled",
9914///    "queued",
9915///    "incomplete"
9916///  ]
9917///}
9918/// ```
9919/// </details>
9920#[derive(
9921    ::serde::Deserialize,
9922    ::serde::Serialize,
9923    Clone,
9924    Copy,
9925    Debug,
9926    Eq,
9927    Hash,
9928    Ord,
9929    PartialEq,
9930    PartialOrd,
9931)]
9932pub enum ResponseStatus {
9933    #[serde(rename = "completed")]
9934    Completed,
9935    #[serde(rename = "failed")]
9936    Failed,
9937    #[serde(rename = "in_progress")]
9938    InProgress,
9939    #[serde(rename = "cancelled")]
9940    Cancelled,
9941    #[serde(rename = "queued")]
9942    Queued,
9943    #[serde(rename = "incomplete")]
9944    Incomplete,
9945}
9946impl ::std::fmt::Display for ResponseStatus {
9947    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
9948        match *self {
9949            Self::Completed => f.write_str("completed"),
9950            Self::Failed => f.write_str("failed"),
9951            Self::InProgress => f.write_str("in_progress"),
9952            Self::Cancelled => f.write_str("cancelled"),
9953            Self::Queued => f.write_str("queued"),
9954            Self::Incomplete => f.write_str("incomplete"),
9955        }
9956    }
9957}
9958impl ::std::str::FromStr for ResponseStatus {
9959    type Err = self::error::ConversionError;
9960    fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
9961        match value {
9962            "completed" => Ok(Self::Completed),
9963            "failed" => Ok(Self::Failed),
9964            "in_progress" => Ok(Self::InProgress),
9965            "cancelled" => Ok(Self::Cancelled),
9966            "queued" => Ok(Self::Queued),
9967            "incomplete" => Ok(Self::Incomplete),
9968            _ => Err("invalid value".into()),
9969        }
9970    }
9971}
9972impl ::std::convert::TryFrom<&str> for ResponseStatus {
9973    type Error = self::error::ConversionError;
9974    fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
9975        value.parse()
9976    }
9977}
9978impl ::std::convert::TryFrom<&::std::string::String> for ResponseStatus {
9979    type Error = self::error::ConversionError;
9980    fn try_from(
9981        value: &::std::string::String,
9982    ) -> ::std::result::Result<Self, self::error::ConversionError> {
9983        value.parse()
9984    }
9985}
9986impl ::std::convert::TryFrom<::std::string::String> for ResponseStatus {
9987    type Error = self::error::ConversionError;
9988    fn try_from(
9989        value: ::std::string::String,
9990    ) -> ::std::result::Result<Self, self::error::ConversionError> {
9991        value.parse()
9992    }
9993}
9994/**A server-sent event emitted while streaming a response. The Responses API emits a sequence of typed events (for example `response.created`, `response.output_text.delta`, and `response.completed`). This schema models the common event envelope; which fields are populated depends on the event `type`.
9995*/
9996///
9997/// <details><summary>JSON schema</summary>
9998///
9999/// ```json
10000///{
10001///  "description": "A server-sent event emitted while streaming a response. The Responses API emits a sequence of typed events (for example `response.created`, `response.output_text.delta`, and `response.completed`). This schema models the common event envelope; which fields are populated depends on the event `type`.\n",
10002///  "type": "object",
10003///  "required": [
10004///    "type"
10005///  ],
10006///  "properties": {
10007///    "content_index": {
10008///      "description": "The index of the content part within the output item.",
10009///      "type": "integer"
10010///    },
10011///    "delta": {
10012///      "description": "The incremental text delta for `*.delta` events.",
10013///      "type": "string"
10014///    },
10015///    "item_id": {
10016///      "description": "The ID of the output item this event relates to.",
10017///      "type": "string"
10018///    },
10019///    "output_index": {
10020///      "description": "The index of the output item in the response's output array.",
10021///      "type": "integer"
10022///    },
10023///    "response": {
10024///      "$ref": "#/definitions/Response"
10025///    },
10026///    "sequence_number": {
10027///      "description": "The sequence number of this event.",
10028///      "type": "integer"
10029///    },
10030///    "text": {
10031///      "description": "The finalized text for `*.done` events.",
10032///      "type": "string"
10033///    },
10034///    "type": {
10035///      "description": "The type of the streamed event, for example `response.output_text.delta` or `response.completed`.\n",
10036///      "type": "string"
10037///    }
10038///  }
10039///}
10040/// ```
10041/// </details>
10042#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
10043pub struct ResponseStreamEvent {
10044    ///The index of the content part within the output item.
10045    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
10046    pub content_index: ::std::option::Option<i64>,
10047    ///The incremental text delta for `*.delta` events.
10048    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
10049    pub delta: ::std::option::Option<::std::string::String>,
10050    ///The ID of the output item this event relates to.
10051    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
10052    pub item_id: ::std::option::Option<::std::string::String>,
10053    ///The index of the output item in the response's output array.
10054    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
10055    pub output_index: ::std::option::Option<i64>,
10056    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
10057    pub response: ::std::option::Option<Response>,
10058    ///The sequence number of this event.
10059    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
10060    pub sequence_number: ::std::option::Option<i64>,
10061    ///The finalized text for `*.done` events.
10062    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
10063    pub text: ::std::option::Option<::std::string::String>,
10064    /**The type of the streamed event, for example `response.output_text.delta` or `response.completed`.
10065     */
10066    #[serde(rename = "type")]
10067    pub type_: ::std::string::String,
10068}
10069/**Configuration options for a text response from the model. Can be plain text or structured JSON data.
10070*/
10071///
10072/// <details><summary>JSON schema</summary>
10073///
10074/// ```json
10075///{
10076///  "description": "Configuration options for a text response from the model. Can be plain text or structured JSON data.\n",
10077///  "type": "object",
10078///  "properties": {
10079///    "format": {
10080///      "description": "An object specifying the format that the model must output.",
10081///      "type": "object",
10082///      "required": [
10083///        "type"
10084///      ],
10085///      "properties": {
10086///        "name": {
10087///          "description": "The name of the response format (used with `json_schema`).",
10088///          "type": "string"
10089///        },
10090///        "schema": {
10091///          "$ref": "#/definitions/FunctionParameters"
10092///        },
10093///        "strict": {
10094///          "description": "Whether to enable strict schema adherence.",
10095///          "default": false,
10096///          "type": "boolean"
10097///        },
10098///        "type": {
10099///          "description": "The type of response format being defined.",
10100///          "type": "string",
10101///          "enum": [
10102///            "text",
10103///            "json_schema",
10104///            "json_object"
10105///          ]
10106///        }
10107///      }
10108///    }
10109///  }
10110///}
10111/// ```
10112/// </details>
10113#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
10114pub struct ResponseTextConfig {
10115    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
10116    pub format: ::std::option::Option<ResponseTextConfigFormat>,
10117}
10118impl ::std::default::Default for ResponseTextConfig {
10119    fn default() -> Self {
10120        Self {
10121            format: Default::default(),
10122        }
10123    }
10124}
10125///An object specifying the format that the model must output.
10126///
10127/// <details><summary>JSON schema</summary>
10128///
10129/// ```json
10130///{
10131///  "description": "An object specifying the format that the model must output.",
10132///  "type": "object",
10133///  "required": [
10134///    "type"
10135///  ],
10136///  "properties": {
10137///    "name": {
10138///      "description": "The name of the response format (used with `json_schema`).",
10139///      "type": "string"
10140///    },
10141///    "schema": {
10142///      "$ref": "#/definitions/FunctionParameters"
10143///    },
10144///    "strict": {
10145///      "description": "Whether to enable strict schema adherence.",
10146///      "default": false,
10147///      "type": "boolean"
10148///    },
10149///    "type": {
10150///      "description": "The type of response format being defined.",
10151///      "type": "string",
10152///      "enum": [
10153///        "text",
10154///        "json_schema",
10155///        "json_object"
10156///      ]
10157///    }
10158///  }
10159///}
10160/// ```
10161/// </details>
10162#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
10163pub struct ResponseTextConfigFormat {
10164    ///The name of the response format (used with `json_schema`).
10165    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
10166    pub name: ::std::option::Option<::std::string::String>,
10167    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
10168    pub schema: ::std::option::Option<FunctionParameters>,
10169    ///Whether to enable strict schema adherence.
10170    #[serde(default)]
10171    pub strict: bool,
10172    ///The type of response format being defined.
10173    #[serde(rename = "type")]
10174    pub type_: ResponseTextConfigFormatType,
10175}
10176///The type of response format being defined.
10177///
10178/// <details><summary>JSON schema</summary>
10179///
10180/// ```json
10181///{
10182///  "description": "The type of response format being defined.",
10183///  "type": "string",
10184///  "enum": [
10185///    "text",
10186///    "json_schema",
10187///    "json_object"
10188///  ]
10189///}
10190/// ```
10191/// </details>
10192#[derive(
10193    ::serde::Deserialize,
10194    ::serde::Serialize,
10195    Clone,
10196    Copy,
10197    Debug,
10198    Eq,
10199    Hash,
10200    Ord,
10201    PartialEq,
10202    PartialOrd,
10203)]
10204pub enum ResponseTextConfigFormatType {
10205    #[serde(rename = "text")]
10206    Text,
10207    #[serde(rename = "json_schema")]
10208    JsonSchema,
10209    #[serde(rename = "json_object")]
10210    JsonObject,
10211}
10212impl ::std::fmt::Display for ResponseTextConfigFormatType {
10213    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
10214        match *self {
10215            Self::Text => f.write_str("text"),
10216            Self::JsonSchema => f.write_str("json_schema"),
10217            Self::JsonObject => f.write_str("json_object"),
10218        }
10219    }
10220}
10221impl ::std::str::FromStr for ResponseTextConfigFormatType {
10222    type Err = self::error::ConversionError;
10223    fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
10224        match value {
10225            "text" => Ok(Self::Text),
10226            "json_schema" => Ok(Self::JsonSchema),
10227            "json_object" => Ok(Self::JsonObject),
10228            _ => Err("invalid value".into()),
10229        }
10230    }
10231}
10232impl ::std::convert::TryFrom<&str> for ResponseTextConfigFormatType {
10233    type Error = self::error::ConversionError;
10234    fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
10235        value.parse()
10236    }
10237}
10238impl ::std::convert::TryFrom<&::std::string::String> for ResponseTextConfigFormatType {
10239    type Error = self::error::ConversionError;
10240    fn try_from(
10241        value: &::std::string::String,
10242    ) -> ::std::result::Result<Self, self::error::ConversionError> {
10243        value.parse()
10244    }
10245}
10246impl ::std::convert::TryFrom<::std::string::String> for ResponseTextConfigFormatType {
10247    type Error = self::error::ConversionError;
10248    fn try_from(
10249        value: ::std::string::String,
10250    ) -> ::std::result::Result<Self, self::error::ConversionError> {
10251        value.parse()
10252    }
10253}
10254/**A tool the model may call. Only function tools are modeled here. Note the Responses API uses a flattened function tool shape (`name`, `description`, and `parameters` at the top level) rather than nesting them under a `function` object as `/chat/completions` does.
10255*/
10256///
10257/// <details><summary>JSON schema</summary>
10258///
10259/// ```json
10260///{
10261///  "description": "A tool the model may call. Only function tools are modeled here. Note the Responses API uses a flattened function tool shape (`name`, `description`, and `parameters` at the top level) rather than nesting them under a `function` object as `/chat/completions` does.\n",
10262///  "type": "object",
10263///  "required": [
10264///    "name",
10265///    "type"
10266///  ],
10267///  "properties": {
10268///    "description": {
10269///      "description": "A description of the function, used by the model to decide when and how to call it.\n",
10270///      "type": "string"
10271///    },
10272///    "name": {
10273///      "description": "The name of the function to call.",
10274///      "type": "string"
10275///    },
10276///    "parameters": {
10277///      "$ref": "#/definitions/FunctionParameters"
10278///    },
10279///    "strict": {
10280///      "description": "Whether to enforce strict parameter validation.",
10281///      "default": false,
10282///      "type": "boolean"
10283///    },
10284///    "type": {
10285///      "description": "The type of the tool. Currently only `function`.",
10286///      "type": "string",
10287///      "enum": [
10288///        "function"
10289///      ]
10290///    }
10291///  }
10292///}
10293/// ```
10294/// </details>
10295#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
10296pub struct ResponseTool {
10297    /**A description of the function, used by the model to decide when and how to call it.
10298     */
10299    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
10300    pub description: ::std::option::Option<::std::string::String>,
10301    ///The name of the function to call.
10302    pub name: ::std::string::String,
10303    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
10304    pub parameters: ::std::option::Option<FunctionParameters>,
10305    ///Whether to enforce strict parameter validation.
10306    #[serde(default)]
10307    pub strict: bool,
10308    ///The type of the tool. Currently only `function`.
10309    #[serde(rename = "type")]
10310    pub type_: ResponseToolType,
10311}
10312/**How the model should select which tool (or tools) to use. Either a mode string (`none`, `auto`, `required`) or an object forcing a specific tool.
10313*/
10314///
10315/// <details><summary>JSON schema</summary>
10316///
10317/// ```json
10318///{
10319///  "description": "How the model should select which tool (or tools) to use. Either a mode string (`none`, `auto`, `required`) or an object forcing a specific tool.\n",
10320///  "oneOf": [
10321///    {
10322///      "description": "The tool-choice mode.",
10323///      "type": "string",
10324///      "enum": [
10325///        "none",
10326///        "auto",
10327///        "required"
10328///      ]
10329///    },
10330///    {
10331///      "description": "Forces the model to call a specific function tool.",
10332///      "type": "object",
10333///      "required": [
10334///        "name",
10335///        "type"
10336///      ],
10337///      "properties": {
10338///        "name": {
10339///          "type": "string"
10340///        },
10341///        "type": {
10342///          "type": "string",
10343///          "enum": [
10344///            "function"
10345///          ]
10346///        }
10347///      }
10348///    }
10349///  ]
10350///}
10351/// ```
10352/// </details>
10353#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
10354#[serde(untagged)]
10355pub enum ResponseToolChoice {
10356    String(ResponseToolChoiceString),
10357    Object {
10358        name: ::std::string::String,
10359        #[serde(rename = "type")]
10360        type_: ResponseToolChoiceObjectType,
10361    },
10362}
10363impl ::std::convert::From<ResponseToolChoiceString> for ResponseToolChoice {
10364    fn from(value: ResponseToolChoiceString) -> Self {
10365        Self::String(value)
10366    }
10367}
10368///`ResponseToolChoiceObjectType`
10369///
10370/// <details><summary>JSON schema</summary>
10371///
10372/// ```json
10373///{
10374///  "type": "string",
10375///  "enum": [
10376///    "function"
10377///  ]
10378///}
10379/// ```
10380/// </details>
10381#[derive(
10382    ::serde::Deserialize,
10383    ::serde::Serialize,
10384    Clone,
10385    Copy,
10386    Debug,
10387    Eq,
10388    Hash,
10389    Ord,
10390    PartialEq,
10391    PartialOrd,
10392)]
10393pub enum ResponseToolChoiceObjectType {
10394    #[serde(rename = "function")]
10395    Function,
10396}
10397impl ::std::fmt::Display for ResponseToolChoiceObjectType {
10398    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
10399        match *self {
10400            Self::Function => f.write_str("function"),
10401        }
10402    }
10403}
10404impl ::std::str::FromStr for ResponseToolChoiceObjectType {
10405    type Err = self::error::ConversionError;
10406    fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
10407        match value {
10408            "function" => Ok(Self::Function),
10409            _ => Err("invalid value".into()),
10410        }
10411    }
10412}
10413impl ::std::convert::TryFrom<&str> for ResponseToolChoiceObjectType {
10414    type Error = self::error::ConversionError;
10415    fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
10416        value.parse()
10417    }
10418}
10419impl ::std::convert::TryFrom<&::std::string::String> for ResponseToolChoiceObjectType {
10420    type Error = self::error::ConversionError;
10421    fn try_from(
10422        value: &::std::string::String,
10423    ) -> ::std::result::Result<Self, self::error::ConversionError> {
10424        value.parse()
10425    }
10426}
10427impl ::std::convert::TryFrom<::std::string::String> for ResponseToolChoiceObjectType {
10428    type Error = self::error::ConversionError;
10429    fn try_from(
10430        value: ::std::string::String,
10431    ) -> ::std::result::Result<Self, self::error::ConversionError> {
10432        value.parse()
10433    }
10434}
10435///The tool-choice mode.
10436///
10437/// <details><summary>JSON schema</summary>
10438///
10439/// ```json
10440///{
10441///  "description": "The tool-choice mode.",
10442///  "type": "string",
10443///  "enum": [
10444///    "none",
10445///    "auto",
10446///    "required"
10447///  ]
10448///}
10449/// ```
10450/// </details>
10451#[derive(
10452    ::serde::Deserialize,
10453    ::serde::Serialize,
10454    Clone,
10455    Copy,
10456    Debug,
10457    Eq,
10458    Hash,
10459    Ord,
10460    PartialEq,
10461    PartialOrd,
10462)]
10463pub enum ResponseToolChoiceString {
10464    #[serde(rename = "none")]
10465    None,
10466    #[serde(rename = "auto")]
10467    Auto,
10468    #[serde(rename = "required")]
10469    Required,
10470}
10471impl ::std::fmt::Display for ResponseToolChoiceString {
10472    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
10473        match *self {
10474            Self::None => f.write_str("none"),
10475            Self::Auto => f.write_str("auto"),
10476            Self::Required => f.write_str("required"),
10477        }
10478    }
10479}
10480impl ::std::str::FromStr for ResponseToolChoiceString {
10481    type Err = self::error::ConversionError;
10482    fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
10483        match value {
10484            "none" => Ok(Self::None),
10485            "auto" => Ok(Self::Auto),
10486            "required" => Ok(Self::Required),
10487            _ => Err("invalid value".into()),
10488        }
10489    }
10490}
10491impl ::std::convert::TryFrom<&str> for ResponseToolChoiceString {
10492    type Error = self::error::ConversionError;
10493    fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
10494        value.parse()
10495    }
10496}
10497impl ::std::convert::TryFrom<&::std::string::String> for ResponseToolChoiceString {
10498    type Error = self::error::ConversionError;
10499    fn try_from(
10500        value: &::std::string::String,
10501    ) -> ::std::result::Result<Self, self::error::ConversionError> {
10502        value.parse()
10503    }
10504}
10505impl ::std::convert::TryFrom<::std::string::String> for ResponseToolChoiceString {
10506    type Error = self::error::ConversionError;
10507    fn try_from(
10508        value: ::std::string::String,
10509    ) -> ::std::result::Result<Self, self::error::ConversionError> {
10510        value.parse()
10511    }
10512}
10513///The type of the tool. Currently only `function`.
10514///
10515/// <details><summary>JSON schema</summary>
10516///
10517/// ```json
10518///{
10519///  "description": "The type of the tool. Currently only `function`.",
10520///  "type": "string",
10521///  "enum": [
10522///    "function"
10523///  ]
10524///}
10525/// ```
10526/// </details>
10527#[derive(
10528    ::serde::Deserialize,
10529    ::serde::Serialize,
10530    Clone,
10531    Copy,
10532    Debug,
10533    Eq,
10534    Hash,
10535    Ord,
10536    PartialEq,
10537    PartialOrd,
10538)]
10539pub enum ResponseToolType {
10540    #[serde(rename = "function")]
10541    Function,
10542}
10543impl ::std::fmt::Display for ResponseToolType {
10544    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
10545        match *self {
10546            Self::Function => f.write_str("function"),
10547        }
10548    }
10549}
10550impl ::std::str::FromStr for ResponseToolType {
10551    type Err = self::error::ConversionError;
10552    fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
10553        match value {
10554            "function" => Ok(Self::Function),
10555            _ => Err("invalid value".into()),
10556        }
10557    }
10558}
10559impl ::std::convert::TryFrom<&str> for ResponseToolType {
10560    type Error = self::error::ConversionError;
10561    fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
10562        value.parse()
10563    }
10564}
10565impl ::std::convert::TryFrom<&::std::string::String> for ResponseToolType {
10566    type Error = self::error::ConversionError;
10567    fn try_from(
10568        value: &::std::string::String,
10569    ) -> ::std::result::Result<Self, self::error::ConversionError> {
10570        value.parse()
10571    }
10572}
10573impl ::std::convert::TryFrom<::std::string::String> for ResponseToolType {
10574    type Error = self::error::ConversionError;
10575    fn try_from(
10576        value: ::std::string::String,
10577    ) -> ::std::result::Result<Self, self::error::ConversionError> {
10578        value.parse()
10579    }
10580}
10581///Token usage details for the response.
10582///
10583/// <details><summary>JSON schema</summary>
10584///
10585/// ```json
10586///{
10587///  "description": "Token usage details for the response.",
10588///  "type": "object",
10589///  "required": [
10590///    "input_tokens",
10591///    "output_tokens",
10592///    "total_tokens"
10593///  ],
10594///  "properties": {
10595///    "input_tokens": {
10596///      "description": "The number of input tokens.",
10597///      "default": 0,
10598///      "type": "integer",
10599///      "format": "int64"
10600///    },
10601///    "input_tokens_details": {
10602///      "description": "A detailed breakdown of the input tokens.",
10603///      "type": "object",
10604///      "properties": {
10605///        "cached_tokens": {
10606///          "description": "The number of tokens retrieved from the cache.",
10607///          "default": 0,
10608///          "type": "integer",
10609///          "format": "int64"
10610///        }
10611///      }
10612///    },
10613///    "output_tokens": {
10614///      "description": "The number of output tokens.",
10615///      "default": 0,
10616///      "type": "integer",
10617///      "format": "int64"
10618///    },
10619///    "output_tokens_details": {
10620///      "description": "A detailed breakdown of the output tokens.",
10621///      "type": "object",
10622///      "properties": {
10623///        "reasoning_tokens": {
10624///          "description": "The number of reasoning tokens.",
10625///          "default": 0,
10626///          "type": "integer",
10627///          "format": "int64"
10628///        }
10629///      }
10630///    },
10631///    "total_tokens": {
10632///      "description": "The total number of tokens used (input + output).",
10633///      "default": 0,
10634///      "type": "integer",
10635///      "format": "int64"
10636///    }
10637///  }
10638///}
10639/// ```
10640/// </details>
10641#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
10642pub struct ResponseUsage {
10643    ///The number of input tokens.
10644    pub input_tokens: i64,
10645    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
10646    pub input_tokens_details: ::std::option::Option<ResponseUsageInputTokensDetails>,
10647    ///The number of output tokens.
10648    pub output_tokens: i64,
10649    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
10650    pub output_tokens_details: ::std::option::Option<ResponseUsageOutputTokensDetails>,
10651    ///The total number of tokens used (input + output).
10652    pub total_tokens: i64,
10653}
10654///A detailed breakdown of the input tokens.
10655///
10656/// <details><summary>JSON schema</summary>
10657///
10658/// ```json
10659///{
10660///  "description": "A detailed breakdown of the input tokens.",
10661///  "type": "object",
10662///  "properties": {
10663///    "cached_tokens": {
10664///      "description": "The number of tokens retrieved from the cache.",
10665///      "default": 0,
10666///      "type": "integer",
10667///      "format": "int64"
10668///    }
10669///  }
10670///}
10671/// ```
10672/// </details>
10673#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
10674pub struct ResponseUsageInputTokensDetails {
10675    ///The number of tokens retrieved from the cache.
10676    #[serde(default)]
10677    pub cached_tokens: i64,
10678}
10679impl ::std::default::Default for ResponseUsageInputTokensDetails {
10680    fn default() -> Self {
10681        Self {
10682            cached_tokens: Default::default(),
10683        }
10684    }
10685}
10686///A detailed breakdown of the output tokens.
10687///
10688/// <details><summary>JSON schema</summary>
10689///
10690/// ```json
10691///{
10692///  "description": "A detailed breakdown of the output tokens.",
10693///  "type": "object",
10694///  "properties": {
10695///    "reasoning_tokens": {
10696///      "description": "The number of reasoning tokens.",
10697///      "default": 0,
10698///      "type": "integer",
10699///      "format": "int64"
10700///    }
10701///  }
10702///}
10703/// ```
10704/// </details>
10705#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
10706pub struct ResponseUsageOutputTokensDetails {
10707    ///The number of reasoning tokens.
10708    #[serde(default)]
10709    pub reasoning_tokens: i64,
10710}
10711impl ::std::default::Default for ResponseUsageOutputTokensDetails {
10712    fn default() -> Self {
10713        Self {
10714            reasoning_tokens: Default::default(),
10715        }
10716    }
10717}
10718///`SsEvent`
10719///
10720/// <details><summary>JSON schema</summary>
10721///
10722/// ```json
10723///{
10724///  "type": "object",
10725///  "properties": {
10726///    "data": {
10727///      "type": "string",
10728///      "format": "byte"
10729///    },
10730///    "event": {
10731///      "type": "string",
10732///      "enum": [
10733///        "message-start",
10734///        "stream-start",
10735///        "content-start",
10736///        "content-delta",
10737///        "content-end",
10738///        "message-end",
10739///        "stream-end"
10740///      ]
10741///    },
10742///    "retry": {
10743///      "type": "integer"
10744///    }
10745///  }
10746///}
10747/// ```
10748/// </details>
10749#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
10750pub struct SsEvent {
10751    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
10752    pub data: ::std::option::Option<::std::string::String>,
10753    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
10754    pub event: ::std::option::Option<SsEventEvent>,
10755    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
10756    pub retry: ::std::option::Option<i64>,
10757}
10758impl ::std::default::Default for SsEvent {
10759    fn default() -> Self {
10760        Self {
10761            data: Default::default(),
10762            event: Default::default(),
10763            retry: Default::default(),
10764        }
10765    }
10766}
10767///`SsEventEvent`
10768///
10769/// <details><summary>JSON schema</summary>
10770///
10771/// ```json
10772///{
10773///  "type": "string",
10774///  "enum": [
10775///    "message-start",
10776///    "stream-start",
10777///    "content-start",
10778///    "content-delta",
10779///    "content-end",
10780///    "message-end",
10781///    "stream-end"
10782///  ]
10783///}
10784/// ```
10785/// </details>
10786#[derive(
10787    ::serde::Deserialize,
10788    ::serde::Serialize,
10789    Clone,
10790    Copy,
10791    Debug,
10792    Eq,
10793    Hash,
10794    Ord,
10795    PartialEq,
10796    PartialOrd,
10797)]
10798pub enum SsEventEvent {
10799    #[serde(rename = "message-start")]
10800    MessageStart,
10801    #[serde(rename = "stream-start")]
10802    StreamStart,
10803    #[serde(rename = "content-start")]
10804    ContentStart,
10805    #[serde(rename = "content-delta")]
10806    ContentDelta,
10807    #[serde(rename = "content-end")]
10808    ContentEnd,
10809    #[serde(rename = "message-end")]
10810    MessageEnd,
10811    #[serde(rename = "stream-end")]
10812    StreamEnd,
10813}
10814impl ::std::fmt::Display for SsEventEvent {
10815    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
10816        match *self {
10817            Self::MessageStart => f.write_str("message-start"),
10818            Self::StreamStart => f.write_str("stream-start"),
10819            Self::ContentStart => f.write_str("content-start"),
10820            Self::ContentDelta => f.write_str("content-delta"),
10821            Self::ContentEnd => f.write_str("content-end"),
10822            Self::MessageEnd => f.write_str("message-end"),
10823            Self::StreamEnd => f.write_str("stream-end"),
10824        }
10825    }
10826}
10827impl ::std::str::FromStr for SsEventEvent {
10828    type Err = self::error::ConversionError;
10829    fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
10830        match value {
10831            "message-start" => Ok(Self::MessageStart),
10832            "stream-start" => Ok(Self::StreamStart),
10833            "content-start" => Ok(Self::ContentStart),
10834            "content-delta" => Ok(Self::ContentDelta),
10835            "content-end" => Ok(Self::ContentEnd),
10836            "message-end" => Ok(Self::MessageEnd),
10837            "stream-end" => Ok(Self::StreamEnd),
10838            _ => Err("invalid value".into()),
10839        }
10840    }
10841}
10842impl ::std::convert::TryFrom<&str> for SsEventEvent {
10843    type Error = self::error::ConversionError;
10844    fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
10845        value.parse()
10846    }
10847}
10848impl ::std::convert::TryFrom<&::std::string::String> for SsEventEvent {
10849    type Error = self::error::ConversionError;
10850    fn try_from(
10851        value: &::std::string::String,
10852    ) -> ::std::result::Result<Self, self::error::ConversionError> {
10853        value.parse()
10854    }
10855}
10856impl ::std::convert::TryFrom<::std::string::String> for SsEventEvent {
10857    type Error = self::error::ConversionError;
10858    fn try_from(
10859        value: ::std::string::String,
10860    ) -> ::std::result::Result<Self, self::error::ConversionError> {
10861        value.parse()
10862    }
10863}
10864///Text content part
10865///
10866/// <details><summary>JSON schema</summary>
10867///
10868/// ```json
10869///{
10870///  "description": "Text content part",
10871///  "type": "object",
10872///  "required": [
10873///    "text",
10874///    "type"
10875///  ],
10876///  "properties": {
10877///    "text": {
10878///      "description": "The text content",
10879///      "type": "string"
10880///    },
10881///    "type": {
10882///      "description": "Content type identifier",
10883///      "type": "string",
10884///      "enum": [
10885///        "text"
10886///      ]
10887///    }
10888///  }
10889///}
10890/// ```
10891/// </details>
10892#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
10893pub struct TextContentPart {
10894    ///The text content
10895    pub text: ::std::string::String,
10896    ///Content type identifier
10897    #[serde(rename = "type")]
10898    pub type_: TextContentPartType,
10899}
10900///Content type identifier
10901///
10902/// <details><summary>JSON schema</summary>
10903///
10904/// ```json
10905///{
10906///  "description": "Content type identifier",
10907///  "type": "string",
10908///  "enum": [
10909///    "text"
10910///  ]
10911///}
10912/// ```
10913/// </details>
10914#[derive(
10915    ::serde::Deserialize,
10916    ::serde::Serialize,
10917    Clone,
10918    Copy,
10919    Debug,
10920    Eq,
10921    Hash,
10922    Ord,
10923    PartialEq,
10924    PartialOrd,
10925)]
10926pub enum TextContentPartType {
10927    #[serde(rename = "text")]
10928    Text,
10929}
10930impl ::std::fmt::Display for TextContentPartType {
10931    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
10932        match *self {
10933            Self::Text => f.write_str("text"),
10934        }
10935    }
10936}
10937impl ::std::str::FromStr for TextContentPartType {
10938    type Err = self::error::ConversionError;
10939    fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
10940        match value {
10941            "text" => Ok(Self::Text),
10942            _ => Err("invalid value".into()),
10943        }
10944    }
10945}
10946impl ::std::convert::TryFrom<&str> for TextContentPartType {
10947    type Error = self::error::ConversionError;
10948    fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
10949        value.parse()
10950    }
10951}
10952impl ::std::convert::TryFrom<&::std::string::String> for TextContentPartType {
10953    type Error = self::error::ConversionError;
10954    fn try_from(
10955        value: &::std::string::String,
10956    ) -> ::std::result::Result<Self, self::error::ConversionError> {
10957        value.parse()
10958    }
10959}
10960impl ::std::convert::TryFrom<::std::string::String> for TextContentPartType {
10961    type Error = self::error::ConversionError;
10962    fn try_from(
10963        value: ::std::string::String,
10964    ) -> ::std::result::Result<Self, self::error::ConversionError> {
10965        value.parse()
10966    }
10967}
10968/**Provider-specific opaque data attached to a tool call. The contents are
10969not interpreted by the gateway, but must be echoed back verbatim on the
10970next request that references this tool call. Currently used by Google
10971Gemini extended-thinking models to carry the per-call `thought_signature`.
10972Other providers may ignore the field.
10973*/
10974///
10975/// <details><summary>JSON schema</summary>
10976///
10977/// ```json
10978///{
10979///  "description": "Provider-specific opaque data attached to a tool call. The contents are\nnot interpreted by the gateway, but must be echoed back verbatim on the\nnext request that references this tool call. Currently used by Google\nGemini extended-thinking models to carry the per-call `thought_signature`.\nOther providers may ignore the field.\n",
10980///  "type": "object",
10981///  "properties": {
10982///    "google": {
10983///      "description": "Google Gemini-specific extra content.",
10984///      "type": "object",
10985///      "properties": {
10986///        "thought_signature": {
10987///          "description": "Opaque signature returned with reasoning-enabled tool calls.\nMust be echoed back verbatim in the next request that includes\nthis tool call, or Google will reject the request.\n",
10988///          "type": "string"
10989///        }
10990///      },
10991///      "additionalProperties": true
10992///    }
10993///  }
10994///}
10995/// ```
10996/// </details>
10997#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
10998pub struct ToolCallExtraContent {
10999    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
11000    pub google: ::std::option::Option<ToolCallExtraContentGoogle>,
11001}
11002impl ::std::default::Default for ToolCallExtraContent {
11003    fn default() -> Self {
11004        Self {
11005            google: Default::default(),
11006        }
11007    }
11008}
11009///Google Gemini-specific extra content.
11010///
11011/// <details><summary>JSON schema</summary>
11012///
11013/// ```json
11014///{
11015///  "description": "Google Gemini-specific extra content.",
11016///  "type": "object",
11017///  "properties": {
11018///    "thought_signature": {
11019///      "description": "Opaque signature returned with reasoning-enabled tool calls.\nMust be echoed back verbatim in the next request that includes\nthis tool call, or Google will reject the request.\n",
11020///      "type": "string"
11021///    }
11022///  },
11023///  "additionalProperties": true
11024///}
11025/// ```
11026/// </details>
11027#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
11028pub struct ToolCallExtraContentGoogle {
11029    /**Opaque signature returned with reasoning-enabled tool calls.
11030    Must be echoed back verbatim in the next request that includes
11031    this tool call, or Google will reject the request.
11032    */
11033    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
11034    pub thought_signature: ::std::option::Option<::std::string::String>,
11035}
11036impl ::std::default::Default for ToolCallExtraContentGoogle {
11037    fn default() -> Self {
11038        Self {
11039            thought_signature: Default::default(),
11040        }
11041    }
11042}
11043/// Generation of default values for serde.
11044pub mod defaults {
11045    pub(super) fn default_bool<const V: bool>() -> bool {
11046        V
11047    }
11048    pub(super) fn default_i64<T, const V: i64>() -> T
11049    where
11050        T: ::std::convert::TryFrom<i64>,
11051        <T as ::std::convert::TryFrom<i64>>::Error: ::std::fmt::Debug,
11052    {
11053        T::try_from(V).unwrap()
11054    }
11055    pub(super) fn default_nzu64<T, const V: u64>() -> T
11056    where
11057        T: ::std::convert::TryFrom<::std::num::NonZeroU64>,
11058        <T as ::std::convert::TryFrom<::std::num::NonZeroU64>>::Error: ::std::fmt::Debug,
11059    {
11060        T::try_from(::std::num::NonZeroU64::try_from(V).unwrap()).unwrap()
11061    }
11062    pub(super) fn create_chat_completion_request_frequency_penalty() -> f64 {
11063        0_f64
11064    }
11065    pub(super) fn create_chat_completion_request_presence_penalty() -> f64 {
11066        0_f64
11067    }
11068    pub(super) fn create_chat_completion_request_temperature() -> f64 {
11069        1_f64
11070    }
11071    pub(super) fn create_chat_completion_request_top_p() -> f64 {
11072        1_f64
11073    }
11074    pub(super) fn create_image_request_response_format() -> super::CreateImageRequestResponseFormat
11075    {
11076        super::CreateImageRequestResponseFormat::Url
11077    }
11078    pub(super) fn create_response_request_temperature() -> f32 {
11079        1_f32
11080    }
11081    pub(super) fn create_response_request_top_p() -> f32 {
11082        1_f32
11083    }
11084    pub(super) fn create_speech_request_language() -> super::CreateSpeechRequestLanguage {
11085        super::CreateSpeechRequestLanguage("en".to_string())
11086    }
11087    pub(super) fn create_speech_request_response_format() -> super::CreateSpeechRequestResponseFormat
11088    {
11089        super::CreateSpeechRequestResponseFormat::Mp3
11090    }
11091    pub(super) fn create_speech_request_speed() -> f64 {
11092        1_f64
11093    }
11094    pub(super) fn image_url_detail() -> super::ImageUrlDetail {
11095        super::ImageUrlDetail::Auto
11096    }
11097    pub(super) fn response_input_image_detail() -> super::ResponseInputImageDetail {
11098        super::ResponseInputImageDetail::Auto
11099    }
11100    pub(super) fn response_input_item_type() -> ::std::string::String {
11101        "message".to_string()
11102    }
11103    pub(super) fn response_reasoning_effort() -> super::ResponseReasoningEffort {
11104        super::ResponseReasoningEffort::Medium
11105    }
11106}