Skip to main content

defect_llm/wire/
openai.rs

1// @generated by defect-llm-codegen — do not edit by hand.
2// Source OAS: crates/llm/oas/openai.yaml
3// Re-run via `cargo run -p defect-llm-codegen -- openai`.
4#![allow(
5    clippy::manual_async_fn,
6    clippy::needless_return,
7    clippy::single_match,
8    clippy::match_single_binding,
9    clippy::too_many_arguments,
10    clippy::large_enum_variant,
11    clippy::enum_variant_names,
12    dead_code,
13    unused_imports,
14    rustdoc::bare_urls,
15    rustdoc::broken_intra_doc_links
16)]
17
18/// # OpenAI API
19///
20/// The OpenAI REST API. Please see https://platform.openai.com/docs/api-reference for more details.
21///
22/// - **Version:** `2.3.0`
23/// - **Terms of Service:** <https://openai.com/policies/terms-of-use>
24/// - **Contact:** OpenAI Support <https://help.openai.com/>
25/// - **License:** MIT <https://github.com/openai/openai-openapi/blob/master/LICENSE>
26pub mod spec {}
27pub mod components {
28    #![allow(deprecated)]
29    #![allow(unreachable_patterns)]
30    #![allow(non_camel_case_types)]
31    #![allow(non_snake_case)]
32    #![allow(clippy::all, clippy::pedantic)]
33    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
34    #[serde(untagged)]
35    pub enum ChatCompletionStreamResponseDeltaContent {
36        ChatCompletionStreamResponseDeltaContentVariant0(String),
37        ChatCompletionStreamResponseDeltaContentVariant1(Option<::serde_json::Value>),
38    }
39    impl ::std::convert::From<String> for ChatCompletionStreamResponseDeltaContent {
40        fn from(value: String) -> Self {
41            ChatCompletionStreamResponseDeltaContent::ChatCompletionStreamResponseDeltaContentVariant0(
42                value,
43            )
44        }
45    }
46    impl ::std::convert::TryFrom<ChatCompletionStreamResponseDeltaContent> for String {
47        type Error = ChatCompletionStreamResponseDeltaContent;
48        /// # Errors
49        ///
50        /// Returns the original enum value if it does not match the
51        /// `#variant_ident` variant.
52        fn try_from(
53            value: ChatCompletionStreamResponseDeltaContent,
54        ) -> ::std::result::Result<Self, Self::Error> {
55            match value {
56                ChatCompletionStreamResponseDeltaContent::ChatCompletionStreamResponseDeltaContentVariant0(
57                    inner,
58                ) => ::std::result::Result::Ok(inner),
59                other => ::std::result::Result::Err(other),
60            }
61        }
62    }
63    impl ::std::convert::From<Option<::serde_json::Value>>
64        for ChatCompletionStreamResponseDeltaContent
65    {
66        fn from(value: Option<::serde_json::Value>) -> Self {
67            ChatCompletionStreamResponseDeltaContent::ChatCompletionStreamResponseDeltaContentVariant1(
68                value,
69            )
70        }
71    }
72    impl ::std::convert::TryFrom<ChatCompletionStreamResponseDeltaContent>
73        for Option<::serde_json::Value>
74    {
75        type Error = ChatCompletionStreamResponseDeltaContent;
76        /// # Errors
77        ///
78        /// Returns the original enum value if it does not match the
79        /// `#variant_ident` variant.
80        fn try_from(
81            value: ChatCompletionStreamResponseDeltaContent,
82        ) -> ::std::result::Result<Self, Self::Error> {
83            match value {
84                ChatCompletionStreamResponseDeltaContent::ChatCompletionStreamResponseDeltaContentVariant1(
85                    inner,
86                ) => ::std::result::Result::Ok(inner),
87                other => ::std::result::Result::Err(other),
88            }
89        }
90    }
91    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
92    #[deprecated]
93    /// Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model.
94    pub struct ChatCompletionStreamResponseDeltaFunctionCall {
95        #[serde(skip_serializing_if = "Option::is_none")]
96        /// 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.
97        pub arguments: Option<String>,
98        #[serde(skip_serializing_if = "Option::is_none")]
99        /// The name of the function to call.
100        pub name: Option<String>,
101    }
102    /// The type of the tool. Currently, only `function` is supported.
103    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
104    pub enum ChatCompletionMessageToolCallChunkType {
105        #[serde(rename = "function")]
106        Function,
107    }
108    impl ::std::fmt::Display for ChatCompletionMessageToolCallChunkType {
109        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
110            match self {
111                Self::Function => ::std::write!(__f, "function"),
112            }
113        }
114    }
115    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
116    pub struct ChatCompletionMessageToolCallChunkFunction {
117        #[serde(skip_serializing_if = "Option::is_none")]
118        /// The name of the function to call.
119        pub name: Option<String>,
120        #[serde(skip_serializing_if = "Option::is_none")]
121        /// 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.
122        pub arguments: Option<String>,
123    }
124    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
125    pub struct ChatCompletionMessageToolCallChunk {
126        pub index: i64,
127        #[serde(skip_serializing_if = "Option::is_none")]
128        /// The ID of the tool call.
129        pub id: Option<String>,
130        #[serde(skip_serializing_if = "Option::is_none")]
131        /// The type of the tool. Currently, only `function` is supported.
132        pub r#type: Option<ChatCompletionMessageToolCallChunkType>,
133        #[serde(skip_serializing_if = "Option::is_none")]
134        pub function: Option<ChatCompletionMessageToolCallChunkFunction>,
135    }
136    /// The role of the author of this message.
137    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
138    pub enum ChatCompletionStreamResponseDeltaRole {
139        #[serde(rename = "developer")]
140        Developer,
141        #[serde(rename = "system")]
142        System,
143        #[serde(rename = "user")]
144        User,
145        #[serde(rename = "assistant")]
146        Assistant,
147        #[serde(rename = "tool")]
148        Tool,
149    }
150    impl ::std::fmt::Display for ChatCompletionStreamResponseDeltaRole {
151        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
152            match self {
153                Self::Developer => ::std::write!(__f, "developer"),
154                Self::System => ::std::write!(__f, "system"),
155                Self::User => ::std::write!(__f, "user"),
156                Self::Assistant => ::std::write!(__f, "assistant"),
157                Self::Tool => ::std::write!(__f, "tool"),
158            }
159        }
160    }
161    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
162    #[serde(untagged)]
163    pub enum ChatCompletionStreamResponseDeltaRefusal {
164        ChatCompletionStreamResponseDeltaRefusalVariant0(String),
165        ChatCompletionStreamResponseDeltaRefusalVariant1(Option<::serde_json::Value>),
166    }
167    impl ::std::convert::From<String> for ChatCompletionStreamResponseDeltaRefusal {
168        fn from(value: String) -> Self {
169            ChatCompletionStreamResponseDeltaRefusal::ChatCompletionStreamResponseDeltaRefusalVariant0(
170                value,
171            )
172        }
173    }
174    impl ::std::convert::TryFrom<ChatCompletionStreamResponseDeltaRefusal> for String {
175        type Error = ChatCompletionStreamResponseDeltaRefusal;
176        /// # Errors
177        ///
178        /// Returns the original enum value if it does not match the
179        /// `#variant_ident` variant.
180        fn try_from(
181            value: ChatCompletionStreamResponseDeltaRefusal,
182        ) -> ::std::result::Result<Self, Self::Error> {
183            match value {
184                ChatCompletionStreamResponseDeltaRefusal::ChatCompletionStreamResponseDeltaRefusalVariant0(
185                    inner,
186                ) => ::std::result::Result::Ok(inner),
187                other => ::std::result::Result::Err(other),
188            }
189        }
190    }
191    impl ::std::convert::From<Option<::serde_json::Value>>
192        for ChatCompletionStreamResponseDeltaRefusal
193    {
194        fn from(value: Option<::serde_json::Value>) -> Self {
195            ChatCompletionStreamResponseDeltaRefusal::ChatCompletionStreamResponseDeltaRefusalVariant1(
196                value,
197            )
198        }
199    }
200    impl ::std::convert::TryFrom<ChatCompletionStreamResponseDeltaRefusal>
201        for Option<::serde_json::Value>
202    {
203        type Error = ChatCompletionStreamResponseDeltaRefusal;
204        /// # Errors
205        ///
206        /// Returns the original enum value if it does not match the
207        /// `#variant_ident` variant.
208        fn try_from(
209            value: ChatCompletionStreamResponseDeltaRefusal,
210        ) -> ::std::result::Result<Self, Self::Error> {
211            match value {
212                ChatCompletionStreamResponseDeltaRefusal::ChatCompletionStreamResponseDeltaRefusalVariant1(
213                    inner,
214                ) => ::std::result::Result::Ok(inner),
215                other => ::std::result::Result::Err(other),
216            }
217        }
218    }
219    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
220    /// A chat completion delta generated by streamed model responses.
221    pub struct ChatCompletionStreamResponseDelta {
222        #[serde(skip_serializing_if = "Option::is_none")]
223        pub content: Option<ChatCompletionStreamResponseDeltaContent>,
224        #[serde(skip_serializing_if = "Option::is_none")]
225        /// Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model.
226        #[deprecated]
227        pub function_call: Option<ChatCompletionStreamResponseDeltaFunctionCall>,
228        #[serde(skip_serializing_if = "Option::is_none")]
229        pub tool_calls: Option<Vec<ChatCompletionMessageToolCallChunk>>,
230        #[serde(skip_serializing_if = "Option::is_none")]
231        /// The role of the author of this message.
232        pub role: Option<ChatCompletionStreamResponseDeltaRole>,
233        #[serde(skip_serializing_if = "Option::is_none")]
234        pub refusal: Option<ChatCompletionStreamResponseDeltaRefusal>,
235    }
236    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
237    #[serde(untagged)]
238    pub enum ChatCompletionTokenLogprobBytes {
239        ChatCompletionTokenLogprobBytesVariant0(Vec<i64>),
240        ChatCompletionTokenLogprobBytesVariant1(Option<::serde_json::Value>),
241    }
242    impl ::std::convert::From<Vec<i64>> for ChatCompletionTokenLogprobBytes {
243        fn from(value: Vec<i64>) -> Self {
244            ChatCompletionTokenLogprobBytes::ChatCompletionTokenLogprobBytesVariant0(value)
245        }
246    }
247    impl ::std::convert::TryFrom<ChatCompletionTokenLogprobBytes> for Vec<i64> {
248        type Error = ChatCompletionTokenLogprobBytes;
249        /// # Errors
250        ///
251        /// Returns the original enum value if it does not match the
252        /// `#variant_ident` variant.
253        fn try_from(
254            value: ChatCompletionTokenLogprobBytes,
255        ) -> ::std::result::Result<Self, Self::Error> {
256            match value {
257                ChatCompletionTokenLogprobBytes::ChatCompletionTokenLogprobBytesVariant0(inner) => {
258                    ::std::result::Result::Ok(inner)
259                }
260                other => ::std::result::Result::Err(other),
261            }
262        }
263    }
264    impl ::std::convert::From<Option<::serde_json::Value>> for ChatCompletionTokenLogprobBytes {
265        fn from(value: Option<::serde_json::Value>) -> Self {
266            ChatCompletionTokenLogprobBytes::ChatCompletionTokenLogprobBytesVariant1(value)
267        }
268    }
269    impl ::std::convert::TryFrom<ChatCompletionTokenLogprobBytes> for Option<::serde_json::Value> {
270        type Error = ChatCompletionTokenLogprobBytes;
271        /// # Errors
272        ///
273        /// Returns the original enum value if it does not match the
274        /// `#variant_ident` variant.
275        fn try_from(
276            value: ChatCompletionTokenLogprobBytes,
277        ) -> ::std::result::Result<Self, Self::Error> {
278            match value {
279                ChatCompletionTokenLogprobBytes::ChatCompletionTokenLogprobBytesVariant1(inner) => {
280                    ::std::result::Result::Ok(inner)
281                }
282                other => ::std::result::Result::Err(other),
283            }
284        }
285    }
286    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
287    #[serde(untagged)]
288    pub enum ChatCompletionTokenLogprobTopLogprobsBytes {
289        ChatCompletionTokenLogprobTopLogprobsBytesVariant0(Vec<i64>),
290        ChatCompletionTokenLogprobTopLogprobsBytesVariant1(Option<::serde_json::Value>),
291    }
292    impl ::std::convert::From<Vec<i64>> for ChatCompletionTokenLogprobTopLogprobsBytes {
293        fn from(value: Vec<i64>) -> Self {
294            ChatCompletionTokenLogprobTopLogprobsBytes::ChatCompletionTokenLogprobTopLogprobsBytesVariant0(
295                value,
296            )
297        }
298    }
299    impl ::std::convert::TryFrom<ChatCompletionTokenLogprobTopLogprobsBytes> for Vec<i64> {
300        type Error = ChatCompletionTokenLogprobTopLogprobsBytes;
301        /// # Errors
302        ///
303        /// Returns the original enum value if it does not match the
304        /// `#variant_ident` variant.
305        fn try_from(
306            value: ChatCompletionTokenLogprobTopLogprobsBytes,
307        ) -> ::std::result::Result<Self, Self::Error> {
308            match value {
309                ChatCompletionTokenLogprobTopLogprobsBytes::ChatCompletionTokenLogprobTopLogprobsBytesVariant0(
310                    inner,
311                ) => ::std::result::Result::Ok(inner),
312                other => ::std::result::Result::Err(other),
313            }
314        }
315    }
316    impl ::std::convert::From<Option<::serde_json::Value>>
317        for ChatCompletionTokenLogprobTopLogprobsBytes
318    {
319        fn from(value: Option<::serde_json::Value>) -> Self {
320            ChatCompletionTokenLogprobTopLogprobsBytes::ChatCompletionTokenLogprobTopLogprobsBytesVariant1(
321                value,
322            )
323        }
324    }
325    impl ::std::convert::TryFrom<ChatCompletionTokenLogprobTopLogprobsBytes>
326        for Option<::serde_json::Value>
327    {
328        type Error = ChatCompletionTokenLogprobTopLogprobsBytes;
329        /// # Errors
330        ///
331        /// Returns the original enum value if it does not match the
332        /// `#variant_ident` variant.
333        fn try_from(
334            value: ChatCompletionTokenLogprobTopLogprobsBytes,
335        ) -> ::std::result::Result<Self, Self::Error> {
336            match value {
337                ChatCompletionTokenLogprobTopLogprobsBytes::ChatCompletionTokenLogprobTopLogprobsBytesVariant1(
338                    inner,
339                ) => ::std::result::Result::Ok(inner),
340                other => ::std::result::Result::Err(other),
341            }
342        }
343    }
344    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
345    pub struct ChatCompletionTokenLogprobTopLogprobs {
346        /// The token.
347        pub token: String,
348        /// 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.
349        pub logprob: f64,
350        pub bytes: ChatCompletionTokenLogprobTopLogprobsBytes,
351    }
352    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
353    pub struct ChatCompletionTokenLogprob {
354        /// The token.
355        pub token: String,
356        /// 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.
357        pub logprob: f64,
358        pub bytes: ChatCompletionTokenLogprobBytes,
359        /// List of the most likely tokens and their log probability, at this token position. The number of entries may be fewer than the requested `top_logprobs`.
360        pub top_logprobs: Vec<ChatCompletionTokenLogprobTopLogprobs>,
361    }
362    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
363    /// Log probability information for the choice.
364    pub struct CreateChatCompletionStreamResponseChoicesLogprobs {
365        /// A list of message content tokens with log probability information.
366        pub content: Vec<ChatCompletionTokenLogprob>,
367        /// A list of message refusal tokens with log probability information.
368        pub refusal: Vec<ChatCompletionTokenLogprob>,
369    }
370    /// The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence,
371    /// `length` if the maximum number of tokens specified in the request was reached,
372    /// `content_filter` if content was omitted due to a flag from our content filters,
373    /// `tool_calls` if the model called a tool, or `function_call` (deprecated) if the model called a function.
374    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
375    pub enum CreateChatCompletionStreamResponseChoicesFinishReason {
376        #[serde(rename = "stop")]
377        Stop,
378        #[serde(rename = "length")]
379        Length,
380        #[serde(rename = "tool_calls")]
381        ToolCalls,
382        #[serde(rename = "content_filter")]
383        ContentFilter,
384        #[serde(rename = "function_call")]
385        FunctionCall,
386    }
387    impl ::std::fmt::Display for CreateChatCompletionStreamResponseChoicesFinishReason {
388        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
389            match self {
390                Self::Stop => ::std::write!(__f, "stop"),
391                Self::Length => ::std::write!(__f, "length"),
392                Self::ToolCalls => ::std::write!(__f, "tool_calls"),
393                Self::ContentFilter => ::std::write!(__f, "content_filter"),
394                Self::FunctionCall => ::std::write!(__f, "function_call"),
395            }
396        }
397    }
398    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
399    pub struct CreateChatCompletionStreamResponseChoices {
400        pub delta: ChatCompletionStreamResponseDelta,
401        #[serde(skip_serializing_if = "Option::is_none")]
402        /// Log probability information for the choice.
403        pub logprobs: Option<CreateChatCompletionStreamResponseChoicesLogprobs>,
404        #[serde(skip_serializing_if = "Option::is_none")]
405        /// The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence,
406        /// `length` if the maximum number of tokens specified in the request was reached,
407        /// `content_filter` if content was omitted due to a flag from our content filters,
408        /// `tool_calls` if the model called a tool, or `function_call` (deprecated) if the model called a function.
409        pub finish_reason: Option<CreateChatCompletionStreamResponseChoicesFinishReason>,
410        /// The index of the choice in the list of choices.
411        pub index: i64,
412    }
413    /// Specifies the processing type used for serving the request.
414    ///   - If set to 'auto', then the request will be processed with the service tier configured in the Project settings. Unless otherwise configured, the Project will use 'default'.
415    ///   - If set to 'default', then the request will be processed with the standard pricing and performance for the selected model.
416    ///   - If set to '[flex](/docs/guides/flex-processing)' or '[priority](https://openai.com/api-priority-processing/)', then the request will be processed with the corresponding service tier.
417    ///   - When not set, the default behavior is 'auto'.
418    ///
419    ///   When the `service_tier` parameter is set, the response body will include the `service_tier` value based on the processing mode actually used to serve the request. This response value may be different from the value set in the parameter.
420    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
421    pub enum ServiceTierVariant0 {
422        #[serde(rename = "auto")]
423        Auto,
424        #[serde(rename = "default")]
425        Default,
426        #[serde(rename = "flex")]
427        Flex,
428        #[serde(rename = "scale")]
429        Scale,
430        #[serde(rename = "priority")]
431        Priority,
432    }
433    impl ::std::fmt::Display for ServiceTierVariant0 {
434        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
435            match self {
436                Self::Auto => ::std::write!(__f, "auto"),
437                Self::Default => ::std::write!(__f, "default"),
438                Self::Flex => ::std::write!(__f, "flex"),
439                Self::Scale => ::std::write!(__f, "scale"),
440                Self::Priority => ::std::write!(__f, "priority"),
441            }
442        }
443    }
444    impl ::std::convert::From<ServiceTierVariant0> for ServiceTier {
445        fn from(value: ServiceTierVariant0) -> Self {
446            ServiceTier::ServiceTierVariant0(value)
447        }
448    }
449    impl ::std::convert::TryFrom<ServiceTier> for ServiceTierVariant0 {
450        type Error = ServiceTier;
451        /// # Errors
452        ///
453        /// Returns the original enum value if it does not match the
454        /// `#variant_ident` variant.
455        fn try_from(value: ServiceTier) -> ::std::result::Result<Self, Self::Error> {
456            match value {
457                ServiceTier::ServiceTierVariant0(inner) => ::std::result::Result::Ok(inner),
458                other => ::std::result::Result::Err(other),
459            }
460        }
461    }
462    impl ::std::convert::From<Option<::serde_json::Value>> for ServiceTier {
463        fn from(value: Option<::serde_json::Value>) -> Self {
464            ServiceTier::ServiceTierVariant1(value)
465        }
466    }
467    impl ::std::convert::TryFrom<ServiceTier> for Option<::serde_json::Value> {
468        type Error = ServiceTier;
469        /// # Errors
470        ///
471        /// Returns the original enum value if it does not match the
472        /// `#variant_ident` variant.
473        fn try_from(value: ServiceTier) -> ::std::result::Result<Self, Self::Error> {
474            match value {
475                ServiceTier::ServiceTierVariant1(inner) => ::std::result::Result::Ok(inner),
476                other => ::std::result::Result::Err(other),
477            }
478        }
479    }
480    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
481    #[serde(untagged)]
482    pub enum ServiceTier {
483        ServiceTierVariant0(ServiceTierVariant0),
484        ServiceTierVariant1(Option<::serde_json::Value>),
485    }
486    /// The object type, which is always `chat.completion.chunk`.
487    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
488    pub enum CreateChatCompletionStreamResponseObject {
489        #[serde(rename = "chat.completion.chunk")]
490        ChatCompletionChunk,
491    }
492    impl ::std::fmt::Display for CreateChatCompletionStreamResponseObject {
493        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
494            match self {
495                Self::ChatCompletionChunk => ::std::write!(__f, "chat.completion.chunk"),
496            }
497        }
498    }
499    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
500    /// Breakdown of tokens used in a completion.
501    pub struct CompletionUsageCompletionTokensDetails {
502        #[serde(skip_serializing_if = "Option::is_none")]
503        /// When using Predicted Outputs, the number of tokens in the
504        /// prediction that appeared in the completion.
505        pub accepted_prediction_tokens: Option<i64>,
506        #[serde(skip_serializing_if = "Option::is_none")]
507        /// Audio input tokens generated by the model.
508        pub audio_tokens: Option<i64>,
509        #[serde(skip_serializing_if = "Option::is_none")]
510        /// Tokens generated by the model for reasoning.
511        pub reasoning_tokens: Option<i64>,
512        #[serde(skip_serializing_if = "Option::is_none")]
513        /// When using Predicted Outputs, the number of tokens in the
514        /// prediction that did not appear in the completion. However, like
515        /// reasoning tokens, these tokens are still counted in the total
516        /// completion tokens for purposes of billing, output, and context window
517        /// limits.
518        pub rejected_prediction_tokens: Option<i64>,
519    }
520    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
521    /// Breakdown of tokens used in the prompt.
522    pub struct CompletionUsagePromptTokensDetails {
523        #[serde(skip_serializing_if = "Option::is_none")]
524        /// Audio input tokens present in the prompt.
525        pub audio_tokens: Option<i64>,
526        #[serde(skip_serializing_if = "Option::is_none")]
527        /// Cached tokens present in the prompt.
528        pub cached_tokens: Option<i64>,
529    }
530    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
531    /// Usage statistics for the completion request.
532    pub struct CompletionUsage {
533        /// Number of tokens in the generated completion.
534        pub completion_tokens: i64,
535        /// Number of tokens in the prompt.
536        pub prompt_tokens: i64,
537        /// Total number of tokens used in the request (prompt + completion).
538        pub total_tokens: i64,
539        #[serde(skip_serializing_if = "Option::is_none")]
540        /// Breakdown of tokens used in a completion.
541        pub completion_tokens_details: Option<CompletionUsageCompletionTokensDetails>,
542        #[serde(skip_serializing_if = "Option::is_none")]
543        /// Breakdown of tokens used in the prompt.
544        pub prompt_tokens_details: Option<CompletionUsagePromptTokensDetails>,
545    }
546    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
547    /// Represents a streamed chunk of a chat completion response returned
548    /// by the model, based on the provided input.
549    /// [Learn more](/docs/guides/streaming-responses).
550    pub struct CreateChatCompletionStreamResponse {
551        /// A unique identifier for the chat completion. Each chunk has the same ID.
552        pub id: String,
553        /// A list of chat completion choices. Can contain more than one elements if `n` is greater than 1. Can also be empty for the
554        /// last chunk if you set `stream_options: {"include_usage": true}`.
555        pub choices: Vec<CreateChatCompletionStreamResponseChoices>,
556        /// The Unix timestamp (in seconds) of when the chat completion was created. Each chunk has the same timestamp.
557        pub created: i64,
558        /// The model to generate the completion.
559        pub model: String,
560        #[serde(skip_serializing_if = "Option::is_none")]
561        pub service_tier: Option<ServiceTier>,
562        #[serde(skip_serializing_if = "Option::is_none")]
563        /// This fingerprint represents the backend configuration that the model runs with.
564        /// Can be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism.
565        #[deprecated]
566        pub system_fingerprint: Option<String>,
567        /// The object type, which is always `chat.completion.chunk`.
568        pub object: CreateChatCompletionStreamResponseObject,
569        #[serde(skip_serializing_if = "Option::is_none")]
570        pub usage: Option<CompletionUsage>,
571    }
572    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
573    /// Options for streaming response. Only set this when you set `stream: true`.
574    pub struct ChatCompletionStreamOptionsVariant0 {
575        #[serde(skip_serializing_if = "Option::is_none")]
576        /// If set, an additional chunk will be streamed before the `data: [DONE]`
577        /// message. The `usage` field on this chunk shows the token usage statistics
578        /// for the entire request, and the `choices` field will always be an empty
579        /// array.
580        ///
581        /// All other chunks will also include a `usage` field, but with a null
582        /// value. **NOTE:** If the stream is interrupted, you may not receive the
583        /// final usage chunk which contains the total token usage for the request.
584        pub include_usage: Option<bool>,
585        #[serde(skip_serializing_if = "Option::is_none")]
586        /// When true, stream obfuscation will be enabled. Stream obfuscation adds
587        /// random characters to an `obfuscation` field on streaming delta events to
588        /// normalize payload sizes as a mitigation to certain side-channel attacks.
589        /// These obfuscation fields are included by default, but add a small amount
590        /// of overhead to the data stream. You can set `include_obfuscation` to
591        /// false to optimize for bandwidth if you trust the network links between
592        /// your application and the OpenAI API.
593        pub include_obfuscation: Option<bool>,
594    }
595    impl ::std::convert::From<ChatCompletionStreamOptionsVariant0> for ChatCompletionStreamOptions {
596        fn from(value: ChatCompletionStreamOptionsVariant0) -> Self {
597            ChatCompletionStreamOptions::ChatCompletionStreamOptionsVariant0(value)
598        }
599    }
600    impl ::std::convert::TryFrom<ChatCompletionStreamOptions> for ChatCompletionStreamOptionsVariant0 {
601        type Error = ChatCompletionStreamOptions;
602        /// # Errors
603        ///
604        /// Returns the original enum value if it does not match the
605        /// `#variant_ident` variant.
606        fn try_from(
607            value: ChatCompletionStreamOptions,
608        ) -> ::std::result::Result<Self, Self::Error> {
609            match value {
610                ChatCompletionStreamOptions::ChatCompletionStreamOptionsVariant0(inner) => {
611                    ::std::result::Result::Ok(inner)
612                }
613                other => ::std::result::Result::Err(other),
614            }
615        }
616    }
617    impl ::std::convert::From<Option<::serde_json::Value>> for ChatCompletionStreamOptions {
618        fn from(value: Option<::serde_json::Value>) -> Self {
619            ChatCompletionStreamOptions::ChatCompletionStreamOptionsVariant1(value)
620        }
621    }
622    impl ::std::convert::TryFrom<ChatCompletionStreamOptions> for Option<::serde_json::Value> {
623        type Error = ChatCompletionStreamOptions;
624        /// # Errors
625        ///
626        /// Returns the original enum value if it does not match the
627        /// `#variant_ident` variant.
628        fn try_from(
629            value: ChatCompletionStreamOptions,
630        ) -> ::std::result::Result<Self, Self::Error> {
631            match value {
632                ChatCompletionStreamOptions::ChatCompletionStreamOptionsVariant1(inner) => {
633                    ::std::result::Result::Ok(inner)
634                }
635                other => ::std::result::Result::Err(other),
636            }
637        }
638    }
639    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
640    #[serde(untagged)]
641    pub enum ChatCompletionStreamOptions {
642        ChatCompletionStreamOptionsVariant0(ChatCompletionStreamOptionsVariant0),
643        ChatCompletionStreamOptionsVariant1(Option<::serde_json::Value>),
644    }
645    /// The type of the tool. Currently, only `function` is supported.
646    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
647    pub enum ChatCompletionToolType {
648        #[serde(rename = "function")]
649        Function,
650    }
651    impl ::std::fmt::Display for ChatCompletionToolType {
652        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
653            match self {
654                Self::Function => ::std::write!(__f, "function"),
655            }
656        }
657    }
658    /// 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.
659    ///
660    /// Omitting `parameters` defines a function with an empty parameter list.
661    pub type FunctionParameters = ::std::collections::BTreeMap<String, ::serde_json::Value>;
662    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
663    #[serde(untagged)]
664    pub enum FunctionObjectStrict {
665        FunctionObjectStrictVariant0(bool),
666        FunctionObjectStrictVariant1(Option<::serde_json::Value>),
667    }
668    impl ::std::convert::From<bool> for FunctionObjectStrict {
669        fn from(value: bool) -> Self {
670            FunctionObjectStrict::FunctionObjectStrictVariant0(value)
671        }
672    }
673    impl ::std::convert::TryFrom<FunctionObjectStrict> for bool {
674        type Error = FunctionObjectStrict;
675        /// # Errors
676        ///
677        /// Returns the original enum value if it does not match the
678        /// `#variant_ident` variant.
679        fn try_from(value: FunctionObjectStrict) -> ::std::result::Result<Self, Self::Error> {
680            match value {
681                FunctionObjectStrict::FunctionObjectStrictVariant0(inner) => {
682                    ::std::result::Result::Ok(inner)
683                }
684                other => ::std::result::Result::Err(other),
685            }
686        }
687    }
688    impl ::std::convert::From<Option<::serde_json::Value>> for FunctionObjectStrict {
689        fn from(value: Option<::serde_json::Value>) -> Self {
690            FunctionObjectStrict::FunctionObjectStrictVariant1(value)
691        }
692    }
693    impl ::std::convert::TryFrom<FunctionObjectStrict> for Option<::serde_json::Value> {
694        type Error = FunctionObjectStrict;
695        /// # Errors
696        ///
697        /// Returns the original enum value if it does not match the
698        /// `#variant_ident` variant.
699        fn try_from(value: FunctionObjectStrict) -> ::std::result::Result<Self, Self::Error> {
700            match value {
701                FunctionObjectStrict::FunctionObjectStrictVariant1(inner) => {
702                    ::std::result::Result::Ok(inner)
703                }
704                other => ::std::result::Result::Err(other),
705            }
706        }
707    }
708    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
709    pub struct FunctionObject {
710        #[serde(skip_serializing_if = "Option::is_none")]
711        /// A description of what the function does, used by the model to choose when and how to call the function.
712        pub description: Option<String>,
713        /// 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.
714        pub name: String,
715        #[serde(skip_serializing_if = "Option::is_none")]
716        pub parameters: Option<FunctionParameters>,
717        #[serde(skip_serializing_if = "Option::is_none")]
718        pub strict: Option<FunctionObjectStrict>,
719    }
720    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
721    /// # Function tool
722    /// A function tool that can be used to generate a response.
723    pub struct ChatCompletionTool {
724        /// The type of the tool. Currently, only `function` is supported.
725        pub r#type: ChatCompletionToolType,
726        pub function: FunctionObject,
727    }
728    /// # Tool choice mode
729    /// `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.
730    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
731    pub enum ChatCompletionToolChoiceOptionVariant0 {
732        #[serde(rename = "none")]
733        None,
734        #[serde(rename = "auto")]
735        Auto,
736        #[serde(rename = "required")]
737        Required,
738    }
739    impl ::std::fmt::Display for ChatCompletionToolChoiceOptionVariant0 {
740        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
741            match self {
742                Self::None => ::std::write!(__f, "none"),
743                Self::Auto => ::std::write!(__f, "auto"),
744                Self::Required => ::std::write!(__f, "required"),
745            }
746        }
747    }
748    /// Allowed tool configuration type. Always `allowed_tools`.
749    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
750    pub enum ChatCompletionAllowedToolsChoiceType {
751        #[serde(rename = "allowed_tools")]
752        AllowedTools,
753    }
754    impl ::std::fmt::Display for ChatCompletionAllowedToolsChoiceType {
755        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
756            match self {
757                Self::AllowedTools => ::std::write!(__f, "allowed_tools"),
758            }
759        }
760    }
761    /// Constrains the tools available to the model to a pre-defined set.
762    ///
763    /// `auto` allows the model to pick from among the allowed tools and generate a
764    /// message.
765    ///
766    /// `required` requires the model to call one or more of the allowed tools.
767    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
768    pub enum ChatCompletionAllowedToolsMode {
769        #[serde(rename = "auto")]
770        Auto,
771        #[serde(rename = "required")]
772        Required,
773    }
774    impl ::std::fmt::Display for ChatCompletionAllowedToolsMode {
775        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
776            match self {
777                Self::Auto => ::std::write!(__f, "auto"),
778                Self::Required => ::std::write!(__f, "required"),
779            }
780        }
781    }
782    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
783    /// # Allowed tools
784    /// Constrains the tools available to the model to a pre-defined set.
785    pub struct ChatCompletionAllowedTools {
786        /// Constrains the tools available to the model to a pre-defined set.
787        ///
788        /// `auto` allows the model to pick from among the allowed tools and generate a
789        /// message.
790        ///
791        /// `required` requires the model to call one or more of the allowed tools.
792        pub mode: ChatCompletionAllowedToolsMode,
793        /// A list of tool definitions that the model should be allowed to call.
794        ///
795        /// For the Chat Completions API, the list of tool definitions might look like:
796        /// ```json
797        /// [
798        ///   { "type": "function", "function": { "name": "get_weather" } },
799        ///   { "type": "function", "function": { "name": "get_time" } }
800        /// ]
801        /// ```
802        pub tools: Vec<::std::collections::BTreeMap<String, ::serde_json::Value>>,
803    }
804    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
805    /// # Allowed tools
806    /// Constrains the tools available to the model to a pre-defined set.
807    pub struct ChatCompletionAllowedToolsChoice {
808        /// Allowed tool configuration type. Always `allowed_tools`.
809        pub r#type: ChatCompletionAllowedToolsChoiceType,
810        pub allowed_tools: ChatCompletionAllowedTools,
811    }
812    /// For function calling, the type is always `function`.
813    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
814    pub enum ChatCompletionNamedToolChoiceType {
815        #[serde(rename = "function")]
816        Function,
817    }
818    impl ::std::fmt::Display for ChatCompletionNamedToolChoiceType {
819        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
820            match self {
821                Self::Function => ::std::write!(__f, "function"),
822            }
823        }
824    }
825    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
826    pub struct ChatCompletionNamedToolChoiceFunction {
827        /// The name of the function to call.
828        pub name: String,
829    }
830    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
831    /// # Function tool choice
832    /// Specifies a tool the model should use. Use to force the model to call a specific function.
833    pub struct ChatCompletionNamedToolChoice {
834        /// For function calling, the type is always `function`.
835        pub r#type: ChatCompletionNamedToolChoiceType,
836        pub function: ChatCompletionNamedToolChoiceFunction,
837    }
838    /// For custom tool calling, the type is always `custom`.
839    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
840    pub enum ChatCompletionNamedToolChoiceCustomType {
841        #[serde(rename = "custom")]
842        Custom,
843    }
844    impl ::std::fmt::Display for ChatCompletionNamedToolChoiceCustomType {
845        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
846            match self {
847                Self::Custom => ::std::write!(__f, "custom"),
848            }
849        }
850    }
851    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
852    pub struct ChatCompletionNamedToolChoiceCustomCustom {
853        /// The name of the custom tool to call.
854        pub name: String,
855    }
856    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
857    /// # Custom tool choice
858    /// Specifies a tool the model should use. Use to force the model to call a specific custom tool.
859    pub struct ChatCompletionNamedToolChoiceCustom {
860        /// For custom tool calling, the type is always `custom`.
861        pub r#type: ChatCompletionNamedToolChoiceCustomType,
862        pub custom: ChatCompletionNamedToolChoiceCustomCustom,
863    }
864    impl ::std::convert::From<ChatCompletionToolChoiceOptionVariant0>
865        for ChatCompletionToolChoiceOption
866    {
867        fn from(value: ChatCompletionToolChoiceOptionVariant0) -> Self {
868            ChatCompletionToolChoiceOption::ChatCompletionToolChoiceOptionVariant0(value)
869        }
870    }
871    impl ::std::convert::TryFrom<ChatCompletionToolChoiceOption>
872        for ChatCompletionToolChoiceOptionVariant0
873    {
874        type Error = ChatCompletionToolChoiceOption;
875        /// # Errors
876        ///
877        /// Returns the original enum value if it does not match the
878        /// `#variant_ident` variant.
879        fn try_from(
880            value: ChatCompletionToolChoiceOption,
881        ) -> ::std::result::Result<Self, Self::Error> {
882            match value {
883                ChatCompletionToolChoiceOption::ChatCompletionToolChoiceOptionVariant0(inner) => {
884                    ::std::result::Result::Ok(inner)
885                }
886                other => ::std::result::Result::Err(other),
887            }
888        }
889    }
890    impl ::std::convert::From<ChatCompletionAllowedToolsChoice> for ChatCompletionToolChoiceOption {
891        fn from(value: ChatCompletionAllowedToolsChoice) -> Self {
892            ChatCompletionToolChoiceOption::ChatCompletionAllowedToolsChoice(value)
893        }
894    }
895    impl ::std::convert::TryFrom<ChatCompletionToolChoiceOption> for ChatCompletionAllowedToolsChoice {
896        type Error = ChatCompletionToolChoiceOption;
897        /// # Errors
898        ///
899        /// Returns the original enum value if it does not match the
900        /// `#variant_ident` variant.
901        fn try_from(
902            value: ChatCompletionToolChoiceOption,
903        ) -> ::std::result::Result<Self, Self::Error> {
904            match value {
905                ChatCompletionToolChoiceOption::ChatCompletionAllowedToolsChoice(inner) => {
906                    ::std::result::Result::Ok(inner)
907                }
908                other => ::std::result::Result::Err(other),
909            }
910        }
911    }
912    impl ::std::convert::From<ChatCompletionNamedToolChoice> for ChatCompletionToolChoiceOption {
913        fn from(value: ChatCompletionNamedToolChoice) -> Self {
914            ChatCompletionToolChoiceOption::ChatCompletionNamedToolChoice(value)
915        }
916    }
917    impl ::std::convert::TryFrom<ChatCompletionToolChoiceOption> for ChatCompletionNamedToolChoice {
918        type Error = ChatCompletionToolChoiceOption;
919        /// # Errors
920        ///
921        /// Returns the original enum value if it does not match the
922        /// `#variant_ident` variant.
923        fn try_from(
924            value: ChatCompletionToolChoiceOption,
925        ) -> ::std::result::Result<Self, Self::Error> {
926            match value {
927                ChatCompletionToolChoiceOption::ChatCompletionNamedToolChoice(inner) => {
928                    ::std::result::Result::Ok(inner)
929                }
930                other => ::std::result::Result::Err(other),
931            }
932        }
933    }
934    impl ::std::convert::From<ChatCompletionNamedToolChoiceCustom> for ChatCompletionToolChoiceOption {
935        fn from(value: ChatCompletionNamedToolChoiceCustom) -> Self {
936            ChatCompletionToolChoiceOption::ChatCompletionNamedToolChoiceCustom(value)
937        }
938    }
939    impl ::std::convert::TryFrom<ChatCompletionToolChoiceOption>
940        for ChatCompletionNamedToolChoiceCustom
941    {
942        type Error = ChatCompletionToolChoiceOption;
943        /// # Errors
944        ///
945        /// Returns the original enum value if it does not match the
946        /// `#variant_ident` variant.
947        fn try_from(
948            value: ChatCompletionToolChoiceOption,
949        ) -> ::std::result::Result<Self, Self::Error> {
950            match value {
951                ChatCompletionToolChoiceOption::ChatCompletionNamedToolChoiceCustom(inner) => {
952                    ::std::result::Result::Ok(inner)
953                }
954                other => ::std::result::Result::Err(other),
955            }
956        }
957    }
958    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
959    #[serde(untagged)]
960    /// Controls which (if any) tool is called by the model.
961    /// `none` means the model will not call any tool and instead generates a message.
962    /// `auto` means the model can pick between generating a message or calling one or more tools.
963    /// `required` means the model must call one or more tools.
964    /// Specifying a particular tool via `{"type": "function", "function": {"name": "my_function"}}` forces the model to call that tool.
965    ///
966    /// `none` is the default when no tools are present. `auto` is the default if tools are present.
967    pub enum ChatCompletionToolChoiceOption {
968        ChatCompletionToolChoiceOptionVariant0(ChatCompletionToolChoiceOptionVariant0),
969        ChatCompletionAllowedToolsChoice(ChatCompletionAllowedToolsChoice),
970        ChatCompletionNamedToolChoice(ChatCompletionNamedToolChoice),
971        ChatCompletionNamedToolChoiceCustom(ChatCompletionNamedToolChoiceCustom),
972    }
973    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
974    pub enum VoiceIdsSharedVariant1 {
975        #[serde(rename = "alloy")]
976        Alloy,
977        #[serde(rename = "ash")]
978        Ash,
979        #[serde(rename = "ballad")]
980        Ballad,
981        #[serde(rename = "coral")]
982        Coral,
983        #[serde(rename = "echo")]
984        Echo,
985        #[serde(rename = "sage")]
986        Sage,
987        #[serde(rename = "shimmer")]
988        Shimmer,
989        #[serde(rename = "verse")]
990        Verse,
991        #[serde(rename = "marin")]
992        Marin,
993        #[serde(rename = "cedar")]
994        Cedar,
995    }
996    impl ::std::fmt::Display for VoiceIdsSharedVariant1 {
997        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
998            match self {
999                Self::Alloy => ::std::write!(__f, "alloy"),
1000                Self::Ash => ::std::write!(__f, "ash"),
1001                Self::Ballad => ::std::write!(__f, "ballad"),
1002                Self::Coral => ::std::write!(__f, "coral"),
1003                Self::Echo => ::std::write!(__f, "echo"),
1004                Self::Sage => ::std::write!(__f, "sage"),
1005                Self::Shimmer => ::std::write!(__f, "shimmer"),
1006                Self::Verse => ::std::write!(__f, "verse"),
1007                Self::Marin => ::std::write!(__f, "marin"),
1008                Self::Cedar => ::std::write!(__f, "cedar"),
1009            }
1010        }
1011    }
1012    impl ::std::convert::From<String> for VoiceIdsShared {
1013        fn from(value: String) -> Self {
1014            VoiceIdsShared::VoiceIdsSharedVariant0(value)
1015        }
1016    }
1017    impl ::std::convert::TryFrom<VoiceIdsShared> for String {
1018        type Error = VoiceIdsShared;
1019        /// # Errors
1020        ///
1021        /// Returns the original enum value if it does not match the
1022        /// `#variant_ident` variant.
1023        fn try_from(value: VoiceIdsShared) -> ::std::result::Result<Self, Self::Error> {
1024            match value {
1025                VoiceIdsShared::VoiceIdsSharedVariant0(inner) => ::std::result::Result::Ok(inner),
1026                other => ::std::result::Result::Err(other),
1027            }
1028        }
1029    }
1030    impl ::std::convert::From<VoiceIdsSharedVariant1> for VoiceIdsShared {
1031        fn from(value: VoiceIdsSharedVariant1) -> Self {
1032            VoiceIdsShared::VoiceIdsSharedVariant1(value)
1033        }
1034    }
1035    impl ::std::convert::TryFrom<VoiceIdsShared> for VoiceIdsSharedVariant1 {
1036        type Error = VoiceIdsShared;
1037        /// # Errors
1038        ///
1039        /// Returns the original enum value if it does not match the
1040        /// `#variant_ident` variant.
1041        fn try_from(value: VoiceIdsShared) -> ::std::result::Result<Self, Self::Error> {
1042            match value {
1043                VoiceIdsShared::VoiceIdsSharedVariant1(inner) => ::std::result::Result::Ok(inner),
1044                other => ::std::result::Result::Err(other),
1045            }
1046        }
1047    }
1048    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
1049    #[serde(untagged)]
1050    pub enum VoiceIdsShared {
1051        VoiceIdsSharedVariant0(String),
1052        VoiceIdsSharedVariant1(VoiceIdsSharedVariant1),
1053    }
1054    impl ::std::convert::From<::std::collections::BTreeMap<String, String>> for Metadata {
1055        fn from(value: ::std::collections::BTreeMap<String, String>) -> Self {
1056            Metadata::MetadataVariant0(value)
1057        }
1058    }
1059    impl ::std::convert::TryFrom<Metadata> for ::std::collections::BTreeMap<String, String> {
1060        type Error = Metadata;
1061        /// # Errors
1062        ///
1063        /// Returns the original enum value if it does not match the
1064        /// `#variant_ident` variant.
1065        fn try_from(value: Metadata) -> ::std::result::Result<Self, Self::Error> {
1066            match value {
1067                Metadata::MetadataVariant0(inner) => ::std::result::Result::Ok(inner),
1068                other => ::std::result::Result::Err(other),
1069            }
1070        }
1071    }
1072    impl ::std::convert::From<Option<::serde_json::Value>> for Metadata {
1073        fn from(value: Option<::serde_json::Value>) -> Self {
1074            Metadata::MetadataVariant1(value)
1075        }
1076    }
1077    impl ::std::convert::TryFrom<Metadata> for Option<::serde_json::Value> {
1078        type Error = Metadata;
1079        /// # Errors
1080        ///
1081        /// Returns the original enum value if it does not match the
1082        /// `#variant_ident` variant.
1083        fn try_from(value: Metadata) -> ::std::result::Result<Self, Self::Error> {
1084            match value {
1085                Metadata::MetadataVariant1(inner) => ::std::result::Result::Ok(inner),
1086                other => ::std::result::Result::Err(other),
1087            }
1088        }
1089    }
1090    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
1091    #[serde(untagged)]
1092    pub enum Metadata {
1093        MetadataVariant0(::std::collections::BTreeMap<String, String>),
1094        MetadataVariant1(Option<::serde_json::Value>),
1095    }
1096    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
1097    #[serde(untagged)]
1098    pub enum CreateModelResponsePropertiesTopLogprobs {
1099        CreateModelResponsePropertiesTopLogprobsVariant0(i64),
1100        CreateModelResponsePropertiesTopLogprobsVariant1(Option<::serde_json::Value>),
1101    }
1102    impl ::std::convert::From<i64> for CreateModelResponsePropertiesTopLogprobs {
1103        fn from(value: i64) -> Self {
1104            CreateModelResponsePropertiesTopLogprobs::CreateModelResponsePropertiesTopLogprobsVariant0(
1105                value,
1106            )
1107        }
1108    }
1109    impl ::std::convert::TryFrom<CreateModelResponsePropertiesTopLogprobs> for i64 {
1110        type Error = CreateModelResponsePropertiesTopLogprobs;
1111        /// # Errors
1112        ///
1113        /// Returns the original enum value if it does not match the
1114        /// `#variant_ident` variant.
1115        fn try_from(
1116            value: CreateModelResponsePropertiesTopLogprobs,
1117        ) -> ::std::result::Result<Self, Self::Error> {
1118            match value {
1119                CreateModelResponsePropertiesTopLogprobs::CreateModelResponsePropertiesTopLogprobsVariant0(
1120                    inner,
1121                ) => ::std::result::Result::Ok(inner),
1122                other => ::std::result::Result::Err(other),
1123            }
1124        }
1125    }
1126    impl ::std::convert::From<Option<::serde_json::Value>>
1127        for CreateModelResponsePropertiesTopLogprobs
1128    {
1129        fn from(value: Option<::serde_json::Value>) -> Self {
1130            CreateModelResponsePropertiesTopLogprobs::CreateModelResponsePropertiesTopLogprobsVariant1(
1131                value,
1132            )
1133        }
1134    }
1135    impl ::std::convert::TryFrom<CreateModelResponsePropertiesTopLogprobs>
1136        for Option<::serde_json::Value>
1137    {
1138        type Error = CreateModelResponsePropertiesTopLogprobs;
1139        /// # Errors
1140        ///
1141        /// Returns the original enum value if it does not match the
1142        /// `#variant_ident` variant.
1143        fn try_from(
1144            value: CreateModelResponsePropertiesTopLogprobs,
1145        ) -> ::std::result::Result<Self, Self::Error> {
1146            match value {
1147                CreateModelResponsePropertiesTopLogprobs::CreateModelResponsePropertiesTopLogprobsVariant1(
1148                    inner,
1149                ) => ::std::result::Result::Ok(inner),
1150                other => ::std::result::Result::Err(other),
1151            }
1152        }
1153    }
1154    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
1155    #[serde(untagged)]
1156    pub enum CreateModelResponsePropertiesTemperature {
1157        CreateModelResponsePropertiesTemperatureVariant0(f64),
1158        CreateModelResponsePropertiesTemperatureVariant1(Option<::serde_json::Value>),
1159    }
1160    impl ::std::convert::From<f64> for CreateModelResponsePropertiesTemperature {
1161        fn from(value: f64) -> Self {
1162            CreateModelResponsePropertiesTemperature::CreateModelResponsePropertiesTemperatureVariant0(
1163                value,
1164            )
1165        }
1166    }
1167    impl ::std::convert::TryFrom<CreateModelResponsePropertiesTemperature> for f64 {
1168        type Error = CreateModelResponsePropertiesTemperature;
1169        /// # Errors
1170        ///
1171        /// Returns the original enum value if it does not match the
1172        /// `#variant_ident` variant.
1173        fn try_from(
1174            value: CreateModelResponsePropertiesTemperature,
1175        ) -> ::std::result::Result<Self, Self::Error> {
1176            match value {
1177                CreateModelResponsePropertiesTemperature::CreateModelResponsePropertiesTemperatureVariant0(
1178                    inner,
1179                ) => ::std::result::Result::Ok(inner),
1180                other => ::std::result::Result::Err(other),
1181            }
1182        }
1183    }
1184    impl ::std::convert::From<Option<::serde_json::Value>>
1185        for CreateModelResponsePropertiesTemperature
1186    {
1187        fn from(value: Option<::serde_json::Value>) -> Self {
1188            CreateModelResponsePropertiesTemperature::CreateModelResponsePropertiesTemperatureVariant1(
1189                value,
1190            )
1191        }
1192    }
1193    impl ::std::convert::TryFrom<CreateModelResponsePropertiesTemperature>
1194        for Option<::serde_json::Value>
1195    {
1196        type Error = CreateModelResponsePropertiesTemperature;
1197        /// # Errors
1198        ///
1199        /// Returns the original enum value if it does not match the
1200        /// `#variant_ident` variant.
1201        fn try_from(
1202            value: CreateModelResponsePropertiesTemperature,
1203        ) -> ::std::result::Result<Self, Self::Error> {
1204            match value {
1205                CreateModelResponsePropertiesTemperature::CreateModelResponsePropertiesTemperatureVariant1(
1206                    inner,
1207                ) => ::std::result::Result::Ok(inner),
1208                other => ::std::result::Result::Err(other),
1209            }
1210        }
1211    }
1212    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
1213    #[serde(untagged)]
1214    pub enum CreateModelResponsePropertiesTopP {
1215        CreateModelResponsePropertiesTopPVariant0(f64),
1216        CreateModelResponsePropertiesTopPVariant1(Option<::serde_json::Value>),
1217    }
1218    impl ::std::convert::From<f64> for CreateModelResponsePropertiesTopP {
1219        fn from(value: f64) -> Self {
1220            CreateModelResponsePropertiesTopP::CreateModelResponsePropertiesTopPVariant0(value)
1221        }
1222    }
1223    impl ::std::convert::TryFrom<CreateModelResponsePropertiesTopP> for f64 {
1224        type Error = CreateModelResponsePropertiesTopP;
1225        /// # Errors
1226        ///
1227        /// Returns the original enum value if it does not match the
1228        /// `#variant_ident` variant.
1229        fn try_from(
1230            value: CreateModelResponsePropertiesTopP,
1231        ) -> ::std::result::Result<Self, Self::Error> {
1232            match value {
1233                CreateModelResponsePropertiesTopP::CreateModelResponsePropertiesTopPVariant0(
1234                    inner,
1235                ) => ::std::result::Result::Ok(inner),
1236                other => ::std::result::Result::Err(other),
1237            }
1238        }
1239    }
1240    impl ::std::convert::From<Option<::serde_json::Value>> for CreateModelResponsePropertiesTopP {
1241        fn from(value: Option<::serde_json::Value>) -> Self {
1242            CreateModelResponsePropertiesTopP::CreateModelResponsePropertiesTopPVariant1(value)
1243        }
1244    }
1245    impl ::std::convert::TryFrom<CreateModelResponsePropertiesTopP> for Option<::serde_json::Value> {
1246        type Error = CreateModelResponsePropertiesTopP;
1247        /// # Errors
1248        ///
1249        /// Returns the original enum value if it does not match the
1250        /// `#variant_ident` variant.
1251        fn try_from(
1252            value: CreateModelResponsePropertiesTopP,
1253        ) -> ::std::result::Result<Self, Self::Error> {
1254            match value {
1255                CreateModelResponsePropertiesTopP::CreateModelResponsePropertiesTopPVariant1(
1256                    inner,
1257                ) => ::std::result::Result::Ok(inner),
1258                other => ::std::result::Result::Err(other),
1259            }
1260        }
1261    }
1262    /// The retention policy for the prompt cache. Set to `24h` to enable extended prompt caching, which keeps cached prefixes active for longer, up to a maximum of 24 hours. [Learn more](/docs/guides/prompt-caching#prompt-cache-retention).
1263    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
1264    pub enum CreateModelResponsePropertiesPromptCacheRetentionVariant0 {
1265        #[serde(rename = "in_memory")]
1266        InMemory,
1267        #[serde(rename = "24h")]
1268        _24h,
1269    }
1270    impl ::std::fmt::Display for CreateModelResponsePropertiesPromptCacheRetentionVariant0 {
1271        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
1272            match self {
1273                Self::InMemory => ::std::write!(__f, "in_memory"),
1274                Self::_24h => ::std::write!(__f, "24h"),
1275            }
1276        }
1277    }
1278    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
1279    #[serde(untagged)]
1280    pub enum CreateModelResponsePropertiesPromptCacheRetention {
1281        CreateModelResponsePropertiesPromptCacheRetentionVariant0(
1282            CreateModelResponsePropertiesPromptCacheRetentionVariant0,
1283        ),
1284        CreateModelResponsePropertiesPromptCacheRetentionVariant1(Option<::serde_json::Value>),
1285    }
1286    impl ::std::convert::From<CreateModelResponsePropertiesPromptCacheRetentionVariant0>
1287        for CreateModelResponsePropertiesPromptCacheRetention
1288    {
1289        fn from(value: CreateModelResponsePropertiesPromptCacheRetentionVariant0) -> Self {
1290            CreateModelResponsePropertiesPromptCacheRetention::CreateModelResponsePropertiesPromptCacheRetentionVariant0(
1291                value,
1292            )
1293        }
1294    }
1295    impl ::std::convert::TryFrom<CreateModelResponsePropertiesPromptCacheRetention>
1296        for CreateModelResponsePropertiesPromptCacheRetentionVariant0
1297    {
1298        type Error = CreateModelResponsePropertiesPromptCacheRetention;
1299        /// # Errors
1300        ///
1301        /// Returns the original enum value if it does not match the
1302        /// `#variant_ident` variant.
1303        fn try_from(
1304            value: CreateModelResponsePropertiesPromptCacheRetention,
1305        ) -> ::std::result::Result<Self, Self::Error> {
1306            match value {
1307                CreateModelResponsePropertiesPromptCacheRetention::CreateModelResponsePropertiesPromptCacheRetentionVariant0(
1308                    inner,
1309                ) => ::std::result::Result::Ok(inner),
1310                other => ::std::result::Result::Err(other),
1311            }
1312        }
1313    }
1314    impl ::std::convert::From<Option<::serde_json::Value>>
1315        for CreateModelResponsePropertiesPromptCacheRetention
1316    {
1317        fn from(value: Option<::serde_json::Value>) -> Self {
1318            CreateModelResponsePropertiesPromptCacheRetention::CreateModelResponsePropertiesPromptCacheRetentionVariant1(
1319                value,
1320            )
1321        }
1322    }
1323    impl ::std::convert::TryFrom<CreateModelResponsePropertiesPromptCacheRetention>
1324        for Option<::serde_json::Value>
1325    {
1326        type Error = CreateModelResponsePropertiesPromptCacheRetention;
1327        /// # Errors
1328        ///
1329        /// Returns the original enum value if it does not match the
1330        /// `#variant_ident` variant.
1331        fn try_from(
1332            value: CreateModelResponsePropertiesPromptCacheRetention,
1333        ) -> ::std::result::Result<Self, Self::Error> {
1334            match value {
1335                CreateModelResponsePropertiesPromptCacheRetention::CreateModelResponsePropertiesPromptCacheRetentionVariant1(
1336                    inner,
1337                ) => ::std::result::Result::Ok(inner),
1338                other => ::std::result::Result::Err(other),
1339            }
1340        }
1341    }
1342    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
1343    pub struct CreateModelResponseProperties {
1344        #[serde(skip_serializing_if = "Option::is_none")]
1345        pub metadata: Option<Metadata>,
1346        #[serde(skip_serializing_if = "Option::is_none")]
1347        pub top_logprobs: Option<CreateModelResponsePropertiesTopLogprobs>,
1348        #[serde(skip_serializing_if = "Option::is_none")]
1349        pub temperature: Option<CreateModelResponsePropertiesTemperature>,
1350        #[serde(skip_serializing_if = "Option::is_none")]
1351        pub top_p: Option<CreateModelResponsePropertiesTopP>,
1352        #[serde(skip_serializing_if = "Option::is_none")]
1353        /// This field is being replaced by `safety_identifier` and `prompt_cache_key`. Use `prompt_cache_key` instead to maintain caching optimizations.
1354        /// A stable identifier for your end-users.
1355        /// Used to boost cache hit rates by better bucketing similar requests and  to help OpenAI detect and prevent abuse. [Learn more](/docs/guides/safety-best-practices#safety-identifiers).
1356        #[deprecated]
1357        pub user: Option<String>,
1358        #[serde(skip_serializing_if = "Option::is_none")]
1359        /// A stable identifier used to help detect users of your application that may be violating OpenAI's usage policies.
1360        /// The IDs should be a string that uniquely identifies each user, with a maximum length of 64 characters. We recommend hashing their username or email address, in order to avoid sending us any identifying information. [Learn more](/docs/guides/safety-best-practices#safety-identifiers).
1361        pub safety_identifier: Option<String>,
1362        #[serde(skip_serializing_if = "Option::is_none")]
1363        /// Used by OpenAI to cache responses for similar requests to optimize your cache hit rates. Replaces the `user` field. [Learn more](/docs/guides/prompt-caching).
1364        pub prompt_cache_key: Option<String>,
1365        #[serde(skip_serializing_if = "Option::is_none")]
1366        pub service_tier: Option<ServiceTier>,
1367        #[serde(skip_serializing_if = "Option::is_none")]
1368        pub prompt_cache_retention: Option<CreateModelResponsePropertiesPromptCacheRetention>,
1369    }
1370    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
1371    /// Custom voice reference.
1372    pub struct VoiceIdsOrCustomVoiceVariant1 {
1373        /// The custom voice ID, e.g. `voice_1234`.
1374        pub id: String,
1375    }
1376    impl ::std::convert::From<VoiceIdsShared> for VoiceIdsOrCustomVoice {
1377        fn from(value: VoiceIdsShared) -> Self {
1378            VoiceIdsOrCustomVoice::VoiceIdsShared(value)
1379        }
1380    }
1381    impl ::std::convert::TryFrom<VoiceIdsOrCustomVoice> for VoiceIdsShared {
1382        type Error = VoiceIdsOrCustomVoice;
1383        /// # Errors
1384        ///
1385        /// Returns the original enum value if it does not match the
1386        /// `#variant_ident` variant.
1387        fn try_from(value: VoiceIdsOrCustomVoice) -> ::std::result::Result<Self, Self::Error> {
1388            match value {
1389                VoiceIdsOrCustomVoice::VoiceIdsShared(inner) => ::std::result::Result::Ok(inner),
1390                other => ::std::result::Result::Err(other),
1391            }
1392        }
1393    }
1394    impl ::std::convert::From<VoiceIdsOrCustomVoiceVariant1> for VoiceIdsOrCustomVoice {
1395        fn from(value: VoiceIdsOrCustomVoiceVariant1) -> Self {
1396            VoiceIdsOrCustomVoice::VoiceIdsOrCustomVoiceVariant1(value)
1397        }
1398    }
1399    impl ::std::convert::TryFrom<VoiceIdsOrCustomVoice> for VoiceIdsOrCustomVoiceVariant1 {
1400        type Error = VoiceIdsOrCustomVoice;
1401        /// # Errors
1402        ///
1403        /// Returns the original enum value if it does not match the
1404        /// `#variant_ident` variant.
1405        fn try_from(value: VoiceIdsOrCustomVoice) -> ::std::result::Result<Self, Self::Error> {
1406            match value {
1407                VoiceIdsOrCustomVoice::VoiceIdsOrCustomVoiceVariant1(inner) => {
1408                    ::std::result::Result::Ok(inner)
1409                }
1410                other => ::std::result::Result::Err(other),
1411            }
1412        }
1413    }
1414    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
1415    #[serde(untagged)]
1416    /// # Voice
1417    /// A built-in voice name or a custom voice reference.
1418    pub enum VoiceIdsOrCustomVoice {
1419        VoiceIdsShared(VoiceIdsShared),
1420        VoiceIdsOrCustomVoiceVariant1(VoiceIdsOrCustomVoiceVariant1),
1421    }
1422    /// The type of the custom tool. Always `custom`.
1423    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
1424    pub enum CustomToolChatCompletionsType {
1425        #[serde(rename = "custom")]
1426        Custom,
1427    }
1428    impl ::std::fmt::Display for CustomToolChatCompletionsType {
1429        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
1430            match self {
1431                Self::Custom => ::std::write!(__f, "custom"),
1432            }
1433        }
1434    }
1435    /// Unconstrained text format. Always `text`.
1436    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
1437    pub enum CustomToolChatCompletionsCustomFormatVariant0Type {
1438        #[serde(rename = "text")]
1439        Text,
1440    }
1441    impl ::std::fmt::Display for CustomToolChatCompletionsCustomFormatVariant0Type {
1442        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
1443            match self {
1444                Self::Text => ::std::write!(__f, "text"),
1445            }
1446        }
1447    }
1448    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
1449    /// # Text format
1450    /// Unconstrained free-form text.
1451    pub struct CustomToolChatCompletionsCustomFormatVariant0 {
1452        /// Unconstrained text format. Always `text`.
1453        pub r#type: CustomToolChatCompletionsCustomFormatVariant0Type,
1454    }
1455    /// Grammar format. Always `grammar`.
1456    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
1457    pub enum CustomToolChatCompletionsCustomFormatVariant1Type {
1458        #[serde(rename = "grammar")]
1459        Grammar,
1460    }
1461    impl ::std::fmt::Display for CustomToolChatCompletionsCustomFormatVariant1Type {
1462        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
1463            match self {
1464                Self::Grammar => ::std::write!(__f, "grammar"),
1465            }
1466        }
1467    }
1468    /// The syntax of the grammar definition. One of `lark` or `regex`.
1469    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
1470    pub enum CustomToolChatCompletionsCustomFormatVariant1GrammarSyntax {
1471        #[serde(rename = "lark")]
1472        Lark,
1473        #[serde(rename = "regex")]
1474        Regex,
1475    }
1476    impl ::std::fmt::Display for CustomToolChatCompletionsCustomFormatVariant1GrammarSyntax {
1477        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
1478            match self {
1479                Self::Lark => ::std::write!(__f, "lark"),
1480                Self::Regex => ::std::write!(__f, "regex"),
1481            }
1482        }
1483    }
1484    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
1485    /// # Grammar format
1486    /// Your chosen grammar.
1487    pub struct CustomToolChatCompletionsCustomFormatVariant1Grammar {
1488        /// The grammar definition.
1489        pub definition: String,
1490        /// The syntax of the grammar definition. One of `lark` or `regex`.
1491        pub syntax: CustomToolChatCompletionsCustomFormatVariant1GrammarSyntax,
1492    }
1493    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
1494    /// # Grammar format
1495    /// A grammar defined by the user.
1496    pub struct CustomToolChatCompletionsCustomFormatVariant1 {
1497        /// Grammar format. Always `grammar`.
1498        pub r#type: CustomToolChatCompletionsCustomFormatVariant1Type,
1499        /// Your chosen grammar.
1500        pub grammar: CustomToolChatCompletionsCustomFormatVariant1Grammar,
1501    }
1502    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
1503    #[serde(untagged)]
1504    /// The input format for the custom tool. Default is unconstrained text.
1505    pub enum CustomToolChatCompletionsCustomFormat {
1506        CustomToolChatCompletionsCustomFormatVariant0(
1507            CustomToolChatCompletionsCustomFormatVariant0,
1508        ),
1509        CustomToolChatCompletionsCustomFormatVariant1(
1510            CustomToolChatCompletionsCustomFormatVariant1,
1511        ),
1512    }
1513    impl ::std::convert::From<CustomToolChatCompletionsCustomFormatVariant0>
1514        for CustomToolChatCompletionsCustomFormat
1515    {
1516        fn from(value: CustomToolChatCompletionsCustomFormatVariant0) -> Self {
1517            CustomToolChatCompletionsCustomFormat::CustomToolChatCompletionsCustomFormatVariant0(
1518                value,
1519            )
1520        }
1521    }
1522    impl ::std::convert::TryFrom<CustomToolChatCompletionsCustomFormat>
1523        for CustomToolChatCompletionsCustomFormatVariant0
1524    {
1525        type Error = CustomToolChatCompletionsCustomFormat;
1526        /// # Errors
1527        ///
1528        /// Returns the original enum value if it does not match the
1529        /// `#variant_ident` variant.
1530        fn try_from(
1531            value: CustomToolChatCompletionsCustomFormat,
1532        ) -> ::std::result::Result<Self, Self::Error> {
1533            match value {
1534                CustomToolChatCompletionsCustomFormat::CustomToolChatCompletionsCustomFormatVariant0(
1535                    inner,
1536                ) => ::std::result::Result::Ok(inner),
1537                other => ::std::result::Result::Err(other),
1538            }
1539        }
1540    }
1541    impl ::std::convert::From<CustomToolChatCompletionsCustomFormatVariant1>
1542        for CustomToolChatCompletionsCustomFormat
1543    {
1544        fn from(value: CustomToolChatCompletionsCustomFormatVariant1) -> Self {
1545            CustomToolChatCompletionsCustomFormat::CustomToolChatCompletionsCustomFormatVariant1(
1546                value,
1547            )
1548        }
1549    }
1550    impl ::std::convert::TryFrom<CustomToolChatCompletionsCustomFormat>
1551        for CustomToolChatCompletionsCustomFormatVariant1
1552    {
1553        type Error = CustomToolChatCompletionsCustomFormat;
1554        /// # Errors
1555        ///
1556        /// Returns the original enum value if it does not match the
1557        /// `#variant_ident` variant.
1558        fn try_from(
1559            value: CustomToolChatCompletionsCustomFormat,
1560        ) -> ::std::result::Result<Self, Self::Error> {
1561            match value {
1562                CustomToolChatCompletionsCustomFormat::CustomToolChatCompletionsCustomFormatVariant1(
1563                    inner,
1564                ) => ::std::result::Result::Ok(inner),
1565                other => ::std::result::Result::Err(other),
1566            }
1567        }
1568    }
1569    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
1570    /// # Custom tool properties
1571    /// Properties of the custom tool.
1572    pub struct CustomToolChatCompletionsCustom {
1573        /// The name of the custom tool, used to identify it in tool calls.
1574        pub name: String,
1575        #[serde(skip_serializing_if = "Option::is_none")]
1576        /// Optional description of the custom tool, used to provide more context.
1577        pub description: Option<String>,
1578        #[serde(skip_serializing_if = "Option::is_none")]
1579        /// The input format for the custom tool. Default is unconstrained text.
1580        pub format: Option<CustomToolChatCompletionsCustomFormat>,
1581    }
1582    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
1583    /// # Custom tool
1584    /// A custom tool that processes input using a specified format.
1585    pub struct CustomToolChatCompletions {
1586        /// The type of the custom tool. Always `custom`.
1587        pub r#type: CustomToolChatCompletionsType,
1588        /// Properties of the custom tool.
1589        pub custom: CustomToolChatCompletionsCustom,
1590    }
1591    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
1592    pub enum ModelIdsSharedVariant1 {
1593        #[serde(rename = "gpt-5.4")]
1594        Gpt54,
1595        #[serde(rename = "gpt-5.4-mini")]
1596        Gpt54Mini,
1597        #[serde(rename = "gpt-5.4-nano")]
1598        Gpt54Nano,
1599        #[serde(rename = "gpt-5.4-mini-2026-03-17")]
1600        Gpt54Mini2026Minus03Minus17,
1601        #[serde(rename = "gpt-5.4-nano-2026-03-17")]
1602        Gpt54Nano2026Minus03Minus17,
1603        #[serde(rename = "gpt-5.3-chat-latest")]
1604        Gpt53ChatLatest,
1605        #[serde(rename = "gpt-5.2")]
1606        Gpt52,
1607        #[serde(rename = "gpt-5.2-2025-12-11")]
1608        Gpt52Minus2025Minus12Minus11,
1609        #[serde(rename = "gpt-5.2-chat-latest")]
1610        Gpt52ChatLatest,
1611        #[serde(rename = "gpt-5.2-pro")]
1612        Gpt52Pro,
1613        #[serde(rename = "gpt-5.2-pro-2025-12-11")]
1614        Gpt52Pro2025Minus12Minus11,
1615        #[serde(rename = "gpt-5.1")]
1616        Gpt51,
1617        #[serde(rename = "gpt-5.1-2025-11-13")]
1618        Gpt51Minus2025Minus11Minus13,
1619        #[serde(rename = "gpt-5.1-codex")]
1620        Gpt51Codex,
1621        #[serde(rename = "gpt-5.1-mini")]
1622        Gpt51Mini,
1623        #[serde(rename = "gpt-5.1-chat-latest")]
1624        Gpt51ChatLatest,
1625        #[serde(rename = "gpt-5")]
1626        Gpt5,
1627        #[serde(rename = "gpt-5-mini")]
1628        Gpt5Mini,
1629        #[serde(rename = "gpt-5-nano")]
1630        Gpt5Nano,
1631        #[serde(rename = "gpt-5-2025-08-07")]
1632        Gpt5Minus2025Minus08Minus07,
1633        #[serde(rename = "gpt-5-mini-2025-08-07")]
1634        Gpt5Mini2025Minus08Minus07,
1635        #[serde(rename = "gpt-5-nano-2025-08-07")]
1636        Gpt5Nano2025Minus08Minus07,
1637        #[serde(rename = "gpt-5-chat-latest")]
1638        Gpt5ChatLatest,
1639        #[serde(rename = "gpt-4.1")]
1640        Gpt41,
1641        #[serde(rename = "gpt-4.1-mini")]
1642        Gpt41Mini,
1643        #[serde(rename = "gpt-4.1-nano")]
1644        Gpt41Nano,
1645        #[serde(rename = "gpt-4.1-2025-04-14")]
1646        Gpt41Minus2025Minus04Minus14,
1647        #[serde(rename = "gpt-4.1-mini-2025-04-14")]
1648        Gpt41Mini2025Minus04Minus14,
1649        #[serde(rename = "gpt-4.1-nano-2025-04-14")]
1650        Gpt41Nano2025Minus04Minus14,
1651        #[serde(rename = "o4-mini")]
1652        O4Mini,
1653        #[serde(rename = "o4-mini-2025-04-16")]
1654        O4Mini2025Minus04Minus16,
1655        #[serde(rename = "o3")]
1656        O3,
1657        #[serde(rename = "o3-2025-04-16")]
1658        O3Minus2025Minus04Minus16,
1659        #[serde(rename = "o3-mini")]
1660        O3Mini,
1661        #[serde(rename = "o3-mini-2025-01-31")]
1662        O3Mini2025Minus01Minus31,
1663        #[serde(rename = "o1")]
1664        O1,
1665        #[serde(rename = "o1-2024-12-17")]
1666        O1Minus2024Minus12Minus17,
1667        #[serde(rename = "o1-preview")]
1668        O1Preview,
1669        #[serde(rename = "o1-preview-2024-09-12")]
1670        O1Preview2024Minus09Minus12,
1671        #[serde(rename = "o1-mini")]
1672        O1Mini,
1673        #[serde(rename = "o1-mini-2024-09-12")]
1674        O1Mini2024Minus09Minus12,
1675        #[serde(rename = "gpt-4o")]
1676        Gpt4o,
1677        #[serde(rename = "gpt-4o-2024-11-20")]
1678        Gpt4o2024Minus11Minus20,
1679        #[serde(rename = "gpt-4o-2024-08-06")]
1680        Gpt4o2024Minus08Minus06,
1681        #[serde(rename = "gpt-4o-2024-05-13")]
1682        Gpt4o2024Minus05Minus13,
1683        #[serde(rename = "gpt-4o-audio-preview")]
1684        Gpt4oAudioPreview,
1685        #[serde(rename = "gpt-4o-audio-preview-2024-10-01")]
1686        Gpt4oAudioPreview2024Minus10Minus01,
1687        #[serde(rename = "gpt-4o-audio-preview-2024-12-17")]
1688        Gpt4oAudioPreview2024Minus12Minus17,
1689        #[serde(rename = "gpt-4o-audio-preview-2025-06-03")]
1690        Gpt4oAudioPreview2025Minus06Minus03,
1691        #[serde(rename = "gpt-4o-mini-audio-preview")]
1692        Gpt4oMiniAudioPreview,
1693        #[serde(rename = "gpt-4o-mini-audio-preview-2024-12-17")]
1694        Gpt4oMiniAudioPreview2024Minus12Minus17,
1695        #[serde(rename = "gpt-4o-search-preview")]
1696        Gpt4oSearchPreview,
1697        #[serde(rename = "gpt-4o-mini-search-preview")]
1698        Gpt4oMiniSearchPreview,
1699        #[serde(rename = "gpt-4o-search-preview-2025-03-11")]
1700        Gpt4oSearchPreview2025Minus03Minus11,
1701        #[serde(rename = "gpt-4o-mini-search-preview-2025-03-11")]
1702        Gpt4oMiniSearchPreview2025Minus03Minus11,
1703        #[serde(rename = "chatgpt-4o-latest")]
1704        Chatgpt4oLatest,
1705        #[serde(rename = "codex-mini-latest")]
1706        CodexMiniLatest,
1707        #[serde(rename = "gpt-4o-mini")]
1708        Gpt4oMini,
1709        #[serde(rename = "gpt-4o-mini-2024-07-18")]
1710        Gpt4oMini2024Minus07Minus18,
1711        #[serde(rename = "gpt-4-turbo")]
1712        Gpt4Turbo,
1713        #[serde(rename = "gpt-4-turbo-2024-04-09")]
1714        Gpt4Turbo2024Minus04Minus09,
1715        #[serde(rename = "gpt-4-0125-preview")]
1716        Gpt4Minus0125Preview,
1717        #[serde(rename = "gpt-4-turbo-preview")]
1718        Gpt4TurboPreview,
1719        #[serde(rename = "gpt-4-1106-preview")]
1720        Gpt4Minus1106Preview,
1721        #[serde(rename = "gpt-4-vision-preview")]
1722        Gpt4VisionPreview,
1723        #[serde(rename = "gpt-4")]
1724        Gpt4,
1725        #[serde(rename = "gpt-4-0314")]
1726        Gpt4Minus0314,
1727        #[serde(rename = "gpt-4-0613")]
1728        Gpt4Minus0613,
1729        #[serde(rename = "gpt-4-32k")]
1730        Gpt4Minus32k,
1731        #[serde(rename = "gpt-4-32k-0314")]
1732        Gpt4Minus32k0314,
1733        #[serde(rename = "gpt-4-32k-0613")]
1734        Gpt4Minus32k0613,
1735        #[serde(rename = "gpt-3.5-turbo")]
1736        Gpt35Turbo,
1737        #[serde(rename = "gpt-3.5-turbo-16k")]
1738        Gpt35Turbo16k,
1739        #[serde(rename = "gpt-3.5-turbo-0301")]
1740        Gpt35Turbo0301,
1741        #[serde(rename = "gpt-3.5-turbo-0613")]
1742        Gpt35Turbo0613,
1743        #[serde(rename = "gpt-3.5-turbo-1106")]
1744        Gpt35Turbo1106,
1745        #[serde(rename = "gpt-3.5-turbo-0125")]
1746        Gpt35Turbo0125,
1747        #[serde(rename = "gpt-3.5-turbo-16k-0613")]
1748        Gpt35Turbo16k0613,
1749    }
1750    impl ::std::fmt::Display for ModelIdsSharedVariant1 {
1751        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
1752            match self {
1753                Self::Gpt54 => ::std::write!(__f, "gpt-5.4"),
1754                Self::Gpt54Mini => ::std::write!(__f, "gpt-5.4-mini"),
1755                Self::Gpt54Nano => ::std::write!(__f, "gpt-5.4-nano"),
1756                Self::Gpt54Mini2026Minus03Minus17 => {
1757                    ::std::write!(__f, "gpt-5.4-mini-2026-03-17")
1758                }
1759                Self::Gpt54Nano2026Minus03Minus17 => {
1760                    ::std::write!(__f, "gpt-5.4-nano-2026-03-17")
1761                }
1762                Self::Gpt53ChatLatest => ::std::write!(__f, "gpt-5.3-chat-latest"),
1763                Self::Gpt52 => ::std::write!(__f, "gpt-5.2"),
1764                Self::Gpt52Minus2025Minus12Minus11 => {
1765                    ::std::write!(__f, "gpt-5.2-2025-12-11")
1766                }
1767                Self::Gpt52ChatLatest => ::std::write!(__f, "gpt-5.2-chat-latest"),
1768                Self::Gpt52Pro => ::std::write!(__f, "gpt-5.2-pro"),
1769                Self::Gpt52Pro2025Minus12Minus11 => {
1770                    ::std::write!(__f, "gpt-5.2-pro-2025-12-11")
1771                }
1772                Self::Gpt51 => ::std::write!(__f, "gpt-5.1"),
1773                Self::Gpt51Minus2025Minus11Minus13 => {
1774                    ::std::write!(__f, "gpt-5.1-2025-11-13")
1775                }
1776                Self::Gpt51Codex => ::std::write!(__f, "gpt-5.1-codex"),
1777                Self::Gpt51Mini => ::std::write!(__f, "gpt-5.1-mini"),
1778                Self::Gpt51ChatLatest => ::std::write!(__f, "gpt-5.1-chat-latest"),
1779                Self::Gpt5 => ::std::write!(__f, "gpt-5"),
1780                Self::Gpt5Mini => ::std::write!(__f, "gpt-5-mini"),
1781                Self::Gpt5Nano => ::std::write!(__f, "gpt-5-nano"),
1782                Self::Gpt5Minus2025Minus08Minus07 => {
1783                    ::std::write!(__f, "gpt-5-2025-08-07")
1784                }
1785                Self::Gpt5Mini2025Minus08Minus07 => {
1786                    ::std::write!(__f, "gpt-5-mini-2025-08-07")
1787                }
1788                Self::Gpt5Nano2025Minus08Minus07 => {
1789                    ::std::write!(__f, "gpt-5-nano-2025-08-07")
1790                }
1791                Self::Gpt5ChatLatest => ::std::write!(__f, "gpt-5-chat-latest"),
1792                Self::Gpt41 => ::std::write!(__f, "gpt-4.1"),
1793                Self::Gpt41Mini => ::std::write!(__f, "gpt-4.1-mini"),
1794                Self::Gpt41Nano => ::std::write!(__f, "gpt-4.1-nano"),
1795                Self::Gpt41Minus2025Minus04Minus14 => {
1796                    ::std::write!(__f, "gpt-4.1-2025-04-14")
1797                }
1798                Self::Gpt41Mini2025Minus04Minus14 => {
1799                    ::std::write!(__f, "gpt-4.1-mini-2025-04-14")
1800                }
1801                Self::Gpt41Nano2025Minus04Minus14 => {
1802                    ::std::write!(__f, "gpt-4.1-nano-2025-04-14")
1803                }
1804                Self::O4Mini => ::std::write!(__f, "o4-mini"),
1805                Self::O4Mini2025Minus04Minus16 => {
1806                    ::std::write!(__f, "o4-mini-2025-04-16")
1807                }
1808                Self::O3 => ::std::write!(__f, "o3"),
1809                Self::O3Minus2025Minus04Minus16 => ::std::write!(__f, "o3-2025-04-16"),
1810                Self::O3Mini => ::std::write!(__f, "o3-mini"),
1811                Self::O3Mini2025Minus01Minus31 => {
1812                    ::std::write!(__f, "o3-mini-2025-01-31")
1813                }
1814                Self::O1 => ::std::write!(__f, "o1"),
1815                Self::O1Minus2024Minus12Minus17 => ::std::write!(__f, "o1-2024-12-17"),
1816                Self::O1Preview => ::std::write!(__f, "o1-preview"),
1817                Self::O1Preview2024Minus09Minus12 => {
1818                    ::std::write!(__f, "o1-preview-2024-09-12")
1819                }
1820                Self::O1Mini => ::std::write!(__f, "o1-mini"),
1821                Self::O1Mini2024Minus09Minus12 => {
1822                    ::std::write!(__f, "o1-mini-2024-09-12")
1823                }
1824                Self::Gpt4o => ::std::write!(__f, "gpt-4o"),
1825                Self::Gpt4o2024Minus11Minus20 => ::std::write!(__f, "gpt-4o-2024-11-20"),
1826                Self::Gpt4o2024Minus08Minus06 => ::std::write!(__f, "gpt-4o-2024-08-06"),
1827                Self::Gpt4o2024Minus05Minus13 => ::std::write!(__f, "gpt-4o-2024-05-13"),
1828                Self::Gpt4oAudioPreview => ::std::write!(__f, "gpt-4o-audio-preview"),
1829                Self::Gpt4oAudioPreview2024Minus10Minus01 => {
1830                    ::std::write!(__f, "gpt-4o-audio-preview-2024-10-01")
1831                }
1832                Self::Gpt4oAudioPreview2024Minus12Minus17 => {
1833                    ::std::write!(__f, "gpt-4o-audio-preview-2024-12-17")
1834                }
1835                Self::Gpt4oAudioPreview2025Minus06Minus03 => {
1836                    ::std::write!(__f, "gpt-4o-audio-preview-2025-06-03")
1837                }
1838                Self::Gpt4oMiniAudioPreview => {
1839                    ::std::write!(__f, "gpt-4o-mini-audio-preview")
1840                }
1841                Self::Gpt4oMiniAudioPreview2024Minus12Minus17 => {
1842                    ::std::write!(__f, "gpt-4o-mini-audio-preview-2024-12-17")
1843                }
1844                Self::Gpt4oSearchPreview => ::std::write!(__f, "gpt-4o-search-preview"),
1845                Self::Gpt4oMiniSearchPreview => {
1846                    ::std::write!(__f, "gpt-4o-mini-search-preview")
1847                }
1848                Self::Gpt4oSearchPreview2025Minus03Minus11 => {
1849                    ::std::write!(__f, "gpt-4o-search-preview-2025-03-11")
1850                }
1851                Self::Gpt4oMiniSearchPreview2025Minus03Minus11 => {
1852                    ::std::write!(__f, "gpt-4o-mini-search-preview-2025-03-11")
1853                }
1854                Self::Chatgpt4oLatest => ::std::write!(__f, "chatgpt-4o-latest"),
1855                Self::CodexMiniLatest => ::std::write!(__f, "codex-mini-latest"),
1856                Self::Gpt4oMini => ::std::write!(__f, "gpt-4o-mini"),
1857                Self::Gpt4oMini2024Minus07Minus18 => {
1858                    ::std::write!(__f, "gpt-4o-mini-2024-07-18")
1859                }
1860                Self::Gpt4Turbo => ::std::write!(__f, "gpt-4-turbo"),
1861                Self::Gpt4Turbo2024Minus04Minus09 => {
1862                    ::std::write!(__f, "gpt-4-turbo-2024-04-09")
1863                }
1864                Self::Gpt4Minus0125Preview => ::std::write!(__f, "gpt-4-0125-preview"),
1865                Self::Gpt4TurboPreview => ::std::write!(__f, "gpt-4-turbo-preview"),
1866                Self::Gpt4Minus1106Preview => ::std::write!(__f, "gpt-4-1106-preview"),
1867                Self::Gpt4VisionPreview => ::std::write!(__f, "gpt-4-vision-preview"),
1868                Self::Gpt4 => ::std::write!(__f, "gpt-4"),
1869                Self::Gpt4Minus0314 => ::std::write!(__f, "gpt-4-0314"),
1870                Self::Gpt4Minus0613 => ::std::write!(__f, "gpt-4-0613"),
1871                Self::Gpt4Minus32k => ::std::write!(__f, "gpt-4-32k"),
1872                Self::Gpt4Minus32k0314 => ::std::write!(__f, "gpt-4-32k-0314"),
1873                Self::Gpt4Minus32k0613 => ::std::write!(__f, "gpt-4-32k-0613"),
1874                Self::Gpt35Turbo => ::std::write!(__f, "gpt-3.5-turbo"),
1875                Self::Gpt35Turbo16k => ::std::write!(__f, "gpt-3.5-turbo-16k"),
1876                Self::Gpt35Turbo0301 => ::std::write!(__f, "gpt-3.5-turbo-0301"),
1877                Self::Gpt35Turbo0613 => ::std::write!(__f, "gpt-3.5-turbo-0613"),
1878                Self::Gpt35Turbo1106 => ::std::write!(__f, "gpt-3.5-turbo-1106"),
1879                Self::Gpt35Turbo0125 => ::std::write!(__f, "gpt-3.5-turbo-0125"),
1880                Self::Gpt35Turbo16k0613 => ::std::write!(__f, "gpt-3.5-turbo-16k-0613"),
1881            }
1882        }
1883    }
1884    impl ::std::convert::From<String> for ModelIdsShared {
1885        fn from(value: String) -> Self {
1886            ModelIdsShared::ModelIdsSharedVariant0(value)
1887        }
1888    }
1889    impl ::std::convert::TryFrom<ModelIdsShared> for String {
1890        type Error = ModelIdsShared;
1891        /// # Errors
1892        ///
1893        /// Returns the original enum value if it does not match the
1894        /// `#variant_ident` variant.
1895        fn try_from(value: ModelIdsShared) -> ::std::result::Result<Self, Self::Error> {
1896            match value {
1897                ModelIdsShared::ModelIdsSharedVariant0(inner) => ::std::result::Result::Ok(inner),
1898                other => ::std::result::Result::Err(other),
1899            }
1900        }
1901    }
1902    impl ::std::convert::From<ModelIdsSharedVariant1> for ModelIdsShared {
1903        fn from(value: ModelIdsSharedVariant1) -> Self {
1904            ModelIdsShared::ModelIdsSharedVariant1(value)
1905        }
1906    }
1907    impl ::std::convert::TryFrom<ModelIdsShared> for ModelIdsSharedVariant1 {
1908        type Error = ModelIdsShared;
1909        /// # Errors
1910        ///
1911        /// Returns the original enum value if it does not match the
1912        /// `#variant_ident` variant.
1913        fn try_from(value: ModelIdsShared) -> ::std::result::Result<Self, Self::Error> {
1914            match value {
1915                ModelIdsShared::ModelIdsSharedVariant1(inner) => ::std::result::Result::Ok(inner),
1916                other => ::std::result::Result::Err(other),
1917            }
1918        }
1919    }
1920    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
1921    #[serde(untagged)]
1922    pub enum ModelIdsShared {
1923        ModelIdsSharedVariant0(String),
1924        ModelIdsSharedVariant1(ModelIdsSharedVariant1),
1925    }
1926    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
1927    #[serde(untagged)]
1928    pub enum ModelResponsePropertiesTopLogprobs {
1929        ModelResponsePropertiesTopLogprobsVariant0(i64),
1930        ModelResponsePropertiesTopLogprobsVariant1(Option<::serde_json::Value>),
1931    }
1932    impl ::std::convert::From<i64> for ModelResponsePropertiesTopLogprobs {
1933        fn from(value: i64) -> Self {
1934            ModelResponsePropertiesTopLogprobs::ModelResponsePropertiesTopLogprobsVariant0(value)
1935        }
1936    }
1937    impl ::std::convert::TryFrom<ModelResponsePropertiesTopLogprobs> for i64 {
1938        type Error = ModelResponsePropertiesTopLogprobs;
1939        /// # Errors
1940        ///
1941        /// Returns the original enum value if it does not match the
1942        /// `#variant_ident` variant.
1943        fn try_from(
1944            value: ModelResponsePropertiesTopLogprobs,
1945        ) -> ::std::result::Result<Self, Self::Error> {
1946            match value {
1947                ModelResponsePropertiesTopLogprobs::ModelResponsePropertiesTopLogprobsVariant0(
1948                    inner,
1949                ) => ::std::result::Result::Ok(inner),
1950                other => ::std::result::Result::Err(other),
1951            }
1952        }
1953    }
1954    impl ::std::convert::From<Option<::serde_json::Value>> for ModelResponsePropertiesTopLogprobs {
1955        fn from(value: Option<::serde_json::Value>) -> Self {
1956            ModelResponsePropertiesTopLogprobs::ModelResponsePropertiesTopLogprobsVariant1(value)
1957        }
1958    }
1959    impl ::std::convert::TryFrom<ModelResponsePropertiesTopLogprobs> for Option<::serde_json::Value> {
1960        type Error = ModelResponsePropertiesTopLogprobs;
1961        /// # Errors
1962        ///
1963        /// Returns the original enum value if it does not match the
1964        /// `#variant_ident` variant.
1965        fn try_from(
1966            value: ModelResponsePropertiesTopLogprobs,
1967        ) -> ::std::result::Result<Self, Self::Error> {
1968            match value {
1969                ModelResponsePropertiesTopLogprobs::ModelResponsePropertiesTopLogprobsVariant1(
1970                    inner,
1971                ) => ::std::result::Result::Ok(inner),
1972                other => ::std::result::Result::Err(other),
1973            }
1974        }
1975    }
1976    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
1977    #[serde(untagged)]
1978    pub enum ModelResponsePropertiesTemperature {
1979        ModelResponsePropertiesTemperatureVariant0(f64),
1980        ModelResponsePropertiesTemperatureVariant1(Option<::serde_json::Value>),
1981    }
1982    impl ::std::convert::From<f64> for ModelResponsePropertiesTemperature {
1983        fn from(value: f64) -> Self {
1984            ModelResponsePropertiesTemperature::ModelResponsePropertiesTemperatureVariant0(value)
1985        }
1986    }
1987    impl ::std::convert::TryFrom<ModelResponsePropertiesTemperature> for f64 {
1988        type Error = ModelResponsePropertiesTemperature;
1989        /// # Errors
1990        ///
1991        /// Returns the original enum value if it does not match the
1992        /// `#variant_ident` variant.
1993        fn try_from(
1994            value: ModelResponsePropertiesTemperature,
1995        ) -> ::std::result::Result<Self, Self::Error> {
1996            match value {
1997                ModelResponsePropertiesTemperature::ModelResponsePropertiesTemperatureVariant0(
1998                    inner,
1999                ) => ::std::result::Result::Ok(inner),
2000                other => ::std::result::Result::Err(other),
2001            }
2002        }
2003    }
2004    impl ::std::convert::From<Option<::serde_json::Value>> for ModelResponsePropertiesTemperature {
2005        fn from(value: Option<::serde_json::Value>) -> Self {
2006            ModelResponsePropertiesTemperature::ModelResponsePropertiesTemperatureVariant1(value)
2007        }
2008    }
2009    impl ::std::convert::TryFrom<ModelResponsePropertiesTemperature> for Option<::serde_json::Value> {
2010        type Error = ModelResponsePropertiesTemperature;
2011        /// # Errors
2012        ///
2013        /// Returns the original enum value if it does not match the
2014        /// `#variant_ident` variant.
2015        fn try_from(
2016            value: ModelResponsePropertiesTemperature,
2017        ) -> ::std::result::Result<Self, Self::Error> {
2018            match value {
2019                ModelResponsePropertiesTemperature::ModelResponsePropertiesTemperatureVariant1(
2020                    inner,
2021                ) => ::std::result::Result::Ok(inner),
2022                other => ::std::result::Result::Err(other),
2023            }
2024        }
2025    }
2026    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
2027    #[serde(untagged)]
2028    pub enum ModelResponsePropertiesTopP {
2029        ModelResponsePropertiesTopPVariant0(f64),
2030        ModelResponsePropertiesTopPVariant1(Option<::serde_json::Value>),
2031    }
2032    impl ::std::convert::From<f64> for ModelResponsePropertiesTopP {
2033        fn from(value: f64) -> Self {
2034            ModelResponsePropertiesTopP::ModelResponsePropertiesTopPVariant0(value)
2035        }
2036    }
2037    impl ::std::convert::TryFrom<ModelResponsePropertiesTopP> for f64 {
2038        type Error = ModelResponsePropertiesTopP;
2039        /// # Errors
2040        ///
2041        /// Returns the original enum value if it does not match the
2042        /// `#variant_ident` variant.
2043        fn try_from(
2044            value: ModelResponsePropertiesTopP,
2045        ) -> ::std::result::Result<Self, Self::Error> {
2046            match value {
2047                ModelResponsePropertiesTopP::ModelResponsePropertiesTopPVariant0(inner) => {
2048                    ::std::result::Result::Ok(inner)
2049                }
2050                other => ::std::result::Result::Err(other),
2051            }
2052        }
2053    }
2054    impl ::std::convert::From<Option<::serde_json::Value>> for ModelResponsePropertiesTopP {
2055        fn from(value: Option<::serde_json::Value>) -> Self {
2056            ModelResponsePropertiesTopP::ModelResponsePropertiesTopPVariant1(value)
2057        }
2058    }
2059    impl ::std::convert::TryFrom<ModelResponsePropertiesTopP> for Option<::serde_json::Value> {
2060        type Error = ModelResponsePropertiesTopP;
2061        /// # Errors
2062        ///
2063        /// Returns the original enum value if it does not match the
2064        /// `#variant_ident` variant.
2065        fn try_from(
2066            value: ModelResponsePropertiesTopP,
2067        ) -> ::std::result::Result<Self, Self::Error> {
2068            match value {
2069                ModelResponsePropertiesTopP::ModelResponsePropertiesTopPVariant1(inner) => {
2070                    ::std::result::Result::Ok(inner)
2071                }
2072                other => ::std::result::Result::Err(other),
2073            }
2074        }
2075    }
2076    /// The retention policy for the prompt cache. Set to `24h` to enable extended prompt caching, which keeps cached prefixes active for longer, up to a maximum of 24 hours. [Learn more](/docs/guides/prompt-caching#prompt-cache-retention).
2077    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
2078    pub enum ModelResponsePropertiesPromptCacheRetentionVariant0 {
2079        #[serde(rename = "in_memory")]
2080        InMemory,
2081        #[serde(rename = "24h")]
2082        _24h,
2083    }
2084    impl ::std::fmt::Display for ModelResponsePropertiesPromptCacheRetentionVariant0 {
2085        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
2086            match self {
2087                Self::InMemory => ::std::write!(__f, "in_memory"),
2088                Self::_24h => ::std::write!(__f, "24h"),
2089            }
2090        }
2091    }
2092    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
2093    #[serde(untagged)]
2094    pub enum ModelResponsePropertiesPromptCacheRetention {
2095        ModelResponsePropertiesPromptCacheRetentionVariant0(
2096            ModelResponsePropertiesPromptCacheRetentionVariant0,
2097        ),
2098        ModelResponsePropertiesPromptCacheRetentionVariant1(Option<::serde_json::Value>),
2099    }
2100    impl ::std::convert::From<ModelResponsePropertiesPromptCacheRetentionVariant0>
2101        for ModelResponsePropertiesPromptCacheRetention
2102    {
2103        fn from(value: ModelResponsePropertiesPromptCacheRetentionVariant0) -> Self {
2104            ModelResponsePropertiesPromptCacheRetention::ModelResponsePropertiesPromptCacheRetentionVariant0(
2105                value,
2106            )
2107        }
2108    }
2109    impl ::std::convert::TryFrom<ModelResponsePropertiesPromptCacheRetention>
2110        for ModelResponsePropertiesPromptCacheRetentionVariant0
2111    {
2112        type Error = ModelResponsePropertiesPromptCacheRetention;
2113        /// # Errors
2114        ///
2115        /// Returns the original enum value if it does not match the
2116        /// `#variant_ident` variant.
2117        fn try_from(
2118            value: ModelResponsePropertiesPromptCacheRetention,
2119        ) -> ::std::result::Result<Self, Self::Error> {
2120            match value {
2121                ModelResponsePropertiesPromptCacheRetention::ModelResponsePropertiesPromptCacheRetentionVariant0(
2122                    inner,
2123                ) => ::std::result::Result::Ok(inner),
2124                other => ::std::result::Result::Err(other),
2125            }
2126        }
2127    }
2128    impl ::std::convert::From<Option<::serde_json::Value>>
2129        for ModelResponsePropertiesPromptCacheRetention
2130    {
2131        fn from(value: Option<::serde_json::Value>) -> Self {
2132            ModelResponsePropertiesPromptCacheRetention::ModelResponsePropertiesPromptCacheRetentionVariant1(
2133                value,
2134            )
2135        }
2136    }
2137    impl ::std::convert::TryFrom<ModelResponsePropertiesPromptCacheRetention>
2138        for Option<::serde_json::Value>
2139    {
2140        type Error = ModelResponsePropertiesPromptCacheRetention;
2141        /// # Errors
2142        ///
2143        /// Returns the original enum value if it does not match the
2144        /// `#variant_ident` variant.
2145        fn try_from(
2146            value: ModelResponsePropertiesPromptCacheRetention,
2147        ) -> ::std::result::Result<Self, Self::Error> {
2148            match value {
2149                ModelResponsePropertiesPromptCacheRetention::ModelResponsePropertiesPromptCacheRetentionVariant1(
2150                    inner,
2151                ) => ::std::result::Result::Ok(inner),
2152                other => ::std::result::Result::Err(other),
2153            }
2154        }
2155    }
2156    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
2157    pub struct ModelResponseProperties {
2158        #[serde(skip_serializing_if = "Option::is_none")]
2159        pub metadata: Option<Metadata>,
2160        #[serde(skip_serializing_if = "Option::is_none")]
2161        pub top_logprobs: Option<ModelResponsePropertiesTopLogprobs>,
2162        #[serde(skip_serializing_if = "Option::is_none")]
2163        pub temperature: Option<ModelResponsePropertiesTemperature>,
2164        #[serde(skip_serializing_if = "Option::is_none")]
2165        pub top_p: Option<ModelResponsePropertiesTopP>,
2166        #[serde(skip_serializing_if = "Option::is_none")]
2167        /// This field is being replaced by `safety_identifier` and `prompt_cache_key`. Use `prompt_cache_key` instead to maintain caching optimizations.
2168        /// A stable identifier for your end-users.
2169        /// Used to boost cache hit rates by better bucketing similar requests and  to help OpenAI detect and prevent abuse. [Learn more](/docs/guides/safety-best-practices#safety-identifiers).
2170        #[deprecated]
2171        pub user: Option<String>,
2172        #[serde(skip_serializing_if = "Option::is_none")]
2173        /// A stable identifier used to help detect users of your application that may be violating OpenAI's usage policies.
2174        /// The IDs should be a string that uniquely identifies each user, with a maximum length of 64 characters. We recommend hashing their username or email address, in order to avoid sending us any identifying information. [Learn more](/docs/guides/safety-best-practices#safety-identifiers).
2175        pub safety_identifier: Option<String>,
2176        #[serde(skip_serializing_if = "Option::is_none")]
2177        /// Used by OpenAI to cache responses for similar requests to optimize your cache hit rates. Replaces the `user` field. [Learn more](/docs/guides/prompt-caching).
2178        pub prompt_cache_key: Option<String>,
2179        #[serde(skip_serializing_if = "Option::is_none")]
2180        pub service_tier: Option<ServiceTier>,
2181        #[serde(skip_serializing_if = "Option::is_none")]
2182        pub prompt_cache_retention: Option<ModelResponsePropertiesPromptCacheRetention>,
2183    }
2184    /// Constrains the verbosity of the model's response. Lower values will result in
2185    /// more concise responses, while higher values will result in more verbose responses.
2186    /// Currently supported values are `low`, `medium`, and `high`.
2187    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
2188    pub enum VerbosityVariant0 {
2189        #[serde(rename = "low")]
2190        Low,
2191        #[serde(rename = "medium")]
2192        Medium,
2193        #[serde(rename = "high")]
2194        High,
2195    }
2196    impl ::std::fmt::Display for VerbosityVariant0 {
2197        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
2198            match self {
2199                Self::Low => ::std::write!(__f, "low"),
2200                Self::Medium => ::std::write!(__f, "medium"),
2201                Self::High => ::std::write!(__f, "high"),
2202            }
2203        }
2204    }
2205    impl ::std::convert::From<VerbosityVariant0> for Verbosity {
2206        fn from(value: VerbosityVariant0) -> Self {
2207            Verbosity::VerbosityVariant0(value)
2208        }
2209    }
2210    impl ::std::convert::TryFrom<Verbosity> for VerbosityVariant0 {
2211        type Error = Verbosity;
2212        /// # Errors
2213        ///
2214        /// Returns the original enum value if it does not match the
2215        /// `#variant_ident` variant.
2216        fn try_from(value: Verbosity) -> ::std::result::Result<Self, Self::Error> {
2217            match value {
2218                Verbosity::VerbosityVariant0(inner) => ::std::result::Result::Ok(inner),
2219                other => ::std::result::Result::Err(other),
2220            }
2221        }
2222    }
2223    impl ::std::convert::From<Option<::serde_json::Value>> for Verbosity {
2224        fn from(value: Option<::serde_json::Value>) -> Self {
2225            Verbosity::VerbosityVariant1(value)
2226        }
2227    }
2228    impl ::std::convert::TryFrom<Verbosity> for Option<::serde_json::Value> {
2229        type Error = Verbosity;
2230        /// # Errors
2231        ///
2232        /// Returns the original enum value if it does not match the
2233        /// `#variant_ident` variant.
2234        fn try_from(value: Verbosity) -> ::std::result::Result<Self, Self::Error> {
2235            match value {
2236                Verbosity::VerbosityVariant1(inner) => ::std::result::Result::Ok(inner),
2237                other => ::std::result::Result::Err(other),
2238            }
2239        }
2240    }
2241    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
2242    #[serde(untagged)]
2243    pub enum Verbosity {
2244        VerbosityVariant0(VerbosityVariant0),
2245        VerbosityVariant1(Option<::serde_json::Value>),
2246    }
2247    /// The type of the predicted content you want to provide. This type is
2248    /// currently always `content`.
2249    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
2250    pub enum PredictionContentType {
2251        #[serde(rename = "content")]
2252        Content,
2253    }
2254    impl ::std::fmt::Display for PredictionContentType {
2255        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
2256            match self {
2257                Self::Content => ::std::write!(__f, "content"),
2258            }
2259        }
2260    }
2261    /// The type of the content part.
2262    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
2263    pub enum ChatCompletionRequestMessageContentPartTextType {
2264        #[serde(rename = "text")]
2265        Text,
2266    }
2267    impl ::std::fmt::Display for ChatCompletionRequestMessageContentPartTextType {
2268        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
2269            match self {
2270                Self::Text => ::std::write!(__f, "text"),
2271            }
2272        }
2273    }
2274    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
2275    /// # Text content part
2276    /// Learn about [text inputs](/docs/guides/text-generation).
2277    pub struct ChatCompletionRequestMessageContentPartText {
2278        /// The type of the content part.
2279        pub r#type: ChatCompletionRequestMessageContentPartTextType,
2280        /// The text content.
2281        pub text: String,
2282    }
2283    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
2284    #[serde(untagged)]
2285    /// The content that should be matched when generating a model response.
2286    /// If generated tokens would match this content, the entire model response
2287    /// can be returned much more quickly.
2288    pub enum PredictionContentContent {
2289        PredictionContentContentVariant0(String),
2290        PredictionContentContentVariant1(Vec<ChatCompletionRequestMessageContentPartText>),
2291    }
2292    impl ::std::convert::From<String> for PredictionContentContent {
2293        fn from(value: String) -> Self {
2294            PredictionContentContent::PredictionContentContentVariant0(value)
2295        }
2296    }
2297    impl ::std::convert::TryFrom<PredictionContentContent> for String {
2298        type Error = PredictionContentContent;
2299        /// # Errors
2300        ///
2301        /// Returns the original enum value if it does not match the
2302        /// `#variant_ident` variant.
2303        fn try_from(value: PredictionContentContent) -> ::std::result::Result<Self, Self::Error> {
2304            match value {
2305                PredictionContentContent::PredictionContentContentVariant0(inner) => {
2306                    ::std::result::Result::Ok(inner)
2307                }
2308                other => ::std::result::Result::Err(other),
2309            }
2310        }
2311    }
2312    impl ::std::convert::From<Vec<ChatCompletionRequestMessageContentPartText>>
2313        for PredictionContentContent
2314    {
2315        fn from(value: Vec<ChatCompletionRequestMessageContentPartText>) -> Self {
2316            PredictionContentContent::PredictionContentContentVariant1(value)
2317        }
2318    }
2319    impl ::std::convert::TryFrom<PredictionContentContent>
2320        for Vec<ChatCompletionRequestMessageContentPartText>
2321    {
2322        type Error = PredictionContentContent;
2323        /// # Errors
2324        ///
2325        /// Returns the original enum value if it does not match the
2326        /// `#variant_ident` variant.
2327        fn try_from(value: PredictionContentContent) -> ::std::result::Result<Self, Self::Error> {
2328            match value {
2329                PredictionContentContent::PredictionContentContentVariant1(inner) => {
2330                    ::std::result::Result::Ok(inner)
2331                }
2332                other => ::std::result::Result::Err(other),
2333            }
2334        }
2335    }
2336    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
2337    /// # Static Content
2338    /// Static predicted output content, such as the content of a text file that is
2339    /// being regenerated.
2340    pub struct PredictionContent {
2341        /// The type of the predicted content you want to provide. This type is
2342        /// currently always `content`.
2343        pub r#type: PredictionContentType,
2344        /// The content that should be matched when generating a model response.
2345        /// If generated tokens would match this content, the entire model response
2346        /// can be returned much more quickly.
2347        pub content: PredictionContentContent,
2348    }
2349    /// Constrains effort on reasoning for
2350    /// [reasoning models](https://platform.openai.com/docs/guides/reasoning).
2351    /// Currently supported values are `none`, `minimal`, `low`, `medium`, `high`, and `xhigh`. Reducing
2352    /// reasoning effort can result in faster responses and fewer tokens used
2353    /// on reasoning in a response.
2354    ///
2355    /// - `gpt-5.1` defaults to `none`, which does not perform reasoning. The supported reasoning values for `gpt-5.1` are `none`, `low`, `medium`, and `high`. Tool calls are supported for all reasoning values in gpt-5.1.
2356    /// - All models before `gpt-5.1` default to `medium` reasoning effort, and do not support `none`.
2357    /// - The `gpt-5-pro` model defaults to (and only supports) `high` reasoning effort.
2358    /// - `xhigh` is supported for all models after `gpt-5.1-codex-max`.
2359    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
2360    pub enum ReasoningEffortVariant0 {
2361        #[serde(rename = "none")]
2362        None,
2363        #[serde(rename = "minimal")]
2364        Minimal,
2365        #[serde(rename = "low")]
2366        Low,
2367        #[serde(rename = "medium")]
2368        Medium,
2369        #[serde(rename = "high")]
2370        High,
2371        #[serde(rename = "xhigh")]
2372        Xhigh,
2373    }
2374    impl ::std::fmt::Display for ReasoningEffortVariant0 {
2375        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
2376            match self {
2377                Self::None => ::std::write!(__f, "none"),
2378                Self::Minimal => ::std::write!(__f, "minimal"),
2379                Self::Low => ::std::write!(__f, "low"),
2380                Self::Medium => ::std::write!(__f, "medium"),
2381                Self::High => ::std::write!(__f, "high"),
2382                Self::Xhigh => ::std::write!(__f, "xhigh"),
2383            }
2384        }
2385    }
2386    impl ::std::convert::From<ReasoningEffortVariant0> for ReasoningEffort {
2387        fn from(value: ReasoningEffortVariant0) -> Self {
2388            ReasoningEffort::ReasoningEffortVariant0(value)
2389        }
2390    }
2391    impl ::std::convert::TryFrom<ReasoningEffort> for ReasoningEffortVariant0 {
2392        type Error = ReasoningEffort;
2393        /// # Errors
2394        ///
2395        /// Returns the original enum value if it does not match the
2396        /// `#variant_ident` variant.
2397        fn try_from(value: ReasoningEffort) -> ::std::result::Result<Self, Self::Error> {
2398            match value {
2399                ReasoningEffort::ReasoningEffortVariant0(inner) => ::std::result::Result::Ok(inner),
2400                other => ::std::result::Result::Err(other),
2401            }
2402        }
2403    }
2404    impl ::std::convert::From<Option<::serde_json::Value>> for ReasoningEffort {
2405        fn from(value: Option<::serde_json::Value>) -> Self {
2406            ReasoningEffort::ReasoningEffortVariant1(value)
2407        }
2408    }
2409    impl ::std::convert::TryFrom<ReasoningEffort> for Option<::serde_json::Value> {
2410        type Error = ReasoningEffort;
2411        /// # Errors
2412        ///
2413        /// Returns the original enum value if it does not match the
2414        /// `#variant_ident` variant.
2415        fn try_from(value: ReasoningEffort) -> ::std::result::Result<Self, Self::Error> {
2416            match value {
2417                ReasoningEffort::ReasoningEffortVariant1(inner) => ::std::result::Result::Ok(inner),
2418                other => ::std::result::Result::Err(other),
2419            }
2420        }
2421    }
2422    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
2423    #[serde(untagged)]
2424    pub enum ReasoningEffort {
2425        ReasoningEffortVariant0(ReasoningEffortVariant0),
2426        ReasoningEffortVariant1(Option<::serde_json::Value>),
2427    }
2428    impl ::std::convert::From<String> for StopConfiguration {
2429        fn from(value: String) -> Self {
2430            StopConfiguration::StopConfigurationVariant0(value)
2431        }
2432    }
2433    impl ::std::convert::TryFrom<StopConfiguration> for String {
2434        type Error = StopConfiguration;
2435        /// # Errors
2436        ///
2437        /// Returns the original enum value if it does not match the
2438        /// `#variant_ident` variant.
2439        fn try_from(value: StopConfiguration) -> ::std::result::Result<Self, Self::Error> {
2440            match value {
2441                StopConfiguration::StopConfigurationVariant0(inner) => {
2442                    ::std::result::Result::Ok(inner)
2443                }
2444                other => ::std::result::Result::Err(other),
2445            }
2446        }
2447    }
2448    impl ::std::convert::From<Vec<String>> for StopConfiguration {
2449        fn from(value: Vec<String>) -> Self {
2450            StopConfiguration::StopConfigurationVariant1(value)
2451        }
2452    }
2453    impl ::std::convert::TryFrom<StopConfiguration> for Vec<String> {
2454        type Error = StopConfiguration;
2455        /// # Errors
2456        ///
2457        /// Returns the original enum value if it does not match the
2458        /// `#variant_ident` variant.
2459        fn try_from(value: StopConfiguration) -> ::std::result::Result<Self, Self::Error> {
2460            match value {
2461                StopConfiguration::StopConfigurationVariant1(inner) => {
2462                    ::std::result::Result::Ok(inner)
2463                }
2464                other => ::std::result::Result::Err(other),
2465            }
2466        }
2467    }
2468    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
2469    #[serde(untagged)]
2470    /// Not supported with latest reasoning models `o3` and `o4-mini`.
2471    ///
2472    /// Up to 4 sequences where the API will stop generating further tokens. The
2473    /// returned text will not contain the stop sequence.
2474    pub enum StopConfiguration {
2475        StopConfigurationVariant0(String),
2476        StopConfigurationVariant1(Vec<String>),
2477    }
2478    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
2479    pub enum ResponseModalitiesVariant0 {
2480        #[serde(rename = "text")]
2481        Text,
2482        #[serde(rename = "audio")]
2483        Audio,
2484    }
2485    impl ::std::fmt::Display for ResponseModalitiesVariant0 {
2486        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
2487            match self {
2488                Self::Text => ::std::write!(__f, "text"),
2489                Self::Audio => ::std::write!(__f, "audio"),
2490            }
2491        }
2492    }
2493    impl ::std::convert::From<Vec<ResponseModalitiesVariant0>> for ResponseModalities {
2494        fn from(value: Vec<ResponseModalitiesVariant0>) -> Self {
2495            ResponseModalities::ResponseModalitiesVariant0(value)
2496        }
2497    }
2498    impl ::std::convert::TryFrom<ResponseModalities> for Vec<ResponseModalitiesVariant0> {
2499        type Error = ResponseModalities;
2500        /// # Errors
2501        ///
2502        /// Returns the original enum value if it does not match the
2503        /// `#variant_ident` variant.
2504        fn try_from(value: ResponseModalities) -> ::std::result::Result<Self, Self::Error> {
2505            match value {
2506                ResponseModalities::ResponseModalitiesVariant0(inner) => {
2507                    ::std::result::Result::Ok(inner)
2508                }
2509                other => ::std::result::Result::Err(other),
2510            }
2511        }
2512    }
2513    impl ::std::convert::From<Option<::serde_json::Value>> for ResponseModalities {
2514        fn from(value: Option<::serde_json::Value>) -> Self {
2515            ResponseModalities::ResponseModalitiesVariant1(value)
2516        }
2517    }
2518    impl ::std::convert::TryFrom<ResponseModalities> for Option<::serde_json::Value> {
2519        type Error = ResponseModalities;
2520        /// # Errors
2521        ///
2522        /// Returns the original enum value if it does not match the
2523        /// `#variant_ident` variant.
2524        fn try_from(value: ResponseModalities) -> ::std::result::Result<Self, Self::Error> {
2525            match value {
2526                ResponseModalities::ResponseModalitiesVariant1(inner) => {
2527                    ::std::result::Result::Ok(inner)
2528                }
2529                other => ::std::result::Result::Err(other),
2530            }
2531        }
2532    }
2533    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
2534    #[serde(untagged)]
2535    pub enum ResponseModalities {
2536        ResponseModalitiesVariant0(Vec<ResponseModalitiesVariant0>),
2537        ResponseModalitiesVariant1(Option<::serde_json::Value>),
2538    }
2539    /// The type of response format being defined. Always `text`.
2540    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
2541    pub enum ResponseFormatTextType {
2542        #[serde(rename = "text")]
2543        Text,
2544    }
2545    impl ::std::fmt::Display for ResponseFormatTextType {
2546        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
2547            match self {
2548                Self::Text => ::std::write!(__f, "text"),
2549            }
2550        }
2551    }
2552    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
2553    /// # Text
2554    /// Default response format. Used to generate text responses.
2555    pub struct ResponseFormatText {
2556        /// The type of response format being defined. Always `text`.
2557        pub r#type: ResponseFormatTextType,
2558    }
2559    /// # JSON schema
2560    /// The schema for the response format, described as a JSON Schema object.
2561    /// Learn how to build JSON schemas [here](https://json-schema.org/).
2562    pub type ResponseFormatJsonSchemaSchema =
2563        ::std::collections::BTreeMap<String, ::serde_json::Value>;
2564    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
2565    /// # Web search location
2566    /// Approximate location parameters for the search.
2567    pub struct WebSearchLocation {
2568        #[serde(skip_serializing_if = "Option::is_none")]
2569        /// The two-letter
2570        /// [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user,
2571        /// e.g. `US`.
2572        pub country: Option<String>,
2573        #[serde(skip_serializing_if = "Option::is_none")]
2574        /// Free text input for the region of the user, e.g. `California`.
2575        pub region: Option<String>,
2576        #[serde(skip_serializing_if = "Option::is_none")]
2577        /// Free text input for the city of the user, e.g. `San Francisco`.
2578        pub city: Option<String>,
2579        #[serde(skip_serializing_if = "Option::is_none")]
2580        /// The [IANA timezone](https://timeapi.io/documentation/iana-timezones)
2581        /// of the user, e.g. `America/Los_Angeles`.
2582        pub timezone: Option<String>,
2583    }
2584    impl ::std::fmt::Display for WebSearchContextSize {
2585        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
2586            match self {
2587                Self::Low => ::std::write!(__f, "low"),
2588                Self::Medium => ::std::write!(__f, "medium"),
2589                Self::High => ::std::write!(__f, "high"),
2590            }
2591        }
2592    }
2593    /// High level guidance for the amount of context window space to use for the
2594    /// search. One of `low`, `medium`, or `high`. `medium` is the default.
2595    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
2596    pub enum WebSearchContextSize {
2597        #[serde(rename = "low")]
2598        Low,
2599        #[serde(rename = "medium")]
2600        Medium,
2601        #[serde(rename = "high")]
2602        High,
2603    }
2604    /// The object type, which is always "model".
2605    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
2606    pub enum ModelObject {
2607        #[serde(rename = "model")]
2608        Model,
2609    }
2610    impl ::std::fmt::Display for ModelObject {
2611        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
2612            match self {
2613                Self::Model => ::std::write!(__f, "model"),
2614            }
2615        }
2616    }
2617    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
2618    /// # Model
2619    /// Describes an OpenAI model offering that can be used with the API.
2620    pub struct Model {
2621        /// The model identifier, which can be referenced in the API endpoints.
2622        pub id: String,
2623        /// The Unix timestamp (in seconds) when the model was created.
2624        pub created: i64,
2625        /// The object type, which is always "model".
2626        pub object: ModelObject,
2627        /// The organization that owns the model.
2628        pub owned_by: String,
2629    }
2630    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
2631    pub enum ListModelsResponseObject {
2632        #[serde(rename = "list")]
2633        List,
2634    }
2635    impl ::std::fmt::Display for ListModelsResponseObject {
2636        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
2637            match self {
2638                Self::List => ::std::write!(__f, "list"),
2639            }
2640        }
2641    }
2642    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
2643    pub struct ListModelsResponse {
2644        pub object: ListModelsResponseObject,
2645        pub data: Vec<Model>,
2646    }
2647    /// The type of response format being defined. Always `json_schema`.
2648    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
2649    pub enum ResponseFormatJsonSchemaType {
2650        #[serde(rename = "json_schema")]
2651        JsonSchema,
2652    }
2653    impl ::std::fmt::Display for ResponseFormatJsonSchemaType {
2654        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
2655            match self {
2656                Self::JsonSchema => ::std::write!(__f, "json_schema"),
2657            }
2658        }
2659    }
2660    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
2661    #[serde(untagged)]
2662    pub enum ResponseFormatJsonSchemaJsonSchemaStrict {
2663        ResponseFormatJsonSchemaJsonSchemaStrictVariant0(bool),
2664        ResponseFormatJsonSchemaJsonSchemaStrictVariant1(Option<::serde_json::Value>),
2665    }
2666    impl ::std::convert::From<bool> for ResponseFormatJsonSchemaJsonSchemaStrict {
2667        fn from(value: bool) -> Self {
2668            ResponseFormatJsonSchemaJsonSchemaStrict::ResponseFormatJsonSchemaJsonSchemaStrictVariant0(
2669                value,
2670            )
2671        }
2672    }
2673    impl ::std::convert::TryFrom<ResponseFormatJsonSchemaJsonSchemaStrict> for bool {
2674        type Error = ResponseFormatJsonSchemaJsonSchemaStrict;
2675        /// # Errors
2676        ///
2677        /// Returns the original enum value if it does not match the
2678        /// `#variant_ident` variant.
2679        fn try_from(
2680            value: ResponseFormatJsonSchemaJsonSchemaStrict,
2681        ) -> ::std::result::Result<Self, Self::Error> {
2682            match value {
2683                ResponseFormatJsonSchemaJsonSchemaStrict::ResponseFormatJsonSchemaJsonSchemaStrictVariant0(
2684                    inner,
2685                ) => ::std::result::Result::Ok(inner),
2686                other => ::std::result::Result::Err(other),
2687            }
2688        }
2689    }
2690    impl ::std::convert::From<Option<::serde_json::Value>>
2691        for ResponseFormatJsonSchemaJsonSchemaStrict
2692    {
2693        fn from(value: Option<::serde_json::Value>) -> Self {
2694            ResponseFormatJsonSchemaJsonSchemaStrict::ResponseFormatJsonSchemaJsonSchemaStrictVariant1(
2695                value,
2696            )
2697        }
2698    }
2699    impl ::std::convert::TryFrom<ResponseFormatJsonSchemaJsonSchemaStrict>
2700        for Option<::serde_json::Value>
2701    {
2702        type Error = ResponseFormatJsonSchemaJsonSchemaStrict;
2703        /// # Errors
2704        ///
2705        /// Returns the original enum value if it does not match the
2706        /// `#variant_ident` variant.
2707        fn try_from(
2708            value: ResponseFormatJsonSchemaJsonSchemaStrict,
2709        ) -> ::std::result::Result<Self, Self::Error> {
2710            match value {
2711                ResponseFormatJsonSchemaJsonSchemaStrict::ResponseFormatJsonSchemaJsonSchemaStrictVariant1(
2712                    inner,
2713                ) => ::std::result::Result::Ok(inner),
2714                other => ::std::result::Result::Err(other),
2715            }
2716        }
2717    }
2718    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
2719    /// # JSON schema
2720    /// Structured Outputs configuration options, including a JSON Schema.
2721    pub struct ResponseFormatJsonSchemaJsonSchema {
2722        #[serde(skip_serializing_if = "Option::is_none")]
2723        /// A description of what the response format is for, used by the model to
2724        /// determine how to respond in the format.
2725        pub description: Option<String>,
2726        /// The name of the response format. Must be a-z, A-Z, 0-9, or contain
2727        /// underscores and dashes, with a maximum length of 64.
2728        pub name: String,
2729        #[serde(skip_serializing_if = "Option::is_none")]
2730        pub schema: Option<ResponseFormatJsonSchemaSchema>,
2731        #[serde(skip_serializing_if = "Option::is_none")]
2732        pub strict: Option<ResponseFormatJsonSchemaJsonSchemaStrict>,
2733    }
2734    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
2735    /// # JSON schema
2736    /// JSON Schema response format. Used to generate structured JSON responses.
2737    /// Learn more about [Structured Outputs](/docs/guides/structured-outputs).
2738    pub struct ResponseFormatJsonSchema {
2739        /// The type of response format being defined. Always `json_schema`.
2740        pub r#type: ResponseFormatJsonSchemaType,
2741        /// Structured Outputs configuration options, including a JSON Schema.
2742        pub json_schema: ResponseFormatJsonSchemaJsonSchema,
2743    }
2744    /// The type of response format being defined. Always `json_object`.
2745    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
2746    pub enum ResponseFormatJsonObjectType {
2747        #[serde(rename = "json_object")]
2748        JsonObject,
2749    }
2750    impl ::std::fmt::Display for ResponseFormatJsonObjectType {
2751        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
2752            match self {
2753                Self::JsonObject => ::std::write!(__f, "json_object"),
2754            }
2755        }
2756    }
2757    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
2758    /// # JSON object
2759    /// JSON object response format. An older method of generating JSON responses.
2760    /// Using `json_schema` is recommended for models that support it. Note that the
2761    /// model will not generate JSON without a system or user message instructing it
2762    /// to do so.
2763    pub struct ResponseFormatJsonObject {
2764        /// The type of response format being defined. Always `json_object`.
2765        pub r#type: ResponseFormatJsonObjectType,
2766    }
2767    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
2768    /// Specifying a particular function via `{"name": "my_function"}` forces the model to call that function.
2769    pub struct ChatCompletionFunctionCallOption {
2770        /// The name of the function to call.
2771        pub name: String,
2772    }
2773    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
2774    #[deprecated]
2775    pub struct ChatCompletionFunctions {
2776        #[serde(skip_serializing_if = "Option::is_none")]
2777        /// A description of what the function does, used by the model to choose when and how to call the function.
2778        pub description: Option<String>,
2779        /// 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.
2780        pub name: String,
2781        #[serde(skip_serializing_if = "Option::is_none")]
2782        pub parameters: Option<FunctionParameters>,
2783    }
2784    /// Whether to enable [parallel function calling](/docs/guides/function-calling#configuring-parallel-function-calling) during tool use.
2785    pub type ParallelToolCalls = bool;
2786    /// The type of the tool. Always `custom`.
2787    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
2788    pub enum ChatCompletionMessageCustomToolCallType {
2789        #[serde(rename = "custom")]
2790        Custom,
2791    }
2792    impl ::std::fmt::Display for ChatCompletionMessageCustomToolCallType {
2793        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
2794            match self {
2795                Self::Custom => ::std::write!(__f, "custom"),
2796            }
2797        }
2798    }
2799    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
2800    /// The custom tool that the model called.
2801    pub struct ChatCompletionMessageCustomToolCallCustom {
2802        /// The name of the custom tool to call.
2803        pub name: String,
2804        /// The input for the custom tool call generated by the model.
2805        pub input: String,
2806    }
2807    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
2808    /// # Custom tool call
2809    /// A call to a custom tool created by the model.
2810    pub struct ChatCompletionMessageCustomToolCall {
2811        /// The ID of the tool call.
2812        pub id: String,
2813        /// The type of the tool. Always `custom`.
2814        pub r#type: ChatCompletionMessageCustomToolCallType,
2815        /// The custom tool that the model called.
2816        pub custom: ChatCompletionMessageCustomToolCallCustom,
2817    }
2818    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
2819    #[serde(untagged)]
2820    pub enum CreateChatCompletionRequestTopLogprobs {
2821        CreateChatCompletionRequestTopLogprobsVariant0(i64),
2822        CreateChatCompletionRequestTopLogprobsVariant1(Option<::serde_json::Value>),
2823    }
2824    impl ::std::convert::From<i64> for CreateChatCompletionRequestTopLogprobs {
2825        fn from(value: i64) -> Self {
2826            CreateChatCompletionRequestTopLogprobs::CreateChatCompletionRequestTopLogprobsVariant0(
2827                value,
2828            )
2829        }
2830    }
2831    impl ::std::convert::TryFrom<CreateChatCompletionRequestTopLogprobs> for i64 {
2832        type Error = CreateChatCompletionRequestTopLogprobs;
2833        /// # Errors
2834        ///
2835        /// Returns the original enum value if it does not match the
2836        /// `#variant_ident` variant.
2837        fn try_from(
2838            value: CreateChatCompletionRequestTopLogprobs,
2839        ) -> ::std::result::Result<Self, Self::Error> {
2840            match value {
2841                CreateChatCompletionRequestTopLogprobs::CreateChatCompletionRequestTopLogprobsVariant0(
2842                    inner,
2843                ) => ::std::result::Result::Ok(inner),
2844                other => ::std::result::Result::Err(other),
2845            }
2846        }
2847    }
2848    impl ::std::convert::From<Option<::serde_json::Value>> for CreateChatCompletionRequestTopLogprobs {
2849        fn from(value: Option<::serde_json::Value>) -> Self {
2850            CreateChatCompletionRequestTopLogprobs::CreateChatCompletionRequestTopLogprobsVariant1(
2851                value,
2852            )
2853        }
2854    }
2855    impl ::std::convert::TryFrom<CreateChatCompletionRequestTopLogprobs>
2856        for Option<::serde_json::Value>
2857    {
2858        type Error = CreateChatCompletionRequestTopLogprobs;
2859        /// # Errors
2860        ///
2861        /// Returns the original enum value if it does not match the
2862        /// `#variant_ident` variant.
2863        fn try_from(
2864            value: CreateChatCompletionRequestTopLogprobs,
2865        ) -> ::std::result::Result<Self, Self::Error> {
2866            match value {
2867                CreateChatCompletionRequestTopLogprobs::CreateChatCompletionRequestTopLogprobsVariant1(
2868                    inner,
2869                ) => ::std::result::Result::Ok(inner),
2870                other => ::std::result::Result::Err(other),
2871            }
2872        }
2873    }
2874    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
2875    #[serde(untagged)]
2876    pub enum CreateChatCompletionRequestTemperature {
2877        CreateChatCompletionRequestTemperatureVariant0(f64),
2878        CreateChatCompletionRequestTemperatureVariant1(Option<::serde_json::Value>),
2879    }
2880    impl ::std::convert::From<f64> for CreateChatCompletionRequestTemperature {
2881        fn from(value: f64) -> Self {
2882            CreateChatCompletionRequestTemperature::CreateChatCompletionRequestTemperatureVariant0(
2883                value,
2884            )
2885        }
2886    }
2887    impl ::std::convert::TryFrom<CreateChatCompletionRequestTemperature> for f64 {
2888        type Error = CreateChatCompletionRequestTemperature;
2889        /// # Errors
2890        ///
2891        /// Returns the original enum value if it does not match the
2892        /// `#variant_ident` variant.
2893        fn try_from(
2894            value: CreateChatCompletionRequestTemperature,
2895        ) -> ::std::result::Result<Self, Self::Error> {
2896            match value {
2897                CreateChatCompletionRequestTemperature::CreateChatCompletionRequestTemperatureVariant0(
2898                    inner,
2899                ) => ::std::result::Result::Ok(inner),
2900                other => ::std::result::Result::Err(other),
2901            }
2902        }
2903    }
2904    impl ::std::convert::From<Option<::serde_json::Value>> for CreateChatCompletionRequestTemperature {
2905        fn from(value: Option<::serde_json::Value>) -> Self {
2906            CreateChatCompletionRequestTemperature::CreateChatCompletionRequestTemperatureVariant1(
2907                value,
2908            )
2909        }
2910    }
2911    impl ::std::convert::TryFrom<CreateChatCompletionRequestTemperature>
2912        for Option<::serde_json::Value>
2913    {
2914        type Error = CreateChatCompletionRequestTemperature;
2915        /// # Errors
2916        ///
2917        /// Returns the original enum value if it does not match the
2918        /// `#variant_ident` variant.
2919        fn try_from(
2920            value: CreateChatCompletionRequestTemperature,
2921        ) -> ::std::result::Result<Self, Self::Error> {
2922            match value {
2923                CreateChatCompletionRequestTemperature::CreateChatCompletionRequestTemperatureVariant1(
2924                    inner,
2925                ) => ::std::result::Result::Ok(inner),
2926                other => ::std::result::Result::Err(other),
2927            }
2928        }
2929    }
2930    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
2931    #[serde(untagged)]
2932    pub enum CreateChatCompletionRequestTopP {
2933        CreateChatCompletionRequestTopPVariant0(f64),
2934        CreateChatCompletionRequestTopPVariant1(Option<::serde_json::Value>),
2935    }
2936    impl ::std::convert::From<f64> for CreateChatCompletionRequestTopP {
2937        fn from(value: f64) -> Self {
2938            CreateChatCompletionRequestTopP::CreateChatCompletionRequestTopPVariant0(value)
2939        }
2940    }
2941    impl ::std::convert::TryFrom<CreateChatCompletionRequestTopP> for f64 {
2942        type Error = CreateChatCompletionRequestTopP;
2943        /// # Errors
2944        ///
2945        /// Returns the original enum value if it does not match the
2946        /// `#variant_ident` variant.
2947        fn try_from(
2948            value: CreateChatCompletionRequestTopP,
2949        ) -> ::std::result::Result<Self, Self::Error> {
2950            match value {
2951                CreateChatCompletionRequestTopP::CreateChatCompletionRequestTopPVariant0(inner) => {
2952                    ::std::result::Result::Ok(inner)
2953                }
2954                other => ::std::result::Result::Err(other),
2955            }
2956        }
2957    }
2958    impl ::std::convert::From<Option<::serde_json::Value>> for CreateChatCompletionRequestTopP {
2959        fn from(value: Option<::serde_json::Value>) -> Self {
2960            CreateChatCompletionRequestTopP::CreateChatCompletionRequestTopPVariant1(value)
2961        }
2962    }
2963    impl ::std::convert::TryFrom<CreateChatCompletionRequestTopP> for Option<::serde_json::Value> {
2964        type Error = CreateChatCompletionRequestTopP;
2965        /// # Errors
2966        ///
2967        /// Returns the original enum value if it does not match the
2968        /// `#variant_ident` variant.
2969        fn try_from(
2970            value: CreateChatCompletionRequestTopP,
2971        ) -> ::std::result::Result<Self, Self::Error> {
2972            match value {
2973                CreateChatCompletionRequestTopP::CreateChatCompletionRequestTopPVariant1(inner) => {
2974                    ::std::result::Result::Ok(inner)
2975                }
2976                other => ::std::result::Result::Err(other),
2977            }
2978        }
2979    }
2980    /// The retention policy for the prompt cache. Set to `24h` to enable extended prompt caching, which keeps cached prefixes active for longer, up to a maximum of 24 hours. [Learn more](/docs/guides/prompt-caching#prompt-cache-retention).
2981    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
2982    pub enum CreateChatCompletionRequestPromptCacheRetentionVariant0 {
2983        #[serde(rename = "in_memory")]
2984        InMemory,
2985        #[serde(rename = "24h")]
2986        _24h,
2987    }
2988    impl ::std::fmt::Display for CreateChatCompletionRequestPromptCacheRetentionVariant0 {
2989        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
2990            match self {
2991                Self::InMemory => ::std::write!(__f, "in_memory"),
2992                Self::_24h => ::std::write!(__f, "24h"),
2993            }
2994        }
2995    }
2996    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
2997    #[serde(untagged)]
2998    pub enum CreateChatCompletionRequestPromptCacheRetention {
2999        CreateChatCompletionRequestPromptCacheRetentionVariant0(
3000            CreateChatCompletionRequestPromptCacheRetentionVariant0,
3001        ),
3002        CreateChatCompletionRequestPromptCacheRetentionVariant1(Option<::serde_json::Value>),
3003    }
3004    impl ::std::convert::From<CreateChatCompletionRequestPromptCacheRetentionVariant0>
3005        for CreateChatCompletionRequestPromptCacheRetention
3006    {
3007        fn from(value: CreateChatCompletionRequestPromptCacheRetentionVariant0) -> Self {
3008            CreateChatCompletionRequestPromptCacheRetention::CreateChatCompletionRequestPromptCacheRetentionVariant0(
3009                value,
3010            )
3011        }
3012    }
3013    impl ::std::convert::TryFrom<CreateChatCompletionRequestPromptCacheRetention>
3014        for CreateChatCompletionRequestPromptCacheRetentionVariant0
3015    {
3016        type Error = CreateChatCompletionRequestPromptCacheRetention;
3017        /// # Errors
3018        ///
3019        /// Returns the original enum value if it does not match the
3020        /// `#variant_ident` variant.
3021        fn try_from(
3022            value: CreateChatCompletionRequestPromptCacheRetention,
3023        ) -> ::std::result::Result<Self, Self::Error> {
3024            match value {
3025                CreateChatCompletionRequestPromptCacheRetention::CreateChatCompletionRequestPromptCacheRetentionVariant0(
3026                    inner,
3027                ) => ::std::result::Result::Ok(inner),
3028                other => ::std::result::Result::Err(other),
3029            }
3030        }
3031    }
3032    impl ::std::convert::From<Option<::serde_json::Value>>
3033        for CreateChatCompletionRequestPromptCacheRetention
3034    {
3035        fn from(value: Option<::serde_json::Value>) -> Self {
3036            CreateChatCompletionRequestPromptCacheRetention::CreateChatCompletionRequestPromptCacheRetentionVariant1(
3037                value,
3038            )
3039        }
3040    }
3041    impl ::std::convert::TryFrom<CreateChatCompletionRequestPromptCacheRetention>
3042        for Option<::serde_json::Value>
3043    {
3044        type Error = CreateChatCompletionRequestPromptCacheRetention;
3045        /// # Errors
3046        ///
3047        /// Returns the original enum value if it does not match the
3048        /// `#variant_ident` variant.
3049        fn try_from(
3050            value: CreateChatCompletionRequestPromptCacheRetention,
3051        ) -> ::std::result::Result<Self, Self::Error> {
3052            match value {
3053                CreateChatCompletionRequestPromptCacheRetention::CreateChatCompletionRequestPromptCacheRetentionVariant1(
3054                    inner,
3055                ) => ::std::result::Result::Ok(inner),
3056                other => ::std::result::Result::Err(other),
3057            }
3058        }
3059    }
3060    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3061    #[serde(untagged)]
3062    /// The contents of the developer message.
3063    pub enum ChatCompletionRequestDeveloperMessageContent {
3064        ChatCompletionRequestDeveloperMessageContentVariant0(String),
3065        ChatCompletionRequestDeveloperMessageContentVariant1(
3066            Vec<ChatCompletionRequestMessageContentPartText>,
3067        ),
3068    }
3069    impl ::std::convert::From<String> for ChatCompletionRequestDeveloperMessageContent {
3070        fn from(value: String) -> Self {
3071            ChatCompletionRequestDeveloperMessageContent::ChatCompletionRequestDeveloperMessageContentVariant0(
3072                value,
3073            )
3074        }
3075    }
3076    impl ::std::convert::TryFrom<ChatCompletionRequestDeveloperMessageContent> for String {
3077        type Error = ChatCompletionRequestDeveloperMessageContent;
3078        /// # Errors
3079        ///
3080        /// Returns the original enum value if it does not match the
3081        /// `#variant_ident` variant.
3082        fn try_from(
3083            value: ChatCompletionRequestDeveloperMessageContent,
3084        ) -> ::std::result::Result<Self, Self::Error> {
3085            match value {
3086                ChatCompletionRequestDeveloperMessageContent::ChatCompletionRequestDeveloperMessageContentVariant0(
3087                    inner,
3088                ) => ::std::result::Result::Ok(inner),
3089                other => ::std::result::Result::Err(other),
3090            }
3091        }
3092    }
3093    impl ::std::convert::From<Vec<ChatCompletionRequestMessageContentPartText>>
3094        for ChatCompletionRequestDeveloperMessageContent
3095    {
3096        fn from(value: Vec<ChatCompletionRequestMessageContentPartText>) -> Self {
3097            ChatCompletionRequestDeveloperMessageContent::ChatCompletionRequestDeveloperMessageContentVariant1(
3098                value,
3099            )
3100        }
3101    }
3102    impl ::std::convert::TryFrom<ChatCompletionRequestDeveloperMessageContent>
3103        for Vec<ChatCompletionRequestMessageContentPartText>
3104    {
3105        type Error = ChatCompletionRequestDeveloperMessageContent;
3106        /// # Errors
3107        ///
3108        /// Returns the original enum value if it does not match the
3109        /// `#variant_ident` variant.
3110        fn try_from(
3111            value: ChatCompletionRequestDeveloperMessageContent,
3112        ) -> ::std::result::Result<Self, Self::Error> {
3113            match value {
3114                ChatCompletionRequestDeveloperMessageContent::ChatCompletionRequestDeveloperMessageContentVariant1(
3115                    inner,
3116                ) => ::std::result::Result::Ok(inner),
3117                other => ::std::result::Result::Err(other),
3118            }
3119        }
3120    }
3121    /// The role of the messages author, in this case `developer`.
3122    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
3123    pub enum ChatCompletionRequestDeveloperMessageRole {
3124        #[serde(rename = "developer")]
3125        Developer,
3126    }
3127    impl ::std::fmt::Display for ChatCompletionRequestDeveloperMessageRole {
3128        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
3129            match self {
3130                Self::Developer => ::std::write!(__f, "developer"),
3131            }
3132        }
3133    }
3134    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3135    /// # Developer message
3136    /// Developer-provided instructions that the model should follow, regardless of
3137    /// messages sent by the user. With o1 models and newer, `developer` messages
3138    /// replace the previous `system` messages.
3139    pub struct ChatCompletionRequestDeveloperMessage {
3140        /// The contents of the developer message.
3141        pub content: ChatCompletionRequestDeveloperMessageContent,
3142        /// The role of the messages author, in this case `developer`.
3143        pub role: ChatCompletionRequestDeveloperMessageRole,
3144        #[serde(skip_serializing_if = "Option::is_none")]
3145        /// An optional name for the participant. Provides the model information to differentiate between participants of the same role.
3146        pub name: Option<String>,
3147    }
3148    impl ::std::convert::From<ChatCompletionRequestMessageContentPartText>
3149        for ChatCompletionRequestSystemMessageContentPart
3150    {
3151        fn from(value: ChatCompletionRequestMessageContentPartText) -> Self {
3152            ChatCompletionRequestSystemMessageContentPart::ChatCompletionRequestMessageContentPartText(
3153                value,
3154            )
3155        }
3156    }
3157    impl ::std::convert::TryFrom<ChatCompletionRequestSystemMessageContentPart>
3158        for ChatCompletionRequestMessageContentPartText
3159    {
3160        type Error = ChatCompletionRequestSystemMessageContentPart;
3161        /// # Errors
3162        ///
3163        /// Returns the original enum value if it does not match the
3164        /// `#variant_ident` variant.
3165        fn try_from(
3166            value: ChatCompletionRequestSystemMessageContentPart,
3167        ) -> ::std::result::Result<Self, Self::Error> {
3168            match value {
3169                ChatCompletionRequestSystemMessageContentPart::ChatCompletionRequestMessageContentPartText(
3170                    inner,
3171                ) => ::std::result::Result::Ok(inner),
3172                other => ::std::result::Result::Err(other),
3173            }
3174        }
3175    }
3176    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3177    #[serde(untagged)]
3178    pub enum ChatCompletionRequestSystemMessageContentPart {
3179        ChatCompletionRequestMessageContentPartText(ChatCompletionRequestMessageContentPartText),
3180    }
3181    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3182    #[serde(untagged)]
3183    /// The contents of the system message.
3184    pub enum ChatCompletionRequestSystemMessageContent {
3185        ChatCompletionRequestSystemMessageContentVariant0(String),
3186        ChatCompletionRequestSystemMessageContentVariant1(
3187            Vec<ChatCompletionRequestSystemMessageContentPart>,
3188        ),
3189    }
3190    impl ::std::convert::From<String> for ChatCompletionRequestSystemMessageContent {
3191        fn from(value: String) -> Self {
3192            ChatCompletionRequestSystemMessageContent::ChatCompletionRequestSystemMessageContentVariant0(
3193                value,
3194            )
3195        }
3196    }
3197    impl ::std::convert::TryFrom<ChatCompletionRequestSystemMessageContent> for String {
3198        type Error = ChatCompletionRequestSystemMessageContent;
3199        /// # Errors
3200        ///
3201        /// Returns the original enum value if it does not match the
3202        /// `#variant_ident` variant.
3203        fn try_from(
3204            value: ChatCompletionRequestSystemMessageContent,
3205        ) -> ::std::result::Result<Self, Self::Error> {
3206            match value {
3207                ChatCompletionRequestSystemMessageContent::ChatCompletionRequestSystemMessageContentVariant0(
3208                    inner,
3209                ) => ::std::result::Result::Ok(inner),
3210                other => ::std::result::Result::Err(other),
3211            }
3212        }
3213    }
3214    impl ::std::convert::From<Vec<ChatCompletionRequestSystemMessageContentPart>>
3215        for ChatCompletionRequestSystemMessageContent
3216    {
3217        fn from(value: Vec<ChatCompletionRequestSystemMessageContentPart>) -> Self {
3218            ChatCompletionRequestSystemMessageContent::ChatCompletionRequestSystemMessageContentVariant1(
3219                value,
3220            )
3221        }
3222    }
3223    impl ::std::convert::TryFrom<ChatCompletionRequestSystemMessageContent>
3224        for Vec<ChatCompletionRequestSystemMessageContentPart>
3225    {
3226        type Error = ChatCompletionRequestSystemMessageContent;
3227        /// # Errors
3228        ///
3229        /// Returns the original enum value if it does not match the
3230        /// `#variant_ident` variant.
3231        fn try_from(
3232            value: ChatCompletionRequestSystemMessageContent,
3233        ) -> ::std::result::Result<Self, Self::Error> {
3234            match value {
3235                ChatCompletionRequestSystemMessageContent::ChatCompletionRequestSystemMessageContentVariant1(
3236                    inner,
3237                ) => ::std::result::Result::Ok(inner),
3238                other => ::std::result::Result::Err(other),
3239            }
3240        }
3241    }
3242    /// The role of the messages author, in this case `system`.
3243    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
3244    pub enum ChatCompletionRequestSystemMessageRole {
3245        #[serde(rename = "system")]
3246        System,
3247    }
3248    impl ::std::fmt::Display for ChatCompletionRequestSystemMessageRole {
3249        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
3250            match self {
3251                Self::System => ::std::write!(__f, "system"),
3252            }
3253        }
3254    }
3255    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3256    /// # System message
3257    /// Developer-provided instructions that the model should follow, regardless of
3258    /// messages sent by the user. With o1 models and newer, use `developer` messages
3259    /// for this purpose instead.
3260    pub struct ChatCompletionRequestSystemMessage {
3261        /// The contents of the system message.
3262        pub content: ChatCompletionRequestSystemMessageContent,
3263        /// The role of the messages author, in this case `system`.
3264        pub role: ChatCompletionRequestSystemMessageRole,
3265        #[serde(skip_serializing_if = "Option::is_none")]
3266        /// An optional name for the participant. Provides the model information to differentiate between participants of the same role.
3267        pub name: Option<String>,
3268    }
3269    /// The type of the content part.
3270    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
3271    pub enum ChatCompletionRequestMessageContentPartImageType {
3272        #[serde(rename = "image_url")]
3273        ImageUrl,
3274    }
3275    impl ::std::fmt::Display for ChatCompletionRequestMessageContentPartImageType {
3276        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
3277            match self {
3278                Self::ImageUrl => ::std::write!(__f, "image_url"),
3279            }
3280        }
3281    }
3282    /// Specifies the detail level of the image. Learn more in the [Vision guide](/docs/guides/vision#low-or-high-fidelity-image-understanding).
3283    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
3284    pub enum ChatCompletionRequestMessageContentPartImageImageUrlDetail {
3285        #[serde(rename = "auto")]
3286        Auto,
3287        #[serde(rename = "low")]
3288        Low,
3289        #[serde(rename = "high")]
3290        High,
3291    }
3292    impl ::std::fmt::Display for ChatCompletionRequestMessageContentPartImageImageUrlDetail {
3293        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
3294            match self {
3295                Self::Auto => ::std::write!(__f, "auto"),
3296                Self::Low => ::std::write!(__f, "low"),
3297                Self::High => ::std::write!(__f, "high"),
3298            }
3299        }
3300    }
3301    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3302    pub struct ChatCompletionRequestMessageContentPartImageImageUrl {
3303        /// Either a URL of the image or the base64 encoded image data.
3304        pub url: String,
3305        #[serde(skip_serializing_if = "Option::is_none")]
3306        /// Specifies the detail level of the image. Learn more in the [Vision guide](/docs/guides/vision#low-or-high-fidelity-image-understanding).
3307        pub detail: Option<ChatCompletionRequestMessageContentPartImageImageUrlDetail>,
3308    }
3309    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3310    /// # Image content part
3311    /// Learn about [image inputs](/docs/guides/vision).
3312    pub struct ChatCompletionRequestMessageContentPartImage {
3313        /// The type of the content part.
3314        pub r#type: ChatCompletionRequestMessageContentPartImageType,
3315        pub image_url: ChatCompletionRequestMessageContentPartImageImageUrl,
3316    }
3317    /// The type of the content part. Always `input_audio`.
3318    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
3319    pub enum ChatCompletionRequestMessageContentPartAudioType {
3320        #[serde(rename = "input_audio")]
3321        InputAudio,
3322    }
3323    impl ::std::fmt::Display for ChatCompletionRequestMessageContentPartAudioType {
3324        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
3325            match self {
3326                Self::InputAudio => ::std::write!(__f, "input_audio"),
3327            }
3328        }
3329    }
3330    /// The format of the encoded audio data. Currently supports "wav" and "mp3".
3331    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
3332    pub enum ChatCompletionRequestMessageContentPartAudioInputAudioFormat {
3333        #[serde(rename = "wav")]
3334        Wav,
3335        #[serde(rename = "mp3")]
3336        Mp3,
3337    }
3338    impl ::std::fmt::Display for ChatCompletionRequestMessageContentPartAudioInputAudioFormat {
3339        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
3340            match self {
3341                Self::Wav => ::std::write!(__f, "wav"),
3342                Self::Mp3 => ::std::write!(__f, "mp3"),
3343            }
3344        }
3345    }
3346    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3347    pub struct ChatCompletionRequestMessageContentPartAudioInputAudio {
3348        /// Base64 encoded audio data.
3349        pub data: String,
3350        /// The format of the encoded audio data. Currently supports "wav" and "mp3".
3351        pub format: ChatCompletionRequestMessageContentPartAudioInputAudioFormat,
3352    }
3353    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3354    /// # Audio content part
3355    /// Learn about [audio inputs](/docs/guides/audio).
3356    pub struct ChatCompletionRequestMessageContentPartAudio {
3357        /// The type of the content part. Always `input_audio`.
3358        pub r#type: ChatCompletionRequestMessageContentPartAudioType,
3359        pub input_audio: ChatCompletionRequestMessageContentPartAudioInputAudio,
3360    }
3361    /// The type of the content part. Always `file`.
3362    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
3363    pub enum ChatCompletionRequestMessageContentPartFileType {
3364        #[serde(rename = "file")]
3365        File,
3366    }
3367    impl ::std::fmt::Display for ChatCompletionRequestMessageContentPartFileType {
3368        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
3369            match self {
3370                Self::File => ::std::write!(__f, "file"),
3371            }
3372        }
3373    }
3374    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3375    pub struct ChatCompletionRequestMessageContentPartFileFile {
3376        #[serde(skip_serializing_if = "Option::is_none")]
3377        /// The name of the file, used when passing the file to the model as a
3378        /// string.
3379        pub filename: Option<String>,
3380        #[serde(skip_serializing_if = "Option::is_none")]
3381        /// The base64 encoded file data, used when passing the file to the model
3382        /// as a string.
3383        pub file_data: Option<String>,
3384        #[serde(skip_serializing_if = "Option::is_none")]
3385        /// The ID of an uploaded file to use as input.
3386        pub file_id: Option<String>,
3387    }
3388    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3389    /// # File content part
3390    /// Learn about [file inputs](/docs/guides/text) for text generation.
3391    pub struct ChatCompletionRequestMessageContentPartFile {
3392        /// The type of the content part. Always `file`.
3393        pub r#type: ChatCompletionRequestMessageContentPartFileType,
3394        pub file: ChatCompletionRequestMessageContentPartFileFile,
3395    }
3396    impl ::std::convert::From<ChatCompletionRequestMessageContentPartText>
3397        for ChatCompletionRequestUserMessageContentPart
3398    {
3399        fn from(value: ChatCompletionRequestMessageContentPartText) -> Self {
3400            ChatCompletionRequestUserMessageContentPart::ChatCompletionRequestMessageContentPartText(
3401                value,
3402            )
3403        }
3404    }
3405    impl ::std::convert::TryFrom<ChatCompletionRequestUserMessageContentPart>
3406        for ChatCompletionRequestMessageContentPartText
3407    {
3408        type Error = ChatCompletionRequestUserMessageContentPart;
3409        /// # Errors
3410        ///
3411        /// Returns the original enum value if it does not match the
3412        /// `#variant_ident` variant.
3413        fn try_from(
3414            value: ChatCompletionRequestUserMessageContentPart,
3415        ) -> ::std::result::Result<Self, Self::Error> {
3416            match value {
3417                ChatCompletionRequestUserMessageContentPart::ChatCompletionRequestMessageContentPartText(
3418                    inner,
3419                ) => ::std::result::Result::Ok(inner),
3420                other => ::std::result::Result::Err(other),
3421            }
3422        }
3423    }
3424    impl ::std::convert::From<ChatCompletionRequestMessageContentPartImage>
3425        for ChatCompletionRequestUserMessageContentPart
3426    {
3427        fn from(value: ChatCompletionRequestMessageContentPartImage) -> Self {
3428            ChatCompletionRequestUserMessageContentPart::ChatCompletionRequestMessageContentPartImage(
3429                value,
3430            )
3431        }
3432    }
3433    impl ::std::convert::TryFrom<ChatCompletionRequestUserMessageContentPart>
3434        for ChatCompletionRequestMessageContentPartImage
3435    {
3436        type Error = ChatCompletionRequestUserMessageContentPart;
3437        /// # Errors
3438        ///
3439        /// Returns the original enum value if it does not match the
3440        /// `#variant_ident` variant.
3441        fn try_from(
3442            value: ChatCompletionRequestUserMessageContentPart,
3443        ) -> ::std::result::Result<Self, Self::Error> {
3444            match value {
3445                ChatCompletionRequestUserMessageContentPart::ChatCompletionRequestMessageContentPartImage(
3446                    inner,
3447                ) => ::std::result::Result::Ok(inner),
3448                other => ::std::result::Result::Err(other),
3449            }
3450        }
3451    }
3452    impl ::std::convert::From<ChatCompletionRequestMessageContentPartAudio>
3453        for ChatCompletionRequestUserMessageContentPart
3454    {
3455        fn from(value: ChatCompletionRequestMessageContentPartAudio) -> Self {
3456            ChatCompletionRequestUserMessageContentPart::ChatCompletionRequestMessageContentPartAudio(
3457                value,
3458            )
3459        }
3460    }
3461    impl ::std::convert::TryFrom<ChatCompletionRequestUserMessageContentPart>
3462        for ChatCompletionRequestMessageContentPartAudio
3463    {
3464        type Error = ChatCompletionRequestUserMessageContentPart;
3465        /// # Errors
3466        ///
3467        /// Returns the original enum value if it does not match the
3468        /// `#variant_ident` variant.
3469        fn try_from(
3470            value: ChatCompletionRequestUserMessageContentPart,
3471        ) -> ::std::result::Result<Self, Self::Error> {
3472            match value {
3473                ChatCompletionRequestUserMessageContentPart::ChatCompletionRequestMessageContentPartAudio(
3474                    inner,
3475                ) => ::std::result::Result::Ok(inner),
3476                other => ::std::result::Result::Err(other),
3477            }
3478        }
3479    }
3480    impl ::std::convert::From<ChatCompletionRequestMessageContentPartFile>
3481        for ChatCompletionRequestUserMessageContentPart
3482    {
3483        fn from(value: ChatCompletionRequestMessageContentPartFile) -> Self {
3484            ChatCompletionRequestUserMessageContentPart::ChatCompletionRequestMessageContentPartFile(
3485                value,
3486            )
3487        }
3488    }
3489    impl ::std::convert::TryFrom<ChatCompletionRequestUserMessageContentPart>
3490        for ChatCompletionRequestMessageContentPartFile
3491    {
3492        type Error = ChatCompletionRequestUserMessageContentPart;
3493        /// # Errors
3494        ///
3495        /// Returns the original enum value if it does not match the
3496        /// `#variant_ident` variant.
3497        fn try_from(
3498            value: ChatCompletionRequestUserMessageContentPart,
3499        ) -> ::std::result::Result<Self, Self::Error> {
3500            match value {
3501                ChatCompletionRequestUserMessageContentPart::ChatCompletionRequestMessageContentPartFile(
3502                    inner,
3503                ) => ::std::result::Result::Ok(inner),
3504                other => ::std::result::Result::Err(other),
3505            }
3506        }
3507    }
3508    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3509    #[serde(untagged)]
3510    pub enum ChatCompletionRequestUserMessageContentPart {
3511        ChatCompletionRequestMessageContentPartText(ChatCompletionRequestMessageContentPartText),
3512        ChatCompletionRequestMessageContentPartImage(ChatCompletionRequestMessageContentPartImage),
3513        ChatCompletionRequestMessageContentPartAudio(ChatCompletionRequestMessageContentPartAudio),
3514        ChatCompletionRequestMessageContentPartFile(ChatCompletionRequestMessageContentPartFile),
3515    }
3516    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3517    #[serde(untagged)]
3518    /// The contents of the user message.
3519    pub enum ChatCompletionRequestUserMessageContent {
3520        ChatCompletionRequestUserMessageContentVariant0(String),
3521        ChatCompletionRequestUserMessageContentVariant1(
3522            Vec<ChatCompletionRequestUserMessageContentPart>,
3523        ),
3524    }
3525    impl ::std::convert::From<String> for ChatCompletionRequestUserMessageContent {
3526        fn from(value: String) -> Self {
3527            ChatCompletionRequestUserMessageContent::ChatCompletionRequestUserMessageContentVariant0(
3528                value,
3529            )
3530        }
3531    }
3532    impl ::std::convert::TryFrom<ChatCompletionRequestUserMessageContent> for String {
3533        type Error = ChatCompletionRequestUserMessageContent;
3534        /// # Errors
3535        ///
3536        /// Returns the original enum value if it does not match the
3537        /// `#variant_ident` variant.
3538        fn try_from(
3539            value: ChatCompletionRequestUserMessageContent,
3540        ) -> ::std::result::Result<Self, Self::Error> {
3541            match value {
3542                ChatCompletionRequestUserMessageContent::ChatCompletionRequestUserMessageContentVariant0(
3543                    inner,
3544                ) => ::std::result::Result::Ok(inner),
3545                other => ::std::result::Result::Err(other),
3546            }
3547        }
3548    }
3549    impl ::std::convert::From<Vec<ChatCompletionRequestUserMessageContentPart>>
3550        for ChatCompletionRequestUserMessageContent
3551    {
3552        fn from(value: Vec<ChatCompletionRequestUserMessageContentPart>) -> Self {
3553            ChatCompletionRequestUserMessageContent::ChatCompletionRequestUserMessageContentVariant1(
3554                value,
3555            )
3556        }
3557    }
3558    impl ::std::convert::TryFrom<ChatCompletionRequestUserMessageContent>
3559        for Vec<ChatCompletionRequestUserMessageContentPart>
3560    {
3561        type Error = ChatCompletionRequestUserMessageContent;
3562        /// # Errors
3563        ///
3564        /// Returns the original enum value if it does not match the
3565        /// `#variant_ident` variant.
3566        fn try_from(
3567            value: ChatCompletionRequestUserMessageContent,
3568        ) -> ::std::result::Result<Self, Self::Error> {
3569            match value {
3570                ChatCompletionRequestUserMessageContent::ChatCompletionRequestUserMessageContentVariant1(
3571                    inner,
3572                ) => ::std::result::Result::Ok(inner),
3573                other => ::std::result::Result::Err(other),
3574            }
3575        }
3576    }
3577    /// The role of the messages author, in this case `user`.
3578    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
3579    pub enum ChatCompletionRequestUserMessageRole {
3580        #[serde(rename = "user")]
3581        User,
3582    }
3583    impl ::std::fmt::Display for ChatCompletionRequestUserMessageRole {
3584        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
3585            match self {
3586                Self::User => ::std::write!(__f, "user"),
3587            }
3588        }
3589    }
3590    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3591    /// # User message
3592    /// Messages sent by an end user, containing prompts or additional context
3593    /// information.
3594    pub struct ChatCompletionRequestUserMessage {
3595        /// The contents of the user message.
3596        pub content: ChatCompletionRequestUserMessageContent,
3597        /// The role of the messages author, in this case `user`.
3598        pub role: ChatCompletionRequestUserMessageRole,
3599        #[serde(skip_serializing_if = "Option::is_none")]
3600        /// An optional name for the participant. Provides the model information to differentiate between participants of the same role.
3601        pub name: Option<String>,
3602    }
3603    /// The type of the content part.
3604    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
3605    pub enum ChatCompletionRequestMessageContentPartRefusalType {
3606        #[serde(rename = "refusal")]
3607        Refusal,
3608    }
3609    impl ::std::fmt::Display for ChatCompletionRequestMessageContentPartRefusalType {
3610        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
3611            match self {
3612                Self::Refusal => ::std::write!(__f, "refusal"),
3613            }
3614        }
3615    }
3616    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3617    /// # Refusal content part
3618    pub struct ChatCompletionRequestMessageContentPartRefusal {
3619        /// The type of the content part.
3620        pub r#type: ChatCompletionRequestMessageContentPartRefusalType,
3621        /// The refusal message generated by the model.
3622        pub refusal: String,
3623    }
3624    impl ::std::convert::From<ChatCompletionRequestMessageContentPartText>
3625        for ChatCompletionRequestAssistantMessageContentPart
3626    {
3627        fn from(value: ChatCompletionRequestMessageContentPartText) -> Self {
3628            ChatCompletionRequestAssistantMessageContentPart::ChatCompletionRequestMessageContentPartText(
3629                value,
3630            )
3631        }
3632    }
3633    impl ::std::convert::TryFrom<ChatCompletionRequestAssistantMessageContentPart>
3634        for ChatCompletionRequestMessageContentPartText
3635    {
3636        type Error = ChatCompletionRequestAssistantMessageContentPart;
3637        /// # Errors
3638        ///
3639        /// Returns the original enum value if it does not match the
3640        /// `#variant_ident` variant.
3641        fn try_from(
3642            value: ChatCompletionRequestAssistantMessageContentPart,
3643        ) -> ::std::result::Result<Self, Self::Error> {
3644            match value {
3645                ChatCompletionRequestAssistantMessageContentPart::ChatCompletionRequestMessageContentPartText(
3646                    inner,
3647                ) => ::std::result::Result::Ok(inner),
3648                other => ::std::result::Result::Err(other),
3649            }
3650        }
3651    }
3652    impl ::std::convert::From<ChatCompletionRequestMessageContentPartRefusal>
3653        for ChatCompletionRequestAssistantMessageContentPart
3654    {
3655        fn from(value: ChatCompletionRequestMessageContentPartRefusal) -> Self {
3656            ChatCompletionRequestAssistantMessageContentPart::ChatCompletionRequestMessageContentPartRefusal(
3657                value,
3658            )
3659        }
3660    }
3661    impl ::std::convert::TryFrom<ChatCompletionRequestAssistantMessageContentPart>
3662        for ChatCompletionRequestMessageContentPartRefusal
3663    {
3664        type Error = ChatCompletionRequestAssistantMessageContentPart;
3665        /// # Errors
3666        ///
3667        /// Returns the original enum value if it does not match the
3668        /// `#variant_ident` variant.
3669        fn try_from(
3670            value: ChatCompletionRequestAssistantMessageContentPart,
3671        ) -> ::std::result::Result<Self, Self::Error> {
3672            match value {
3673                ChatCompletionRequestAssistantMessageContentPart::ChatCompletionRequestMessageContentPartRefusal(
3674                    inner,
3675                ) => ::std::result::Result::Ok(inner),
3676                other => ::std::result::Result::Err(other),
3677            }
3678        }
3679    }
3680    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3681    #[serde(untagged)]
3682    pub enum ChatCompletionRequestAssistantMessageContentPart {
3683        ChatCompletionRequestMessageContentPartText(ChatCompletionRequestMessageContentPartText),
3684        ChatCompletionRequestMessageContentPartRefusal(
3685            ChatCompletionRequestMessageContentPartRefusal,
3686        ),
3687    }
3688    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3689    #[serde(untagged)]
3690    /// The contents of the assistant message. Required unless `tool_calls` or `function_call` is specified.
3691    pub enum ChatCompletionRequestAssistantMessageContentVariant0 {
3692        ChatCompletionRequestAssistantMessageContentVariant0Variant0(String),
3693        ChatCompletionRequestAssistantMessageContentVariant0Variant1(
3694            Vec<ChatCompletionRequestAssistantMessageContentPart>,
3695        ),
3696    }
3697    impl ::std::convert::From<String> for ChatCompletionRequestAssistantMessageContentVariant0 {
3698        fn from(value: String) -> Self {
3699            ChatCompletionRequestAssistantMessageContentVariant0::ChatCompletionRequestAssistantMessageContentVariant0Variant0(
3700                value,
3701            )
3702        }
3703    }
3704    impl ::std::convert::TryFrom<ChatCompletionRequestAssistantMessageContentVariant0> for String {
3705        type Error = ChatCompletionRequestAssistantMessageContentVariant0;
3706        /// # Errors
3707        ///
3708        /// Returns the original enum value if it does not match the
3709        /// `#variant_ident` variant.
3710        fn try_from(
3711            value: ChatCompletionRequestAssistantMessageContentVariant0,
3712        ) -> ::std::result::Result<Self, Self::Error> {
3713            match value {
3714                ChatCompletionRequestAssistantMessageContentVariant0::ChatCompletionRequestAssistantMessageContentVariant0Variant0(
3715                    inner,
3716                ) => ::std::result::Result::Ok(inner),
3717                other => ::std::result::Result::Err(other),
3718            }
3719        }
3720    }
3721    impl ::std::convert::From<Vec<ChatCompletionRequestAssistantMessageContentPart>>
3722        for ChatCompletionRequestAssistantMessageContentVariant0
3723    {
3724        fn from(value: Vec<ChatCompletionRequestAssistantMessageContentPart>) -> Self {
3725            ChatCompletionRequestAssistantMessageContentVariant0::ChatCompletionRequestAssistantMessageContentVariant0Variant1(
3726                value,
3727            )
3728        }
3729    }
3730    impl ::std::convert::TryFrom<ChatCompletionRequestAssistantMessageContentVariant0>
3731        for Vec<ChatCompletionRequestAssistantMessageContentPart>
3732    {
3733        type Error = ChatCompletionRequestAssistantMessageContentVariant0;
3734        /// # Errors
3735        ///
3736        /// Returns the original enum value if it does not match the
3737        /// `#variant_ident` variant.
3738        fn try_from(
3739            value: ChatCompletionRequestAssistantMessageContentVariant0,
3740        ) -> ::std::result::Result<Self, Self::Error> {
3741            match value {
3742                ChatCompletionRequestAssistantMessageContentVariant0::ChatCompletionRequestAssistantMessageContentVariant0Variant1(
3743                    inner,
3744                ) => ::std::result::Result::Ok(inner),
3745                other => ::std::result::Result::Err(other),
3746            }
3747        }
3748    }
3749    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3750    #[serde(untagged)]
3751    pub enum ChatCompletionRequestAssistantMessageContent {
3752        ChatCompletionRequestAssistantMessageContentVariant0(
3753            ChatCompletionRequestAssistantMessageContentVariant0,
3754        ),
3755        ChatCompletionRequestAssistantMessageContentVariant1(Option<::serde_json::Value>),
3756    }
3757    impl ::std::convert::From<ChatCompletionRequestAssistantMessageContentVariant0>
3758        for ChatCompletionRequestAssistantMessageContent
3759    {
3760        fn from(value: ChatCompletionRequestAssistantMessageContentVariant0) -> Self {
3761            ChatCompletionRequestAssistantMessageContent::ChatCompletionRequestAssistantMessageContentVariant0(
3762                value,
3763            )
3764        }
3765    }
3766    impl ::std::convert::TryFrom<ChatCompletionRequestAssistantMessageContent>
3767        for ChatCompletionRequestAssistantMessageContentVariant0
3768    {
3769        type Error = ChatCompletionRequestAssistantMessageContent;
3770        /// # Errors
3771        ///
3772        /// Returns the original enum value if it does not match the
3773        /// `#variant_ident` variant.
3774        fn try_from(
3775            value: ChatCompletionRequestAssistantMessageContent,
3776        ) -> ::std::result::Result<Self, Self::Error> {
3777            match value {
3778                ChatCompletionRequestAssistantMessageContent::ChatCompletionRequestAssistantMessageContentVariant0(
3779                    inner,
3780                ) => ::std::result::Result::Ok(inner),
3781                other => ::std::result::Result::Err(other),
3782            }
3783        }
3784    }
3785    impl ::std::convert::From<Option<::serde_json::Value>>
3786        for ChatCompletionRequestAssistantMessageContent
3787    {
3788        fn from(value: Option<::serde_json::Value>) -> Self {
3789            ChatCompletionRequestAssistantMessageContent::ChatCompletionRequestAssistantMessageContentVariant1(
3790                value,
3791            )
3792        }
3793    }
3794    impl ::std::convert::TryFrom<ChatCompletionRequestAssistantMessageContent>
3795        for Option<::serde_json::Value>
3796    {
3797        type Error = ChatCompletionRequestAssistantMessageContent;
3798        /// # Errors
3799        ///
3800        /// Returns the original enum value if it does not match the
3801        /// `#variant_ident` variant.
3802        fn try_from(
3803            value: ChatCompletionRequestAssistantMessageContent,
3804        ) -> ::std::result::Result<Self, Self::Error> {
3805            match value {
3806                ChatCompletionRequestAssistantMessageContent::ChatCompletionRequestAssistantMessageContentVariant1(
3807                    inner,
3808                ) => ::std::result::Result::Ok(inner),
3809                other => ::std::result::Result::Err(other),
3810            }
3811        }
3812    }
3813    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3814    #[serde(untagged)]
3815    pub enum ChatCompletionRequestAssistantMessageRefusal {
3816        ChatCompletionRequestAssistantMessageRefusalVariant0(String),
3817        ChatCompletionRequestAssistantMessageRefusalVariant1(Option<::serde_json::Value>),
3818    }
3819    impl ::std::convert::From<String> for ChatCompletionRequestAssistantMessageRefusal {
3820        fn from(value: String) -> Self {
3821            ChatCompletionRequestAssistantMessageRefusal::ChatCompletionRequestAssistantMessageRefusalVariant0(
3822                value,
3823            )
3824        }
3825    }
3826    impl ::std::convert::TryFrom<ChatCompletionRequestAssistantMessageRefusal> for String {
3827        type Error = ChatCompletionRequestAssistantMessageRefusal;
3828        /// # Errors
3829        ///
3830        /// Returns the original enum value if it does not match the
3831        /// `#variant_ident` variant.
3832        fn try_from(
3833            value: ChatCompletionRequestAssistantMessageRefusal,
3834        ) -> ::std::result::Result<Self, Self::Error> {
3835            match value {
3836                ChatCompletionRequestAssistantMessageRefusal::ChatCompletionRequestAssistantMessageRefusalVariant0(
3837                    inner,
3838                ) => ::std::result::Result::Ok(inner),
3839                other => ::std::result::Result::Err(other),
3840            }
3841        }
3842    }
3843    impl ::std::convert::From<Option<::serde_json::Value>>
3844        for ChatCompletionRequestAssistantMessageRefusal
3845    {
3846        fn from(value: Option<::serde_json::Value>) -> Self {
3847            ChatCompletionRequestAssistantMessageRefusal::ChatCompletionRequestAssistantMessageRefusalVariant1(
3848                value,
3849            )
3850        }
3851    }
3852    impl ::std::convert::TryFrom<ChatCompletionRequestAssistantMessageRefusal>
3853        for Option<::serde_json::Value>
3854    {
3855        type Error = ChatCompletionRequestAssistantMessageRefusal;
3856        /// # Errors
3857        ///
3858        /// Returns the original enum value if it does not match the
3859        /// `#variant_ident` variant.
3860        fn try_from(
3861            value: ChatCompletionRequestAssistantMessageRefusal,
3862        ) -> ::std::result::Result<Self, Self::Error> {
3863            match value {
3864                ChatCompletionRequestAssistantMessageRefusal::ChatCompletionRequestAssistantMessageRefusalVariant1(
3865                    inner,
3866                ) => ::std::result::Result::Ok(inner),
3867                other => ::std::result::Result::Err(other),
3868            }
3869        }
3870    }
3871    /// The role of the messages author, in this case `assistant`.
3872    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
3873    pub enum ChatCompletionRequestAssistantMessageRole {
3874        #[serde(rename = "assistant")]
3875        Assistant,
3876    }
3877    impl ::std::fmt::Display for ChatCompletionRequestAssistantMessageRole {
3878        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
3879            match self {
3880                Self::Assistant => ::std::write!(__f, "assistant"),
3881            }
3882        }
3883    }
3884    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3885    /// Data about a previous audio response from the model.
3886    /// [Learn more](/docs/guides/audio).
3887    pub struct ChatCompletionRequestAssistantMessageAudioVariant0 {
3888        /// Unique identifier for a previous audio response from the model.
3889        pub id: String,
3890    }
3891    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3892    #[serde(untagged)]
3893    pub enum ChatCompletionRequestAssistantMessageAudio {
3894        ChatCompletionRequestAssistantMessageAudioVariant0(
3895            ChatCompletionRequestAssistantMessageAudioVariant0,
3896        ),
3897        ChatCompletionRequestAssistantMessageAudioVariant1(Option<::serde_json::Value>),
3898    }
3899    impl ::std::convert::From<ChatCompletionRequestAssistantMessageAudioVariant0>
3900        for ChatCompletionRequestAssistantMessageAudio
3901    {
3902        fn from(value: ChatCompletionRequestAssistantMessageAudioVariant0) -> Self {
3903            ChatCompletionRequestAssistantMessageAudio::ChatCompletionRequestAssistantMessageAudioVariant0(
3904                value,
3905            )
3906        }
3907    }
3908    impl ::std::convert::TryFrom<ChatCompletionRequestAssistantMessageAudio>
3909        for ChatCompletionRequestAssistantMessageAudioVariant0
3910    {
3911        type Error = ChatCompletionRequestAssistantMessageAudio;
3912        /// # Errors
3913        ///
3914        /// Returns the original enum value if it does not match the
3915        /// `#variant_ident` variant.
3916        fn try_from(
3917            value: ChatCompletionRequestAssistantMessageAudio,
3918        ) -> ::std::result::Result<Self, Self::Error> {
3919            match value {
3920                ChatCompletionRequestAssistantMessageAudio::ChatCompletionRequestAssistantMessageAudioVariant0(
3921                    inner,
3922                ) => ::std::result::Result::Ok(inner),
3923                other => ::std::result::Result::Err(other),
3924            }
3925        }
3926    }
3927    impl ::std::convert::From<Option<::serde_json::Value>>
3928        for ChatCompletionRequestAssistantMessageAudio
3929    {
3930        fn from(value: Option<::serde_json::Value>) -> Self {
3931            ChatCompletionRequestAssistantMessageAudio::ChatCompletionRequestAssistantMessageAudioVariant1(
3932                value,
3933            )
3934        }
3935    }
3936    impl ::std::convert::TryFrom<ChatCompletionRequestAssistantMessageAudio>
3937        for Option<::serde_json::Value>
3938    {
3939        type Error = ChatCompletionRequestAssistantMessageAudio;
3940        /// # Errors
3941        ///
3942        /// Returns the original enum value if it does not match the
3943        /// `#variant_ident` variant.
3944        fn try_from(
3945            value: ChatCompletionRequestAssistantMessageAudio,
3946        ) -> ::std::result::Result<Self, Self::Error> {
3947            match value {
3948                ChatCompletionRequestAssistantMessageAudio::ChatCompletionRequestAssistantMessageAudioVariant1(
3949                    inner,
3950                ) => ::std::result::Result::Ok(inner),
3951                other => ::std::result::Result::Err(other),
3952            }
3953        }
3954    }
3955    /// The type of the tool. Currently, only `function` is supported.
3956    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
3957    pub enum ChatCompletionMessageToolCallType {
3958        #[serde(rename = "function")]
3959        Function,
3960    }
3961    impl ::std::fmt::Display for ChatCompletionMessageToolCallType {
3962        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
3963            match self {
3964                Self::Function => ::std::write!(__f, "function"),
3965            }
3966        }
3967    }
3968    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3969    /// The function that the model called.
3970    pub struct ChatCompletionMessageToolCallFunction {
3971        /// The name of the function to call.
3972        pub name: String,
3973        /// 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.
3974        pub arguments: String,
3975    }
3976    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3977    /// # Function tool call
3978    /// A call to a function tool created by the model.
3979    pub struct ChatCompletionMessageToolCall {
3980        /// The ID of the tool call.
3981        pub id: String,
3982        /// The type of the tool. Currently, only `function` is supported.
3983        pub r#type: ChatCompletionMessageToolCallType,
3984        /// The function that the model called.
3985        pub function: ChatCompletionMessageToolCallFunction,
3986    }
3987    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3988    #[serde(untagged)]
3989    pub enum ChatCompletionMessageToolCallsItem {
3990        ChatCompletionMessageToolCall(ChatCompletionMessageToolCall),
3991        ChatCompletionMessageCustomToolCall(ChatCompletionMessageCustomToolCall),
3992    }
3993    impl ::std::convert::From<ChatCompletionMessageToolCall> for ChatCompletionMessageToolCallsItem {
3994        fn from(value: ChatCompletionMessageToolCall) -> Self {
3995            ChatCompletionMessageToolCallsItem::ChatCompletionMessageToolCall(value)
3996        }
3997    }
3998    impl ::std::convert::TryFrom<ChatCompletionMessageToolCallsItem> for ChatCompletionMessageToolCall {
3999        type Error = ChatCompletionMessageToolCallsItem;
4000        /// # Errors
4001        ///
4002        /// Returns the original enum value if it does not match the
4003        /// `#variant_ident` variant.
4004        fn try_from(
4005            value: ChatCompletionMessageToolCallsItem,
4006        ) -> ::std::result::Result<Self, Self::Error> {
4007            match value {
4008                ChatCompletionMessageToolCallsItem::ChatCompletionMessageToolCall(inner) => {
4009                    ::std::result::Result::Ok(inner)
4010                }
4011                other => ::std::result::Result::Err(other),
4012            }
4013        }
4014    }
4015    impl ::std::convert::From<ChatCompletionMessageCustomToolCall>
4016        for ChatCompletionMessageToolCallsItem
4017    {
4018        fn from(value: ChatCompletionMessageCustomToolCall) -> Self {
4019            ChatCompletionMessageToolCallsItem::ChatCompletionMessageCustomToolCall(value)
4020        }
4021    }
4022    impl ::std::convert::TryFrom<ChatCompletionMessageToolCallsItem>
4023        for ChatCompletionMessageCustomToolCall
4024    {
4025        type Error = ChatCompletionMessageToolCallsItem;
4026        /// # Errors
4027        ///
4028        /// Returns the original enum value if it does not match the
4029        /// `#variant_ident` variant.
4030        fn try_from(
4031            value: ChatCompletionMessageToolCallsItem,
4032        ) -> ::std::result::Result<Self, Self::Error> {
4033            match value {
4034                ChatCompletionMessageToolCallsItem::ChatCompletionMessageCustomToolCall(inner) => {
4035                    ::std::result::Result::Ok(inner)
4036                }
4037                other => ::std::result::Result::Err(other),
4038            }
4039        }
4040    }
4041    /// The tool calls generated by the model, such as function calls.
4042    pub type ChatCompletionMessageToolCalls = Vec<ChatCompletionMessageToolCallsItem>;
4043    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
4044    #[deprecated]
4045    /// Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model.
4046    pub struct ChatCompletionRequestAssistantMessageFunctionCallVariant0 {
4047        /// 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.
4048        pub arguments: String,
4049        /// The name of the function to call.
4050        pub name: String,
4051    }
4052    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
4053    #[serde(untagged)]
4054    pub enum ChatCompletionRequestAssistantMessageFunctionCall {
4055        ChatCompletionRequestAssistantMessageFunctionCallVariant0(
4056            ChatCompletionRequestAssistantMessageFunctionCallVariant0,
4057        ),
4058        ChatCompletionRequestAssistantMessageFunctionCallVariant1(Option<::serde_json::Value>),
4059    }
4060    impl ::std::convert::From<ChatCompletionRequestAssistantMessageFunctionCallVariant0>
4061        for ChatCompletionRequestAssistantMessageFunctionCall
4062    {
4063        fn from(value: ChatCompletionRequestAssistantMessageFunctionCallVariant0) -> Self {
4064            ChatCompletionRequestAssistantMessageFunctionCall::ChatCompletionRequestAssistantMessageFunctionCallVariant0(
4065                value,
4066            )
4067        }
4068    }
4069    impl ::std::convert::TryFrom<ChatCompletionRequestAssistantMessageFunctionCall>
4070        for ChatCompletionRequestAssistantMessageFunctionCallVariant0
4071    {
4072        type Error = ChatCompletionRequestAssistantMessageFunctionCall;
4073        /// # Errors
4074        ///
4075        /// Returns the original enum value if it does not match the
4076        /// `#variant_ident` variant.
4077        fn try_from(
4078            value: ChatCompletionRequestAssistantMessageFunctionCall,
4079        ) -> ::std::result::Result<Self, Self::Error> {
4080            match value {
4081                ChatCompletionRequestAssistantMessageFunctionCall::ChatCompletionRequestAssistantMessageFunctionCallVariant0(
4082                    inner,
4083                ) => ::std::result::Result::Ok(inner),
4084                other => ::std::result::Result::Err(other),
4085            }
4086        }
4087    }
4088    impl ::std::convert::From<Option<::serde_json::Value>>
4089        for ChatCompletionRequestAssistantMessageFunctionCall
4090    {
4091        fn from(value: Option<::serde_json::Value>) -> Self {
4092            ChatCompletionRequestAssistantMessageFunctionCall::ChatCompletionRequestAssistantMessageFunctionCallVariant1(
4093                value,
4094            )
4095        }
4096    }
4097    impl ::std::convert::TryFrom<ChatCompletionRequestAssistantMessageFunctionCall>
4098        for Option<::serde_json::Value>
4099    {
4100        type Error = ChatCompletionRequestAssistantMessageFunctionCall;
4101        /// # Errors
4102        ///
4103        /// Returns the original enum value if it does not match the
4104        /// `#variant_ident` variant.
4105        fn try_from(
4106            value: ChatCompletionRequestAssistantMessageFunctionCall,
4107        ) -> ::std::result::Result<Self, Self::Error> {
4108            match value {
4109                ChatCompletionRequestAssistantMessageFunctionCall::ChatCompletionRequestAssistantMessageFunctionCallVariant1(
4110                    inner,
4111                ) => ::std::result::Result::Ok(inner),
4112                other => ::std::result::Result::Err(other),
4113            }
4114        }
4115    }
4116    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
4117    /// # Assistant message
4118    /// Messages sent by the model in response to user messages.
4119    pub struct ChatCompletionRequestAssistantMessage {
4120        #[serde(skip_serializing_if = "Option::is_none")]
4121        pub content: Option<ChatCompletionRequestAssistantMessageContent>,
4122        #[serde(skip_serializing_if = "Option::is_none")]
4123        pub refusal: Option<ChatCompletionRequestAssistantMessageRefusal>,
4124        /// The role of the messages author, in this case `assistant`.
4125        pub role: ChatCompletionRequestAssistantMessageRole,
4126        #[serde(skip_serializing_if = "Option::is_none")]
4127        /// An optional name for the participant. Provides the model information to differentiate between participants of the same role.
4128        pub name: Option<String>,
4129        #[serde(skip_serializing_if = "Option::is_none")]
4130        pub audio: Option<ChatCompletionRequestAssistantMessageAudio>,
4131        #[serde(skip_serializing_if = "Option::is_none")]
4132        pub tool_calls: Option<ChatCompletionMessageToolCalls>,
4133        #[serde(skip_serializing_if = "Option::is_none")]
4134        pub function_call: Option<ChatCompletionRequestAssistantMessageFunctionCall>,
4135        #[serde(skip_serializing_if = "Option::is_none")]
4136        /// 兼容厂商扩展(DeepSeek-v4-pro 等):上一轮 assistant 的思考链文本,thinking 模式下必须回放给服务端。OpenAI 官方忽略此字段。
4137        pub reasoning_content: Option<String>,
4138    }
4139    /// The role of the messages author, in this case `tool`.
4140    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
4141    pub enum ChatCompletionRequestToolMessageRole {
4142        #[serde(rename = "tool")]
4143        Tool,
4144    }
4145    impl ::std::fmt::Display for ChatCompletionRequestToolMessageRole {
4146        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
4147            match self {
4148                Self::Tool => ::std::write!(__f, "tool"),
4149            }
4150        }
4151    }
4152    impl ::std::convert::From<ChatCompletionRequestMessageContentPartText>
4153        for ChatCompletionRequestToolMessageContentPart
4154    {
4155        fn from(value: ChatCompletionRequestMessageContentPartText) -> Self {
4156            ChatCompletionRequestToolMessageContentPart::ChatCompletionRequestMessageContentPartText(
4157                value,
4158            )
4159        }
4160    }
4161    impl ::std::convert::TryFrom<ChatCompletionRequestToolMessageContentPart>
4162        for ChatCompletionRequestMessageContentPartText
4163    {
4164        type Error = ChatCompletionRequestToolMessageContentPart;
4165        /// # Errors
4166        ///
4167        /// Returns the original enum value if it does not match the
4168        /// `#variant_ident` variant.
4169        fn try_from(
4170            value: ChatCompletionRequestToolMessageContentPart,
4171        ) -> ::std::result::Result<Self, Self::Error> {
4172            match value {
4173                ChatCompletionRequestToolMessageContentPart::ChatCompletionRequestMessageContentPartText(
4174                    inner,
4175                ) => ::std::result::Result::Ok(inner),
4176                other => ::std::result::Result::Err(other),
4177            }
4178        }
4179    }
4180    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
4181    #[serde(untagged)]
4182    pub enum ChatCompletionRequestToolMessageContentPart {
4183        ChatCompletionRequestMessageContentPartText(ChatCompletionRequestMessageContentPartText),
4184    }
4185    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
4186    #[serde(untagged)]
4187    /// The contents of the tool message.
4188    pub enum ChatCompletionRequestToolMessageContent {
4189        ChatCompletionRequestToolMessageContentVariant0(String),
4190        ChatCompletionRequestToolMessageContentVariant1(
4191            Vec<ChatCompletionRequestToolMessageContentPart>,
4192        ),
4193    }
4194    impl ::std::convert::From<String> for ChatCompletionRequestToolMessageContent {
4195        fn from(value: String) -> Self {
4196            ChatCompletionRequestToolMessageContent::ChatCompletionRequestToolMessageContentVariant0(
4197                value,
4198            )
4199        }
4200    }
4201    impl ::std::convert::TryFrom<ChatCompletionRequestToolMessageContent> for String {
4202        type Error = ChatCompletionRequestToolMessageContent;
4203        /// # Errors
4204        ///
4205        /// Returns the original enum value if it does not match the
4206        /// `#variant_ident` variant.
4207        fn try_from(
4208            value: ChatCompletionRequestToolMessageContent,
4209        ) -> ::std::result::Result<Self, Self::Error> {
4210            match value {
4211                ChatCompletionRequestToolMessageContent::ChatCompletionRequestToolMessageContentVariant0(
4212                    inner,
4213                ) => ::std::result::Result::Ok(inner),
4214                other => ::std::result::Result::Err(other),
4215            }
4216        }
4217    }
4218    impl ::std::convert::From<Vec<ChatCompletionRequestToolMessageContentPart>>
4219        for ChatCompletionRequestToolMessageContent
4220    {
4221        fn from(value: Vec<ChatCompletionRequestToolMessageContentPart>) -> Self {
4222            ChatCompletionRequestToolMessageContent::ChatCompletionRequestToolMessageContentVariant1(
4223                value,
4224            )
4225        }
4226    }
4227    impl ::std::convert::TryFrom<ChatCompletionRequestToolMessageContent>
4228        for Vec<ChatCompletionRequestToolMessageContentPart>
4229    {
4230        type Error = ChatCompletionRequestToolMessageContent;
4231        /// # Errors
4232        ///
4233        /// Returns the original enum value if it does not match the
4234        /// `#variant_ident` variant.
4235        fn try_from(
4236            value: ChatCompletionRequestToolMessageContent,
4237        ) -> ::std::result::Result<Self, Self::Error> {
4238            match value {
4239                ChatCompletionRequestToolMessageContent::ChatCompletionRequestToolMessageContentVariant1(
4240                    inner,
4241                ) => ::std::result::Result::Ok(inner),
4242                other => ::std::result::Result::Err(other),
4243            }
4244        }
4245    }
4246    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
4247    /// # Tool message
4248    pub struct ChatCompletionRequestToolMessage {
4249        /// The role of the messages author, in this case `tool`.
4250        pub role: ChatCompletionRequestToolMessageRole,
4251        /// The contents of the tool message.
4252        pub content: ChatCompletionRequestToolMessageContent,
4253        /// Tool call that this message is responding to.
4254        pub tool_call_id: String,
4255    }
4256    /// The role of the messages author, in this case `function`.
4257    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
4258    pub enum ChatCompletionRequestFunctionMessageRole {
4259        #[serde(rename = "function")]
4260        Function,
4261    }
4262    impl ::std::fmt::Display for ChatCompletionRequestFunctionMessageRole {
4263        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
4264            match self {
4265                Self::Function => ::std::write!(__f, "function"),
4266            }
4267        }
4268    }
4269    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
4270    #[serde(untagged)]
4271    pub enum ChatCompletionRequestFunctionMessageContent {
4272        ChatCompletionRequestFunctionMessageContentVariant0(String),
4273        ChatCompletionRequestFunctionMessageContentVariant1(Option<::serde_json::Value>),
4274    }
4275    impl ::std::convert::From<String> for ChatCompletionRequestFunctionMessageContent {
4276        fn from(value: String) -> Self {
4277            ChatCompletionRequestFunctionMessageContent::ChatCompletionRequestFunctionMessageContentVariant0(
4278                value,
4279            )
4280        }
4281    }
4282    impl ::std::convert::TryFrom<ChatCompletionRequestFunctionMessageContent> for String {
4283        type Error = ChatCompletionRequestFunctionMessageContent;
4284        /// # Errors
4285        ///
4286        /// Returns the original enum value if it does not match the
4287        /// `#variant_ident` variant.
4288        fn try_from(
4289            value: ChatCompletionRequestFunctionMessageContent,
4290        ) -> ::std::result::Result<Self, Self::Error> {
4291            match value {
4292                ChatCompletionRequestFunctionMessageContent::ChatCompletionRequestFunctionMessageContentVariant0(
4293                    inner,
4294                ) => ::std::result::Result::Ok(inner),
4295                other => ::std::result::Result::Err(other),
4296            }
4297        }
4298    }
4299    impl ::std::convert::From<Option<::serde_json::Value>>
4300        for ChatCompletionRequestFunctionMessageContent
4301    {
4302        fn from(value: Option<::serde_json::Value>) -> Self {
4303            ChatCompletionRequestFunctionMessageContent::ChatCompletionRequestFunctionMessageContentVariant1(
4304                value,
4305            )
4306        }
4307    }
4308    impl ::std::convert::TryFrom<ChatCompletionRequestFunctionMessageContent>
4309        for Option<::serde_json::Value>
4310    {
4311        type Error = ChatCompletionRequestFunctionMessageContent;
4312        /// # Errors
4313        ///
4314        /// Returns the original enum value if it does not match the
4315        /// `#variant_ident` variant.
4316        fn try_from(
4317            value: ChatCompletionRequestFunctionMessageContent,
4318        ) -> ::std::result::Result<Self, Self::Error> {
4319            match value {
4320                ChatCompletionRequestFunctionMessageContent::ChatCompletionRequestFunctionMessageContentVariant1(
4321                    inner,
4322                ) => ::std::result::Result::Ok(inner),
4323                other => ::std::result::Result::Err(other),
4324            }
4325        }
4326    }
4327    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
4328    #[deprecated]
4329    /// # Function message
4330    pub struct ChatCompletionRequestFunctionMessage {
4331        /// The role of the messages author, in this case `function`.
4332        pub role: ChatCompletionRequestFunctionMessageRole,
4333        pub content: ChatCompletionRequestFunctionMessageContent,
4334        /// The name of the function to call.
4335        pub name: String,
4336    }
4337    impl ::std::convert::From<ChatCompletionRequestDeveloperMessage> for ChatCompletionRequestMessage {
4338        fn from(value: ChatCompletionRequestDeveloperMessage) -> Self {
4339            ChatCompletionRequestMessage::ChatCompletionRequestDeveloperMessage(value)
4340        }
4341    }
4342    impl ::std::convert::TryFrom<ChatCompletionRequestMessage>
4343        for ChatCompletionRequestDeveloperMessage
4344    {
4345        type Error = ChatCompletionRequestMessage;
4346        /// # Errors
4347        ///
4348        /// Returns the original enum value if it does not match the
4349        /// `#variant_ident` variant.
4350        fn try_from(
4351            value: ChatCompletionRequestMessage,
4352        ) -> ::std::result::Result<Self, Self::Error> {
4353            match value {
4354                ChatCompletionRequestMessage::ChatCompletionRequestDeveloperMessage(inner) => {
4355                    ::std::result::Result::Ok(inner)
4356                }
4357                other => ::std::result::Result::Err(other),
4358            }
4359        }
4360    }
4361    impl ::std::convert::From<ChatCompletionRequestSystemMessage> for ChatCompletionRequestMessage {
4362        fn from(value: ChatCompletionRequestSystemMessage) -> Self {
4363            ChatCompletionRequestMessage::ChatCompletionRequestSystemMessage(value)
4364        }
4365    }
4366    impl ::std::convert::TryFrom<ChatCompletionRequestMessage> for ChatCompletionRequestSystemMessage {
4367        type Error = ChatCompletionRequestMessage;
4368        /// # Errors
4369        ///
4370        /// Returns the original enum value if it does not match the
4371        /// `#variant_ident` variant.
4372        fn try_from(
4373            value: ChatCompletionRequestMessage,
4374        ) -> ::std::result::Result<Self, Self::Error> {
4375            match value {
4376                ChatCompletionRequestMessage::ChatCompletionRequestSystemMessage(inner) => {
4377                    ::std::result::Result::Ok(inner)
4378                }
4379                other => ::std::result::Result::Err(other),
4380            }
4381        }
4382    }
4383    impl ::std::convert::From<ChatCompletionRequestUserMessage> for ChatCompletionRequestMessage {
4384        fn from(value: ChatCompletionRequestUserMessage) -> Self {
4385            ChatCompletionRequestMessage::ChatCompletionRequestUserMessage(value)
4386        }
4387    }
4388    impl ::std::convert::TryFrom<ChatCompletionRequestMessage> for ChatCompletionRequestUserMessage {
4389        type Error = ChatCompletionRequestMessage;
4390        /// # Errors
4391        ///
4392        /// Returns the original enum value if it does not match the
4393        /// `#variant_ident` variant.
4394        fn try_from(
4395            value: ChatCompletionRequestMessage,
4396        ) -> ::std::result::Result<Self, Self::Error> {
4397            match value {
4398                ChatCompletionRequestMessage::ChatCompletionRequestUserMessage(inner) => {
4399                    ::std::result::Result::Ok(inner)
4400                }
4401                other => ::std::result::Result::Err(other),
4402            }
4403        }
4404    }
4405    impl ::std::convert::From<ChatCompletionRequestAssistantMessage> for ChatCompletionRequestMessage {
4406        fn from(value: ChatCompletionRequestAssistantMessage) -> Self {
4407            ChatCompletionRequestMessage::ChatCompletionRequestAssistantMessage(value)
4408        }
4409    }
4410    impl ::std::convert::TryFrom<ChatCompletionRequestMessage>
4411        for ChatCompletionRequestAssistantMessage
4412    {
4413        type Error = ChatCompletionRequestMessage;
4414        /// # Errors
4415        ///
4416        /// Returns the original enum value if it does not match the
4417        /// `#variant_ident` variant.
4418        fn try_from(
4419            value: ChatCompletionRequestMessage,
4420        ) -> ::std::result::Result<Self, Self::Error> {
4421            match value {
4422                ChatCompletionRequestMessage::ChatCompletionRequestAssistantMessage(inner) => {
4423                    ::std::result::Result::Ok(inner)
4424                }
4425                other => ::std::result::Result::Err(other),
4426            }
4427        }
4428    }
4429    impl ::std::convert::From<ChatCompletionRequestToolMessage> for ChatCompletionRequestMessage {
4430        fn from(value: ChatCompletionRequestToolMessage) -> Self {
4431            ChatCompletionRequestMessage::ChatCompletionRequestToolMessage(value)
4432        }
4433    }
4434    impl ::std::convert::TryFrom<ChatCompletionRequestMessage> for ChatCompletionRequestToolMessage {
4435        type Error = ChatCompletionRequestMessage;
4436        /// # Errors
4437        ///
4438        /// Returns the original enum value if it does not match the
4439        /// `#variant_ident` variant.
4440        fn try_from(
4441            value: ChatCompletionRequestMessage,
4442        ) -> ::std::result::Result<Self, Self::Error> {
4443            match value {
4444                ChatCompletionRequestMessage::ChatCompletionRequestToolMessage(inner) => {
4445                    ::std::result::Result::Ok(inner)
4446                }
4447                other => ::std::result::Result::Err(other),
4448            }
4449        }
4450    }
4451    impl ::std::convert::From<ChatCompletionRequestFunctionMessage> for ChatCompletionRequestMessage {
4452        fn from(value: ChatCompletionRequestFunctionMessage) -> Self {
4453            ChatCompletionRequestMessage::ChatCompletionRequestFunctionMessage(value)
4454        }
4455    }
4456    impl ::std::convert::TryFrom<ChatCompletionRequestMessage>
4457        for ChatCompletionRequestFunctionMessage
4458    {
4459        type Error = ChatCompletionRequestMessage;
4460        /// # Errors
4461        ///
4462        /// Returns the original enum value if it does not match the
4463        /// `#variant_ident` variant.
4464        fn try_from(
4465            value: ChatCompletionRequestMessage,
4466        ) -> ::std::result::Result<Self, Self::Error> {
4467            match value {
4468                ChatCompletionRequestMessage::ChatCompletionRequestFunctionMessage(inner) => {
4469                    ::std::result::Result::Ok(inner)
4470                }
4471                other => ::std::result::Result::Err(other),
4472            }
4473        }
4474    }
4475    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
4476    #[serde(untagged)]
4477    pub enum ChatCompletionRequestMessage {
4478        ChatCompletionRequestDeveloperMessage(ChatCompletionRequestDeveloperMessage),
4479        ChatCompletionRequestSystemMessage(ChatCompletionRequestSystemMessage),
4480        ChatCompletionRequestUserMessage(ChatCompletionRequestUserMessage),
4481        ChatCompletionRequestAssistantMessage(ChatCompletionRequestAssistantMessage),
4482        ChatCompletionRequestToolMessage(ChatCompletionRequestToolMessage),
4483        ChatCompletionRequestFunctionMessage(ChatCompletionRequestFunctionMessage),
4484    }
4485    /// The type of location approximation. Always `approximate`.
4486    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
4487    pub enum CreateChatCompletionRequestWebSearchOptionsUserLocationType {
4488        #[serde(rename = "approximate")]
4489        Approximate,
4490    }
4491    impl ::std::fmt::Display for CreateChatCompletionRequestWebSearchOptionsUserLocationType {
4492        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
4493            match self {
4494                Self::Approximate => ::std::write!(__f, "approximate"),
4495            }
4496        }
4497    }
4498    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
4499    /// Approximate location parameters for the search.
4500    pub struct CreateChatCompletionRequestWebSearchOptionsUserLocation {
4501        /// The type of location approximation. Always `approximate`.
4502        pub r#type: CreateChatCompletionRequestWebSearchOptionsUserLocationType,
4503        pub approximate: WebSearchLocation,
4504    }
4505    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
4506    /// # Web search
4507    /// This tool searches the web for relevant results to use in a response.
4508    /// Learn more about the [web search tool](/docs/guides/tools-web-search?api-mode=chat).
4509    pub struct CreateChatCompletionRequestWebSearchOptions {
4510        #[serde(skip_serializing_if = "Option::is_none")]
4511        /// Approximate location parameters for the search.
4512        pub user_location: Option<CreateChatCompletionRequestWebSearchOptionsUserLocation>,
4513        #[serde(skip_serializing_if = "Option::is_none")]
4514        pub search_context_size: Option<WebSearchContextSize>,
4515    }
4516    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
4517    #[serde(untagged)]
4518    /// An object specifying the format that the model must output.
4519    ///
4520    /// Setting to `{ "type": "json_schema", "json_schema": {...} }` enables
4521    /// Structured Outputs which ensures the model will match your supplied JSON
4522    /// schema. Learn more in the [Structured Outputs
4523    /// guide](/docs/guides/structured-outputs).
4524    ///
4525    /// Setting to `{ "type": "json_object" }` enables the older JSON mode, which
4526    /// ensures the message the model generates is valid JSON. Using `json_schema`
4527    /// is preferred for models that support it.
4528    pub enum CreateChatCompletionRequestResponseFormat {
4529        ResponseFormatText(ResponseFormatText),
4530        ResponseFormatJsonSchema(ResponseFormatJsonSchema),
4531        ResponseFormatJsonObject(ResponseFormatJsonObject),
4532    }
4533    impl ::std::convert::From<ResponseFormatText> for CreateChatCompletionRequestResponseFormat {
4534        fn from(value: ResponseFormatText) -> Self {
4535            CreateChatCompletionRequestResponseFormat::ResponseFormatText(value)
4536        }
4537    }
4538    impl ::std::convert::TryFrom<CreateChatCompletionRequestResponseFormat> for ResponseFormatText {
4539        type Error = CreateChatCompletionRequestResponseFormat;
4540        /// # Errors
4541        ///
4542        /// Returns the original enum value if it does not match the
4543        /// `#variant_ident` variant.
4544        fn try_from(
4545            value: CreateChatCompletionRequestResponseFormat,
4546        ) -> ::std::result::Result<Self, Self::Error> {
4547            match value {
4548                CreateChatCompletionRequestResponseFormat::ResponseFormatText(inner) => {
4549                    ::std::result::Result::Ok(inner)
4550                }
4551                other => ::std::result::Result::Err(other),
4552            }
4553        }
4554    }
4555    impl ::std::convert::From<ResponseFormatJsonSchema> for CreateChatCompletionRequestResponseFormat {
4556        fn from(value: ResponseFormatJsonSchema) -> Self {
4557            CreateChatCompletionRequestResponseFormat::ResponseFormatJsonSchema(value)
4558        }
4559    }
4560    impl ::std::convert::TryFrom<CreateChatCompletionRequestResponseFormat>
4561        for ResponseFormatJsonSchema
4562    {
4563        type Error = CreateChatCompletionRequestResponseFormat;
4564        /// # Errors
4565        ///
4566        /// Returns the original enum value if it does not match the
4567        /// `#variant_ident` variant.
4568        fn try_from(
4569            value: CreateChatCompletionRequestResponseFormat,
4570        ) -> ::std::result::Result<Self, Self::Error> {
4571            match value {
4572                CreateChatCompletionRequestResponseFormat::ResponseFormatJsonSchema(inner) => {
4573                    ::std::result::Result::Ok(inner)
4574                }
4575                other => ::std::result::Result::Err(other),
4576            }
4577        }
4578    }
4579    impl ::std::convert::From<ResponseFormatJsonObject> for CreateChatCompletionRequestResponseFormat {
4580        fn from(value: ResponseFormatJsonObject) -> Self {
4581            CreateChatCompletionRequestResponseFormat::ResponseFormatJsonObject(value)
4582        }
4583    }
4584    impl ::std::convert::TryFrom<CreateChatCompletionRequestResponseFormat>
4585        for ResponseFormatJsonObject
4586    {
4587        type Error = CreateChatCompletionRequestResponseFormat;
4588        /// # Errors
4589        ///
4590        /// Returns the original enum value if it does not match the
4591        /// `#variant_ident` variant.
4592        fn try_from(
4593            value: CreateChatCompletionRequestResponseFormat,
4594        ) -> ::std::result::Result<Self, Self::Error> {
4595            match value {
4596                CreateChatCompletionRequestResponseFormat::ResponseFormatJsonObject(inner) => {
4597                    ::std::result::Result::Ok(inner)
4598                }
4599                other => ::std::result::Result::Err(other),
4600            }
4601        }
4602    }
4603    /// Specifies the output audio format. Must be one of `wav`, `mp3`, `flac`,
4604    /// `opus`, or `pcm16`.
4605    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
4606    pub enum CreateChatCompletionRequestAudioFormat {
4607        #[serde(rename = "wav")]
4608        Wav,
4609        #[serde(rename = "aac")]
4610        Aac,
4611        #[serde(rename = "mp3")]
4612        Mp3,
4613        #[serde(rename = "flac")]
4614        Flac,
4615        #[serde(rename = "opus")]
4616        Opus,
4617        #[serde(rename = "pcm16")]
4618        Pcm16,
4619    }
4620    impl ::std::fmt::Display for CreateChatCompletionRequestAudioFormat {
4621        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
4622            match self {
4623                Self::Wav => ::std::write!(__f, "wav"),
4624                Self::Aac => ::std::write!(__f, "aac"),
4625                Self::Mp3 => ::std::write!(__f, "mp3"),
4626                Self::Flac => ::std::write!(__f, "flac"),
4627                Self::Opus => ::std::write!(__f, "opus"),
4628                Self::Pcm16 => ::std::write!(__f, "pcm16"),
4629            }
4630        }
4631    }
4632    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
4633    /// Parameters for audio output. Required when audio output is requested with
4634    /// `modalities: ["audio"]`. [Learn more](/docs/guides/audio).
4635    pub struct CreateChatCompletionRequestAudio {
4636        pub voice: VoiceIdsOrCustomVoice,
4637        /// Specifies the output audio format. Must be one of `wav`, `mp3`, `flac`,
4638        /// `opus`, or `pcm16`.
4639        pub format: CreateChatCompletionRequestAudioFormat,
4640    }
4641    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
4642    #[serde(untagged)]
4643    /// Configuration for a [Predicted Output](/docs/guides/predicted-outputs),
4644    /// which can greatly improve response times when large parts of the model
4645    /// response are known ahead of time. This is most common when you are
4646    /// regenerating a file with only minor changes to most of the content.
4647    pub enum CreateChatCompletionRequestPrediction {
4648        PredictionContent(PredictionContent),
4649    }
4650    impl ::std::convert::From<PredictionContent> for CreateChatCompletionRequestPrediction {
4651        fn from(value: PredictionContent) -> Self {
4652            CreateChatCompletionRequestPrediction::PredictionContent(value)
4653        }
4654    }
4655    impl ::std::convert::TryFrom<CreateChatCompletionRequestPrediction> for PredictionContent {
4656        type Error = CreateChatCompletionRequestPrediction;
4657        /// # Errors
4658        ///
4659        /// Returns the original enum value if it does not match the
4660        /// `#variant_ident` variant.
4661        fn try_from(
4662            value: CreateChatCompletionRequestPrediction,
4663        ) -> ::std::result::Result<Self, Self::Error> {
4664            match value {
4665                CreateChatCompletionRequestPrediction::PredictionContent(inner) => {
4666                    ::std::result::Result::Ok(inner)
4667                }
4668                other => ::std::result::Result::Err(other),
4669            }
4670        }
4671    }
4672    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
4673    #[serde(untagged)]
4674    pub enum CreateChatCompletionRequestTools {
4675        ChatCompletionTool(ChatCompletionTool),
4676        CustomToolChatCompletions(CustomToolChatCompletions),
4677    }
4678    impl ::std::convert::From<ChatCompletionTool> for CreateChatCompletionRequestTools {
4679        fn from(value: ChatCompletionTool) -> Self {
4680            CreateChatCompletionRequestTools::ChatCompletionTool(value)
4681        }
4682    }
4683    impl ::std::convert::TryFrom<CreateChatCompletionRequestTools> for ChatCompletionTool {
4684        type Error = CreateChatCompletionRequestTools;
4685        /// # Errors
4686        ///
4687        /// Returns the original enum value if it does not match the
4688        /// `#variant_ident` variant.
4689        fn try_from(
4690            value: CreateChatCompletionRequestTools,
4691        ) -> ::std::result::Result<Self, Self::Error> {
4692            match value {
4693                CreateChatCompletionRequestTools::ChatCompletionTool(inner) => {
4694                    ::std::result::Result::Ok(inner)
4695                }
4696                other => ::std::result::Result::Err(other),
4697            }
4698        }
4699    }
4700    impl ::std::convert::From<CustomToolChatCompletions> for CreateChatCompletionRequestTools {
4701        fn from(value: CustomToolChatCompletions) -> Self {
4702            CreateChatCompletionRequestTools::CustomToolChatCompletions(value)
4703        }
4704    }
4705    impl ::std::convert::TryFrom<CreateChatCompletionRequestTools> for CustomToolChatCompletions {
4706        type Error = CreateChatCompletionRequestTools;
4707        /// # Errors
4708        ///
4709        /// Returns the original enum value if it does not match the
4710        /// `#variant_ident` variant.
4711        fn try_from(
4712            value: CreateChatCompletionRequestTools,
4713        ) -> ::std::result::Result<Self, Self::Error> {
4714            match value {
4715                CreateChatCompletionRequestTools::CustomToolChatCompletions(inner) => {
4716                    ::std::result::Result::Ok(inner)
4717                }
4718                other => ::std::result::Result::Err(other),
4719            }
4720        }
4721    }
4722    /// `none` means the model will not call a function and instead generates a message. `auto` means the model can pick between generating a message or calling a function.
4723    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
4724    pub enum CreateChatCompletionRequestFunctionCallVariant0 {
4725        #[serde(rename = "none")]
4726        None,
4727        #[serde(rename = "auto")]
4728        Auto,
4729    }
4730    impl ::std::fmt::Display for CreateChatCompletionRequestFunctionCallVariant0 {
4731        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
4732            match self {
4733                Self::None => ::std::write!(__f, "none"),
4734                Self::Auto => ::std::write!(__f, "auto"),
4735            }
4736        }
4737    }
4738    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
4739    #[serde(untagged)]
4740    #[deprecated]
4741    /// Deprecated in favor of `tool_choice`.
4742    ///
4743    /// Controls which (if any) function is called by the model.
4744    ///
4745    /// `none` means the model will not call a function and instead generates a
4746    /// message.
4747    ///
4748    /// `auto` means the model can pick between generating a message or calling a
4749    /// function.
4750    ///
4751    /// Specifying a particular function via `{"name": "my_function"}` forces the
4752    /// model to call that function.
4753    ///
4754    /// `none` is the default when no functions are present. `auto` is the default
4755    /// if functions are present.
4756    pub enum CreateChatCompletionRequestFunctionCall {
4757        CreateChatCompletionRequestFunctionCallVariant0(
4758            CreateChatCompletionRequestFunctionCallVariant0,
4759        ),
4760        ChatCompletionFunctionCallOption(ChatCompletionFunctionCallOption),
4761    }
4762    impl ::std::convert::From<CreateChatCompletionRequestFunctionCallVariant0>
4763        for CreateChatCompletionRequestFunctionCall
4764    {
4765        fn from(value: CreateChatCompletionRequestFunctionCallVariant0) -> Self {
4766            CreateChatCompletionRequestFunctionCall::CreateChatCompletionRequestFunctionCallVariant0(
4767                value,
4768            )
4769        }
4770    }
4771    impl ::std::convert::TryFrom<CreateChatCompletionRequestFunctionCall>
4772        for CreateChatCompletionRequestFunctionCallVariant0
4773    {
4774        type Error = CreateChatCompletionRequestFunctionCall;
4775        /// # Errors
4776        ///
4777        /// Returns the original enum value if it does not match the
4778        /// `#variant_ident` variant.
4779        fn try_from(
4780            value: CreateChatCompletionRequestFunctionCall,
4781        ) -> ::std::result::Result<Self, Self::Error> {
4782            match value {
4783                CreateChatCompletionRequestFunctionCall::CreateChatCompletionRequestFunctionCallVariant0(
4784                    inner,
4785                ) => ::std::result::Result::Ok(inner),
4786                other => ::std::result::Result::Err(other),
4787            }
4788        }
4789    }
4790    impl ::std::convert::From<ChatCompletionFunctionCallOption>
4791        for CreateChatCompletionRequestFunctionCall
4792    {
4793        fn from(value: ChatCompletionFunctionCallOption) -> Self {
4794            CreateChatCompletionRequestFunctionCall::ChatCompletionFunctionCallOption(value)
4795        }
4796    }
4797    impl ::std::convert::TryFrom<CreateChatCompletionRequestFunctionCall>
4798        for ChatCompletionFunctionCallOption
4799    {
4800        type Error = CreateChatCompletionRequestFunctionCall;
4801        /// # Errors
4802        ///
4803        /// Returns the original enum value if it does not match the
4804        /// `#variant_ident` variant.
4805        fn try_from(
4806            value: CreateChatCompletionRequestFunctionCall,
4807        ) -> ::std::result::Result<Self, Self::Error> {
4808            match value {
4809                CreateChatCompletionRequestFunctionCall::ChatCompletionFunctionCallOption(
4810                    inner,
4811                ) => ::std::result::Result::Ok(inner),
4812                other => ::std::result::Result::Err(other),
4813            }
4814        }
4815    }
4816    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
4817    pub struct CreateChatCompletionRequest {
4818        #[serde(skip_serializing_if = "Option::is_none")]
4819        pub metadata: Option<Metadata>,
4820        #[serde(skip_serializing_if = "Option::is_none")]
4821        pub top_logprobs: Option<CreateChatCompletionRequestTopLogprobs>,
4822        #[serde(skip_serializing_if = "Option::is_none")]
4823        pub temperature: Option<CreateChatCompletionRequestTemperature>,
4824        #[serde(skip_serializing_if = "Option::is_none")]
4825        pub top_p: Option<CreateChatCompletionRequestTopP>,
4826        #[serde(skip_serializing_if = "Option::is_none")]
4827        /// This field is being replaced by `safety_identifier` and `prompt_cache_key`. Use `prompt_cache_key` instead to maintain caching optimizations.
4828        /// A stable identifier for your end-users.
4829        /// Used to boost cache hit rates by better bucketing similar requests and  to help OpenAI detect and prevent abuse. [Learn more](/docs/guides/safety-best-practices#safety-identifiers).
4830        #[deprecated]
4831        pub user: Option<String>,
4832        #[serde(skip_serializing_if = "Option::is_none")]
4833        /// A stable identifier used to help detect users of your application that may be violating OpenAI's usage policies.
4834        /// The IDs should be a string that uniquely identifies each user, with a maximum length of 64 characters. We recommend hashing their username or email address, in order to avoid sending us any identifying information. [Learn more](/docs/guides/safety-best-practices#safety-identifiers).
4835        pub safety_identifier: Option<String>,
4836        #[serde(skip_serializing_if = "Option::is_none")]
4837        /// Used by OpenAI to cache responses for similar requests to optimize your cache hit rates. Replaces the `user` field. [Learn more](/docs/guides/prompt-caching).
4838        pub prompt_cache_key: Option<String>,
4839        #[serde(skip_serializing_if = "Option::is_none")]
4840        pub service_tier: Option<ServiceTier>,
4841        #[serde(skip_serializing_if = "Option::is_none")]
4842        pub prompt_cache_retention: Option<CreateChatCompletionRequestPromptCacheRetention>,
4843        /// A list of messages comprising the conversation so far. Depending on the
4844        /// [model](/docs/models) you use, different message types (modalities) are
4845        /// supported, like [text](/docs/guides/text-generation),
4846        /// [images](/docs/guides/vision), and [audio](/docs/guides/audio).
4847        pub messages: Vec<ChatCompletionRequestMessage>,
4848        pub model: ModelIdsShared,
4849        #[serde(skip_serializing_if = "Option::is_none")]
4850        pub modalities: Option<ResponseModalities>,
4851        #[serde(skip_serializing_if = "Option::is_none")]
4852        pub verbosity: Option<Verbosity>,
4853        #[serde(skip_serializing_if = "Option::is_none")]
4854        pub reasoning_effort: Option<ReasoningEffort>,
4855        #[serde(skip_serializing_if = "Option::is_none")]
4856        /// An upper bound for the number of tokens that can be generated for a completion, including visible output tokens and [reasoning tokens](/docs/guides/reasoning).
4857        pub max_completion_tokens: Option<i64>,
4858        #[serde(skip_serializing_if = "Option::is_none")]
4859        /// Number between -2.0 and 2.0. Positive values penalize new tokens based on
4860        /// their existing frequency in the text so far, decreasing the model's
4861        /// likelihood to repeat the same line verbatim.
4862        pub frequency_penalty: Option<f64>,
4863        #[serde(skip_serializing_if = "Option::is_none")]
4864        /// Number between -2.0 and 2.0. Positive values penalize new tokens based on
4865        /// whether they appear in the text so far, increasing the model's likelihood
4866        /// to talk about new topics.
4867        pub presence_penalty: Option<f64>,
4868        #[serde(skip_serializing_if = "Option::is_none")]
4869        /// This tool searches the web for relevant results to use in a response.
4870        /// Learn more about the [web search tool](/docs/guides/tools-web-search?api-mode=chat).
4871        pub web_search_options: Option<CreateChatCompletionRequestWebSearchOptions>,
4872        #[serde(skip_serializing_if = "Option::is_none")]
4873        /// An object specifying the format that the model must output.
4874        ///
4875        /// Setting to `{ "type": "json_schema", "json_schema": {...} }` enables
4876        /// Structured Outputs which ensures the model will match your supplied JSON
4877        /// schema. Learn more in the [Structured Outputs
4878        /// guide](/docs/guides/structured-outputs).
4879        ///
4880        /// Setting to `{ "type": "json_object" }` enables the older JSON mode, which
4881        /// ensures the message the model generates is valid JSON. Using `json_schema`
4882        /// is preferred for models that support it.
4883        pub response_format: Option<CreateChatCompletionRequestResponseFormat>,
4884        #[serde(skip_serializing_if = "Option::is_none")]
4885        /// Parameters for audio output. Required when audio output is requested with
4886        /// `modalities: ["audio"]`. [Learn more](/docs/guides/audio).
4887        pub audio: Option<CreateChatCompletionRequestAudio>,
4888        #[serde(skip_serializing_if = "Option::is_none")]
4889        /// Whether or not to store the output of this chat completion request for
4890        /// use in our [model distillation](/docs/guides/distillation) or
4891        /// [evals](/docs/guides/evals) products.
4892        ///
4893        /// Supports text and image inputs. Note: image inputs over 8MB will be dropped.
4894        pub store: Option<bool>,
4895        #[serde(skip_serializing_if = "Option::is_none")]
4896        /// If set to true, the model response data will be streamed to the client
4897        /// 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).
4898        /// See the [Streaming section below](/docs/api-reference/chat/streaming)
4899        /// for more information, along with the [streaming responses](/docs/guides/streaming-responses)
4900        /// guide for more information on how to handle the streaming events.
4901        pub stream: Option<bool>,
4902        #[serde(skip_serializing_if = "Option::is_none")]
4903        pub stop: Option<StopConfiguration>,
4904        #[serde(skip_serializing_if = "Option::is_none")]
4905        /// Modify the likelihood of specified tokens appearing in the completion.
4906        ///
4907        /// Accepts a JSON object that maps tokens (specified by their token ID in the
4908        /// tokenizer) to an associated bias value from -100 to 100. Mathematically,
4909        /// the bias is added to the logits generated by the model prior to sampling.
4910        /// The exact effect will vary per model, but values between -1 and 1 should
4911        /// decrease or increase likelihood of selection; values like -100 or 100
4912        /// should result in a ban or exclusive selection of the relevant token.
4913        pub logit_bias: Option<::std::collections::BTreeMap<String, i64>>,
4914        #[serde(skip_serializing_if = "Option::is_none")]
4915        /// Whether to return log probabilities of the output tokens or not. If true,
4916        /// returns the log probabilities of each output token returned in the
4917        /// `content` of `message`.
4918        pub logprobs: Option<bool>,
4919        #[serde(skip_serializing_if = "Option::is_none")]
4920        /// The maximum number of [tokens](/tokenizer) that can be generated in the
4921        /// chat completion. This value can be used to control
4922        /// [costs](https://openai.com/api/pricing/) for text generated via API.
4923        ///
4924        /// This value is now deprecated in favor of `max_completion_tokens`, and is
4925        /// not compatible with [o-series models](/docs/guides/reasoning).
4926        #[deprecated]
4927        pub max_tokens: Option<i64>,
4928        #[serde(skip_serializing_if = "Option::is_none")]
4929        /// How many chat completion choices to generate for each input message. Note that you will be charged based on the number of generated tokens across all of the choices. Keep `n` as `1` to minimize costs.
4930        pub n: Option<i64>,
4931        #[serde(skip_serializing_if = "Option::is_none")]
4932        /// Configuration for a [Predicted Output](/docs/guides/predicted-outputs),
4933        /// which can greatly improve response times when large parts of the model
4934        /// response are known ahead of time. This is most common when you are
4935        /// regenerating a file with only minor changes to most of the content.
4936        pub prediction: Option<CreateChatCompletionRequestPrediction>,
4937        #[serde(skip_serializing_if = "Option::is_none")]
4938        /// This feature is in Beta.
4939        /// 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.
4940        /// Determinism is not guaranteed, and you should refer to the `system_fingerprint` response parameter to monitor changes in the backend.
4941        #[deprecated]
4942        pub seed: Option<i64>,
4943        #[serde(skip_serializing_if = "Option::is_none")]
4944        pub stream_options: Option<ChatCompletionStreamOptions>,
4945        #[serde(skip_serializing_if = "Option::is_none")]
4946        /// A list of tools the model may call. You can provide either
4947        /// [custom tools](/docs/guides/function-calling#custom-tools) or
4948        /// [function tools](/docs/guides/function-calling).
4949        pub tools: Option<Vec<CreateChatCompletionRequestTools>>,
4950        #[serde(skip_serializing_if = "Option::is_none")]
4951        pub tool_choice: Option<ChatCompletionToolChoiceOption>,
4952        #[serde(skip_serializing_if = "Option::is_none")]
4953        pub parallel_tool_calls: Option<ParallelToolCalls>,
4954        #[serde(skip_serializing_if = "Option::is_none")]
4955        /// Deprecated in favor of `tool_choice`.
4956        ///
4957        /// Controls which (if any) function is called by the model.
4958        ///
4959        /// `none` means the model will not call a function and instead generates a
4960        /// message.
4961        ///
4962        /// `auto` means the model can pick between generating a message or calling a
4963        /// function.
4964        ///
4965        /// Specifying a particular function via `{"name": "my_function"}` forces the
4966        /// model to call that function.
4967        ///
4968        /// `none` is the default when no functions are present. `auto` is the default
4969        /// if functions are present.
4970        #[deprecated]
4971        pub function_call: Option<CreateChatCompletionRequestFunctionCall>,
4972        #[serde(skip_serializing_if = "Option::is_none")]
4973        /// Deprecated in favor of `tools`.
4974        ///
4975        /// A list of functions the model may generate JSON inputs for.
4976        #[deprecated]
4977        pub functions: Option<Vec<ChatCompletionFunctions>>,
4978    }
4979    /// The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence,
4980    /// `length` if the maximum number of tokens specified in the request was reached,
4981    /// `content_filter` if content was omitted due to a flag from our content filters,
4982    /// `tool_calls` if the model called a tool, or `function_call` (deprecated) if the model called a function.
4983    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
4984    pub enum CreateChatCompletionResponseChoicesFinishReason {
4985        #[serde(rename = "stop")]
4986        Stop,
4987        #[serde(rename = "length")]
4988        Length,
4989        #[serde(rename = "tool_calls")]
4990        ToolCalls,
4991        #[serde(rename = "content_filter")]
4992        ContentFilter,
4993        #[serde(rename = "function_call")]
4994        FunctionCall,
4995    }
4996    impl ::std::fmt::Display for CreateChatCompletionResponseChoicesFinishReason {
4997        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
4998            match self {
4999                Self::Stop => ::std::write!(__f, "stop"),
5000                Self::Length => ::std::write!(__f, "length"),
5001                Self::ToolCalls => ::std::write!(__f, "tool_calls"),
5002                Self::ContentFilter => ::std::write!(__f, "content_filter"),
5003                Self::FunctionCall => ::std::write!(__f, "function_call"),
5004            }
5005        }
5006    }
5007    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
5008    #[serde(untagged)]
5009    pub enum ChatCompletionResponseMessageContent {
5010        ChatCompletionResponseMessageContentVariant0(String),
5011        ChatCompletionResponseMessageContentVariant1(Option<::serde_json::Value>),
5012    }
5013    impl ::std::convert::From<String> for ChatCompletionResponseMessageContent {
5014        fn from(value: String) -> Self {
5015            ChatCompletionResponseMessageContent::ChatCompletionResponseMessageContentVariant0(
5016                value,
5017            )
5018        }
5019    }
5020    impl ::std::convert::TryFrom<ChatCompletionResponseMessageContent> for String {
5021        type Error = ChatCompletionResponseMessageContent;
5022        /// # Errors
5023        ///
5024        /// Returns the original enum value if it does not match the
5025        /// `#variant_ident` variant.
5026        fn try_from(
5027            value: ChatCompletionResponseMessageContent,
5028        ) -> ::std::result::Result<Self, Self::Error> {
5029            match value {
5030                ChatCompletionResponseMessageContent::ChatCompletionResponseMessageContentVariant0(
5031                    inner,
5032                ) => ::std::result::Result::Ok(inner),
5033                other => ::std::result::Result::Err(other),
5034            }
5035        }
5036    }
5037    impl ::std::convert::From<Option<::serde_json::Value>> for ChatCompletionResponseMessageContent {
5038        fn from(value: Option<::serde_json::Value>) -> Self {
5039            ChatCompletionResponseMessageContent::ChatCompletionResponseMessageContentVariant1(
5040                value,
5041            )
5042        }
5043    }
5044    impl ::std::convert::TryFrom<ChatCompletionResponseMessageContent> for Option<::serde_json::Value> {
5045        type Error = ChatCompletionResponseMessageContent;
5046        /// # Errors
5047        ///
5048        /// Returns the original enum value if it does not match the
5049        /// `#variant_ident` variant.
5050        fn try_from(
5051            value: ChatCompletionResponseMessageContent,
5052        ) -> ::std::result::Result<Self, Self::Error> {
5053            match value {
5054                ChatCompletionResponseMessageContent::ChatCompletionResponseMessageContentVariant1(
5055                    inner,
5056                ) => ::std::result::Result::Ok(inner),
5057                other => ::std::result::Result::Err(other),
5058            }
5059        }
5060    }
5061    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
5062    #[serde(untagged)]
5063    pub enum ChatCompletionResponseMessageRefusal {
5064        ChatCompletionResponseMessageRefusalVariant0(String),
5065        ChatCompletionResponseMessageRefusalVariant1(Option<::serde_json::Value>),
5066    }
5067    impl ::std::convert::From<String> for ChatCompletionResponseMessageRefusal {
5068        fn from(value: String) -> Self {
5069            ChatCompletionResponseMessageRefusal::ChatCompletionResponseMessageRefusalVariant0(
5070                value,
5071            )
5072        }
5073    }
5074    impl ::std::convert::TryFrom<ChatCompletionResponseMessageRefusal> for String {
5075        type Error = ChatCompletionResponseMessageRefusal;
5076        /// # Errors
5077        ///
5078        /// Returns the original enum value if it does not match the
5079        /// `#variant_ident` variant.
5080        fn try_from(
5081            value: ChatCompletionResponseMessageRefusal,
5082        ) -> ::std::result::Result<Self, Self::Error> {
5083            match value {
5084                ChatCompletionResponseMessageRefusal::ChatCompletionResponseMessageRefusalVariant0(
5085                    inner,
5086                ) => ::std::result::Result::Ok(inner),
5087                other => ::std::result::Result::Err(other),
5088            }
5089        }
5090    }
5091    impl ::std::convert::From<Option<::serde_json::Value>> for ChatCompletionResponseMessageRefusal {
5092        fn from(value: Option<::serde_json::Value>) -> Self {
5093            ChatCompletionResponseMessageRefusal::ChatCompletionResponseMessageRefusalVariant1(
5094                value,
5095            )
5096        }
5097    }
5098    impl ::std::convert::TryFrom<ChatCompletionResponseMessageRefusal> for Option<::serde_json::Value> {
5099        type Error = ChatCompletionResponseMessageRefusal;
5100        /// # Errors
5101        ///
5102        /// Returns the original enum value if it does not match the
5103        /// `#variant_ident` variant.
5104        fn try_from(
5105            value: ChatCompletionResponseMessageRefusal,
5106        ) -> ::std::result::Result<Self, Self::Error> {
5107            match value {
5108                ChatCompletionResponseMessageRefusal::ChatCompletionResponseMessageRefusalVariant1(
5109                    inner,
5110                ) => ::std::result::Result::Ok(inner),
5111                other => ::std::result::Result::Err(other),
5112            }
5113        }
5114    }
5115    /// The type of the URL citation. Always `url_citation`.
5116    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
5117    pub enum ChatCompletionResponseMessageAnnotationsType {
5118        #[serde(rename = "url_citation")]
5119        UrlCitation,
5120    }
5121    impl ::std::fmt::Display for ChatCompletionResponseMessageAnnotationsType {
5122        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
5123            match self {
5124                Self::UrlCitation => ::std::write!(__f, "url_citation"),
5125            }
5126        }
5127    }
5128    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
5129    /// A URL citation when using web search.
5130    pub struct ChatCompletionResponseMessageAnnotationsUrlCitation {
5131        /// The index of the last character of the URL citation in the message.
5132        pub end_index: i64,
5133        /// The index of the first character of the URL citation in the message.
5134        pub start_index: i64,
5135        /// The URL of the web resource.
5136        pub url: String,
5137        /// The title of the web resource.
5138        pub title: String,
5139    }
5140    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
5141    /// A URL citation when using web search.
5142    pub struct ChatCompletionResponseMessageAnnotations {
5143        /// The type of the URL citation. Always `url_citation`.
5144        pub r#type: ChatCompletionResponseMessageAnnotationsType,
5145        /// A URL citation when using web search.
5146        pub url_citation: ChatCompletionResponseMessageAnnotationsUrlCitation,
5147    }
5148    /// The role of the author of this message.
5149    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
5150    pub enum ChatCompletionResponseMessageRole {
5151        #[serde(rename = "assistant")]
5152        Assistant,
5153    }
5154    impl ::std::fmt::Display for ChatCompletionResponseMessageRole {
5155        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
5156            match self {
5157                Self::Assistant => ::std::write!(__f, "assistant"),
5158            }
5159        }
5160    }
5161    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
5162    #[deprecated]
5163    /// Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model.
5164    pub struct ChatCompletionResponseMessageFunctionCall {
5165        /// 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.
5166        pub arguments: String,
5167        /// The name of the function to call.
5168        pub name: String,
5169    }
5170    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
5171    /// If the audio output modality is requested, this object contains data
5172    /// about the audio response from the model. [Learn more](/docs/guides/audio).
5173    pub struct ChatCompletionResponseMessageAudioVariant0 {
5174        /// Unique identifier for this audio response.
5175        pub id: String,
5176        /// The Unix timestamp (in seconds) for when this audio response will
5177        /// no longer be accessible on the server for use in multi-turn
5178        /// conversations.
5179        pub expires_at: i64,
5180        /// Base64 encoded audio bytes generated by the model, in the format
5181        /// specified in the request.
5182        pub data: String,
5183        /// Transcript of the audio generated by the model.
5184        pub transcript: String,
5185    }
5186    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
5187    #[serde(untagged)]
5188    pub enum ChatCompletionResponseMessageAudio {
5189        ChatCompletionResponseMessageAudioVariant0(ChatCompletionResponseMessageAudioVariant0),
5190        ChatCompletionResponseMessageAudioVariant1(Option<::serde_json::Value>),
5191    }
5192    impl ::std::convert::From<ChatCompletionResponseMessageAudioVariant0>
5193        for ChatCompletionResponseMessageAudio
5194    {
5195        fn from(value: ChatCompletionResponseMessageAudioVariant0) -> Self {
5196            ChatCompletionResponseMessageAudio::ChatCompletionResponseMessageAudioVariant0(value)
5197        }
5198    }
5199    impl ::std::convert::TryFrom<ChatCompletionResponseMessageAudio>
5200        for ChatCompletionResponseMessageAudioVariant0
5201    {
5202        type Error = ChatCompletionResponseMessageAudio;
5203        /// # Errors
5204        ///
5205        /// Returns the original enum value if it does not match the
5206        /// `#variant_ident` variant.
5207        fn try_from(
5208            value: ChatCompletionResponseMessageAudio,
5209        ) -> ::std::result::Result<Self, Self::Error> {
5210            match value {
5211                ChatCompletionResponseMessageAudio::ChatCompletionResponseMessageAudioVariant0(
5212                    inner,
5213                ) => ::std::result::Result::Ok(inner),
5214                other => ::std::result::Result::Err(other),
5215            }
5216        }
5217    }
5218    impl ::std::convert::From<Option<::serde_json::Value>> for ChatCompletionResponseMessageAudio {
5219        fn from(value: Option<::serde_json::Value>) -> Self {
5220            ChatCompletionResponseMessageAudio::ChatCompletionResponseMessageAudioVariant1(value)
5221        }
5222    }
5223    impl ::std::convert::TryFrom<ChatCompletionResponseMessageAudio> for Option<::serde_json::Value> {
5224        type Error = ChatCompletionResponseMessageAudio;
5225        /// # Errors
5226        ///
5227        /// Returns the original enum value if it does not match the
5228        /// `#variant_ident` variant.
5229        fn try_from(
5230            value: ChatCompletionResponseMessageAudio,
5231        ) -> ::std::result::Result<Self, Self::Error> {
5232            match value {
5233                ChatCompletionResponseMessageAudio::ChatCompletionResponseMessageAudioVariant1(
5234                    inner,
5235                ) => ::std::result::Result::Ok(inner),
5236                other => ::std::result::Result::Err(other),
5237            }
5238        }
5239    }
5240    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
5241    /// A chat completion message generated by the model.
5242    pub struct ChatCompletionResponseMessage {
5243        pub content: ChatCompletionResponseMessageContent,
5244        pub refusal: ChatCompletionResponseMessageRefusal,
5245        #[serde(skip_serializing_if = "Option::is_none")]
5246        pub tool_calls: Option<ChatCompletionMessageToolCalls>,
5247        #[serde(skip_serializing_if = "Option::is_none")]
5248        /// Annotations for the message, when applicable, as when using the
5249        /// [web search tool](/docs/guides/tools-web-search?api-mode=chat).
5250        pub annotations: Option<Vec<ChatCompletionResponseMessageAnnotations>>,
5251        /// The role of the author of this message.
5252        pub role: ChatCompletionResponseMessageRole,
5253        #[serde(skip_serializing_if = "Option::is_none")]
5254        /// Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model.
5255        #[deprecated]
5256        pub function_call: Option<ChatCompletionResponseMessageFunctionCall>,
5257        #[serde(skip_serializing_if = "Option::is_none")]
5258        pub audio: Option<ChatCompletionResponseMessageAudio>,
5259    }
5260    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
5261    #[serde(untagged)]
5262    pub enum CreateChatCompletionResponseChoicesLogprobsVariant0Content {
5263        CreateChatCompletionResponseChoicesLogprobsVariant0ContentVariant0(
5264            Vec<ChatCompletionTokenLogprob>,
5265        ),
5266        CreateChatCompletionResponseChoicesLogprobsVariant0ContentVariant1(
5267            Option<::serde_json::Value>,
5268        ),
5269    }
5270    impl ::std::convert::From<Vec<ChatCompletionTokenLogprob>>
5271        for CreateChatCompletionResponseChoicesLogprobsVariant0Content
5272    {
5273        fn from(value: Vec<ChatCompletionTokenLogprob>) -> Self {
5274            CreateChatCompletionResponseChoicesLogprobsVariant0Content::CreateChatCompletionResponseChoicesLogprobsVariant0ContentVariant0(
5275                value,
5276            )
5277        }
5278    }
5279    impl ::std::convert::TryFrom<CreateChatCompletionResponseChoicesLogprobsVariant0Content>
5280        for Vec<ChatCompletionTokenLogprob>
5281    {
5282        type Error = CreateChatCompletionResponseChoicesLogprobsVariant0Content;
5283        /// # Errors
5284        ///
5285        /// Returns the original enum value if it does not match the
5286        /// `#variant_ident` variant.
5287        fn try_from(
5288            value: CreateChatCompletionResponseChoicesLogprobsVariant0Content,
5289        ) -> ::std::result::Result<Self, Self::Error> {
5290            match value {
5291                CreateChatCompletionResponseChoicesLogprobsVariant0Content::CreateChatCompletionResponseChoicesLogprobsVariant0ContentVariant0(
5292                    inner,
5293                ) => ::std::result::Result::Ok(inner),
5294                other => ::std::result::Result::Err(other),
5295            }
5296        }
5297    }
5298    impl ::std::convert::From<Option<::serde_json::Value>>
5299        for CreateChatCompletionResponseChoicesLogprobsVariant0Content
5300    {
5301        fn from(value: Option<::serde_json::Value>) -> Self {
5302            CreateChatCompletionResponseChoicesLogprobsVariant0Content::CreateChatCompletionResponseChoicesLogprobsVariant0ContentVariant1(
5303                value,
5304            )
5305        }
5306    }
5307    impl ::std::convert::TryFrom<CreateChatCompletionResponseChoicesLogprobsVariant0Content>
5308        for Option<::serde_json::Value>
5309    {
5310        type Error = CreateChatCompletionResponseChoicesLogprobsVariant0Content;
5311        /// # Errors
5312        ///
5313        /// Returns the original enum value if it does not match the
5314        /// `#variant_ident` variant.
5315        fn try_from(
5316            value: CreateChatCompletionResponseChoicesLogprobsVariant0Content,
5317        ) -> ::std::result::Result<Self, Self::Error> {
5318            match value {
5319                CreateChatCompletionResponseChoicesLogprobsVariant0Content::CreateChatCompletionResponseChoicesLogprobsVariant0ContentVariant1(
5320                    inner,
5321                ) => ::std::result::Result::Ok(inner),
5322                other => ::std::result::Result::Err(other),
5323            }
5324        }
5325    }
5326    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
5327    #[serde(untagged)]
5328    pub enum CreateChatCompletionResponseChoicesLogprobsVariant0Refusal {
5329        CreateChatCompletionResponseChoicesLogprobsVariant0RefusalVariant0(
5330            Vec<ChatCompletionTokenLogprob>,
5331        ),
5332        CreateChatCompletionResponseChoicesLogprobsVariant0RefusalVariant1(
5333            Option<::serde_json::Value>,
5334        ),
5335    }
5336    impl ::std::convert::From<Vec<ChatCompletionTokenLogprob>>
5337        for CreateChatCompletionResponseChoicesLogprobsVariant0Refusal
5338    {
5339        fn from(value: Vec<ChatCompletionTokenLogprob>) -> Self {
5340            CreateChatCompletionResponseChoicesLogprobsVariant0Refusal::CreateChatCompletionResponseChoicesLogprobsVariant0RefusalVariant0(
5341                value,
5342            )
5343        }
5344    }
5345    impl ::std::convert::TryFrom<CreateChatCompletionResponseChoicesLogprobsVariant0Refusal>
5346        for Vec<ChatCompletionTokenLogprob>
5347    {
5348        type Error = CreateChatCompletionResponseChoicesLogprobsVariant0Refusal;
5349        /// # Errors
5350        ///
5351        /// Returns the original enum value if it does not match the
5352        /// `#variant_ident` variant.
5353        fn try_from(
5354            value: CreateChatCompletionResponseChoicesLogprobsVariant0Refusal,
5355        ) -> ::std::result::Result<Self, Self::Error> {
5356            match value {
5357                CreateChatCompletionResponseChoicesLogprobsVariant0Refusal::CreateChatCompletionResponseChoicesLogprobsVariant0RefusalVariant0(
5358                    inner,
5359                ) => ::std::result::Result::Ok(inner),
5360                other => ::std::result::Result::Err(other),
5361            }
5362        }
5363    }
5364    impl ::std::convert::From<Option<::serde_json::Value>>
5365        for CreateChatCompletionResponseChoicesLogprobsVariant0Refusal
5366    {
5367        fn from(value: Option<::serde_json::Value>) -> Self {
5368            CreateChatCompletionResponseChoicesLogprobsVariant0Refusal::CreateChatCompletionResponseChoicesLogprobsVariant0RefusalVariant1(
5369                value,
5370            )
5371        }
5372    }
5373    impl ::std::convert::TryFrom<CreateChatCompletionResponseChoicesLogprobsVariant0Refusal>
5374        for Option<::serde_json::Value>
5375    {
5376        type Error = CreateChatCompletionResponseChoicesLogprobsVariant0Refusal;
5377        /// # Errors
5378        ///
5379        /// Returns the original enum value if it does not match the
5380        /// `#variant_ident` variant.
5381        fn try_from(
5382            value: CreateChatCompletionResponseChoicesLogprobsVariant0Refusal,
5383        ) -> ::std::result::Result<Self, Self::Error> {
5384            match value {
5385                CreateChatCompletionResponseChoicesLogprobsVariant0Refusal::CreateChatCompletionResponseChoicesLogprobsVariant0RefusalVariant1(
5386                    inner,
5387                ) => ::std::result::Result::Ok(inner),
5388                other => ::std::result::Result::Err(other),
5389            }
5390        }
5391    }
5392    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
5393    /// Log probability information for the choice.
5394    pub struct CreateChatCompletionResponseChoicesLogprobsVariant0 {
5395        pub content: CreateChatCompletionResponseChoicesLogprobsVariant0Content,
5396        pub refusal: CreateChatCompletionResponseChoicesLogprobsVariant0Refusal,
5397    }
5398    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
5399    #[serde(untagged)]
5400    pub enum CreateChatCompletionResponseChoicesLogprobs {
5401        CreateChatCompletionResponseChoicesLogprobsVariant0(
5402            CreateChatCompletionResponseChoicesLogprobsVariant0,
5403        ),
5404        CreateChatCompletionResponseChoicesLogprobsVariant1(Option<::serde_json::Value>),
5405    }
5406    impl ::std::convert::From<CreateChatCompletionResponseChoicesLogprobsVariant0>
5407        for CreateChatCompletionResponseChoicesLogprobs
5408    {
5409        fn from(value: CreateChatCompletionResponseChoicesLogprobsVariant0) -> Self {
5410            CreateChatCompletionResponseChoicesLogprobs::CreateChatCompletionResponseChoicesLogprobsVariant0(
5411                value,
5412            )
5413        }
5414    }
5415    impl ::std::convert::TryFrom<CreateChatCompletionResponseChoicesLogprobs>
5416        for CreateChatCompletionResponseChoicesLogprobsVariant0
5417    {
5418        type Error = CreateChatCompletionResponseChoicesLogprobs;
5419        /// # Errors
5420        ///
5421        /// Returns the original enum value if it does not match the
5422        /// `#variant_ident` variant.
5423        fn try_from(
5424            value: CreateChatCompletionResponseChoicesLogprobs,
5425        ) -> ::std::result::Result<Self, Self::Error> {
5426            match value {
5427                CreateChatCompletionResponseChoicesLogprobs::CreateChatCompletionResponseChoicesLogprobsVariant0(
5428                    inner,
5429                ) => ::std::result::Result::Ok(inner),
5430                other => ::std::result::Result::Err(other),
5431            }
5432        }
5433    }
5434    impl ::std::convert::From<Option<::serde_json::Value>>
5435        for CreateChatCompletionResponseChoicesLogprobs
5436    {
5437        fn from(value: Option<::serde_json::Value>) -> Self {
5438            CreateChatCompletionResponseChoicesLogprobs::CreateChatCompletionResponseChoicesLogprobsVariant1(
5439                value,
5440            )
5441        }
5442    }
5443    impl ::std::convert::TryFrom<CreateChatCompletionResponseChoicesLogprobs>
5444        for Option<::serde_json::Value>
5445    {
5446        type Error = CreateChatCompletionResponseChoicesLogprobs;
5447        /// # Errors
5448        ///
5449        /// Returns the original enum value if it does not match the
5450        /// `#variant_ident` variant.
5451        fn try_from(
5452            value: CreateChatCompletionResponseChoicesLogprobs,
5453        ) -> ::std::result::Result<Self, Self::Error> {
5454            match value {
5455                CreateChatCompletionResponseChoicesLogprobs::CreateChatCompletionResponseChoicesLogprobsVariant1(
5456                    inner,
5457                ) => ::std::result::Result::Ok(inner),
5458                other => ::std::result::Result::Err(other),
5459            }
5460        }
5461    }
5462    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
5463    pub struct CreateChatCompletionResponseChoices {
5464        /// The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence,
5465        /// `length` if the maximum number of tokens specified in the request was reached,
5466        /// `content_filter` if content was omitted due to a flag from our content filters,
5467        /// `tool_calls` if the model called a tool, or `function_call` (deprecated) if the model called a function.
5468        pub finish_reason: CreateChatCompletionResponseChoicesFinishReason,
5469        /// The index of the choice in the list of choices.
5470        pub index: i64,
5471        pub message: ChatCompletionResponseMessage,
5472        pub logprobs: CreateChatCompletionResponseChoicesLogprobs,
5473    }
5474    /// The object type, which is always `chat.completion`.
5475    #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
5476    pub enum CreateChatCompletionResponseObject {
5477        #[serde(rename = "chat.completion")]
5478        ChatCompletion,
5479    }
5480    impl ::std::fmt::Display for CreateChatCompletionResponseObject {
5481        fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
5482            match self {
5483                Self::ChatCompletion => ::std::write!(__f, "chat.completion"),
5484            }
5485        }
5486    }
5487    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
5488    /// Represents a chat completion response returned by model, based on the provided input.
5489    pub struct CreateChatCompletionResponse {
5490        /// A unique identifier for the chat completion.
5491        pub id: String,
5492        /// A list of chat completion choices. Can be more than one if `n` is greater than 1.
5493        pub choices: Vec<CreateChatCompletionResponseChoices>,
5494        /// The Unix timestamp (in seconds) of when the chat completion was created.
5495        pub created: i64,
5496        /// The model used for the chat completion.
5497        pub model: String,
5498        #[serde(skip_serializing_if = "Option::is_none")]
5499        pub service_tier: Option<ServiceTier>,
5500        #[serde(skip_serializing_if = "Option::is_none")]
5501        /// This fingerprint represents the backend configuration that the model runs with.
5502        ///
5503        /// Can be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism.
5504        #[deprecated]
5505        pub system_fingerprint: Option<String>,
5506        /// The object type, which is always `chat.completion`.
5507        pub object: CreateChatCompletionResponseObject,
5508        #[serde(skip_serializing_if = "Option::is_none")]
5509        pub usage: Option<CompletionUsage>,
5510    }
5511    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
5512    pub struct OpenAiErrorResponseError {
5513        /// 人类可读的错误描述。
5514        pub message: String,
5515        /// OpenAI 错误大类:invalid_request_error / authentication_error / permission_error / not_found_error / rate_limit_error / insufficient_quota / server_error / overloaded 等。
5516        pub r#type: String,
5517        #[serde(skip_serializing_if = "Option::is_none")]
5518        /// 细化错误代码(如 model_not_found / context_length_exceeded / insufficient_quota)。
5519        pub code: Option<String>,
5520        #[serde(skip_serializing_if = "Option::is_none")]
5521        /// 引发错误的请求参数名(如有)。
5522        pub param: Option<String>,
5523    }
5524    #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
5525    /// OpenAI 4xx/5xx 错误响应。`error.code` / `param` 在不同错误类型上可能缺省。
5526    pub struct OpenAiErrorResponse {
5527        pub error: OpenAiErrorResponseError,
5528    }
5529}
5530pub mod operations {
5531    #![allow(deprecated)]
5532    #![allow(unreachable_patterns)]
5533    #![allow(non_camel_case_types)]
5534    #![allow(non_snake_case)]
5535    #![allow(clippy::all, clippy::pedantic)]
5536    pub mod models {
5537        pub mod get {
5538            #[derive(Debug, Clone, PartialEq)]
5539            /// # Lists the currently available models, and provides basic information about each one such as the owner and availability.
5540            pub struct Request {}
5541            impl Request {
5542                /// `GET /models`
5543                /// Operation ID: `listModels`.
5544                pub const METHOD: ::http::Method = ::http::Method::GET;
5545                /// URL path template, with `{name}` placeholders for path
5546                /// parameters. Rendering into a concrete URL is the caller's
5547                /// responsibility.
5548                pub const PATH_TEMPLATE: &'static str = "/models";
5549                /// Security requirement declared by the spec for this
5550                /// operation. Outer slice encodes OR alternatives; inner
5551                /// slice encodes AND requirements within one alternative.
5552                /// Empty outer slice means "public, no auth required".
5553                pub const SECURITY: &'static [&'static [&'static str]] = &[&["ApiKeyAuth"]];
5554                /// Wraps this request with an `Accept` header override.
5555                ///
5556                /// The generated [`::toac::MakeRequest`] impl auto-emits an
5557                /// `Accept` header listing every response media type
5558                /// declared in the spec. Use this method to steer content
5559                /// negotiation to one specific type (for example, asking
5560                /// for `text/event-stream` to land on a streaming branch).
5561                pub fn with_accept(self, accept: ::http::HeaderValue) -> ::toac::WithAccept<Self> {
5562                    ::toac::WithAccept::new(self, accept)
5563                }
5564            }
5565            impl ::toac::MakeRequest for Request {
5566                type Error = ::std::convert::Infallible;
5567                fn make_request(
5568                    self,
5569                ) -> impl ::std::future::Future<
5570                    Output = ::std::result::Result<::toac::Request, Self::Error>,
5571                > + Send {
5572                    async move {
5573                        let mut __path = ::std::string::String::new();
5574                        __path.push_str("/models");
5575                        let mut __builder = ::http::Request::builder()
5576                            .method(::http::Method::GET)
5577                            .uri(__path);
5578                        __builder = __builder.header(
5579                            ::http::header::ACCEPT,
5580                            ::http::HeaderValue::from_static("application/json"),
5581                        );
5582                        let mut __request = __builder
5583                            .body(::toac::body::Body::empty())
5584                            .expect("valid generated HTTP request");
5585                        __request
5586                            .extensions_mut()
5587                            .insert(::toac::OperationSecurity(&[&["ApiKeyAuth"]]));
5588                        ::std::result::Result::Ok(__request)
5589                    }
5590                }
5591            }
5592            #[derive(Debug, Clone, PartialEq)]
5593            pub enum ResponseBody {
5594                ///OK
5595                Status200(crate::wire::openai::components::ListModelsResponse),
5596                ///Bad Request — 请求体格式或字段无效。
5597                Status400(crate::wire::openai::components::OpenAiErrorResponse),
5598                ///Unauthorized — API key 缺失 / 无效。
5599                Status401(crate::wire::openai::components::OpenAiErrorResponse),
5600                ///Forbidden — 资源访问被拒,可能是配额耗尽。
5601                Status403(crate::wire::openai::components::OpenAiErrorResponse),
5602                ///Not Found — 模型 id 不存在或被弃用。
5603                Status404(crate::wire::openai::components::OpenAiErrorResponse),
5604                ///Payload Too Large — 请求体超出上游限制。
5605                Status413(crate::wire::openai::components::OpenAiErrorResponse),
5606                ///Too Many Requests — 触发 RPM / TPM 限速。
5607                Status429(crate::wire::openai::components::OpenAiErrorResponse),
5608                ///Internal Server Error — 上游异常。
5609                Status500(crate::wire::openai::components::OpenAiErrorResponse),
5610                ///Bad Gateway — 上游网关异常。
5611                Status502(crate::wire::openai::components::OpenAiErrorResponse),
5612                ///Service Unavailable — 上游过载或维护中。
5613                Status503(crate::wire::openai::components::OpenAiErrorResponse),
5614            }
5615            #[derive(Debug, Clone, PartialEq)]
5616            pub struct Response {
5617                /// Response headers as received from the wire.
5618                pub headers: ::http::HeaderMap,
5619                /// Decoded body, dispatched by status (and Content-Type
5620                /// when the spec declares multiple codecs per status).
5621                pub body: ResponseBody,
5622            }
5623            impl ::toac::ParseResponse for Response {
5624                type Error = ::toac::DecodeError;
5625                fn parse_response<__B>(
5626                    response: ::http::Response<__B>,
5627                ) -> impl ::std::future::Future<
5628                    Output = ::std::result::Result<Self, Self::Error>,
5629                > + ::std::marker::Send
5630                where
5631                    __B: ::http_body::Body<Data = ::bytes::Bytes>
5632                        + ::std::marker::Send
5633                        + ::std::marker::Sync
5634                        + 'static,
5635                    __B::Error: ::std::convert::Into<::toac::BoxError>,
5636                {
5637                    async move {
5638                        let (__parts, __body) = response.into_parts();
5639                        let __status = __parts.status;
5640                        let __headers = __parts.headers;
5641                        match __status.as_u16() {
5642                            200u16 => {
5643                                let __decoder = <::toac::body::codec::json::JsonDecoder as ::std::default::Default>::default();
5644                                let __value = ::toac::body::codec::decode_body(&__decoder, __body)
5645                                    .await
5646                                    .map_err(|e| {
5647                                        ::toac::DecodeError::Codec(::std::convert::Into::into(e))
5648                                    })?;
5649                                return ::std::result::Result::Ok(Self {
5650                                    headers: __headers,
5651                                    body: ResponseBody::Status200(__value),
5652                                });
5653                            }
5654                            400u16 => {
5655                                let __decoder = <::toac::body::codec::json::JsonDecoder as ::std::default::Default>::default();
5656                                let __value = ::toac::body::codec::decode_body(&__decoder, __body)
5657                                    .await
5658                                    .map_err(|e| {
5659                                        ::toac::DecodeError::Codec(::std::convert::Into::into(e))
5660                                    })?;
5661                                return ::std::result::Result::Ok(Self {
5662                                    headers: __headers,
5663                                    body: ResponseBody::Status400(__value),
5664                                });
5665                            }
5666                            401u16 => {
5667                                let __decoder = <::toac::body::codec::json::JsonDecoder as ::std::default::Default>::default();
5668                                let __value = ::toac::body::codec::decode_body(&__decoder, __body)
5669                                    .await
5670                                    .map_err(|e| {
5671                                        ::toac::DecodeError::Codec(::std::convert::Into::into(e))
5672                                    })?;
5673                                return ::std::result::Result::Ok(Self {
5674                                    headers: __headers,
5675                                    body: ResponseBody::Status401(__value),
5676                                });
5677                            }
5678                            403u16 => {
5679                                let __decoder = <::toac::body::codec::json::JsonDecoder as ::std::default::Default>::default();
5680                                let __value = ::toac::body::codec::decode_body(&__decoder, __body)
5681                                    .await
5682                                    .map_err(|e| {
5683                                        ::toac::DecodeError::Codec(::std::convert::Into::into(e))
5684                                    })?;
5685                                return ::std::result::Result::Ok(Self {
5686                                    headers: __headers,
5687                                    body: ResponseBody::Status403(__value),
5688                                });
5689                            }
5690                            404u16 => {
5691                                let __decoder = <::toac::body::codec::json::JsonDecoder as ::std::default::Default>::default();
5692                                let __value = ::toac::body::codec::decode_body(&__decoder, __body)
5693                                    .await
5694                                    .map_err(|e| {
5695                                        ::toac::DecodeError::Codec(::std::convert::Into::into(e))
5696                                    })?;
5697                                return ::std::result::Result::Ok(Self {
5698                                    headers: __headers,
5699                                    body: ResponseBody::Status404(__value),
5700                                });
5701                            }
5702                            413u16 => {
5703                                let __decoder = <::toac::body::codec::json::JsonDecoder as ::std::default::Default>::default();
5704                                let __value = ::toac::body::codec::decode_body(&__decoder, __body)
5705                                    .await
5706                                    .map_err(|e| {
5707                                        ::toac::DecodeError::Codec(::std::convert::Into::into(e))
5708                                    })?;
5709                                return ::std::result::Result::Ok(Self {
5710                                    headers: __headers,
5711                                    body: ResponseBody::Status413(__value),
5712                                });
5713                            }
5714                            429u16 => {
5715                                let __decoder = <::toac::body::codec::json::JsonDecoder as ::std::default::Default>::default();
5716                                let __value = ::toac::body::codec::decode_body(&__decoder, __body)
5717                                    .await
5718                                    .map_err(|e| {
5719                                        ::toac::DecodeError::Codec(::std::convert::Into::into(e))
5720                                    })?;
5721                                return ::std::result::Result::Ok(Self {
5722                                    headers: __headers,
5723                                    body: ResponseBody::Status429(__value),
5724                                });
5725                            }
5726                            500u16 => {
5727                                let __decoder = <::toac::body::codec::json::JsonDecoder as ::std::default::Default>::default();
5728                                let __value = ::toac::body::codec::decode_body(&__decoder, __body)
5729                                    .await
5730                                    .map_err(|e| {
5731                                        ::toac::DecodeError::Codec(::std::convert::Into::into(e))
5732                                    })?;
5733                                return ::std::result::Result::Ok(Self {
5734                                    headers: __headers,
5735                                    body: ResponseBody::Status500(__value),
5736                                });
5737                            }
5738                            502u16 => {
5739                                let __decoder = <::toac::body::codec::json::JsonDecoder as ::std::default::Default>::default();
5740                                let __value = ::toac::body::codec::decode_body(&__decoder, __body)
5741                                    .await
5742                                    .map_err(|e| {
5743                                        ::toac::DecodeError::Codec(::std::convert::Into::into(e))
5744                                    })?;
5745                                return ::std::result::Result::Ok(Self {
5746                                    headers: __headers,
5747                                    body: ResponseBody::Status502(__value),
5748                                });
5749                            }
5750                            503u16 => {
5751                                let __decoder = <::toac::body::codec::json::JsonDecoder as ::std::default::Default>::default();
5752                                let __value = ::toac::body::codec::decode_body(&__decoder, __body)
5753                                    .await
5754                                    .map_err(|e| {
5755                                        ::toac::DecodeError::Codec(::std::convert::Into::into(e))
5756                                    })?;
5757                                return ::std::result::Result::Ok(Self {
5758                                    headers: __headers,
5759                                    body: ResponseBody::Status503(__value),
5760                                });
5761                            }
5762                            _ => {}
5763                        }
5764                        ::std::mem::drop(__body);
5765                        return ::std::result::Result::Err(::toac::DecodeError::UnexpectedStatus(
5766                            __status,
5767                        ));
5768                    }
5769                }
5770            }
5771            impl ::toac::Operation for Request {
5772                type Response = Response;
5773            }
5774        }
5775    }
5776    pub mod chat {
5777        pub mod completions {
5778            pub mod post {
5779                #[derive(Debug, Clone, PartialEq)]
5780                /**
5781                # **Starting a new project?** We recommend trying [Responses](/docs/api-reference/responses)
5782                to take advantage of the latest OpenAI platform features. Compare
5783                [Chat Completions with Responses](/docs/guides/responses-vs-chat-completions?api-mode=responses).
5784
5785                ---
5786
5787                Creates a model response for the given chat conversation. Learn more in the
5788                [text generation](/docs/guides/text-generation), [vision](/docs/guides/vision),
5789                and [audio](/docs/guides/audio) guides.
5790
5791                Parameter support can differ depending on the model used to generate the
5792                response, particularly for newer reasoning models. Parameters that are only
5793                supported for reasoning models are noted below. For the current state of
5794                unsupported parameters in reasoning models,
5795                [refer to the reasoning guide](/docs/guides/reasoning).
5796
5797                Returns a chat completion object, or a streamed sequence of chat completion
5798                chunk objects if the request is streamed.
5799                */
5800                pub struct Request {
5801                    pub body: crate::wire::openai::components::CreateChatCompletionRequest,
5802                }
5803                impl Request {
5804                    /// `POST /chat/completions`
5805                    /// Operation ID: `createChatCompletion`.
5806                    pub const METHOD: ::http::Method = ::http::Method::POST;
5807                    /// URL path template, with `{name}` placeholders for path
5808                    /// parameters. Rendering into a concrete URL is the caller's
5809                    /// responsibility.
5810                    pub const PATH_TEMPLATE: &'static str = "/chat/completions";
5811                    /// Security requirement declared by the spec for this
5812                    /// operation. Outer slice encodes OR alternatives; inner
5813                    /// slice encodes AND requirements within one alternative.
5814                    /// Empty outer slice means "public, no auth required".
5815                    pub const SECURITY: &'static [&'static [&'static str]] = &[&["ApiKeyAuth"]];
5816                    /// Wraps this request with an `Accept` header override.
5817                    ///
5818                    /// The generated [`::toac::MakeRequest`] impl auto-emits an
5819                    /// `Accept` header listing every response media type
5820                    /// declared in the spec. Use this method to steer content
5821                    /// negotiation to one specific type (for example, asking
5822                    /// for `text/event-stream` to land on a streaming branch).
5823                    pub fn with_accept(
5824                        self,
5825                        accept: ::http::HeaderValue,
5826                    ) -> ::toac::WithAccept<Self> {
5827                        ::toac::WithAccept::new(self, accept)
5828                    }
5829                }
5830                impl ::toac::MakeRequest for Request {
5831                    type Error = ::serde_json::Error;
5832                    fn make_request(
5833                        self,
5834                    ) -> impl ::std::future::Future<
5835                        Output = ::std::result::Result<::toac::Request, Self::Error>,
5836                    > + Send {
5837                        async move {
5838                            let mut __path = ::std::string::String::new();
5839                            __path.push_str("/chat/completions");
5840                            let mut __builder = ::http::Request::builder()
5841                                .method(::http::Method::POST)
5842                                .uri(__path);
5843                            __builder = __builder.header(
5844                                ::http::header::ACCEPT,
5845                                ::http::HeaderValue::from_static(
5846                                    "application/json, text/event-stream",
5847                                ),
5848                            );
5849                            let mut __request = __builder
5850                                .body(::toac::body::Body::empty())
5851                                .expect("valid generated HTTP request");
5852                            __request
5853                                .extensions_mut()
5854                                .insert(::toac::OperationSecurity(&[&["ApiKeyAuth"]]));
5855                            {
5856                                let __payload = &self.body;
5857                                ::toac::body::codec::encode_body(
5858                                    &<::toac::body::codec::json::JsonEncoder as ::std::default::Default>::default(),
5859                                    __payload,
5860                                    __request,
5861                                )
5862                            }
5863                        }
5864                    }
5865                }
5866                pub enum ResponseBody {
5867                    ///OK
5868                    Status200Json(crate::wire::openai::components::CreateChatCompletionResponse),
5869                    ///OK
5870                    Status200Sse(::toac::body::codec::sse::SseEventStream),
5871                    ///Bad Request — 请求体格式或字段无效。
5872                    Status400(crate::wire::openai::components::OpenAiErrorResponse),
5873                    ///Unauthorized — API key 缺失 / 无效。
5874                    Status401(crate::wire::openai::components::OpenAiErrorResponse),
5875                    ///Forbidden — 资源访问被拒,可能是配额耗尽。
5876                    Status403(crate::wire::openai::components::OpenAiErrorResponse),
5877                    ///Not Found — 模型 id 不存在或被弃用。
5878                    Status404(crate::wire::openai::components::OpenAiErrorResponse),
5879                    ///Payload Too Large — 请求体超出上游限制。
5880                    Status413(crate::wire::openai::components::OpenAiErrorResponse),
5881                    ///Too Many Requests — 触发 RPM / TPM 限速。
5882                    Status429(crate::wire::openai::components::OpenAiErrorResponse),
5883                    ///Internal Server Error — 上游异常。
5884                    Status500(crate::wire::openai::components::OpenAiErrorResponse),
5885                    ///Bad Gateway — 上游网关异常。
5886                    Status502(crate::wire::openai::components::OpenAiErrorResponse),
5887                    ///Service Unavailable — 上游过载或维护中。
5888                    Status503(crate::wire::openai::components::OpenAiErrorResponse),
5889                }
5890                pub struct Response {
5891                    /// Response headers as received from the wire.
5892                    pub headers: ::http::HeaderMap,
5893                    /// Decoded body, dispatched by status (and Content-Type
5894                    /// when the spec declares multiple codecs per status).
5895                    pub body: ResponseBody,
5896                }
5897                impl ::toac::ParseResponse for Response {
5898                    type Error = ::toac::DecodeError;
5899                    fn parse_response<__B>(
5900                        response: ::http::Response<__B>,
5901                    ) -> impl ::std::future::Future<
5902                        Output = ::std::result::Result<Self, Self::Error>,
5903                    > + ::std::marker::Send
5904                    where
5905                        __B: ::http_body::Body<Data = ::bytes::Bytes>
5906                            + ::std::marker::Send
5907                            + ::std::marker::Sync
5908                            + 'static,
5909                        __B::Error: ::std::convert::Into<::toac::BoxError>,
5910                    {
5911                        async move {
5912                            let (__parts, __body) = response.into_parts();
5913                            let __status = __parts.status;
5914                            let __headers = __parts.headers;
5915                            let __content_type = __headers
5916                                .get(::http::header::CONTENT_TYPE)
5917                                .and_then(|v| v.to_str().ok())
5918                                .map(|s| {
5919                                    s.split(';').next().unwrap_or(s).trim().to_ascii_lowercase()
5920                                });
5921                            match __status.as_u16() {
5922                                200u16 => match __content_type.as_deref() {
5923                                    ::std::option::Option::Some(__ct)
5924                                        if __ct == "application/json" =>
5925                                    {
5926                                        let __decoder = <::toac::body::codec::json::JsonDecoder as ::std::default::Default>::default();
5927                                        let __value =
5928                                            ::toac::body::codec::decode_body(&__decoder, __body)
5929                                                .await
5930                                                .map_err(|e| {
5931                                                    ::toac::DecodeError::Codec(
5932                                                        ::std::convert::Into::into(e),
5933                                                    )
5934                                                })?;
5935                                        return ::std::result::Result::Ok(Self {
5936                                            headers: __headers,
5937                                            body: ResponseBody::Status200Json(__value),
5938                                        });
5939                                    }
5940                                    ::std::option::Option::Some(__ct)
5941                                        if __ct == "text/event-stream" =>
5942                                    {
5943                                        let __decoder = <::toac::body::codec::sse::SseDecoder as ::std::default::Default>::default();
5944                                        let __value =
5945                                            ::toac::body::codec::decode_body(&__decoder, __body)
5946                                                .await
5947                                                .map_err(|e| {
5948                                                    ::toac::DecodeError::Codec(
5949                                                        ::std::convert::Into::into(e),
5950                                                    )
5951                                                })?;
5952                                        return ::std::result::Result::Ok(Self {
5953                                            headers: __headers,
5954                                            body: ResponseBody::Status200Sse(__value),
5955                                        });
5956                                    }
5957                                    _ => {
5958                                        let __decoder = <::toac::body::codec::json::JsonDecoder as ::std::default::Default>::default();
5959                                        let __value =
5960                                            ::toac::body::codec::decode_body(&__decoder, __body)
5961                                                .await
5962                                                .map_err(|e| {
5963                                                    ::toac::DecodeError::Codec(
5964                                                        ::std::convert::Into::into(e),
5965                                                    )
5966                                                })?;
5967                                        return ::std::result::Result::Ok(Self {
5968                                            headers: __headers,
5969                                            body: ResponseBody::Status200Json(__value),
5970                                        });
5971                                    }
5972                                },
5973                                400u16 => {
5974                                    let __decoder = <::toac::body::codec::json::JsonDecoder as ::std::default::Default>::default();
5975                                    let __value =
5976                                        ::toac::body::codec::decode_body(&__decoder, __body)
5977                                            .await
5978                                            .map_err(|e| {
5979                                                ::toac::DecodeError::Codec(
5980                                                    ::std::convert::Into::into(e),
5981                                                )
5982                                            })?;
5983                                    return ::std::result::Result::Ok(Self {
5984                                        headers: __headers,
5985                                        body: ResponseBody::Status400(__value),
5986                                    });
5987                                }
5988                                401u16 => {
5989                                    let __decoder = <::toac::body::codec::json::JsonDecoder as ::std::default::Default>::default();
5990                                    let __value =
5991                                        ::toac::body::codec::decode_body(&__decoder, __body)
5992                                            .await
5993                                            .map_err(|e| {
5994                                                ::toac::DecodeError::Codec(
5995                                                    ::std::convert::Into::into(e),
5996                                                )
5997                                            })?;
5998                                    return ::std::result::Result::Ok(Self {
5999                                        headers: __headers,
6000                                        body: ResponseBody::Status401(__value),
6001                                    });
6002                                }
6003                                403u16 => {
6004                                    let __decoder = <::toac::body::codec::json::JsonDecoder as ::std::default::Default>::default();
6005                                    let __value =
6006                                        ::toac::body::codec::decode_body(&__decoder, __body)
6007                                            .await
6008                                            .map_err(|e| {
6009                                                ::toac::DecodeError::Codec(
6010                                                    ::std::convert::Into::into(e),
6011                                                )
6012                                            })?;
6013                                    return ::std::result::Result::Ok(Self {
6014                                        headers: __headers,
6015                                        body: ResponseBody::Status403(__value),
6016                                    });
6017                                }
6018                                404u16 => {
6019                                    let __decoder = <::toac::body::codec::json::JsonDecoder as ::std::default::Default>::default();
6020                                    let __value =
6021                                        ::toac::body::codec::decode_body(&__decoder, __body)
6022                                            .await
6023                                            .map_err(|e| {
6024                                                ::toac::DecodeError::Codec(
6025                                                    ::std::convert::Into::into(e),
6026                                                )
6027                                            })?;
6028                                    return ::std::result::Result::Ok(Self {
6029                                        headers: __headers,
6030                                        body: ResponseBody::Status404(__value),
6031                                    });
6032                                }
6033                                413u16 => {
6034                                    let __decoder = <::toac::body::codec::json::JsonDecoder as ::std::default::Default>::default();
6035                                    let __value =
6036                                        ::toac::body::codec::decode_body(&__decoder, __body)
6037                                            .await
6038                                            .map_err(|e| {
6039                                                ::toac::DecodeError::Codec(
6040                                                    ::std::convert::Into::into(e),
6041                                                )
6042                                            })?;
6043                                    return ::std::result::Result::Ok(Self {
6044                                        headers: __headers,
6045                                        body: ResponseBody::Status413(__value),
6046                                    });
6047                                }
6048                                429u16 => {
6049                                    let __decoder = <::toac::body::codec::json::JsonDecoder as ::std::default::Default>::default();
6050                                    let __value =
6051                                        ::toac::body::codec::decode_body(&__decoder, __body)
6052                                            .await
6053                                            .map_err(|e| {
6054                                                ::toac::DecodeError::Codec(
6055                                                    ::std::convert::Into::into(e),
6056                                                )
6057                                            })?;
6058                                    return ::std::result::Result::Ok(Self {
6059                                        headers: __headers,
6060                                        body: ResponseBody::Status429(__value),
6061                                    });
6062                                }
6063                                500u16 => {
6064                                    let __decoder = <::toac::body::codec::json::JsonDecoder as ::std::default::Default>::default();
6065                                    let __value =
6066                                        ::toac::body::codec::decode_body(&__decoder, __body)
6067                                            .await
6068                                            .map_err(|e| {
6069                                                ::toac::DecodeError::Codec(
6070                                                    ::std::convert::Into::into(e),
6071                                                )
6072                                            })?;
6073                                    return ::std::result::Result::Ok(Self {
6074                                        headers: __headers,
6075                                        body: ResponseBody::Status500(__value),
6076                                    });
6077                                }
6078                                502u16 => {
6079                                    let __decoder = <::toac::body::codec::json::JsonDecoder as ::std::default::Default>::default();
6080                                    let __value =
6081                                        ::toac::body::codec::decode_body(&__decoder, __body)
6082                                            .await
6083                                            .map_err(|e| {
6084                                                ::toac::DecodeError::Codec(
6085                                                    ::std::convert::Into::into(e),
6086                                                )
6087                                            })?;
6088                                    return ::std::result::Result::Ok(Self {
6089                                        headers: __headers,
6090                                        body: ResponseBody::Status502(__value),
6091                                    });
6092                                }
6093                                503u16 => {
6094                                    let __decoder = <::toac::body::codec::json::JsonDecoder as ::std::default::Default>::default();
6095                                    let __value =
6096                                        ::toac::body::codec::decode_body(&__decoder, __body)
6097                                            .await
6098                                            .map_err(|e| {
6099                                                ::toac::DecodeError::Codec(
6100                                                    ::std::convert::Into::into(e),
6101                                                )
6102                                            })?;
6103                                    return ::std::result::Result::Ok(Self {
6104                                        headers: __headers,
6105                                        body: ResponseBody::Status503(__value),
6106                                    });
6107                                }
6108                                _ => {}
6109                            }
6110                            ::std::mem::drop(__body);
6111                            return ::std::result::Result::Err(
6112                                ::toac::DecodeError::UnexpectedStatus(__status),
6113                            );
6114                        }
6115                    }
6116                }
6117                impl ::toac::Operation for Request {
6118                    type Response = Response;
6119                }
6120            }
6121        }
6122    }
6123}
6124pub mod servers {
6125    #![allow(deprecated)]
6126    #![allow(unreachable_patterns)]
6127    #![allow(non_camel_case_types)]
6128    #![allow(non_snake_case)]
6129    #![allow(clippy::all, clippy::pedantic)]
6130    /// `https://api.openai.com/v1`
6131    #[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
6132    pub struct ServerOption0;
6133    impl ::toac::Server for ServerOption0 {
6134        fn base_url(&self) -> ::std::borrow::Cow<'_, str> {
6135            ::std::borrow::Cow::Borrowed("https://api.openai.com/v1")
6136        }
6137    }
6138    pub type ApiServer = ServerOption0;
6139}
6140pub mod security {
6141    #![allow(deprecated)]
6142    #![allow(unreachable_patterns)]
6143    #![allow(non_camel_case_types)]
6144    #![allow(non_snake_case)]
6145    #![allow(clippy::all, clippy::pedantic)]
6146    /// HTTP Bearer credential. The token is sent as
6147    /// `Authorization: Bearer <token>`.
6148    #[derive(Debug, Clone)]
6149    pub struct AdminApiKeyAuthCredential {
6150        pub token: ::std::string::String,
6151    }
6152    impl AdminApiKeyAuthCredential {
6153        /// Builds a credential from a raw token value.
6154        pub fn new<T: ::std::convert::Into<::std::string::String>>(token: T) -> Self {
6155            Self {
6156                token: token.into(),
6157            }
6158        }
6159        fn as_runtime(&self) -> ::toac::security::BearerCredential {
6160            ::toac::security::BearerCredential {
6161                token: self.token.clone(),
6162            }
6163        }
6164    }
6165    impl ::toac::SecurityCredential for AdminApiKeyAuthCredential {
6166        fn apply(
6167            &self,
6168            req: ::toac::Request,
6169        ) -> impl ::std::future::Future<
6170            Output = ::std::result::Result<::toac::Request, ::toac::BoxError>,
6171        > + ::std::marker::Send {
6172            let __cred = self.as_runtime();
6173            async move { ::toac::SecurityCredential::apply(&__cred, req).await }
6174        }
6175    }
6176    /// HTTP Bearer credential. The token is sent as
6177    /// `Authorization: Bearer <token>`.
6178    #[derive(Debug, Clone)]
6179    pub struct ApiKeyAuthCredential {
6180        pub token: ::std::string::String,
6181    }
6182    impl ApiKeyAuthCredential {
6183        /// Builds a credential from a raw token value.
6184        pub fn new<T: ::std::convert::Into<::std::string::String>>(token: T) -> Self {
6185            Self {
6186                token: token.into(),
6187            }
6188        }
6189        fn as_runtime(&self) -> ::toac::security::BearerCredential {
6190            ::toac::security::BearerCredential {
6191                token: self.token.clone(),
6192            }
6193        }
6194    }
6195    impl ::toac::SecurityCredential for ApiKeyAuthCredential {
6196        fn apply(
6197            &self,
6198            req: ::toac::Request,
6199        ) -> impl ::std::future::Future<
6200            Output = ::std::result::Result<::toac::Request, ::toac::BoxError>,
6201        > + ::std::marker::Send {
6202            let __cred = self.as_runtime();
6203            async move { ::toac::SecurityCredential::apply(&__cred, req).await }
6204        }
6205    }
6206    /// Aggregate of every credential the spec's security schemes
6207    /// might need. Each field is optional — callers populate only
6208    /// the schemes they actually use. Build through
6209    /// [`AuthConfig::builder`].
6210    #[derive(Debug, Clone, Default)]
6211    pub struct AuthConfig {
6212        pub admin_api_key_auth: ::std::option::Option<AdminApiKeyAuthCredential>,
6213        pub api_key_auth: ::std::option::Option<ApiKeyAuthCredential>,
6214    }
6215    impl AuthConfig {
6216        /// Starts a fluent builder for [`AuthConfig`]. Each setter
6217        /// is named after the scheme's key in
6218        /// `components.securitySchemes`, normalised to snake_case.
6219        pub fn builder() -> AuthConfigBuilder {
6220            <AuthConfigBuilder as ::std::default::Default>::default()
6221        }
6222    }
6223    #[derive(Debug, Clone, Default)]
6224    pub struct AuthConfigBuilder {
6225        admin_api_key_auth: ::std::option::Option<AdminApiKeyAuthCredential>,
6226        api_key_auth: ::std::option::Option<ApiKeyAuthCredential>,
6227    }
6228    impl AuthConfigBuilder {
6229        /// Provides the Bearer token for this scheme.
6230        pub fn admin_api_key_auth<T>(mut self, token: T) -> Self
6231        where
6232            T: ::std::convert::Into<::std::string::String>,
6233        {
6234            self.admin_api_key_auth =
6235                ::std::option::Option::Some(AdminApiKeyAuthCredential::new(token));
6236            self
6237        }
6238        /// Provides the Bearer token for this scheme.
6239        pub fn api_key_auth<T>(mut self, token: T) -> Self
6240        where
6241            T: ::std::convert::Into<::std::string::String>,
6242        {
6243            self.api_key_auth = ::std::option::Option::Some(ApiKeyAuthCredential::new(token));
6244            self
6245        }
6246        /// Finalises into an [`AuthConfig`].
6247        pub fn build(self) -> AuthConfig {
6248            let Self {
6249                admin_api_key_auth,
6250                api_key_auth,
6251            } = self;
6252            AuthConfig {
6253                admin_api_key_auth,
6254                api_key_auth,
6255            }
6256        }
6257    }
6258    impl ::toac::AuthSelector for AuthConfig {
6259        fn apply_for(
6260            &self,
6261            req: ::toac::Request,
6262            requirements: &'static [&'static [&'static str]],
6263        ) -> ::toac::security::AuthFuture<'_> {
6264            ::std::boxed::Box::pin(async move {
6265                if requirements.is_empty() {
6266                    return ::std::result::Result::Ok(req);
6267                }
6268                let mut __chosen: ::std::option::Option<&'static [&'static str]> =
6269                    ::std::option::Option::None;
6270                for __alt in requirements {
6271                    let mut __can_satisfy = true;
6272                    let mut __matched_any = false;
6273                    for __scheme in __alt.iter().copied() {
6274                        if __scheme == "AdminApiKeyAuth" {
6275                            let ::std::option::Option::Some(_) = &self.admin_api_key_auth else {
6276                                __can_satisfy = false;
6277                                break;
6278                            };
6279                            __matched_any = true;
6280                            continue;
6281                        }
6282                        if __scheme == "ApiKeyAuth" {
6283                            let ::std::option::Option::Some(_) = &self.api_key_auth else {
6284                                __can_satisfy = false;
6285                                break;
6286                            };
6287                            __matched_any = true;
6288                            continue;
6289                        }
6290                        let _ = __matched_any;
6291                        __can_satisfy = false;
6292                        break;
6293                    }
6294                    if __can_satisfy && __matched_any {
6295                        __chosen = ::std::option::Option::Some(__alt);
6296                        break;
6297                    }
6298                }
6299                let ::std::option::Option::Some(__alt) = __chosen else {
6300                    return ::std::result::Result::Err(::std::convert::Into::into(::std::format!(
6301                        "no configured credentials satisfy {:?}",
6302                        requirements,
6303                    )));
6304                };
6305                let mut __req = req;
6306                for __scheme in __alt.iter().copied() {
6307                    if __scheme == "AdminApiKeyAuth" {
6308                        let ::std::option::Option::Some(__cred) = &self.admin_api_key_auth else {
6309                            continue;
6310                        };
6311                        __req = ::toac::SecurityCredential::apply(__cred, __req).await?;
6312                        continue;
6313                    }
6314                    if __scheme == "ApiKeyAuth" {
6315                        let ::std::option::Option::Some(__cred) = &self.api_key_auth else {
6316                            continue;
6317                        };
6318                        __req = ::toac::SecurityCredential::apply(__cred, __req).await?;
6319                        continue;
6320                    }
6321                }
6322                ::std::result::Result::Ok(__req)
6323            })
6324        }
6325    }
6326}