openai_openapi_types/
generated.rs

1#[derive(Clone, Debug, PartialEq)]
2#[serde_with::serde_as]
3#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
4pub struct AddUploadPartRequest {
5    #[doc = "The chunk of bytes for this Part.\n"]
6    #[serde_as(as = "serde_with::base64::Base64")]
7    #[serde(rename = "data")]
8    pub data: Vec<u8>,
9}
10#[allow(clippy::module_inception)]
11pub mod admin_api_key {
12    #[doc = "The object type, which is always `organization.admin_api_key`"]
13    #[derive(Clone, Copy, Debug, Default, PartialEq)]
14    pub(crate) struct Object;
15    impl_serde!(Object, "organization.admin_api_key");
16    #[allow(clippy::module_inception)]
17    pub mod owner {
18        #[doc = "Always `user`"]
19        #[derive(Clone, Copy, Debug, Default, PartialEq)]
20        pub struct Type;
21        impl_serde!(Type, "user");
22        #[doc = "The object type, which is always organization.user"]
23        #[derive(Clone, Copy, Debug, Default, PartialEq)]
24        pub struct Object;
25        impl_serde!(Object, "organization.user");
26        #[doc = "Always `owner`"]
27        #[derive(Clone, Copy, Debug, Default, PartialEq)]
28        pub struct Role;
29        impl_serde!(Role, "owner");
30    }
31    #[derive(Clone, Debug, Default, PartialEq)]
32    #[serde_with::serde_as]
33    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
34    pub struct Owner {
35        #[doc = "Always `user`"]
36        #[serde(rename = "type")]
37        #[serde(skip_serializing_if = "Option::is_none")]
38        #[builder(default)]
39        pub r#type: Option<crate::__types::admin_api_key::owner::Type>,
40        #[doc = "The object type, which is always organization.user"]
41        #[serde(rename = "object")]
42        #[serde(skip_serializing_if = "Option::is_none")]
43        #[builder(default)]
44        pub object: Option<crate::__types::admin_api_key::owner::Object>,
45        #[doc = "The identifier, which can be referenced in API endpoints"]
46        #[serde(rename = "id")]
47        #[serde(skip_serializing_if = "Option::is_none")]
48        #[builder(default)]
49        pub id: Option<String>,
50        #[doc = "The name of the user"]
51        #[serde(rename = "name")]
52        #[serde(skip_serializing_if = "Option::is_none")]
53        #[builder(default)]
54        pub name: Option<String>,
55        #[doc = "The Unix timestamp (in seconds) of when the user was created"]
56        #[serde(rename = "created_at")]
57        #[serde(skip_serializing_if = "Option::is_none")]
58        #[builder(default)]
59        pub created_at: Option<i64>,
60        #[doc = "Always `owner`"]
61        #[serde(rename = "role")]
62        #[serde(skip_serializing_if = "Option::is_none")]
63        #[builder(default)]
64        pub role: Option<crate::__types::admin_api_key::owner::Role>,
65    }
66}
67#[doc = "Represents an individual Admin API key in an org."]
68#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
69pub struct AdminApiKey {
70    #[doc = "The identifier, which can be referenced in API endpoints"]
71    pub id: String,
72    #[doc = "The name of the API key"]
73    pub name: String,
74    #[doc = "The redacted value of the API key"]
75    pub redacted_value: String,
76    #[doc = "The value of the API key. Only shown on create."]
77    #[builder(default)]
78    pub value: Option<String>,
79    #[doc = "The Unix timestamp (in seconds) of when the API key was created"]
80    pub created_at: i64,
81    #[doc = "The Unix timestamp (in seconds) of when the API key was last used"]
82    #[builder(default)]
83    pub last_used_at: Option<i64>,
84    #[builder(default)]
85    pub owner: crate::__types::admin_api_key::Owner,
86}
87impl<'de> serde::Deserialize<'de> for AdminApiKey {
88    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
89    where
90        D: serde::Deserializer<'de>,
91    {
92        #[serde_with::serde_as]
93        #[derive(serde :: Deserialize)]
94        struct AdminApiKey {
95            #[serde(rename = "object")]
96            #[allow(dead_code)]
97            object: crate::__types::admin_api_key::Object,
98            #[serde(rename = "id")]
99            id: String,
100            #[serde(rename = "name")]
101            name: String,
102            #[serde(rename = "redacted_value")]
103            redacted_value: String,
104            #[serde(rename = "value")]
105            value: Option<String>,
106            #[serde(rename = "created_at")]
107            created_at: i64,
108            #[serde(rename = "last_used_at")]
109            last_used_at: Option<i64>,
110            #[serde(rename = "owner")]
111            owner: crate::__types::admin_api_key::Owner,
112        }
113        let AdminApiKey {
114            id,
115            name,
116            redacted_value,
117            value,
118            created_at,
119            last_used_at,
120            owner,
121            ..
122        } = AdminApiKey::deserialize(deserializer)?;
123        Ok(Self {
124            id,
125            name,
126            redacted_value,
127            value,
128            created_at,
129            last_used_at,
130            owner,
131        })
132    }
133}
134impl serde::Serialize for AdminApiKey {
135    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
136    where
137        S: serde::Serializer,
138    {
139        #[serde_with::serde_as]
140        #[derive(serde :: Serialize)]
141        struct AdminApiKey<'a> {
142            #[serde(rename = "object")]
143            object: &'a crate::__types::admin_api_key::Object,
144            #[serde(rename = "id")]
145            id: &'a String,
146            #[serde(rename = "name")]
147            name: &'a String,
148            #[serde(rename = "redacted_value")]
149            redacted_value: &'a String,
150            #[serde(rename = "value")]
151            #[serde(skip_serializing_if = "Option::is_none")]
152            value: &'a Option<String>,
153            #[serde(rename = "created_at")]
154            created_at: &'a i64,
155            #[serde(rename = "last_used_at")]
156            #[serde(skip_serializing_if = "Option::is_none")]
157            last_used_at: &'a Option<i64>,
158            #[serde(rename = "owner")]
159            owner: &'a crate::__types::admin_api_key::Owner,
160        }
161        let Self {
162            id,
163            name,
164            redacted_value,
165            value,
166            created_at,
167            last_used_at,
168            owner,
169        } = self;
170        AdminApiKey {
171            object: &Default::default(),
172            id,
173            name,
174            redacted_value,
175            value,
176            created_at,
177            last_used_at,
178            owner,
179        }
180        .serialize(serializer)
181    }
182}
183#[derive(Clone, Debug, Default, PartialEq)]
184#[serde_with::serde_as]
185#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
186pub struct ApiKeyList {
187    #[serde(rename = "object")]
188    #[serde(skip_serializing_if = "Option::is_none")]
189    #[builder(default)]
190    pub object: Option<String>,
191    #[serde(rename = "data")]
192    #[serde(skip_serializing_if = "Option::is_none")]
193    #[builder(default)]
194    pub data: Option<Vec<crate::__types::AdminApiKey>>,
195    #[serde(rename = "has_more")]
196    #[serde(skip_serializing_if = "Option::is_none")]
197    #[builder(default)]
198    pub has_more: Option<bool>,
199    #[serde(rename = "first_id")]
200    #[serde(skip_serializing_if = "Option::is_none")]
201    #[builder(default)]
202    pub first_id: Option<String>,
203    #[serde(rename = "last_id")]
204    #[serde(skip_serializing_if = "Option::is_none")]
205    #[builder(default)]
206    pub last_id: Option<String>,
207}
208#[allow(clippy::module_inception)]
209pub mod assistant_object {
210    #[doc = "The object type, which is always `assistant`."]
211    #[derive(Clone, Copy, Debug, Default, PartialEq)]
212    pub(crate) struct Object;
213    impl_serde!(Object, "assistant");
214    #[allow(clippy::module_inception)]
215    pub mod tool_resources {
216        #[derive(Clone, Debug, Default, PartialEq)]
217        #[serde_with::serde_as]
218        #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
219        pub struct CodeInterpreter {
220            #[doc = "A list of [file](https://platform.openai.com/docs/api-reference/files) IDs made available to the `code_interpreter`` tool. There can be a maximum of 20 files associated with the tool.\n"]
221            #[serde(rename = "file_ids")]
222            #[serde(skip_serializing_if = "Option::is_none")]
223            #[builder(default)]
224            pub file_ids: Option<Vec<String>>,
225        }
226        #[derive(Clone, Debug, Default, PartialEq)]
227        #[serde_with::serde_as]
228        #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
229        pub struct FileSearch {
230            #[doc = "The ID of the [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object) attached to this assistant. There can be a maximum of 1 vector store attached to the assistant.\n"]
231            #[serde(rename = "vector_store_ids")]
232            #[serde(skip_serializing_if = "Option::is_none")]
233            #[builder(default)]
234            pub vector_store_ids: Option<Vec<String>>,
235        }
236    }
237    #[doc = "A set of resources that are used by the assistant's tools. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.\n"]
238    #[derive(Clone, Debug, Default, PartialEq)]
239    #[serde_with::serde_as]
240    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
241    pub struct ToolResources {
242        #[serde(rename = "code_interpreter")]
243        #[serde(skip_serializing_if = "Option::is_none")]
244        #[builder(default)]
245        pub code_interpreter:
246            Option<crate::__types::assistant_object::tool_resources::CodeInterpreter>,
247        #[serde(rename = "file_search")]
248        #[serde(skip_serializing_if = "Option::is_none")]
249        #[builder(default)]
250        pub file_search: Option<crate::__types::assistant_object::tool_resources::FileSearch>,
251    }
252}
253#[doc = "Represents an `assistant` that can call the model and use tools."]
254#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
255pub struct AssistantObject {
256    #[doc = "The identifier, which can be referenced in API endpoints."]
257    pub id: String,
258    #[doc = "The Unix timestamp (in seconds) for when the assistant was created."]
259    pub created_at: i64,
260    #[doc = "The name of the assistant. The maximum length is 256 characters.\n"]
261    #[builder(default)]
262    pub name: Option<String>,
263    #[doc = "The description of the assistant. The maximum length is 512 characters.\n"]
264    #[builder(default)]
265    pub description: Option<String>,
266    #[doc = "ID of the model to use. You can use the [List models](https://platform.openai.com/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](https://platform.openai.com/docs/models) for descriptions of them.\n"]
267    pub model: String,
268    #[doc = "The system instructions that the assistant uses. The maximum length is 256,000 characters.\n"]
269    #[builder(default)]
270    pub instructions: Option<String>,
271    #[doc = "A list of tool enabled on the assistant. There can be a maximum of 128 tools per assistant. Tools can be of types `code_interpreter`, `file_search`, or `function`.\n"]
272    pub tools: Vec<crate::__types::AssistantTool>,
273    #[doc = "A set of resources that are used by the assistant's tools. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.\n"]
274    #[builder(default)]
275    pub tool_resources: Option<crate::__types::assistant_object::ToolResources>,
276    #[builder(default)]
277    pub metadata: Option<crate::__types::Metadata>,
278    #[doc = "What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.\n"]
279    #[builder(default)]
280    pub temperature: Option<serde_json::Number>,
281    #[doc = "An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.\n\nWe generally recommend altering this or temperature but not both.\n"]
282    #[builder(default)]
283    pub top_p: Option<serde_json::Number>,
284    #[builder(default)]
285    pub response_format: Option<crate::__types::AssistantsApiResponseFormatOption>,
286}
287impl<'de> serde::Deserialize<'de> for AssistantObject {
288    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
289    where
290        D: serde::Deserializer<'de>,
291    {
292        #[serde_with::serde_as]
293        #[derive(serde :: Deserialize)]
294        struct AssistantObject {
295            #[serde(rename = "id")]
296            id: String,
297            #[serde(rename = "object")]
298            #[allow(dead_code)]
299            object: crate::__types::assistant_object::Object,
300            #[serde(rename = "created_at")]
301            created_at: i64,
302            #[serde(rename = "name")]
303            name: Option<String>,
304            #[serde(rename = "description")]
305            description: Option<String>,
306            #[serde(rename = "model")]
307            model: String,
308            #[serde(rename = "instructions")]
309            instructions: Option<String>,
310            #[serde(rename = "tools")]
311            tools: Vec<crate::__types::AssistantTool>,
312            #[serde(rename = "tool_resources")]
313            tool_resources: Option<crate::__types::assistant_object::ToolResources>,
314            #[serde(rename = "metadata")]
315            metadata: Option<crate::__types::Metadata>,
316            #[serde(rename = "temperature")]
317            temperature: Option<serde_json::Number>,
318            #[serde(rename = "top_p")]
319            top_p: Option<serde_json::Number>,
320            #[serde(rename = "response_format")]
321            response_format: Option<crate::__types::AssistantsApiResponseFormatOption>,
322        }
323        let AssistantObject {
324            id,
325            created_at,
326            name,
327            description,
328            model,
329            instructions,
330            tools,
331            tool_resources,
332            metadata,
333            temperature,
334            top_p,
335            response_format,
336            ..
337        } = AssistantObject::deserialize(deserializer)?;
338        Ok(Self {
339            id,
340            created_at,
341            name,
342            description,
343            model,
344            instructions,
345            tools,
346            tool_resources,
347            metadata,
348            temperature,
349            top_p,
350            response_format,
351        })
352    }
353}
354impl serde::Serialize for AssistantObject {
355    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
356    where
357        S: serde::Serializer,
358    {
359        #[serde_with::serde_as]
360        #[derive(serde :: Serialize)]
361        struct AssistantObject<'a> {
362            #[serde(rename = "id")]
363            id: &'a String,
364            #[serde(rename = "object")]
365            object: &'a crate::__types::assistant_object::Object,
366            #[serde(rename = "created_at")]
367            created_at: &'a i64,
368            #[serde(rename = "name")]
369            #[serde(skip_serializing_if = "Option::is_none")]
370            name: &'a Option<String>,
371            #[serde(rename = "description")]
372            #[serde(skip_serializing_if = "Option::is_none")]
373            description: &'a Option<String>,
374            #[serde(rename = "model")]
375            model: &'a String,
376            #[serde(rename = "instructions")]
377            #[serde(skip_serializing_if = "Option::is_none")]
378            instructions: &'a Option<String>,
379            #[serde(rename = "tools")]
380            tools: &'a Vec<crate::__types::AssistantTool>,
381            #[serde(rename = "tool_resources")]
382            #[serde(skip_serializing_if = "Option::is_none")]
383            tool_resources: &'a Option<crate::__types::assistant_object::ToolResources>,
384            #[serde(rename = "metadata")]
385            #[serde(skip_serializing_if = "Option::is_none")]
386            metadata: &'a Option<crate::__types::Metadata>,
387            #[serde(rename = "temperature")]
388            #[serde(skip_serializing_if = "Option::is_none")]
389            temperature: &'a Option<serde_json::Number>,
390            #[serde(rename = "top_p")]
391            #[serde(skip_serializing_if = "Option::is_none")]
392            top_p: &'a Option<serde_json::Number>,
393            #[serde(rename = "response_format")]
394            #[serde(skip_serializing_if = "Option::is_none")]
395            response_format: &'a Option<crate::__types::AssistantsApiResponseFormatOption>,
396        }
397        let Self {
398            id,
399            created_at,
400            name,
401            description,
402            model,
403            instructions,
404            tools,
405            tool_resources,
406            metadata,
407            temperature,
408            top_p,
409            response_format,
410        } = self;
411        AssistantObject {
412            id,
413            object: &Default::default(),
414            created_at,
415            name,
416            description,
417            model,
418            instructions,
419            tools,
420            tool_resources,
421            metadata,
422            temperature,
423            top_p,
424            response_format,
425        }
426        .serialize(serializer)
427    }
428}
429#[doc = "Represents an event emitted when streaming a Run.\n\nEach event in a server-sent events stream has an `event` and `data` property:\n\n```text\nevent: thread.created\ndata: {\"id\": \"thread_123\", \"object\": \"thread\", ...}\n```\n\nWe emit events whenever a new object is created, transitions to a new state, or is being\nstreamed in parts (deltas). For example, we emit `thread.run.created` when a new run\nis created, `thread.run.completed` when a run completes, and so on. When an Assistant chooses\nto create a message during a run, we emit a `thread.message.created event`, a\n`thread.message.in_progress` event, many `thread.message.delta` events, and finally a\n`thread.message.completed` event.\n\nWe may add additional events over time, so we recommend handling unknown events gracefully\nin your code. See the [Assistants API quickstart](https://platform.openai.com/docs/assistants/overview) to learn how to\nintegrate the Assistants API with streaming.\n"]
430#[derive(Clone, Debug, PartialEq)]
431#[serde_with::serde_as]
432#[derive(serde :: Deserialize, serde :: Serialize)]
433#[serde(untagged)]
434#[allow(clippy::large_enum_variant)]
435pub enum AssistantStreamEvent {
436    ThreadStreamEvent(crate::__types::ThreadStreamEvent),
437    RunStreamEvent(crate::__types::RunStreamEvent),
438    RunStepStreamEvent(crate::__types::RunStepStreamEvent),
439    MessageStreamEvent(crate::__types::MessageStreamEvent),
440    ErrorEvent(crate::__types::ErrorEvent),
441}
442#[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
443pub enum AssistantSupportedModels {
444    #[doc = "`gpt-5`"]
445    #[serde(rename = "gpt-5")]
446    Gpt5,
447    #[doc = "`gpt-5-mini`"]
448    #[serde(rename = "gpt-5-mini")]
449    Gpt5Mini,
450    #[doc = "`gpt-5-nano`"]
451    #[serde(rename = "gpt-5-nano")]
452    Gpt5Nano,
453    #[doc = "`gpt-5-2025-08-07`"]
454    #[serde(rename = "gpt-5-2025-08-07")]
455    Gpt5_2025_08_07,
456    #[doc = "`gpt-5-mini-2025-08-07`"]
457    #[serde(rename = "gpt-5-mini-2025-08-07")]
458    Gpt5Mini2025_08_07,
459    #[doc = "`gpt-5-nano-2025-08-07`"]
460    #[serde(rename = "gpt-5-nano-2025-08-07")]
461    Gpt5Nano2025_08_07,
462    #[doc = "`gpt-4.1`"]
463    #[serde(rename = "gpt-4.1")]
464    Gpt4_1,
465    #[doc = "`gpt-4.1-mini`"]
466    #[serde(rename = "gpt-4.1-mini")]
467    Gpt4_1Mini,
468    #[doc = "`gpt-4.1-nano`"]
469    #[serde(rename = "gpt-4.1-nano")]
470    Gpt4_1Nano,
471    #[doc = "`gpt-4.1-2025-04-14`"]
472    #[serde(rename = "gpt-4.1-2025-04-14")]
473    Gpt4_1_2025_04_14,
474    #[doc = "`gpt-4.1-mini-2025-04-14`"]
475    #[serde(rename = "gpt-4.1-mini-2025-04-14")]
476    Gpt4_1Mini2025_04_14,
477    #[doc = "`gpt-4.1-nano-2025-04-14`"]
478    #[serde(rename = "gpt-4.1-nano-2025-04-14")]
479    Gpt4_1Nano2025_04_14,
480    #[doc = "`o3-mini`"]
481    #[serde(rename = "o3-mini")]
482    O3Mini,
483    #[doc = "`o3-mini-2025-01-31`"]
484    #[serde(rename = "o3-mini-2025-01-31")]
485    O3Mini2025_01_31,
486    #[doc = "`o1`"]
487    #[serde(rename = "o1")]
488    O1,
489    #[doc = "`o1-2024-12-17`"]
490    #[serde(rename = "o1-2024-12-17")]
491    O1_2024_12_17,
492    #[doc = "`gpt-4o`"]
493    #[serde(rename = "gpt-4o")]
494    Gpt4o,
495    #[doc = "`gpt-4o-2024-11-20`"]
496    #[serde(rename = "gpt-4o-2024-11-20")]
497    Gpt4o2024_11_20,
498    #[doc = "`gpt-4o-2024-08-06`"]
499    #[serde(rename = "gpt-4o-2024-08-06")]
500    Gpt4o2024_08_06,
501    #[doc = "`gpt-4o-2024-05-13`"]
502    #[serde(rename = "gpt-4o-2024-05-13")]
503    Gpt4o2024_05_13,
504    #[doc = "`gpt-4o-mini`"]
505    #[serde(rename = "gpt-4o-mini")]
506    Gpt4oMini,
507    #[doc = "`gpt-4o-mini-2024-07-18`"]
508    #[serde(rename = "gpt-4o-mini-2024-07-18")]
509    Gpt4oMini2024_07_18,
510    #[doc = "`gpt-4.5-preview`"]
511    #[serde(rename = "gpt-4.5-preview")]
512    Gpt4_5Preview,
513    #[doc = "`gpt-4.5-preview-2025-02-27`"]
514    #[serde(rename = "gpt-4.5-preview-2025-02-27")]
515    Gpt4_5Preview2025_02_27,
516    #[doc = "`gpt-4-turbo`"]
517    #[serde(rename = "gpt-4-turbo")]
518    Gpt4Turbo,
519    #[doc = "`gpt-4-turbo-2024-04-09`"]
520    #[serde(rename = "gpt-4-turbo-2024-04-09")]
521    Gpt4Turbo2024_04_09,
522    #[doc = "`gpt-4-0125-preview`"]
523    #[serde(rename = "gpt-4-0125-preview")]
524    Gpt4_0125Preview,
525    #[doc = "`gpt-4-turbo-preview`"]
526    #[serde(rename = "gpt-4-turbo-preview")]
527    Gpt4TurboPreview,
528    #[doc = "`gpt-4-1106-preview`"]
529    #[serde(rename = "gpt-4-1106-preview")]
530    Gpt4_1106Preview,
531    #[doc = "`gpt-4-vision-preview`"]
532    #[serde(rename = "gpt-4-vision-preview")]
533    Gpt4VisionPreview,
534    #[doc = "`gpt-4`"]
535    #[serde(rename = "gpt-4")]
536    Gpt4,
537    #[doc = "`gpt-4-0314`"]
538    #[serde(rename = "gpt-4-0314")]
539    Gpt4_0314,
540    #[doc = "`gpt-4-0613`"]
541    #[serde(rename = "gpt-4-0613")]
542    Gpt4_0613,
543    #[doc = "`gpt-4-32k`"]
544    #[serde(rename = "gpt-4-32k")]
545    Gpt4_32k,
546    #[doc = "`gpt-4-32k-0314`"]
547    #[serde(rename = "gpt-4-32k-0314")]
548    Gpt4_32k0314,
549    #[doc = "`gpt-4-32k-0613`"]
550    #[serde(rename = "gpt-4-32k-0613")]
551    Gpt4_32k0613,
552    #[doc = "`gpt-3.5-turbo`"]
553    #[serde(rename = "gpt-3.5-turbo")]
554    Gpt3_5Turbo,
555    #[doc = "`gpt-3.5-turbo-16k`"]
556    #[serde(rename = "gpt-3.5-turbo-16k")]
557    Gpt3_5Turbo16k,
558    #[doc = "`gpt-3.5-turbo-0613`"]
559    #[serde(rename = "gpt-3.5-turbo-0613")]
560    Gpt3_5Turbo0613,
561    #[doc = "`gpt-3.5-turbo-1106`"]
562    #[serde(rename = "gpt-3.5-turbo-1106")]
563    Gpt3_5Turbo1106,
564    #[doc = "`gpt-3.5-turbo-0125`"]
565    #[serde(rename = "gpt-3.5-turbo-0125")]
566    Gpt3_5Turbo0125,
567    #[doc = "`gpt-3.5-turbo-16k-0613`"]
568    #[serde(rename = "gpt-3.5-turbo-16k-0613")]
569    Gpt3_5Turbo16k0613,
570}
571#[allow(clippy::module_inception)]
572pub(crate) mod assistant_tools_code {
573    #[doc = "The type of tool being defined: `code_interpreter`"]
574    #[derive(Clone, Copy, Debug, Default, PartialEq)]
575    pub(crate) struct Type;
576    impl_serde!(Type, "code_interpreter");
577}
578#[derive(Clone, Copy, Debug, Default, PartialEq, typed_builder :: TypedBuilder)]
579pub struct AssistantToolsCode {}
580impl<'de> serde::Deserialize<'de> for AssistantToolsCode {
581    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
582    where
583        D: serde::Deserializer<'de>,
584    {
585        #[serde_with::serde_as]
586        #[derive(serde :: Deserialize)]
587        struct AssistantToolsCode {
588            #[serde(rename = "type")]
589            #[allow(dead_code)]
590            r#type: crate::__types::assistant_tools_code::Type,
591        }
592        let AssistantToolsCode { .. } = AssistantToolsCode::deserialize(deserializer)?;
593        Ok(Self {})
594    }
595}
596impl serde::Serialize for AssistantToolsCode {
597    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
598    where
599        S: serde::Serializer,
600    {
601        #[serde_with::serde_as]
602        #[derive(serde :: Serialize)]
603        struct AssistantToolsCode<'a> {
604            #[serde(rename = "type")]
605            r#type: &'a crate::__types::assistant_tools_code::Type,
606        }
607        let Self {} = self;
608        AssistantToolsCode {
609            r#type: &Default::default(),
610        }
611        .serialize(serializer)
612    }
613}
614#[allow(clippy::module_inception)]
615pub mod assistant_tools_file_search {
616    #[doc = "The type of tool being defined: `file_search`"]
617    #[derive(Clone, Copy, Debug, Default, PartialEq)]
618    pub(crate) struct Type;
619    impl_serde!(Type, "file_search");
620    #[doc = "Overrides for the file search tool."]
621    #[derive(Clone, Debug, Default, PartialEq)]
622    #[serde_with::serde_as]
623    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
624    pub struct FileSearch {
625        #[doc = "The maximum number of results the file search tool should output. The default is 20 for `gpt-4*` models and 5 for `gpt-3.5-turbo`. This number should be between 1 and 50 inclusive.\n\nNote that the file search tool may output fewer than `max_num_results` results. See the [file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search#customizing-file-search-settings) for more information.\n"]
626        #[serde(rename = "max_num_results")]
627        #[serde(skip_serializing_if = "Option::is_none")]
628        #[builder(default)]
629        pub max_num_results: Option<i64>,
630        #[serde(rename = "ranking_options")]
631        #[serde(skip_serializing_if = "Option::is_none")]
632        #[builder(default)]
633        pub ranking_options: Option<crate::__types::FileSearchRankingOptions>,
634    }
635}
636#[derive(Clone, Debug, Default, PartialEq, typed_builder :: TypedBuilder)]
637pub struct AssistantToolsFileSearch {
638    #[doc = "Overrides for the file search tool."]
639    #[builder(default)]
640    pub file_search: Option<crate::__types::assistant_tools_file_search::FileSearch>,
641}
642impl<'de> serde::Deserialize<'de> for AssistantToolsFileSearch {
643    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
644    where
645        D: serde::Deserializer<'de>,
646    {
647        #[serde_with::serde_as]
648        #[derive(serde :: Deserialize)]
649        struct AssistantToolsFileSearch {
650            #[serde(rename = "type")]
651            #[allow(dead_code)]
652            r#type: crate::__types::assistant_tools_file_search::Type,
653            #[serde(rename = "file_search")]
654            file_search: Option<crate::__types::assistant_tools_file_search::FileSearch>,
655        }
656        let AssistantToolsFileSearch { file_search, .. } =
657            AssistantToolsFileSearch::deserialize(deserializer)?;
658        Ok(Self { file_search })
659    }
660}
661impl serde::Serialize for AssistantToolsFileSearch {
662    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
663    where
664        S: serde::Serializer,
665    {
666        #[serde_with::serde_as]
667        #[derive(serde :: Serialize)]
668        struct AssistantToolsFileSearch<'a> {
669            #[serde(rename = "type")]
670            r#type: &'a crate::__types::assistant_tools_file_search::Type,
671            #[serde(rename = "file_search")]
672            #[serde(skip_serializing_if = "Option::is_none")]
673            file_search: &'a Option<crate::__types::assistant_tools_file_search::FileSearch>,
674        }
675        let Self { file_search } = self;
676        AssistantToolsFileSearch {
677            r#type: &Default::default(),
678            file_search,
679        }
680        .serialize(serializer)
681    }
682}
683#[allow(clippy::module_inception)]
684pub(crate) mod assistant_tools_file_search_type_only {
685    #[doc = "The type of tool being defined: `file_search`"]
686    #[derive(Clone, Copy, Debug, Default, PartialEq)]
687    pub(crate) struct Type;
688    impl_serde!(Type, "file_search");
689}
690#[derive(Clone, Copy, Debug, Default, PartialEq, typed_builder :: TypedBuilder)]
691pub struct AssistantToolsFileSearchTypeOnly {}
692impl<'de> serde::Deserialize<'de> for AssistantToolsFileSearchTypeOnly {
693    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
694    where
695        D: serde::Deserializer<'de>,
696    {
697        #[serde_with::serde_as]
698        #[derive(serde :: Deserialize)]
699        struct AssistantToolsFileSearchTypeOnly {
700            #[serde(rename = "type")]
701            #[allow(dead_code)]
702            r#type: crate::__types::assistant_tools_file_search_type_only::Type,
703        }
704        let AssistantToolsFileSearchTypeOnly { .. } =
705            AssistantToolsFileSearchTypeOnly::deserialize(deserializer)?;
706        Ok(Self {})
707    }
708}
709impl serde::Serialize for AssistantToolsFileSearchTypeOnly {
710    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
711    where
712        S: serde::Serializer,
713    {
714        #[serde_with::serde_as]
715        #[derive(serde :: Serialize)]
716        struct AssistantToolsFileSearchTypeOnly<'a> {
717            #[serde(rename = "type")]
718            r#type: &'a crate::__types::assistant_tools_file_search_type_only::Type,
719        }
720        let Self {} = self;
721        AssistantToolsFileSearchTypeOnly {
722            r#type: &Default::default(),
723        }
724        .serialize(serializer)
725    }
726}
727#[allow(clippy::module_inception)]
728pub(crate) mod assistant_tools_function {
729    #[doc = "The type of tool being defined: `function`"]
730    #[derive(Clone, Copy, Debug, Default, PartialEq)]
731    pub(crate) struct Type;
732    impl_serde!(Type, "function");
733}
734#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
735pub struct AssistantToolsFunction {
736    pub function: crate::__types::FunctionObject,
737}
738impl<'de> serde::Deserialize<'de> for AssistantToolsFunction {
739    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
740    where
741        D: serde::Deserializer<'de>,
742    {
743        #[serde_with::serde_as]
744        #[derive(serde :: Deserialize)]
745        struct AssistantToolsFunction {
746            #[serde(rename = "type")]
747            #[allow(dead_code)]
748            r#type: crate::__types::assistant_tools_function::Type,
749            #[serde(rename = "function")]
750            function: crate::__types::FunctionObject,
751        }
752        let AssistantToolsFunction { function, .. } =
753            AssistantToolsFunction::deserialize(deserializer)?;
754        Ok(Self { function })
755    }
756}
757impl serde::Serialize for AssistantToolsFunction {
758    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
759    where
760        S: serde::Serializer,
761    {
762        #[serde_with::serde_as]
763        #[derive(serde :: Serialize)]
764        struct AssistantToolsFunction<'a> {
765            #[serde(rename = "type")]
766            r#type: &'a crate::__types::assistant_tools_function::Type,
767            #[serde(rename = "function")]
768            function: &'a crate::__types::FunctionObject,
769        }
770        let Self { function } = self;
771        AssistantToolsFunction {
772            r#type: &Default::default(),
773            function,
774        }
775        .serialize(serializer)
776    }
777}
778#[allow(clippy::module_inception)]
779pub(crate) mod assistants_api_response_format_option {
780    #[doc = "`auto` is the default value\n"]
781    #[derive(Clone, Copy, Debug, Default, PartialEq)]
782    pub(crate) struct Auto;
783    impl_serde!(Auto, "auto");
784}
785#[doc = "Specifies the format that the model must output. Compatible with [GPT-4o](https://platform.openai.com/docs/models#gpt-4o), [GPT-4 Turbo](https://platform.openai.com/docs/models#gpt-4-turbo-and-gpt-4), and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`.\n\nSetting to `{ \"type\": \"json_schema\", \"json_schema\": {...} }` enables Structured Outputs which ensures the model will match your supplied JSON schema. Learn more in the [Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs).\n\nSetting to `{ \"type\": \"json_object\" }` enables JSON mode, which ensures the message the model generates is valid JSON.\n\n**Important:** when using JSON mode, you **must** also instruct the model to produce JSON yourself via a system or user message. Without this, the model may generate an unending stream of whitespace until the generation reaches the token limit, resulting in a long-running and seemingly \"stuck\" request. Also note that the message content may be partially cut off if `finish_reason=\"length\"`, which indicates the generation exceeded `max_tokens` or the conversation exceeded the max context length.\n"]
786#[derive(Clone, Debug, PartialEq)]
787#[allow(clippy::large_enum_variant)]
788pub enum AssistantsApiResponseFormatOption {
789    #[doc = "auto"]
790    Auto,
791    Text(crate::__types::ResponseFormatText),
792    JsonObject(crate::__types::ResponseFormatJsonObject),
793    JsonSchema(crate::__types::ResponseFormatJsonSchema),
794}
795impl<'de> serde::Deserialize<'de> for AssistantsApiResponseFormatOption {
796    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
797    where
798        D: serde::Deserializer<'de>,
799    {
800        #[serde_with::serde_as]
801        #[derive(serde :: Deserialize)]
802        #[serde(untagged)]
803        #[allow(clippy::enum_variant_names, clippy::large_enum_variant)]
804        enum AssistantsApiResponseFormatOption {
805            Auto(crate::__types::assistants_api_response_format_option::Auto),
806            Text(crate::__types::ResponseFormatText),
807            JsonObject(crate::__types::ResponseFormatJsonObject),
808            JsonSchema(crate::__types::ResponseFormatJsonSchema),
809        }
810        Ok(
811            match AssistantsApiResponseFormatOption::deserialize(deserializer)? {
812                AssistantsApiResponseFormatOption::Auto(_) => Self::Auto,
813                AssistantsApiResponseFormatOption::Text(v) => Self::Text(v),
814                AssistantsApiResponseFormatOption::JsonObject(v) => Self::JsonObject(v),
815                AssistantsApiResponseFormatOption::JsonSchema(v) => Self::JsonSchema(v),
816            },
817        )
818    }
819}
820impl serde::Serialize for AssistantsApiResponseFormatOption {
821    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
822    where
823        S: serde::Serializer,
824    {
825        #[serde_with::serde_as]
826        #[derive(serde :: Serialize)]
827        #[serde(untagged)]
828        #[allow(clippy::enum_variant_names)]
829        enum AssistantsApiResponseFormatOption<'a> {
830            Auto(crate::__types::assistants_api_response_format_option::Auto),
831            Text(&'a crate::__types::ResponseFormatText),
832            JsonObject(&'a crate::__types::ResponseFormatJsonObject),
833            JsonSchema(&'a crate::__types::ResponseFormatJsonSchema),
834        }
835        match self {
836            Self::Auto => AssistantsApiResponseFormatOption::Auto(Default::default()),
837            Self::Text(v) => AssistantsApiResponseFormatOption::Text(v),
838            Self::JsonObject(v) => AssistantsApiResponseFormatOption::JsonObject(v),
839            Self::JsonSchema(v) => AssistantsApiResponseFormatOption::JsonSchema(v),
840        }
841        .serialize(serializer)
842    }
843}
844#[allow(clippy::module_inception)]
845pub(crate) mod assistants_api_tool_choice_option {
846    #[doc = "none"]
847    #[derive(Clone, Copy, Debug, Default, PartialEq)]
848    pub(crate) struct None;
849    impl_serde!(None, "none");
850    #[doc = "auto"]
851    #[derive(Clone, Copy, Debug, Default, PartialEq)]
852    pub(crate) struct Auto;
853    impl_serde!(Auto, "auto");
854    #[doc = "required"]
855    #[derive(Clone, Copy, Debug, Default, PartialEq)]
856    pub(crate) struct Required;
857    impl_serde!(Required, "required");
858}
859#[doc = "Controls which (if any) tool is called by the model.\n`none` means the model will not call any tools and instead generates a message.\n`auto` is the default value and means the model can pick between generating a message or calling one or more tools.\n`required` means the model must call one or more tools before responding to the user.\nSpecifying a particular tool like `{\"type\": \"file_search\"}` or `{\"type\": \"function\", \"function\": {\"name\": \"my_function\"}}` forces the model to call that tool.\n"]
860#[derive(Clone, Debug, PartialEq)]
861#[allow(clippy::large_enum_variant)]
862pub enum AssistantsApiToolChoiceOption {
863    #[doc = "none"]
864    None,
865    #[doc = "auto"]
866    Auto,
867    #[doc = "required"]
868    Required,
869    AssistantsNamedToolChoice(crate::__types::AssistantsNamedToolChoice),
870}
871impl<'de> serde::Deserialize<'de> for AssistantsApiToolChoiceOption {
872    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
873    where
874        D: serde::Deserializer<'de>,
875    {
876        #[serde_with::serde_as]
877        #[derive(serde :: Deserialize)]
878        #[serde(untagged)]
879        #[allow(clippy::enum_variant_names, clippy::large_enum_variant)]
880        enum AssistantsApiToolChoiceOption {
881            None(crate::__types::assistants_api_tool_choice_option::None),
882            Auto(crate::__types::assistants_api_tool_choice_option::Auto),
883            Required(crate::__types::assistants_api_tool_choice_option::Required),
884            AssistantsNamedToolChoice(crate::__types::AssistantsNamedToolChoice),
885        }
886        Ok(
887            match AssistantsApiToolChoiceOption::deserialize(deserializer)? {
888                AssistantsApiToolChoiceOption::None(_) => Self::None,
889                AssistantsApiToolChoiceOption::Auto(_) => Self::Auto,
890                AssistantsApiToolChoiceOption::Required(_) => Self::Required,
891                AssistantsApiToolChoiceOption::AssistantsNamedToolChoice(v) => {
892                    Self::AssistantsNamedToolChoice(v)
893                }
894            },
895        )
896    }
897}
898impl serde::Serialize for AssistantsApiToolChoiceOption {
899    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
900    where
901        S: serde::Serializer,
902    {
903        #[serde_with::serde_as]
904        #[derive(serde :: Serialize)]
905        #[serde(untagged)]
906        #[allow(clippy::enum_variant_names)]
907        enum AssistantsApiToolChoiceOption<'a> {
908            None(crate::__types::assistants_api_tool_choice_option::None),
909            Auto(crate::__types::assistants_api_tool_choice_option::Auto),
910            Required(crate::__types::assistants_api_tool_choice_option::Required),
911            AssistantsNamedToolChoice(&'a crate::__types::AssistantsNamedToolChoice),
912        }
913        match self {
914            Self::None => AssistantsApiToolChoiceOption::None(Default::default()),
915            Self::Auto => AssistantsApiToolChoiceOption::Auto(Default::default()),
916            Self::Required => AssistantsApiToolChoiceOption::Required(Default::default()),
917            Self::AssistantsNamedToolChoice(v) => {
918                AssistantsApiToolChoiceOption::AssistantsNamedToolChoice(v)
919            }
920        }
921        .serialize(serializer)
922    }
923}
924#[allow(clippy::module_inception)]
925pub mod assistants_named_tool_choice {
926    #[doc = "The type of the tool. If type is `function`, the function name must be set"]
927    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
928    pub enum Type {
929        #[doc = "`function`"]
930        #[serde(rename = "function")]
931        Function,
932        #[doc = "`code_interpreter`"]
933        #[serde(rename = "code_interpreter")]
934        CodeInterpreter,
935        #[doc = "`file_search`"]
936        #[serde(rename = "file_search")]
937        FileSearch,
938    }
939    #[derive(Clone, Debug, PartialEq)]
940    #[serde_with::serde_as]
941    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
942    pub struct Function {
943        #[doc = "The name of the function to call."]
944        #[serde(rename = "name")]
945        pub name: String,
946    }
947}
948#[doc = "Specifies a tool the model should use. Use to force the model to call a specific tool."]
949#[derive(Clone, Debug, PartialEq)]
950#[serde_with::serde_as]
951#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
952pub struct AssistantsNamedToolChoice {
953    #[doc = "The type of the tool. If type is `function`, the function name must be set"]
954    #[serde(rename = "type")]
955    pub r#type: crate::__types::assistants_named_tool_choice::Type,
956    #[serde(rename = "function")]
957    #[serde(skip_serializing_if = "Option::is_none")]
958    #[builder(default)]
959    pub function: Option<crate::__types::assistants_named_tool_choice::Function>,
960}
961#[doc = "The format of the output, in one of these options: `json`, `text`, `srt`, `verbose_json`, or `vtt`. For `gpt-4o-transcribe` and `gpt-4o-mini-transcribe`, the only supported format is `json`.\n"]
962#[derive(Clone, Copy, Debug, Default, PartialEq, serde :: Deserialize, serde :: Serialize)]
963pub enum AudioResponseFormat {
964    #[doc = "`json`"]
965    #[default]
966    #[serde(rename = "json")]
967    Json,
968    #[doc = "`text`"]
969    #[serde(rename = "text")]
970    Text,
971    #[doc = "`srt`"]
972    #[serde(rename = "srt")]
973    Srt,
974    #[doc = "`verbose_json`"]
975    #[serde(rename = "verbose_json")]
976    VerboseJson,
977    #[doc = "`vtt`"]
978    #[serde(rename = "vtt")]
979    Vtt,
980}
981#[allow(clippy::module_inception)]
982pub mod audit_log {
983    #[doc = "The project that the action was scoped to. Absent for actions not scoped to projects. Note that any admin actions taken via Admin API keys are associated with the default project."]
984    #[derive(Clone, Debug, Default, PartialEq)]
985    #[serde_with::serde_as]
986    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
987    pub struct Project {
988        #[doc = "The project ID."]
989        #[serde(rename = "id")]
990        #[serde(skip_serializing_if = "Option::is_none")]
991        #[builder(default)]
992        pub id: Option<String>,
993        #[doc = "The project title."]
994        #[serde(rename = "name")]
995        #[serde(skip_serializing_if = "Option::is_none")]
996        #[builder(default)]
997        pub name: Option<String>,
998    }
999    #[allow(clippy::module_inception)]
1000    pub mod api_key_created {
1001        #[doc = "The payload used to create the API key."]
1002        #[derive(Clone, Debug, Default, PartialEq)]
1003        #[serde_with::serde_as]
1004        #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
1005        pub struct Data {
1006            #[doc = "A list of scopes allowed for the API key, e.g. `[\"api.model.request\"]`"]
1007            #[serde(rename = "scopes")]
1008            #[serde(skip_serializing_if = "Option::is_none")]
1009            #[builder(default)]
1010            pub scopes: Option<Vec<String>>,
1011        }
1012    }
1013    #[doc = "The details for events with this `type`."]
1014    #[derive(Clone, Debug, Default, PartialEq)]
1015    #[serde_with::serde_as]
1016    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
1017    pub struct ApiKeyCreated {
1018        #[doc = "The tracking ID of the API key."]
1019        #[serde(rename = "id")]
1020        #[serde(skip_serializing_if = "Option::is_none")]
1021        #[builder(default)]
1022        pub id: Option<String>,
1023        #[doc = "The payload used to create the API key."]
1024        #[serde(rename = "data")]
1025        #[serde(skip_serializing_if = "Option::is_none")]
1026        #[builder(default)]
1027        pub data: Option<crate::__types::audit_log::api_key_created::Data>,
1028    }
1029    #[allow(clippy::module_inception)]
1030    pub mod api_key_updated {
1031        #[doc = "The payload used to update the API key."]
1032        #[derive(Clone, Debug, Default, PartialEq)]
1033        #[serde_with::serde_as]
1034        #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
1035        pub struct ChangesRequested {
1036            #[doc = "A list of scopes allowed for the API key, e.g. `[\"api.model.request\"]`"]
1037            #[serde(rename = "scopes")]
1038            #[serde(skip_serializing_if = "Option::is_none")]
1039            #[builder(default)]
1040            pub scopes: Option<Vec<String>>,
1041        }
1042    }
1043    #[doc = "The details for events with this `type`."]
1044    #[derive(Clone, Debug, Default, PartialEq)]
1045    #[serde_with::serde_as]
1046    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
1047    pub struct ApiKeyUpdated {
1048        #[doc = "The tracking ID of the API key."]
1049        #[serde(rename = "id")]
1050        #[serde(skip_serializing_if = "Option::is_none")]
1051        #[builder(default)]
1052        pub id: Option<String>,
1053        #[doc = "The payload used to update the API key."]
1054        #[serde(rename = "changes_requested")]
1055        #[serde(skip_serializing_if = "Option::is_none")]
1056        #[builder(default)]
1057        pub changes_requested: Option<crate::__types::audit_log::api_key_updated::ChangesRequested>,
1058    }
1059    #[doc = "The details for events with this `type`."]
1060    #[derive(Clone, Debug, Default, PartialEq)]
1061    #[serde_with::serde_as]
1062    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
1063    pub struct ApiKeyDeleted {
1064        #[doc = "The tracking ID of the API key."]
1065        #[serde(rename = "id")]
1066        #[serde(skip_serializing_if = "Option::is_none")]
1067        #[builder(default)]
1068        pub id: Option<String>,
1069    }
1070    #[allow(clippy::module_inception)]
1071    pub mod checkpoint_permission_created {
1072        #[doc = "The payload used to create the checkpoint permission."]
1073        #[derive(Clone, Debug, Default, PartialEq)]
1074        #[serde_with::serde_as]
1075        #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
1076        pub struct Data {
1077            #[doc = "The ID of the project that the checkpoint permission was created for."]
1078            #[serde(rename = "project_id")]
1079            #[serde(skip_serializing_if = "Option::is_none")]
1080            #[builder(default)]
1081            pub project_id: Option<String>,
1082            #[doc = "The ID of the fine-tuned model checkpoint."]
1083            #[serde(rename = "fine_tuned_model_checkpoint")]
1084            #[serde(skip_serializing_if = "Option::is_none")]
1085            #[builder(default)]
1086            pub fine_tuned_model_checkpoint: Option<String>,
1087        }
1088    }
1089    #[doc = "The project and fine-tuned model checkpoint that the checkpoint permission was created for."]
1090    #[derive(Clone, Debug, Default, PartialEq)]
1091    #[serde_with::serde_as]
1092    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
1093    pub struct CheckpointPermissionCreated {
1094        #[doc = "The ID of the checkpoint permission."]
1095        #[serde(rename = "id")]
1096        #[serde(skip_serializing_if = "Option::is_none")]
1097        #[builder(default)]
1098        pub id: Option<String>,
1099        #[doc = "The payload used to create the checkpoint permission."]
1100        #[serde(rename = "data")]
1101        #[serde(skip_serializing_if = "Option::is_none")]
1102        #[builder(default)]
1103        pub data: Option<crate::__types::audit_log::checkpoint_permission_created::Data>,
1104    }
1105    #[doc = "The details for events with this `type`."]
1106    #[derive(Clone, Debug, Default, PartialEq)]
1107    #[serde_with::serde_as]
1108    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
1109    pub struct CheckpointPermissionDeleted {
1110        #[doc = "The ID of the checkpoint permission."]
1111        #[serde(rename = "id")]
1112        #[serde(skip_serializing_if = "Option::is_none")]
1113        #[builder(default)]
1114        pub id: Option<String>,
1115    }
1116    #[allow(clippy::module_inception)]
1117    pub mod invite_sent {
1118        #[doc = "The payload used to create the invite."]
1119        #[derive(Clone, Debug, Default, PartialEq)]
1120        #[serde_with::serde_as]
1121        #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
1122        pub struct Data {
1123            #[doc = "The email invited to the organization."]
1124            #[serde(rename = "email")]
1125            #[serde(skip_serializing_if = "Option::is_none")]
1126            #[builder(default)]
1127            pub email: Option<String>,
1128            #[doc = "The role the email was invited to be. Is either `owner` or `member`."]
1129            #[serde(rename = "role")]
1130            #[serde(skip_serializing_if = "Option::is_none")]
1131            #[builder(default)]
1132            pub role: Option<String>,
1133        }
1134    }
1135    #[doc = "The details for events with this `type`."]
1136    #[derive(Clone, Debug, Default, PartialEq)]
1137    #[serde_with::serde_as]
1138    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
1139    pub struct InviteSent {
1140        #[doc = "The ID of the invite."]
1141        #[serde(rename = "id")]
1142        #[serde(skip_serializing_if = "Option::is_none")]
1143        #[builder(default)]
1144        pub id: Option<String>,
1145        #[doc = "The payload used to create the invite."]
1146        #[serde(rename = "data")]
1147        #[serde(skip_serializing_if = "Option::is_none")]
1148        #[builder(default)]
1149        pub data: Option<crate::__types::audit_log::invite_sent::Data>,
1150    }
1151    #[doc = "The details for events with this `type`."]
1152    #[derive(Clone, Debug, Default, PartialEq)]
1153    #[serde_with::serde_as]
1154    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
1155    pub struct InviteAccepted {
1156        #[doc = "The ID of the invite."]
1157        #[serde(rename = "id")]
1158        #[serde(skip_serializing_if = "Option::is_none")]
1159        #[builder(default)]
1160        pub id: Option<String>,
1161    }
1162    #[doc = "The details for events with this `type`."]
1163    #[derive(Clone, Debug, Default, PartialEq)]
1164    #[serde_with::serde_as]
1165    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
1166    pub struct InviteDeleted {
1167        #[doc = "The ID of the invite."]
1168        #[serde(rename = "id")]
1169        #[serde(skip_serializing_if = "Option::is_none")]
1170        #[builder(default)]
1171        pub id: Option<String>,
1172    }
1173    #[doc = "The details for events with this `type`."]
1174    #[derive(Clone, Debug, Default, PartialEq)]
1175    #[serde_with::serde_as]
1176    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
1177    pub struct LoginFailed {
1178        #[doc = "The error code of the failure."]
1179        #[serde(rename = "error_code")]
1180        #[serde(skip_serializing_if = "Option::is_none")]
1181        #[builder(default)]
1182        pub error_code: Option<String>,
1183        #[doc = "The error message of the failure."]
1184        #[serde(rename = "error_message")]
1185        #[serde(skip_serializing_if = "Option::is_none")]
1186        #[builder(default)]
1187        pub error_message: Option<String>,
1188    }
1189    #[doc = "The details for events with this `type`."]
1190    #[derive(Clone, Debug, Default, PartialEq)]
1191    #[serde_with::serde_as]
1192    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
1193    pub struct LogoutFailed {
1194        #[doc = "The error code of the failure."]
1195        #[serde(rename = "error_code")]
1196        #[serde(skip_serializing_if = "Option::is_none")]
1197        #[builder(default)]
1198        pub error_code: Option<String>,
1199        #[doc = "The error message of the failure."]
1200        #[serde(rename = "error_message")]
1201        #[serde(skip_serializing_if = "Option::is_none")]
1202        #[builder(default)]
1203        pub error_message: Option<String>,
1204    }
1205    #[allow(clippy::module_inception)]
1206    pub mod organization_updated {
1207        #[doc = "The payload used to update the organization settings."]
1208        #[derive(Clone, Debug, Default, PartialEq)]
1209        #[serde_with::serde_as]
1210        #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
1211        pub struct ChangesRequested {
1212            #[doc = "The organization title."]
1213            #[serde(rename = "title")]
1214            #[serde(skip_serializing_if = "Option::is_none")]
1215            #[builder(default)]
1216            pub title: Option<String>,
1217            #[doc = "The organization description."]
1218            #[serde(rename = "description")]
1219            #[serde(skip_serializing_if = "Option::is_none")]
1220            #[builder(default)]
1221            pub description: Option<String>,
1222            #[doc = "The organization name."]
1223            #[serde(rename = "name")]
1224            #[serde(skip_serializing_if = "Option::is_none")]
1225            #[builder(default)]
1226            pub name: Option<String>,
1227            #[doc = "Visibility of the threads page which shows messages created with the Assistants API and Playground. One of `ANY_ROLE`, `OWNERS`, or `NONE`."]
1228            #[serde(rename = "threads_ui_visibility")]
1229            #[serde(skip_serializing_if = "Option::is_none")]
1230            #[builder(default)]
1231            pub threads_ui_visibility: Option<String>,
1232            #[doc = "Visibility of the usage dashboard which shows activity and costs for your organization. One of `ANY_ROLE` or `OWNERS`."]
1233            #[serde(rename = "usage_dashboard_visibility")]
1234            #[serde(skip_serializing_if = "Option::is_none")]
1235            #[builder(default)]
1236            pub usage_dashboard_visibility: Option<String>,
1237            #[doc = "How your organization logs data from supported API calls. One of `disabled`, `enabled_per_call`, `enabled_for_all_projects`, or `enabled_for_selected_projects`"]
1238            #[serde(rename = "api_call_logging")]
1239            #[serde(skip_serializing_if = "Option::is_none")]
1240            #[builder(default)]
1241            pub api_call_logging: Option<String>,
1242            #[doc = "The list of project ids if api_call_logging is set to `enabled_for_selected_projects`"]
1243            #[serde(rename = "api_call_logging_project_ids")]
1244            #[serde(skip_serializing_if = "Option::is_none")]
1245            #[builder(default)]
1246            pub api_call_logging_project_ids: Option<String>,
1247        }
1248    }
1249    #[doc = "The details for events with this `type`."]
1250    #[derive(Clone, Debug, Default, PartialEq)]
1251    #[serde_with::serde_as]
1252    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
1253    pub struct OrganizationUpdated {
1254        #[doc = "The organization ID."]
1255        #[serde(rename = "id")]
1256        #[serde(skip_serializing_if = "Option::is_none")]
1257        #[builder(default)]
1258        pub id: Option<String>,
1259        #[doc = "The payload used to update the organization settings."]
1260        #[serde(rename = "changes_requested")]
1261        #[serde(skip_serializing_if = "Option::is_none")]
1262        #[builder(default)]
1263        pub changes_requested:
1264            Option<crate::__types::audit_log::organization_updated::ChangesRequested>,
1265    }
1266    #[allow(clippy::module_inception)]
1267    pub mod project_created {
1268        #[doc = "The payload used to create the project."]
1269        #[derive(Clone, Debug, Default, PartialEq)]
1270        #[serde_with::serde_as]
1271        #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
1272        pub struct Data {
1273            #[doc = "The project name."]
1274            #[serde(rename = "name")]
1275            #[serde(skip_serializing_if = "Option::is_none")]
1276            #[builder(default)]
1277            pub name: Option<String>,
1278            #[doc = "The title of the project as seen on the dashboard."]
1279            #[serde(rename = "title")]
1280            #[serde(skip_serializing_if = "Option::is_none")]
1281            #[builder(default)]
1282            pub title: Option<String>,
1283        }
1284    }
1285    #[doc = "The details for events with this `type`."]
1286    #[derive(Clone, Debug, Default, PartialEq)]
1287    #[serde_with::serde_as]
1288    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
1289    pub struct ProjectCreated {
1290        #[doc = "The project ID."]
1291        #[serde(rename = "id")]
1292        #[serde(skip_serializing_if = "Option::is_none")]
1293        #[builder(default)]
1294        pub id: Option<String>,
1295        #[doc = "The payload used to create the project."]
1296        #[serde(rename = "data")]
1297        #[serde(skip_serializing_if = "Option::is_none")]
1298        #[builder(default)]
1299        pub data: Option<crate::__types::audit_log::project_created::Data>,
1300    }
1301    #[allow(clippy::module_inception)]
1302    pub mod project_updated {
1303        #[doc = "The payload used to update the project."]
1304        #[derive(Clone, Debug, Default, PartialEq)]
1305        #[serde_with::serde_as]
1306        #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
1307        pub struct ChangesRequested {
1308            #[doc = "The title of the project as seen on the dashboard."]
1309            #[serde(rename = "title")]
1310            #[serde(skip_serializing_if = "Option::is_none")]
1311            #[builder(default)]
1312            pub title: Option<String>,
1313        }
1314    }
1315    #[doc = "The details for events with this `type`."]
1316    #[derive(Clone, Debug, Default, PartialEq)]
1317    #[serde_with::serde_as]
1318    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
1319    pub struct ProjectUpdated {
1320        #[doc = "The project ID."]
1321        #[serde(rename = "id")]
1322        #[serde(skip_serializing_if = "Option::is_none")]
1323        #[builder(default)]
1324        pub id: Option<String>,
1325        #[doc = "The payload used to update the project."]
1326        #[serde(rename = "changes_requested")]
1327        #[serde(skip_serializing_if = "Option::is_none")]
1328        #[builder(default)]
1329        pub changes_requested: Option<crate::__types::audit_log::project_updated::ChangesRequested>,
1330    }
1331    #[doc = "The details for events with this `type`."]
1332    #[derive(Clone, Debug, Default, PartialEq)]
1333    #[serde_with::serde_as]
1334    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
1335    pub struct ProjectArchived {
1336        #[doc = "The project ID."]
1337        #[serde(rename = "id")]
1338        #[serde(skip_serializing_if = "Option::is_none")]
1339        #[builder(default)]
1340        pub id: Option<String>,
1341    }
1342    #[allow(clippy::module_inception)]
1343    pub mod rate_limit_updated {
1344        #[doc = "The payload used to update the rate limits."]
1345        #[derive(Clone, Copy, Debug, Default, PartialEq)]
1346        #[serde_with::serde_as]
1347        #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
1348        pub struct ChangesRequested {
1349            #[doc = "The maximum requests per minute."]
1350            #[serde(rename = "max_requests_per_1_minute")]
1351            #[serde(skip_serializing_if = "Option::is_none")]
1352            #[builder(default)]
1353            pub max_requests_per_1_minute: Option<i64>,
1354            #[doc = "The maximum tokens per minute."]
1355            #[serde(rename = "max_tokens_per_1_minute")]
1356            #[serde(skip_serializing_if = "Option::is_none")]
1357            #[builder(default)]
1358            pub max_tokens_per_1_minute: Option<i64>,
1359            #[doc = "The maximum images per minute. Only relevant for certain models."]
1360            #[serde(rename = "max_images_per_1_minute")]
1361            #[serde(skip_serializing_if = "Option::is_none")]
1362            #[builder(default)]
1363            pub max_images_per_1_minute: Option<i64>,
1364            #[doc = "The maximum audio megabytes per minute. Only relevant for certain models."]
1365            #[serde(rename = "max_audio_megabytes_per_1_minute")]
1366            #[serde(skip_serializing_if = "Option::is_none")]
1367            #[builder(default)]
1368            pub max_audio_megabytes_per_1_minute: Option<i64>,
1369            #[doc = "The maximum requests per day. Only relevant for certain models."]
1370            #[serde(rename = "max_requests_per_1_day")]
1371            #[serde(skip_serializing_if = "Option::is_none")]
1372            #[builder(default)]
1373            pub max_requests_per_1_day: Option<i64>,
1374            #[doc = "The maximum batch input tokens per day. Only relevant for certain models."]
1375            #[serde(rename = "batch_1_day_max_input_tokens")]
1376            #[serde(skip_serializing_if = "Option::is_none")]
1377            #[builder(default)]
1378            pub batch_1_day_max_input_tokens: Option<i64>,
1379        }
1380    }
1381    #[doc = "The details for events with this `type`."]
1382    #[derive(Clone, Debug, Default, PartialEq)]
1383    #[serde_with::serde_as]
1384    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
1385    pub struct RateLimitUpdated {
1386        #[doc = "The rate limit ID"]
1387        #[serde(rename = "id")]
1388        #[serde(skip_serializing_if = "Option::is_none")]
1389        #[builder(default)]
1390        pub id: Option<String>,
1391        #[doc = "The payload used to update the rate limits."]
1392        #[serde(rename = "changes_requested")]
1393        #[serde(skip_serializing_if = "Option::is_none")]
1394        #[builder(default)]
1395        pub changes_requested:
1396            Option<crate::__types::audit_log::rate_limit_updated::ChangesRequested>,
1397    }
1398    #[doc = "The details for events with this `type`."]
1399    #[derive(Clone, Debug, Default, PartialEq)]
1400    #[serde_with::serde_as]
1401    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
1402    pub struct RateLimitDeleted {
1403        #[doc = "The rate limit ID"]
1404        #[serde(rename = "id")]
1405        #[serde(skip_serializing_if = "Option::is_none")]
1406        #[builder(default)]
1407        pub id: Option<String>,
1408    }
1409    #[allow(clippy::module_inception)]
1410    pub mod service_account_created {
1411        #[doc = "The payload used to create the service account."]
1412        #[derive(Clone, Debug, Default, PartialEq)]
1413        #[serde_with::serde_as]
1414        #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
1415        pub struct Data {
1416            #[doc = "The role of the service account. Is either `owner` or `member`."]
1417            #[serde(rename = "role")]
1418            #[serde(skip_serializing_if = "Option::is_none")]
1419            #[builder(default)]
1420            pub role: Option<String>,
1421        }
1422    }
1423    #[doc = "The details for events with this `type`."]
1424    #[derive(Clone, Debug, Default, PartialEq)]
1425    #[serde_with::serde_as]
1426    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
1427    pub struct ServiceAccountCreated {
1428        #[doc = "The service account ID."]
1429        #[serde(rename = "id")]
1430        #[serde(skip_serializing_if = "Option::is_none")]
1431        #[builder(default)]
1432        pub id: Option<String>,
1433        #[doc = "The payload used to create the service account."]
1434        #[serde(rename = "data")]
1435        #[serde(skip_serializing_if = "Option::is_none")]
1436        #[builder(default)]
1437        pub data: Option<crate::__types::audit_log::service_account_created::Data>,
1438    }
1439    #[allow(clippy::module_inception)]
1440    pub mod service_account_updated {
1441        #[doc = "The payload used to updated the service account."]
1442        #[derive(Clone, Debug, Default, PartialEq)]
1443        #[serde_with::serde_as]
1444        #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
1445        pub struct ChangesRequested {
1446            #[doc = "The role of the service account. Is either `owner` or `member`."]
1447            #[serde(rename = "role")]
1448            #[serde(skip_serializing_if = "Option::is_none")]
1449            #[builder(default)]
1450            pub role: Option<String>,
1451        }
1452    }
1453    #[doc = "The details for events with this `type`."]
1454    #[derive(Clone, Debug, Default, PartialEq)]
1455    #[serde_with::serde_as]
1456    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
1457    pub struct ServiceAccountUpdated {
1458        #[doc = "The service account ID."]
1459        #[serde(rename = "id")]
1460        #[serde(skip_serializing_if = "Option::is_none")]
1461        #[builder(default)]
1462        pub id: Option<String>,
1463        #[doc = "The payload used to updated the service account."]
1464        #[serde(rename = "changes_requested")]
1465        #[serde(skip_serializing_if = "Option::is_none")]
1466        #[builder(default)]
1467        pub changes_requested:
1468            Option<crate::__types::audit_log::service_account_updated::ChangesRequested>,
1469    }
1470    #[doc = "The details for events with this `type`."]
1471    #[derive(Clone, Debug, Default, PartialEq)]
1472    #[serde_with::serde_as]
1473    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
1474    pub struct ServiceAccountDeleted {
1475        #[doc = "The service account ID."]
1476        #[serde(rename = "id")]
1477        #[serde(skip_serializing_if = "Option::is_none")]
1478        #[builder(default)]
1479        pub id: Option<String>,
1480    }
1481    #[allow(clippy::module_inception)]
1482    pub mod user_added {
1483        #[doc = "The payload used to add the user to the project."]
1484        #[derive(Clone, Debug, Default, PartialEq)]
1485        #[serde_with::serde_as]
1486        #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
1487        pub struct Data {
1488            #[doc = "The role of the user. Is either `owner` or `member`."]
1489            #[serde(rename = "role")]
1490            #[serde(skip_serializing_if = "Option::is_none")]
1491            #[builder(default)]
1492            pub role: Option<String>,
1493        }
1494    }
1495    #[doc = "The details for events with this `type`."]
1496    #[derive(Clone, Debug, Default, PartialEq)]
1497    #[serde_with::serde_as]
1498    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
1499    pub struct UserAdded {
1500        #[doc = "The user ID."]
1501        #[serde(rename = "id")]
1502        #[serde(skip_serializing_if = "Option::is_none")]
1503        #[builder(default)]
1504        pub id: Option<String>,
1505        #[doc = "The payload used to add the user to the project."]
1506        #[serde(rename = "data")]
1507        #[serde(skip_serializing_if = "Option::is_none")]
1508        #[builder(default)]
1509        pub data: Option<crate::__types::audit_log::user_added::Data>,
1510    }
1511    #[allow(clippy::module_inception)]
1512    pub mod user_updated {
1513        #[doc = "The payload used to update the user."]
1514        #[derive(Clone, Debug, Default, PartialEq)]
1515        #[serde_with::serde_as]
1516        #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
1517        pub struct ChangesRequested {
1518            #[doc = "The role of the user. Is either `owner` or `member`."]
1519            #[serde(rename = "role")]
1520            #[serde(skip_serializing_if = "Option::is_none")]
1521            #[builder(default)]
1522            pub role: Option<String>,
1523        }
1524    }
1525    #[doc = "The details for events with this `type`."]
1526    #[derive(Clone, Debug, Default, PartialEq)]
1527    #[serde_with::serde_as]
1528    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
1529    pub struct UserUpdated {
1530        #[doc = "The project ID."]
1531        #[serde(rename = "id")]
1532        #[serde(skip_serializing_if = "Option::is_none")]
1533        #[builder(default)]
1534        pub id: Option<String>,
1535        #[doc = "The payload used to update the user."]
1536        #[serde(rename = "changes_requested")]
1537        #[serde(skip_serializing_if = "Option::is_none")]
1538        #[builder(default)]
1539        pub changes_requested: Option<crate::__types::audit_log::user_updated::ChangesRequested>,
1540    }
1541    #[doc = "The details for events with this `type`."]
1542    #[derive(Clone, Debug, Default, PartialEq)]
1543    #[serde_with::serde_as]
1544    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
1545    pub struct UserDeleted {
1546        #[doc = "The user ID."]
1547        #[serde(rename = "id")]
1548        #[serde(skip_serializing_if = "Option::is_none")]
1549        #[builder(default)]
1550        pub id: Option<String>,
1551    }
1552    #[doc = "The details for events with this `type`."]
1553    #[derive(Clone, Debug, Default, PartialEq)]
1554    #[serde_with::serde_as]
1555    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
1556    pub struct CertificateCreated {
1557        #[doc = "The certificate ID."]
1558        #[serde(rename = "id")]
1559        #[serde(skip_serializing_if = "Option::is_none")]
1560        #[builder(default)]
1561        pub id: Option<String>,
1562        #[doc = "The name of the certificate."]
1563        #[serde(rename = "name")]
1564        #[serde(skip_serializing_if = "Option::is_none")]
1565        #[builder(default)]
1566        pub name: Option<String>,
1567    }
1568    #[doc = "The details for events with this `type`."]
1569    #[derive(Clone, Debug, Default, PartialEq)]
1570    #[serde_with::serde_as]
1571    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
1572    pub struct CertificateUpdated {
1573        #[doc = "The certificate ID."]
1574        #[serde(rename = "id")]
1575        #[serde(skip_serializing_if = "Option::is_none")]
1576        #[builder(default)]
1577        pub id: Option<String>,
1578        #[doc = "The name of the certificate."]
1579        #[serde(rename = "name")]
1580        #[serde(skip_serializing_if = "Option::is_none")]
1581        #[builder(default)]
1582        pub name: Option<String>,
1583    }
1584    #[doc = "The details for events with this `type`."]
1585    #[derive(Clone, Debug, Default, PartialEq)]
1586    #[serde_with::serde_as]
1587    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
1588    pub struct CertificateDeleted {
1589        #[doc = "The certificate ID."]
1590        #[serde(rename = "id")]
1591        #[serde(skip_serializing_if = "Option::is_none")]
1592        #[builder(default)]
1593        pub id: Option<String>,
1594        #[doc = "The name of the certificate."]
1595        #[serde(rename = "name")]
1596        #[serde(skip_serializing_if = "Option::is_none")]
1597        #[builder(default)]
1598        pub name: Option<String>,
1599        #[doc = "The certificate content in PEM format."]
1600        #[serde(rename = "certificate")]
1601        #[serde(skip_serializing_if = "Option::is_none")]
1602        #[builder(default)]
1603        pub certificate: Option<String>,
1604    }
1605    #[allow(clippy::module_inception)]
1606    pub mod certificates_activated {
1607        #[allow(clippy::module_inception)]
1608        pub mod certificates {
1609            #[derive(Clone, Debug, Default, PartialEq)]
1610            #[serde_with::serde_as]
1611            #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
1612            pub struct Item {
1613                #[doc = "The certificate ID."]
1614                #[serde(rename = "id")]
1615                #[serde(skip_serializing_if = "Option::is_none")]
1616                #[builder(default)]
1617                pub id: Option<String>,
1618                #[doc = "The name of the certificate."]
1619                #[serde(rename = "name")]
1620                #[serde(skip_serializing_if = "Option::is_none")]
1621                #[builder(default)]
1622                pub name: Option<String>,
1623            }
1624        }
1625    }
1626    #[doc = "The details for events with this `type`."]
1627    #[derive(Clone, Debug, Default, PartialEq)]
1628    #[serde_with::serde_as]
1629    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
1630    pub struct CertificatesActivated {
1631        #[serde(rename = "certificates")]
1632        #[serde(skip_serializing_if = "Option::is_none")]
1633        #[builder(default)]
1634        pub certificates:
1635            Option<Vec<crate::__types::audit_log::certificates_activated::certificates::Item>>,
1636    }
1637    #[allow(clippy::module_inception)]
1638    pub mod certificates_deactivated {
1639        #[allow(clippy::module_inception)]
1640        pub mod certificates {
1641            #[derive(Clone, Debug, Default, PartialEq)]
1642            #[serde_with::serde_as]
1643            #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
1644            pub struct Item {
1645                #[doc = "The certificate ID."]
1646                #[serde(rename = "id")]
1647                #[serde(skip_serializing_if = "Option::is_none")]
1648                #[builder(default)]
1649                pub id: Option<String>,
1650                #[doc = "The name of the certificate."]
1651                #[serde(rename = "name")]
1652                #[serde(skip_serializing_if = "Option::is_none")]
1653                #[builder(default)]
1654                pub name: Option<String>,
1655            }
1656        }
1657    }
1658    #[doc = "The details for events with this `type`."]
1659    #[derive(Clone, Debug, Default, PartialEq)]
1660    #[serde_with::serde_as]
1661    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
1662    pub struct CertificatesDeactivated {
1663        #[serde(rename = "certificates")]
1664        #[serde(skip_serializing_if = "Option::is_none")]
1665        #[builder(default)]
1666        pub certificates:
1667            Option<Vec<crate::__types::audit_log::certificates_deactivated::certificates::Item>>,
1668    }
1669}
1670#[doc = "A log of a user action or configuration change within this organization."]
1671#[derive(Clone, Debug, PartialEq)]
1672#[serde_with::serde_as]
1673#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
1674pub struct AuditLog {
1675    #[doc = "The ID of this log."]
1676    #[serde(rename = "id")]
1677    pub id: String,
1678    #[serde(rename = "type")]
1679    pub r#type: crate::__types::AuditLogEventType,
1680    #[doc = "The Unix timestamp (in seconds) of the event."]
1681    #[serde(rename = "effective_at")]
1682    pub effective_at: i64,
1683    #[doc = "The project that the action was scoped to. Absent for actions not scoped to projects. Note that any admin actions taken via Admin API keys are associated with the default project."]
1684    #[serde(rename = "project")]
1685    #[serde(skip_serializing_if = "Option::is_none")]
1686    #[builder(default)]
1687    pub project: Option<crate::__types::audit_log::Project>,
1688    #[serde(rename = "actor")]
1689    #[builder(default)]
1690    pub actor: crate::__types::AuditLogActor,
1691    #[doc = "The details for events with this `type`."]
1692    #[serde(rename = "api_key.created")]
1693    #[serde(skip_serializing_if = "Option::is_none")]
1694    #[builder(default)]
1695    pub api_key_created: Option<crate::__types::audit_log::ApiKeyCreated>,
1696    #[doc = "The details for events with this `type`."]
1697    #[serde(rename = "api_key.updated")]
1698    #[serde(skip_serializing_if = "Option::is_none")]
1699    #[builder(default)]
1700    pub api_key_updated: Option<crate::__types::audit_log::ApiKeyUpdated>,
1701    #[doc = "The details for events with this `type`."]
1702    #[serde(rename = "api_key.deleted")]
1703    #[serde(skip_serializing_if = "Option::is_none")]
1704    #[builder(default)]
1705    pub api_key_deleted: Option<crate::__types::audit_log::ApiKeyDeleted>,
1706    #[doc = "The project and fine-tuned model checkpoint that the checkpoint permission was created for."]
1707    #[serde(rename = "checkpoint_permission.created")]
1708    #[serde(skip_serializing_if = "Option::is_none")]
1709    #[builder(default)]
1710    pub checkpoint_permission_created:
1711        Option<crate::__types::audit_log::CheckpointPermissionCreated>,
1712    #[doc = "The details for events with this `type`."]
1713    #[serde(rename = "checkpoint_permission.deleted")]
1714    #[serde(skip_serializing_if = "Option::is_none")]
1715    #[builder(default)]
1716    pub checkpoint_permission_deleted:
1717        Option<crate::__types::audit_log::CheckpointPermissionDeleted>,
1718    #[doc = "The details for events with this `type`."]
1719    #[serde(rename = "invite.sent")]
1720    #[serde(skip_serializing_if = "Option::is_none")]
1721    #[builder(default)]
1722    pub invite_sent: Option<crate::__types::audit_log::InviteSent>,
1723    #[doc = "The details for events with this `type`."]
1724    #[serde(rename = "invite.accepted")]
1725    #[serde(skip_serializing_if = "Option::is_none")]
1726    #[builder(default)]
1727    pub invite_accepted: Option<crate::__types::audit_log::InviteAccepted>,
1728    #[doc = "The details for events with this `type`."]
1729    #[serde(rename = "invite.deleted")]
1730    #[serde(skip_serializing_if = "Option::is_none")]
1731    #[builder(default)]
1732    pub invite_deleted: Option<crate::__types::audit_log::InviteDeleted>,
1733    #[doc = "The details for events with this `type`."]
1734    #[serde(rename = "login.failed")]
1735    #[serde(skip_serializing_if = "Option::is_none")]
1736    #[builder(default)]
1737    pub login_failed: Option<crate::__types::audit_log::LoginFailed>,
1738    #[doc = "The details for events with this `type`."]
1739    #[serde(rename = "logout.failed")]
1740    #[serde(skip_serializing_if = "Option::is_none")]
1741    #[builder(default)]
1742    pub logout_failed: Option<crate::__types::audit_log::LogoutFailed>,
1743    #[doc = "The details for events with this `type`."]
1744    #[serde(rename = "organization.updated")]
1745    #[serde(skip_serializing_if = "Option::is_none")]
1746    #[builder(default)]
1747    pub organization_updated: Option<crate::__types::audit_log::OrganizationUpdated>,
1748    #[doc = "The details for events with this `type`."]
1749    #[serde(rename = "project.created")]
1750    #[serde(skip_serializing_if = "Option::is_none")]
1751    #[builder(default)]
1752    pub project_created: Option<crate::__types::audit_log::ProjectCreated>,
1753    #[doc = "The details for events with this `type`."]
1754    #[serde(rename = "project.updated")]
1755    #[serde(skip_serializing_if = "Option::is_none")]
1756    #[builder(default)]
1757    pub project_updated: Option<crate::__types::audit_log::ProjectUpdated>,
1758    #[doc = "The details for events with this `type`."]
1759    #[serde(rename = "project.archived")]
1760    #[serde(skip_serializing_if = "Option::is_none")]
1761    #[builder(default)]
1762    pub project_archived: Option<crate::__types::audit_log::ProjectArchived>,
1763    #[doc = "The details for events with this `type`."]
1764    #[serde(rename = "rate_limit.updated")]
1765    #[serde(skip_serializing_if = "Option::is_none")]
1766    #[builder(default)]
1767    pub rate_limit_updated: Option<crate::__types::audit_log::RateLimitUpdated>,
1768    #[doc = "The details for events with this `type`."]
1769    #[serde(rename = "rate_limit.deleted")]
1770    #[serde(skip_serializing_if = "Option::is_none")]
1771    #[builder(default)]
1772    pub rate_limit_deleted: Option<crate::__types::audit_log::RateLimitDeleted>,
1773    #[doc = "The details for events with this `type`."]
1774    #[serde(rename = "service_account.created")]
1775    #[serde(skip_serializing_if = "Option::is_none")]
1776    #[builder(default)]
1777    pub service_account_created: Option<crate::__types::audit_log::ServiceAccountCreated>,
1778    #[doc = "The details for events with this `type`."]
1779    #[serde(rename = "service_account.updated")]
1780    #[serde(skip_serializing_if = "Option::is_none")]
1781    #[builder(default)]
1782    pub service_account_updated: Option<crate::__types::audit_log::ServiceAccountUpdated>,
1783    #[doc = "The details for events with this `type`."]
1784    #[serde(rename = "service_account.deleted")]
1785    #[serde(skip_serializing_if = "Option::is_none")]
1786    #[builder(default)]
1787    pub service_account_deleted: Option<crate::__types::audit_log::ServiceAccountDeleted>,
1788    #[doc = "The details for events with this `type`."]
1789    #[serde(rename = "user.added")]
1790    #[serde(skip_serializing_if = "Option::is_none")]
1791    #[builder(default)]
1792    pub user_added: Option<crate::__types::audit_log::UserAdded>,
1793    #[doc = "The details for events with this `type`."]
1794    #[serde(rename = "user.updated")]
1795    #[serde(skip_serializing_if = "Option::is_none")]
1796    #[builder(default)]
1797    pub user_updated: Option<crate::__types::audit_log::UserUpdated>,
1798    #[doc = "The details for events with this `type`."]
1799    #[serde(rename = "user.deleted")]
1800    #[serde(skip_serializing_if = "Option::is_none")]
1801    #[builder(default)]
1802    pub user_deleted: Option<crate::__types::audit_log::UserDeleted>,
1803    #[doc = "The details for events with this `type`."]
1804    #[serde(rename = "certificate.created")]
1805    #[serde(skip_serializing_if = "Option::is_none")]
1806    #[builder(default)]
1807    pub certificate_created: Option<crate::__types::audit_log::CertificateCreated>,
1808    #[doc = "The details for events with this `type`."]
1809    #[serde(rename = "certificate.updated")]
1810    #[serde(skip_serializing_if = "Option::is_none")]
1811    #[builder(default)]
1812    pub certificate_updated: Option<crate::__types::audit_log::CertificateUpdated>,
1813    #[doc = "The details for events with this `type`."]
1814    #[serde(rename = "certificate.deleted")]
1815    #[serde(skip_serializing_if = "Option::is_none")]
1816    #[builder(default)]
1817    pub certificate_deleted: Option<crate::__types::audit_log::CertificateDeleted>,
1818    #[doc = "The details for events with this `type`."]
1819    #[serde(rename = "certificates.activated")]
1820    #[serde(skip_serializing_if = "Option::is_none")]
1821    #[builder(default)]
1822    pub certificates_activated: Option<crate::__types::audit_log::CertificatesActivated>,
1823    #[doc = "The details for events with this `type`."]
1824    #[serde(rename = "certificates.deactivated")]
1825    #[serde(skip_serializing_if = "Option::is_none")]
1826    #[builder(default)]
1827    pub certificates_deactivated: Option<crate::__types::audit_log::CertificatesDeactivated>,
1828}
1829#[allow(clippy::module_inception)]
1830pub mod audit_log_actor {
1831    #[doc = "The type of actor. Is either `session` or `api_key`."]
1832    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
1833    pub enum Type {
1834        #[doc = "`session`"]
1835        #[serde(rename = "session")]
1836        Session,
1837        #[doc = "`api_key`"]
1838        #[serde(rename = "api_key")]
1839        ApiKey,
1840    }
1841}
1842#[doc = "The actor who performed the audit logged action."]
1843#[derive(Clone, Debug, Default, PartialEq)]
1844#[serde_with::serde_as]
1845#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
1846pub struct AuditLogActor {
1847    #[doc = "The type of actor. Is either `session` or `api_key`."]
1848    #[serde(rename = "type")]
1849    #[serde(skip_serializing_if = "Option::is_none")]
1850    #[builder(default)]
1851    pub r#type: Option<crate::__types::audit_log_actor::Type>,
1852    #[serde(rename = "session")]
1853    #[serde(skip_serializing_if = "Option::is_none")]
1854    #[builder(default)]
1855    pub session: Option<crate::__types::AuditLogActorSession>,
1856    #[serde(rename = "api_key")]
1857    #[serde(skip_serializing_if = "Option::is_none")]
1858    #[builder(default)]
1859    pub api_key: Option<crate::__types::AuditLogActorApiKey>,
1860}
1861#[allow(clippy::module_inception)]
1862pub mod audit_log_actor_api_key {
1863    #[doc = "The type of API key. Can be either `user` or `service_account`."]
1864    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
1865    pub enum Type {
1866        #[doc = "`user`"]
1867        #[serde(rename = "user")]
1868        User,
1869        #[doc = "`service_account`"]
1870        #[serde(rename = "service_account")]
1871        ServiceAccount,
1872    }
1873}
1874#[doc = "The API Key used to perform the audit logged action."]
1875#[derive(Clone, Debug, Default, PartialEq)]
1876#[serde_with::serde_as]
1877#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
1878pub struct AuditLogActorApiKey {
1879    #[doc = "The tracking id of the API key."]
1880    #[serde(rename = "id")]
1881    #[serde(skip_serializing_if = "Option::is_none")]
1882    #[builder(default)]
1883    pub id: Option<String>,
1884    #[doc = "The type of API key. Can be either `user` or `service_account`."]
1885    #[serde(rename = "type")]
1886    #[serde(skip_serializing_if = "Option::is_none")]
1887    #[builder(default)]
1888    pub r#type: Option<crate::__types::audit_log_actor_api_key::Type>,
1889    #[serde(rename = "user")]
1890    #[serde(skip_serializing_if = "Option::is_none")]
1891    #[builder(default)]
1892    pub user: Option<crate::__types::AuditLogActorUser>,
1893    #[serde(rename = "service_account")]
1894    #[serde(skip_serializing_if = "Option::is_none")]
1895    #[builder(default)]
1896    pub service_account: Option<crate::__types::AuditLogActorServiceAccount>,
1897}
1898#[doc = "The service account that performed the audit logged action."]
1899#[derive(Clone, Debug, Default, PartialEq)]
1900#[serde_with::serde_as]
1901#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
1902pub struct AuditLogActorServiceAccount {
1903    #[doc = "The service account id."]
1904    #[serde(rename = "id")]
1905    #[serde(skip_serializing_if = "Option::is_none")]
1906    #[builder(default)]
1907    pub id: Option<String>,
1908}
1909#[doc = "The session in which the audit logged action was performed."]
1910#[derive(Clone, Debug, Default, PartialEq)]
1911#[serde_with::serde_as]
1912#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
1913pub struct AuditLogActorSession {
1914    #[serde(rename = "user")]
1915    #[serde(skip_serializing_if = "Option::is_none")]
1916    #[builder(default)]
1917    pub user: Option<crate::__types::AuditLogActorUser>,
1918    #[doc = "The IP address from which the action was performed."]
1919    #[serde(rename = "ip_address")]
1920    #[serde(skip_serializing_if = "Option::is_none")]
1921    #[builder(default)]
1922    pub ip_address: Option<String>,
1923}
1924#[doc = "The user who performed the audit logged action."]
1925#[derive(Clone, Debug, Default, PartialEq)]
1926#[serde_with::serde_as]
1927#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
1928pub struct AuditLogActorUser {
1929    #[doc = "The user id."]
1930    #[serde(rename = "id")]
1931    #[serde(skip_serializing_if = "Option::is_none")]
1932    #[builder(default)]
1933    pub id: Option<String>,
1934    #[doc = "The user email."]
1935    #[serde(rename = "email")]
1936    #[serde(skip_serializing_if = "Option::is_none")]
1937    #[builder(default)]
1938    pub email: Option<String>,
1939}
1940#[doc = "The event type."]
1941#[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
1942pub enum AuditLogEventType {
1943    #[doc = "`api_key.created`"]
1944    #[serde(rename = "api_key.created")]
1945    ApiKeyCreated,
1946    #[doc = "`api_key.updated`"]
1947    #[serde(rename = "api_key.updated")]
1948    ApiKeyUpdated,
1949    #[doc = "`api_key.deleted`"]
1950    #[serde(rename = "api_key.deleted")]
1951    ApiKeyDeleted,
1952    #[doc = "`checkpoint_permission.created`"]
1953    #[serde(rename = "checkpoint_permission.created")]
1954    CheckpointPermissionCreated,
1955    #[doc = "`checkpoint_permission.deleted`"]
1956    #[serde(rename = "checkpoint_permission.deleted")]
1957    CheckpointPermissionDeleted,
1958    #[doc = "`invite.sent`"]
1959    #[serde(rename = "invite.sent")]
1960    InviteSent,
1961    #[doc = "`invite.accepted`"]
1962    #[serde(rename = "invite.accepted")]
1963    InviteAccepted,
1964    #[doc = "`invite.deleted`"]
1965    #[serde(rename = "invite.deleted")]
1966    InviteDeleted,
1967    #[doc = "`login.succeeded`"]
1968    #[serde(rename = "login.succeeded")]
1969    LoginSucceeded,
1970    #[doc = "`login.failed`"]
1971    #[serde(rename = "login.failed")]
1972    LoginFailed,
1973    #[doc = "`logout.succeeded`"]
1974    #[serde(rename = "logout.succeeded")]
1975    LogoutSucceeded,
1976    #[doc = "`logout.failed`"]
1977    #[serde(rename = "logout.failed")]
1978    LogoutFailed,
1979    #[doc = "`organization.updated`"]
1980    #[serde(rename = "organization.updated")]
1981    OrganizationUpdated,
1982    #[doc = "`project.created`"]
1983    #[serde(rename = "project.created")]
1984    ProjectCreated,
1985    #[doc = "`project.updated`"]
1986    #[serde(rename = "project.updated")]
1987    ProjectUpdated,
1988    #[doc = "`project.archived`"]
1989    #[serde(rename = "project.archived")]
1990    ProjectArchived,
1991    #[doc = "`service_account.created`"]
1992    #[serde(rename = "service_account.created")]
1993    ServiceAccountCreated,
1994    #[doc = "`service_account.updated`"]
1995    #[serde(rename = "service_account.updated")]
1996    ServiceAccountUpdated,
1997    #[doc = "`service_account.deleted`"]
1998    #[serde(rename = "service_account.deleted")]
1999    ServiceAccountDeleted,
2000    #[doc = "`rate_limit.updated`"]
2001    #[serde(rename = "rate_limit.updated")]
2002    RateLimitUpdated,
2003    #[doc = "`rate_limit.deleted`"]
2004    #[serde(rename = "rate_limit.deleted")]
2005    RateLimitDeleted,
2006    #[doc = "`user.added`"]
2007    #[serde(rename = "user.added")]
2008    UserAdded,
2009    #[doc = "`user.updated`"]
2010    #[serde(rename = "user.updated")]
2011    UserUpdated,
2012    #[doc = "`user.deleted`"]
2013    #[serde(rename = "user.deleted")]
2014    UserDeleted,
2015}
2016#[allow(clippy::module_inception)]
2017pub(crate) mod auto_chunking_strategy_request_param {
2018    #[doc = "Always `auto`."]
2019    #[derive(Clone, Copy, Debug, Default, PartialEq)]
2020    pub(crate) struct Type;
2021    impl_serde!(Type, "auto");
2022}
2023#[doc = "The default strategy. This strategy currently uses a `max_chunk_size_tokens` of `800` and `chunk_overlap_tokens` of `400`."]
2024#[derive(Clone, Copy, Debug, Default, PartialEq, typed_builder :: TypedBuilder)]
2025pub struct AutoChunkingStrategyRequestParam {}
2026impl<'de> serde::Deserialize<'de> for AutoChunkingStrategyRequestParam {
2027    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
2028    where
2029        D: serde::Deserializer<'de>,
2030    {
2031        #[serde_with::serde_as]
2032        #[derive(serde :: Deserialize)]
2033        struct AutoChunkingStrategyRequestParam {
2034            #[serde(rename = "type")]
2035            #[allow(dead_code)]
2036            r#type: crate::__types::auto_chunking_strategy_request_param::Type,
2037        }
2038        let AutoChunkingStrategyRequestParam { .. } =
2039            AutoChunkingStrategyRequestParam::deserialize(deserializer)?;
2040        Ok(Self {})
2041    }
2042}
2043impl serde::Serialize for AutoChunkingStrategyRequestParam {
2044    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
2045    where
2046        S: serde::Serializer,
2047    {
2048        #[serde_with::serde_as]
2049        #[derive(serde :: Serialize)]
2050        struct AutoChunkingStrategyRequestParam<'a> {
2051            #[serde(rename = "type")]
2052            r#type: &'a crate::__types::auto_chunking_strategy_request_param::Type,
2053        }
2054        let Self {} = self;
2055        AutoChunkingStrategyRequestParam {
2056            r#type: &Default::default(),
2057        }
2058        .serialize(serializer)
2059    }
2060}
2061#[allow(clippy::module_inception)]
2062pub mod batch {
2063    #[doc = "The object type, which is always `batch`."]
2064    #[derive(Clone, Copy, Debug, Default, PartialEq)]
2065    pub(crate) struct Object;
2066    impl_serde!(Object, "batch");
2067    #[allow(clippy::module_inception)]
2068    pub mod errors {
2069        #[doc = "The object type, which is always `list`."]
2070        #[derive(Clone, Copy, Debug, Default, PartialEq)]
2071        pub struct Object;
2072        impl_serde!(Object, "list");
2073    }
2074    #[derive(Clone, Debug, Default, PartialEq)]
2075    #[serde_with::serde_as]
2076    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
2077    pub struct Errors {
2078        #[doc = "The object type, which is always `list`."]
2079        #[serde(rename = "object")]
2080        #[serde(skip_serializing_if = "Option::is_none")]
2081        #[builder(default)]
2082        pub object: Option<crate::__types::batch::errors::Object>,
2083        #[serde(rename = "data")]
2084        #[serde(skip_serializing_if = "Option::is_none")]
2085        #[builder(default)]
2086        pub data: Option<Vec<crate::__types::BatchError>>,
2087    }
2088    #[doc = "The current status of the batch."]
2089    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
2090    pub enum Status {
2091        #[doc = "`validating`"]
2092        #[serde(rename = "validating")]
2093        Validating,
2094        #[doc = "`failed`"]
2095        #[serde(rename = "failed")]
2096        Failed,
2097        #[doc = "`in_progress`"]
2098        #[serde(rename = "in_progress")]
2099        InProgress,
2100        #[doc = "`finalizing`"]
2101        #[serde(rename = "finalizing")]
2102        Finalizing,
2103        #[doc = "`completed`"]
2104        #[serde(rename = "completed")]
2105        Completed,
2106        #[doc = "`expired`"]
2107        #[serde(rename = "expired")]
2108        Expired,
2109        #[doc = "`cancelling`"]
2110        #[serde(rename = "cancelling")]
2111        Cancelling,
2112        #[doc = "`cancelled`"]
2113        #[serde(rename = "cancelled")]
2114        Cancelled,
2115    }
2116}
2117#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
2118pub struct Batch {
2119    pub id: String,
2120    #[doc = "The OpenAI API endpoint used by the batch."]
2121    pub endpoint: String,
2122    #[builder(default)]
2123    pub errors: Option<crate::__types::batch::Errors>,
2124    #[doc = "The ID of the input file for the batch."]
2125    pub input_file_id: String,
2126    #[doc = "The time frame within which the batch should be processed."]
2127    pub completion_window: String,
2128    #[doc = "The current status of the batch."]
2129    pub status: crate::__types::batch::Status,
2130    #[doc = "The ID of the file containing the outputs of successfully executed requests."]
2131    #[builder(default)]
2132    pub output_file_id: Option<String>,
2133    #[doc = "The ID of the file containing the outputs of requests with errors."]
2134    #[builder(default)]
2135    pub error_file_id: Option<String>,
2136    #[doc = "The Unix timestamp (in seconds) for when the batch was created."]
2137    pub created_at: i64,
2138    #[doc = "The Unix timestamp (in seconds) for when the batch started processing."]
2139    #[builder(default)]
2140    pub in_progress_at: Option<i64>,
2141    #[doc = "The Unix timestamp (in seconds) for when the batch will expire."]
2142    #[builder(default)]
2143    pub expires_at: Option<i64>,
2144    #[doc = "The Unix timestamp (in seconds) for when the batch started finalizing."]
2145    #[builder(default)]
2146    pub finalizing_at: Option<i64>,
2147    #[doc = "The Unix timestamp (in seconds) for when the batch was completed."]
2148    #[builder(default)]
2149    pub completed_at: Option<i64>,
2150    #[doc = "The Unix timestamp (in seconds) for when the batch failed."]
2151    #[builder(default)]
2152    pub failed_at: Option<i64>,
2153    #[doc = "The Unix timestamp (in seconds) for when the batch expired."]
2154    #[builder(default)]
2155    pub expired_at: Option<i64>,
2156    #[doc = "The Unix timestamp (in seconds) for when the batch started cancelling."]
2157    #[builder(default)]
2158    pub cancelling_at: Option<i64>,
2159    #[doc = "The Unix timestamp (in seconds) for when the batch was cancelled."]
2160    #[builder(default)]
2161    pub cancelled_at: Option<i64>,
2162    #[builder(default)]
2163    pub request_counts: Option<crate::__types::BatchRequestCounts>,
2164    #[builder(default)]
2165    pub metadata: Option<crate::__types::Metadata>,
2166}
2167impl<'de> serde::Deserialize<'de> for Batch {
2168    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
2169    where
2170        D: serde::Deserializer<'de>,
2171    {
2172        #[serde_with::serde_as]
2173        #[derive(serde :: Deserialize)]
2174        struct Batch {
2175            #[serde(rename = "id")]
2176            id: String,
2177            #[serde(rename = "object")]
2178            #[allow(dead_code)]
2179            object: crate::__types::batch::Object,
2180            #[serde(rename = "endpoint")]
2181            endpoint: String,
2182            #[serde(rename = "errors")]
2183            errors: Option<crate::__types::batch::Errors>,
2184            #[serde(rename = "input_file_id")]
2185            input_file_id: String,
2186            #[serde(rename = "completion_window")]
2187            completion_window: String,
2188            #[serde(rename = "status")]
2189            status: crate::__types::batch::Status,
2190            #[serde(rename = "output_file_id")]
2191            output_file_id: Option<String>,
2192            #[serde(rename = "error_file_id")]
2193            error_file_id: Option<String>,
2194            #[serde(rename = "created_at")]
2195            created_at: i64,
2196            #[serde(rename = "in_progress_at")]
2197            in_progress_at: Option<i64>,
2198            #[serde(rename = "expires_at")]
2199            expires_at: Option<i64>,
2200            #[serde(rename = "finalizing_at")]
2201            finalizing_at: Option<i64>,
2202            #[serde(rename = "completed_at")]
2203            completed_at: Option<i64>,
2204            #[serde(rename = "failed_at")]
2205            failed_at: Option<i64>,
2206            #[serde(rename = "expired_at")]
2207            expired_at: Option<i64>,
2208            #[serde(rename = "cancelling_at")]
2209            cancelling_at: Option<i64>,
2210            #[serde(rename = "cancelled_at")]
2211            cancelled_at: Option<i64>,
2212            #[serde(rename = "request_counts")]
2213            request_counts: Option<crate::__types::BatchRequestCounts>,
2214            #[serde(rename = "metadata")]
2215            metadata: Option<crate::__types::Metadata>,
2216        }
2217        let Batch {
2218            id,
2219            endpoint,
2220            errors,
2221            input_file_id,
2222            completion_window,
2223            status,
2224            output_file_id,
2225            error_file_id,
2226            created_at,
2227            in_progress_at,
2228            expires_at,
2229            finalizing_at,
2230            completed_at,
2231            failed_at,
2232            expired_at,
2233            cancelling_at,
2234            cancelled_at,
2235            request_counts,
2236            metadata,
2237            ..
2238        } = Batch::deserialize(deserializer)?;
2239        Ok(Self {
2240            id,
2241            endpoint,
2242            errors,
2243            input_file_id,
2244            completion_window,
2245            status,
2246            output_file_id,
2247            error_file_id,
2248            created_at,
2249            in_progress_at,
2250            expires_at,
2251            finalizing_at,
2252            completed_at,
2253            failed_at,
2254            expired_at,
2255            cancelling_at,
2256            cancelled_at,
2257            request_counts,
2258            metadata,
2259        })
2260    }
2261}
2262impl serde::Serialize for Batch {
2263    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
2264    where
2265        S: serde::Serializer,
2266    {
2267        #[serde_with::serde_as]
2268        #[derive(serde :: Serialize)]
2269        struct Batch<'a> {
2270            #[serde(rename = "id")]
2271            id: &'a String,
2272            #[serde(rename = "object")]
2273            object: &'a crate::__types::batch::Object,
2274            #[serde(rename = "endpoint")]
2275            endpoint: &'a String,
2276            #[serde(rename = "errors")]
2277            #[serde(skip_serializing_if = "Option::is_none")]
2278            errors: &'a Option<crate::__types::batch::Errors>,
2279            #[serde(rename = "input_file_id")]
2280            input_file_id: &'a String,
2281            #[serde(rename = "completion_window")]
2282            completion_window: &'a String,
2283            #[serde(rename = "status")]
2284            status: &'a crate::__types::batch::Status,
2285            #[serde(rename = "output_file_id")]
2286            #[serde(skip_serializing_if = "Option::is_none")]
2287            output_file_id: &'a Option<String>,
2288            #[serde(rename = "error_file_id")]
2289            #[serde(skip_serializing_if = "Option::is_none")]
2290            error_file_id: &'a Option<String>,
2291            #[serde(rename = "created_at")]
2292            created_at: &'a i64,
2293            #[serde(rename = "in_progress_at")]
2294            #[serde(skip_serializing_if = "Option::is_none")]
2295            in_progress_at: &'a Option<i64>,
2296            #[serde(rename = "expires_at")]
2297            #[serde(skip_serializing_if = "Option::is_none")]
2298            expires_at: &'a Option<i64>,
2299            #[serde(rename = "finalizing_at")]
2300            #[serde(skip_serializing_if = "Option::is_none")]
2301            finalizing_at: &'a Option<i64>,
2302            #[serde(rename = "completed_at")]
2303            #[serde(skip_serializing_if = "Option::is_none")]
2304            completed_at: &'a Option<i64>,
2305            #[serde(rename = "failed_at")]
2306            #[serde(skip_serializing_if = "Option::is_none")]
2307            failed_at: &'a Option<i64>,
2308            #[serde(rename = "expired_at")]
2309            #[serde(skip_serializing_if = "Option::is_none")]
2310            expired_at: &'a Option<i64>,
2311            #[serde(rename = "cancelling_at")]
2312            #[serde(skip_serializing_if = "Option::is_none")]
2313            cancelling_at: &'a Option<i64>,
2314            #[serde(rename = "cancelled_at")]
2315            #[serde(skip_serializing_if = "Option::is_none")]
2316            cancelled_at: &'a Option<i64>,
2317            #[serde(rename = "request_counts")]
2318            #[serde(skip_serializing_if = "Option::is_none")]
2319            request_counts: &'a Option<crate::__types::BatchRequestCounts>,
2320            #[serde(rename = "metadata")]
2321            #[serde(skip_serializing_if = "Option::is_none")]
2322            metadata: &'a Option<crate::__types::Metadata>,
2323        }
2324        let Self {
2325            id,
2326            endpoint,
2327            errors,
2328            input_file_id,
2329            completion_window,
2330            status,
2331            output_file_id,
2332            error_file_id,
2333            created_at,
2334            in_progress_at,
2335            expires_at,
2336            finalizing_at,
2337            completed_at,
2338            failed_at,
2339            expired_at,
2340            cancelling_at,
2341            cancelled_at,
2342            request_counts,
2343            metadata,
2344        } = self;
2345        Batch {
2346            id,
2347            object: &Default::default(),
2348            endpoint,
2349            errors,
2350            input_file_id,
2351            completion_window,
2352            status,
2353            output_file_id,
2354            error_file_id,
2355            created_at,
2356            in_progress_at,
2357            expires_at,
2358            finalizing_at,
2359            completed_at,
2360            failed_at,
2361            expired_at,
2362            cancelling_at,
2363            cancelled_at,
2364            request_counts,
2365            metadata,
2366        }
2367        .serialize(serializer)
2368    }
2369}
2370#[allow(clippy::module_inception)]
2371pub(crate) mod batch_file_expiration_after {
2372    #[doc = "Anchor timestamp after which the expiration policy applies. Supported anchors: `created_at`. Note that the anchor is the file creation time, not the time the batch is created."]
2373    #[derive(Clone, Copy, Debug, Default, PartialEq)]
2374    pub(crate) struct Anchor;
2375    impl_serde!(Anchor, "created_at");
2376}
2377#[doc = "The expiration policy for the output and/or error file that are generated for a batch."]
2378#[derive(Clone, Copy, Debug, PartialEq, typed_builder :: TypedBuilder)]
2379pub struct BatchFileExpirationAfter {
2380    #[doc = "The number of seconds after the anchor time that the file will expire. Must be between 3600 (1 hour) and 2592000 (30 days)."]
2381    pub seconds: i64,
2382}
2383impl<'de> serde::Deserialize<'de> for BatchFileExpirationAfter {
2384    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
2385    where
2386        D: serde::Deserializer<'de>,
2387    {
2388        #[serde_with::serde_as]
2389        #[derive(serde :: Deserialize)]
2390        struct BatchFileExpirationAfter {
2391            #[serde(rename = "anchor")]
2392            #[allow(dead_code)]
2393            anchor: crate::__types::batch_file_expiration_after::Anchor,
2394            #[serde(rename = "seconds")]
2395            seconds: i64,
2396        }
2397        let BatchFileExpirationAfter { seconds, .. } =
2398            BatchFileExpirationAfter::deserialize(deserializer)?;
2399        Ok(Self { seconds })
2400    }
2401}
2402impl serde::Serialize for BatchFileExpirationAfter {
2403    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
2404    where
2405        S: serde::Serializer,
2406    {
2407        #[serde_with::serde_as]
2408        #[derive(serde :: Serialize)]
2409        struct BatchFileExpirationAfter<'a> {
2410            #[serde(rename = "anchor")]
2411            anchor: &'a crate::__types::batch_file_expiration_after::Anchor,
2412            #[serde(rename = "seconds")]
2413            seconds: &'a i64,
2414        }
2415        let Self { seconds } = self;
2416        BatchFileExpirationAfter {
2417            anchor: &Default::default(),
2418            seconds,
2419        }
2420        .serialize(serializer)
2421    }
2422}
2423#[allow(clippy::module_inception)]
2424pub mod batch_request_input {
2425    #[doc = "The HTTP method to be used for the request. Currently only `POST` is supported."]
2426    #[derive(Clone, Copy, Debug, Default, PartialEq)]
2427    pub struct Method;
2428    impl_serde!(Method, "POST");
2429}
2430#[doc = "The per-line object of the batch input file"]
2431#[derive(Clone, Debug, Default, PartialEq)]
2432#[serde_with::serde_as]
2433#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
2434pub struct BatchRequestInput {
2435    #[doc = "A developer-provided per-request id that will be used to match outputs to inputs. Must be unique for each request in a batch."]
2436    #[serde(rename = "custom_id")]
2437    #[serde(skip_serializing_if = "Option::is_none")]
2438    #[builder(default)]
2439    pub custom_id: Option<String>,
2440    #[doc = "The HTTP method to be used for the request. Currently only `POST` is supported."]
2441    #[serde(rename = "method")]
2442    #[serde(skip_serializing_if = "Option::is_none")]
2443    #[builder(default)]
2444    pub method: Option<crate::__types::batch_request_input::Method>,
2445    #[doc = "The OpenAI API relative URL to be used for the request. Currently `/v1/chat/completions`, `/v1/embeddings`, and `/v1/completions` are supported."]
2446    #[serde(rename = "url")]
2447    #[serde(skip_serializing_if = "Option::is_none")]
2448    #[builder(default)]
2449    pub url: Option<String>,
2450}
2451#[allow(clippy::module_inception)]
2452pub mod batch_request_output {
2453    #[derive(Clone, Debug, Default, PartialEq)]
2454    #[serde_with::serde_as]
2455    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
2456    pub struct Response {
2457        #[doc = "The HTTP status code of the response"]
2458        #[serde(rename = "status_code")]
2459        #[serde(skip_serializing_if = "Option::is_none")]
2460        #[builder(default)]
2461        pub status_code: Option<i64>,
2462        #[doc = "An unique identifier for the OpenAI API request. Please include this request ID when contacting support."]
2463        #[serde(rename = "request_id")]
2464        #[serde(skip_serializing_if = "Option::is_none")]
2465        #[builder(default)]
2466        pub request_id: Option<String>,
2467        #[doc = "The JSON body of the response"]
2468        #[serde(rename = "body")]
2469        #[serde(skip_serializing_if = "Option::is_none")]
2470        #[builder(default)]
2471        pub body: Option<indexmap::IndexMap<String, serde_json::Value>>,
2472    }
2473    #[doc = "For requests that failed with a non-HTTP error, this will contain more information on the cause of the failure."]
2474    #[derive(Clone, Debug, Default, PartialEq)]
2475    #[serde_with::serde_as]
2476    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
2477    pub struct Error {
2478        #[doc = "A machine-readable error code."]
2479        #[serde(rename = "code")]
2480        #[serde(skip_serializing_if = "Option::is_none")]
2481        #[builder(default)]
2482        pub code: Option<String>,
2483        #[doc = "A human-readable error message."]
2484        #[serde(rename = "message")]
2485        #[serde(skip_serializing_if = "Option::is_none")]
2486        #[builder(default)]
2487        pub message: Option<String>,
2488    }
2489}
2490#[doc = "The per-line object of the batch output and error files"]
2491#[derive(Clone, Debug, Default, PartialEq)]
2492#[serde_with::serde_as]
2493#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
2494pub struct BatchRequestOutput {
2495    #[serde(rename = "id")]
2496    #[serde(skip_serializing_if = "Option::is_none")]
2497    #[builder(default)]
2498    pub id: Option<String>,
2499    #[doc = "A developer-provided per-request id that will be used to match outputs to inputs."]
2500    #[serde(rename = "custom_id")]
2501    #[serde(skip_serializing_if = "Option::is_none")]
2502    #[builder(default)]
2503    pub custom_id: Option<String>,
2504    #[serde(rename = "response")]
2505    #[serde(skip_serializing_if = "Option::is_none")]
2506    #[builder(default)]
2507    pub response: Option<crate::__types::batch_request_output::Response>,
2508    #[doc = "For requests that failed with a non-HTTP error, this will contain more information on the cause of the failure."]
2509    #[serde(rename = "error")]
2510    #[serde(skip_serializing_if = "Option::is_none")]
2511    #[builder(default)]
2512    pub error: Option<crate::__types::batch_request_output::Error>,
2513}
2514#[allow(clippy::module_inception)]
2515pub mod certificate {
2516    #[doc = "The object type.\n\n- If creating, updating, or getting a specific certificate, the object type is `certificate`.\n- If listing, activating, or deactivating certificates for the organization, the object type is `organization.certificate`.\n- If listing, activating, or deactivating certificates for a project, the object type is `organization.project.certificate`.\n"]
2517    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
2518    pub enum Object {
2519        #[doc = "`certificate`"]
2520        #[serde(rename = "certificate")]
2521        Certificate,
2522        #[doc = "`organization.certificate`"]
2523        #[serde(rename = "organization.certificate")]
2524        OrganizationCertificate,
2525        #[doc = "`organization.project.certificate`"]
2526        #[serde(rename = "organization.project.certificate")]
2527        OrganizationProjectCertificate,
2528    }
2529    #[derive(Clone, Debug, Default, PartialEq)]
2530    #[serde_with::serde_as]
2531    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
2532    pub struct CertificateDetails {
2533        #[doc = "The Unix timestamp (in seconds) of when the certificate becomes valid."]
2534        #[serde(rename = "valid_at")]
2535        #[serde(skip_serializing_if = "Option::is_none")]
2536        #[builder(default)]
2537        pub valid_at: Option<i64>,
2538        #[doc = "The Unix timestamp (in seconds) of when the certificate expires."]
2539        #[serde(rename = "expires_at")]
2540        #[serde(skip_serializing_if = "Option::is_none")]
2541        #[builder(default)]
2542        pub expires_at: Option<i64>,
2543        #[doc = "The content of the certificate in PEM format."]
2544        #[serde(rename = "content")]
2545        #[serde(skip_serializing_if = "Option::is_none")]
2546        #[builder(default)]
2547        pub content: Option<String>,
2548    }
2549}
2550#[doc = "Represents an individual `certificate` uploaded to the organization."]
2551#[derive(Clone, Debug, PartialEq)]
2552#[serde_with::serde_as]
2553#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
2554pub struct Certificate {
2555    #[doc = "The object type.\n\n- If creating, updating, or getting a specific certificate, the object type is `certificate`.\n- If listing, activating, or deactivating certificates for the organization, the object type is `organization.certificate`.\n- If listing, activating, or deactivating certificates for a project, the object type is `organization.project.certificate`.\n"]
2556    #[serde(rename = "object")]
2557    pub object: crate::__types::certificate::Object,
2558    #[doc = "The identifier, which can be referenced in API endpoints"]
2559    #[serde(rename = "id")]
2560    pub id: String,
2561    #[doc = "The name of the certificate."]
2562    #[serde(rename = "name")]
2563    pub name: String,
2564    #[doc = "The Unix timestamp (in seconds) of when the certificate was uploaded."]
2565    #[serde(rename = "created_at")]
2566    pub created_at: i64,
2567    #[serde(rename = "certificate_details")]
2568    #[builder(default)]
2569    pub certificate_details: crate::__types::certificate::CertificateDetails,
2570    #[doc = "Whether the certificate is currently active at the specified scope. Not returned when getting details for a specific certificate."]
2571    #[serde(rename = "active")]
2572    #[serde(skip_serializing_if = "Option::is_none")]
2573    #[builder(default)]
2574    pub active: Option<bool>,
2575}
2576#[allow(clippy::module_inception)]
2577pub mod chat_completion_allowed_tools {
2578    #[doc = "Constrains the tools available to the model to a pre-defined set.\n\n`auto` allows the model to pick from among the allowed tools and generate a\nmessage.\n\n`required` requires the model to call one or more of the allowed tools.\n"]
2579    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
2580    pub enum Mode {
2581        #[doc = "`auto`"]
2582        #[serde(rename = "auto")]
2583        Auto,
2584        #[doc = "`required`"]
2585        #[serde(rename = "required")]
2586        Required,
2587    }
2588}
2589#[doc = "Constrains the tools available to the model to a pre-defined set.\n"]
2590#[derive(Clone, Debug, PartialEq)]
2591#[serde_with::serde_as]
2592#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
2593pub struct ChatCompletionAllowedTools {
2594    #[doc = "Constrains the tools available to the model to a pre-defined set.\n\n`auto` allows the model to pick from among the allowed tools and generate a\nmessage.\n\n`required` requires the model to call one or more of the allowed tools.\n"]
2595    #[serde(rename = "mode")]
2596    pub mode: crate::__types::chat_completion_allowed_tools::Mode,
2597    #[doc = "A list of tool definitions that the model should be allowed to call.\n\nFor the Chat Completions API, the list of tool definitions might look like:\n```json\n[\n  { \"type\": \"function\", \"function\": { \"name\": \"get_weather\" } },\n  { \"type\": \"function\", \"function\": { \"name\": \"get_time\" } }\n]\n```text\n"]
2598    #[serde(rename = "tools")]
2599    pub tools: Vec<indexmap::IndexMap<String, serde_json::Value>>,
2600}
2601#[allow(clippy::module_inception)]
2602pub(crate) mod chat_completion_allowed_tools_choice {
2603    #[doc = "Allowed tool configuration type. Always `allowed_tools`."]
2604    #[derive(Clone, Copy, Debug, Default, PartialEq)]
2605    pub(crate) struct Type;
2606    impl_serde!(Type, "allowed_tools");
2607}
2608#[doc = "Constrains the tools available to the model to a pre-defined set.\n"]
2609#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
2610pub struct ChatCompletionAllowedToolsChoice {
2611    pub allowed_tools: crate::__types::ChatCompletionAllowedTools,
2612}
2613impl<'de> serde::Deserialize<'de> for ChatCompletionAllowedToolsChoice {
2614    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
2615    where
2616        D: serde::Deserializer<'de>,
2617    {
2618        #[serde_with::serde_as]
2619        #[derive(serde :: Deserialize)]
2620        struct ChatCompletionAllowedToolsChoice {
2621            #[serde(rename = "type")]
2622            #[allow(dead_code)]
2623            r#type: crate::__types::chat_completion_allowed_tools_choice::Type,
2624            #[serde(rename = "allowed_tools")]
2625            allowed_tools: crate::__types::ChatCompletionAllowedTools,
2626        }
2627        let ChatCompletionAllowedToolsChoice { allowed_tools, .. } =
2628            ChatCompletionAllowedToolsChoice::deserialize(deserializer)?;
2629        Ok(Self { allowed_tools })
2630    }
2631}
2632impl serde::Serialize for ChatCompletionAllowedToolsChoice {
2633    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
2634    where
2635        S: serde::Serializer,
2636    {
2637        #[serde_with::serde_as]
2638        #[derive(serde :: Serialize)]
2639        struct ChatCompletionAllowedToolsChoice<'a> {
2640            #[serde(rename = "type")]
2641            r#type: &'a crate::__types::chat_completion_allowed_tools_choice::Type,
2642            #[serde(rename = "allowed_tools")]
2643            allowed_tools: &'a crate::__types::ChatCompletionAllowedTools,
2644        }
2645        let Self { allowed_tools } = self;
2646        ChatCompletionAllowedToolsChoice {
2647            r#type: &Default::default(),
2648            allowed_tools,
2649        }
2650        .serialize(serializer)
2651    }
2652}
2653#[allow(clippy::module_inception)]
2654pub(crate) mod chat_completion_deleted {
2655    #[doc = "The type of object being deleted."]
2656    #[derive(Clone, Copy, Debug, Default, PartialEq)]
2657    pub(crate) struct Object;
2658    impl_serde!(Object, "chat.completion.deleted");
2659}
2660#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
2661pub struct ChatCompletionDeleted {
2662    #[doc = "The ID of the chat completion that was deleted."]
2663    pub id: String,
2664    #[doc = "Whether the chat completion was deleted."]
2665    pub deleted: bool,
2666}
2667impl<'de> serde::Deserialize<'de> for ChatCompletionDeleted {
2668    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
2669    where
2670        D: serde::Deserializer<'de>,
2671    {
2672        #[serde_with::serde_as]
2673        #[derive(serde :: Deserialize)]
2674        struct ChatCompletionDeleted {
2675            #[serde(rename = "object")]
2676            #[allow(dead_code)]
2677            object: crate::__types::chat_completion_deleted::Object,
2678            #[serde(rename = "id")]
2679            id: String,
2680            #[serde(rename = "deleted")]
2681            deleted: bool,
2682        }
2683        let ChatCompletionDeleted { id, deleted, .. } =
2684            ChatCompletionDeleted::deserialize(deserializer)?;
2685        Ok(Self { id, deleted })
2686    }
2687}
2688impl serde::Serialize for ChatCompletionDeleted {
2689    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
2690    where
2691        S: serde::Serializer,
2692    {
2693        #[serde_with::serde_as]
2694        #[derive(serde :: Serialize)]
2695        struct ChatCompletionDeleted<'a> {
2696            #[serde(rename = "object")]
2697            object: &'a crate::__types::chat_completion_deleted::Object,
2698            #[serde(rename = "id")]
2699            id: &'a String,
2700            #[serde(rename = "deleted")]
2701            deleted: &'a bool,
2702        }
2703        let Self { id, deleted } = self;
2704        ChatCompletionDeleted {
2705            object: &Default::default(),
2706            id,
2707            deleted,
2708        }
2709        .serialize(serializer)
2710    }
2711}
2712#[doc = "Specifying a particular function via `{\"name\": \"my_function\"}` forces the model to call that function.\n"]
2713#[derive(Clone, Debug, PartialEq)]
2714#[serde_with::serde_as]
2715#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
2716pub struct ChatCompletionFunctionCallOption {
2717    #[doc = "The name of the function to call."]
2718    #[serde(rename = "name")]
2719    pub name: String,
2720}
2721#[derive(Clone, Debug, PartialEq)]
2722#[serde_with::serde_as]
2723#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
2724pub struct ChatCompletionFunctions {
2725    #[doc = "A description of what the function does, used by the model to choose when and how to call the function."]
2726    #[serde(rename = "description")]
2727    #[serde(skip_serializing_if = "Option::is_none")]
2728    #[builder(default)]
2729    pub description: Option<String>,
2730    #[doc = "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."]
2731    #[serde(rename = "name")]
2732    pub name: String,
2733    #[serde(rename = "parameters")]
2734    #[serde(skip_serializing_if = "Option::is_none")]
2735    #[builder(default)]
2736    pub parameters: Option<crate::__types::FunctionParameters>,
2737}
2738#[allow(clippy::module_inception)]
2739pub(crate) mod chat_completion_list {
2740    #[doc = "The type of this object. It is always set to \"list\".\n"]
2741    #[derive(Clone, Copy, Debug, Default, PartialEq)]
2742    pub(crate) struct Object;
2743    impl_serde!(Object, "list");
2744}
2745#[doc = "An object representing a list of Chat Completions.\n"]
2746#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
2747pub struct ChatCompletionList {
2748    #[doc = "An array of chat completion objects.\n"]
2749    pub data: Vec<crate::__types::CreateChatCompletionResponse>,
2750    #[doc = "The identifier of the first chat completion in the data array."]
2751    pub first_id: String,
2752    #[doc = "The identifier of the last chat completion in the data array."]
2753    pub last_id: String,
2754    #[doc = "Indicates whether there are more Chat Completions available."]
2755    pub has_more: bool,
2756}
2757impl<'de> serde::Deserialize<'de> for ChatCompletionList {
2758    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
2759    where
2760        D: serde::Deserializer<'de>,
2761    {
2762        #[serde_with::serde_as]
2763        #[derive(serde :: Deserialize)]
2764        struct ChatCompletionList {
2765            #[serde(rename = "object")]
2766            #[allow(dead_code)]
2767            object: crate::__types::chat_completion_list::Object,
2768            #[serde(rename = "data")]
2769            data: Vec<crate::__types::CreateChatCompletionResponse>,
2770            #[serde(rename = "first_id")]
2771            first_id: String,
2772            #[serde(rename = "last_id")]
2773            last_id: String,
2774            #[serde(rename = "has_more")]
2775            has_more: bool,
2776        }
2777        let ChatCompletionList {
2778            data,
2779            first_id,
2780            last_id,
2781            has_more,
2782            ..
2783        } = ChatCompletionList::deserialize(deserializer)?;
2784        Ok(Self {
2785            data,
2786            first_id,
2787            last_id,
2788            has_more,
2789        })
2790    }
2791}
2792impl serde::Serialize for ChatCompletionList {
2793    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
2794    where
2795        S: serde::Serializer,
2796    {
2797        #[serde_with::serde_as]
2798        #[derive(serde :: Serialize)]
2799        struct ChatCompletionList<'a> {
2800            #[serde(rename = "object")]
2801            object: &'a crate::__types::chat_completion_list::Object,
2802            #[serde(rename = "data")]
2803            data: &'a Vec<crate::__types::CreateChatCompletionResponse>,
2804            #[serde(rename = "first_id")]
2805            first_id: &'a String,
2806            #[serde(rename = "last_id")]
2807            last_id: &'a String,
2808            #[serde(rename = "has_more")]
2809            has_more: &'a bool,
2810        }
2811        let Self {
2812            data,
2813            first_id,
2814            last_id,
2815            has_more,
2816        } = self;
2817        ChatCompletionList {
2818            object: &Default::default(),
2819            data,
2820            first_id,
2821            last_id,
2822            has_more,
2823        }
2824        .serialize(serializer)
2825    }
2826}
2827#[allow(clippy::module_inception)]
2828pub mod chat_completion_message_custom_tool_call {
2829    #[doc = "The type of the tool. Always `custom`."]
2830    #[derive(Clone, Copy, Debug, Default, PartialEq)]
2831    pub(crate) struct Type;
2832    impl_serde!(Type, "custom");
2833    #[doc = "The custom tool that the model called."]
2834    #[derive(Clone, Debug, PartialEq)]
2835    #[serde_with::serde_as]
2836    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
2837    pub struct Custom {
2838        #[doc = "The name of the custom tool to call."]
2839        #[serde(rename = "name")]
2840        pub name: String,
2841        #[doc = "The input for the custom tool call generated by the model."]
2842        #[serde(rename = "input")]
2843        pub input: String,
2844    }
2845}
2846#[doc = "A call to a custom tool created by the model.\n"]
2847#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
2848pub struct ChatCompletionMessageCustomToolCall {
2849    #[doc = "The ID of the tool call."]
2850    pub id: String,
2851    #[doc = "The custom tool that the model called."]
2852    pub custom: crate::__types::chat_completion_message_custom_tool_call::Custom,
2853}
2854impl<'de> serde::Deserialize<'de> for ChatCompletionMessageCustomToolCall {
2855    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
2856    where
2857        D: serde::Deserializer<'de>,
2858    {
2859        #[serde_with::serde_as]
2860        #[derive(serde :: Deserialize)]
2861        struct ChatCompletionMessageCustomToolCall {
2862            #[serde(rename = "id")]
2863            id: String,
2864            #[serde(rename = "type")]
2865            #[allow(dead_code)]
2866            r#type: crate::__types::chat_completion_message_custom_tool_call::Type,
2867            #[serde(rename = "custom")]
2868            custom: crate::__types::chat_completion_message_custom_tool_call::Custom,
2869        }
2870        let ChatCompletionMessageCustomToolCall { id, custom, .. } =
2871            ChatCompletionMessageCustomToolCall::deserialize(deserializer)?;
2872        Ok(Self { id, custom })
2873    }
2874}
2875impl serde::Serialize for ChatCompletionMessageCustomToolCall {
2876    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
2877    where
2878        S: serde::Serializer,
2879    {
2880        #[serde_with::serde_as]
2881        #[derive(serde :: Serialize)]
2882        struct ChatCompletionMessageCustomToolCall<'a> {
2883            #[serde(rename = "id")]
2884            id: &'a String,
2885            #[serde(rename = "type")]
2886            r#type: &'a crate::__types::chat_completion_message_custom_tool_call::Type,
2887            #[serde(rename = "custom")]
2888            custom: &'a crate::__types::chat_completion_message_custom_tool_call::Custom,
2889        }
2890        let Self { id, custom } = self;
2891        ChatCompletionMessageCustomToolCall {
2892            id,
2893            r#type: &Default::default(),
2894            custom,
2895        }
2896        .serialize(serializer)
2897    }
2898}
2899#[allow(clippy::module_inception)]
2900pub mod chat_completion_message_list {
2901    #[doc = "The type of this object. It is always set to \"list\".\n"]
2902    #[derive(Clone, Copy, Debug, Default, PartialEq)]
2903    pub(crate) struct Object;
2904    impl_serde!(Object, "list");
2905    #[allow(clippy::module_inception)]
2906    pub mod data {
2907        #[allow(clippy::module_inception)]
2908        pub mod item {
2909            #[allow(clippy::module_inception)]
2910            pub mod annotations {
2911                #[allow(clippy::module_inception)]
2912                pub mod item {
2913                    #[doc = "The type of the URL citation. Always `url_citation`."]
2914                    #[derive(Clone, Copy, Debug, Default, PartialEq)]
2915                    pub(crate) struct Type;
2916                    impl_serde!(Type, "url_citation");
2917                    #[doc = "A URL citation when using web search."]
2918                    #[derive(Clone, Debug, PartialEq)]
2919                    #[serde_with::serde_as]
2920                    #[derive(
2921                        serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder,
2922                    )]
2923                    pub struct UrlCitation {
2924                        #[doc = "The index of the last character of the URL citation in the message."]
2925                        #[serde(rename = "end_index")]
2926                        pub end_index: i64,
2927                        #[doc = "The index of the first character of the URL citation in the message."]
2928                        #[serde(rename = "start_index")]
2929                        pub start_index: i64,
2930                        #[doc = "The URL of the web resource."]
2931                        #[serde(rename = "url")]
2932                        pub url: String,
2933                        #[doc = "The title of the web resource."]
2934                        #[serde(rename = "title")]
2935                        pub title: String,
2936                    }
2937                }
2938                #[doc = "A URL citation when using web search.\n"]
2939                #[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
2940                pub struct Item { # [doc = "A URL citation when using web search."] pub url_citation : crate :: __types :: chat_completion_message_list :: data :: item :: annotations :: item :: UrlCitation }
2941                impl<'de> serde::Deserialize<'de> for Item {
2942                    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
2943                    where
2944                        D: serde::Deserializer<'de>,
2945                    {
2946                        #[serde_with::serde_as]
2947                        #[derive(serde :: Deserialize)]
2948                        struct Item { # [serde (rename = "type")] # [allow (dead_code)] r#type : crate :: __types :: chat_completion_message_list :: data :: item :: annotations :: item :: Type , # [serde (rename = "url_citation")] url_citation : crate :: __types :: chat_completion_message_list :: data :: item :: annotations :: item :: UrlCitation }
2949                        let Item { url_citation, .. } = Item::deserialize(deserializer)?;
2950                        Ok(Self { url_citation })
2951                    }
2952                }
2953                impl serde::Serialize for Item {
2954                    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
2955                    where
2956                        S: serde::Serializer,
2957                    {
2958                        #[serde_with::serde_as]
2959                        #[derive(serde :: Serialize)]
2960                        struct Item < 'a > { # [serde (rename = "type")] r#type : & 'a crate :: __types :: chat_completion_message_list :: data :: item :: annotations :: item :: Type , # [serde (rename = "url_citation")] url_citation : & 'a crate :: __types :: chat_completion_message_list :: data :: item :: annotations :: item :: UrlCitation }
2961                        let Self { url_citation } = self;
2962                        Item {
2963                            r#type: &Default::default(),
2964                            url_citation,
2965                        }
2966                        .serialize(serializer)
2967                    }
2968                }
2969            }
2970            #[doc = "The role of the author of this message."]
2971            #[derive(Clone, Copy, Debug, Default, PartialEq)]
2972            pub(crate) struct Role;
2973            impl_serde!(Role, "assistant");
2974            #[doc = "Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model."]
2975            #[derive(Clone, Debug, PartialEq)]
2976            #[serde_with::serde_as]
2977            #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
2978            pub struct FunctionCall {
2979                #[doc = "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."]
2980                #[serde(rename = "arguments")]
2981                pub arguments: String,
2982                #[doc = "The name of the function to call."]
2983                #[serde(rename = "name")]
2984                pub name: String,
2985            }
2986            #[doc = "If the audio output modality is requested, this object contains data\nabout the audio response from the model. [Learn more](https://platform.openai.com/docs/guides/audio).\n"]
2987            #[derive(Clone, Debug, PartialEq)]
2988            #[serde_with::serde_as]
2989            #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
2990            pub struct Audio {
2991                #[doc = "Unique identifier for this audio response."]
2992                #[serde(rename = "id")]
2993                pub id: String,
2994                #[doc = "The Unix timestamp (in seconds) for when this audio response will\nno longer be accessible on the server for use in multi-turn\nconversations.\n"]
2995                #[serde(rename = "expires_at")]
2996                pub expires_at: i64,
2997                #[doc = "Base64 encoded audio bytes generated by the model, in the format\nspecified in the request.\n"]
2998                #[serde(rename = "data")]
2999                pub data: String,
3000                #[doc = "Transcript of the audio generated by the model."]
3001                #[serde(rename = "transcript")]
3002                pub transcript: String,
3003            }
3004            #[allow(clippy::module_inception)]
3005            pub mod content_parts {
3006                #[derive(Clone, Debug, PartialEq)]
3007                #[serde_with::serde_as]
3008                #[derive(serde :: Deserialize, serde :: Serialize)]
3009                #[serde(untagged)]
3010                #[allow(clippy::large_enum_variant)]
3011                pub enum Item {
3012                    Text(crate::__types::ChatCompletionRequestMessageContentPartText),
3013                    ImageUrl(crate::__types::ChatCompletionRequestMessageContentPartImage),
3014                }
3015            }
3016        }
3017        #[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
3018        pub struct Item {
3019            #[doc = "The contents of the message."]
3020            #[builder(default)]
3021            pub content: Option<String>,
3022            #[doc = "The refusal message generated by the model."]
3023            #[builder(default)]
3024            pub refusal: Option<String>,
3025            #[builder(default)]
3026            pub tool_calls: Option<crate::__types::ChatCompletionMessageToolCalls>,
3027            #[doc = "Annotations for the message, when applicable, as when using the\n[web search tool](https://platform.openai.com/docs/guides/tools-web-search?api-mode=chat).\n"]
3028            #[builder(default)]
3029            pub annotations: Option<
3030                Vec<crate::__types::chat_completion_message_list::data::item::annotations::Item>,
3031            >,
3032            #[doc = "Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model."]
3033            #[builder(default)]
3034            pub function_call:
3035                Option<crate::__types::chat_completion_message_list::data::item::FunctionCall>,
3036            #[doc = "If the audio output modality is requested, this object contains data\nabout the audio response from the model. [Learn more](https://platform.openai.com/docs/guides/audio).\n"]
3037            #[builder(default)]
3038            pub audio: Option<crate::__types::chat_completion_message_list::data::item::Audio>,
3039            #[doc = "The identifier of the chat message."]
3040            pub id: String,
3041            #[doc = "If a content parts array was provided, this is an array of `text` and `image_url` parts. \nOtherwise, null.\n"]
3042            #[builder(default)]
3043            pub content_parts: Option<
3044                Vec<crate::__types::chat_completion_message_list::data::item::content_parts::Item>,
3045            >,
3046        }
3047        impl<'de> serde::Deserialize<'de> for Item {
3048            fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
3049            where
3050                D: serde::Deserializer<'de>,
3051            {
3052                #[serde_with::serde_as]
3053                #[derive(serde :: Deserialize)]
3054                struct Item { # [serde (rename = "content")] content : Option < String > , # [serde (rename = "refusal")] refusal : Option < String > , # [serde (rename = "tool_calls")] tool_calls : Option < crate :: __types :: ChatCompletionMessageToolCalls > , # [serde (rename = "annotations")] annotations : Option < Vec < crate :: __types :: chat_completion_message_list :: data :: item :: annotations :: Item > > , # [serde (rename = "role")] # [allow (dead_code)] role : crate :: __types :: chat_completion_message_list :: data :: item :: Role , # [serde (rename = "function_call")] function_call : Option < crate :: __types :: chat_completion_message_list :: data :: item :: FunctionCall > , # [serde (rename = "audio")] audio : Option < crate :: __types :: chat_completion_message_list :: data :: item :: Audio > , # [serde (rename = "id")] id : String , # [serde (rename = "content_parts")] content_parts : Option < Vec < crate :: __types :: chat_completion_message_list :: data :: item :: content_parts :: Item > > }
3055                let Item {
3056                    content,
3057                    refusal,
3058                    tool_calls,
3059                    annotations,
3060                    function_call,
3061                    audio,
3062                    id,
3063                    content_parts,
3064                    ..
3065                } = Item::deserialize(deserializer)?;
3066                Ok(Self {
3067                    content,
3068                    refusal,
3069                    tool_calls,
3070                    annotations,
3071                    function_call,
3072                    audio,
3073                    id,
3074                    content_parts,
3075                })
3076            }
3077        }
3078        impl serde::Serialize for Item {
3079            fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
3080            where
3081                S: serde::Serializer,
3082            {
3083                #[serde_with::serde_as]
3084                #[derive(serde :: Serialize)]
3085                struct Item < 'a > { # [serde (rename = "content")] # [serde (skip_serializing_if = "Option::is_none")] content : & 'a Option < String > , # [serde (rename = "refusal")] # [serde (skip_serializing_if = "Option::is_none")] refusal : & 'a Option < String > , # [serde (rename = "tool_calls")] # [serde (skip_serializing_if = "Option::is_none")] tool_calls : & 'a Option < crate :: __types :: ChatCompletionMessageToolCalls > , # [serde (rename = "annotations")] # [serde (skip_serializing_if = "Option::is_none")] annotations : & 'a Option < Vec < crate :: __types :: chat_completion_message_list :: data :: item :: annotations :: Item > > , # [serde (rename = "role")] role : & 'a crate :: __types :: chat_completion_message_list :: data :: item :: Role , # [serde (rename = "function_call")] # [serde (skip_serializing_if = "Option::is_none")] function_call : & 'a Option < crate :: __types :: chat_completion_message_list :: data :: item :: FunctionCall > , # [serde (rename = "audio")] # [serde (skip_serializing_if = "Option::is_none")] audio : & 'a Option < crate :: __types :: chat_completion_message_list :: data :: item :: Audio > , # [serde (rename = "id")] id : & 'a String , # [serde (rename = "content_parts")] # [serde (skip_serializing_if = "Option::is_none")] content_parts : & 'a Option < Vec < crate :: __types :: chat_completion_message_list :: data :: item :: content_parts :: Item > > }
3086                let Self {
3087                    content,
3088                    refusal,
3089                    tool_calls,
3090                    annotations,
3091                    function_call,
3092                    audio,
3093                    id,
3094                    content_parts,
3095                } = self;
3096                Item {
3097                    content,
3098                    refusal,
3099                    tool_calls,
3100                    annotations,
3101                    role: &Default::default(),
3102                    function_call,
3103                    audio,
3104                    id,
3105                    content_parts,
3106                }
3107                .serialize(serializer)
3108            }
3109        }
3110    }
3111}
3112#[doc = "An object representing a list of chat completion messages.\n"]
3113#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
3114pub struct ChatCompletionMessageList {
3115    #[doc = "An array of chat completion message objects.\n"]
3116    pub data: Vec<crate::__types::chat_completion_message_list::data::Item>,
3117    #[doc = "The identifier of the first chat message in the data array."]
3118    pub first_id: String,
3119    #[doc = "The identifier of the last chat message in the data array."]
3120    pub last_id: String,
3121    #[doc = "Indicates whether there are more chat messages available."]
3122    pub has_more: bool,
3123}
3124impl<'de> serde::Deserialize<'de> for ChatCompletionMessageList {
3125    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
3126    where
3127        D: serde::Deserializer<'de>,
3128    {
3129        #[serde_with::serde_as]
3130        #[derive(serde :: Deserialize)]
3131        struct ChatCompletionMessageList {
3132            #[serde(rename = "object")]
3133            #[allow(dead_code)]
3134            object: crate::__types::chat_completion_message_list::Object,
3135            #[serde(rename = "data")]
3136            data: Vec<crate::__types::chat_completion_message_list::data::Item>,
3137            #[serde(rename = "first_id")]
3138            first_id: String,
3139            #[serde(rename = "last_id")]
3140            last_id: String,
3141            #[serde(rename = "has_more")]
3142            has_more: bool,
3143        }
3144        let ChatCompletionMessageList {
3145            data,
3146            first_id,
3147            last_id,
3148            has_more,
3149            ..
3150        } = ChatCompletionMessageList::deserialize(deserializer)?;
3151        Ok(Self {
3152            data,
3153            first_id,
3154            last_id,
3155            has_more,
3156        })
3157    }
3158}
3159impl serde::Serialize for ChatCompletionMessageList {
3160    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
3161    where
3162        S: serde::Serializer,
3163    {
3164        #[serde_with::serde_as]
3165        #[derive(serde :: Serialize)]
3166        struct ChatCompletionMessageList<'a> {
3167            #[serde(rename = "object")]
3168            object: &'a crate::__types::chat_completion_message_list::Object,
3169            #[serde(rename = "data")]
3170            data: &'a Vec<crate::__types::chat_completion_message_list::data::Item>,
3171            #[serde(rename = "first_id")]
3172            first_id: &'a String,
3173            #[serde(rename = "last_id")]
3174            last_id: &'a String,
3175            #[serde(rename = "has_more")]
3176            has_more: &'a bool,
3177        }
3178        let Self {
3179            data,
3180            first_id,
3181            last_id,
3182            has_more,
3183        } = self;
3184        ChatCompletionMessageList {
3185            object: &Default::default(),
3186            data,
3187            first_id,
3188            last_id,
3189            has_more,
3190        }
3191        .serialize(serializer)
3192    }
3193}
3194#[allow(clippy::module_inception)]
3195pub mod chat_completion_message_tool_call {
3196    #[doc = "The type of the tool. Currently, only `function` is supported."]
3197    #[derive(Clone, Copy, Debug, Default, PartialEq)]
3198    pub(crate) struct Type;
3199    impl_serde!(Type, "function");
3200    #[doc = "The function that the model called."]
3201    #[derive(Clone, Debug, PartialEq)]
3202    #[serde_with::serde_as]
3203    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
3204    pub struct Function {
3205        #[doc = "The name of the function to call."]
3206        #[serde(rename = "name")]
3207        pub name: String,
3208        #[doc = "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."]
3209        #[serde(rename = "arguments")]
3210        pub arguments: String,
3211    }
3212}
3213#[doc = "A call to a function tool created by the model.\n"]
3214#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
3215pub struct ChatCompletionMessageToolCall {
3216    #[doc = "The ID of the tool call."]
3217    pub id: String,
3218    #[doc = "The function that the model called."]
3219    pub function: crate::__types::chat_completion_message_tool_call::Function,
3220}
3221impl<'de> serde::Deserialize<'de> for ChatCompletionMessageToolCall {
3222    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
3223    where
3224        D: serde::Deserializer<'de>,
3225    {
3226        #[serde_with::serde_as]
3227        #[derive(serde :: Deserialize)]
3228        struct ChatCompletionMessageToolCall {
3229            #[serde(rename = "id")]
3230            id: String,
3231            #[serde(rename = "type")]
3232            #[allow(dead_code)]
3233            r#type: crate::__types::chat_completion_message_tool_call::Type,
3234            #[serde(rename = "function")]
3235            function: crate::__types::chat_completion_message_tool_call::Function,
3236        }
3237        let ChatCompletionMessageToolCall { id, function, .. } =
3238            ChatCompletionMessageToolCall::deserialize(deserializer)?;
3239        Ok(Self { id, function })
3240    }
3241}
3242impl serde::Serialize for ChatCompletionMessageToolCall {
3243    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
3244    where
3245        S: serde::Serializer,
3246    {
3247        #[serde_with::serde_as]
3248        #[derive(serde :: Serialize)]
3249        struct ChatCompletionMessageToolCall<'a> {
3250            #[serde(rename = "id")]
3251            id: &'a String,
3252            #[serde(rename = "type")]
3253            r#type: &'a crate::__types::chat_completion_message_tool_call::Type,
3254            #[serde(rename = "function")]
3255            function: &'a crate::__types::chat_completion_message_tool_call::Function,
3256        }
3257        let Self { id, function } = self;
3258        ChatCompletionMessageToolCall {
3259            id,
3260            r#type: &Default::default(),
3261            function,
3262        }
3263        .serialize(serializer)
3264    }
3265}
3266#[allow(clippy::module_inception)]
3267pub mod chat_completion_message_tool_call_chunk {
3268    #[doc = "The type of the tool. Currently, only `function` is supported."]
3269    #[derive(Clone, Copy, Debug, Default, PartialEq)]
3270    pub struct Type;
3271    impl_serde!(Type, "function");
3272    #[derive(Clone, Debug, Default, PartialEq)]
3273    #[serde_with::serde_as]
3274    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
3275    pub struct Function {
3276        #[doc = "The name of the function to call."]
3277        #[serde(rename = "name")]
3278        #[serde(skip_serializing_if = "Option::is_none")]
3279        #[builder(default)]
3280        pub name: Option<String>,
3281        #[doc = "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."]
3282        #[serde(rename = "arguments")]
3283        #[serde(skip_serializing_if = "Option::is_none")]
3284        #[builder(default)]
3285        pub arguments: Option<String>,
3286    }
3287}
3288#[derive(Clone, Debug, PartialEq)]
3289#[serde_with::serde_as]
3290#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
3291pub struct ChatCompletionMessageToolCallChunk {
3292    #[serde(rename = "index")]
3293    pub index: i64,
3294    #[doc = "The ID of the tool call."]
3295    #[serde(rename = "id")]
3296    #[serde(skip_serializing_if = "Option::is_none")]
3297    #[builder(default)]
3298    pub id: Option<String>,
3299    #[doc = "The type of the tool. Currently, only `function` is supported."]
3300    #[serde(rename = "type")]
3301    #[serde(skip_serializing_if = "Option::is_none")]
3302    #[builder(default)]
3303    pub r#type: Option<crate::__types::chat_completion_message_tool_call_chunk::Type>,
3304    #[serde(rename = "function")]
3305    #[serde(skip_serializing_if = "Option::is_none")]
3306    #[builder(default)]
3307    pub function: Option<crate::__types::chat_completion_message_tool_call_chunk::Function>,
3308}
3309#[allow(clippy::module_inception)]
3310pub mod chat_completion_message_tool_calls {
3311    #[derive(Clone, Debug, PartialEq)]
3312    #[serde_with::serde_as]
3313    #[derive(serde :: Deserialize, serde :: Serialize)]
3314    #[serde(untagged)]
3315    #[allow(clippy::large_enum_variant)]
3316    pub enum Item {
3317        Function(crate::__types::ChatCompletionMessageToolCall),
3318        Custom(crate::__types::ChatCompletionMessageCustomToolCall),
3319    }
3320}
3321#[doc = "The tool calls generated by the model, such as function calls."]
3322pub type ChatCompletionMessageToolCalls =
3323    Vec<crate::__types::chat_completion_message_tool_calls::Item>;
3324#[allow(clippy::module_inception)]
3325pub mod chat_completion_modalities {
3326    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
3327    pub enum Item {
3328        #[doc = "`text`"]
3329        #[serde(rename = "text")]
3330        Text,
3331        #[doc = "`audio`"]
3332        #[serde(rename = "audio")]
3333        Audio,
3334    }
3335}
3336#[doc = "Output types that you would like the model to generate for this request.\nMost models are capable of generating text, which is the default:\n\n`[\"text\"]`\n\nThe `gpt-4o-audio-preview` model can also be used to [generate audio](https://platform.openai.com/docs/guides/audio). To\nrequest that this model generate both text and audio responses, you can\nuse:\n\n`[\"text\", \"audio\"]`\n"]
3337pub type ChatCompletionModalities = Vec<crate::__types::chat_completion_modalities::Item>;
3338#[allow(clippy::module_inception)]
3339pub mod chat_completion_named_tool_choice {
3340    #[doc = "For function calling, the type is always `function`."]
3341    #[derive(Clone, Copy, Debug, Default, PartialEq)]
3342    pub(crate) struct Type;
3343    impl_serde!(Type, "function");
3344    #[derive(Clone, Debug, PartialEq)]
3345    #[serde_with::serde_as]
3346    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
3347    pub struct Function {
3348        #[doc = "The name of the function to call."]
3349        #[serde(rename = "name")]
3350        pub name: String,
3351    }
3352}
3353#[doc = "Specifies a tool the model should use. Use to force the model to call a specific function."]
3354#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
3355pub struct ChatCompletionNamedToolChoice {
3356    pub function: crate::__types::chat_completion_named_tool_choice::Function,
3357}
3358impl<'de> serde::Deserialize<'de> for ChatCompletionNamedToolChoice {
3359    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
3360    where
3361        D: serde::Deserializer<'de>,
3362    {
3363        #[serde_with::serde_as]
3364        #[derive(serde :: Deserialize)]
3365        struct ChatCompletionNamedToolChoice {
3366            #[serde(rename = "type")]
3367            #[allow(dead_code)]
3368            r#type: crate::__types::chat_completion_named_tool_choice::Type,
3369            #[serde(rename = "function")]
3370            function: crate::__types::chat_completion_named_tool_choice::Function,
3371        }
3372        let ChatCompletionNamedToolChoice { function, .. } =
3373            ChatCompletionNamedToolChoice::deserialize(deserializer)?;
3374        Ok(Self { function })
3375    }
3376}
3377impl serde::Serialize for ChatCompletionNamedToolChoice {
3378    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
3379    where
3380        S: serde::Serializer,
3381    {
3382        #[serde_with::serde_as]
3383        #[derive(serde :: Serialize)]
3384        struct ChatCompletionNamedToolChoice<'a> {
3385            #[serde(rename = "type")]
3386            r#type: &'a crate::__types::chat_completion_named_tool_choice::Type,
3387            #[serde(rename = "function")]
3388            function: &'a crate::__types::chat_completion_named_tool_choice::Function,
3389        }
3390        let Self { function } = self;
3391        ChatCompletionNamedToolChoice {
3392            r#type: &Default::default(),
3393            function,
3394        }
3395        .serialize(serializer)
3396    }
3397}
3398#[allow(clippy::module_inception)]
3399pub mod chat_completion_named_tool_choice_custom {
3400    #[doc = "For custom tool calling, the type is always `custom`."]
3401    #[derive(Clone, Copy, Debug, Default, PartialEq)]
3402    pub(crate) struct Type;
3403    impl_serde!(Type, "custom");
3404    #[derive(Clone, Debug, PartialEq)]
3405    #[serde_with::serde_as]
3406    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
3407    pub struct Custom {
3408        #[doc = "The name of the custom tool to call."]
3409        #[serde(rename = "name")]
3410        pub name: String,
3411    }
3412}
3413#[doc = "Specifies a tool the model should use. Use to force the model to call a specific custom tool."]
3414#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
3415pub struct ChatCompletionNamedToolChoiceCustom {
3416    pub custom: crate::__types::chat_completion_named_tool_choice_custom::Custom,
3417}
3418impl<'de> serde::Deserialize<'de> for ChatCompletionNamedToolChoiceCustom {
3419    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
3420    where
3421        D: serde::Deserializer<'de>,
3422    {
3423        #[serde_with::serde_as]
3424        #[derive(serde :: Deserialize)]
3425        struct ChatCompletionNamedToolChoiceCustom {
3426            #[serde(rename = "type")]
3427            #[allow(dead_code)]
3428            r#type: crate::__types::chat_completion_named_tool_choice_custom::Type,
3429            #[serde(rename = "custom")]
3430            custom: crate::__types::chat_completion_named_tool_choice_custom::Custom,
3431        }
3432        let ChatCompletionNamedToolChoiceCustom { custom, .. } =
3433            ChatCompletionNamedToolChoiceCustom::deserialize(deserializer)?;
3434        Ok(Self { custom })
3435    }
3436}
3437impl serde::Serialize for ChatCompletionNamedToolChoiceCustom {
3438    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
3439    where
3440        S: serde::Serializer,
3441    {
3442        #[serde_with::serde_as]
3443        #[derive(serde :: Serialize)]
3444        struct ChatCompletionNamedToolChoiceCustom<'a> {
3445            #[serde(rename = "type")]
3446            r#type: &'a crate::__types::chat_completion_named_tool_choice_custom::Type,
3447            #[serde(rename = "custom")]
3448            custom: &'a crate::__types::chat_completion_named_tool_choice_custom::Custom,
3449        }
3450        let Self { custom } = self;
3451        ChatCompletionNamedToolChoiceCustom {
3452            r#type: &Default::default(),
3453            custom,
3454        }
3455        .serialize(serializer)
3456    }
3457}
3458#[allow(clippy::module_inception)]
3459pub mod chat_completion_request_assistant_message {
3460    #[doc = "The contents of the assistant message. Required unless `tool_calls` or `function_call` is specified.\n"]
3461    #[derive(Clone, Debug, PartialEq)]
3462    #[serde_with::serde_as]
3463    #[derive(serde :: Deserialize, serde :: Serialize)]
3464    #[serde(untagged)]
3465    #[allow(clippy::large_enum_variant)]
3466    pub enum Content {
3467        #[doc = "The contents of the assistant message."]
3468        String(String),
3469        #[doc = "An array of content parts with a defined type. Can be one or more of type `text`, or exactly one of type `refusal`."]
3470        Array(Vec<crate::__types::ChatCompletionRequestAssistantMessageContentPart>),
3471    }
3472    #[doc = "The role of the messages author, in this case `assistant`."]
3473    #[derive(Clone, Copy, Debug, Default, PartialEq)]
3474    pub(crate) struct Role;
3475    impl_serde!(Role, "assistant");
3476    #[doc = "Data about a previous audio response from the model. \n[Learn more](https://platform.openai.com/docs/guides/audio).\n"]
3477    #[derive(Clone, Debug, PartialEq)]
3478    #[serde_with::serde_as]
3479    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
3480    pub struct Audio {
3481        #[doc = "Unique identifier for a previous audio response from the model.\n"]
3482        #[serde(rename = "id")]
3483        pub id: String,
3484    }
3485    #[doc = "Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model."]
3486    #[derive(Clone, Debug, PartialEq)]
3487    #[serde_with::serde_as]
3488    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
3489    pub struct FunctionCall {
3490        #[doc = "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."]
3491        #[serde(rename = "arguments")]
3492        pub arguments: String,
3493        #[doc = "The name of the function to call."]
3494        #[serde(rename = "name")]
3495        pub name: String,
3496    }
3497}
3498#[doc = "Messages sent by the model in response to user messages.\n"]
3499#[derive(Clone, Debug, Default, PartialEq, typed_builder :: TypedBuilder)]
3500pub struct ChatCompletionRequestAssistantMessage {
3501    #[doc = "The contents of the assistant message. Required unless `tool_calls` or `function_call` is specified.\n"]
3502    #[builder(default)]
3503    pub content: Option<crate::__types::chat_completion_request_assistant_message::Content>,
3504    #[doc = "The refusal message by the assistant."]
3505    #[builder(default)]
3506    pub refusal: Option<String>,
3507    #[doc = "An optional name for the participant. Provides the model information to differentiate between participants of the same role."]
3508    #[builder(default)]
3509    pub name: Option<String>,
3510    #[doc = "Data about a previous audio response from the model. \n[Learn more](https://platform.openai.com/docs/guides/audio).\n"]
3511    #[builder(default)]
3512    pub audio: Option<crate::__types::chat_completion_request_assistant_message::Audio>,
3513    #[builder(default)]
3514    pub tool_calls: Option<crate::__types::ChatCompletionMessageToolCalls>,
3515    #[doc = "Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model."]
3516    #[builder(default)]
3517    pub function_call:
3518        Option<crate::__types::chat_completion_request_assistant_message::FunctionCall>,
3519}
3520impl<'de> serde::Deserialize<'de> for ChatCompletionRequestAssistantMessage {
3521    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
3522    where
3523        D: serde::Deserializer<'de>,
3524    {
3525        #[serde_with::serde_as]
3526        #[derive(serde :: Deserialize)]
3527        struct ChatCompletionRequestAssistantMessage {
3528            #[serde(rename = "content")]
3529            content: Option<crate::__types::chat_completion_request_assistant_message::Content>,
3530            #[serde(rename = "refusal")]
3531            refusal: Option<String>,
3532            #[serde(rename = "role")]
3533            #[allow(dead_code)]
3534            role: crate::__types::chat_completion_request_assistant_message::Role,
3535            #[serde(rename = "name")]
3536            name: Option<String>,
3537            #[serde(rename = "audio")]
3538            audio: Option<crate::__types::chat_completion_request_assistant_message::Audio>,
3539            #[serde(rename = "tool_calls")]
3540            tool_calls: Option<crate::__types::ChatCompletionMessageToolCalls>,
3541            #[serde(rename = "function_call")]
3542            function_call:
3543                Option<crate::__types::chat_completion_request_assistant_message::FunctionCall>,
3544        }
3545        let ChatCompletionRequestAssistantMessage {
3546            content,
3547            refusal,
3548            name,
3549            audio,
3550            tool_calls,
3551            function_call,
3552            ..
3553        } = ChatCompletionRequestAssistantMessage::deserialize(deserializer)?;
3554        Ok(Self {
3555            content,
3556            refusal,
3557            name,
3558            audio,
3559            tool_calls,
3560            function_call,
3561        })
3562    }
3563}
3564impl serde::Serialize for ChatCompletionRequestAssistantMessage {
3565    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
3566    where
3567        S: serde::Serializer,
3568    {
3569        #[serde_with::serde_as]
3570        #[derive(serde :: Serialize)]
3571        struct ChatCompletionRequestAssistantMessage<'a> {
3572            #[serde(rename = "content")]
3573            #[serde(skip_serializing_if = "Option::is_none")]
3574            content: &'a Option<crate::__types::chat_completion_request_assistant_message::Content>,
3575            #[serde(rename = "refusal")]
3576            #[serde(skip_serializing_if = "Option::is_none")]
3577            refusal: &'a Option<String>,
3578            #[serde(rename = "role")]
3579            role: &'a crate::__types::chat_completion_request_assistant_message::Role,
3580            #[serde(rename = "name")]
3581            #[serde(skip_serializing_if = "Option::is_none")]
3582            name: &'a Option<String>,
3583            #[serde(rename = "audio")]
3584            #[serde(skip_serializing_if = "Option::is_none")]
3585            audio: &'a Option<crate::__types::chat_completion_request_assistant_message::Audio>,
3586            #[serde(rename = "tool_calls")]
3587            #[serde(skip_serializing_if = "Option::is_none")]
3588            tool_calls: &'a Option<crate::__types::ChatCompletionMessageToolCalls>,
3589            #[serde(rename = "function_call")]
3590            #[serde(skip_serializing_if = "Option::is_none")]
3591            function_call:
3592                &'a Option<crate::__types::chat_completion_request_assistant_message::FunctionCall>,
3593        }
3594        let Self {
3595            content,
3596            refusal,
3597            name,
3598            audio,
3599            tool_calls,
3600            function_call,
3601        } = self;
3602        ChatCompletionRequestAssistantMessage {
3603            content,
3604            refusal,
3605            role: &Default::default(),
3606            name,
3607            audio,
3608            tool_calls,
3609            function_call,
3610        }
3611        .serialize(serializer)
3612    }
3613}
3614#[derive(Clone, Debug, PartialEq)]
3615#[serde_with::serde_as]
3616#[derive(serde :: Deserialize, serde :: Serialize)]
3617#[serde(untagged)]
3618#[allow(clippy::large_enum_variant)]
3619pub enum ChatCompletionRequestAssistantMessageContentPart {
3620    Text(crate::__types::ChatCompletionRequestMessageContentPartText),
3621    Refusal(crate::__types::ChatCompletionRequestMessageContentPartRefusal),
3622}
3623#[allow(clippy::module_inception)]
3624pub mod chat_completion_request_developer_message {
3625    #[doc = "The contents of the developer message."]
3626    #[derive(Clone, Debug, PartialEq)]
3627    #[serde_with::serde_as]
3628    #[derive(serde :: Deserialize, serde :: Serialize)]
3629    #[serde(untagged)]
3630    #[allow(clippy::large_enum_variant)]
3631    pub enum Content {
3632        #[doc = "The contents of the developer message."]
3633        String(String),
3634        #[doc = "An array of content parts with a defined type. For developer messages, only type `text` is supported."]
3635        Array(Vec<crate::__types::ChatCompletionRequestMessageContentPartText>),
3636    }
3637    #[doc = "The role of the messages author, in this case `developer`."]
3638    #[derive(Clone, Copy, Debug, Default, PartialEq)]
3639    pub(crate) struct Role;
3640    impl_serde!(Role, "developer");
3641}
3642#[doc = "Developer-provided instructions that the model should follow, regardless of\nmessages sent by the user. With o1 models and newer, `developer` messages\nreplace the previous `system` messages.\n"]
3643#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
3644pub struct ChatCompletionRequestDeveloperMessage {
3645    #[doc = "The contents of the developer message."]
3646    pub content: crate::__types::chat_completion_request_developer_message::Content,
3647    #[doc = "An optional name for the participant. Provides the model information to differentiate between participants of the same role."]
3648    #[builder(default)]
3649    pub name: Option<String>,
3650}
3651impl<'de> serde::Deserialize<'de> for ChatCompletionRequestDeveloperMessage {
3652    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
3653    where
3654        D: serde::Deserializer<'de>,
3655    {
3656        #[serde_with::serde_as]
3657        #[derive(serde :: Deserialize)]
3658        struct ChatCompletionRequestDeveloperMessage {
3659            #[serde(rename = "content")]
3660            content: crate::__types::chat_completion_request_developer_message::Content,
3661            #[serde(rename = "role")]
3662            #[allow(dead_code)]
3663            role: crate::__types::chat_completion_request_developer_message::Role,
3664            #[serde(rename = "name")]
3665            name: Option<String>,
3666        }
3667        let ChatCompletionRequestDeveloperMessage { content, name, .. } =
3668            ChatCompletionRequestDeveloperMessage::deserialize(deserializer)?;
3669        Ok(Self { content, name })
3670    }
3671}
3672impl serde::Serialize for ChatCompletionRequestDeveloperMessage {
3673    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
3674    where
3675        S: serde::Serializer,
3676    {
3677        #[serde_with::serde_as]
3678        #[derive(serde :: Serialize)]
3679        struct ChatCompletionRequestDeveloperMessage<'a> {
3680            #[serde(rename = "content")]
3681            content: &'a crate::__types::chat_completion_request_developer_message::Content,
3682            #[serde(rename = "role")]
3683            role: &'a crate::__types::chat_completion_request_developer_message::Role,
3684            #[serde(rename = "name")]
3685            #[serde(skip_serializing_if = "Option::is_none")]
3686            name: &'a Option<String>,
3687        }
3688        let Self { content, name } = self;
3689        ChatCompletionRequestDeveloperMessage {
3690            content,
3691            role: &Default::default(),
3692            name,
3693        }
3694        .serialize(serializer)
3695    }
3696}
3697#[allow(clippy::module_inception)]
3698pub(crate) mod chat_completion_request_function_message {
3699    #[doc = "The role of the messages author, in this case `function`."]
3700    #[derive(Clone, Copy, Debug, Default, PartialEq)]
3701    pub(crate) struct Role;
3702    impl_serde!(Role, "function");
3703}
3704#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
3705pub struct ChatCompletionRequestFunctionMessage {
3706    #[doc = "The contents of the function message."]
3707    #[builder(default)]
3708    pub content: Option<String>,
3709    #[doc = "The name of the function to call."]
3710    pub name: String,
3711}
3712impl<'de> serde::Deserialize<'de> for ChatCompletionRequestFunctionMessage {
3713    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
3714    where
3715        D: serde::Deserializer<'de>,
3716    {
3717        #[serde_with::serde_as]
3718        #[derive(serde :: Deserialize)]
3719        struct ChatCompletionRequestFunctionMessage {
3720            #[serde(rename = "role")]
3721            #[allow(dead_code)]
3722            role: crate::__types::chat_completion_request_function_message::Role,
3723            #[serde(rename = "content")]
3724            content: Option<String>,
3725            #[serde(rename = "name")]
3726            name: String,
3727        }
3728        let ChatCompletionRequestFunctionMessage { content, name, .. } =
3729            ChatCompletionRequestFunctionMessage::deserialize(deserializer)?;
3730        Ok(Self { content, name })
3731    }
3732}
3733impl serde::Serialize for ChatCompletionRequestFunctionMessage {
3734    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
3735    where
3736        S: serde::Serializer,
3737    {
3738        #[serde_with::serde_as]
3739        #[derive(serde :: Serialize)]
3740        struct ChatCompletionRequestFunctionMessage<'a> {
3741            #[serde(rename = "role")]
3742            role: &'a crate::__types::chat_completion_request_function_message::Role,
3743            #[serde(rename = "content")]
3744            #[serde(skip_serializing_if = "Option::is_none")]
3745            content: &'a Option<String>,
3746            #[serde(rename = "name")]
3747            name: &'a String,
3748        }
3749        let Self { content, name } = self;
3750        ChatCompletionRequestFunctionMessage {
3751            role: &Default::default(),
3752            content,
3753            name,
3754        }
3755        .serialize(serializer)
3756    }
3757}
3758#[derive(Clone, Debug, PartialEq)]
3759#[serde_with::serde_as]
3760#[derive(serde :: Deserialize, serde :: Serialize)]
3761#[serde(untagged)]
3762#[allow(clippy::large_enum_variant)]
3763pub enum ChatCompletionRequestMessage {
3764    Developer(crate::__types::ChatCompletionRequestDeveloperMessage),
3765    System(crate::__types::ChatCompletionRequestSystemMessage),
3766    User(crate::__types::ChatCompletionRequestUserMessage),
3767    Assistant(crate::__types::ChatCompletionRequestAssistantMessage),
3768    Tool(crate::__types::ChatCompletionRequestToolMessage),
3769    Function(crate::__types::ChatCompletionRequestFunctionMessage),
3770}
3771#[allow(clippy::module_inception)]
3772pub mod chat_completion_request_message_content_part_audio {
3773    #[doc = "The type of the content part. Always `input_audio`."]
3774    #[derive(Clone, Copy, Debug, Default, PartialEq)]
3775    pub(crate) struct Type;
3776    impl_serde!(Type, "input_audio");
3777    #[allow(clippy::module_inception)]
3778    pub mod input_audio {
3779        #[doc = "The format of the encoded audio data. Currently supports \"wav\" and \"mp3\".\n"]
3780        #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
3781        pub enum Format {
3782            #[doc = "`wav`"]
3783            #[serde(rename = "wav")]
3784            Wav,
3785            #[doc = "`mp3`"]
3786            #[serde(rename = "mp3")]
3787            Mp3,
3788        }
3789    }
3790    #[derive(Clone, Debug, PartialEq)]
3791    #[serde_with::serde_as]
3792    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
3793    pub struct InputAudio {
3794        #[doc = "Base64 encoded audio data."]
3795        #[serde(rename = "data")]
3796        pub data: String,
3797        #[doc = "The format of the encoded audio data. Currently supports \"wav\" and \"mp3\".\n"]
3798        #[serde(rename = "format")]
3799        pub format:
3800            crate::__types::chat_completion_request_message_content_part_audio::input_audio::Format,
3801    }
3802}
3803#[doc = "Learn about [audio inputs](https://platform.openai.com/docs/guides/audio).\n"]
3804#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
3805pub struct ChatCompletionRequestMessageContentPartAudio {
3806    pub input_audio: crate::__types::chat_completion_request_message_content_part_audio::InputAudio,
3807}
3808impl<'de> serde::Deserialize<'de> for ChatCompletionRequestMessageContentPartAudio {
3809    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
3810    where
3811        D: serde::Deserializer<'de>,
3812    {
3813        #[serde_with::serde_as]
3814        #[derive(serde :: Deserialize)]
3815        struct ChatCompletionRequestMessageContentPartAudio {
3816            #[serde(rename = "type")]
3817            #[allow(dead_code)]
3818            r#type: crate::__types::chat_completion_request_message_content_part_audio::Type,
3819            #[serde(rename = "input_audio")]
3820            input_audio:
3821                crate::__types::chat_completion_request_message_content_part_audio::InputAudio,
3822        }
3823        let ChatCompletionRequestMessageContentPartAudio { input_audio, .. } =
3824            ChatCompletionRequestMessageContentPartAudio::deserialize(deserializer)?;
3825        Ok(Self { input_audio })
3826    }
3827}
3828impl serde::Serialize for ChatCompletionRequestMessageContentPartAudio {
3829    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
3830    where
3831        S: serde::Serializer,
3832    {
3833        #[serde_with::serde_as]
3834        #[derive(serde :: Serialize)]
3835        struct ChatCompletionRequestMessageContentPartAudio<'a> {
3836            #[serde(rename = "type")]
3837            r#type: &'a crate::__types::chat_completion_request_message_content_part_audio::Type,
3838            #[serde(rename = "input_audio")]
3839            input_audio:
3840                &'a crate::__types::chat_completion_request_message_content_part_audio::InputAudio,
3841        }
3842        let Self { input_audio } = self;
3843        ChatCompletionRequestMessageContentPartAudio {
3844            r#type: &Default::default(),
3845            input_audio,
3846        }
3847        .serialize(serializer)
3848    }
3849}
3850#[allow(clippy::module_inception)]
3851pub mod chat_completion_request_message_content_part_file {
3852    #[doc = "The type of the content part. Always `file`."]
3853    #[derive(Clone, Copy, Debug, Default, PartialEq)]
3854    pub(crate) struct Type;
3855    impl_serde!(Type, "file");
3856    #[derive(Clone, Debug, Default, PartialEq)]
3857    #[serde_with::serde_as]
3858    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
3859    pub struct File {
3860        #[doc = "The name of the file, used when passing the file to the model as a \nstring.\n"]
3861        #[serde(rename = "filename")]
3862        #[serde(skip_serializing_if = "Option::is_none")]
3863        #[builder(default)]
3864        pub filename: Option<String>,
3865        #[doc = "The base64 encoded file data, used when passing the file to the model \nas a string.\n"]
3866        #[serde(rename = "file_data")]
3867        #[serde(skip_serializing_if = "Option::is_none")]
3868        #[builder(default)]
3869        pub file_data: Option<String>,
3870        #[doc = "The ID of an uploaded file to use as input.\n"]
3871        #[serde(rename = "file_id")]
3872        #[serde(skip_serializing_if = "Option::is_none")]
3873        #[builder(default)]
3874        pub file_id: Option<String>,
3875    }
3876}
3877#[doc = "Learn about [file inputs](https://platform.openai.com/docs/guides/text) for text generation.\n"]
3878#[derive(Clone, Debug, Default, PartialEq, typed_builder :: TypedBuilder)]
3879pub struct ChatCompletionRequestMessageContentPartFile {
3880    #[builder(default)]
3881    pub file: crate::__types::chat_completion_request_message_content_part_file::File,
3882}
3883impl<'de> serde::Deserialize<'de> for ChatCompletionRequestMessageContentPartFile {
3884    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
3885    where
3886        D: serde::Deserializer<'de>,
3887    {
3888        #[serde_with::serde_as]
3889        #[derive(serde :: Deserialize)]
3890        struct ChatCompletionRequestMessageContentPartFile {
3891            #[serde(rename = "type")]
3892            #[allow(dead_code)]
3893            r#type: crate::__types::chat_completion_request_message_content_part_file::Type,
3894            #[serde(rename = "file")]
3895            file: crate::__types::chat_completion_request_message_content_part_file::File,
3896        }
3897        let ChatCompletionRequestMessageContentPartFile { file, .. } =
3898            ChatCompletionRequestMessageContentPartFile::deserialize(deserializer)?;
3899        Ok(Self { file })
3900    }
3901}
3902impl serde::Serialize for ChatCompletionRequestMessageContentPartFile {
3903    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
3904    where
3905        S: serde::Serializer,
3906    {
3907        #[serde_with::serde_as]
3908        #[derive(serde :: Serialize)]
3909        struct ChatCompletionRequestMessageContentPartFile<'a> {
3910            #[serde(rename = "type")]
3911            r#type: &'a crate::__types::chat_completion_request_message_content_part_file::Type,
3912            #[serde(rename = "file")]
3913            file: &'a crate::__types::chat_completion_request_message_content_part_file::File,
3914        }
3915        let Self { file } = self;
3916        ChatCompletionRequestMessageContentPartFile {
3917            r#type: &Default::default(),
3918            file,
3919        }
3920        .serialize(serializer)
3921    }
3922}
3923#[allow(clippy::module_inception)]
3924pub mod chat_completion_request_message_content_part_image {
3925    #[doc = "The type of the content part."]
3926    #[derive(Clone, Copy, Debug, Default, PartialEq)]
3927    pub(crate) struct Type;
3928    impl_serde!(Type, "image_url");
3929    #[allow(clippy::module_inception)]
3930    pub mod image_url {
3931        #[doc = "Specifies the detail level of the image. Learn more in the [Vision guide](https://platform.openai.com/docs/guides/vision#low-or-high-fidelity-image-understanding)."]
3932        #[derive(
3933            Clone, Copy, Debug, Default, PartialEq, serde :: Deserialize, serde :: Serialize,
3934        )]
3935        pub enum Detail {
3936            #[doc = "`auto`"]
3937            #[default]
3938            #[serde(rename = "auto")]
3939            Auto,
3940            #[doc = "`low`"]
3941            #[serde(rename = "low")]
3942            Low,
3943            #[doc = "`high`"]
3944            #[serde(rename = "high")]
3945            High,
3946        }
3947    }
3948    #[derive(Clone, Debug, PartialEq)]
3949    #[serde_with::serde_as]
3950    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
3951    pub struct ImageUrl {
3952        #[doc = "Either a URL of the image or the base64 encoded image data."]
3953        #[serde(rename = "url")]
3954        pub url: String,
3955        #[doc = "Specifies the detail level of the image. Learn more in the [Vision guide](https://platform.openai.com/docs/guides/vision#low-or-high-fidelity-image-understanding)."]
3956        #[serde(rename = "detail")]
3957        #[serde(skip_serializing_if = "Option::is_none")]
3958        #[builder(default)]
3959        pub detail: Option<
3960            crate::__types::chat_completion_request_message_content_part_image::image_url::Detail,
3961        >,
3962    }
3963}
3964#[doc = "Learn about [image inputs](https://platform.openai.com/docs/guides/vision).\n"]
3965#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
3966pub struct ChatCompletionRequestMessageContentPartImage {
3967    pub image_url: crate::__types::chat_completion_request_message_content_part_image::ImageUrl,
3968}
3969impl<'de> serde::Deserialize<'de> for ChatCompletionRequestMessageContentPartImage {
3970    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
3971    where
3972        D: serde::Deserializer<'de>,
3973    {
3974        #[serde_with::serde_as]
3975        #[derive(serde :: Deserialize)]
3976        struct ChatCompletionRequestMessageContentPartImage {
3977            #[serde(rename = "type")]
3978            #[allow(dead_code)]
3979            r#type: crate::__types::chat_completion_request_message_content_part_image::Type,
3980            #[serde(rename = "image_url")]
3981            image_url: crate::__types::chat_completion_request_message_content_part_image::ImageUrl,
3982        }
3983        let ChatCompletionRequestMessageContentPartImage { image_url, .. } =
3984            ChatCompletionRequestMessageContentPartImage::deserialize(deserializer)?;
3985        Ok(Self { image_url })
3986    }
3987}
3988impl serde::Serialize for ChatCompletionRequestMessageContentPartImage {
3989    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
3990    where
3991        S: serde::Serializer,
3992    {
3993        #[serde_with::serde_as]
3994        #[derive(serde :: Serialize)]
3995        struct ChatCompletionRequestMessageContentPartImage<'a> {
3996            #[serde(rename = "type")]
3997            r#type: &'a crate::__types::chat_completion_request_message_content_part_image::Type,
3998            #[serde(rename = "image_url")]
3999            image_url:
4000                &'a crate::__types::chat_completion_request_message_content_part_image::ImageUrl,
4001        }
4002        let Self { image_url } = self;
4003        ChatCompletionRequestMessageContentPartImage {
4004            r#type: &Default::default(),
4005            image_url,
4006        }
4007        .serialize(serializer)
4008    }
4009}
4010#[allow(clippy::module_inception)]
4011pub(crate) mod chat_completion_request_message_content_part_refusal {
4012    #[doc = "The type of the content part."]
4013    #[derive(Clone, Copy, Debug, Default, PartialEq)]
4014    pub(crate) struct Type;
4015    impl_serde!(Type, "refusal");
4016}
4017#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
4018pub struct ChatCompletionRequestMessageContentPartRefusal {
4019    #[doc = "The refusal message generated by the model."]
4020    pub refusal: String,
4021}
4022impl<'de> serde::Deserialize<'de> for ChatCompletionRequestMessageContentPartRefusal {
4023    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
4024    where
4025        D: serde::Deserializer<'de>,
4026    {
4027        #[serde_with::serde_as]
4028        #[derive(serde :: Deserialize)]
4029        struct ChatCompletionRequestMessageContentPartRefusal {
4030            #[serde(rename = "type")]
4031            #[allow(dead_code)]
4032            r#type: crate::__types::chat_completion_request_message_content_part_refusal::Type,
4033            #[serde(rename = "refusal")]
4034            refusal: String,
4035        }
4036        let ChatCompletionRequestMessageContentPartRefusal { refusal, .. } =
4037            ChatCompletionRequestMessageContentPartRefusal::deserialize(deserializer)?;
4038        Ok(Self { refusal })
4039    }
4040}
4041impl serde::Serialize for ChatCompletionRequestMessageContentPartRefusal {
4042    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
4043    where
4044        S: serde::Serializer,
4045    {
4046        #[serde_with::serde_as]
4047        #[derive(serde :: Serialize)]
4048        struct ChatCompletionRequestMessageContentPartRefusal<'a> {
4049            #[serde(rename = "type")]
4050            r#type: &'a crate::__types::chat_completion_request_message_content_part_refusal::Type,
4051            #[serde(rename = "refusal")]
4052            refusal: &'a String,
4053        }
4054        let Self { refusal } = self;
4055        ChatCompletionRequestMessageContentPartRefusal {
4056            r#type: &Default::default(),
4057            refusal,
4058        }
4059        .serialize(serializer)
4060    }
4061}
4062#[allow(clippy::module_inception)]
4063pub(crate) mod chat_completion_request_message_content_part_text {
4064    #[doc = "The type of the content part."]
4065    #[derive(Clone, Copy, Debug, Default, PartialEq)]
4066    pub(crate) struct Type;
4067    impl_serde!(Type, "text");
4068}
4069#[doc = "Learn about [text inputs](https://platform.openai.com/docs/guides/text-generation).\n"]
4070#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
4071pub struct ChatCompletionRequestMessageContentPartText {
4072    #[doc = "The text content."]
4073    pub text: String,
4074}
4075impl<'de> serde::Deserialize<'de> for ChatCompletionRequestMessageContentPartText {
4076    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
4077    where
4078        D: serde::Deserializer<'de>,
4079    {
4080        #[serde_with::serde_as]
4081        #[derive(serde :: Deserialize)]
4082        struct ChatCompletionRequestMessageContentPartText {
4083            #[serde(rename = "type")]
4084            #[allow(dead_code)]
4085            r#type: crate::__types::chat_completion_request_message_content_part_text::Type,
4086            #[serde(rename = "text")]
4087            text: String,
4088        }
4089        let ChatCompletionRequestMessageContentPartText { text, .. } =
4090            ChatCompletionRequestMessageContentPartText::deserialize(deserializer)?;
4091        Ok(Self { text })
4092    }
4093}
4094impl serde::Serialize for ChatCompletionRequestMessageContentPartText {
4095    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
4096    where
4097        S: serde::Serializer,
4098    {
4099        #[serde_with::serde_as]
4100        #[derive(serde :: Serialize)]
4101        struct ChatCompletionRequestMessageContentPartText<'a> {
4102            #[serde(rename = "type")]
4103            r#type: &'a crate::__types::chat_completion_request_message_content_part_text::Type,
4104            #[serde(rename = "text")]
4105            text: &'a String,
4106        }
4107        let Self { text } = self;
4108        ChatCompletionRequestMessageContentPartText {
4109            r#type: &Default::default(),
4110            text,
4111        }
4112        .serialize(serializer)
4113    }
4114}
4115#[allow(clippy::module_inception)]
4116pub mod chat_completion_request_system_message {
4117    #[doc = "The contents of the system message."]
4118    #[derive(Clone, Debug, PartialEq)]
4119    #[serde_with::serde_as]
4120    #[derive(serde :: Deserialize, serde :: Serialize)]
4121    #[serde(untagged)]
4122    #[allow(clippy::large_enum_variant)]
4123    pub enum Content {
4124        #[doc = "The contents of the system message."]
4125        String(String),
4126        #[doc = "An array of content parts with a defined type. For system messages, only type `text` is supported."]
4127        Array(Vec<crate::__types::ChatCompletionRequestSystemMessageContentPart>),
4128    }
4129    #[doc = "The role of the messages author, in this case `system`."]
4130    #[derive(Clone, Copy, Debug, Default, PartialEq)]
4131    pub(crate) struct Role;
4132    impl_serde!(Role, "system");
4133}
4134#[doc = "Developer-provided instructions that the model should follow, regardless of\nmessages sent by the user. With o1 models and newer, use `developer` messages\nfor this purpose instead.\n"]
4135#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
4136pub struct ChatCompletionRequestSystemMessage {
4137    #[doc = "The contents of the system message."]
4138    pub content: crate::__types::chat_completion_request_system_message::Content,
4139    #[doc = "An optional name for the participant. Provides the model information to differentiate between participants of the same role."]
4140    #[builder(default)]
4141    pub name: Option<String>,
4142}
4143impl<'de> serde::Deserialize<'de> for ChatCompletionRequestSystemMessage {
4144    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
4145    where
4146        D: serde::Deserializer<'de>,
4147    {
4148        #[serde_with::serde_as]
4149        #[derive(serde :: Deserialize)]
4150        struct ChatCompletionRequestSystemMessage {
4151            #[serde(rename = "content")]
4152            content: crate::__types::chat_completion_request_system_message::Content,
4153            #[serde(rename = "role")]
4154            #[allow(dead_code)]
4155            role: crate::__types::chat_completion_request_system_message::Role,
4156            #[serde(rename = "name")]
4157            name: Option<String>,
4158        }
4159        let ChatCompletionRequestSystemMessage { content, name, .. } =
4160            ChatCompletionRequestSystemMessage::deserialize(deserializer)?;
4161        Ok(Self { content, name })
4162    }
4163}
4164impl serde::Serialize for ChatCompletionRequestSystemMessage {
4165    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
4166    where
4167        S: serde::Serializer,
4168    {
4169        #[serde_with::serde_as]
4170        #[derive(serde :: Serialize)]
4171        struct ChatCompletionRequestSystemMessage<'a> {
4172            #[serde(rename = "content")]
4173            content: &'a crate::__types::chat_completion_request_system_message::Content,
4174            #[serde(rename = "role")]
4175            role: &'a crate::__types::chat_completion_request_system_message::Role,
4176            #[serde(rename = "name")]
4177            #[serde(skip_serializing_if = "Option::is_none")]
4178            name: &'a Option<String>,
4179        }
4180        let Self { content, name } = self;
4181        ChatCompletionRequestSystemMessage {
4182            content,
4183            role: &Default::default(),
4184            name,
4185        }
4186        .serialize(serializer)
4187    }
4188}
4189#[derive(Clone, Debug, PartialEq)]
4190#[serde_with::serde_as]
4191#[derive(serde :: Deserialize, serde :: Serialize)]
4192#[serde(untagged)]
4193#[allow(clippy::large_enum_variant)]
4194pub enum ChatCompletionRequestSystemMessageContentPart {
4195    ChatCompletionRequestMessageContentPartText(
4196        crate::__types::ChatCompletionRequestMessageContentPartText,
4197    ),
4198}
4199#[allow(clippy::module_inception)]
4200pub mod chat_completion_request_tool_message {
4201    #[doc = "The role of the messages author, in this case `tool`."]
4202    #[derive(Clone, Copy, Debug, Default, PartialEq)]
4203    pub(crate) struct Role;
4204    impl_serde!(Role, "tool");
4205    #[doc = "The contents of the tool message."]
4206    #[derive(Clone, Debug, PartialEq)]
4207    #[serde_with::serde_as]
4208    #[derive(serde :: Deserialize, serde :: Serialize)]
4209    #[serde(untagged)]
4210    #[allow(clippy::large_enum_variant)]
4211    pub enum Content {
4212        #[doc = "The contents of the tool message."]
4213        String(String),
4214        #[doc = "An array of content parts with a defined type. For tool messages, only type `text` is supported."]
4215        Array(Vec<crate::__types::ChatCompletionRequestToolMessageContentPart>),
4216    }
4217}
4218#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
4219pub struct ChatCompletionRequestToolMessage {
4220    #[doc = "The contents of the tool message."]
4221    pub content: crate::__types::chat_completion_request_tool_message::Content,
4222    #[doc = "Tool call that this message is responding to."]
4223    pub tool_call_id: String,
4224}
4225impl<'de> serde::Deserialize<'de> for ChatCompletionRequestToolMessage {
4226    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
4227    where
4228        D: serde::Deserializer<'de>,
4229    {
4230        #[serde_with::serde_as]
4231        #[derive(serde :: Deserialize)]
4232        struct ChatCompletionRequestToolMessage {
4233            #[serde(rename = "role")]
4234            #[allow(dead_code)]
4235            role: crate::__types::chat_completion_request_tool_message::Role,
4236            #[serde(rename = "content")]
4237            content: crate::__types::chat_completion_request_tool_message::Content,
4238            #[serde(rename = "tool_call_id")]
4239            tool_call_id: String,
4240        }
4241        let ChatCompletionRequestToolMessage {
4242            content,
4243            tool_call_id,
4244            ..
4245        } = ChatCompletionRequestToolMessage::deserialize(deserializer)?;
4246        Ok(Self {
4247            content,
4248            tool_call_id,
4249        })
4250    }
4251}
4252impl serde::Serialize for ChatCompletionRequestToolMessage {
4253    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
4254    where
4255        S: serde::Serializer,
4256    {
4257        #[serde_with::serde_as]
4258        #[derive(serde :: Serialize)]
4259        struct ChatCompletionRequestToolMessage<'a> {
4260            #[serde(rename = "role")]
4261            role: &'a crate::__types::chat_completion_request_tool_message::Role,
4262            #[serde(rename = "content")]
4263            content: &'a crate::__types::chat_completion_request_tool_message::Content,
4264            #[serde(rename = "tool_call_id")]
4265            tool_call_id: &'a String,
4266        }
4267        let Self {
4268            content,
4269            tool_call_id,
4270        } = self;
4271        ChatCompletionRequestToolMessage {
4272            role: &Default::default(),
4273            content,
4274            tool_call_id,
4275        }
4276        .serialize(serializer)
4277    }
4278}
4279#[derive(Clone, Debug, PartialEq)]
4280#[serde_with::serde_as]
4281#[derive(serde :: Deserialize, serde :: Serialize)]
4282#[serde(untagged)]
4283#[allow(clippy::large_enum_variant)]
4284pub enum ChatCompletionRequestToolMessageContentPart {
4285    ChatCompletionRequestMessageContentPartText(
4286        crate::__types::ChatCompletionRequestMessageContentPartText,
4287    ),
4288}
4289#[allow(clippy::module_inception)]
4290pub mod chat_completion_request_user_message {
4291    #[doc = "The contents of the user message.\n"]
4292    #[derive(Clone, Debug, PartialEq)]
4293    #[serde_with::serde_as]
4294    #[derive(serde :: Deserialize, serde :: Serialize)]
4295    #[serde(untagged)]
4296    #[allow(clippy::large_enum_variant)]
4297    pub enum Content {
4298        #[doc = "The text contents of the message."]
4299        String(String),
4300        #[doc = "An array of content parts with a defined type. Supported options differ based on the [model](https://platform.openai.com/docs/models) being used to generate the response. Can contain text, image, or audio inputs."]
4301        Array(Vec<crate::__types::ChatCompletionRequestUserMessageContentPart>),
4302    }
4303    #[doc = "The role of the messages author, in this case `user`."]
4304    #[derive(Clone, Copy, Debug, Default, PartialEq)]
4305    pub(crate) struct Role;
4306    impl_serde!(Role, "user");
4307}
4308#[doc = "Messages sent by an end user, containing prompts or additional context\ninformation.\n"]
4309#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
4310pub struct ChatCompletionRequestUserMessage {
4311    #[doc = "The contents of the user message.\n"]
4312    pub content: crate::__types::chat_completion_request_user_message::Content,
4313    #[doc = "An optional name for the participant. Provides the model information to differentiate between participants of the same role."]
4314    #[builder(default)]
4315    pub name: Option<String>,
4316}
4317impl<'de> serde::Deserialize<'de> for ChatCompletionRequestUserMessage {
4318    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
4319    where
4320        D: serde::Deserializer<'de>,
4321    {
4322        #[serde_with::serde_as]
4323        #[derive(serde :: Deserialize)]
4324        struct ChatCompletionRequestUserMessage {
4325            #[serde(rename = "content")]
4326            content: crate::__types::chat_completion_request_user_message::Content,
4327            #[serde(rename = "role")]
4328            #[allow(dead_code)]
4329            role: crate::__types::chat_completion_request_user_message::Role,
4330            #[serde(rename = "name")]
4331            name: Option<String>,
4332        }
4333        let ChatCompletionRequestUserMessage { content, name, .. } =
4334            ChatCompletionRequestUserMessage::deserialize(deserializer)?;
4335        Ok(Self { content, name })
4336    }
4337}
4338impl serde::Serialize for ChatCompletionRequestUserMessage {
4339    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
4340    where
4341        S: serde::Serializer,
4342    {
4343        #[serde_with::serde_as]
4344        #[derive(serde :: Serialize)]
4345        struct ChatCompletionRequestUserMessage<'a> {
4346            #[serde(rename = "content")]
4347            content: &'a crate::__types::chat_completion_request_user_message::Content,
4348            #[serde(rename = "role")]
4349            role: &'a crate::__types::chat_completion_request_user_message::Role,
4350            #[serde(rename = "name")]
4351            #[serde(skip_serializing_if = "Option::is_none")]
4352            name: &'a Option<String>,
4353        }
4354        let Self { content, name } = self;
4355        ChatCompletionRequestUserMessage {
4356            content,
4357            role: &Default::default(),
4358            name,
4359        }
4360        .serialize(serializer)
4361    }
4362}
4363#[derive(Clone, Debug, PartialEq)]
4364#[serde_with::serde_as]
4365#[derive(serde :: Deserialize, serde :: Serialize)]
4366#[serde(untagged)]
4367#[allow(clippy::large_enum_variant)]
4368pub enum ChatCompletionRequestUserMessageContentPart {
4369    Text(crate::__types::ChatCompletionRequestMessageContentPartText),
4370    ImageUrl(crate::__types::ChatCompletionRequestMessageContentPartImage),
4371    InputAudio(crate::__types::ChatCompletionRequestMessageContentPartAudio),
4372    File(crate::__types::ChatCompletionRequestMessageContentPartFile),
4373}
4374#[allow(clippy::module_inception)]
4375pub mod chat_completion_response_message {
4376    #[allow(clippy::module_inception)]
4377    pub mod annotations {
4378        #[allow(clippy::module_inception)]
4379        pub mod item {
4380            #[doc = "The type of the URL citation. Always `url_citation`."]
4381            #[derive(Clone, Copy, Debug, Default, PartialEq)]
4382            pub(crate) struct Type;
4383            impl_serde!(Type, "url_citation");
4384            #[doc = "A URL citation when using web search."]
4385            #[derive(Clone, Debug, PartialEq)]
4386            #[serde_with::serde_as]
4387            #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
4388            pub struct UrlCitation {
4389                #[doc = "The index of the last character of the URL citation in the message."]
4390                #[serde(rename = "end_index")]
4391                pub end_index: i64,
4392                #[doc = "The index of the first character of the URL citation in the message."]
4393                #[serde(rename = "start_index")]
4394                pub start_index: i64,
4395                #[doc = "The URL of the web resource."]
4396                #[serde(rename = "url")]
4397                pub url: String,
4398                #[doc = "The title of the web resource."]
4399                #[serde(rename = "title")]
4400                pub title: String,
4401            }
4402        }
4403        #[doc = "A URL citation when using web search.\n"]
4404        #[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
4405        pub struct Item {
4406            #[doc = "A URL citation when using web search."]
4407            pub url_citation:
4408                crate::__types::chat_completion_response_message::annotations::item::UrlCitation,
4409        }
4410        impl<'de> serde::Deserialize<'de> for Item {
4411            fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
4412            where
4413                D: serde::Deserializer<'de>,
4414            {
4415                #[serde_with::serde_as]
4416                #[derive(serde :: Deserialize)]
4417                struct Item { # [serde (rename = "type")] # [allow (dead_code)] r#type : crate :: __types :: chat_completion_response_message :: annotations :: item :: Type , # [serde (rename = "url_citation")] url_citation : crate :: __types :: chat_completion_response_message :: annotations :: item :: UrlCitation }
4418                let Item { url_citation, .. } = Item::deserialize(deserializer)?;
4419                Ok(Self { url_citation })
4420            }
4421        }
4422        impl serde::Serialize for Item {
4423            fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
4424            where
4425                S: serde::Serializer,
4426            {
4427                #[serde_with::serde_as]
4428                #[derive(serde :: Serialize)]
4429                struct Item < 'a > { # [serde (rename = "type")] r#type : & 'a crate :: __types :: chat_completion_response_message :: annotations :: item :: Type , # [serde (rename = "url_citation")] url_citation : & 'a crate :: __types :: chat_completion_response_message :: annotations :: item :: UrlCitation }
4430                let Self { url_citation } = self;
4431                Item {
4432                    r#type: &Default::default(),
4433                    url_citation,
4434                }
4435                .serialize(serializer)
4436            }
4437        }
4438    }
4439    #[doc = "The role of the author of this message."]
4440    #[derive(Clone, Copy, Debug, Default, PartialEq)]
4441    pub(crate) struct Role;
4442    impl_serde!(Role, "assistant");
4443    #[doc = "Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model."]
4444    #[derive(Clone, Debug, PartialEq)]
4445    #[serde_with::serde_as]
4446    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
4447    pub struct FunctionCall {
4448        #[doc = "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."]
4449        #[serde(rename = "arguments")]
4450        pub arguments: String,
4451        #[doc = "The name of the function to call."]
4452        #[serde(rename = "name")]
4453        pub name: String,
4454    }
4455    #[doc = "If the audio output modality is requested, this object contains data\nabout the audio response from the model. [Learn more](https://platform.openai.com/docs/guides/audio).\n"]
4456    #[derive(Clone, Debug, PartialEq)]
4457    #[serde_with::serde_as]
4458    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
4459    pub struct Audio {
4460        #[doc = "Unique identifier for this audio response."]
4461        #[serde(rename = "id")]
4462        pub id: String,
4463        #[doc = "The Unix timestamp (in seconds) for when this audio response will\nno longer be accessible on the server for use in multi-turn\nconversations.\n"]
4464        #[serde(rename = "expires_at")]
4465        pub expires_at: i64,
4466        #[doc = "Base64 encoded audio bytes generated by the model, in the format\nspecified in the request.\n"]
4467        #[serde(rename = "data")]
4468        pub data: String,
4469        #[doc = "Transcript of the audio generated by the model."]
4470        #[serde(rename = "transcript")]
4471        pub transcript: String,
4472    }
4473}
4474#[doc = "A chat completion message generated by the model."]
4475#[derive(Clone, Debug, Default, PartialEq, typed_builder :: TypedBuilder)]
4476pub struct ChatCompletionResponseMessage {
4477    #[doc = "The contents of the message."]
4478    #[builder(default)]
4479    pub content: Option<String>,
4480    #[doc = "The refusal message generated by the model."]
4481    #[builder(default)]
4482    pub refusal: Option<String>,
4483    #[builder(default)]
4484    pub tool_calls: Option<crate::__types::ChatCompletionMessageToolCalls>,
4485    #[doc = "Annotations for the message, when applicable, as when using the\n[web search tool](https://platform.openai.com/docs/guides/tools-web-search?api-mode=chat).\n"]
4486    #[builder(default)]
4487    pub annotations:
4488        Option<Vec<crate::__types::chat_completion_response_message::annotations::Item>>,
4489    #[doc = "Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model."]
4490    #[builder(default)]
4491    pub function_call: Option<crate::__types::chat_completion_response_message::FunctionCall>,
4492    #[doc = "If the audio output modality is requested, this object contains data\nabout the audio response from the model. [Learn more](https://platform.openai.com/docs/guides/audio).\n"]
4493    #[builder(default)]
4494    pub audio: Option<crate::__types::chat_completion_response_message::Audio>,
4495}
4496impl<'de> serde::Deserialize<'de> for ChatCompletionResponseMessage {
4497    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
4498    where
4499        D: serde::Deserializer<'de>,
4500    {
4501        #[serde_with::serde_as]
4502        #[derive(serde :: Deserialize)]
4503        struct ChatCompletionResponseMessage {
4504            #[serde(rename = "content")]
4505            content: Option<String>,
4506            #[serde(rename = "refusal")]
4507            refusal: Option<String>,
4508            #[serde(rename = "tool_calls")]
4509            tool_calls: Option<crate::__types::ChatCompletionMessageToolCalls>,
4510            #[serde(rename = "annotations")]
4511            annotations:
4512                Option<Vec<crate::__types::chat_completion_response_message::annotations::Item>>,
4513            #[serde(rename = "role")]
4514            #[allow(dead_code)]
4515            role: crate::__types::chat_completion_response_message::Role,
4516            #[serde(rename = "function_call")]
4517            function_call: Option<crate::__types::chat_completion_response_message::FunctionCall>,
4518            #[serde(rename = "audio")]
4519            audio: Option<crate::__types::chat_completion_response_message::Audio>,
4520        }
4521        let ChatCompletionResponseMessage {
4522            content,
4523            refusal,
4524            tool_calls,
4525            annotations,
4526            function_call,
4527            audio,
4528            ..
4529        } = ChatCompletionResponseMessage::deserialize(deserializer)?;
4530        Ok(Self {
4531            content,
4532            refusal,
4533            tool_calls,
4534            annotations,
4535            function_call,
4536            audio,
4537        })
4538    }
4539}
4540impl serde::Serialize for ChatCompletionResponseMessage {
4541    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
4542    where
4543        S: serde::Serializer,
4544    {
4545        #[serde_with::serde_as]
4546        #[derive(serde :: Serialize)]
4547        struct ChatCompletionResponseMessage<'a> {
4548            #[serde(rename = "content")]
4549            #[serde(skip_serializing_if = "Option::is_none")]
4550            content: &'a Option<String>,
4551            #[serde(rename = "refusal")]
4552            #[serde(skip_serializing_if = "Option::is_none")]
4553            refusal: &'a Option<String>,
4554            #[serde(rename = "tool_calls")]
4555            #[serde(skip_serializing_if = "Option::is_none")]
4556            tool_calls: &'a Option<crate::__types::ChatCompletionMessageToolCalls>,
4557            #[serde(rename = "annotations")]
4558            #[serde(skip_serializing_if = "Option::is_none")]
4559            annotations: &'a Option<
4560                Vec<crate::__types::chat_completion_response_message::annotations::Item>,
4561            >,
4562            #[serde(rename = "role")]
4563            role: &'a crate::__types::chat_completion_response_message::Role,
4564            #[serde(rename = "function_call")]
4565            #[serde(skip_serializing_if = "Option::is_none")]
4566            function_call:
4567                &'a Option<crate::__types::chat_completion_response_message::FunctionCall>,
4568            #[serde(rename = "audio")]
4569            #[serde(skip_serializing_if = "Option::is_none")]
4570            audio: &'a Option<crate::__types::chat_completion_response_message::Audio>,
4571        }
4572        let Self {
4573            content,
4574            refusal,
4575            tool_calls,
4576            annotations,
4577            function_call,
4578            audio,
4579        } = self;
4580        ChatCompletionResponseMessage {
4581            content,
4582            refusal,
4583            tool_calls,
4584            annotations,
4585            role: &Default::default(),
4586            function_call,
4587            audio,
4588        }
4589        .serialize(serializer)
4590    }
4591}
4592#[doc = "The role of the author of a message"]
4593#[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
4594pub enum ChatCompletionRole {
4595    #[doc = "`developer`"]
4596    #[serde(rename = "developer")]
4597    Developer,
4598    #[doc = "`system`"]
4599    #[serde(rename = "system")]
4600    System,
4601    #[doc = "`user`"]
4602    #[serde(rename = "user")]
4603    User,
4604    #[doc = "`assistant`"]
4605    #[serde(rename = "assistant")]
4606    Assistant,
4607    #[doc = "`tool`"]
4608    #[serde(rename = "tool")]
4609    Tool,
4610    #[doc = "`function`"]
4611    #[serde(rename = "function")]
4612    Function,
4613}
4614#[doc = "Options for streaming response. Only set this when you set `stream: true`.\n"]
4615#[derive(Clone, Copy, Debug, Default, PartialEq)]
4616#[serde_with::serde_as]
4617#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
4618pub struct ChatCompletionStreamOptions {
4619    #[doc = "If set, an additional chunk will be streamed before the `data: [DONE]`\nmessage. The `usage` field on this chunk shows the token usage statistics\nfor the entire request, and the `choices` field will always be an empty\narray.\n\nAll other chunks will also include a `usage` field, but with a null\nvalue. **NOTE:** If the stream is interrupted, you may not receive the\nfinal usage chunk which contains the total token usage for the request.\n"]
4620    #[serde(rename = "include_usage")]
4621    #[serde(skip_serializing_if = "Option::is_none")]
4622    #[builder(default)]
4623    pub include_usage: Option<bool>,
4624    #[doc = "When true, stream obfuscation will be enabled. Stream obfuscation adds\nrandom characters to an `obfuscation` field on streaming delta events to\nnormalize payload sizes as a mitigation to certain side-channel attacks.\nThese obfuscation fields are included by default, but add a small amount\nof overhead to the data stream. You can set `include_obfuscation` to\nfalse to optimize for bandwidth if you trust the network links between\nyour application and the OpenAI API.\n"]
4625    #[serde(rename = "include_obfuscation")]
4626    #[serde(skip_serializing_if = "Option::is_none")]
4627    #[builder(default)]
4628    pub include_obfuscation: Option<bool>,
4629}
4630#[allow(clippy::module_inception)]
4631pub mod chat_completion_stream_response_delta {
4632    #[doc = "Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model."]
4633    #[derive(Clone, Debug, Default, PartialEq)]
4634    #[serde_with::serde_as]
4635    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
4636    pub struct FunctionCall {
4637        #[doc = "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."]
4638        #[serde(rename = "arguments")]
4639        #[serde(skip_serializing_if = "Option::is_none")]
4640        #[builder(default)]
4641        pub arguments: Option<String>,
4642        #[doc = "The name of the function to call."]
4643        #[serde(rename = "name")]
4644        #[serde(skip_serializing_if = "Option::is_none")]
4645        #[builder(default)]
4646        pub name: Option<String>,
4647    }
4648    #[doc = "The role of the author of this message."]
4649    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
4650    pub enum Role {
4651        #[doc = "`developer`"]
4652        #[serde(rename = "developer")]
4653        Developer,
4654        #[doc = "`system`"]
4655        #[serde(rename = "system")]
4656        System,
4657        #[doc = "`user`"]
4658        #[serde(rename = "user")]
4659        User,
4660        #[doc = "`assistant`"]
4661        #[serde(rename = "assistant")]
4662        Assistant,
4663        #[doc = "`tool`"]
4664        #[serde(rename = "tool")]
4665        Tool,
4666    }
4667}
4668#[doc = "A chat completion delta generated by streamed model responses."]
4669#[derive(Clone, Debug, Default, PartialEq)]
4670#[serde_with::serde_as]
4671#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
4672pub struct ChatCompletionStreamResponseDelta {
4673    #[doc = "The contents of the chunk message."]
4674    #[serde(rename = "content")]
4675    #[serde(skip_serializing_if = "Option::is_none")]
4676    #[builder(default)]
4677    pub content: Option<String>,
4678    #[doc = "Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model."]
4679    #[serde(rename = "function_call")]
4680    #[serde(skip_serializing_if = "Option::is_none")]
4681    #[builder(default)]
4682    pub function_call: Option<crate::__types::chat_completion_stream_response_delta::FunctionCall>,
4683    #[serde(rename = "tool_calls")]
4684    #[serde(skip_serializing_if = "Option::is_none")]
4685    #[builder(default)]
4686    pub tool_calls: Option<Vec<crate::__types::ChatCompletionMessageToolCallChunk>>,
4687    #[doc = "The role of the author of this message."]
4688    #[serde(rename = "role")]
4689    #[serde(skip_serializing_if = "Option::is_none")]
4690    #[builder(default)]
4691    pub role: Option<crate::__types::chat_completion_stream_response_delta::Role>,
4692    #[doc = "The refusal message generated by the model."]
4693    #[serde(rename = "refusal")]
4694    #[serde(skip_serializing_if = "Option::is_none")]
4695    #[builder(default)]
4696    pub refusal: Option<String>,
4697}
4698#[allow(clippy::module_inception)]
4699pub mod chat_completion_token_logprob {
4700    #[allow(clippy::module_inception)]
4701    pub mod top_logprobs {
4702        #[derive(Clone, Debug, PartialEq)]
4703        #[serde_with::serde_as]
4704        #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
4705        pub struct Item {
4706            #[doc = "The token."]
4707            #[serde(rename = "token")]
4708            pub token: String,
4709            #[doc = "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."]
4710            #[serde(rename = "logprob")]
4711            pub logprob: serde_json::Number,
4712            #[doc = "A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be `null` if there is no bytes representation for the token."]
4713            #[serde(rename = "bytes")]
4714            #[serde(skip_serializing_if = "Option::is_none")]
4715            #[builder(default)]
4716            pub bytes: Option<Vec<i64>>,
4717        }
4718    }
4719}
4720#[derive(Clone, Debug, PartialEq)]
4721#[serde_with::serde_as]
4722#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
4723pub struct ChatCompletionTokenLogprob {
4724    #[doc = "The token."]
4725    #[serde(rename = "token")]
4726    pub token: String,
4727    #[doc = "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."]
4728    #[serde(rename = "logprob")]
4729    pub logprob: serde_json::Number,
4730    #[doc = "A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be `null` if there is no bytes representation for the token."]
4731    #[serde(rename = "bytes")]
4732    #[serde(skip_serializing_if = "Option::is_none")]
4733    #[builder(default)]
4734    pub bytes: Option<Vec<i64>>,
4735    #[doc = "List of the most likely tokens and their log probability, at this token position. In rare cases, there may be fewer than the number of requested `top_logprobs` returned."]
4736    #[serde(rename = "top_logprobs")]
4737    pub top_logprobs: Vec<crate::__types::chat_completion_token_logprob::top_logprobs::Item>,
4738}
4739#[allow(clippy::module_inception)]
4740pub(crate) mod chat_completion_tool {
4741    #[doc = "The type of the tool. Currently, only `function` is supported."]
4742    #[derive(Clone, Copy, Debug, Default, PartialEq)]
4743    pub(crate) struct Type;
4744    impl_serde!(Type, "function");
4745}
4746#[doc = "A function tool that can be used to generate a response.\n"]
4747#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
4748pub struct ChatCompletionTool {
4749    pub function: crate::__types::FunctionObject,
4750}
4751impl<'de> serde::Deserialize<'de> for ChatCompletionTool {
4752    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
4753    where
4754        D: serde::Deserializer<'de>,
4755    {
4756        #[serde_with::serde_as]
4757        #[derive(serde :: Deserialize)]
4758        struct ChatCompletionTool {
4759            #[serde(rename = "type")]
4760            #[allow(dead_code)]
4761            r#type: crate::__types::chat_completion_tool::Type,
4762            #[serde(rename = "function")]
4763            function: crate::__types::FunctionObject,
4764        }
4765        let ChatCompletionTool { function, .. } = ChatCompletionTool::deserialize(deserializer)?;
4766        Ok(Self { function })
4767    }
4768}
4769impl serde::Serialize for ChatCompletionTool {
4770    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
4771    where
4772        S: serde::Serializer,
4773    {
4774        #[serde_with::serde_as]
4775        #[derive(serde :: Serialize)]
4776        struct ChatCompletionTool<'a> {
4777            #[serde(rename = "type")]
4778            r#type: &'a crate::__types::chat_completion_tool::Type,
4779            #[serde(rename = "function")]
4780            function: &'a crate::__types::FunctionObject,
4781        }
4782        let Self { function } = self;
4783        ChatCompletionTool {
4784            r#type: &Default::default(),
4785            function,
4786        }
4787        .serialize(serializer)
4788    }
4789}
4790#[allow(clippy::module_inception)]
4791pub(crate) mod chat_completion_tool_choice_option {
4792    #[doc = "none"]
4793    #[derive(Clone, Copy, Debug, Default, PartialEq)]
4794    pub(crate) struct None;
4795    impl_serde!(None, "none");
4796    #[doc = "auto"]
4797    #[derive(Clone, Copy, Debug, Default, PartialEq)]
4798    pub(crate) struct Auto;
4799    impl_serde!(Auto, "auto");
4800    #[doc = "required"]
4801    #[derive(Clone, Copy, Debug, Default, PartialEq)]
4802    pub(crate) struct Required;
4803    impl_serde!(Required, "required");
4804}
4805#[doc = "Controls which (if any) tool is called by the model.\n`none` means the model will not call any tool and instead generates a message.\n`auto` means the model can pick between generating a message or calling one or more tools.\n`required` means the model must call one or more tools.\nSpecifying a particular tool via `{\"type\": \"function\", \"function\": {\"name\": \"my_function\"}}` forces the model to call that tool.\n\n`none` is the default when no tools are present. `auto` is the default if tools are present.\n"]
4806#[derive(Clone, Debug, PartialEq)]
4807#[allow(clippy::large_enum_variant)]
4808pub enum ChatCompletionToolChoiceOption {
4809    #[doc = "none"]
4810    None,
4811    #[doc = "auto"]
4812    Auto,
4813    #[doc = "required"]
4814    Required,
4815    AllowedTools(crate::__types::ChatCompletionAllowedToolsChoice),
4816    Function(crate::__types::ChatCompletionNamedToolChoice),
4817    Custom(crate::__types::ChatCompletionNamedToolChoiceCustom),
4818}
4819impl<'de> serde::Deserialize<'de> for ChatCompletionToolChoiceOption {
4820    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
4821    where
4822        D: serde::Deserializer<'de>,
4823    {
4824        #[serde_with::serde_as]
4825        #[derive(serde :: Deserialize)]
4826        #[serde(untagged)]
4827        #[allow(clippy::enum_variant_names, clippy::large_enum_variant)]
4828        enum ChatCompletionToolChoiceOption {
4829            None(crate::__types::chat_completion_tool_choice_option::None),
4830            Auto(crate::__types::chat_completion_tool_choice_option::Auto),
4831            Required(crate::__types::chat_completion_tool_choice_option::Required),
4832            AllowedTools(crate::__types::ChatCompletionAllowedToolsChoice),
4833            Function(crate::__types::ChatCompletionNamedToolChoice),
4834            Custom(crate::__types::ChatCompletionNamedToolChoiceCustom),
4835        }
4836        Ok(
4837            match ChatCompletionToolChoiceOption::deserialize(deserializer)? {
4838                ChatCompletionToolChoiceOption::None(_) => Self::None,
4839                ChatCompletionToolChoiceOption::Auto(_) => Self::Auto,
4840                ChatCompletionToolChoiceOption::Required(_) => Self::Required,
4841                ChatCompletionToolChoiceOption::AllowedTools(v) => Self::AllowedTools(v),
4842                ChatCompletionToolChoiceOption::Function(v) => Self::Function(v),
4843                ChatCompletionToolChoiceOption::Custom(v) => Self::Custom(v),
4844            },
4845        )
4846    }
4847}
4848impl serde::Serialize for ChatCompletionToolChoiceOption {
4849    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
4850    where
4851        S: serde::Serializer,
4852    {
4853        #[serde_with::serde_as]
4854        #[derive(serde :: Serialize)]
4855        #[serde(untagged)]
4856        #[allow(clippy::enum_variant_names)]
4857        enum ChatCompletionToolChoiceOption<'a> {
4858            None(crate::__types::chat_completion_tool_choice_option::None),
4859            Auto(crate::__types::chat_completion_tool_choice_option::Auto),
4860            Required(crate::__types::chat_completion_tool_choice_option::Required),
4861            AllowedTools(&'a crate::__types::ChatCompletionAllowedToolsChoice),
4862            Function(&'a crate::__types::ChatCompletionNamedToolChoice),
4863            Custom(&'a crate::__types::ChatCompletionNamedToolChoiceCustom),
4864        }
4865        match self {
4866            Self::None => ChatCompletionToolChoiceOption::None(Default::default()),
4867            Self::Auto => ChatCompletionToolChoiceOption::Auto(Default::default()),
4868            Self::Required => ChatCompletionToolChoiceOption::Required(Default::default()),
4869            Self::AllowedTools(v) => ChatCompletionToolChoiceOption::AllowedTools(v),
4870            Self::Function(v) => ChatCompletionToolChoiceOption::Function(v),
4871            Self::Custom(v) => ChatCompletionToolChoiceOption::Custom(v),
4872        }
4873        .serialize(serializer)
4874    }
4875}
4876#[doc = "The chunking strategy used to chunk the file(s). If not set, will use the `auto` strategy. Only applicable if `file_ids` is non-empty."]
4877#[derive(Clone, Copy, Debug, PartialEq)]
4878#[serde_with::serde_as]
4879#[derive(serde :: Deserialize, serde :: Serialize)]
4880#[serde(untagged)]
4881#[allow(clippy::large_enum_variant)]
4882pub enum ChunkingStrategyRequestParam {
4883    Auto(crate::__types::AutoChunkingStrategyRequestParam),
4884    Static(crate::__types::StaticChunkingStrategyRequestParam),
4885}
4886#[allow(clippy::module_inception)]
4887pub mod click {
4888    #[doc = "Specifies the event type. For a click action, this property is \nalways set to `click`.\n"]
4889    #[derive(Clone, Copy, Debug, Default, PartialEq)]
4890    pub(crate) struct Type;
4891    impl_serde!(Type, "click");
4892    #[doc = "Indicates which mouse button was pressed during the click. One of `left`, `right`, `wheel`, `back`, or `forward`.\n"]
4893    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
4894    pub enum Button {
4895        #[doc = "`left`"]
4896        #[serde(rename = "left")]
4897        Left,
4898        #[doc = "`right`"]
4899        #[serde(rename = "right")]
4900        Right,
4901        #[doc = "`wheel`"]
4902        #[serde(rename = "wheel")]
4903        Wheel,
4904        #[doc = "`back`"]
4905        #[serde(rename = "back")]
4906        Back,
4907        #[doc = "`forward`"]
4908        #[serde(rename = "forward")]
4909        Forward,
4910    }
4911}
4912#[doc = "A click action.\n"]
4913#[derive(Clone, Copy, Debug, PartialEq, typed_builder :: TypedBuilder)]
4914pub struct Click {
4915    #[doc = "Indicates which mouse button was pressed during the click. One of `left`, `right`, `wheel`, `back`, or `forward`.\n"]
4916    pub button: crate::__types::click::Button,
4917    #[doc = "The x-coordinate where the click occurred.\n"]
4918    pub x: i64,
4919    #[doc = "The y-coordinate where the click occurred.\n"]
4920    pub y: i64,
4921}
4922impl<'de> serde::Deserialize<'de> for Click {
4923    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
4924    where
4925        D: serde::Deserializer<'de>,
4926    {
4927        #[serde_with::serde_as]
4928        #[derive(serde :: Deserialize)]
4929        struct Click {
4930            #[serde(rename = "type")]
4931            #[allow(dead_code)]
4932            r#type: crate::__types::click::Type,
4933            #[serde(rename = "button")]
4934            button: crate::__types::click::Button,
4935            #[serde(rename = "x")]
4936            x: i64,
4937            #[serde(rename = "y")]
4938            y: i64,
4939        }
4940        let Click { button, x, y, .. } = Click::deserialize(deserializer)?;
4941        Ok(Self { button, x, y })
4942    }
4943}
4944impl serde::Serialize for Click {
4945    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
4946    where
4947        S: serde::Serializer,
4948    {
4949        #[serde_with::serde_as]
4950        #[derive(serde :: Serialize)]
4951        struct Click<'a> {
4952            #[serde(rename = "type")]
4953            r#type: &'a crate::__types::click::Type,
4954            #[serde(rename = "button")]
4955            button: &'a crate::__types::click::Button,
4956            #[serde(rename = "x")]
4957            x: &'a i64,
4958            #[serde(rename = "y")]
4959            y: &'a i64,
4960        }
4961        let Self { button, x, y } = self;
4962        Click {
4963            r#type: &Default::default(),
4964            button,
4965            x,
4966            y,
4967        }
4968        .serialize(serializer)
4969    }
4970}
4971#[allow(clippy::module_inception)]
4972pub mod code_interpreter_file_output {
4973    #[doc = "The type of the code interpreter file output. Always `files`.\n"]
4974    #[derive(Clone, Copy, Debug, Default, PartialEq)]
4975    pub(crate) struct Type;
4976    impl_serde!(Type, "files");
4977    #[allow(clippy::module_inception)]
4978    pub mod files {
4979        #[derive(Clone, Debug, PartialEq)]
4980        #[serde_with::serde_as]
4981        #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
4982        pub struct Item {
4983            #[doc = "The MIME type of the file.\n"]
4984            #[serde(rename = "mime_type")]
4985            pub mime_type: String,
4986            #[doc = "The ID of the file.\n"]
4987            #[serde(rename = "file_id")]
4988            pub file_id: String,
4989        }
4990    }
4991}
4992#[doc = "The output of a code interpreter tool call that is a file.\n"]
4993#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
4994pub struct CodeInterpreterFileOutput {
4995    pub files: Vec<crate::__types::code_interpreter_file_output::files::Item>,
4996}
4997impl<'de> serde::Deserialize<'de> for CodeInterpreterFileOutput {
4998    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
4999    where
5000        D: serde::Deserializer<'de>,
5001    {
5002        #[serde_with::serde_as]
5003        #[derive(serde :: Deserialize)]
5004        struct CodeInterpreterFileOutput {
5005            #[serde(rename = "type")]
5006            #[allow(dead_code)]
5007            r#type: crate::__types::code_interpreter_file_output::Type,
5008            #[serde(rename = "files")]
5009            files: Vec<crate::__types::code_interpreter_file_output::files::Item>,
5010        }
5011        let CodeInterpreterFileOutput { files, .. } =
5012            CodeInterpreterFileOutput::deserialize(deserializer)?;
5013        Ok(Self { files })
5014    }
5015}
5016impl serde::Serialize for CodeInterpreterFileOutput {
5017    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
5018    where
5019        S: serde::Serializer,
5020    {
5021        #[serde_with::serde_as]
5022        #[derive(serde :: Serialize)]
5023        struct CodeInterpreterFileOutput<'a> {
5024            #[serde(rename = "type")]
5025            r#type: &'a crate::__types::code_interpreter_file_output::Type,
5026            #[serde(rename = "files")]
5027            files: &'a Vec<crate::__types::code_interpreter_file_output::files::Item>,
5028        }
5029        let Self { files } = self;
5030        CodeInterpreterFileOutput {
5031            r#type: &Default::default(),
5032            files,
5033        }
5034        .serialize(serializer)
5035    }
5036}
5037#[allow(clippy::module_inception)]
5038pub(crate) mod code_interpreter_output_image {
5039    #[doc = "The type of the output. Always 'image'."]
5040    #[derive(Clone, Copy, Debug, Default, PartialEq)]
5041    pub(crate) struct Type;
5042    impl_serde!(Type, "image");
5043}
5044#[doc = "The image output from the code interpreter.\n"]
5045#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
5046pub struct CodeInterpreterOutputImage {
5047    #[doc = "The URL of the image output from the code interpreter."]
5048    pub url: String,
5049}
5050impl<'de> serde::Deserialize<'de> for CodeInterpreterOutputImage {
5051    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
5052    where
5053        D: serde::Deserializer<'de>,
5054    {
5055        #[serde_with::serde_as]
5056        #[derive(serde :: Deserialize)]
5057        struct CodeInterpreterOutputImage {
5058            #[serde(rename = "type")]
5059            #[allow(dead_code)]
5060            r#type: crate::__types::code_interpreter_output_image::Type,
5061            #[serde(rename = "url")]
5062            url: String,
5063        }
5064        let CodeInterpreterOutputImage { url, .. } =
5065            CodeInterpreterOutputImage::deserialize(deserializer)?;
5066        Ok(Self { url })
5067    }
5068}
5069impl serde::Serialize for CodeInterpreterOutputImage {
5070    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
5071    where
5072        S: serde::Serializer,
5073    {
5074        #[serde_with::serde_as]
5075        #[derive(serde :: Serialize)]
5076        struct CodeInterpreterOutputImage<'a> {
5077            #[serde(rename = "type")]
5078            r#type: &'a crate::__types::code_interpreter_output_image::Type,
5079            #[serde(rename = "url")]
5080            url: &'a String,
5081        }
5082        let Self { url } = self;
5083        CodeInterpreterOutputImage {
5084            r#type: &Default::default(),
5085            url,
5086        }
5087        .serialize(serializer)
5088    }
5089}
5090#[allow(clippy::module_inception)]
5091pub(crate) mod code_interpreter_output_logs {
5092    #[doc = "The type of the output. Always 'logs'."]
5093    #[derive(Clone, Copy, Debug, Default, PartialEq)]
5094    pub(crate) struct Type;
5095    impl_serde!(Type, "logs");
5096}
5097#[doc = "The logs output from the code interpreter.\n"]
5098#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
5099pub struct CodeInterpreterOutputLogs {
5100    #[doc = "The logs output from the code interpreter."]
5101    pub logs: String,
5102}
5103impl<'de> serde::Deserialize<'de> for CodeInterpreterOutputLogs {
5104    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
5105    where
5106        D: serde::Deserializer<'de>,
5107    {
5108        #[serde_with::serde_as]
5109        #[derive(serde :: Deserialize)]
5110        struct CodeInterpreterOutputLogs {
5111            #[serde(rename = "type")]
5112            #[allow(dead_code)]
5113            r#type: crate::__types::code_interpreter_output_logs::Type,
5114            #[serde(rename = "logs")]
5115            logs: String,
5116        }
5117        let CodeInterpreterOutputLogs { logs, .. } =
5118            CodeInterpreterOutputLogs::deserialize(deserializer)?;
5119        Ok(Self { logs })
5120    }
5121}
5122impl serde::Serialize for CodeInterpreterOutputLogs {
5123    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
5124    where
5125        S: serde::Serializer,
5126    {
5127        #[serde_with::serde_as]
5128        #[derive(serde :: Serialize)]
5129        struct CodeInterpreterOutputLogs<'a> {
5130            #[serde(rename = "type")]
5131            r#type: &'a crate::__types::code_interpreter_output_logs::Type,
5132            #[serde(rename = "logs")]
5133            logs: &'a String,
5134        }
5135        let Self { logs } = self;
5136        CodeInterpreterOutputLogs {
5137            r#type: &Default::default(),
5138            logs,
5139        }
5140        .serialize(serializer)
5141    }
5142}
5143#[allow(clippy::module_inception)]
5144pub(crate) mod code_interpreter_text_output {
5145    #[doc = "The type of the code interpreter text output. Always `logs`.\n"]
5146    #[derive(Clone, Copy, Debug, Default, PartialEq)]
5147    pub(crate) struct Type;
5148    impl_serde!(Type, "logs");
5149}
5150#[doc = "The output of a code interpreter tool call that is text.\n"]
5151#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
5152pub struct CodeInterpreterTextOutput {
5153    #[doc = "The logs of the code interpreter tool call.\n"]
5154    pub logs: String,
5155}
5156impl<'de> serde::Deserialize<'de> for CodeInterpreterTextOutput {
5157    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
5158    where
5159        D: serde::Deserializer<'de>,
5160    {
5161        #[serde_with::serde_as]
5162        #[derive(serde :: Deserialize)]
5163        struct CodeInterpreterTextOutput {
5164            #[serde(rename = "type")]
5165            #[allow(dead_code)]
5166            r#type: crate::__types::code_interpreter_text_output::Type,
5167            #[serde(rename = "logs")]
5168            logs: String,
5169        }
5170        let CodeInterpreterTextOutput { logs, .. } =
5171            CodeInterpreterTextOutput::deserialize(deserializer)?;
5172        Ok(Self { logs })
5173    }
5174}
5175impl serde::Serialize for CodeInterpreterTextOutput {
5176    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
5177    where
5178        S: serde::Serializer,
5179    {
5180        #[serde_with::serde_as]
5181        #[derive(serde :: Serialize)]
5182        struct CodeInterpreterTextOutput<'a> {
5183            #[serde(rename = "type")]
5184            r#type: &'a crate::__types::code_interpreter_text_output::Type,
5185            #[serde(rename = "logs")]
5186            logs: &'a String,
5187        }
5188        let Self { logs } = self;
5189        CodeInterpreterTextOutput {
5190            r#type: &Default::default(),
5191            logs,
5192        }
5193        .serialize(serializer)
5194    }
5195}
5196#[allow(clippy::module_inception)]
5197pub mod code_interpreter_tool {
5198    #[doc = "The type of the code interpreter tool. Always `code_interpreter`.\n"]
5199    #[derive(Clone, Copy, Debug, Default, PartialEq)]
5200    pub(crate) struct Type;
5201    impl_serde!(Type, "code_interpreter");
5202    #[doc = "The code interpreter container. Can be a container ID or an object that\nspecifies uploaded file IDs to make available to your code.\n"]
5203    #[derive(Clone, Debug, PartialEq)]
5204    #[serde_with::serde_as]
5205    #[derive(serde :: Deserialize, serde :: Serialize)]
5206    #[serde(untagged)]
5207    #[allow(clippy::large_enum_variant)]
5208    pub enum Container {
5209        #[doc = "The container ID."]
5210        String(String),
5211        CodeInterpreterToolAuto(crate::__types::CodeInterpreterToolAuto),
5212    }
5213}
5214#[doc = "A tool that runs Python code to help generate a response to a prompt.\n"]
5215#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
5216pub struct CodeInterpreterTool {
5217    #[doc = "The code interpreter container. Can be a container ID or an object that\nspecifies uploaded file IDs to make available to your code.\n"]
5218    pub container: crate::__types::code_interpreter_tool::Container,
5219}
5220impl<'de> serde::Deserialize<'de> for CodeInterpreterTool {
5221    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
5222    where
5223        D: serde::Deserializer<'de>,
5224    {
5225        #[serde_with::serde_as]
5226        #[derive(serde :: Deserialize)]
5227        struct CodeInterpreterTool {
5228            #[serde(rename = "type")]
5229            #[allow(dead_code)]
5230            r#type: crate::__types::code_interpreter_tool::Type,
5231            #[serde(rename = "container")]
5232            container: crate::__types::code_interpreter_tool::Container,
5233        }
5234        let CodeInterpreterTool { container, .. } = CodeInterpreterTool::deserialize(deserializer)?;
5235        Ok(Self { container })
5236    }
5237}
5238impl serde::Serialize for CodeInterpreterTool {
5239    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
5240    where
5241        S: serde::Serializer,
5242    {
5243        #[serde_with::serde_as]
5244        #[derive(serde :: Serialize)]
5245        struct CodeInterpreterTool<'a> {
5246            #[serde(rename = "type")]
5247            r#type: &'a crate::__types::code_interpreter_tool::Type,
5248            #[serde(rename = "container")]
5249            container: &'a crate::__types::code_interpreter_tool::Container,
5250        }
5251        let Self { container } = self;
5252        CodeInterpreterTool {
5253            r#type: &Default::default(),
5254            container,
5255        }
5256        .serialize(serializer)
5257    }
5258}
5259#[allow(clippy::module_inception)]
5260pub(crate) mod code_interpreter_tool_auto {
5261    #[doc = "Always `auto`."]
5262    #[derive(Clone, Copy, Debug, Default, PartialEq)]
5263    pub(crate) struct Type;
5264    impl_serde!(Type, "auto");
5265}
5266#[doc = "Configuration for a code interpreter container. Optionally specify the IDs\nof the files to run the code on.\n"]
5267#[derive(Clone, Debug, Default, PartialEq, typed_builder :: TypedBuilder)]
5268pub struct CodeInterpreterToolAuto {
5269    #[doc = "An optional list of uploaded files to make available to your code.\n"]
5270    #[builder(default)]
5271    pub file_ids: Option<Vec<String>>,
5272}
5273impl<'de> serde::Deserialize<'de> for CodeInterpreterToolAuto {
5274    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
5275    where
5276        D: serde::Deserializer<'de>,
5277    {
5278        #[serde_with::serde_as]
5279        #[derive(serde :: Deserialize)]
5280        struct CodeInterpreterToolAuto {
5281            #[serde(rename = "type")]
5282            #[allow(dead_code)]
5283            r#type: crate::__types::code_interpreter_tool_auto::Type,
5284            #[serde(rename = "file_ids")]
5285            file_ids: Option<Vec<String>>,
5286        }
5287        let CodeInterpreterToolAuto { file_ids, .. } =
5288            CodeInterpreterToolAuto::deserialize(deserializer)?;
5289        Ok(Self { file_ids })
5290    }
5291}
5292impl serde::Serialize for CodeInterpreterToolAuto {
5293    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
5294    where
5295        S: serde::Serializer,
5296    {
5297        #[serde_with::serde_as]
5298        #[derive(serde :: Serialize)]
5299        struct CodeInterpreterToolAuto<'a> {
5300            #[serde(rename = "type")]
5301            r#type: &'a crate::__types::code_interpreter_tool_auto::Type,
5302            #[serde(rename = "file_ids")]
5303            #[serde(skip_serializing_if = "Option::is_none")]
5304            file_ids: &'a Option<Vec<String>>,
5305        }
5306        let Self { file_ids } = self;
5307        CodeInterpreterToolAuto {
5308            r#type: &Default::default(),
5309            file_ids,
5310        }
5311        .serialize(serializer)
5312    }
5313}
5314#[allow(clippy::module_inception)]
5315pub mod code_interpreter_tool_call {
5316    #[doc = "The type of the code interpreter tool call. Always `code_interpreter_call`.\n"]
5317    #[derive(Clone, Copy, Debug, Default, PartialEq)]
5318    pub(crate) struct Type;
5319    impl_serde!(Type, "code_interpreter_call");
5320    #[doc = "The status of the code interpreter tool call. Valid values are `in_progress`, `completed`, `incomplete`, `interpreting`, and `failed`.\n"]
5321    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
5322    pub enum Status {
5323        #[doc = "`in_progress`"]
5324        #[serde(rename = "in_progress")]
5325        InProgress,
5326        #[doc = "`completed`"]
5327        #[serde(rename = "completed")]
5328        Completed,
5329        #[doc = "`incomplete`"]
5330        #[serde(rename = "incomplete")]
5331        Incomplete,
5332        #[doc = "`interpreting`"]
5333        #[serde(rename = "interpreting")]
5334        Interpreting,
5335        #[doc = "`failed`"]
5336        #[serde(rename = "failed")]
5337        Failed,
5338    }
5339    #[allow(clippy::module_inception)]
5340    pub mod outputs {
5341        #[derive(Clone, Debug, PartialEq)]
5342        #[serde_with::serde_as]
5343        #[derive(serde :: Deserialize, serde :: Serialize)]
5344        #[serde(untagged)]
5345        #[allow(clippy::large_enum_variant)]
5346        pub enum Item {
5347            Logs(crate::__types::CodeInterpreterOutputLogs),
5348            Image(crate::__types::CodeInterpreterOutputImage),
5349        }
5350    }
5351}
5352#[doc = "A tool call to run code.\n"]
5353#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
5354pub struct CodeInterpreterToolCall {
5355    #[doc = "The unique ID of the code interpreter tool call.\n"]
5356    pub id: String,
5357    #[doc = "The status of the code interpreter tool call. Valid values are `in_progress`, `completed`, `incomplete`, `interpreting`, and `failed`.\n"]
5358    pub status: crate::__types::code_interpreter_tool_call::Status,
5359    #[doc = "The ID of the container used to run the code.\n"]
5360    pub container_id: String,
5361    #[doc = "The code to run, or null if not available.\n"]
5362    #[builder(default)]
5363    pub code: Option<String>,
5364    #[doc = "The outputs generated by the code interpreter, such as logs or images. \nCan be null if no outputs are available.\n"]
5365    #[builder(default)]
5366    pub outputs: Option<Vec<crate::__types::code_interpreter_tool_call::outputs::Item>>,
5367}
5368impl<'de> serde::Deserialize<'de> for CodeInterpreterToolCall {
5369    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
5370    where
5371        D: serde::Deserializer<'de>,
5372    {
5373        #[serde_with::serde_as]
5374        #[derive(serde :: Deserialize)]
5375        struct CodeInterpreterToolCall {
5376            #[serde(rename = "type")]
5377            #[allow(dead_code)]
5378            r#type: crate::__types::code_interpreter_tool_call::Type,
5379            #[serde(rename = "id")]
5380            id: String,
5381            #[serde(rename = "status")]
5382            status: crate::__types::code_interpreter_tool_call::Status,
5383            #[serde(rename = "container_id")]
5384            container_id: String,
5385            #[serde(rename = "code")]
5386            code: Option<String>,
5387            #[serde(rename = "outputs")]
5388            outputs: Option<Vec<crate::__types::code_interpreter_tool_call::outputs::Item>>,
5389        }
5390        let CodeInterpreterToolCall {
5391            id,
5392            status,
5393            container_id,
5394            code,
5395            outputs,
5396            ..
5397        } = CodeInterpreterToolCall::deserialize(deserializer)?;
5398        Ok(Self {
5399            id,
5400            status,
5401            container_id,
5402            code,
5403            outputs,
5404        })
5405    }
5406}
5407impl serde::Serialize for CodeInterpreterToolCall {
5408    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
5409    where
5410        S: serde::Serializer,
5411    {
5412        #[serde_with::serde_as]
5413        #[derive(serde :: Serialize)]
5414        struct CodeInterpreterToolCall<'a> {
5415            #[serde(rename = "type")]
5416            r#type: &'a crate::__types::code_interpreter_tool_call::Type,
5417            #[serde(rename = "id")]
5418            id: &'a String,
5419            #[serde(rename = "status")]
5420            status: &'a crate::__types::code_interpreter_tool_call::Status,
5421            #[serde(rename = "container_id")]
5422            container_id: &'a String,
5423            #[serde(rename = "code")]
5424            #[serde(skip_serializing_if = "Option::is_none")]
5425            code: &'a Option<String>,
5426            #[serde(rename = "outputs")]
5427            #[serde(skip_serializing_if = "Option::is_none")]
5428            outputs: &'a Option<Vec<crate::__types::code_interpreter_tool_call::outputs::Item>>,
5429        }
5430        let Self {
5431            id,
5432            status,
5433            container_id,
5434            code,
5435            outputs,
5436        } = self;
5437        CodeInterpreterToolCall {
5438            r#type: &Default::default(),
5439            id,
5440            status,
5441            container_id,
5442            code,
5443            outputs,
5444        }
5445        .serialize(serializer)
5446    }
5447}
5448#[allow(clippy::module_inception)]
5449pub mod comparison_filter {
5450    #[doc = "Specifies the comparison operator: `eq`, `ne`, `gt`, `gte`, `lt`, `lte`.\n- `eq`: equals\n- `ne`: not equal\n- `gt`: greater than\n- `gte`: greater than or equal\n- `lt`: less than\n- `lte`: less than or equal\n"]
5451    #[derive(Clone, Copy, Debug, Default, PartialEq, serde :: Deserialize, serde :: Serialize)]
5452    pub enum Type {
5453        #[doc = "`eq`"]
5454        #[default]
5455        #[serde(rename = "eq")]
5456        Eq,
5457        #[doc = "`ne`"]
5458        #[serde(rename = "ne")]
5459        Ne,
5460        #[doc = "`gt`"]
5461        #[serde(rename = "gt")]
5462        Gt,
5463        #[doc = "`gte`"]
5464        #[serde(rename = "gte")]
5465        Gte,
5466        #[doc = "`lt`"]
5467        #[serde(rename = "lt")]
5468        Lt,
5469        #[doc = "`lte`"]
5470        #[serde(rename = "lte")]
5471        Lte,
5472    }
5473    #[doc = "The value to compare against the attribute key; supports string, number, or boolean types."]
5474    #[derive(Clone, Debug, PartialEq)]
5475    #[serde_with::serde_as]
5476    #[derive(serde :: Deserialize, serde :: Serialize)]
5477    #[serde(untagged)]
5478    #[allow(clippy::large_enum_variant)]
5479    pub enum Value {
5480        String(String),
5481        Number(serde_json::Number),
5482        Bool(bool),
5483    }
5484}
5485#[doc = "A filter used to compare a specified attribute key to a given value using a defined comparison operation.\n"]
5486#[derive(Clone, Debug, PartialEq)]
5487#[serde_with::serde_as]
5488#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
5489pub struct ComparisonFilter {
5490    #[doc = "Specifies the comparison operator: `eq`, `ne`, `gt`, `gte`, `lt`, `lte`.\n- `eq`: equals\n- `ne`: not equal\n- `gt`: greater than\n- `gte`: greater than or equal\n- `lt`: less than\n- `lte`: less than or equal\n"]
5491    #[serde(rename = "type")]
5492    #[builder(default)]
5493    pub r#type: crate::__types::comparison_filter::Type,
5494    #[doc = "The key to compare against the value."]
5495    #[serde(rename = "key")]
5496    pub key: String,
5497    #[doc = "The value to compare against the attribute key; supports string, number, or boolean types."]
5498    #[serde(rename = "value")]
5499    pub value: crate::__types::comparison_filter::Value,
5500}
5501#[derive(Clone, Debug, PartialEq)]
5502#[serde_with::serde_as]
5503#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
5504pub struct CompleteUploadRequest {
5505    #[doc = "The ordered list of Part IDs.\n"]
5506    #[serde(rename = "part_ids")]
5507    pub part_ids: Vec<String>,
5508    #[doc = "The optional md5 checksum for the file contents to verify if the bytes uploaded matches what you expect.\n"]
5509    #[serde(rename = "md5")]
5510    #[serde(skip_serializing_if = "Option::is_none")]
5511    #[builder(default)]
5512    pub md5: Option<String>,
5513}
5514#[allow(clippy::module_inception)]
5515pub mod completion_usage {
5516    #[doc = "Breakdown of tokens used in a completion."]
5517    #[derive(Clone, Copy, Debug, Default, PartialEq)]
5518    #[serde_with::serde_as]
5519    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
5520    pub struct CompletionTokensDetails {
5521        #[doc = "When using Predicted Outputs, the number of tokens in the\nprediction that appeared in the completion.\n"]
5522        #[serde(rename = "accepted_prediction_tokens")]
5523        #[serde(skip_serializing_if = "Option::is_none")]
5524        #[builder(default)]
5525        pub accepted_prediction_tokens: Option<i64>,
5526        #[doc = "Audio input tokens generated by the model."]
5527        #[serde(rename = "audio_tokens")]
5528        #[serde(skip_serializing_if = "Option::is_none")]
5529        #[builder(default)]
5530        pub audio_tokens: Option<i64>,
5531        #[doc = "Tokens generated by the model for reasoning."]
5532        #[serde(rename = "reasoning_tokens")]
5533        #[serde(skip_serializing_if = "Option::is_none")]
5534        #[builder(default)]
5535        pub reasoning_tokens: Option<i64>,
5536        #[doc = "When using Predicted Outputs, the number of tokens in the\nprediction that did not appear in the completion. However, like\nreasoning tokens, these tokens are still counted in the total\ncompletion tokens for purposes of billing, output, and context window\nlimits.\n"]
5537        #[serde(rename = "rejected_prediction_tokens")]
5538        #[serde(skip_serializing_if = "Option::is_none")]
5539        #[builder(default)]
5540        pub rejected_prediction_tokens: Option<i64>,
5541    }
5542    #[doc = "Breakdown of tokens used in the prompt."]
5543    #[derive(Clone, Copy, Debug, Default, PartialEq)]
5544    #[serde_with::serde_as]
5545    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
5546    pub struct PromptTokensDetails {
5547        #[doc = "Audio input tokens present in the prompt."]
5548        #[serde(rename = "audio_tokens")]
5549        #[serde(skip_serializing_if = "Option::is_none")]
5550        #[builder(default)]
5551        pub audio_tokens: Option<i64>,
5552        #[doc = "Cached tokens present in the prompt."]
5553        #[serde(rename = "cached_tokens")]
5554        #[serde(skip_serializing_if = "Option::is_none")]
5555        #[builder(default)]
5556        pub cached_tokens: Option<i64>,
5557    }
5558}
5559#[doc = "Usage statistics for the completion request."]
5560#[derive(Clone, Copy, Debug, PartialEq)]
5561#[serde_with::serde_as]
5562#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
5563pub struct CompletionUsage {
5564    #[doc = "Number of tokens in the generated completion."]
5565    #[serde(rename = "completion_tokens")]
5566    pub completion_tokens: i64,
5567    #[doc = "Number of tokens in the prompt."]
5568    #[serde(rename = "prompt_tokens")]
5569    pub prompt_tokens: i64,
5570    #[doc = "Total number of tokens used in the request (prompt + completion)."]
5571    #[serde(rename = "total_tokens")]
5572    pub total_tokens: i64,
5573    #[doc = "Breakdown of tokens used in a completion."]
5574    #[serde(rename = "completion_tokens_details")]
5575    #[serde(skip_serializing_if = "Option::is_none")]
5576    #[builder(default)]
5577    pub completion_tokens_details:
5578        Option<crate::__types::completion_usage::CompletionTokensDetails>,
5579    #[doc = "Breakdown of tokens used in the prompt."]
5580    #[serde(rename = "prompt_tokens_details")]
5581    #[serde(skip_serializing_if = "Option::is_none")]
5582    #[builder(default)]
5583    pub prompt_tokens_details: Option<crate::__types::completion_usage::PromptTokensDetails>,
5584}
5585#[allow(clippy::module_inception)]
5586pub mod compound_filter {
5587    #[doc = "Type of operation: `and` or `or`."]
5588    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
5589    pub enum Type {
5590        #[doc = "`and`"]
5591        #[serde(rename = "and")]
5592        And,
5593        #[doc = "`or`"]
5594        #[serde(rename = "or")]
5595        Or,
5596    }
5597    #[allow(clippy::module_inception)]
5598    pub mod filters {
5599        #[derive(Clone, Debug, PartialEq)]
5600        #[serde_with::serde_as]
5601        #[derive(serde :: Deserialize, serde :: Serialize)]
5602        #[serde(untagged)]
5603        #[allow(clippy::large_enum_variant)]
5604        pub enum Item {
5605            ComparisonFilter(crate::__types::ComparisonFilter),
5606            CompoundFilter(crate::__types::CompoundFilter),
5607        }
5608    }
5609}
5610#[doc = "Combine multiple filters using `and` or `or`."]
5611#[derive(Clone, Debug, PartialEq)]
5612#[serde_with::serde_as]
5613#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
5614pub struct CompoundFilter {
5615    #[doc = "Type of operation: `and` or `or`."]
5616    #[serde(rename = "type")]
5617    pub r#type: crate::__types::compound_filter::Type,
5618    #[doc = "Array of filters to combine. Items can be `ComparisonFilter` or `CompoundFilter`."]
5619    #[serde(rename = "filters")]
5620    pub filters: Vec<crate::__types::compound_filter::filters::Item>,
5621}
5622#[derive(Clone, Debug, PartialEq)]
5623#[serde_with::serde_as]
5624#[derive(serde :: Deserialize, serde :: Serialize)]
5625#[serde(untagged)]
5626#[allow(clippy::large_enum_variant)]
5627pub enum ComputerAction {
5628    Click(crate::__types::Click),
5629    DoubleClick(crate::__types::DoubleClick),
5630    Drag(crate::__types::Drag),
5631    Keypress(crate::__types::KeyPress),
5632    Move(crate::__types::Move),
5633    Screenshot(crate::__types::Screenshot),
5634    Scroll(crate::__types::Scroll),
5635    Type(crate::__types::Type),
5636    Wait(crate::__types::Wait),
5637}
5638#[allow(clippy::module_inception)]
5639pub(crate) mod computer_screenshot_image {
5640    #[doc = "Specifies the event type. For a computer screenshot, this property is \nalways set to `computer_screenshot`.\n"]
5641    #[derive(Clone, Copy, Debug, Default, PartialEq)]
5642    pub(crate) struct Type;
5643    impl_serde!(Type, "computer_screenshot");
5644}
5645#[doc = "A computer screenshot image used with the computer use tool.\n"]
5646#[derive(Clone, Debug, Default, PartialEq, typed_builder :: TypedBuilder)]
5647pub struct ComputerScreenshotImage {
5648    #[doc = "The URL of the screenshot image."]
5649    #[builder(default)]
5650    pub image_url: Option<String>,
5651    #[doc = "The identifier of an uploaded file that contains the screenshot."]
5652    #[builder(default)]
5653    pub file_id: Option<String>,
5654}
5655impl<'de> serde::Deserialize<'de> for ComputerScreenshotImage {
5656    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
5657    where
5658        D: serde::Deserializer<'de>,
5659    {
5660        #[serde_with::serde_as]
5661        #[derive(serde :: Deserialize)]
5662        struct ComputerScreenshotImage {
5663            #[serde(rename = "type")]
5664            #[allow(dead_code)]
5665            r#type: crate::__types::computer_screenshot_image::Type,
5666            #[serde(rename = "image_url")]
5667            image_url: Option<String>,
5668            #[serde(rename = "file_id")]
5669            file_id: Option<String>,
5670        }
5671        let ComputerScreenshotImage {
5672            image_url, file_id, ..
5673        } = ComputerScreenshotImage::deserialize(deserializer)?;
5674        Ok(Self { image_url, file_id })
5675    }
5676}
5677impl serde::Serialize for ComputerScreenshotImage {
5678    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
5679    where
5680        S: serde::Serializer,
5681    {
5682        #[serde_with::serde_as]
5683        #[derive(serde :: Serialize)]
5684        struct ComputerScreenshotImage<'a> {
5685            #[serde(rename = "type")]
5686            r#type: &'a crate::__types::computer_screenshot_image::Type,
5687            #[serde(rename = "image_url")]
5688            #[serde(skip_serializing_if = "Option::is_none")]
5689            image_url: &'a Option<String>,
5690            #[serde(rename = "file_id")]
5691            #[serde(skip_serializing_if = "Option::is_none")]
5692            file_id: &'a Option<String>,
5693        }
5694        let Self { image_url, file_id } = self;
5695        ComputerScreenshotImage {
5696            r#type: &Default::default(),
5697            image_url,
5698            file_id,
5699        }
5700        .serialize(serializer)
5701    }
5702}
5703#[allow(clippy::module_inception)]
5704pub mod computer_tool_call {
5705    #[doc = "The type of the computer call. Always `computer_call`."]
5706    #[derive(Clone, Copy, Debug, Default, PartialEq)]
5707    pub(crate) struct Type;
5708    impl_serde!(Type, "computer_call");
5709    #[doc = "The status of the item. One of `in_progress`, `completed`, or\n`incomplete`. Populated when items are returned via API.\n"]
5710    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
5711    pub enum Status {
5712        #[doc = "`in_progress`"]
5713        #[serde(rename = "in_progress")]
5714        InProgress,
5715        #[doc = "`completed`"]
5716        #[serde(rename = "completed")]
5717        Completed,
5718        #[doc = "`incomplete`"]
5719        #[serde(rename = "incomplete")]
5720        Incomplete,
5721    }
5722}
5723#[doc = "A tool call to a computer use tool. See the \n[computer use guide](https://platform.openai.com/docs/guides/tools-computer-use) for more information.\n"]
5724#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
5725pub struct ComputerToolCall {
5726    #[doc = "The unique ID of the computer call."]
5727    pub id: String,
5728    #[doc = "An identifier used when responding to the tool call with output.\n"]
5729    pub call_id: String,
5730    pub action: crate::__types::ComputerAction,
5731    #[doc = "The pending safety checks for the computer call.\n"]
5732    pub pending_safety_checks: Vec<crate::__types::ComputerToolCallSafetyCheck>,
5733    #[doc = "The status of the item. One of `in_progress`, `completed`, or\n`incomplete`. Populated when items are returned via API.\n"]
5734    pub status: crate::__types::computer_tool_call::Status,
5735}
5736impl<'de> serde::Deserialize<'de> for ComputerToolCall {
5737    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
5738    where
5739        D: serde::Deserializer<'de>,
5740    {
5741        #[serde_with::serde_as]
5742        #[derive(serde :: Deserialize)]
5743        struct ComputerToolCall {
5744            #[serde(rename = "type")]
5745            #[allow(dead_code)]
5746            r#type: crate::__types::computer_tool_call::Type,
5747            #[serde(rename = "id")]
5748            id: String,
5749            #[serde(rename = "call_id")]
5750            call_id: String,
5751            #[serde(rename = "action")]
5752            action: crate::__types::ComputerAction,
5753            #[serde(rename = "pending_safety_checks")]
5754            pending_safety_checks: Vec<crate::__types::ComputerToolCallSafetyCheck>,
5755            #[serde(rename = "status")]
5756            status: crate::__types::computer_tool_call::Status,
5757        }
5758        let ComputerToolCall {
5759            id,
5760            call_id,
5761            action,
5762            pending_safety_checks,
5763            status,
5764            ..
5765        } = ComputerToolCall::deserialize(deserializer)?;
5766        Ok(Self {
5767            id,
5768            call_id,
5769            action,
5770            pending_safety_checks,
5771            status,
5772        })
5773    }
5774}
5775impl serde::Serialize for ComputerToolCall {
5776    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
5777    where
5778        S: serde::Serializer,
5779    {
5780        #[serde_with::serde_as]
5781        #[derive(serde :: Serialize)]
5782        struct ComputerToolCall<'a> {
5783            #[serde(rename = "type")]
5784            r#type: &'a crate::__types::computer_tool_call::Type,
5785            #[serde(rename = "id")]
5786            id: &'a String,
5787            #[serde(rename = "call_id")]
5788            call_id: &'a String,
5789            #[serde(rename = "action")]
5790            action: &'a crate::__types::ComputerAction,
5791            #[serde(rename = "pending_safety_checks")]
5792            pending_safety_checks: &'a Vec<crate::__types::ComputerToolCallSafetyCheck>,
5793            #[serde(rename = "status")]
5794            status: &'a crate::__types::computer_tool_call::Status,
5795        }
5796        let Self {
5797            id,
5798            call_id,
5799            action,
5800            pending_safety_checks,
5801            status,
5802        } = self;
5803        ComputerToolCall {
5804            r#type: &Default::default(),
5805            id,
5806            call_id,
5807            action,
5808            pending_safety_checks,
5809            status,
5810        }
5811        .serialize(serializer)
5812    }
5813}
5814#[allow(clippy::module_inception)]
5815pub mod computer_tool_call_output {
5816    #[doc = "The type of the computer tool call output. Always `computer_call_output`.\n"]
5817    #[derive(Clone, Copy, Debug, Default, PartialEq)]
5818    pub(crate) struct Type;
5819    impl_serde!(Type, "computer_call_output");
5820    #[doc = "The status of the message input. One of `in_progress`, `completed`, or\n`incomplete`. Populated when input items are returned via API.\n"]
5821    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
5822    pub enum Status {
5823        #[doc = "`in_progress`"]
5824        #[serde(rename = "in_progress")]
5825        InProgress,
5826        #[doc = "`completed`"]
5827        #[serde(rename = "completed")]
5828        Completed,
5829        #[doc = "`incomplete`"]
5830        #[serde(rename = "incomplete")]
5831        Incomplete,
5832    }
5833}
5834#[doc = "The output of a computer tool call.\n"]
5835#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
5836pub struct ComputerToolCallOutput {
5837    #[doc = "The ID of the computer tool call output.\n"]
5838    #[builder(default)]
5839    pub id: Option<String>,
5840    #[doc = "The ID of the computer tool call that produced the output.\n"]
5841    pub call_id: String,
5842    #[doc = "The safety checks reported by the API that have been acknowledged by the \ndeveloper.\n"]
5843    #[builder(default)]
5844    pub acknowledged_safety_checks: Option<Vec<crate::__types::ComputerToolCallSafetyCheck>>,
5845    #[builder(default)]
5846    pub output: crate::__types::ComputerScreenshotImage,
5847    #[doc = "The status of the message input. One of `in_progress`, `completed`, or\n`incomplete`. Populated when input items are returned via API.\n"]
5848    #[builder(default)]
5849    pub status: Option<crate::__types::computer_tool_call_output::Status>,
5850}
5851impl<'de> serde::Deserialize<'de> for ComputerToolCallOutput {
5852    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
5853    where
5854        D: serde::Deserializer<'de>,
5855    {
5856        #[serde_with::serde_as]
5857        #[derive(serde :: Deserialize)]
5858        struct ComputerToolCallOutput {
5859            #[serde(rename = "type")]
5860            #[allow(dead_code)]
5861            r#type: crate::__types::computer_tool_call_output::Type,
5862            #[serde(rename = "id")]
5863            id: Option<String>,
5864            #[serde(rename = "call_id")]
5865            call_id: String,
5866            #[serde(rename = "acknowledged_safety_checks")]
5867            acknowledged_safety_checks: Option<Vec<crate::__types::ComputerToolCallSafetyCheck>>,
5868            #[serde(rename = "output")]
5869            output: crate::__types::ComputerScreenshotImage,
5870            #[serde(rename = "status")]
5871            status: Option<crate::__types::computer_tool_call_output::Status>,
5872        }
5873        let ComputerToolCallOutput {
5874            id,
5875            call_id,
5876            acknowledged_safety_checks,
5877            output,
5878            status,
5879            ..
5880        } = ComputerToolCallOutput::deserialize(deserializer)?;
5881        Ok(Self {
5882            id,
5883            call_id,
5884            acknowledged_safety_checks,
5885            output,
5886            status,
5887        })
5888    }
5889}
5890impl serde::Serialize for ComputerToolCallOutput {
5891    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
5892    where
5893        S: serde::Serializer,
5894    {
5895        #[serde_with::serde_as]
5896        #[derive(serde :: Serialize)]
5897        struct ComputerToolCallOutput<'a> {
5898            #[serde(rename = "type")]
5899            r#type: &'a crate::__types::computer_tool_call_output::Type,
5900            #[serde(rename = "id")]
5901            #[serde(skip_serializing_if = "Option::is_none")]
5902            id: &'a Option<String>,
5903            #[serde(rename = "call_id")]
5904            call_id: &'a String,
5905            #[serde(rename = "acknowledged_safety_checks")]
5906            #[serde(skip_serializing_if = "Option::is_none")]
5907            acknowledged_safety_checks:
5908                &'a Option<Vec<crate::__types::ComputerToolCallSafetyCheck>>,
5909            #[serde(rename = "output")]
5910            output: &'a crate::__types::ComputerScreenshotImage,
5911            #[serde(rename = "status")]
5912            #[serde(skip_serializing_if = "Option::is_none")]
5913            status: &'a Option<crate::__types::computer_tool_call_output::Status>,
5914        }
5915        let Self {
5916            id,
5917            call_id,
5918            acknowledged_safety_checks,
5919            output,
5920            status,
5921        } = self;
5922        ComputerToolCallOutput {
5923            r#type: &Default::default(),
5924            id,
5925            call_id,
5926            acknowledged_safety_checks,
5927            output,
5928            status,
5929        }
5930        .serialize(serializer)
5931    }
5932}
5933#[allow(clippy::module_inception)]
5934pub mod computer_tool_call_output_resource {
5935    #[doc = "The type of the computer tool call output. Always `computer_call_output`.\n"]
5936    #[derive(Clone, Copy, Debug, Default, PartialEq)]
5937    pub(crate) struct Type;
5938    impl_serde!(Type, "computer_call_output");
5939    #[doc = "The status of the message input. One of `in_progress`, `completed`, or\n`incomplete`. Populated when input items are returned via API.\n"]
5940    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
5941    pub enum Status {
5942        #[doc = "`in_progress`"]
5943        #[serde(rename = "in_progress")]
5944        InProgress,
5945        #[doc = "`completed`"]
5946        #[serde(rename = "completed")]
5947        Completed,
5948        #[doc = "`incomplete`"]
5949        #[serde(rename = "incomplete")]
5950        Incomplete,
5951    }
5952}
5953#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
5954pub struct ComputerToolCallOutputResource {
5955    #[doc = "The ID of the computer tool call output.\n"]
5956    pub id: String,
5957    #[doc = "The ID of the computer tool call that produced the output.\n"]
5958    pub call_id: String,
5959    #[doc = "The safety checks reported by the API that have been acknowledged by the \ndeveloper.\n"]
5960    #[builder(default)]
5961    pub acknowledged_safety_checks: Option<Vec<crate::__types::ComputerToolCallSafetyCheck>>,
5962    #[builder(default)]
5963    pub output: crate::__types::ComputerScreenshotImage,
5964    #[doc = "The status of the message input. One of `in_progress`, `completed`, or\n`incomplete`. Populated when input items are returned via API.\n"]
5965    #[builder(default)]
5966    pub status: Option<crate::__types::computer_tool_call_output_resource::Status>,
5967}
5968impl<'de> serde::Deserialize<'de> for ComputerToolCallOutputResource {
5969    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
5970    where
5971        D: serde::Deserializer<'de>,
5972    {
5973        #[serde_with::serde_as]
5974        #[derive(serde :: Deserialize)]
5975        struct ComputerToolCallOutputResource {
5976            #[serde(rename = "type")]
5977            #[allow(dead_code)]
5978            r#type: crate::__types::computer_tool_call_output_resource::Type,
5979            #[serde(rename = "id")]
5980            id: String,
5981            #[serde(rename = "call_id")]
5982            call_id: String,
5983            #[serde(rename = "acknowledged_safety_checks")]
5984            acknowledged_safety_checks: Option<Vec<crate::__types::ComputerToolCallSafetyCheck>>,
5985            #[serde(rename = "output")]
5986            output: crate::__types::ComputerScreenshotImage,
5987            #[serde(rename = "status")]
5988            status: Option<crate::__types::computer_tool_call_output_resource::Status>,
5989        }
5990        let ComputerToolCallOutputResource {
5991            id,
5992            call_id,
5993            acknowledged_safety_checks,
5994            output,
5995            status,
5996            ..
5997        } = ComputerToolCallOutputResource::deserialize(deserializer)?;
5998        Ok(Self {
5999            id,
6000            call_id,
6001            acknowledged_safety_checks,
6002            output,
6003            status,
6004        })
6005    }
6006}
6007impl serde::Serialize for ComputerToolCallOutputResource {
6008    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
6009    where
6010        S: serde::Serializer,
6011    {
6012        #[serde_with::serde_as]
6013        #[derive(serde :: Serialize)]
6014        struct ComputerToolCallOutputResource<'a> {
6015            #[serde(rename = "type")]
6016            r#type: &'a crate::__types::computer_tool_call_output_resource::Type,
6017            #[serde(rename = "id")]
6018            id: &'a String,
6019            #[serde(rename = "call_id")]
6020            call_id: &'a String,
6021            #[serde(rename = "acknowledged_safety_checks")]
6022            #[serde(skip_serializing_if = "Option::is_none")]
6023            acknowledged_safety_checks:
6024                &'a Option<Vec<crate::__types::ComputerToolCallSafetyCheck>>,
6025            #[serde(rename = "output")]
6026            output: &'a crate::__types::ComputerScreenshotImage,
6027            #[serde(rename = "status")]
6028            #[serde(skip_serializing_if = "Option::is_none")]
6029            status: &'a Option<crate::__types::computer_tool_call_output_resource::Status>,
6030        }
6031        let Self {
6032            id,
6033            call_id,
6034            acknowledged_safety_checks,
6035            output,
6036            status,
6037        } = self;
6038        ComputerToolCallOutputResource {
6039            r#type: &Default::default(),
6040            id,
6041            call_id,
6042            acknowledged_safety_checks,
6043            output,
6044            status,
6045        }
6046        .serialize(serializer)
6047    }
6048}
6049#[doc = "A pending safety check for the computer call.\n"]
6050#[derive(Clone, Debug, PartialEq)]
6051#[serde_with::serde_as]
6052#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
6053pub struct ComputerToolCallSafetyCheck {
6054    #[doc = "The ID of the pending safety check."]
6055    #[serde(rename = "id")]
6056    pub id: String,
6057    #[doc = "The type of the pending safety check."]
6058    #[serde(rename = "code")]
6059    pub code: String,
6060    #[doc = "Details about the pending safety check."]
6061    #[serde(rename = "message")]
6062    pub message: String,
6063}
6064#[allow(clippy::module_inception)]
6065pub(crate) mod container_file_list_resource {
6066    #[doc = "The type of object returned, must be 'list'."]
6067    #[derive(Clone, Copy, Debug, Default, PartialEq)]
6068    pub(crate) struct Object;
6069    impl_serde!(Object, "list");
6070}
6071#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
6072pub struct ContainerFileListResource {
6073    #[doc = "A list of container files."]
6074    pub data: Vec<crate::__types::ContainerFileResource>,
6075    #[doc = "The ID of the first file in the list."]
6076    pub first_id: String,
6077    #[doc = "The ID of the last file in the list."]
6078    pub last_id: String,
6079    #[doc = "Whether there are more files available."]
6080    pub has_more: bool,
6081}
6082impl<'de> serde::Deserialize<'de> for ContainerFileListResource {
6083    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
6084    where
6085        D: serde::Deserializer<'de>,
6086    {
6087        #[serde_with::serde_as]
6088        #[derive(serde :: Deserialize)]
6089        struct ContainerFileListResource {
6090            #[serde(rename = "object")]
6091            #[allow(dead_code)]
6092            object: crate::__types::container_file_list_resource::Object,
6093            #[serde(rename = "data")]
6094            data: Vec<crate::__types::ContainerFileResource>,
6095            #[serde(rename = "first_id")]
6096            first_id: String,
6097            #[serde(rename = "last_id")]
6098            last_id: String,
6099            #[serde(rename = "has_more")]
6100            has_more: bool,
6101        }
6102        let ContainerFileListResource {
6103            data,
6104            first_id,
6105            last_id,
6106            has_more,
6107            ..
6108        } = ContainerFileListResource::deserialize(deserializer)?;
6109        Ok(Self {
6110            data,
6111            first_id,
6112            last_id,
6113            has_more,
6114        })
6115    }
6116}
6117impl serde::Serialize for ContainerFileListResource {
6118    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
6119    where
6120        S: serde::Serializer,
6121    {
6122        #[serde_with::serde_as]
6123        #[derive(serde :: Serialize)]
6124        struct ContainerFileListResource<'a> {
6125            #[serde(rename = "object")]
6126            object: &'a crate::__types::container_file_list_resource::Object,
6127            #[serde(rename = "data")]
6128            data: &'a Vec<crate::__types::ContainerFileResource>,
6129            #[serde(rename = "first_id")]
6130            first_id: &'a String,
6131            #[serde(rename = "last_id")]
6132            last_id: &'a String,
6133            #[serde(rename = "has_more")]
6134            has_more: &'a bool,
6135        }
6136        let Self {
6137            data,
6138            first_id,
6139            last_id,
6140            has_more,
6141        } = self;
6142        ContainerFileListResource {
6143            object: &Default::default(),
6144            data,
6145            first_id,
6146            last_id,
6147            has_more,
6148        }
6149        .serialize(serializer)
6150    }
6151}
6152#[derive(Clone, Debug, PartialEq)]
6153#[serde_with::serde_as]
6154#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
6155pub struct ContainerFileResource {
6156    #[doc = "Unique identifier for the file."]
6157    #[serde(rename = "id")]
6158    pub id: String,
6159    #[doc = "The type of this object (`container.file`)."]
6160    #[serde(rename = "object")]
6161    pub object: String,
6162    #[doc = "The container this file belongs to."]
6163    #[serde(rename = "container_id")]
6164    pub container_id: String,
6165    #[doc = "Unix timestamp (in seconds) when the file was created."]
6166    #[serde(rename = "created_at")]
6167    pub created_at: i64,
6168    #[doc = "Size of the file in bytes."]
6169    #[serde(rename = "bytes")]
6170    pub bytes: i64,
6171    #[doc = "Path of the file in the container."]
6172    #[serde(rename = "path")]
6173    pub path: String,
6174    #[doc = "Source of the file (e.g., `user`, `assistant`)."]
6175    #[serde(rename = "source")]
6176    pub source: String,
6177}
6178#[allow(clippy::module_inception)]
6179pub(crate) mod container_list_resource {
6180    #[doc = "The type of object returned, must be 'list'."]
6181    #[derive(Clone, Copy, Debug, Default, PartialEq)]
6182    pub(crate) struct Object;
6183    impl_serde!(Object, "list");
6184}
6185#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
6186pub struct ContainerListResource {
6187    #[doc = "A list of containers."]
6188    pub data: Vec<crate::__types::ContainerResource>,
6189    #[doc = "The ID of the first container in the list."]
6190    pub first_id: String,
6191    #[doc = "The ID of the last container in the list."]
6192    pub last_id: String,
6193    #[doc = "Whether there are more containers available."]
6194    pub has_more: bool,
6195}
6196impl<'de> serde::Deserialize<'de> for ContainerListResource {
6197    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
6198    where
6199        D: serde::Deserializer<'de>,
6200    {
6201        #[serde_with::serde_as]
6202        #[derive(serde :: Deserialize)]
6203        struct ContainerListResource {
6204            #[serde(rename = "object")]
6205            #[allow(dead_code)]
6206            object: crate::__types::container_list_resource::Object,
6207            #[serde(rename = "data")]
6208            data: Vec<crate::__types::ContainerResource>,
6209            #[serde(rename = "first_id")]
6210            first_id: String,
6211            #[serde(rename = "last_id")]
6212            last_id: String,
6213            #[serde(rename = "has_more")]
6214            has_more: bool,
6215        }
6216        let ContainerListResource {
6217            data,
6218            first_id,
6219            last_id,
6220            has_more,
6221            ..
6222        } = ContainerListResource::deserialize(deserializer)?;
6223        Ok(Self {
6224            data,
6225            first_id,
6226            last_id,
6227            has_more,
6228        })
6229    }
6230}
6231impl serde::Serialize for ContainerListResource {
6232    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
6233    where
6234        S: serde::Serializer,
6235    {
6236        #[serde_with::serde_as]
6237        #[derive(serde :: Serialize)]
6238        struct ContainerListResource<'a> {
6239            #[serde(rename = "object")]
6240            object: &'a crate::__types::container_list_resource::Object,
6241            #[serde(rename = "data")]
6242            data: &'a Vec<crate::__types::ContainerResource>,
6243            #[serde(rename = "first_id")]
6244            first_id: &'a String,
6245            #[serde(rename = "last_id")]
6246            last_id: &'a String,
6247            #[serde(rename = "has_more")]
6248            has_more: &'a bool,
6249        }
6250        let Self {
6251            data,
6252            first_id,
6253            last_id,
6254            has_more,
6255        } = self;
6256        ContainerListResource {
6257            object: &Default::default(),
6258            data,
6259            first_id,
6260            last_id,
6261            has_more,
6262        }
6263        .serialize(serializer)
6264    }
6265}
6266#[allow(clippy::module_inception)]
6267pub mod container_resource {
6268    #[allow(clippy::module_inception)]
6269    pub mod expires_after {
6270        #[doc = "The reference point for the expiration."]
6271        #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
6272        pub enum Anchor {
6273            #[doc = "`last_active_at`"]
6274            #[serde(rename = "last_active_at")]
6275            LastActiveAt,
6276        }
6277    }
6278    #[doc = "The container will expire after this time period.\nThe anchor is the reference point for the expiration.\nThe minutes is the number of minutes after the anchor before the container expires.\n"]
6279    #[derive(Clone, Copy, Debug, Default, PartialEq)]
6280    #[serde_with::serde_as]
6281    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
6282    pub struct ExpiresAfter {
6283        #[doc = "The reference point for the expiration."]
6284        #[serde(rename = "anchor")]
6285        #[serde(skip_serializing_if = "Option::is_none")]
6286        #[builder(default)]
6287        pub anchor: Option<crate::__types::container_resource::expires_after::Anchor>,
6288        #[doc = "The number of minutes after the anchor before the container expires."]
6289        #[serde(rename = "minutes")]
6290        #[serde(skip_serializing_if = "Option::is_none")]
6291        #[builder(default)]
6292        pub minutes: Option<i64>,
6293    }
6294}
6295#[derive(Clone, Debug, PartialEq)]
6296#[serde_with::serde_as]
6297#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
6298pub struct ContainerResource {
6299    #[doc = "Unique identifier for the container."]
6300    #[serde(rename = "id")]
6301    pub id: String,
6302    #[doc = "The type of this object."]
6303    #[serde(rename = "object")]
6304    pub object: String,
6305    #[doc = "Name of the container."]
6306    #[serde(rename = "name")]
6307    pub name: String,
6308    #[doc = "Unix timestamp (in seconds) when the container was created."]
6309    #[serde(rename = "created_at")]
6310    pub created_at: i64,
6311    #[doc = "Status of the container (e.g., active, deleted)."]
6312    #[serde(rename = "status")]
6313    pub status: String,
6314    #[doc = "The container will expire after this time period.\nThe anchor is the reference point for the expiration.\nThe minutes is the number of minutes after the anchor before the container expires.\n"]
6315    #[serde(rename = "expires_after")]
6316    #[serde(skip_serializing_if = "Option::is_none")]
6317    #[builder(default)]
6318    pub expires_after: Option<crate::__types::container_resource::ExpiresAfter>,
6319}
6320#[doc = "Multi-modal input and output contents.\n"]
6321#[derive(Clone, Debug, PartialEq)]
6322#[serde_with::serde_as]
6323#[derive(serde :: Deserialize, serde :: Serialize)]
6324#[serde(untagged)]
6325#[allow(clippy::large_enum_variant)]
6326pub enum Content {
6327    InputContent(crate::__types::InputContent),
6328    OutputContent(crate::__types::OutputContent),
6329}
6330#[allow(clippy::module_inception)]
6331pub(crate) mod conversation {
6332    #[doc = "The object type, which is always `conversation`."]
6333    #[derive(Clone, Copy, Debug, Default, PartialEq)]
6334    pub(crate) struct Object;
6335    impl_serde!(Object, "conversation");
6336}
6337#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
6338pub struct Conversation {
6339    #[doc = "The unique ID of the conversation."]
6340    pub id: String,
6341    #[doc = "Set of 16 key-value pairs that can be attached to an object. This can be         useful for storing additional information about the object in a structured         format, and querying for objects via API or the dashboard.\n        Keys are strings with a maximum length of 64 characters. Values are strings         with a maximum length of 512 characters."]
6342    pub metadata: serde_json::Value,
6343    #[doc = "The time at which the conversation was created, measured in seconds since the Unix epoch."]
6344    pub created_at: i64,
6345}
6346impl<'de> serde::Deserialize<'de> for Conversation {
6347    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
6348    where
6349        D: serde::Deserializer<'de>,
6350    {
6351        #[serde_with::serde_as]
6352        #[derive(serde :: Deserialize)]
6353        struct Conversation {
6354            #[serde(rename = "id")]
6355            id: String,
6356            #[serde(rename = "object")]
6357            #[allow(dead_code)]
6358            object: crate::__types::conversation::Object,
6359            #[serde(rename = "metadata")]
6360            metadata: serde_json::Value,
6361            #[serde(rename = "created_at")]
6362            created_at: i64,
6363        }
6364        let Conversation {
6365            id,
6366            metadata,
6367            created_at,
6368            ..
6369        } = Conversation::deserialize(deserializer)?;
6370        Ok(Self {
6371            id,
6372            metadata,
6373            created_at,
6374        })
6375    }
6376}
6377impl serde::Serialize for Conversation {
6378    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
6379    where
6380        S: serde::Serializer,
6381    {
6382        #[serde_with::serde_as]
6383        #[derive(serde :: Serialize)]
6384        struct Conversation<'a> {
6385            #[serde(rename = "id")]
6386            id: &'a String,
6387            #[serde(rename = "object")]
6388            object: &'a crate::__types::conversation::Object,
6389            #[serde(rename = "metadata")]
6390            metadata: &'a serde_json::Value,
6391            #[serde(rename = "created_at")]
6392            created_at: &'a i64,
6393        }
6394        let Self {
6395            id,
6396            metadata,
6397            created_at,
6398        } = self;
6399        Conversation {
6400            id,
6401            object: &Default::default(),
6402            metadata,
6403            created_at,
6404        }
6405        .serialize(serializer)
6406    }
6407}
6408#[doc = "A single item within a conversation. The set of possible types are the same as the `output` type of a [Response object](https://platform.openai.com/docs/api-reference/responses/object#responses/object-output)."]
6409#[derive(Clone, Debug, PartialEq)]
6410#[serde_with::serde_as]
6411#[derive(serde :: Deserialize, serde :: Serialize)]
6412#[serde(untagged)]
6413#[allow(clippy::large_enum_variant)]
6414pub enum ConversationItem {
6415    Message(crate::__types::Message),
6416    FunctionCall(crate::__types::FunctionToolCallResource),
6417    FunctionCallOutput(crate::__types::FunctionToolCallOutputResource),
6418    FileSearchCall(crate::__types::FileSearchToolCall),
6419    WebSearchCall(crate::__types::WebSearchToolCall),
6420    ImageGenerationCall(crate::__types::ImageGenToolCall),
6421    ComputerCall(crate::__types::ComputerToolCall),
6422    ComputerCallOutput(crate::__types::ComputerToolCallOutputResource),
6423    Reasoning(crate::__types::ReasoningItem),
6424    CodeInterpreterCall(crate::__types::CodeInterpreterToolCall),
6425    LocalShellCall(crate::__types::LocalShellToolCall),
6426    LocalShellCallOutput(crate::__types::LocalShellToolCallOutput),
6427    McpListTools(crate::__types::McpListTools),
6428    McpApprovalRequest(crate::__types::McpApprovalRequest),
6429    McpApprovalResponse(crate::__types::McpApprovalResponseResource),
6430    McpCall(crate::__types::McpToolCall),
6431    CustomToolCall(crate::__types::CustomToolCall),
6432    CustomToolCallOutput(crate::__types::CustomToolCallOutput),
6433}
6434#[allow(clippy::module_inception)]
6435pub(crate) mod conversation_item_list {
6436    #[doc = "The type of object returned, must be `list`."]
6437    #[derive(Clone, Copy, Debug, Default, PartialEq)]
6438    pub(crate) struct Object;
6439    impl_serde!(Object, "list");
6440}
6441#[doc = "A list of Conversation items."]
6442#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
6443pub struct ConversationItemList {
6444    #[doc = "A list of conversation items."]
6445    pub data: Vec<crate::__types::ConversationItem>,
6446    #[doc = "Whether there are more items available."]
6447    pub has_more: bool,
6448    #[doc = "The ID of the first item in the list."]
6449    pub first_id: String,
6450    #[doc = "The ID of the last item in the list."]
6451    pub last_id: String,
6452}
6453impl<'de> serde::Deserialize<'de> for ConversationItemList {
6454    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
6455    where
6456        D: serde::Deserializer<'de>,
6457    {
6458        #[serde_with::serde_as]
6459        #[derive(serde :: Deserialize)]
6460        struct ConversationItemList {
6461            #[serde(rename = "object")]
6462            #[allow(dead_code)]
6463            object: crate::__types::conversation_item_list::Object,
6464            #[serde(rename = "data")]
6465            data: Vec<crate::__types::ConversationItem>,
6466            #[serde(rename = "has_more")]
6467            has_more: bool,
6468            #[serde(rename = "first_id")]
6469            first_id: String,
6470            #[serde(rename = "last_id")]
6471            last_id: String,
6472        }
6473        let ConversationItemList {
6474            data,
6475            has_more,
6476            first_id,
6477            last_id,
6478            ..
6479        } = ConversationItemList::deserialize(deserializer)?;
6480        Ok(Self {
6481            data,
6482            has_more,
6483            first_id,
6484            last_id,
6485        })
6486    }
6487}
6488impl serde::Serialize for ConversationItemList {
6489    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
6490    where
6491        S: serde::Serializer,
6492    {
6493        #[serde_with::serde_as]
6494        #[derive(serde :: Serialize)]
6495        struct ConversationItemList<'a> {
6496            #[serde(rename = "object")]
6497            object: &'a crate::__types::conversation_item_list::Object,
6498            #[serde(rename = "data")]
6499            data: &'a Vec<crate::__types::ConversationItem>,
6500            #[serde(rename = "has_more")]
6501            has_more: &'a bool,
6502            #[serde(rename = "first_id")]
6503            first_id: &'a String,
6504            #[serde(rename = "last_id")]
6505            last_id: &'a String,
6506        }
6507        let Self {
6508            data,
6509            has_more,
6510            first_id,
6511            last_id,
6512        } = self;
6513        ConversationItemList {
6514            object: &Default::default(),
6515            data,
6516            has_more,
6517            first_id,
6518            last_id,
6519        }
6520        .serialize(serializer)
6521    }
6522}
6523#[doc = "An x/y coordinate pair, e.g. `{ x: 100, y: 200 }`.\n"]
6524#[derive(Clone, Copy, Debug, PartialEq)]
6525#[serde_with::serde_as]
6526#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
6527pub struct Coordinate {
6528    #[doc = "The x-coordinate.\n"]
6529    #[serde(rename = "x")]
6530    pub x: i64,
6531    #[doc = "The y-coordinate.\n"]
6532    #[serde(rename = "y")]
6533    pub y: i64,
6534}
6535#[allow(clippy::module_inception)]
6536pub mod costs_result {
6537    #[doc = "organization.costs.result"]
6538    #[derive(Clone, Copy, Debug, Default, PartialEq)]
6539    pub(crate) struct Object;
6540    impl_serde!(Object, "organization.costs.result");
6541    #[doc = "The monetary value in its associated currency."]
6542    #[derive(Clone, Debug, Default, PartialEq)]
6543    #[serde_with::serde_as]
6544    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
6545    pub struct Amount {
6546        #[doc = "The numeric value of the cost."]
6547        #[serde(rename = "value")]
6548        #[serde(skip_serializing_if = "Option::is_none")]
6549        #[builder(default)]
6550        pub value: Option<serde_json::Number>,
6551        #[doc = "Lowercase ISO-4217 currency e.g. \"usd\""]
6552        #[serde(rename = "currency")]
6553        #[serde(skip_serializing_if = "Option::is_none")]
6554        #[builder(default)]
6555        pub currency: Option<String>,
6556    }
6557}
6558#[doc = "The aggregated costs details of the specific time bucket."]
6559#[derive(Clone, Debug, Default, PartialEq, typed_builder :: TypedBuilder)]
6560pub struct CostsResult {
6561    #[doc = "The monetary value in its associated currency."]
6562    #[builder(default)]
6563    pub amount: Option<crate::__types::costs_result::Amount>,
6564    #[doc = "When `group_by=line_item`, this field provides the line item of the grouped costs result."]
6565    #[builder(default)]
6566    pub line_item: Option<String>,
6567    #[doc = "When `group_by=project_id`, this field provides the project ID of the grouped costs result."]
6568    #[builder(default)]
6569    pub project_id: Option<String>,
6570}
6571impl<'de> serde::Deserialize<'de> for CostsResult {
6572    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
6573    where
6574        D: serde::Deserializer<'de>,
6575    {
6576        #[serde_with::serde_as]
6577        #[derive(serde :: Deserialize)]
6578        struct CostsResult {
6579            #[serde(rename = "object")]
6580            #[allow(dead_code)]
6581            object: crate::__types::costs_result::Object,
6582            #[serde(rename = "amount")]
6583            amount: Option<crate::__types::costs_result::Amount>,
6584            #[serde(rename = "line_item")]
6585            line_item: Option<String>,
6586            #[serde(rename = "project_id")]
6587            project_id: Option<String>,
6588        }
6589        let CostsResult {
6590            amount,
6591            line_item,
6592            project_id,
6593            ..
6594        } = CostsResult::deserialize(deserializer)?;
6595        Ok(Self {
6596            amount,
6597            line_item,
6598            project_id,
6599        })
6600    }
6601}
6602impl serde::Serialize for CostsResult {
6603    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
6604    where
6605        S: serde::Serializer,
6606    {
6607        #[serde_with::serde_as]
6608        #[derive(serde :: Serialize)]
6609        struct CostsResult<'a> {
6610            #[serde(rename = "object")]
6611            object: &'a crate::__types::costs_result::Object,
6612            #[serde(rename = "amount")]
6613            #[serde(skip_serializing_if = "Option::is_none")]
6614            amount: &'a Option<crate::__types::costs_result::Amount>,
6615            #[serde(rename = "line_item")]
6616            #[serde(skip_serializing_if = "Option::is_none")]
6617            line_item: &'a Option<String>,
6618            #[serde(rename = "project_id")]
6619            #[serde(skip_serializing_if = "Option::is_none")]
6620            project_id: &'a Option<String>,
6621        }
6622        let Self {
6623            amount,
6624            line_item,
6625            project_id,
6626        } = self;
6627        CostsResult {
6628            object: &Default::default(),
6629            amount,
6630            line_item,
6631            project_id,
6632        }
6633        .serialize(serializer)
6634    }
6635}
6636#[allow(clippy::module_inception)]
6637pub mod create_assistant_request {
6638    #[doc = "ID of the model to use. You can use the [List models](https://platform.openai.com/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](https://platform.openai.com/docs/models) for descriptions of them.\n"]
6639    #[derive(Clone, Debug, PartialEq)]
6640    #[allow(clippy::large_enum_variant)]
6641    pub enum Model {
6642        Other(String),
6643        AssistantSupportedModels(crate::__types::AssistantSupportedModels),
6644    }
6645    impl<'de> serde::Deserialize<'de> for Model {
6646        fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
6647        where
6648            D: serde::Deserializer<'de>,
6649        {
6650            #[serde_with::serde_as]
6651            #[derive(serde :: Deserialize)]
6652            #[serde(untagged)]
6653            #[allow(clippy::enum_variant_names, clippy::large_enum_variant)]
6654            enum Model {
6655                AssistantSupportedModels(crate::__types::AssistantSupportedModels),
6656                Other(String),
6657            }
6658            Ok(match Model::deserialize(deserializer)? {
6659                Model::Other(v) => Self::Other(v),
6660                Model::AssistantSupportedModels(v) => Self::AssistantSupportedModels(v),
6661            })
6662        }
6663    }
6664    impl serde::Serialize for Model {
6665        fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
6666        where
6667            S: serde::Serializer,
6668        {
6669            #[serde_with::serde_as]
6670            #[derive(serde :: Serialize)]
6671            #[serde(untagged)]
6672            #[allow(clippy::enum_variant_names)]
6673            enum Model<'a> {
6674                Other(&'a String),
6675                AssistantSupportedModels(&'a crate::__types::AssistantSupportedModels),
6676            }
6677            match self {
6678                Self::Other(v) => Model::Other(v),
6679                Self::AssistantSupportedModels(v) => Model::AssistantSupportedModels(v),
6680            }
6681            .serialize(serializer)
6682        }
6683    }
6684    #[allow(clippy::module_inception)]
6685    pub mod tool_resources {
6686        #[derive(Clone, Debug, Default, PartialEq)]
6687        #[serde_with::serde_as]
6688        #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
6689        pub struct CodeInterpreter {
6690            #[doc = "A list of [file](https://platform.openai.com/docs/api-reference/files) IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool.\n"]
6691            #[serde(rename = "file_ids")]
6692            #[serde(skip_serializing_if = "Option::is_none")]
6693            #[builder(default)]
6694            pub file_ids: Option<Vec<String>>,
6695        }
6696        #[allow(clippy::module_inception)]
6697        pub mod file_search {
6698            #[allow(clippy::module_inception)]
6699            pub mod variant0 {
6700                #[allow(clippy::module_inception)]
6701                pub mod vector_stores {
6702                    #[allow(clippy::module_inception)]
6703                    pub mod item {
6704                        #[allow(clippy::module_inception)]
6705                        pub mod chunking_strategy {
6706                            #[allow(clippy::module_inception)]
6707                            pub(crate) mod auto {
6708                                #[doc = "Always `auto`."]
6709                                #[derive(Clone, Copy, Debug, Default, PartialEq)]
6710                                pub(crate) struct Type;
6711                                impl_serde!(Type, "auto");
6712                            }
6713                            #[doc = "The default strategy. This strategy currently uses a `max_chunk_size_tokens` of `800` and `chunk_overlap_tokens` of `400`."]
6714                            #[derive(
6715                                Clone,
6716                                Copy,
6717                                Debug,
6718                                Default,
6719                                PartialEq,
6720                                typed_builder :: TypedBuilder,
6721                            )]
6722                            pub struct Auto {}
6723                            impl<'de> serde::Deserialize<'de> for Auto {
6724                                fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
6725                                where
6726                                    D: serde::Deserializer<'de>,
6727                                {
6728                                    #[serde_with::serde_as]
6729                                    #[derive(serde :: Deserialize)]
6730                                    struct Auto { # [serde (rename = "type")] # [allow (dead_code)] r#type : crate :: __types :: create_assistant_request :: tool_resources :: file_search :: variant0 :: vector_stores :: item :: chunking_strategy :: auto :: Type }
6731                                    let Auto { .. } = Auto::deserialize(deserializer)?;
6732                                    Ok(Self {})
6733                                }
6734                            }
6735                            impl serde::Serialize for Auto {
6736                                fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
6737                                where
6738                                    S: serde::Serializer,
6739                                {
6740                                    #[serde_with::serde_as]
6741                                    #[derive(serde :: Serialize)]
6742                                    struct Auto < 'a > { # [serde (rename = "type")] r#type : & 'a crate :: __types :: create_assistant_request :: tool_resources :: file_search :: variant0 :: vector_stores :: item :: chunking_strategy :: auto :: Type }
6743                                    let Self {} = self;
6744                                    Auto {
6745                                        r#type: &Default::default(),
6746                                    }
6747                                    .serialize(serializer)
6748                                }
6749                            }
6750                            #[allow(clippy::module_inception)]
6751                            pub mod r#static {
6752                                #[doc = "Always `static`."]
6753                                #[derive(Clone, Copy, Debug, Default, PartialEq)]
6754                                pub(crate) struct Type;
6755                                impl_serde!(Type, "static");
6756                                #[derive(Clone, Copy, Debug, PartialEq)]
6757                                #[serde_with::serde_as]
6758                                #[derive(
6759                                    serde :: Deserialize,
6760                                    serde :: Serialize,
6761                                    typed_builder :: TypedBuilder,
6762                                )]
6763                                pub struct Static {
6764                                    #[doc = "The maximum number of tokens in each chunk. The default value is `800`. The minimum value is `100` and the maximum value is `4096`."]
6765                                    #[serde(rename = "max_chunk_size_tokens")]
6766                                    pub max_chunk_size_tokens: i64,
6767                                    #[doc = "The number of tokens that overlap between chunks. The default value is `400`.\n\nNote that the overlap must not exceed half of `max_chunk_size_tokens`.\n"]
6768                                    #[serde(rename = "chunk_overlap_tokens")]
6769                                    pub chunk_overlap_tokens: i64,
6770                                }
6771                            }
6772                            #[derive(
6773                                Clone, Copy, Debug, PartialEq, typed_builder :: TypedBuilder,
6774                            )]
6775                            pub struct Static { pub r#static : crate :: __types :: create_assistant_request :: tool_resources :: file_search :: variant0 :: vector_stores :: item :: chunking_strategy :: r#static :: Static }
6776                            impl<'de> serde::Deserialize<'de> for Static {
6777                                fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
6778                                where
6779                                    D: serde::Deserializer<'de>,
6780                                {
6781                                    #[serde_with::serde_as]
6782                                    #[derive(serde :: Deserialize)]
6783                                    struct Static { # [serde (rename = "type")] # [allow (dead_code)] r#type : crate :: __types :: create_assistant_request :: tool_resources :: file_search :: variant0 :: vector_stores :: item :: chunking_strategy :: r#static :: Type , # [serde (rename = "static")] r#static : crate :: __types :: create_assistant_request :: tool_resources :: file_search :: variant0 :: vector_stores :: item :: chunking_strategy :: r#static :: Static }
6784                                    let Static { r#static, .. } =
6785                                        Static::deserialize(deserializer)?;
6786                                    Ok(Self { r#static })
6787                                }
6788                            }
6789                            impl serde::Serialize for Static {
6790                                fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
6791                                where
6792                                    S: serde::Serializer,
6793                                {
6794                                    #[serde_with::serde_as]
6795                                    #[derive(serde :: Serialize)]
6796                                    struct Static < 'a > { # [serde (rename = "type")] r#type : & 'a crate :: __types :: create_assistant_request :: tool_resources :: file_search :: variant0 :: vector_stores :: item :: chunking_strategy :: r#static :: Type , # [serde (rename = "static")] r#static : & 'a crate :: __types :: create_assistant_request :: tool_resources :: file_search :: variant0 :: vector_stores :: item :: chunking_strategy :: r#static :: Static }
6797                                    let Self { r#static } = self;
6798                                    Static {
6799                                        r#type: &Default::default(),
6800                                        r#static,
6801                                    }
6802                                    .serialize(serializer)
6803                                }
6804                            }
6805                        }
6806                        #[doc = "The chunking strategy used to chunk the file(s). If not set, will use the `auto` strategy."]
6807                        #[derive(Clone, Copy, Debug, PartialEq)]
6808                        #[serde_with::serde_as]
6809                        #[derive(serde :: Deserialize, serde :: Serialize)]
6810                        #[serde(untagged)]
6811                        #[allow(clippy::large_enum_variant)]
6812                        pub enum ChunkingStrategy {
6813                            # [doc = "The default strategy. This strategy currently uses a `max_chunk_size_tokens` of `800` and `chunk_overlap_tokens` of `400`."] Auto (crate :: __types :: create_assistant_request :: tool_resources :: file_search :: variant0 :: vector_stores :: item :: chunking_strategy :: Auto) , Static (crate :: __types :: create_assistant_request :: tool_resources :: file_search :: variant0 :: vector_stores :: item :: chunking_strategy :: Static) }
6814                    }
6815                    #[derive(Clone, Debug, Default, PartialEq)]
6816                    #[serde_with::serde_as]
6817                    #[derive(
6818                        serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder,
6819                    )]
6820                    pub struct Item { # [doc = "A list of [file](https://platform.openai.com/docs/api-reference/files) IDs to add to the vector store. There can be a maximum of 10000 files in a vector store.\n"] # [serde (rename = "file_ids")] # [serde (skip_serializing_if = "Option::is_none")] # [builder (default)] pub file_ids : Option < Vec < String > > , # [doc = "The chunking strategy used to chunk the file(s). If not set, will use the `auto` strategy."] # [serde (rename = "chunking_strategy")] # [serde (skip_serializing_if = "Option::is_none")] # [builder (default)] pub chunking_strategy : Option < crate :: __types :: create_assistant_request :: tool_resources :: file_search :: variant0 :: vector_stores :: item :: ChunkingStrategy > , # [serde (rename = "metadata")] # [serde (skip_serializing_if = "Option::is_none")] # [builder (default)] pub metadata : Option < crate :: __types :: Metadata > }
6821                }
6822            }
6823            #[derive(Clone, Debug, PartialEq)]
6824            #[serde_with::serde_as]
6825            #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
6826            pub struct Variant0 { # [doc = "The [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object) attached to this assistant. There can be a maximum of 1 vector store attached to the assistant.\n"] # [serde (rename = "vector_store_ids")] pub vector_store_ids : Vec < String > , # [doc = "A helper to create a [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object) with file_ids and attach it to this assistant. There can be a maximum of 1 vector store attached to the assistant.\n"] # [serde (rename = "vector_stores")] # [serde (skip_serializing_if = "Option::is_none")] # [builder (default)] pub vector_stores : Option < Vec < crate :: __types :: create_assistant_request :: tool_resources :: file_search :: variant0 :: vector_stores :: Item > > }
6827            #[allow(clippy::module_inception)]
6828            pub mod variant1 {
6829                #[allow(clippy::module_inception)]
6830                pub mod vector_stores {
6831                    #[allow(clippy::module_inception)]
6832                    pub mod item {
6833                        #[allow(clippy::module_inception)]
6834                        pub mod chunking_strategy {
6835                            #[allow(clippy::module_inception)]
6836                            pub(crate) mod auto {
6837                                #[doc = "Always `auto`."]
6838                                #[derive(Clone, Copy, Debug, Default, PartialEq)]
6839                                pub(crate) struct Type;
6840                                impl_serde!(Type, "auto");
6841                            }
6842                            #[doc = "The default strategy. This strategy currently uses a `max_chunk_size_tokens` of `800` and `chunk_overlap_tokens` of `400`."]
6843                            #[derive(
6844                                Clone,
6845                                Copy,
6846                                Debug,
6847                                Default,
6848                                PartialEq,
6849                                typed_builder :: TypedBuilder,
6850                            )]
6851                            pub struct Auto {}
6852                            impl<'de> serde::Deserialize<'de> for Auto {
6853                                fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
6854                                where
6855                                    D: serde::Deserializer<'de>,
6856                                {
6857                                    #[serde_with::serde_as]
6858                                    #[derive(serde :: Deserialize)]
6859                                    struct Auto { # [serde (rename = "type")] # [allow (dead_code)] r#type : crate :: __types :: create_assistant_request :: tool_resources :: file_search :: variant1 :: vector_stores :: item :: chunking_strategy :: auto :: Type }
6860                                    let Auto { .. } = Auto::deserialize(deserializer)?;
6861                                    Ok(Self {})
6862                                }
6863                            }
6864                            impl serde::Serialize for Auto {
6865                                fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
6866                                where
6867                                    S: serde::Serializer,
6868                                {
6869                                    #[serde_with::serde_as]
6870                                    #[derive(serde :: Serialize)]
6871                                    struct Auto < 'a > { # [serde (rename = "type")] r#type : & 'a crate :: __types :: create_assistant_request :: tool_resources :: file_search :: variant1 :: vector_stores :: item :: chunking_strategy :: auto :: Type }
6872                                    let Self {} = self;
6873                                    Auto {
6874                                        r#type: &Default::default(),
6875                                    }
6876                                    .serialize(serializer)
6877                                }
6878                            }
6879                            #[allow(clippy::module_inception)]
6880                            pub mod r#static {
6881                                #[doc = "Always `static`."]
6882                                #[derive(Clone, Copy, Debug, Default, PartialEq)]
6883                                pub(crate) struct Type;
6884                                impl_serde!(Type, "static");
6885                                #[derive(Clone, Copy, Debug, PartialEq)]
6886                                #[serde_with::serde_as]
6887                                #[derive(
6888                                    serde :: Deserialize,
6889                                    serde :: Serialize,
6890                                    typed_builder :: TypedBuilder,
6891                                )]
6892                                pub struct Static {
6893                                    #[doc = "The maximum number of tokens in each chunk. The default value is `800`. The minimum value is `100` and the maximum value is `4096`."]
6894                                    #[serde(rename = "max_chunk_size_tokens")]
6895                                    pub max_chunk_size_tokens: i64,
6896                                    #[doc = "The number of tokens that overlap between chunks. The default value is `400`.\n\nNote that the overlap must not exceed half of `max_chunk_size_tokens`.\n"]
6897                                    #[serde(rename = "chunk_overlap_tokens")]
6898                                    pub chunk_overlap_tokens: i64,
6899                                }
6900                            }
6901                            #[derive(
6902                                Clone, Copy, Debug, PartialEq, typed_builder :: TypedBuilder,
6903                            )]
6904                            pub struct Static { pub r#static : crate :: __types :: create_assistant_request :: tool_resources :: file_search :: variant1 :: vector_stores :: item :: chunking_strategy :: r#static :: Static }
6905                            impl<'de> serde::Deserialize<'de> for Static {
6906                                fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
6907                                where
6908                                    D: serde::Deserializer<'de>,
6909                                {
6910                                    #[serde_with::serde_as]
6911                                    #[derive(serde :: Deserialize)]
6912                                    struct Static { # [serde (rename = "type")] # [allow (dead_code)] r#type : crate :: __types :: create_assistant_request :: tool_resources :: file_search :: variant1 :: vector_stores :: item :: chunking_strategy :: r#static :: Type , # [serde (rename = "static")] r#static : crate :: __types :: create_assistant_request :: tool_resources :: file_search :: variant1 :: vector_stores :: item :: chunking_strategy :: r#static :: Static }
6913                                    let Static { r#static, .. } =
6914                                        Static::deserialize(deserializer)?;
6915                                    Ok(Self { r#static })
6916                                }
6917                            }
6918                            impl serde::Serialize for Static {
6919                                fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
6920                                where
6921                                    S: serde::Serializer,
6922                                {
6923                                    #[serde_with::serde_as]
6924                                    #[derive(serde :: Serialize)]
6925                                    struct Static < 'a > { # [serde (rename = "type")] r#type : & 'a crate :: __types :: create_assistant_request :: tool_resources :: file_search :: variant1 :: vector_stores :: item :: chunking_strategy :: r#static :: Type , # [serde (rename = "static")] r#static : & 'a crate :: __types :: create_assistant_request :: tool_resources :: file_search :: variant1 :: vector_stores :: item :: chunking_strategy :: r#static :: Static }
6926                                    let Self { r#static } = self;
6927                                    Static {
6928                                        r#type: &Default::default(),
6929                                        r#static,
6930                                    }
6931                                    .serialize(serializer)
6932                                }
6933                            }
6934                        }
6935                        #[doc = "The chunking strategy used to chunk the file(s). If not set, will use the `auto` strategy."]
6936                        #[derive(Clone, Copy, Debug, PartialEq)]
6937                        #[serde_with::serde_as]
6938                        #[derive(serde :: Deserialize, serde :: Serialize)]
6939                        #[serde(untagged)]
6940                        #[allow(clippy::large_enum_variant)]
6941                        pub enum ChunkingStrategy {
6942                            # [doc = "The default strategy. This strategy currently uses a `max_chunk_size_tokens` of `800` and `chunk_overlap_tokens` of `400`."] Auto (crate :: __types :: create_assistant_request :: tool_resources :: file_search :: variant1 :: vector_stores :: item :: chunking_strategy :: Auto) , Static (crate :: __types :: create_assistant_request :: tool_resources :: file_search :: variant1 :: vector_stores :: item :: chunking_strategy :: Static) }
6943                    }
6944                    #[derive(Clone, Debug, Default, PartialEq)]
6945                    #[serde_with::serde_as]
6946                    #[derive(
6947                        serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder,
6948                    )]
6949                    pub struct Item { # [doc = "A list of [file](https://platform.openai.com/docs/api-reference/files) IDs to add to the vector store. There can be a maximum of 10000 files in a vector store.\n"] # [serde (rename = "file_ids")] # [serde (skip_serializing_if = "Option::is_none")] # [builder (default)] pub file_ids : Option < Vec < String > > , # [doc = "The chunking strategy used to chunk the file(s). If not set, will use the `auto` strategy."] # [serde (rename = "chunking_strategy")] # [serde (skip_serializing_if = "Option::is_none")] # [builder (default)] pub chunking_strategy : Option < crate :: __types :: create_assistant_request :: tool_resources :: file_search :: variant1 :: vector_stores :: item :: ChunkingStrategy > , # [serde (rename = "metadata")] # [serde (skip_serializing_if = "Option::is_none")] # [builder (default)] pub metadata : Option < crate :: __types :: Metadata > }
6950                }
6951            }
6952            #[derive(Clone, Debug, PartialEq)]
6953            #[serde_with::serde_as]
6954            #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
6955            pub struct Variant1 { # [doc = "The [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object) attached to this assistant. There can be a maximum of 1 vector store attached to the assistant.\n"] # [serde (rename = "vector_store_ids")] # [serde (skip_serializing_if = "Option::is_none")] # [builder (default)] pub vector_store_ids : Option < Vec < String > > , # [doc = "A helper to create a [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object) with file_ids and attach it to this assistant. There can be a maximum of 1 vector store attached to the assistant.\n"] # [serde (rename = "vector_stores")] pub vector_stores : Vec < crate :: __types :: create_assistant_request :: tool_resources :: file_search :: variant1 :: vector_stores :: Item > }
6956        }
6957        #[derive(Clone, Debug, PartialEq)]
6958        #[serde_with::serde_as]
6959        #[derive(serde :: Deserialize, serde :: Serialize)]
6960        #[serde(untagged)]
6961        #[allow(clippy::large_enum_variant)]
6962        pub enum FileSearch {
6963            Variant0(
6964                crate::__types::create_assistant_request::tool_resources::file_search::Variant0,
6965            ),
6966            Variant1(
6967                crate::__types::create_assistant_request::tool_resources::file_search::Variant1,
6968            ),
6969        }
6970    }
6971    #[doc = "A set of resources that are used by the assistant's tools. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.\n"]
6972    #[derive(Clone, Debug, Default, PartialEq)]
6973    #[serde_with::serde_as]
6974    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
6975    pub struct ToolResources {
6976        #[serde(rename = "code_interpreter")]
6977        #[serde(skip_serializing_if = "Option::is_none")]
6978        #[builder(default)]
6979        pub code_interpreter:
6980            Option<crate::__types::create_assistant_request::tool_resources::CodeInterpreter>,
6981        #[serde(rename = "file_search")]
6982        #[serde(skip_serializing_if = "Option::is_none")]
6983        #[builder(default)]
6984        pub file_search:
6985            Option<crate::__types::create_assistant_request::tool_resources::FileSearch>,
6986    }
6987}
6988#[derive(Clone, Debug, PartialEq)]
6989#[serde_with::serde_as]
6990#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
6991pub struct CreateAssistantRequest {
6992    #[doc = "ID of the model to use. You can use the [List models](https://platform.openai.com/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](https://platform.openai.com/docs/models) for descriptions of them.\n"]
6993    #[serde(rename = "model")]
6994    pub model: crate::__types::create_assistant_request::Model,
6995    #[doc = "The name of the assistant. The maximum length is 256 characters.\n"]
6996    #[serde(rename = "name")]
6997    #[serde(skip_serializing_if = "Option::is_none")]
6998    #[builder(default)]
6999    pub name: Option<String>,
7000    #[doc = "The description of the assistant. The maximum length is 512 characters.\n"]
7001    #[serde(rename = "description")]
7002    #[serde(skip_serializing_if = "Option::is_none")]
7003    #[builder(default)]
7004    pub description: Option<String>,
7005    #[doc = "The system instructions that the assistant uses. The maximum length is 256,000 characters.\n"]
7006    #[serde(rename = "instructions")]
7007    #[serde(skip_serializing_if = "Option::is_none")]
7008    #[builder(default)]
7009    pub instructions: Option<String>,
7010    #[serde(rename = "reasoning_effort")]
7011    #[serde(skip_serializing_if = "Option::is_none")]
7012    #[builder(default)]
7013    pub reasoning_effort: Option<crate::__types::ReasoningEffort>,
7014    #[doc = "A list of tool enabled on the assistant. There can be a maximum of 128 tools per assistant. Tools can be of types `code_interpreter`, `file_search`, or `function`.\n"]
7015    #[serde(rename = "tools")]
7016    #[serde(skip_serializing_if = "Option::is_none")]
7017    #[builder(default)]
7018    pub tools: Option<Vec<crate::__types::AssistantTool>>,
7019    #[doc = "A set of resources that are used by the assistant's tools. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.\n"]
7020    #[serde(rename = "tool_resources")]
7021    #[serde(skip_serializing_if = "Option::is_none")]
7022    #[builder(default)]
7023    pub tool_resources: Option<crate::__types::create_assistant_request::ToolResources>,
7024    #[serde(rename = "metadata")]
7025    #[serde(skip_serializing_if = "Option::is_none")]
7026    #[builder(default)]
7027    pub metadata: Option<crate::__types::Metadata>,
7028    #[doc = "What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.\n"]
7029    #[serde(rename = "temperature")]
7030    #[serde(skip_serializing_if = "Option::is_none")]
7031    #[builder(default)]
7032    pub temperature: Option<serde_json::Number>,
7033    #[doc = "An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.\n\nWe generally recommend altering this or temperature but not both.\n"]
7034    #[serde(rename = "top_p")]
7035    #[serde(skip_serializing_if = "Option::is_none")]
7036    #[builder(default)]
7037    pub top_p: Option<serde_json::Number>,
7038    #[serde(rename = "response_format")]
7039    #[serde(skip_serializing_if = "Option::is_none")]
7040    #[builder(default)]
7041    pub response_format: Option<crate::__types::AssistantsApiResponseFormatOption>,
7042}
7043#[allow(clippy::module_inception)]
7044pub mod create_chat_completion_request {
7045    #[allow(clippy::module_inception)]
7046    pub mod web_search_options {
7047        #[allow(clippy::module_inception)]
7048        pub(crate) mod user_location {
7049            #[doc = "The type of location approximation. Always `approximate`.\n"]
7050            #[derive(Clone, Copy, Debug, Default, PartialEq)]
7051            pub(crate) struct Type;
7052            impl_serde!(Type, "approximate");
7053        }
7054        #[doc = "Approximate location parameters for the search.\n"]
7055        #[derive(Clone, Debug, Default, PartialEq, typed_builder :: TypedBuilder)]
7056        pub struct UserLocation {
7057            #[builder(default)]
7058            pub approximate: crate::__types::WebSearchLocation,
7059        }
7060        impl<'de> serde::Deserialize<'de> for UserLocation {
7061            fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
7062            where
7063                D: serde::Deserializer<'de>,
7064            {
7065                #[serde_with::serde_as]
7066                #[derive(serde :: Deserialize)]
7067                struct UserLocation { # [serde (rename = "type")] # [allow (dead_code)] r#type : crate :: __types :: create_chat_completion_request :: web_search_options :: user_location :: Type , # [serde (rename = "approximate")] approximate : crate :: __types :: WebSearchLocation }
7068                let UserLocation { approximate, .. } = UserLocation::deserialize(deserializer)?;
7069                Ok(Self { approximate })
7070            }
7071        }
7072        impl serde::Serialize for UserLocation {
7073            fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
7074            where
7075                S: serde::Serializer,
7076            {
7077                #[serde_with::serde_as]
7078                #[derive(serde :: Serialize)]
7079                struct UserLocation < 'a > { # [serde (rename = "type")] r#type : & 'a crate :: __types :: create_chat_completion_request :: web_search_options :: user_location :: Type , # [serde (rename = "approximate")] approximate : & 'a crate :: __types :: WebSearchLocation }
7080                let Self { approximate } = self;
7081                UserLocation {
7082                    r#type: &Default::default(),
7083                    approximate,
7084                }
7085                .serialize(serializer)
7086            }
7087        }
7088    }
7089    #[doc = "This tool searches the web for relevant results to use in a response.\nLearn more about the [web search tool](https://platform.openai.com/docs/guides/tools-web-search?api-mode=chat).\n"]
7090    #[derive(Clone, Debug, Default, PartialEq)]
7091    #[serde_with::serde_as]
7092    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
7093    pub struct WebSearchOptions {
7094        #[doc = "Approximate location parameters for the search.\n"]
7095        #[serde(rename = "user_location")]
7096        #[serde(skip_serializing_if = "Option::is_none")]
7097        #[builder(default)]
7098        pub user_location: Option<
7099            crate::__types::create_chat_completion_request::web_search_options::UserLocation,
7100        >,
7101        #[serde(rename = "search_context_size")]
7102        #[serde(skip_serializing_if = "Option::is_none")]
7103        #[builder(default)]
7104        pub search_context_size: Option<crate::__types::WebSearchContextSize>,
7105    }
7106    #[doc = "An object specifying the format that the model must output.\n\nSetting to `{ \"type\": \"json_schema\", \"json_schema\": {...} }` enables\nStructured Outputs which ensures the model will match your supplied JSON\nschema. Learn more in the [Structured Outputs\nguide](https://platform.openai.com/docs/guides/structured-outputs).\n\nSetting to `{ \"type\": \"json_object\" }` enables the older JSON mode, which\nensures the message the model generates is valid JSON. Using `json_schema`\nis preferred for models that support it.\n"]
7107    #[derive(Clone, Debug, PartialEq)]
7108    #[serde_with::serde_as]
7109    #[derive(serde :: Deserialize, serde :: Serialize)]
7110    #[serde(untagged)]
7111    #[allow(clippy::large_enum_variant)]
7112    pub enum ResponseFormat {
7113        Text(crate::__types::ResponseFormatText),
7114        JsonSchema(crate::__types::ResponseFormatJsonSchema),
7115        JsonObject(crate::__types::ResponseFormatJsonObject),
7116    }
7117    #[allow(clippy::module_inception)]
7118    pub mod audio {
7119        #[doc = "Specifies the output audio format. Must be one of `wav`, `mp3`, `flac`,\n`opus`, or `pcm16`.\n"]
7120        #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
7121        pub enum Format {
7122            #[doc = "`wav`"]
7123            #[serde(rename = "wav")]
7124            Wav,
7125            #[doc = "`aac`"]
7126            #[serde(rename = "aac")]
7127            Aac,
7128            #[doc = "`mp3`"]
7129            #[serde(rename = "mp3")]
7130            Mp3,
7131            #[doc = "`flac`"]
7132            #[serde(rename = "flac")]
7133            Flac,
7134            #[doc = "`opus`"]
7135            #[serde(rename = "opus")]
7136            Opus,
7137            #[doc = "`pcm16`"]
7138            #[serde(rename = "pcm16")]
7139            Pcm16,
7140        }
7141    }
7142    #[doc = "Parameters for audio output. Required when audio output is requested with\n`modalities: [\"audio\"]`. [Learn more](https://platform.openai.com/docs/guides/audio).\n"]
7143    #[derive(Clone, Debug, PartialEq)]
7144    #[serde_with::serde_as]
7145    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
7146    pub struct Audio {
7147        #[doc = "The voice the model uses to respond. Supported voices are\n`alloy`, `ash`, `ballad`, `coral`, `echo`, `fable`, `nova`, `onyx`, `sage`, and `shimmer`.\n"]
7148        #[serde(rename = "voice")]
7149        pub voice: crate::__types::VoiceIdsShared,
7150        #[doc = "Specifies the output audio format. Must be one of `wav`, `mp3`, `flac`,\n`opus`, or `pcm16`.\n"]
7151        #[serde(rename = "format")]
7152        pub format: crate::__types::create_chat_completion_request::audio::Format,
7153    }
7154    #[doc = "Configuration for a [Predicted Output](https://platform.openai.com/docs/guides/predicted-outputs),\nwhich can greatly improve response times when large parts of the model\nresponse are known ahead of time. This is most common when you are\nregenerating a file with only minor changes to most of the content.\n"]
7155    #[derive(Clone, Debug, PartialEq)]
7156    #[serde_with::serde_as]
7157    #[derive(serde :: Deserialize, serde :: Serialize)]
7158    #[serde(untagged)]
7159    #[allow(clippy::large_enum_variant)]
7160    pub enum Prediction {
7161        PredictionContent(crate::__types::PredictionContent),
7162    }
7163    #[allow(clippy::module_inception)]
7164    pub mod tools {
7165        #[derive(Clone, Debug, PartialEq)]
7166        #[serde_with::serde_as]
7167        #[derive(serde :: Deserialize, serde :: Serialize)]
7168        #[serde(untagged)]
7169        #[allow(clippy::large_enum_variant)]
7170        pub enum Item {
7171            Function(crate::__types::ChatCompletionTool),
7172            Custom(crate::__types::CustomToolChatCompletions),
7173        }
7174    }
7175    #[allow(clippy::module_inception)]
7176    pub(crate) mod function_call {
7177        #[doc = "none"]
7178        #[derive(Clone, Copy, Debug, Default, PartialEq)]
7179        pub(crate) struct None;
7180        impl_serde!(None, "none");
7181        #[doc = "auto"]
7182        #[derive(Clone, Copy, Debug, Default, PartialEq)]
7183        pub(crate) struct Auto;
7184        impl_serde!(Auto, "auto");
7185    }
7186    #[doc = "Deprecated in favor of `tool_choice`.\n\nControls which (if any) function is called by the model.\n\n`none` means the model will not call a function and instead generates a\nmessage.\n\n`auto` means the model can pick between generating a message or calling a\nfunction.\n\nSpecifying a particular function via `{\"name\": \"my_function\"}` forces the\nmodel to call that function.\n\n`none` is the default when no functions are present. `auto` is the default\nif functions are present.\n"]
7187    #[derive(Clone, Debug, PartialEq)]
7188    #[allow(clippy::large_enum_variant)]
7189    pub enum FunctionCall {
7190        #[doc = "none"]
7191        None,
7192        #[doc = "auto"]
7193        Auto,
7194        ChatCompletionFunctionCallOption(crate::__types::ChatCompletionFunctionCallOption),
7195    }
7196    impl<'de> serde::Deserialize<'de> for FunctionCall {
7197        fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
7198        where
7199            D: serde::Deserializer<'de>,
7200        {
7201            #[serde_with::serde_as]
7202            #[derive(serde :: Deserialize)]
7203            #[serde(untagged)]
7204            #[allow(clippy::enum_variant_names, clippy::large_enum_variant)]
7205            enum FunctionCall {
7206                None(crate::__types::create_chat_completion_request::function_call::None),
7207                Auto(crate::__types::create_chat_completion_request::function_call::Auto),
7208                ChatCompletionFunctionCallOption(crate::__types::ChatCompletionFunctionCallOption),
7209            }
7210            Ok(match FunctionCall::deserialize(deserializer)? {
7211                FunctionCall::None(_) => Self::None,
7212                FunctionCall::Auto(_) => Self::Auto,
7213                FunctionCall::ChatCompletionFunctionCallOption(v) => {
7214                    Self::ChatCompletionFunctionCallOption(v)
7215                }
7216            })
7217        }
7218    }
7219    impl serde::Serialize for FunctionCall {
7220        fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
7221        where
7222            S: serde::Serializer,
7223        {
7224            #[serde_with::serde_as]
7225            #[derive(serde :: Serialize)]
7226            #[serde(untagged)]
7227            #[allow(clippy::enum_variant_names)]
7228            enum FunctionCall<'a> {
7229                None(crate::__types::create_chat_completion_request::function_call::None),
7230                Auto(crate::__types::create_chat_completion_request::function_call::Auto),
7231                ChatCompletionFunctionCallOption(
7232                    &'a crate::__types::ChatCompletionFunctionCallOption,
7233                ),
7234            }
7235            match self {
7236                Self::None => FunctionCall::None(Default::default()),
7237                Self::Auto => FunctionCall::Auto(Default::default()),
7238                Self::ChatCompletionFunctionCallOption(v) => {
7239                    FunctionCall::ChatCompletionFunctionCallOption(v)
7240                }
7241            }
7242            .serialize(serializer)
7243        }
7244    }
7245}
7246#[derive(Clone, Debug, PartialEq)]
7247#[serde_with::serde_as]
7248#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
7249pub struct CreateChatCompletionRequest {
7250    #[serde(rename = "metadata")]
7251    #[serde(skip_serializing_if = "Option::is_none")]
7252    #[builder(default)]
7253    pub metadata: Option<crate::__types::Metadata>,
7254    #[doc = "An integer between 0 and 20 specifying the number of most likely tokens to\nreturn at each token position, each with an associated log probability.\n"]
7255    #[serde(rename = "top_logprobs")]
7256    #[serde(skip_serializing_if = "Option::is_none")]
7257    #[builder(default)]
7258    pub top_logprobs: Option<i64>,
7259    #[doc = "What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.\nWe generally recommend altering this or `top_p` but not both.\n"]
7260    #[serde(rename = "temperature")]
7261    #[serde(skip_serializing_if = "Option::is_none")]
7262    #[builder(default)]
7263    pub temperature: Option<serde_json::Number>,
7264    #[doc = "An alternative to sampling with temperature, called nucleus sampling,\nwhere the model considers the results of the tokens with top_p probability\nmass. So 0.1 means only the tokens comprising the top 10% probability mass\nare considered.\n\nWe generally recommend altering this or `temperature` but not both.\n"]
7265    #[serde(rename = "top_p")]
7266    #[serde(skip_serializing_if = "Option::is_none")]
7267    #[builder(default)]
7268    pub top_p: Option<serde_json::Number>,
7269    #[doc = "This field is being replaced by `safety_identifier` and `prompt_cache_key`. Use `prompt_cache_key` instead to maintain caching optimizations.\nA stable identifier for your end-users. \nUsed to boost cache hit rates by better bucketing similar requests and  to help OpenAI detect and prevent abuse. [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#safety-identifiers).\n"]
7270    #[serde(rename = "user")]
7271    #[serde(skip_serializing_if = "Option::is_none")]
7272    #[builder(default)]
7273    pub user: Option<String>,
7274    #[doc = "A stable identifier used to help detect users of your application that may be violating OpenAI's usage policies. \nThe IDs should be a string that uniquely identifies each user. We recommend hashing their username or email address, in order to avoid sending us any identifying information. [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#safety-identifiers).\n"]
7275    #[serde(rename = "safety_identifier")]
7276    #[serde(skip_serializing_if = "Option::is_none")]
7277    #[builder(default)]
7278    pub safety_identifier: Option<String>,
7279    #[doc = "Used by OpenAI to cache responses for similar requests to optimize your cache hit rates. Replaces the `user` field. [Learn more](https://platform.openai.com/docs/guides/prompt-caching).\n"]
7280    #[serde(rename = "prompt_cache_key")]
7281    #[serde(skip_serializing_if = "Option::is_none")]
7282    #[builder(default)]
7283    pub prompt_cache_key: Option<String>,
7284    #[serde(rename = "service_tier")]
7285    #[serde(skip_serializing_if = "Option::is_none")]
7286    #[builder(default)]
7287    pub service_tier: Option<crate::__types::ServiceTier>,
7288    #[doc = "A list of messages comprising the conversation so far. Depending on the\n[model](https://platform.openai.com/docs/models) you use, different message types (modalities) are\nsupported, like [text](https://platform.openai.com/docs/guides/text-generation),\n[images](https://platform.openai.com/docs/guides/vision), and [audio](https://platform.openai.com/docs/guides/audio).\n"]
7289    #[serde(rename = "messages")]
7290    pub messages: Vec<crate::__types::ChatCompletionRequestMessage>,
7291    #[doc = "Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI\noffers a wide range of models with different capabilities, performance\ncharacteristics, and price points. Refer to the [model guide](https://platform.openai.com/docs/models)\nto browse and compare available models.\n"]
7292    #[serde(rename = "model")]
7293    pub model: crate::__types::ModelIdsShared,
7294    #[serde(rename = "modalities")]
7295    #[serde(skip_serializing_if = "Option::is_none")]
7296    #[builder(default)]
7297    pub modalities: Option<crate::__types::ResponseModalities>,
7298    #[serde(rename = "verbosity")]
7299    #[serde(skip_serializing_if = "Option::is_none")]
7300    #[builder(default)]
7301    pub verbosity: Option<crate::__types::Verbosity>,
7302    #[serde(rename = "reasoning_effort")]
7303    #[serde(skip_serializing_if = "Option::is_none")]
7304    #[builder(default)]
7305    pub reasoning_effort: Option<crate::__types::ReasoningEffort>,
7306    #[doc = "An upper bound for the number of tokens that can be generated for a completion, including visible output tokens and [reasoning tokens](https://platform.openai.com/docs/guides/reasoning).\n"]
7307    #[serde(rename = "max_completion_tokens")]
7308    #[serde(skip_serializing_if = "Option::is_none")]
7309    #[builder(default)]
7310    pub max_completion_tokens: Option<i64>,
7311    #[doc = "Number between -2.0 and 2.0. Positive values penalize new tokens based on\ntheir existing frequency in the text so far, decreasing the model's\nlikelihood to repeat the same line verbatim.\n"]
7312    #[serde(rename = "frequency_penalty")]
7313    #[serde(skip_serializing_if = "Option::is_none")]
7314    #[builder(default)]
7315    pub frequency_penalty: Option<serde_json::Number>,
7316    #[doc = "Number between -2.0 and 2.0. Positive values penalize new tokens based on\nwhether they appear in the text so far, increasing the model's likelihood\nto talk about new topics.\n"]
7317    #[serde(rename = "presence_penalty")]
7318    #[serde(skip_serializing_if = "Option::is_none")]
7319    #[builder(default)]
7320    pub presence_penalty: Option<serde_json::Number>,
7321    #[doc = "This tool searches the web for relevant results to use in a response.\nLearn more about the [web search tool](https://platform.openai.com/docs/guides/tools-web-search?api-mode=chat).\n"]
7322    #[serde(rename = "web_search_options")]
7323    #[serde(skip_serializing_if = "Option::is_none")]
7324    #[builder(default)]
7325    pub web_search_options:
7326        Option<crate::__types::create_chat_completion_request::WebSearchOptions>,
7327    #[doc = "An object specifying the format that the model must output.\n\nSetting to `{ \"type\": \"json_schema\", \"json_schema\": {...} }` enables\nStructured Outputs which ensures the model will match your supplied JSON\nschema. Learn more in the [Structured Outputs\nguide](https://platform.openai.com/docs/guides/structured-outputs).\n\nSetting to `{ \"type\": \"json_object\" }` enables the older JSON mode, which\nensures the message the model generates is valid JSON. Using `json_schema`\nis preferred for models that support it.\n"]
7328    #[serde(rename = "response_format")]
7329    #[serde(skip_serializing_if = "Option::is_none")]
7330    #[builder(default)]
7331    pub response_format: Option<crate::__types::create_chat_completion_request::ResponseFormat>,
7332    #[doc = "Parameters for audio output. Required when audio output is requested with\n`modalities: [\"audio\"]`. [Learn more](https://platform.openai.com/docs/guides/audio).\n"]
7333    #[serde(rename = "audio")]
7334    #[serde(skip_serializing_if = "Option::is_none")]
7335    #[builder(default)]
7336    pub audio: Option<crate::__types::create_chat_completion_request::Audio>,
7337    #[doc = "Whether or not to store the output of this chat completion request for\nuse in our [model distillation](https://platform.openai.com/docs/guides/distillation) or\n[evals](https://platform.openai.com/docs/guides/evals) products.\n\nSupports text and image inputs. Note: image inputs over 8MB will be dropped.\n"]
7338    #[serde(rename = "store")]
7339    #[serde(skip_serializing_if = "Option::is_none")]
7340    #[builder(default)]
7341    pub store: Option<bool>,
7342    #[doc = "If set to true, the model response data will be streamed to the client\nas 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).\nSee the [Streaming section below](https://platform.openai.com/docs/api-reference/chat/streaming)\nfor more information, along with the [streaming responses](https://platform.openai.com/docs/guides/streaming-responses)\nguide for more information on how to handle the streaming events.\n"]
7343    #[serde(rename = "stream")]
7344    #[serde(skip_serializing_if = "Option::is_none")]
7345    #[builder(default)]
7346    pub stream: Option<bool>,
7347    #[serde(rename = "stop")]
7348    #[serde(skip_serializing_if = "Option::is_none")]
7349    #[builder(default)]
7350    pub stop: Option<crate::__types::StopConfiguration>,
7351    #[doc = "Modify the likelihood of specified tokens appearing in the completion.\n\nAccepts a JSON object that maps tokens (specified by their token ID in the\ntokenizer) to an associated bias value from -100 to 100. Mathematically,\nthe bias is added to the logits generated by the model prior to sampling.\nThe exact effect will vary per model, but values between -1 and 1 should\ndecrease or increase likelihood of selection; values like -100 or 100\nshould result in a ban or exclusive selection of the relevant token.\n"]
7352    #[serde(rename = "logit_bias")]
7353    #[serde(skip_serializing_if = "Option::is_none")]
7354    #[builder(default)]
7355    pub logit_bias: Option<indexmap::IndexMap<String, i64>>,
7356    #[doc = "Whether to return log probabilities of the output tokens or not. If true,\nreturns the log probabilities of each output token returned in the\n`content` of `message`.\n"]
7357    #[serde(rename = "logprobs")]
7358    #[serde(skip_serializing_if = "Option::is_none")]
7359    #[builder(default)]
7360    pub logprobs: Option<bool>,
7361    #[doc = "The maximum number of [tokens](https://platform.openai.com/tokenizer) that can be generated in the\nchat completion. This value can be used to control\n[costs](https://openai.com/api/pricing/) for text generated via API.\n\nThis value is now deprecated in favor of `max_completion_tokens`, and is\nnot compatible with [o-series models](https://platform.openai.com/docs/guides/reasoning).\n"]
7362    #[serde(rename = "max_tokens")]
7363    #[serde(skip_serializing_if = "Option::is_none")]
7364    #[builder(default)]
7365    pub max_tokens: Option<i64>,
7366    #[doc = "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."]
7367    #[serde(rename = "n")]
7368    #[serde(skip_serializing_if = "Option::is_none")]
7369    #[builder(default)]
7370    pub n: Option<i64>,
7371    #[doc = "Configuration for a [Predicted Output](https://platform.openai.com/docs/guides/predicted-outputs),\nwhich can greatly improve response times when large parts of the model\nresponse are known ahead of time. This is most common when you are\nregenerating a file with only minor changes to most of the content.\n"]
7372    #[serde(rename = "prediction")]
7373    #[serde(skip_serializing_if = "Option::is_none")]
7374    #[builder(default)]
7375    pub prediction: Option<crate::__types::create_chat_completion_request::Prediction>,
7376    #[doc = "This feature is in Beta.\nIf 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.\nDeterminism is not guaranteed, and you should refer to the `system_fingerprint` response parameter to monitor changes in the backend.\n"]
7377    #[serde(rename = "seed")]
7378    #[serde(skip_serializing_if = "Option::is_none")]
7379    #[builder(default)]
7380    pub seed: Option<i64>,
7381    #[serde(rename = "stream_options")]
7382    #[serde(skip_serializing_if = "Option::is_none")]
7383    #[builder(default)]
7384    pub stream_options: Option<crate::__types::ChatCompletionStreamOptions>,
7385    #[doc = "A list of tools the model may call. You can provide either\n[custom tools](https://platform.openai.com/docs/guides/function-calling#custom-tools) or\n[function tools](https://platform.openai.com/docs/guides/function-calling).\n"]
7386    #[serde(rename = "tools")]
7387    #[serde(skip_serializing_if = "Option::is_none")]
7388    #[builder(default)]
7389    pub tools: Option<Vec<crate::__types::create_chat_completion_request::tools::Item>>,
7390    #[serde(rename = "tool_choice")]
7391    #[serde(skip_serializing_if = "Option::is_none")]
7392    #[builder(default)]
7393    pub tool_choice: Option<crate::__types::ChatCompletionToolChoiceOption>,
7394    #[serde(rename = "parallel_tool_calls")]
7395    #[serde(skip_serializing_if = "Option::is_none")]
7396    #[builder(default)]
7397    pub parallel_tool_calls: Option<crate::__types::ParallelToolCalls>,
7398    #[doc = "Deprecated in favor of `tool_choice`.\n\nControls which (if any) function is called by the model.\n\n`none` means the model will not call a function and instead generates a\nmessage.\n\n`auto` means the model can pick between generating a message or calling a\nfunction.\n\nSpecifying a particular function via `{\"name\": \"my_function\"}` forces the\nmodel to call that function.\n\n`none` is the default when no functions are present. `auto` is the default\nif functions are present.\n"]
7399    #[serde(rename = "function_call")]
7400    #[serde(skip_serializing_if = "Option::is_none")]
7401    #[builder(default)]
7402    pub function_call: Option<crate::__types::create_chat_completion_request::FunctionCall>,
7403    #[doc = "Deprecated in favor of `tools`.\n\nA list of functions the model may generate JSON inputs for.\n"]
7404    #[serde(rename = "functions")]
7405    #[serde(skip_serializing_if = "Option::is_none")]
7406    #[builder(default)]
7407    pub functions: Option<Vec<crate::__types::ChatCompletionFunctions>>,
7408}
7409#[allow(clippy::module_inception)]
7410pub mod create_chat_completion_response {
7411    #[allow(clippy::module_inception)]
7412    pub mod choices {
7413        #[allow(clippy::module_inception)]
7414        pub mod item {
7415            #[doc = "The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence,\n`length` if the maximum number of tokens specified in the request was reached,\n`content_filter` if content was omitted due to a flag from our content filters,\n`tool_calls` if the model called a tool, or `function_call` (deprecated) if the model called a function.\n"]
7416            #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
7417            pub enum FinishReason {
7418                #[doc = "`stop`"]
7419                #[serde(rename = "stop")]
7420                Stop,
7421                #[doc = "`length`"]
7422                #[serde(rename = "length")]
7423                Length,
7424                #[doc = "`tool_calls`"]
7425                #[serde(rename = "tool_calls")]
7426                ToolCalls,
7427                #[doc = "`content_filter`"]
7428                #[serde(rename = "content_filter")]
7429                ContentFilter,
7430                #[doc = "`function_call`"]
7431                #[serde(rename = "function_call")]
7432                FunctionCall,
7433            }
7434            #[doc = "Log probability information for the choice."]
7435            #[derive(Clone, Debug, Default, PartialEq)]
7436            #[serde_with::serde_as]
7437            #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
7438            pub struct Logprobs {
7439                #[doc = "A list of message content tokens with log probability information."]
7440                #[serde(rename = "content")]
7441                #[serde(skip_serializing_if = "Option::is_none")]
7442                #[builder(default)]
7443                pub content: Option<Vec<crate::__types::ChatCompletionTokenLogprob>>,
7444                #[doc = "A list of message refusal tokens with log probability information."]
7445                #[serde(rename = "refusal")]
7446                #[serde(skip_serializing_if = "Option::is_none")]
7447                #[builder(default)]
7448                pub refusal: Option<Vec<crate::__types::ChatCompletionTokenLogprob>>,
7449            }
7450        }
7451        #[derive(Clone, Debug, PartialEq)]
7452        #[serde_with::serde_as]
7453        #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
7454        pub struct Item {
7455            #[doc = "The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence,\n`length` if the maximum number of tokens specified in the request was reached,\n`content_filter` if content was omitted due to a flag from our content filters,\n`tool_calls` if the model called a tool, or `function_call` (deprecated) if the model called a function.\n"]
7456            #[serde(rename = "finish_reason")]
7457            pub finish_reason:
7458                crate::__types::create_chat_completion_response::choices::item::FinishReason,
7459            #[doc = "The index of the choice in the list of choices."]
7460            #[serde(rename = "index")]
7461            pub index: i64,
7462            #[serde(rename = "message")]
7463            #[builder(default)]
7464            pub message: crate::__types::ChatCompletionResponseMessage,
7465            #[doc = "Log probability information for the choice."]
7466            #[serde(rename = "logprobs")]
7467            #[serde(skip_serializing_if = "Option::is_none")]
7468            #[builder(default)]
7469            pub logprobs:
7470                Option<crate::__types::create_chat_completion_response::choices::item::Logprobs>,
7471        }
7472    }
7473    #[doc = "The object type, which is always `chat.completion`."]
7474    #[derive(Clone, Copy, Debug, Default, PartialEq)]
7475    pub(crate) struct Object;
7476    impl_serde!(Object, "chat.completion");
7477}
7478#[doc = "Represents a chat completion response returned by model, based on the provided input."]
7479#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
7480pub struct CreateChatCompletionResponse {
7481    #[doc = "A unique identifier for the chat completion."]
7482    pub id: String,
7483    #[doc = "A list of chat completion choices. Can be more than one if `n` is greater than 1."]
7484    pub choices: Vec<crate::__types::create_chat_completion_response::choices::Item>,
7485    #[doc = "The Unix timestamp (in seconds) of when the chat completion was created."]
7486    pub created: i64,
7487    #[doc = "The model used for the chat completion."]
7488    pub model: String,
7489    #[builder(default)]
7490    pub service_tier: Option<crate::__types::ServiceTier>,
7491    #[doc = "This fingerprint represents the backend configuration that the model runs with.\n\nCan be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism.\n"]
7492    #[builder(default)]
7493    pub system_fingerprint: Option<String>,
7494    #[builder(default)]
7495    pub usage: Option<crate::__types::CompletionUsage>,
7496}
7497impl<'de> serde::Deserialize<'de> for CreateChatCompletionResponse {
7498    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
7499    where
7500        D: serde::Deserializer<'de>,
7501    {
7502        #[serde_with::serde_as]
7503        #[derive(serde :: Deserialize)]
7504        struct CreateChatCompletionResponse {
7505            #[serde(rename = "id")]
7506            id: String,
7507            #[serde(rename = "choices")]
7508            choices: Vec<crate::__types::create_chat_completion_response::choices::Item>,
7509            #[serde(rename = "created")]
7510            created: i64,
7511            #[serde(rename = "model")]
7512            model: String,
7513            #[serde(rename = "service_tier")]
7514            service_tier: Option<crate::__types::ServiceTier>,
7515            #[serde(rename = "system_fingerprint")]
7516            system_fingerprint: Option<String>,
7517            #[serde(rename = "object")]
7518            #[allow(dead_code)]
7519            object: crate::__types::create_chat_completion_response::Object,
7520            #[serde(rename = "usage")]
7521            usage: Option<crate::__types::CompletionUsage>,
7522        }
7523        let CreateChatCompletionResponse {
7524            id,
7525            choices,
7526            created,
7527            model,
7528            service_tier,
7529            system_fingerprint,
7530            usage,
7531            ..
7532        } = CreateChatCompletionResponse::deserialize(deserializer)?;
7533        Ok(Self {
7534            id,
7535            choices,
7536            created,
7537            model,
7538            service_tier,
7539            system_fingerprint,
7540            usage,
7541        })
7542    }
7543}
7544impl serde::Serialize for CreateChatCompletionResponse {
7545    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
7546    where
7547        S: serde::Serializer,
7548    {
7549        #[serde_with::serde_as]
7550        #[derive(serde :: Serialize)]
7551        struct CreateChatCompletionResponse<'a> {
7552            #[serde(rename = "id")]
7553            id: &'a String,
7554            #[serde(rename = "choices")]
7555            choices: &'a Vec<crate::__types::create_chat_completion_response::choices::Item>,
7556            #[serde(rename = "created")]
7557            created: &'a i64,
7558            #[serde(rename = "model")]
7559            model: &'a String,
7560            #[serde(rename = "service_tier")]
7561            #[serde(skip_serializing_if = "Option::is_none")]
7562            service_tier: &'a Option<crate::__types::ServiceTier>,
7563            #[serde(rename = "system_fingerprint")]
7564            #[serde(skip_serializing_if = "Option::is_none")]
7565            system_fingerprint: &'a Option<String>,
7566            #[serde(rename = "object")]
7567            object: &'a crate::__types::create_chat_completion_response::Object,
7568            #[serde(rename = "usage")]
7569            #[serde(skip_serializing_if = "Option::is_none")]
7570            usage: &'a Option<crate::__types::CompletionUsage>,
7571        }
7572        let Self {
7573            id,
7574            choices,
7575            created,
7576            model,
7577            service_tier,
7578            system_fingerprint,
7579            usage,
7580        } = self;
7581        CreateChatCompletionResponse {
7582            id,
7583            choices,
7584            created,
7585            model,
7586            service_tier,
7587            system_fingerprint,
7588            object: &Default::default(),
7589            usage,
7590        }
7591        .serialize(serializer)
7592    }
7593}
7594#[allow(clippy::module_inception)]
7595pub mod create_chat_completion_stream_response {
7596    #[allow(clippy::module_inception)]
7597    pub mod choices {
7598        #[allow(clippy::module_inception)]
7599        pub mod item {
7600            #[doc = "Log probability information for the choice."]
7601            #[derive(Clone, Debug, Default, PartialEq)]
7602            #[serde_with::serde_as]
7603            #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
7604            pub struct Logprobs {
7605                #[doc = "A list of message content tokens with log probability information."]
7606                #[serde(rename = "content")]
7607                #[serde(skip_serializing_if = "Option::is_none")]
7608                #[builder(default)]
7609                pub content: Option<Vec<crate::__types::ChatCompletionTokenLogprob>>,
7610                #[doc = "A list of message refusal tokens with log probability information."]
7611                #[serde(rename = "refusal")]
7612                #[serde(skip_serializing_if = "Option::is_none")]
7613                #[builder(default)]
7614                pub refusal: Option<Vec<crate::__types::ChatCompletionTokenLogprob>>,
7615            }
7616            #[doc = "The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence,\n`length` if the maximum number of tokens specified in the request was reached,\n`content_filter` if content was omitted due to a flag from our content filters,\n`tool_calls` if the model called a tool, or `function_call` (deprecated) if the model called a function.\n"]
7617            #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
7618            pub enum FinishReason {
7619                #[doc = "`stop`"]
7620                #[serde(rename = "stop")]
7621                Stop,
7622                #[doc = "`length`"]
7623                #[serde(rename = "length")]
7624                Length,
7625                #[doc = "`tool_calls`"]
7626                #[serde(rename = "tool_calls")]
7627                ToolCalls,
7628                #[doc = "`content_filter`"]
7629                #[serde(rename = "content_filter")]
7630                ContentFilter,
7631                #[doc = "`function_call`"]
7632                #[serde(rename = "function_call")]
7633                FunctionCall,
7634            }
7635        }
7636        #[derive(Clone, Debug, PartialEq)]
7637        #[serde_with::serde_as]
7638        #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
7639        pub struct Item {
7640            #[serde(rename = "delta")]
7641            #[builder(default)]
7642            pub delta: crate::__types::ChatCompletionStreamResponseDelta,
7643            #[doc = "Log probability information for the choice."]
7644            #[serde(rename = "logprobs")]
7645            #[serde(skip_serializing_if = "Option::is_none")]
7646            #[builder(default)]
7647            pub logprobs: Option<
7648                crate::__types::create_chat_completion_stream_response::choices::item::Logprobs,
7649            >,
7650            #[doc = "The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence,\n`length` if the maximum number of tokens specified in the request was reached,\n`content_filter` if content was omitted due to a flag from our content filters,\n`tool_calls` if the model called a tool, or `function_call` (deprecated) if the model called a function.\n"]
7651            #[serde(rename = "finish_reason")]
7652            #[serde(skip_serializing_if = "Option::is_none")]
7653            #[builder(default)]
7654            pub finish_reason: Option<
7655                crate::__types::create_chat_completion_stream_response::choices::item::FinishReason,
7656            >,
7657            #[doc = "The index of the choice in the list of choices."]
7658            #[serde(rename = "index")]
7659            pub index: i64,
7660        }
7661    }
7662    #[doc = "The object type, which is always `chat.completion.chunk`."]
7663    #[derive(Clone, Copy, Debug, Default, PartialEq)]
7664    pub(crate) struct Object;
7665    impl_serde!(Object, "chat.completion.chunk");
7666}
7667#[doc = "Represents a streamed chunk of a chat completion response returned\nby the model, based on the provided input. \n[Learn more](https://platform.openai.com/docs/guides/streaming-responses).\n"]
7668#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
7669pub struct CreateChatCompletionStreamResponse {
7670    #[doc = "A unique identifier for the chat completion. Each chunk has the same ID."]
7671    pub id: String,
7672    #[doc = "A list of chat completion choices. Can contain more than one elements if `n` is greater than 1. Can also be empty for the\nlast chunk if you set `stream_options: {\"include_usage\": true}`.\n"]
7673    pub choices: Vec<crate::__types::create_chat_completion_stream_response::choices::Item>,
7674    #[doc = "The Unix timestamp (in seconds) of when the chat completion was created. Each chunk has the same timestamp."]
7675    pub created: i64,
7676    #[doc = "The model to generate the completion."]
7677    pub model: String,
7678    #[builder(default)]
7679    pub service_tier: Option<crate::__types::ServiceTier>,
7680    #[doc = "This fingerprint represents the backend configuration that the model runs with.\nCan be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism.\n"]
7681    #[builder(default)]
7682    pub system_fingerprint: Option<String>,
7683    #[doc = "An optional field that will only be present when you set\n`stream_options: {\"include_usage\": true}` in your request. When present, it\ncontains a null value **except for the last chunk** which contains the\ntoken usage statistics for the entire request.\n\n**NOTE:** If the stream is interrupted or cancelled, you may not\nreceive the final usage chunk which contains the total token usage for\nthe request.\n"]
7684    #[builder(default)]
7685    pub usage: Option<crate::__types::CompletionUsage>,
7686}
7687impl<'de> serde::Deserialize<'de> for CreateChatCompletionStreamResponse {
7688    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
7689    where
7690        D: serde::Deserializer<'de>,
7691    {
7692        #[serde_with::serde_as]
7693        #[derive(serde :: Deserialize)]
7694        struct CreateChatCompletionStreamResponse {
7695            #[serde(rename = "id")]
7696            id: String,
7697            #[serde(rename = "choices")]
7698            choices: Vec<crate::__types::create_chat_completion_stream_response::choices::Item>,
7699            #[serde(rename = "created")]
7700            created: i64,
7701            #[serde(rename = "model")]
7702            model: String,
7703            #[serde(rename = "service_tier")]
7704            service_tier: Option<crate::__types::ServiceTier>,
7705            #[serde(rename = "system_fingerprint")]
7706            system_fingerprint: Option<String>,
7707            #[serde(rename = "object")]
7708            #[allow(dead_code)]
7709            object: crate::__types::create_chat_completion_stream_response::Object,
7710            #[serde(rename = "usage")]
7711            usage: Option<crate::__types::CompletionUsage>,
7712        }
7713        let CreateChatCompletionStreamResponse {
7714            id,
7715            choices,
7716            created,
7717            model,
7718            service_tier,
7719            system_fingerprint,
7720            usage,
7721            ..
7722        } = CreateChatCompletionStreamResponse::deserialize(deserializer)?;
7723        Ok(Self {
7724            id,
7725            choices,
7726            created,
7727            model,
7728            service_tier,
7729            system_fingerprint,
7730            usage,
7731        })
7732    }
7733}
7734impl serde::Serialize for CreateChatCompletionStreamResponse {
7735    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
7736    where
7737        S: serde::Serializer,
7738    {
7739        #[serde_with::serde_as]
7740        #[derive(serde :: Serialize)]
7741        struct CreateChatCompletionStreamResponse<'a> {
7742            #[serde(rename = "id")]
7743            id: &'a String,
7744            #[serde(rename = "choices")]
7745            choices: &'a Vec<crate::__types::create_chat_completion_stream_response::choices::Item>,
7746            #[serde(rename = "created")]
7747            created: &'a i64,
7748            #[serde(rename = "model")]
7749            model: &'a String,
7750            #[serde(rename = "service_tier")]
7751            #[serde(skip_serializing_if = "Option::is_none")]
7752            service_tier: &'a Option<crate::__types::ServiceTier>,
7753            #[serde(rename = "system_fingerprint")]
7754            #[serde(skip_serializing_if = "Option::is_none")]
7755            system_fingerprint: &'a Option<String>,
7756            #[serde(rename = "object")]
7757            object: &'a crate::__types::create_chat_completion_stream_response::Object,
7758            #[serde(rename = "usage")]
7759            #[serde(skip_serializing_if = "Option::is_none")]
7760            usage: &'a Option<crate::__types::CompletionUsage>,
7761        }
7762        let Self {
7763            id,
7764            choices,
7765            created,
7766            model,
7767            service_tier,
7768            system_fingerprint,
7769            usage,
7770        } = self;
7771        CreateChatCompletionStreamResponse {
7772            id,
7773            choices,
7774            created,
7775            model,
7776            service_tier,
7777            system_fingerprint,
7778            object: &Default::default(),
7779            usage,
7780        }
7781        .serialize(serializer)
7782    }
7783}
7784#[allow(clippy::module_inception)]
7785pub mod create_completion_request {
7786    #[allow(clippy::module_inception)]
7787    pub(crate) mod model {
7788        #[doc = "gpt-3.5-turbo-instruct"]
7789        #[derive(Clone, Copy, Debug, Default, PartialEq)]
7790        pub(crate) struct Gpt3_5TurboInstruct;
7791        impl_serde!(Gpt3_5TurboInstruct, "gpt-3.5-turbo-instruct");
7792        #[doc = "davinci-002"]
7793        #[derive(Clone, Copy, Debug, Default, PartialEq)]
7794        pub(crate) struct Davinci002;
7795        impl_serde!(Davinci002, "davinci-002");
7796        #[doc = "babbage-002"]
7797        #[derive(Clone, Copy, Debug, Default, PartialEq)]
7798        pub(crate) struct Babbage002;
7799        impl_serde!(Babbage002, "babbage-002");
7800    }
7801    #[doc = "ID of the model to use. You can use the [List models](https://platform.openai.com/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](https://platform.openai.com/docs/models) for descriptions of them.\n"]
7802    #[derive(Clone, Debug, PartialEq)]
7803    #[allow(clippy::large_enum_variant)]
7804    pub enum Model {
7805        Other(String),
7806        #[doc = "gpt-3.5-turbo-instruct"]
7807        Gpt3_5TurboInstruct,
7808        #[doc = "davinci-002"]
7809        Davinci002,
7810        #[doc = "babbage-002"]
7811        Babbage002,
7812    }
7813    impl<'de> serde::Deserialize<'de> for Model {
7814        fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
7815        where
7816            D: serde::Deserializer<'de>,
7817        {
7818            #[serde_with::serde_as]
7819            #[derive(serde :: Deserialize)]
7820            #[serde(untagged)]
7821            #[allow(clippy::enum_variant_names, clippy::large_enum_variant)]
7822            enum Model {
7823                Gpt3_5TurboInstruct(
7824                    crate::__types::create_completion_request::model::Gpt3_5TurboInstruct,
7825                ),
7826                Davinci002(crate::__types::create_completion_request::model::Davinci002),
7827                Babbage002(crate::__types::create_completion_request::model::Babbage002),
7828                Other(String),
7829            }
7830            Ok(match Model::deserialize(deserializer)? {
7831                Model::Other(v) => Self::Other(v),
7832                Model::Gpt3_5TurboInstruct(_) => Self::Gpt3_5TurboInstruct,
7833                Model::Davinci002(_) => Self::Davinci002,
7834                Model::Babbage002(_) => Self::Babbage002,
7835            })
7836        }
7837    }
7838    impl serde::Serialize for Model {
7839        fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
7840        where
7841            S: serde::Serializer,
7842        {
7843            #[serde_with::serde_as]
7844            #[derive(serde :: Serialize)]
7845            #[serde(untagged)]
7846            #[allow(clippy::enum_variant_names)]
7847            enum Model<'a> {
7848                Other(&'a String),
7849                Gpt3_5TurboInstruct(
7850                    crate::__types::create_completion_request::model::Gpt3_5TurboInstruct,
7851                ),
7852                Davinci002(crate::__types::create_completion_request::model::Davinci002),
7853                Babbage002(crate::__types::create_completion_request::model::Babbage002),
7854            }
7855            match self {
7856                Self::Other(v) => Model::Other(v),
7857                Self::Gpt3_5TurboInstruct => Model::Gpt3_5TurboInstruct(Default::default()),
7858                Self::Davinci002 => Model::Davinci002(Default::default()),
7859                Self::Babbage002 => Model::Babbage002(Default::default()),
7860            }
7861            .serialize(serializer)
7862        }
7863    }
7864    #[doc = "The prompt(s) to generate completions for, encoded as a string, array of strings, array of tokens, or array of token arrays.\n\nNote that <|endoftext|> is the document separator that the model sees during training, so if a prompt is not specified the model will generate as if from the beginning of a new document.\n"]
7865    #[derive(Clone, Debug, PartialEq)]
7866    #[serde_with::serde_as]
7867    #[derive(serde :: Deserialize, serde :: Serialize)]
7868    #[serde(untagged)]
7869    #[allow(clippy::large_enum_variant)]
7870    pub enum Prompt {
7871        String(String),
7872        ArrayOfString(Vec<String>),
7873        ArrayOfInteger(Vec<i64>),
7874        ArrayOfArray(Vec<Vec<i64>>),
7875    }
7876}
7877#[derive(Clone, Debug, PartialEq)]
7878#[serde_with::serde_as]
7879#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
7880pub struct CreateCompletionRequest {
7881    #[doc = "ID of the model to use. You can use the [List models](https://platform.openai.com/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](https://platform.openai.com/docs/models) for descriptions of them.\n"]
7882    #[serde(rename = "model")]
7883    pub model: crate::__types::create_completion_request::Model,
7884    #[doc = "The prompt(s) to generate completions for, encoded as a string, array of strings, array of tokens, or array of token arrays.\n\nNote that <|endoftext|> is the document separator that the model sees during training, so if a prompt is not specified the model will generate as if from the beginning of a new document.\n"]
7885    #[serde(rename = "prompt")]
7886    #[serde(skip_serializing_if = "Option::is_none")]
7887    #[builder(default)]
7888    pub prompt: Option<crate::__types::create_completion_request::Prompt>,
7889    #[doc = "Generates `best_of` completions server-side and returns the \"best\" (the one with the highest log probability per token). Results cannot be streamed.\n\nWhen used with `n`, `best_of` controls the number of candidate completions and `n` specifies how many to return – `best_of` must be greater than `n`.\n\n**Note:** Because this parameter generates many completions, it can quickly consume your token quota. Use carefully and ensure that you have reasonable settings for `max_tokens` and `stop`.\n"]
7890    #[serde(rename = "best_of")]
7891    #[serde(skip_serializing_if = "Option::is_none")]
7892    #[builder(default)]
7893    pub best_of: Option<i64>,
7894    #[doc = "Echo back the prompt in addition to the completion\n"]
7895    #[serde(rename = "echo")]
7896    #[serde(skip_serializing_if = "Option::is_none")]
7897    #[builder(default)]
7898    pub echo: Option<bool>,
7899    #[doc = "Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim.\n\n[See more information about frequency and presence penalties.](https://platform.openai.com/docs/guides/text-generation)\n"]
7900    #[serde(rename = "frequency_penalty")]
7901    #[serde(skip_serializing_if = "Option::is_none")]
7902    #[builder(default)]
7903    pub frequency_penalty: Option<serde_json::Number>,
7904    #[doc = "Modify the likelihood of specified tokens appearing in the completion.\n\nAccepts a JSON object that maps tokens (specified by their token ID in the GPT tokenizer) to an associated bias value from -100 to 100. You can use this [tokenizer tool](https://platform.openai.com/tokenizer?view=bpe) to convert text to token IDs. Mathematically, the bias is added to the logits generated by the model prior to sampling. The exact effect will vary per model, but values between -1 and 1 should decrease or increase likelihood of selection; values like -100 or 100 should result in a ban or exclusive selection of the relevant token.\n\nAs an example, you can pass `{\"50256\": -100}` to prevent the <|endoftext|> token from being generated.\n"]
7905    #[serde(rename = "logit_bias")]
7906    #[serde(skip_serializing_if = "Option::is_none")]
7907    #[builder(default)]
7908    pub logit_bias: Option<indexmap::IndexMap<String, i64>>,
7909    #[doc = "Include the log probabilities on the `logprobs` most likely output tokens, as well the chosen tokens. For example, if `logprobs` is 5, the API will return a list of the 5 most likely tokens. The API will always return the `logprob` of the sampled token, so there may be up to `logprobs+1` elements in the response.\n\nThe maximum value for `logprobs` is 5.\n"]
7910    #[serde(rename = "logprobs")]
7911    #[serde(skip_serializing_if = "Option::is_none")]
7912    #[builder(default)]
7913    pub logprobs: Option<i64>,
7914    #[doc = "The maximum number of [tokens](https://platform.openai.com/tokenizer) that can be generated in the completion.\n\nThe token count of your prompt plus `max_tokens` cannot exceed the model's context length. [Example Python code](https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken) for counting tokens.\n"]
7915    #[serde(rename = "max_tokens")]
7916    #[serde(skip_serializing_if = "Option::is_none")]
7917    #[builder(default)]
7918    pub max_tokens: Option<i64>,
7919    #[doc = "How many completions to generate for each prompt.\n\n**Note:** Because this parameter generates many completions, it can quickly consume your token quota. Use carefully and ensure that you have reasonable settings for `max_tokens` and `stop`.\n"]
7920    #[serde(rename = "n")]
7921    #[serde(skip_serializing_if = "Option::is_none")]
7922    #[builder(default)]
7923    pub n: Option<i64>,
7924    #[doc = "Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics.\n\n[See more information about frequency and presence penalties.](https://platform.openai.com/docs/guides/text-generation)\n"]
7925    #[serde(rename = "presence_penalty")]
7926    #[serde(skip_serializing_if = "Option::is_none")]
7927    #[builder(default)]
7928    pub presence_penalty: Option<serde_json::Number>,
7929    #[doc = "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.\n\nDeterminism is not guaranteed, and you should refer to the `system_fingerprint` response parameter to monitor changes in the backend.\n"]
7930    #[serde(rename = "seed")]
7931    #[serde(skip_serializing_if = "Option::is_none")]
7932    #[builder(default)]
7933    pub seed: Option<i64>,
7934    #[serde(rename = "stop")]
7935    #[serde(skip_serializing_if = "Option::is_none")]
7936    #[builder(default)]
7937    pub stop: Option<crate::__types::StopConfiguration>,
7938    #[doc = "Whether to stream back partial progress. If set, tokens will be sent as data-only [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) as they become available, with the stream terminated by a `data: [DONE]` message. [Example Python code](https://cookbook.openai.com/examples/how_to_stream_completions).\n"]
7939    #[serde(rename = "stream")]
7940    #[serde(skip_serializing_if = "Option::is_none")]
7941    #[builder(default)]
7942    pub stream: Option<bool>,
7943    #[serde(rename = "stream_options")]
7944    #[serde(skip_serializing_if = "Option::is_none")]
7945    #[builder(default)]
7946    pub stream_options: Option<crate::__types::ChatCompletionStreamOptions>,
7947    #[doc = "The suffix that comes after a completion of inserted text.\n\nThis parameter is only supported for `gpt-3.5-turbo-instruct`.\n"]
7948    #[serde(rename = "suffix")]
7949    #[serde(skip_serializing_if = "Option::is_none")]
7950    #[builder(default)]
7951    pub suffix: Option<String>,
7952    #[doc = "What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.\n\nWe generally recommend altering this or `top_p` but not both.\n"]
7953    #[serde(rename = "temperature")]
7954    #[serde(skip_serializing_if = "Option::is_none")]
7955    #[builder(default)]
7956    pub temperature: Option<serde_json::Number>,
7957    #[doc = "An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.\n\nWe generally recommend altering this or `temperature` but not both.\n"]
7958    #[serde(rename = "top_p")]
7959    #[serde(skip_serializing_if = "Option::is_none")]
7960    #[builder(default)]
7961    pub top_p: Option<serde_json::Number>,
7962    #[doc = "A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#end-user-ids).\n"]
7963    #[serde(rename = "user")]
7964    #[serde(skip_serializing_if = "Option::is_none")]
7965    #[builder(default)]
7966    pub user: Option<String>,
7967}
7968#[allow(clippy::module_inception)]
7969pub mod create_completion_response {
7970    #[allow(clippy::module_inception)]
7971    pub mod choices {
7972        #[allow(clippy::module_inception)]
7973        pub mod item {
7974            #[doc = "The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence,\n`length` if the maximum number of tokens specified in the request was reached,\nor `content_filter` if content was omitted due to a flag from our content filters.\n"]
7975            #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
7976            pub enum FinishReason {
7977                #[doc = "`stop`"]
7978                #[serde(rename = "stop")]
7979                Stop,
7980                #[doc = "`length`"]
7981                #[serde(rename = "length")]
7982                Length,
7983                #[doc = "`content_filter`"]
7984                #[serde(rename = "content_filter")]
7985                ContentFilter,
7986            }
7987            #[derive(Clone, Debug, Default, PartialEq)]
7988            #[serde_with::serde_as]
7989            #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
7990            pub struct Logprobs {
7991                #[serde(rename = "text_offset")]
7992                #[serde(skip_serializing_if = "Option::is_none")]
7993                #[builder(default)]
7994                pub text_offset: Option<Vec<i64>>,
7995                #[serde(rename = "token_logprobs")]
7996                #[serde(skip_serializing_if = "Option::is_none")]
7997                #[builder(default)]
7998                pub token_logprobs: Option<Vec<serde_json::Number>>,
7999                #[serde(rename = "tokens")]
8000                #[serde(skip_serializing_if = "Option::is_none")]
8001                #[builder(default)]
8002                pub tokens: Option<Vec<String>>,
8003                #[serde(rename = "top_logprobs")]
8004                #[serde(skip_serializing_if = "Option::is_none")]
8005                #[builder(default)]
8006                pub top_logprobs: Option<Vec<indexmap::IndexMap<String, serde_json::Number>>>,
8007            }
8008        }
8009        #[derive(Clone, Debug, PartialEq)]
8010        #[serde_with::serde_as]
8011        #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
8012        pub struct Item {
8013            #[doc = "The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence,\n`length` if the maximum number of tokens specified in the request was reached,\nor `content_filter` if content was omitted due to a flag from our content filters.\n"]
8014            #[serde(rename = "finish_reason")]
8015            pub finish_reason:
8016                crate::__types::create_completion_response::choices::item::FinishReason,
8017            #[serde(rename = "index")]
8018            pub index: i64,
8019            #[serde(rename = "logprobs")]
8020            #[serde(skip_serializing_if = "Option::is_none")]
8021            #[builder(default)]
8022            pub logprobs:
8023                Option<crate::__types::create_completion_response::choices::item::Logprobs>,
8024            #[serde(rename = "text")]
8025            pub text: String,
8026        }
8027    }
8028    #[doc = "The object type, which is always \"text_completion\""]
8029    #[derive(Clone, Copy, Debug, Default, PartialEq)]
8030    pub(crate) struct Object;
8031    impl_serde!(Object, "text_completion");
8032}
8033#[doc = "Represents a completion response from the API. Note: both the streamed and non-streamed response objects share the same shape (unlike the chat endpoint).\n"]
8034#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
8035pub struct CreateCompletionResponse {
8036    #[doc = "A unique identifier for the completion."]
8037    pub id: String,
8038    #[doc = "The list of completion choices the model generated for the input prompt."]
8039    pub choices: Vec<crate::__types::create_completion_response::choices::Item>,
8040    #[doc = "The Unix timestamp (in seconds) of when the completion was created."]
8041    pub created: i64,
8042    #[doc = "The model used for completion."]
8043    pub model: String,
8044    #[doc = "This fingerprint represents the backend configuration that the model runs with.\n\nCan be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism.\n"]
8045    #[builder(default)]
8046    pub system_fingerprint: Option<String>,
8047    #[builder(default)]
8048    pub usage: Option<crate::__types::CompletionUsage>,
8049}
8050impl<'de> serde::Deserialize<'de> for CreateCompletionResponse {
8051    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
8052    where
8053        D: serde::Deserializer<'de>,
8054    {
8055        #[serde_with::serde_as]
8056        #[derive(serde :: Deserialize)]
8057        struct CreateCompletionResponse {
8058            #[serde(rename = "id")]
8059            id: String,
8060            #[serde(rename = "choices")]
8061            choices: Vec<crate::__types::create_completion_response::choices::Item>,
8062            #[serde(rename = "created")]
8063            created: i64,
8064            #[serde(rename = "model")]
8065            model: String,
8066            #[serde(rename = "system_fingerprint")]
8067            system_fingerprint: Option<String>,
8068            #[serde(rename = "object")]
8069            #[allow(dead_code)]
8070            object: crate::__types::create_completion_response::Object,
8071            #[serde(rename = "usage")]
8072            usage: Option<crate::__types::CompletionUsage>,
8073        }
8074        let CreateCompletionResponse {
8075            id,
8076            choices,
8077            created,
8078            model,
8079            system_fingerprint,
8080            usage,
8081            ..
8082        } = CreateCompletionResponse::deserialize(deserializer)?;
8083        Ok(Self {
8084            id,
8085            choices,
8086            created,
8087            model,
8088            system_fingerprint,
8089            usage,
8090        })
8091    }
8092}
8093impl serde::Serialize for CreateCompletionResponse {
8094    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
8095    where
8096        S: serde::Serializer,
8097    {
8098        #[serde_with::serde_as]
8099        #[derive(serde :: Serialize)]
8100        struct CreateCompletionResponse<'a> {
8101            #[serde(rename = "id")]
8102            id: &'a String,
8103            #[serde(rename = "choices")]
8104            choices: &'a Vec<crate::__types::create_completion_response::choices::Item>,
8105            #[serde(rename = "created")]
8106            created: &'a i64,
8107            #[serde(rename = "model")]
8108            model: &'a String,
8109            #[serde(rename = "system_fingerprint")]
8110            #[serde(skip_serializing_if = "Option::is_none")]
8111            system_fingerprint: &'a Option<String>,
8112            #[serde(rename = "object")]
8113            object: &'a crate::__types::create_completion_response::Object,
8114            #[serde(rename = "usage")]
8115            #[serde(skip_serializing_if = "Option::is_none")]
8116            usage: &'a Option<crate::__types::CompletionUsage>,
8117        }
8118        let Self {
8119            id,
8120            choices,
8121            created,
8122            model,
8123            system_fingerprint,
8124            usage,
8125        } = self;
8126        CreateCompletionResponse {
8127            id,
8128            choices,
8129            created,
8130            model,
8131            system_fingerprint,
8132            object: &Default::default(),
8133            usage,
8134        }
8135        .serialize(serializer)
8136    }
8137}
8138#[allow(clippy::module_inception)]
8139pub mod create_container_body {
8140    #[allow(clippy::module_inception)]
8141    pub mod expires_after {
8142        #[doc = "Time anchor for the expiration time. Currently only 'last_active_at' is supported."]
8143        #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
8144        pub enum Anchor {
8145            #[doc = "`last_active_at`"]
8146            #[serde(rename = "last_active_at")]
8147            LastActiveAt,
8148        }
8149    }
8150    #[doc = "Container expiration time in seconds relative to the 'anchor' time."]
8151    #[derive(Clone, Copy, Debug, PartialEq)]
8152    #[serde_with::serde_as]
8153    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
8154    pub struct ExpiresAfter {
8155        #[doc = "Time anchor for the expiration time. Currently only 'last_active_at' is supported."]
8156        #[serde(rename = "anchor")]
8157        pub anchor: crate::__types::create_container_body::expires_after::Anchor,
8158        #[serde(rename = "minutes")]
8159        pub minutes: i64,
8160    }
8161}
8162#[derive(Clone, Debug, PartialEq)]
8163#[serde_with::serde_as]
8164#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
8165pub struct CreateContainerBody {
8166    #[doc = "Name of the container to create."]
8167    #[serde(rename = "name")]
8168    pub name: String,
8169    #[doc = "IDs of files to copy to the container."]
8170    #[serde(rename = "file_ids")]
8171    #[serde(skip_serializing_if = "Option::is_none")]
8172    #[builder(default)]
8173    pub file_ids: Option<Vec<String>>,
8174    #[doc = "Container expiration time in seconds relative to the 'anchor' time."]
8175    #[serde(rename = "expires_after")]
8176    #[serde(skip_serializing_if = "Option::is_none")]
8177    #[builder(default)]
8178    pub expires_after: Option<crate::__types::create_container_body::ExpiresAfter>,
8179}
8180#[derive(Clone, Debug, Default, PartialEq)]
8181#[serde_with::serde_as]
8182#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
8183pub struct CreateContainerFileBody {
8184    #[doc = "Name of the file to create."]
8185    #[serde(rename = "file_id")]
8186    #[serde(skip_serializing_if = "Option::is_none")]
8187    #[builder(default)]
8188    pub file_id: Option<String>,
8189    #[doc = "The File object (not file name) to be uploaded.\n"]
8190    #[serde_as(as = "Option<serde_with::base64::Base64>")]
8191    #[serde(rename = "file")]
8192    #[serde(skip_serializing_if = "Option::is_none")]
8193    #[builder(default)]
8194    pub file: Option<Vec<u8>>,
8195}
8196#[doc = "Create a conversation"]
8197#[derive(Clone, Debug, Default, PartialEq)]
8198#[serde_with::serde_as]
8199#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
8200pub struct CreateConversationRequest {
8201    #[doc = "Set of 16 key-value pairs that can be attached to an object. Useful for\nstoring additional information about the object in a structured format.\n"]
8202    #[serde(rename = "metadata")]
8203    #[serde(skip_serializing_if = "Option::is_none")]
8204    #[builder(default)]
8205    pub metadata: Option<crate::__types::Metadata>,
8206    #[doc = "Initial items to include in the conversation context.\nYou may add up to 20 items at a time.\n"]
8207    #[serde(rename = "items")]
8208    #[serde(skip_serializing_if = "Option::is_none")]
8209    #[builder(default)]
8210    pub items: Option<Vec<crate::__types::InputItem>>,
8211}
8212#[allow(clippy::module_inception)]
8213pub mod create_embedding_request {
8214    #[doc = "Input text to embed, encoded as a string or array of tokens. To embed multiple inputs in a single request, pass an array of strings or array of token arrays. The input must not exceed the max input tokens for the model (8192 tokens for all embedding models), cannot be an empty string, and any array must be 2048 dimensions or less. [Example Python code](https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken) for counting tokens. In addition to the per-input token limit, all embedding  models enforce a maximum of 300,000 tokens summed across all inputs in a  single request.\n"]
8215    #[derive(Clone, Debug, PartialEq)]
8216    #[serde_with::serde_as]
8217    #[derive(serde :: Deserialize, serde :: Serialize)]
8218    #[serde(untagged)]
8219    #[allow(clippy::large_enum_variant)]
8220    pub enum Input {
8221        #[doc = "The string that will be turned into an embedding."]
8222        String(String),
8223        #[doc = "The array of strings that will be turned into an embedding."]
8224        ArrayOfString(Vec<String>),
8225        #[doc = "The array of integers that will be turned into an embedding."]
8226        ArrayOfInteger(Vec<i64>),
8227        #[doc = "The array of arrays containing integers that will be turned into an embedding."]
8228        ArrayOfArray(Vec<Vec<i64>>),
8229    }
8230    #[allow(clippy::module_inception)]
8231    pub(crate) mod model {
8232        #[doc = "text-embedding-ada-002"]
8233        #[derive(Clone, Copy, Debug, Default, PartialEq)]
8234        pub(crate) struct TextEmbeddingAda002;
8235        impl_serde!(TextEmbeddingAda002, "text-embedding-ada-002");
8236        #[doc = "text-embedding-3-small"]
8237        #[derive(Clone, Copy, Debug, Default, PartialEq)]
8238        pub(crate) struct TextEmbedding3Small;
8239        impl_serde!(TextEmbedding3Small, "text-embedding-3-small");
8240        #[doc = "text-embedding-3-large"]
8241        #[derive(Clone, Copy, Debug, Default, PartialEq)]
8242        pub(crate) struct TextEmbedding3Large;
8243        impl_serde!(TextEmbedding3Large, "text-embedding-3-large");
8244    }
8245    #[doc = "ID of the model to use. You can use the [List models](https://platform.openai.com/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](https://platform.openai.com/docs/models) for descriptions of them.\n"]
8246    #[derive(Clone, Debug, PartialEq)]
8247    #[allow(clippy::large_enum_variant)]
8248    pub enum Model {
8249        Other(String),
8250        #[doc = "text-embedding-ada-002"]
8251        TextEmbeddingAda002,
8252        #[doc = "text-embedding-3-small"]
8253        TextEmbedding3Small,
8254        #[doc = "text-embedding-3-large"]
8255        TextEmbedding3Large,
8256    }
8257    impl<'de> serde::Deserialize<'de> for Model {
8258        fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
8259        where
8260            D: serde::Deserializer<'de>,
8261        {
8262            #[serde_with::serde_as]
8263            #[derive(serde :: Deserialize)]
8264            #[serde(untagged)]
8265            #[allow(clippy::enum_variant_names, clippy::large_enum_variant)]
8266            enum Model {
8267                TextEmbeddingAda002(
8268                    crate::__types::create_embedding_request::model::TextEmbeddingAda002,
8269                ),
8270                TextEmbedding3Small(
8271                    crate::__types::create_embedding_request::model::TextEmbedding3Small,
8272                ),
8273                TextEmbedding3Large(
8274                    crate::__types::create_embedding_request::model::TextEmbedding3Large,
8275                ),
8276                Other(String),
8277            }
8278            Ok(match Model::deserialize(deserializer)? {
8279                Model::Other(v) => Self::Other(v),
8280                Model::TextEmbeddingAda002(_) => Self::TextEmbeddingAda002,
8281                Model::TextEmbedding3Small(_) => Self::TextEmbedding3Small,
8282                Model::TextEmbedding3Large(_) => Self::TextEmbedding3Large,
8283            })
8284        }
8285    }
8286    impl serde::Serialize for Model {
8287        fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
8288        where
8289            S: serde::Serializer,
8290        {
8291            #[serde_with::serde_as]
8292            #[derive(serde :: Serialize)]
8293            #[serde(untagged)]
8294            #[allow(clippy::enum_variant_names)]
8295            enum Model<'a> {
8296                Other(&'a String),
8297                TextEmbeddingAda002(
8298                    crate::__types::create_embedding_request::model::TextEmbeddingAda002,
8299                ),
8300                TextEmbedding3Small(
8301                    crate::__types::create_embedding_request::model::TextEmbedding3Small,
8302                ),
8303                TextEmbedding3Large(
8304                    crate::__types::create_embedding_request::model::TextEmbedding3Large,
8305                ),
8306            }
8307            match self {
8308                Self::Other(v) => Model::Other(v),
8309                Self::TextEmbeddingAda002 => Model::TextEmbeddingAda002(Default::default()),
8310                Self::TextEmbedding3Small => Model::TextEmbedding3Small(Default::default()),
8311                Self::TextEmbedding3Large => Model::TextEmbedding3Large(Default::default()),
8312            }
8313            .serialize(serializer)
8314        }
8315    }
8316    #[doc = "The format to return the embeddings in. Can be either `float` or [`base64`](https://pypi.org/project/pybase64/)."]
8317    #[derive(Clone, Copy, Debug, Default, PartialEq, serde :: Deserialize, serde :: Serialize)]
8318    pub enum EncodingFormat {
8319        #[doc = "`float`"]
8320        #[default]
8321        #[serde(rename = "float")]
8322        Float,
8323        #[doc = "`base64`"]
8324        #[serde(rename = "base64")]
8325        Base64,
8326    }
8327}
8328#[derive(Clone, Debug, PartialEq)]
8329#[serde_with::serde_as]
8330#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
8331pub struct CreateEmbeddingRequest {
8332    #[doc = "Input text to embed, encoded as a string or array of tokens. To embed multiple inputs in a single request, pass an array of strings or array of token arrays. The input must not exceed the max input tokens for the model (8192 tokens for all embedding models), cannot be an empty string, and any array must be 2048 dimensions or less. [Example Python code](https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken) for counting tokens. In addition to the per-input token limit, all embedding  models enforce a maximum of 300,000 tokens summed across all inputs in a  single request.\n"]
8333    #[serde(rename = "input")]
8334    pub input: crate::__types::create_embedding_request::Input,
8335    #[doc = "ID of the model to use. You can use the [List models](https://platform.openai.com/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](https://platform.openai.com/docs/models) for descriptions of them.\n"]
8336    #[serde(rename = "model")]
8337    pub model: crate::__types::create_embedding_request::Model,
8338    #[doc = "The format to return the embeddings in. Can be either `float` or [`base64`](https://pypi.org/project/pybase64/)."]
8339    #[serde(rename = "encoding_format")]
8340    #[serde(skip_serializing_if = "Option::is_none")]
8341    #[builder(default)]
8342    pub encoding_format: Option<crate::__types::create_embedding_request::EncodingFormat>,
8343    #[doc = "The number of dimensions the resulting output embeddings should have. Only supported in `text-embedding-3` and later models.\n"]
8344    #[serde(rename = "dimensions")]
8345    #[serde(skip_serializing_if = "Option::is_none")]
8346    #[builder(default)]
8347    pub dimensions: Option<i64>,
8348    #[doc = "A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#end-user-ids).\n"]
8349    #[serde(rename = "user")]
8350    #[serde(skip_serializing_if = "Option::is_none")]
8351    #[builder(default)]
8352    pub user: Option<String>,
8353}
8354#[allow(clippy::module_inception)]
8355pub mod create_embedding_response {
8356    #[doc = "The object type, which is always \"list\"."]
8357    #[derive(Clone, Copy, Debug, Default, PartialEq)]
8358    pub(crate) struct Object;
8359    impl_serde!(Object, "list");
8360    #[doc = "The usage information for the request."]
8361    #[derive(Clone, Copy, Debug, PartialEq)]
8362    #[serde_with::serde_as]
8363    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
8364    pub struct Usage {
8365        #[doc = "The number of tokens used by the prompt."]
8366        #[serde(rename = "prompt_tokens")]
8367        pub prompt_tokens: i64,
8368        #[doc = "The total number of tokens used by the request."]
8369        #[serde(rename = "total_tokens")]
8370        pub total_tokens: i64,
8371    }
8372}
8373#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
8374pub struct CreateEmbeddingResponse {
8375    #[doc = "The list of embeddings generated by the model."]
8376    pub data: Vec<crate::__types::Embedding>,
8377    #[doc = "The name of the model used to generate the embedding."]
8378    pub model: String,
8379    #[doc = "The usage information for the request."]
8380    pub usage: crate::__types::create_embedding_response::Usage,
8381}
8382impl<'de> serde::Deserialize<'de> for CreateEmbeddingResponse {
8383    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
8384    where
8385        D: serde::Deserializer<'de>,
8386    {
8387        #[serde_with::serde_as]
8388        #[derive(serde :: Deserialize)]
8389        struct CreateEmbeddingResponse {
8390            #[serde(rename = "data")]
8391            data: Vec<crate::__types::Embedding>,
8392            #[serde(rename = "model")]
8393            model: String,
8394            #[serde(rename = "object")]
8395            #[allow(dead_code)]
8396            object: crate::__types::create_embedding_response::Object,
8397            #[serde(rename = "usage")]
8398            usage: crate::__types::create_embedding_response::Usage,
8399        }
8400        let CreateEmbeddingResponse {
8401            data, model, usage, ..
8402        } = CreateEmbeddingResponse::deserialize(deserializer)?;
8403        Ok(Self { data, model, usage })
8404    }
8405}
8406impl serde::Serialize for CreateEmbeddingResponse {
8407    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
8408    where
8409        S: serde::Serializer,
8410    {
8411        #[serde_with::serde_as]
8412        #[derive(serde :: Serialize)]
8413        struct CreateEmbeddingResponse<'a> {
8414            #[serde(rename = "data")]
8415            data: &'a Vec<crate::__types::Embedding>,
8416            #[serde(rename = "model")]
8417            model: &'a String,
8418            #[serde(rename = "object")]
8419            object: &'a crate::__types::create_embedding_response::Object,
8420            #[serde(rename = "usage")]
8421            usage: &'a crate::__types::create_embedding_response::Usage,
8422        }
8423        let Self { data, model, usage } = self;
8424        CreateEmbeddingResponse {
8425            data,
8426            model,
8427            object: &Default::default(),
8428            usage,
8429        }
8430        .serialize(serializer)
8431    }
8432}
8433#[allow(clippy::module_inception)]
8434pub mod create_eval_completions_run_data_source {
8435    #[doc = "The type of run data source. Always `completions`."]
8436    #[derive(Clone, Copy, Debug, Default, PartialEq)]
8437    pub(crate) struct Type;
8438    impl_serde!(Type, "completions");
8439    #[allow(clippy::module_inception)]
8440    pub mod input_messages {
8441        #[allow(clippy::module_inception)]
8442        pub mod template {
8443            #[doc = "The type of input messages. Always `template`."]
8444            #[derive(Clone, Copy, Debug, Default, PartialEq)]
8445            pub(crate) struct Type;
8446            impl_serde!(Type, "template");
8447            #[allow(clippy::module_inception)]
8448            pub mod template {
8449                #[derive(Clone, Debug, PartialEq)]
8450                #[serde_with::serde_as]
8451                #[derive(serde :: Deserialize, serde :: Serialize)]
8452                #[serde(untagged)]
8453                #[allow(clippy::large_enum_variant)]
8454                pub enum Item {
8455                    EasyInputMessage(crate::__types::EasyInputMessage),
8456                    EvalItem(crate::__types::EvalItem),
8457                }
8458            }
8459        }
8460        #[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
8461        pub struct Template { # [doc = "A list of chat messages forming the prompt or context. May include variable references to the `item` namespace, ie {{item.name}}."] pub template : Vec < crate :: __types :: create_eval_completions_run_data_source :: input_messages :: template :: template :: Item > }
8462        impl<'de> serde::Deserialize<'de> for Template {
8463            fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
8464            where
8465                D: serde::Deserializer<'de>,
8466            {
8467                #[serde_with::serde_as]
8468                #[derive(serde :: Deserialize)]
8469                struct Template { # [serde (rename = "type")] # [allow (dead_code)] r#type : crate :: __types :: create_eval_completions_run_data_source :: input_messages :: template :: Type , # [serde (rename = "template")] template : Vec < crate :: __types :: create_eval_completions_run_data_source :: input_messages :: template :: template :: Item > }
8470                let Template { template, .. } = Template::deserialize(deserializer)?;
8471                Ok(Self { template })
8472            }
8473        }
8474        impl serde::Serialize for Template {
8475            fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
8476            where
8477                S: serde::Serializer,
8478            {
8479                #[serde_with::serde_as]
8480                #[derive(serde :: Serialize)]
8481                struct Template < 'a > { # [serde (rename = "type")] r#type : & 'a crate :: __types :: create_eval_completions_run_data_source :: input_messages :: template :: Type , # [serde (rename = "template")] template : & 'a Vec < crate :: __types :: create_eval_completions_run_data_source :: input_messages :: template :: template :: Item > }
8482                let Self { template } = self;
8483                Template {
8484                    r#type: &Default::default(),
8485                    template,
8486                }
8487                .serialize(serializer)
8488            }
8489        }
8490        #[allow(clippy::module_inception)]
8491        pub(crate) mod item_reference {
8492            #[doc = "The type of input messages. Always `item_reference`."]
8493            #[derive(Clone, Copy, Debug, Default, PartialEq)]
8494            pub(crate) struct Type;
8495            impl_serde!(Type, "item_reference");
8496        }
8497        #[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
8498        pub struct ItemReference {
8499            #[doc = "A reference to a variable in the `item` namespace. Ie, \"item.input_trajectory\""]
8500            pub item_reference: String,
8501        }
8502        impl<'de> serde::Deserialize<'de> for ItemReference {
8503            fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
8504            where
8505                D: serde::Deserializer<'de>,
8506            {
8507                #[serde_with::serde_as]
8508                #[derive(serde :: Deserialize)]
8509                struct ItemReference { # [serde (rename = "type")] # [allow (dead_code)] r#type : crate :: __types :: create_eval_completions_run_data_source :: input_messages :: item_reference :: Type , # [serde (rename = "item_reference")] item_reference : String }
8510                let ItemReference { item_reference, .. } =
8511                    ItemReference::deserialize(deserializer)?;
8512                Ok(Self { item_reference })
8513            }
8514        }
8515        impl serde::Serialize for ItemReference {
8516            fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
8517            where
8518                S: serde::Serializer,
8519            {
8520                #[serde_with::serde_as]
8521                #[derive(serde :: Serialize)]
8522                struct ItemReference < 'a > { # [serde (rename = "type")] r#type : & 'a crate :: __types :: create_eval_completions_run_data_source :: input_messages :: item_reference :: Type , # [serde (rename = "item_reference")] item_reference : & 'a String }
8523                let Self { item_reference } = self;
8524                ItemReference {
8525                    r#type: &Default::default(),
8526                    item_reference,
8527                }
8528                .serialize(serializer)
8529            }
8530        }
8531    }
8532    #[doc = "Used when sampling from a model. Dictates the structure of the messages passed into the model. Can either be a reference to a prebuilt trajectory (ie, `item.input_trajectory`), or a template with variable references to the `item` namespace."]
8533    #[derive(Clone, Debug, PartialEq)]
8534    #[serde_with::serde_as]
8535    #[derive(serde :: Deserialize, serde :: Serialize)]
8536    #[serde(untagged)]
8537    #[allow(clippy::large_enum_variant)]
8538    pub enum InputMessages {
8539        Template(crate::__types::create_eval_completions_run_data_source::input_messages::Template),
8540        ItemReference(
8541            crate::__types::create_eval_completions_run_data_source::input_messages::ItemReference,
8542        ),
8543    }
8544    #[allow(clippy::module_inception)]
8545    pub mod sampling_params {
8546        #[doc = "An object specifying the format that the model must output.\n\nSetting to `{ \"type\": \"json_schema\", \"json_schema\": {...} }` enables\nStructured Outputs which ensures the model will match your supplied JSON\nschema. Learn more in the [Structured Outputs\nguide](https://platform.openai.com/docs/guides/structured-outputs).\n\nSetting to `{ \"type\": \"json_object\" }` enables the older JSON mode, which\nensures the message the model generates is valid JSON. Using `json_schema`\nis preferred for models that support it.\n"]
8547        #[derive(Clone, Debug, PartialEq)]
8548        #[serde_with::serde_as]
8549        #[derive(serde :: Deserialize, serde :: Serialize)]
8550        #[serde(untagged)]
8551        #[allow(clippy::large_enum_variant)]
8552        pub enum ResponseFormat {
8553            Text(crate::__types::ResponseFormatText),
8554            JsonSchema(crate::__types::ResponseFormatJsonSchema),
8555            JsonObject(crate::__types::ResponseFormatJsonObject),
8556        }
8557    }
8558    #[derive(Clone, Debug, Default, PartialEq)]
8559    #[serde_with::serde_as]
8560    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
8561    pub struct SamplingParams { # [doc = "A higher temperature increases randomness in the outputs."] # [serde (rename = "temperature")] # [serde (skip_serializing_if = "Option::is_none")] # [builder (default)] pub temperature : Option < serde_json :: Number > , # [doc = "The maximum number of tokens in the generated output."] # [serde (rename = "max_completion_tokens")] # [serde (skip_serializing_if = "Option::is_none")] # [builder (default)] pub max_completion_tokens : Option < i64 > , # [doc = "An alternative to temperature for nucleus sampling; 1.0 includes all tokens."] # [serde (rename = "top_p")] # [serde (skip_serializing_if = "Option::is_none")] # [builder (default)] pub top_p : Option < serde_json :: Number > , # [doc = "A seed value to initialize the randomness, during sampling."] # [serde (rename = "seed")] # [serde (skip_serializing_if = "Option::is_none")] # [builder (default)] pub seed : Option < i64 > , # [doc = "An object specifying the format that the model must output.\n\nSetting to `{ \"type\": \"json_schema\", \"json_schema\": {...} }` enables\nStructured Outputs which ensures the model will match your supplied JSON\nschema. Learn more in the [Structured Outputs\nguide](https://platform.openai.com/docs/guides/structured-outputs).\n\nSetting to `{ \"type\": \"json_object\" }` enables the older JSON mode, which\nensures the message the model generates is valid JSON. Using `json_schema`\nis preferred for models that support it.\n"] # [serde (rename = "response_format")] # [serde (skip_serializing_if = "Option::is_none")] # [builder (default)] pub response_format : Option < crate :: __types :: create_eval_completions_run_data_source :: sampling_params :: ResponseFormat > , # [doc = "A list of tools the model may call. Currently, only functions are supported as a tool. Use this to provide a list of functions the model may generate JSON inputs for. A max of 128 functions are supported.\n"] # [serde (rename = "tools")] # [serde (skip_serializing_if = "Option::is_none")] # [builder (default)] pub tools : Option < Vec < crate :: __types :: ChatCompletionTool > > }
8562    #[doc = "Determines what populates the `item` namespace in this run's data source."]
8563    #[derive(Clone, Debug, PartialEq)]
8564    #[serde_with::serde_as]
8565    #[derive(serde :: Deserialize, serde :: Serialize)]
8566    #[serde(untagged)]
8567    #[allow(clippy::large_enum_variant)]
8568    pub enum Source {
8569        FileContent(crate::__types::EvalJsonlFileContentSource),
8570        FileId(crate::__types::EvalJsonlFileIdSource),
8571        StoredCompletions(crate::__types::EvalStoredCompletionsSource),
8572    }
8573}
8574#[doc = "A CompletionsRunDataSource object describing a model sampling configuration.\n"]
8575#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
8576pub struct CreateEvalCompletionsRunDataSource {
8577    #[doc = "Used when sampling from a model. Dictates the structure of the messages passed into the model. Can either be a reference to a prebuilt trajectory (ie, `item.input_trajectory`), or a template with variable references to the `item` namespace."]
8578    #[builder(default)]
8579    pub input_messages:
8580        Option<crate::__types::create_eval_completions_run_data_source::InputMessages>,
8581    #[builder(default)]
8582    pub sampling_params:
8583        Option<crate::__types::create_eval_completions_run_data_source::SamplingParams>,
8584    #[doc = "The name of the model to use for generating completions (e.g. \"o3-mini\")."]
8585    #[builder(default)]
8586    pub model: Option<String>,
8587    #[doc = "Determines what populates the `item` namespace in this run's data source."]
8588    pub source: crate::__types::create_eval_completions_run_data_source::Source,
8589}
8590impl<'de> serde::Deserialize<'de> for CreateEvalCompletionsRunDataSource {
8591    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
8592    where
8593        D: serde::Deserializer<'de>,
8594    {
8595        #[serde_with::serde_as]
8596        #[derive(serde :: Deserialize)]
8597        struct CreateEvalCompletionsRunDataSource {
8598            #[serde(rename = "type")]
8599            #[allow(dead_code)]
8600            r#type: crate::__types::create_eval_completions_run_data_source::Type,
8601            #[serde(rename = "input_messages")]
8602            input_messages:
8603                Option<crate::__types::create_eval_completions_run_data_source::InputMessages>,
8604            #[serde(rename = "sampling_params")]
8605            sampling_params:
8606                Option<crate::__types::create_eval_completions_run_data_source::SamplingParams>,
8607            #[serde(rename = "model")]
8608            model: Option<String>,
8609            #[serde(rename = "source")]
8610            source: crate::__types::create_eval_completions_run_data_source::Source,
8611        }
8612        let CreateEvalCompletionsRunDataSource {
8613            input_messages,
8614            sampling_params,
8615            model,
8616            source,
8617            ..
8618        } = CreateEvalCompletionsRunDataSource::deserialize(deserializer)?;
8619        Ok(Self {
8620            input_messages,
8621            sampling_params,
8622            model,
8623            source,
8624        })
8625    }
8626}
8627impl serde::Serialize for CreateEvalCompletionsRunDataSource {
8628    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
8629    where
8630        S: serde::Serializer,
8631    {
8632        #[serde_with::serde_as]
8633        #[derive(serde :: Serialize)]
8634        struct CreateEvalCompletionsRunDataSource<'a> {
8635            #[serde(rename = "type")]
8636            r#type: &'a crate::__types::create_eval_completions_run_data_source::Type,
8637            #[serde(rename = "input_messages")]
8638            #[serde(skip_serializing_if = "Option::is_none")]
8639            input_messages:
8640                &'a Option<crate::__types::create_eval_completions_run_data_source::InputMessages>,
8641            #[serde(rename = "sampling_params")]
8642            #[serde(skip_serializing_if = "Option::is_none")]
8643            sampling_params:
8644                &'a Option<crate::__types::create_eval_completions_run_data_source::SamplingParams>,
8645            #[serde(rename = "model")]
8646            #[serde(skip_serializing_if = "Option::is_none")]
8647            model: &'a Option<String>,
8648            #[serde(rename = "source")]
8649            source: &'a crate::__types::create_eval_completions_run_data_source::Source,
8650        }
8651        let Self {
8652            input_messages,
8653            sampling_params,
8654            model,
8655            source,
8656        } = self;
8657        CreateEvalCompletionsRunDataSource {
8658            r#type: &Default::default(),
8659            input_messages,
8660            sampling_params,
8661            model,
8662            source,
8663        }
8664        .serialize(serializer)
8665    }
8666}
8667#[allow(clippy::module_inception)]
8668pub(crate) mod create_eval_custom_data_source_config {
8669    #[doc = "The type of data source. Always `custom`."]
8670    #[derive(Clone, Copy, Debug, Default, PartialEq)]
8671    pub(crate) struct Type;
8672    impl_serde!(Type, "custom");
8673}
8674#[doc = "A CustomDataSourceConfig object that defines the schema for the data source used for the evaluation runs.\nThis schema is used to define the shape of the data that will be:\n- Used to define your testing criteria and\n- What data is required when creating a run\n"]
8675#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
8676pub struct CreateEvalCustomDataSourceConfig {
8677    #[doc = "The json schema for each row in the data source."]
8678    pub item_schema: indexmap::IndexMap<String, serde_json::Value>,
8679    #[doc = "Whether the eval should expect you to populate the sample namespace (ie, by generating responses off of your data source)"]
8680    #[builder(default)]
8681    pub include_sample_schema: Option<bool>,
8682}
8683impl<'de> serde::Deserialize<'de> for CreateEvalCustomDataSourceConfig {
8684    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
8685    where
8686        D: serde::Deserializer<'de>,
8687    {
8688        #[serde_with::serde_as]
8689        #[derive(serde :: Deserialize)]
8690        struct CreateEvalCustomDataSourceConfig {
8691            #[serde(rename = "type")]
8692            #[allow(dead_code)]
8693            r#type: crate::__types::create_eval_custom_data_source_config::Type,
8694            #[serde(rename = "item_schema")]
8695            item_schema: indexmap::IndexMap<String, serde_json::Value>,
8696            #[serde(rename = "include_sample_schema")]
8697            include_sample_schema: Option<bool>,
8698        }
8699        let CreateEvalCustomDataSourceConfig {
8700            item_schema,
8701            include_sample_schema,
8702            ..
8703        } = CreateEvalCustomDataSourceConfig::deserialize(deserializer)?;
8704        Ok(Self {
8705            item_schema,
8706            include_sample_schema,
8707        })
8708    }
8709}
8710impl serde::Serialize for CreateEvalCustomDataSourceConfig {
8711    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
8712    where
8713        S: serde::Serializer,
8714    {
8715        #[serde_with::serde_as]
8716        #[derive(serde :: Serialize)]
8717        struct CreateEvalCustomDataSourceConfig<'a> {
8718            #[serde(rename = "type")]
8719            r#type: &'a crate::__types::create_eval_custom_data_source_config::Type,
8720            #[serde(rename = "item_schema")]
8721            item_schema: &'a indexmap::IndexMap<String, serde_json::Value>,
8722            #[serde(rename = "include_sample_schema")]
8723            #[serde(skip_serializing_if = "Option::is_none")]
8724            include_sample_schema: &'a Option<bool>,
8725        }
8726        let Self {
8727            item_schema,
8728            include_sample_schema,
8729        } = self;
8730        CreateEvalCustomDataSourceConfig {
8731            r#type: &Default::default(),
8732            item_schema,
8733            include_sample_schema,
8734        }
8735        .serialize(serializer)
8736    }
8737}
8738#[allow(clippy::module_inception)]
8739pub mod create_eval_item {
8740    #[derive(Clone, Debug, PartialEq)]
8741    #[serde_with::serde_as]
8742    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
8743    pub struct Variant0 {
8744        #[doc = "The role of the message (e.g. \"system\", \"assistant\", \"user\")."]
8745        #[serde(rename = "role")]
8746        pub role: String,
8747        #[doc = "The content of the message."]
8748        #[serde(rename = "content")]
8749        pub content: String,
8750    }
8751}
8752#[doc = "A chat message that makes up the prompt or context. May include variable references to the `item` namespace, ie {{item.name}}."]
8753#[derive(Clone, Debug, PartialEq)]
8754#[serde_with::serde_as]
8755#[derive(serde :: Deserialize, serde :: Serialize)]
8756#[serde(untagged)]
8757#[allow(clippy::large_enum_variant)]
8758pub enum CreateEvalItem {
8759    Variant0(crate::__types::create_eval_item::Variant0),
8760    EvalItem(crate::__types::EvalItem),
8761}
8762#[allow(clippy::module_inception)]
8763pub mod create_eval_jsonl_run_data_source {
8764    #[doc = "The type of data source. Always `jsonl`."]
8765    #[derive(Clone, Copy, Debug, Default, PartialEq)]
8766    pub(crate) struct Type;
8767    impl_serde!(Type, "jsonl");
8768    #[doc = "Determines what populates the `item` namespace in the data source."]
8769    #[derive(Clone, Debug, PartialEq)]
8770    #[serde_with::serde_as]
8771    #[derive(serde :: Deserialize, serde :: Serialize)]
8772    #[serde(untagged)]
8773    #[allow(clippy::large_enum_variant)]
8774    pub enum Source {
8775        FileContent(crate::__types::EvalJsonlFileContentSource),
8776        FileId(crate::__types::EvalJsonlFileIdSource),
8777    }
8778}
8779#[doc = "A JsonlRunDataSource object with that specifies a JSONL file that matches the eval \n"]
8780#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
8781pub struct CreateEvalJsonlRunDataSource {
8782    #[doc = "Determines what populates the `item` namespace in the data source."]
8783    pub source: crate::__types::create_eval_jsonl_run_data_source::Source,
8784}
8785impl<'de> serde::Deserialize<'de> for CreateEvalJsonlRunDataSource {
8786    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
8787    where
8788        D: serde::Deserializer<'de>,
8789    {
8790        #[serde_with::serde_as]
8791        #[derive(serde :: Deserialize)]
8792        struct CreateEvalJsonlRunDataSource {
8793            #[serde(rename = "type")]
8794            #[allow(dead_code)]
8795            r#type: crate::__types::create_eval_jsonl_run_data_source::Type,
8796            #[serde(rename = "source")]
8797            source: crate::__types::create_eval_jsonl_run_data_source::Source,
8798        }
8799        let CreateEvalJsonlRunDataSource { source, .. } =
8800            CreateEvalJsonlRunDataSource::deserialize(deserializer)?;
8801        Ok(Self { source })
8802    }
8803}
8804impl serde::Serialize for CreateEvalJsonlRunDataSource {
8805    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
8806    where
8807        S: serde::Serializer,
8808    {
8809        #[serde_with::serde_as]
8810        #[derive(serde :: Serialize)]
8811        struct CreateEvalJsonlRunDataSource<'a> {
8812            #[serde(rename = "type")]
8813            r#type: &'a crate::__types::create_eval_jsonl_run_data_source::Type,
8814            #[serde(rename = "source")]
8815            source: &'a crate::__types::create_eval_jsonl_run_data_source::Source,
8816        }
8817        let Self { source } = self;
8818        CreateEvalJsonlRunDataSource {
8819            r#type: &Default::default(),
8820            source,
8821        }
8822        .serialize(serializer)
8823    }
8824}
8825#[allow(clippy::module_inception)]
8826pub(crate) mod create_eval_label_model_grader {
8827    #[doc = "The object type, which is always `label_model`."]
8828    #[derive(Clone, Copy, Debug, Default, PartialEq)]
8829    pub(crate) struct Type;
8830    impl_serde!(Type, "label_model");
8831}
8832#[doc = "A LabelModelGrader object which uses a model to assign labels to each item\nin the evaluation.\n"]
8833#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
8834pub struct CreateEvalLabelModelGrader {
8835    #[doc = "The name of the grader."]
8836    pub name: String,
8837    #[doc = "The model to use for the evaluation. Must support structured outputs."]
8838    pub model: String,
8839    #[doc = "A list of chat messages forming the prompt or context. May include variable references to the `item` namespace, ie {{item.name}}."]
8840    pub input: Vec<crate::__types::CreateEvalItem>,
8841    #[doc = "The labels to classify to each item in the evaluation."]
8842    pub labels: Vec<String>,
8843    #[doc = "The labels that indicate a passing result. Must be a subset of labels."]
8844    pub passing_labels: Vec<String>,
8845}
8846impl<'de> serde::Deserialize<'de> for CreateEvalLabelModelGrader {
8847    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
8848    where
8849        D: serde::Deserializer<'de>,
8850    {
8851        #[serde_with::serde_as]
8852        #[derive(serde :: Deserialize)]
8853        struct CreateEvalLabelModelGrader {
8854            #[serde(rename = "type")]
8855            #[allow(dead_code)]
8856            r#type: crate::__types::create_eval_label_model_grader::Type,
8857            #[serde(rename = "name")]
8858            name: String,
8859            #[serde(rename = "model")]
8860            model: String,
8861            #[serde(rename = "input")]
8862            input: Vec<crate::__types::CreateEvalItem>,
8863            #[serde(rename = "labels")]
8864            labels: Vec<String>,
8865            #[serde(rename = "passing_labels")]
8866            passing_labels: Vec<String>,
8867        }
8868        let CreateEvalLabelModelGrader {
8869            name,
8870            model,
8871            input,
8872            labels,
8873            passing_labels,
8874            ..
8875        } = CreateEvalLabelModelGrader::deserialize(deserializer)?;
8876        Ok(Self {
8877            name,
8878            model,
8879            input,
8880            labels,
8881            passing_labels,
8882        })
8883    }
8884}
8885impl serde::Serialize for CreateEvalLabelModelGrader {
8886    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
8887    where
8888        S: serde::Serializer,
8889    {
8890        #[serde_with::serde_as]
8891        #[derive(serde :: Serialize)]
8892        struct CreateEvalLabelModelGrader<'a> {
8893            #[serde(rename = "type")]
8894            r#type: &'a crate::__types::create_eval_label_model_grader::Type,
8895            #[serde(rename = "name")]
8896            name: &'a String,
8897            #[serde(rename = "model")]
8898            model: &'a String,
8899            #[serde(rename = "input")]
8900            input: &'a Vec<crate::__types::CreateEvalItem>,
8901            #[serde(rename = "labels")]
8902            labels: &'a Vec<String>,
8903            #[serde(rename = "passing_labels")]
8904            passing_labels: &'a Vec<String>,
8905        }
8906        let Self {
8907            name,
8908            model,
8909            input,
8910            labels,
8911            passing_labels,
8912        } = self;
8913        CreateEvalLabelModelGrader {
8914            r#type: &Default::default(),
8915            name,
8916            model,
8917            input,
8918            labels,
8919            passing_labels,
8920        }
8921        .serialize(serializer)
8922    }
8923}
8924#[allow(clippy::module_inception)]
8925pub(crate) mod create_eval_logs_data_source_config {
8926    #[doc = "The type of data source. Always `logs`."]
8927    #[derive(Clone, Copy, Debug, Default, PartialEq)]
8928    pub(crate) struct Type;
8929    impl_serde!(Type, "logs");
8930}
8931#[doc = "A data source config which specifies the metadata property of your logs query.\nThis is usually metadata like `usecase=chatbot` or `prompt-version=v2`, etc.\n"]
8932#[derive(Clone, Debug, Default, PartialEq, typed_builder :: TypedBuilder)]
8933pub struct CreateEvalLogsDataSourceConfig {
8934    #[doc = "Metadata filters for the logs data source."]
8935    #[builder(default)]
8936    pub metadata: Option<indexmap::IndexMap<String, serde_json::Value>>,
8937}
8938impl<'de> serde::Deserialize<'de> for CreateEvalLogsDataSourceConfig {
8939    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
8940    where
8941        D: serde::Deserializer<'de>,
8942    {
8943        #[serde_with::serde_as]
8944        #[derive(serde :: Deserialize)]
8945        struct CreateEvalLogsDataSourceConfig {
8946            #[serde(rename = "type")]
8947            #[allow(dead_code)]
8948            r#type: crate::__types::create_eval_logs_data_source_config::Type,
8949            #[serde(rename = "metadata")]
8950            metadata: Option<indexmap::IndexMap<String, serde_json::Value>>,
8951        }
8952        let CreateEvalLogsDataSourceConfig { metadata, .. } =
8953            CreateEvalLogsDataSourceConfig::deserialize(deserializer)?;
8954        Ok(Self { metadata })
8955    }
8956}
8957impl serde::Serialize for CreateEvalLogsDataSourceConfig {
8958    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
8959    where
8960        S: serde::Serializer,
8961    {
8962        #[serde_with::serde_as]
8963        #[derive(serde :: Serialize)]
8964        struct CreateEvalLogsDataSourceConfig<'a> {
8965            #[serde(rename = "type")]
8966            r#type: &'a crate::__types::create_eval_logs_data_source_config::Type,
8967            #[serde(rename = "metadata")]
8968            #[serde(skip_serializing_if = "Option::is_none")]
8969            metadata: &'a Option<indexmap::IndexMap<String, serde_json::Value>>,
8970        }
8971        let Self { metadata } = self;
8972        CreateEvalLogsDataSourceConfig {
8973            r#type: &Default::default(),
8974            metadata,
8975        }
8976        .serialize(serializer)
8977    }
8978}
8979#[allow(clippy::module_inception)]
8980pub mod create_eval_request {
8981    #[doc = "The configuration for the data source used for the evaluation runs. Dictates the schema of the data used in the evaluation."]
8982    #[derive(Clone, Debug, PartialEq)]
8983    #[serde_with::serde_as]
8984    #[derive(serde :: Deserialize, serde :: Serialize)]
8985    #[serde(untagged)]
8986    #[allow(clippy::large_enum_variant)]
8987    pub enum DataSourceConfig {
8988        Custom(crate::__types::CreateEvalCustomDataSourceConfig),
8989        Logs(crate::__types::CreateEvalLogsDataSourceConfig),
8990        StoredCompletions(crate::__types::CreateEvalStoredCompletionsDataSourceConfig),
8991    }
8992    #[allow(clippy::module_inception)]
8993    pub mod testing_criteria {
8994        #[derive(Clone, Debug, PartialEq)]
8995        #[serde_with::serde_as]
8996        #[derive(serde :: Deserialize, serde :: Serialize)]
8997        #[serde(untagged)]
8998        #[allow(clippy::large_enum_variant)]
8999        pub enum Item {
9000            LabelModel(crate::__types::CreateEvalLabelModelGrader),
9001            StringCheck(crate::__types::EvalGraderStringCheck),
9002            TextSimilarity(crate::__types::EvalGraderTextSimilarity),
9003            Python(crate::__types::EvalGraderPython),
9004            ScoreModel(crate::__types::EvalGraderScoreModel),
9005        }
9006    }
9007}
9008#[derive(Clone, Debug, PartialEq)]
9009#[serde_with::serde_as]
9010#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
9011pub struct CreateEvalRequest {
9012    #[doc = "The name of the evaluation."]
9013    #[serde(rename = "name")]
9014    #[serde(skip_serializing_if = "Option::is_none")]
9015    #[builder(default)]
9016    pub name: Option<String>,
9017    #[serde(rename = "metadata")]
9018    #[serde(skip_serializing_if = "Option::is_none")]
9019    #[builder(default)]
9020    pub metadata: Option<crate::__types::Metadata>,
9021    #[doc = "The configuration for the data source used for the evaluation runs. Dictates the schema of the data used in the evaluation."]
9022    #[serde(rename = "data_source_config")]
9023    pub data_source_config: crate::__types::create_eval_request::DataSourceConfig,
9024    #[doc = "A list of graders for all eval runs in this group. Graders can reference variables in the data source using double curly braces notation, like `{{item.variable_name}}`. To reference the model's output, use the `sample` namespace (ie, `{{sample.output_text}}`)."]
9025    #[serde(rename = "testing_criteria")]
9026    pub testing_criteria: Vec<crate::__types::create_eval_request::testing_criteria::Item>,
9027}
9028#[allow(clippy::module_inception)]
9029pub mod create_eval_responses_run_data_source {
9030    #[doc = "The type of run data source. Always `responses`."]
9031    #[derive(Clone, Copy, Debug, Default, PartialEq)]
9032    pub(crate) struct Type;
9033    impl_serde!(Type, "responses");
9034    #[allow(clippy::module_inception)]
9035    pub mod input_messages {
9036        #[allow(clippy::module_inception)]
9037        pub mod template {
9038            #[doc = "The type of input messages. Always `template`."]
9039            #[derive(Clone, Copy, Debug, Default, PartialEq)]
9040            pub(crate) struct Type;
9041            impl_serde!(Type, "template");
9042            #[allow(clippy::module_inception)]
9043            pub mod template {
9044                #[allow(clippy::module_inception)]
9045                pub mod item {
9046                    #[derive(Clone, Debug, PartialEq)]
9047                    #[serde_with::serde_as]
9048                    #[derive(
9049                        serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder,
9050                    )]
9051                    pub struct Variant0 {
9052                        #[doc = "The role of the message (e.g. \"system\", \"assistant\", \"user\")."]
9053                        #[serde(rename = "role")]
9054                        pub role: String,
9055                        #[doc = "The content of the message."]
9056                        #[serde(rename = "content")]
9057                        pub content: String,
9058                    }
9059                }
9060                #[derive(Clone, Debug, PartialEq)]
9061                #[serde_with::serde_as]
9062                #[derive(serde :: Deserialize, serde :: Serialize)]
9063                #[serde(untagged)]
9064                #[allow(clippy::large_enum_variant)]
9065                pub enum Item {
9066                    Variant0 (crate :: __types :: create_eval_responses_run_data_source :: input_messages :: template :: template :: item :: Variant0) , EvalItem (crate :: __types :: EvalItem) }
9067            }
9068        }
9069        #[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
9070        pub struct Template { # [doc = "A list of chat messages forming the prompt or context. May include variable references to the `item` namespace, ie {{item.name}}."] pub template : Vec < crate :: __types :: create_eval_responses_run_data_source :: input_messages :: template :: template :: Item > }
9071        impl<'de> serde::Deserialize<'de> for Template {
9072            fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
9073            where
9074                D: serde::Deserializer<'de>,
9075            {
9076                #[serde_with::serde_as]
9077                #[derive(serde :: Deserialize)]
9078                struct Template { # [serde (rename = "type")] # [allow (dead_code)] r#type : crate :: __types :: create_eval_responses_run_data_source :: input_messages :: template :: Type , # [serde (rename = "template")] template : Vec < crate :: __types :: create_eval_responses_run_data_source :: input_messages :: template :: template :: Item > }
9079                let Template { template, .. } = Template::deserialize(deserializer)?;
9080                Ok(Self { template })
9081            }
9082        }
9083        impl serde::Serialize for Template {
9084            fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
9085            where
9086                S: serde::Serializer,
9087            {
9088                #[serde_with::serde_as]
9089                #[derive(serde :: Serialize)]
9090                struct Template < 'a > { # [serde (rename = "type")] r#type : & 'a crate :: __types :: create_eval_responses_run_data_source :: input_messages :: template :: Type , # [serde (rename = "template")] template : & 'a Vec < crate :: __types :: create_eval_responses_run_data_source :: input_messages :: template :: template :: Item > }
9091                let Self { template } = self;
9092                Template {
9093                    r#type: &Default::default(),
9094                    template,
9095                }
9096                .serialize(serializer)
9097            }
9098        }
9099        #[allow(clippy::module_inception)]
9100        pub(crate) mod item_reference {
9101            #[doc = "The type of input messages. Always `item_reference`."]
9102            #[derive(Clone, Copy, Debug, Default, PartialEq)]
9103            pub(crate) struct Type;
9104            impl_serde!(Type, "item_reference");
9105        }
9106        #[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
9107        pub struct ItemReference {
9108            #[doc = "A reference to a variable in the `item` namespace. Ie, \"item.name\""]
9109            pub item_reference: String,
9110        }
9111        impl<'de> serde::Deserialize<'de> for ItemReference {
9112            fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
9113            where
9114                D: serde::Deserializer<'de>,
9115            {
9116                #[serde_with::serde_as]
9117                #[derive(serde :: Deserialize)]
9118                struct ItemReference { # [serde (rename = "type")] # [allow (dead_code)] r#type : crate :: __types :: create_eval_responses_run_data_source :: input_messages :: item_reference :: Type , # [serde (rename = "item_reference")] item_reference : String }
9119                let ItemReference { item_reference, .. } =
9120                    ItemReference::deserialize(deserializer)?;
9121                Ok(Self { item_reference })
9122            }
9123        }
9124        impl serde::Serialize for ItemReference {
9125            fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
9126            where
9127                S: serde::Serializer,
9128            {
9129                #[serde_with::serde_as]
9130                #[derive(serde :: Serialize)]
9131                struct ItemReference < 'a > { # [serde (rename = "type")] r#type : & 'a crate :: __types :: create_eval_responses_run_data_source :: input_messages :: item_reference :: Type , # [serde (rename = "item_reference")] item_reference : & 'a String }
9132                let Self { item_reference } = self;
9133                ItemReference {
9134                    r#type: &Default::default(),
9135                    item_reference,
9136                }
9137                .serialize(serializer)
9138            }
9139        }
9140    }
9141    #[doc = "Used when sampling from a model. Dictates the structure of the messages passed into the model. Can either be a reference to a prebuilt trajectory (ie, `item.input_trajectory`), or a template with variable references to the `item` namespace."]
9142    #[derive(Clone, Debug, PartialEq)]
9143    #[serde_with::serde_as]
9144    #[derive(serde :: Deserialize, serde :: Serialize)]
9145    #[serde(untagged)]
9146    #[allow(clippy::large_enum_variant)]
9147    pub enum InputMessages {
9148        Template(crate::__types::create_eval_responses_run_data_source::input_messages::Template),
9149        ItemReference(
9150            crate::__types::create_eval_responses_run_data_source::input_messages::ItemReference,
9151        ),
9152    }
9153    #[allow(clippy::module_inception)]
9154    pub mod sampling_params {
9155        #[doc = "Configuration options for a text response from the model. Can be plain\ntext or structured JSON data. Learn more:\n- [Text inputs and outputs](https://platform.openai.com/docs/guides/text)\n- [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs)\n"]
9156        #[derive(Clone, Debug, Default, PartialEq)]
9157        #[serde_with::serde_as]
9158        #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
9159        pub struct Text {
9160            #[serde(rename = "format")]
9161            #[serde(skip_serializing_if = "Option::is_none")]
9162            #[builder(default)]
9163            pub format: Option<crate::__types::TextResponseFormatConfiguration>,
9164        }
9165    }
9166    #[derive(Clone, Debug, Default, PartialEq)]
9167    #[serde_with::serde_as]
9168    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
9169    pub struct SamplingParams {
9170        #[doc = "A higher temperature increases randomness in the outputs."]
9171        #[serde(rename = "temperature")]
9172        #[serde(skip_serializing_if = "Option::is_none")]
9173        #[builder(default)]
9174        pub temperature: Option<serde_json::Number>,
9175        #[doc = "The maximum number of tokens in the generated output."]
9176        #[serde(rename = "max_completion_tokens")]
9177        #[serde(skip_serializing_if = "Option::is_none")]
9178        #[builder(default)]
9179        pub max_completion_tokens: Option<i64>,
9180        #[doc = "An alternative to temperature for nucleus sampling; 1.0 includes all tokens."]
9181        #[serde(rename = "top_p")]
9182        #[serde(skip_serializing_if = "Option::is_none")]
9183        #[builder(default)]
9184        pub top_p: Option<serde_json::Number>,
9185        #[doc = "A seed value to initialize the randomness, during sampling."]
9186        #[serde(rename = "seed")]
9187        #[serde(skip_serializing_if = "Option::is_none")]
9188        #[builder(default)]
9189        pub seed: Option<i64>,
9190        #[doc = "An array of tools the model may call while generating a response. You\ncan specify which tool to use by setting the `tool_choice` parameter.\n\nThe two categories of tools you can provide the model are:\n\n- **Built-in tools**: Tools that are provided by OpenAI that extend the\n  model's capabilities, like [web search](https://platform.openai.com/docs/guides/tools-web-search)\n  or [file search](https://platform.openai.com/docs/guides/tools-file-search). Learn more about\n  [built-in tools](https://platform.openai.com/docs/guides/tools).\n- **Function calls (custom tools)**: Functions that are defined by you,\n  enabling the model to call your own code. Learn more about\n  [function calling](https://platform.openai.com/docs/guides/function-calling).\n"]
9191        #[serde(rename = "tools")]
9192        #[serde(skip_serializing_if = "Option::is_none")]
9193        #[builder(default)]
9194        pub tools: Option<Vec<crate::__types::Tool>>,
9195        #[doc = "Configuration options for a text response from the model. Can be plain\ntext or structured JSON data. Learn more:\n- [Text inputs and outputs](https://platform.openai.com/docs/guides/text)\n- [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs)\n"]
9196        #[serde(rename = "text")]
9197        #[serde(skip_serializing_if = "Option::is_none")]
9198        #[builder(default)]
9199        pub text:
9200            Option<crate::__types::create_eval_responses_run_data_source::sampling_params::Text>,
9201    }
9202    #[doc = "Determines what populates the `item` namespace in this run's data source."]
9203    #[derive(Clone, Debug, PartialEq)]
9204    #[serde_with::serde_as]
9205    #[derive(serde :: Deserialize, serde :: Serialize)]
9206    #[serde(untagged)]
9207    #[allow(clippy::large_enum_variant)]
9208    pub enum Source {
9209        FileContent(crate::__types::EvalJsonlFileContentSource),
9210        FileId(crate::__types::EvalJsonlFileIdSource),
9211        Responses(crate::__types::EvalResponsesSource),
9212    }
9213}
9214#[doc = "A ResponsesRunDataSource object describing a model sampling configuration.\n"]
9215#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
9216pub struct CreateEvalResponsesRunDataSource {
9217    #[doc = "Used when sampling from a model. Dictates the structure of the messages passed into the model. Can either be a reference to a prebuilt trajectory (ie, `item.input_trajectory`), or a template with variable references to the `item` namespace."]
9218    #[builder(default)]
9219    pub input_messages:
9220        Option<crate::__types::create_eval_responses_run_data_source::InputMessages>,
9221    #[builder(default)]
9222    pub sampling_params:
9223        Option<crate::__types::create_eval_responses_run_data_source::SamplingParams>,
9224    #[doc = "The name of the model to use for generating completions (e.g. \"o3-mini\")."]
9225    #[builder(default)]
9226    pub model: Option<String>,
9227    #[doc = "Determines what populates the `item` namespace in this run's data source."]
9228    pub source: crate::__types::create_eval_responses_run_data_source::Source,
9229}
9230impl<'de> serde::Deserialize<'de> for CreateEvalResponsesRunDataSource {
9231    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
9232    where
9233        D: serde::Deserializer<'de>,
9234    {
9235        #[serde_with::serde_as]
9236        #[derive(serde :: Deserialize)]
9237        struct CreateEvalResponsesRunDataSource {
9238            #[serde(rename = "type")]
9239            #[allow(dead_code)]
9240            r#type: crate::__types::create_eval_responses_run_data_source::Type,
9241            #[serde(rename = "input_messages")]
9242            input_messages:
9243                Option<crate::__types::create_eval_responses_run_data_source::InputMessages>,
9244            #[serde(rename = "sampling_params")]
9245            sampling_params:
9246                Option<crate::__types::create_eval_responses_run_data_source::SamplingParams>,
9247            #[serde(rename = "model")]
9248            model: Option<String>,
9249            #[serde(rename = "source")]
9250            source: crate::__types::create_eval_responses_run_data_source::Source,
9251        }
9252        let CreateEvalResponsesRunDataSource {
9253            input_messages,
9254            sampling_params,
9255            model,
9256            source,
9257            ..
9258        } = CreateEvalResponsesRunDataSource::deserialize(deserializer)?;
9259        Ok(Self {
9260            input_messages,
9261            sampling_params,
9262            model,
9263            source,
9264        })
9265    }
9266}
9267impl serde::Serialize for CreateEvalResponsesRunDataSource {
9268    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
9269    where
9270        S: serde::Serializer,
9271    {
9272        #[serde_with::serde_as]
9273        #[derive(serde :: Serialize)]
9274        struct CreateEvalResponsesRunDataSource<'a> {
9275            #[serde(rename = "type")]
9276            r#type: &'a crate::__types::create_eval_responses_run_data_source::Type,
9277            #[serde(rename = "input_messages")]
9278            #[serde(skip_serializing_if = "Option::is_none")]
9279            input_messages:
9280                &'a Option<crate::__types::create_eval_responses_run_data_source::InputMessages>,
9281            #[serde(rename = "sampling_params")]
9282            #[serde(skip_serializing_if = "Option::is_none")]
9283            sampling_params:
9284                &'a Option<crate::__types::create_eval_responses_run_data_source::SamplingParams>,
9285            #[serde(rename = "model")]
9286            #[serde(skip_serializing_if = "Option::is_none")]
9287            model: &'a Option<String>,
9288            #[serde(rename = "source")]
9289            source: &'a crate::__types::create_eval_responses_run_data_source::Source,
9290        }
9291        let Self {
9292            input_messages,
9293            sampling_params,
9294            model,
9295            source,
9296        } = self;
9297        CreateEvalResponsesRunDataSource {
9298            r#type: &Default::default(),
9299            input_messages,
9300            sampling_params,
9301            model,
9302            source,
9303        }
9304        .serialize(serializer)
9305    }
9306}
9307#[allow(clippy::module_inception)]
9308pub mod create_eval_run_request {
9309    #[doc = "Details about the run's data source."]
9310    #[derive(Clone, Debug, PartialEq)]
9311    #[serde_with::serde_as]
9312    #[derive(serde :: Deserialize, serde :: Serialize)]
9313    #[serde(untagged)]
9314    #[allow(clippy::large_enum_variant)]
9315    pub enum DataSource {
9316        Jsonl(crate::__types::CreateEvalJsonlRunDataSource),
9317        Completions(crate::__types::CreateEvalCompletionsRunDataSource),
9318        Responses(crate::__types::CreateEvalResponsesRunDataSource),
9319    }
9320}
9321#[derive(Clone, Debug, PartialEq)]
9322#[serde_with::serde_as]
9323#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
9324pub struct CreateEvalRunRequest {
9325    #[doc = "The name of the run."]
9326    #[serde(rename = "name")]
9327    #[serde(skip_serializing_if = "Option::is_none")]
9328    #[builder(default)]
9329    pub name: Option<String>,
9330    #[serde(rename = "metadata")]
9331    #[serde(skip_serializing_if = "Option::is_none")]
9332    #[builder(default)]
9333    pub metadata: Option<crate::__types::Metadata>,
9334    #[doc = "Details about the run's data source."]
9335    #[serde(rename = "data_source")]
9336    pub data_source: crate::__types::create_eval_run_request::DataSource,
9337}
9338#[allow(clippy::module_inception)]
9339pub(crate) mod create_eval_stored_completions_data_source_config {
9340    #[doc = "The type of data source. Always `stored_completions`."]
9341    #[derive(Clone, Copy, Debug, Default, PartialEq)]
9342    pub(crate) struct Type;
9343    impl_serde!(Type, "stored_completions");
9344}
9345#[doc = "Deprecated in favor of LogsDataSourceConfig.\n"]
9346#[derive(Clone, Debug, Default, PartialEq, typed_builder :: TypedBuilder)]
9347pub struct CreateEvalStoredCompletionsDataSourceConfig {
9348    #[doc = "Metadata filters for the stored completions data source."]
9349    #[builder(default)]
9350    pub metadata: Option<indexmap::IndexMap<String, serde_json::Value>>,
9351}
9352impl<'de> serde::Deserialize<'de> for CreateEvalStoredCompletionsDataSourceConfig {
9353    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
9354    where
9355        D: serde::Deserializer<'de>,
9356    {
9357        #[serde_with::serde_as]
9358        #[derive(serde :: Deserialize)]
9359        struct CreateEvalStoredCompletionsDataSourceConfig {
9360            #[serde(rename = "type")]
9361            #[allow(dead_code)]
9362            r#type: crate::__types::create_eval_stored_completions_data_source_config::Type,
9363            #[serde(rename = "metadata")]
9364            metadata: Option<indexmap::IndexMap<String, serde_json::Value>>,
9365        }
9366        let CreateEvalStoredCompletionsDataSourceConfig { metadata, .. } =
9367            CreateEvalStoredCompletionsDataSourceConfig::deserialize(deserializer)?;
9368        Ok(Self { metadata })
9369    }
9370}
9371impl serde::Serialize for CreateEvalStoredCompletionsDataSourceConfig {
9372    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
9373    where
9374        S: serde::Serializer,
9375    {
9376        #[serde_with::serde_as]
9377        #[derive(serde :: Serialize)]
9378        struct CreateEvalStoredCompletionsDataSourceConfig<'a> {
9379            #[serde(rename = "type")]
9380            r#type: &'a crate::__types::create_eval_stored_completions_data_source_config::Type,
9381            #[serde(rename = "metadata")]
9382            #[serde(skip_serializing_if = "Option::is_none")]
9383            metadata: &'a Option<indexmap::IndexMap<String, serde_json::Value>>,
9384        }
9385        let Self { metadata } = self;
9386        CreateEvalStoredCompletionsDataSourceConfig {
9387            r#type: &Default::default(),
9388            metadata,
9389        }
9390        .serialize(serializer)
9391    }
9392}
9393#[derive(Clone, Debug, PartialEq)]
9394#[serde_with::serde_as]
9395#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
9396pub struct CreateFileRequest {
9397    #[doc = "The File object (not file name) to be uploaded.\n"]
9398    #[serde_as(as = "serde_with::base64::Base64")]
9399    #[serde(rename = "file")]
9400    pub file: Vec<u8>,
9401    #[serde(rename = "purpose")]
9402    pub purpose: crate::__types::FilePurpose,
9403    #[serde(rename = "expires_after")]
9404    #[serde(skip_serializing_if = "Option::is_none")]
9405    #[builder(default)]
9406    pub expires_after: Option<crate::__types::FileExpirationAfter>,
9407}
9408#[derive(Clone, Debug, PartialEq)]
9409#[serde_with::serde_as]
9410#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
9411pub struct CreateFineTuningCheckpointPermissionRequest {
9412    #[doc = "The project identifiers to grant access to."]
9413    #[serde(rename = "project_ids")]
9414    pub project_ids: Vec<String>,
9415}
9416#[allow(clippy::module_inception)]
9417pub mod create_fine_tuning_job_request {
9418    #[allow(clippy::module_inception)]
9419    pub(crate) mod model {
9420        #[doc = "babbage-002"]
9421        #[derive(Clone, Copy, Debug, Default, PartialEq)]
9422        pub(crate) struct Babbage002;
9423        impl_serde!(Babbage002, "babbage-002");
9424        #[doc = "davinci-002"]
9425        #[derive(Clone, Copy, Debug, Default, PartialEq)]
9426        pub(crate) struct Davinci002;
9427        impl_serde!(Davinci002, "davinci-002");
9428        #[doc = "gpt-3.5-turbo"]
9429        #[derive(Clone, Copy, Debug, Default, PartialEq)]
9430        pub(crate) struct Gpt3_5Turbo;
9431        impl_serde!(Gpt3_5Turbo, "gpt-3.5-turbo");
9432        #[doc = "gpt-4o-mini"]
9433        #[derive(Clone, Copy, Debug, Default, PartialEq)]
9434        pub(crate) struct Gpt4oMini;
9435        impl_serde!(Gpt4oMini, "gpt-4o-mini");
9436    }
9437    #[doc = "The name of the model to fine-tune. You can select one of the\n[supported models](https://platform.openai.com/docs/guides/fine-tuning#which-models-can-be-fine-tuned).\n"]
9438    #[derive(Clone, Debug, PartialEq)]
9439    #[allow(clippy::large_enum_variant)]
9440    pub enum Model {
9441        Other(String),
9442        #[doc = "babbage-002"]
9443        Babbage002,
9444        #[doc = "davinci-002"]
9445        Davinci002,
9446        #[doc = "gpt-3.5-turbo"]
9447        Gpt3_5Turbo,
9448        #[doc = "gpt-4o-mini"]
9449        Gpt4oMini,
9450    }
9451    impl<'de> serde::Deserialize<'de> for Model {
9452        fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
9453        where
9454            D: serde::Deserializer<'de>,
9455        {
9456            #[serde_with::serde_as]
9457            #[derive(serde :: Deserialize)]
9458            #[serde(untagged)]
9459            #[allow(clippy::enum_variant_names, clippy::large_enum_variant)]
9460            enum Model {
9461                Babbage002(crate::__types::create_fine_tuning_job_request::model::Babbage002),
9462                Davinci002(crate::__types::create_fine_tuning_job_request::model::Davinci002),
9463                Gpt3_5Turbo(crate::__types::create_fine_tuning_job_request::model::Gpt3_5Turbo),
9464                Gpt4oMini(crate::__types::create_fine_tuning_job_request::model::Gpt4oMini),
9465                Other(String),
9466            }
9467            Ok(match Model::deserialize(deserializer)? {
9468                Model::Other(v) => Self::Other(v),
9469                Model::Babbage002(_) => Self::Babbage002,
9470                Model::Davinci002(_) => Self::Davinci002,
9471                Model::Gpt3_5Turbo(_) => Self::Gpt3_5Turbo,
9472                Model::Gpt4oMini(_) => Self::Gpt4oMini,
9473            })
9474        }
9475    }
9476    impl serde::Serialize for Model {
9477        fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
9478        where
9479            S: serde::Serializer,
9480        {
9481            #[serde_with::serde_as]
9482            #[derive(serde :: Serialize)]
9483            #[serde(untagged)]
9484            #[allow(clippy::enum_variant_names)]
9485            enum Model<'a> {
9486                Other(&'a String),
9487                Babbage002(crate::__types::create_fine_tuning_job_request::model::Babbage002),
9488                Davinci002(crate::__types::create_fine_tuning_job_request::model::Davinci002),
9489                Gpt3_5Turbo(crate::__types::create_fine_tuning_job_request::model::Gpt3_5Turbo),
9490                Gpt4oMini(crate::__types::create_fine_tuning_job_request::model::Gpt4oMini),
9491            }
9492            match self {
9493                Self::Other(v) => Model::Other(v),
9494                Self::Babbage002 => Model::Babbage002(Default::default()),
9495                Self::Davinci002 => Model::Davinci002(Default::default()),
9496                Self::Gpt3_5Turbo => Model::Gpt3_5Turbo(Default::default()),
9497                Self::Gpt4oMini => Model::Gpt4oMini(Default::default()),
9498            }
9499            .serialize(serializer)
9500        }
9501    }
9502    #[allow(clippy::module_inception)]
9503    pub mod hyperparameters {
9504        #[allow(clippy::module_inception)]
9505        pub(crate) mod batch_size {
9506            #[doc = "auto"]
9507            #[derive(Clone, Copy, Debug, Default, PartialEq)]
9508            pub(crate) struct Auto;
9509            impl_serde!(Auto, "auto");
9510        }
9511        #[doc = "Number of examples in each batch. A larger batch size means that model parameters\nare updated less frequently, but with lower variance.\n"]
9512        #[derive(Clone, Copy, Debug, PartialEq)]
9513        #[allow(clippy::large_enum_variant)]
9514        pub enum BatchSize {
9515            #[doc = "auto"]
9516            Auto,
9517            Integer(i64),
9518        }
9519        impl<'de> serde::Deserialize<'de> for BatchSize {
9520            fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
9521            where
9522                D: serde::Deserializer<'de>,
9523            {
9524                #[serde_with::serde_as]
9525                #[derive(serde :: Deserialize)]
9526                #[serde(untagged)]
9527                #[allow(clippy::enum_variant_names, clippy::large_enum_variant)]
9528                enum BatchSize {
9529                    Auto (crate :: __types :: create_fine_tuning_job_request :: hyperparameters :: batch_size :: Auto) , Integer (i64) }
9530                Ok(match BatchSize::deserialize(deserializer)? {
9531                    BatchSize::Auto(_) => Self::Auto,
9532                    BatchSize::Integer(v) => Self::Integer(v),
9533                })
9534            }
9535        }
9536        impl serde::Serialize for BatchSize {
9537            fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
9538            where
9539                S: serde::Serializer,
9540            {
9541                #[serde_with::serde_as]
9542                #[derive(serde :: Serialize)]
9543                #[serde(untagged)]
9544                #[allow(clippy::enum_variant_names)]
9545                enum BatchSize<'a> {
9546                    Auto (crate :: __types :: create_fine_tuning_job_request :: hyperparameters :: batch_size :: Auto) , Integer (& 'a i64) }
9547                match self {
9548                    Self::Auto => BatchSize::Auto(Default::default()),
9549                    Self::Integer(v) => BatchSize::Integer(v),
9550                }
9551                .serialize(serializer)
9552            }
9553        }
9554        #[allow(clippy::module_inception)]
9555        pub(crate) mod learning_rate_multiplier {
9556            #[doc = "auto"]
9557            #[derive(Clone, Copy, Debug, Default, PartialEq)]
9558            pub(crate) struct Auto;
9559            impl_serde!(Auto, "auto");
9560        }
9561        #[doc = "Scaling factor for the learning rate. A smaller learning rate may be useful to avoid\noverfitting.\n"]
9562        #[derive(Clone, Debug, PartialEq)]
9563        #[allow(clippy::large_enum_variant)]
9564        pub enum LearningRateMultiplier {
9565            #[doc = "auto"]
9566            Auto,
9567            Number(serde_json::Number),
9568        }
9569        impl<'de> serde::Deserialize<'de> for LearningRateMultiplier {
9570            fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
9571            where
9572                D: serde::Deserializer<'de>,
9573            {
9574                #[serde_with::serde_as]
9575                #[derive(serde :: Deserialize)]
9576                #[serde(untagged)]
9577                #[allow(clippy::enum_variant_names, clippy::large_enum_variant)]
9578                enum LearningRateMultiplier {
9579                    Auto (crate :: __types :: create_fine_tuning_job_request :: hyperparameters :: learning_rate_multiplier :: Auto) , Number (serde_json :: Number) }
9580                Ok(match LearningRateMultiplier::deserialize(deserializer)? {
9581                    LearningRateMultiplier::Auto(_) => Self::Auto,
9582                    LearningRateMultiplier::Number(v) => Self::Number(v),
9583                })
9584            }
9585        }
9586        impl serde::Serialize for LearningRateMultiplier {
9587            fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
9588            where
9589                S: serde::Serializer,
9590            {
9591                #[serde_with::serde_as]
9592                #[derive(serde :: Serialize)]
9593                #[serde(untagged)]
9594                #[allow(clippy::enum_variant_names)]
9595                enum LearningRateMultiplier<'a> {
9596                    Auto (crate :: __types :: create_fine_tuning_job_request :: hyperparameters :: learning_rate_multiplier :: Auto) , Number (& 'a serde_json :: Number) }
9597                match self {
9598                    Self::Auto => LearningRateMultiplier::Auto(Default::default()),
9599                    Self::Number(v) => LearningRateMultiplier::Number(v),
9600                }
9601                .serialize(serializer)
9602            }
9603        }
9604        #[allow(clippy::module_inception)]
9605        pub(crate) mod n_epochs {
9606            #[doc = "auto"]
9607            #[derive(Clone, Copy, Debug, Default, PartialEq)]
9608            pub(crate) struct Auto;
9609            impl_serde!(Auto, "auto");
9610        }
9611        #[doc = "The number of epochs to train the model for. An epoch refers to one full cycle\nthrough the training dataset.\n"]
9612        #[derive(Clone, Copy, Debug, PartialEq)]
9613        #[allow(clippy::large_enum_variant)]
9614        pub enum NEpochs {
9615            #[doc = "auto"]
9616            Auto,
9617            Integer(i64),
9618        }
9619        impl<'de> serde::Deserialize<'de> for NEpochs {
9620            fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
9621            where
9622                D: serde::Deserializer<'de>,
9623            {
9624                #[serde_with::serde_as]
9625                #[derive(serde :: Deserialize)]
9626                #[serde(untagged)]
9627                #[allow(clippy::enum_variant_names, clippy::large_enum_variant)]
9628                enum NEpochs {
9629                    Auto (crate :: __types :: create_fine_tuning_job_request :: hyperparameters :: n_epochs :: Auto) , Integer (i64) }
9630                Ok(match NEpochs::deserialize(deserializer)? {
9631                    NEpochs::Auto(_) => Self::Auto,
9632                    NEpochs::Integer(v) => Self::Integer(v),
9633                })
9634            }
9635        }
9636        impl serde::Serialize for NEpochs {
9637            fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
9638            where
9639                S: serde::Serializer,
9640            {
9641                #[serde_with::serde_as]
9642                #[derive(serde :: Serialize)]
9643                #[serde(untagged)]
9644                #[allow(clippy::enum_variant_names)]
9645                enum NEpochs<'a> {
9646                    Auto (crate :: __types :: create_fine_tuning_job_request :: hyperparameters :: n_epochs :: Auto) , Integer (& 'a i64) }
9647                match self {
9648                    Self::Auto => NEpochs::Auto(Default::default()),
9649                    Self::Integer(v) => NEpochs::Integer(v),
9650                }
9651                .serialize(serializer)
9652            }
9653        }
9654    }
9655    #[doc = "The hyperparameters used for the fine-tuning job.\nThis value is now deprecated in favor of `method`, and should be passed in under the `method` parameter.\n"]
9656    #[derive(Clone, Debug, Default, PartialEq)]
9657    #[serde_with::serde_as]
9658    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
9659    pub struct Hyperparameters {
9660        #[doc = "Number of examples in each batch. A larger batch size means that model parameters\nare updated less frequently, but with lower variance.\n"]
9661        #[serde(rename = "batch_size")]
9662        #[serde(skip_serializing_if = "Option::is_none")]
9663        #[builder(default)]
9664        pub batch_size:
9665            Option<crate::__types::create_fine_tuning_job_request::hyperparameters::BatchSize>,
9666        #[doc = "Scaling factor for the learning rate. A smaller learning rate may be useful to avoid\noverfitting.\n"]
9667        #[serde(rename = "learning_rate_multiplier")]
9668        #[serde(skip_serializing_if = "Option::is_none")]
9669        #[builder(default)]
9670        pub learning_rate_multiplier: Option<
9671            crate::__types::create_fine_tuning_job_request::hyperparameters::LearningRateMultiplier,
9672        >,
9673        #[doc = "The number of epochs to train the model for. An epoch refers to one full cycle\nthrough the training dataset.\n"]
9674        #[serde(rename = "n_epochs")]
9675        #[serde(skip_serializing_if = "Option::is_none")]
9676        #[builder(default)]
9677        pub n_epochs:
9678            Option<crate::__types::create_fine_tuning_job_request::hyperparameters::NEpochs>,
9679    }
9680    #[allow(clippy::module_inception)]
9681    pub mod integrations {
9682        #[allow(clippy::module_inception)]
9683        pub mod item {
9684            #[doc = "The type of integration to enable. Currently, only \"wandb\" (Weights and Biases) is supported.\n"]
9685            #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
9686            pub enum Type {
9687                #[doc = "`wandb`"]
9688                #[serde(rename = "wandb")]
9689                Wandb,
9690            }
9691            #[doc = "The settings for your integration with Weights and Biases. This payload specifies the project that\nmetrics will be sent to. Optionally, you can set an explicit display name for your run, add tags\nto your run, and set a default entity (team, username, etc) to be associated with your run.\n"]
9692            #[derive(Clone, Debug, PartialEq)]
9693            #[serde_with::serde_as]
9694            #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
9695            pub struct Wandb {
9696                #[doc = "The name of the project that the new run will be created under.\n"]
9697                #[serde(rename = "project")]
9698                pub project: String,
9699                #[doc = "A display name to set for the run. If not set, we will use the Job ID as the name.\n"]
9700                #[serde(rename = "name")]
9701                #[serde(skip_serializing_if = "Option::is_none")]
9702                #[builder(default)]
9703                pub name: Option<String>,
9704                #[doc = "The entity to use for the run. This allows you to set the team or username of the WandB user that you would\nlike associated with the run. If not set, the default entity for the registered WandB API key is used.\n"]
9705                #[serde(rename = "entity")]
9706                #[serde(skip_serializing_if = "Option::is_none")]
9707                #[builder(default)]
9708                pub entity: Option<String>,
9709                #[doc = "A list of tags to be attached to the newly created run. These tags are passed through directly to WandB. Some\ndefault tags are generated by OpenAI: \"openai/finetune\", \"openai/{base-model}\", \"openai/{ftjob-abcdef}\".\n"]
9710                #[serde(rename = "tags")]
9711                #[serde(skip_serializing_if = "Option::is_none")]
9712                #[builder(default)]
9713                pub tags: Option<Vec<String>>,
9714            }
9715        }
9716        #[derive(Clone, Debug, PartialEq)]
9717        #[serde_with::serde_as]
9718        #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
9719        pub struct Item {
9720            #[doc = "The type of integration to enable. Currently, only \"wandb\" (Weights and Biases) is supported.\n"]
9721            #[serde(rename = "type")]
9722            pub r#type: crate::__types::create_fine_tuning_job_request::integrations::item::Type,
9723            #[doc = "The settings for your integration with Weights and Biases. This payload specifies the project that\nmetrics will be sent to. Optionally, you can set an explicit display name for your run, add tags\nto your run, and set a default entity (team, username, etc) to be associated with your run.\n"]
9724            #[serde(rename = "wandb")]
9725            pub wandb: crate::__types::create_fine_tuning_job_request::integrations::item::Wandb,
9726        }
9727    }
9728}
9729#[derive(Clone, Debug, PartialEq)]
9730#[serde_with::serde_as]
9731#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
9732pub struct CreateFineTuningJobRequest {
9733    #[doc = "The name of the model to fine-tune. You can select one of the\n[supported models](https://platform.openai.com/docs/guides/fine-tuning#which-models-can-be-fine-tuned).\n"]
9734    #[serde(rename = "model")]
9735    pub model: crate::__types::create_fine_tuning_job_request::Model,
9736    #[doc = "The ID of an uploaded file that contains training data.\n\nSee [upload file](https://platform.openai.com/docs/api-reference/files/create) for how to upload a file.\n\nYour dataset must be formatted as a JSONL file. Additionally, you must upload your file with the purpose `fine-tune`.\n\nThe contents of the file should differ depending on if the model uses the [chat](https://platform.openai.com/docs/api-reference/fine-tuning/chat-input), [completions](https://platform.openai.com/docs/api-reference/fine-tuning/completions-input) format, or if the fine-tuning method uses the [preference](https://platform.openai.com/docs/api-reference/fine-tuning/preference-input) format.\n\nSee the [fine-tuning guide](https://platform.openai.com/docs/guides/model-optimization) for more details.\n"]
9737    #[serde(rename = "training_file")]
9738    pub training_file: String,
9739    #[doc = "The hyperparameters used for the fine-tuning job.\nThis value is now deprecated in favor of `method`, and should be passed in under the `method` parameter.\n"]
9740    #[serde(rename = "hyperparameters")]
9741    #[serde(skip_serializing_if = "Option::is_none")]
9742    #[builder(default)]
9743    pub hyperparameters: Option<crate::__types::create_fine_tuning_job_request::Hyperparameters>,
9744    #[doc = "A string of up to 64 characters that will be added to your fine-tuned model name.\n\nFor example, a `suffix` of \"custom-model-name\" would produce a model name like `ft:gpt-4o-mini:openai:custom-model-name:7p4lURel`.\n"]
9745    #[serde(rename = "suffix")]
9746    #[serde(skip_serializing_if = "Option::is_none")]
9747    #[builder(default)]
9748    pub suffix: Option<String>,
9749    #[doc = "The ID of an uploaded file that contains validation data.\n\nIf you provide this file, the data is used to generate validation\nmetrics periodically during fine-tuning. These metrics can be viewed in\nthe fine-tuning results file.\nThe same data should not be present in both train and validation files.\n\nYour dataset must be formatted as a JSONL file. You must upload your file with the purpose `fine-tune`.\n\nSee the [fine-tuning guide](https://platform.openai.com/docs/guides/model-optimization) for more details.\n"]
9750    #[serde(rename = "validation_file")]
9751    #[serde(skip_serializing_if = "Option::is_none")]
9752    #[builder(default)]
9753    pub validation_file: Option<String>,
9754    #[doc = "A list of integrations to enable for your fine-tuning job."]
9755    #[serde(rename = "integrations")]
9756    #[serde(skip_serializing_if = "Option::is_none")]
9757    #[builder(default)]
9758    pub integrations:
9759        Option<Vec<crate::__types::create_fine_tuning_job_request::integrations::Item>>,
9760    #[doc = "The seed controls the reproducibility of the job. Passing in the same seed and job parameters should produce the same results, but may differ in rare cases.\nIf a seed is not specified, one will be generated for you.\n"]
9761    #[serde(rename = "seed")]
9762    #[serde(skip_serializing_if = "Option::is_none")]
9763    #[builder(default)]
9764    pub seed: Option<i64>,
9765    #[serde(rename = "method")]
9766    #[serde(skip_serializing_if = "Option::is_none")]
9767    #[builder(default)]
9768    pub method: Option<crate::__types::FineTuneMethod>,
9769    #[serde(rename = "metadata")]
9770    #[serde(skip_serializing_if = "Option::is_none")]
9771    #[builder(default)]
9772    pub metadata: Option<crate::__types::Metadata>,
9773}
9774#[allow(clippy::module_inception)]
9775pub mod create_image_edit_request {
9776    #[doc = "The image(s) to edit. Must be a supported image file or an array of images.\n\nFor `gpt-image-1`, each image should be a `png`, `webp`, or `jpg` file less \nthan 50MB. You can provide up to 16 images.\n\nFor `dall-e-2`, you can only provide one image, and it should be a square \n`png` file less than 4MB.\n"]
9777    #[derive(Clone, Debug, PartialEq)]
9778    #[serde_with::serde_as]
9779    #[derive(serde :: Deserialize, serde :: Serialize)]
9780    #[serde(untagged)]
9781    #[allow(clippy::large_enum_variant)]
9782    pub enum Image {
9783        Bytes(#[serde_as(as = "serde_with::base64::Base64")] Vec<u8>),
9784        Array(#[serde_as(as = "Vec<serde_with::base64::Base64>")] Vec<Vec<u8>>),
9785    }
9786    #[doc = "Allows to set transparency for the background of the generated image(s). \nThis parameter is only supported for `gpt-image-1`. Must be one of \n`transparent`, `opaque` or `auto` (default value). When `auto` is used, the \nmodel will automatically determine the best background for the image.\n\nIf `transparent`, the output format needs to support transparency, so it \nshould be set to either `png` (default value) or `webp`.\n"]
9787    #[derive(Clone, Copy, Debug, Default, PartialEq, serde :: Deserialize, serde :: Serialize)]
9788    pub enum Background {
9789        #[doc = "`transparent`"]
9790        #[serde(rename = "transparent")]
9791        Transparent,
9792        #[doc = "`opaque`"]
9793        #[serde(rename = "opaque")]
9794        Opaque,
9795        #[doc = "`auto`"]
9796        #[default]
9797        #[serde(rename = "auto")]
9798        Auto,
9799    }
9800    #[allow(clippy::module_inception)]
9801    pub(crate) mod model {
9802        #[doc = "dall-e-2"]
9803        #[derive(Clone, Copy, Debug, Default, PartialEq)]
9804        pub(crate) struct DallE2;
9805        impl_serde!(DallE2, "dall-e-2");
9806        #[doc = "gpt-image-1"]
9807        #[derive(Clone, Copy, Debug, Default, PartialEq)]
9808        pub(crate) struct GptImage1;
9809        impl_serde!(GptImage1, "gpt-image-1");
9810    }
9811    #[doc = "The model to use for image generation. Only `dall-e-2` and `gpt-image-1` are supported. Defaults to `dall-e-2` unless a parameter specific to `gpt-image-1` is used."]
9812    #[derive(Clone, Debug, PartialEq)]
9813    #[allow(clippy::large_enum_variant)]
9814    pub enum Model {
9815        Other(String),
9816        #[doc = "dall-e-2"]
9817        DallE2,
9818        #[doc = "gpt-image-1"]
9819        GptImage1,
9820    }
9821    impl<'de> serde::Deserialize<'de> for Model {
9822        fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
9823        where
9824            D: serde::Deserializer<'de>,
9825        {
9826            #[serde_with::serde_as]
9827            #[derive(serde :: Deserialize)]
9828            #[serde(untagged)]
9829            #[allow(clippy::enum_variant_names, clippy::large_enum_variant)]
9830            enum Model {
9831                DallE2(crate::__types::create_image_edit_request::model::DallE2),
9832                GptImage1(crate::__types::create_image_edit_request::model::GptImage1),
9833                Other(String),
9834            }
9835            Ok(match Model::deserialize(deserializer)? {
9836                Model::Other(v) => Self::Other(v),
9837                Model::DallE2(_) => Self::DallE2,
9838                Model::GptImage1(_) => Self::GptImage1,
9839            })
9840        }
9841    }
9842    impl serde::Serialize for Model {
9843        fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
9844        where
9845            S: serde::Serializer,
9846        {
9847            #[serde_with::serde_as]
9848            #[derive(serde :: Serialize)]
9849            #[serde(untagged)]
9850            #[allow(clippy::enum_variant_names)]
9851            enum Model<'a> {
9852                Other(&'a String),
9853                DallE2(crate::__types::create_image_edit_request::model::DallE2),
9854                GptImage1(crate::__types::create_image_edit_request::model::GptImage1),
9855            }
9856            match self {
9857                Self::Other(v) => Model::Other(v),
9858                Self::DallE2 => Model::DallE2(Default::default()),
9859                Self::GptImage1 => Model::GptImage1(Default::default()),
9860            }
9861            .serialize(serializer)
9862        }
9863    }
9864    #[doc = "The size of the generated images. Must be one of `1024x1024`, `1536x1024` (landscape), `1024x1536` (portrait), or `auto` (default value) for `gpt-image-1`, and one of `256x256`, `512x512`, or `1024x1024` for `dall-e-2`."]
9865    #[derive(Clone, Copy, Debug, Default, PartialEq, serde :: Deserialize, serde :: Serialize)]
9866    pub enum Size {
9867        #[doc = "`256x256`"]
9868        #[serde(rename = "256x256")]
9869        _256x256,
9870        #[doc = "`512x512`"]
9871        #[serde(rename = "512x512")]
9872        _512x512,
9873        #[doc = "`1024x1024`"]
9874        #[default]
9875        #[serde(rename = "1024x1024")]
9876        _1024x1024,
9877        #[doc = "`1536x1024`"]
9878        #[serde(rename = "1536x1024")]
9879        _1536x1024,
9880        #[doc = "`1024x1536`"]
9881        #[serde(rename = "1024x1536")]
9882        _1024x1536,
9883        #[doc = "`auto`"]
9884        #[serde(rename = "auto")]
9885        Auto,
9886    }
9887    #[doc = "The format in which the generated images are returned. Must be one of `url` or `b64_json`. URLs are only valid for 60 minutes after the image has been generated. This parameter is only supported for `dall-e-2`, as `gpt-image-1` will always return base64-encoded images."]
9888    #[derive(Clone, Copy, Debug, Default, PartialEq, serde :: Deserialize, serde :: Serialize)]
9889    pub enum ResponseFormat {
9890        #[doc = "`url`"]
9891        #[default]
9892        #[serde(rename = "url")]
9893        Url,
9894        #[doc = "`b64_json`"]
9895        #[serde(rename = "b64_json")]
9896        B64Json,
9897    }
9898    #[doc = "The format in which the generated images are returned. This parameter is\nonly supported for `gpt-image-1`. Must be one of `png`, `jpeg`, or `webp`.\nThe default value is `png`.\n"]
9899    #[derive(Clone, Copy, Debug, Default, PartialEq, serde :: Deserialize, serde :: Serialize)]
9900    pub enum OutputFormat {
9901        #[doc = "`png`"]
9902        #[default]
9903        #[serde(rename = "png")]
9904        Png,
9905        #[doc = "`jpeg`"]
9906        #[serde(rename = "jpeg")]
9907        Jpeg,
9908        #[doc = "`webp`"]
9909        #[serde(rename = "webp")]
9910        Webp,
9911    }
9912    #[doc = "The quality of the image that will be generated. `high`, `medium` and `low` are only supported for `gpt-image-1`. `dall-e-2` only supports `standard` quality. Defaults to `auto`.\n"]
9913    #[derive(Clone, Copy, Debug, Default, PartialEq, serde :: Deserialize, serde :: Serialize)]
9914    pub enum Quality {
9915        #[doc = "`standard`"]
9916        #[serde(rename = "standard")]
9917        Standard,
9918        #[doc = "`low`"]
9919        #[serde(rename = "low")]
9920        Low,
9921        #[doc = "`medium`"]
9922        #[serde(rename = "medium")]
9923        Medium,
9924        #[doc = "`high`"]
9925        #[serde(rename = "high")]
9926        High,
9927        #[doc = "`auto`"]
9928        #[default]
9929        #[serde(rename = "auto")]
9930        Auto,
9931    }
9932}
9933#[derive(Clone, Debug, PartialEq)]
9934#[serde_with::serde_as]
9935#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
9936pub struct CreateImageEditRequest {
9937    #[doc = "The image(s) to edit. Must be a supported image file or an array of images.\n\nFor `gpt-image-1`, each image should be a `png`, `webp`, or `jpg` file less \nthan 50MB. You can provide up to 16 images.\n\nFor `dall-e-2`, you can only provide one image, and it should be a square \n`png` file less than 4MB.\n"]
9938    #[serde(rename = "image")]
9939    pub image: crate::__types::create_image_edit_request::Image,
9940    #[doc = "A text description of the desired image(s). The maximum length is 1000 characters for `dall-e-2`, and 32000 characters for `gpt-image-1`."]
9941    #[serde(rename = "prompt")]
9942    pub prompt: String,
9943    #[doc = "An additional image whose fully transparent areas (e.g. where alpha is zero) indicate where `image` should be edited. If there are multiple images provided, the mask will be applied on the first image. Must be a valid PNG file, less than 4MB, and have the same dimensions as `image`."]
9944    #[serde_as(as = "Option<serde_with::base64::Base64>")]
9945    #[serde(rename = "mask")]
9946    #[serde(skip_serializing_if = "Option::is_none")]
9947    #[builder(default)]
9948    pub mask: Option<Vec<u8>>,
9949    #[doc = "Allows to set transparency for the background of the generated image(s). \nThis parameter is only supported for `gpt-image-1`. Must be one of \n`transparent`, `opaque` or `auto` (default value). When `auto` is used, the \nmodel will automatically determine the best background for the image.\n\nIf `transparent`, the output format needs to support transparency, so it \nshould be set to either `png` (default value) or `webp`.\n"]
9950    #[serde(rename = "background")]
9951    #[serde(skip_serializing_if = "Option::is_none")]
9952    #[builder(default)]
9953    pub background: Option<crate::__types::create_image_edit_request::Background>,
9954    #[doc = "The model to use for image generation. Only `dall-e-2` and `gpt-image-1` are supported. Defaults to `dall-e-2` unless a parameter specific to `gpt-image-1` is used."]
9955    #[serde(rename = "model")]
9956    #[serde(skip_serializing_if = "Option::is_none")]
9957    #[builder(default)]
9958    pub model: Option<crate::__types::create_image_edit_request::Model>,
9959    #[doc = "The number of images to generate. Must be between 1 and 10."]
9960    #[serde(rename = "n")]
9961    #[serde(skip_serializing_if = "Option::is_none")]
9962    #[builder(default)]
9963    pub n: Option<i64>,
9964    #[doc = "The size of the generated images. Must be one of `1024x1024`, `1536x1024` (landscape), `1024x1536` (portrait), or `auto` (default value) for `gpt-image-1`, and one of `256x256`, `512x512`, or `1024x1024` for `dall-e-2`."]
9965    #[serde(rename = "size")]
9966    #[serde(skip_serializing_if = "Option::is_none")]
9967    #[builder(default)]
9968    pub size: Option<crate::__types::create_image_edit_request::Size>,
9969    #[doc = "The format in which the generated images are returned. Must be one of `url` or `b64_json`. URLs are only valid for 60 minutes after the image has been generated. This parameter is only supported for `dall-e-2`, as `gpt-image-1` will always return base64-encoded images."]
9970    #[serde(rename = "response_format")]
9971    #[serde(skip_serializing_if = "Option::is_none")]
9972    #[builder(default)]
9973    pub response_format: Option<crate::__types::create_image_edit_request::ResponseFormat>,
9974    #[doc = "The format in which the generated images are returned. This parameter is\nonly supported for `gpt-image-1`. Must be one of `png`, `jpeg`, or `webp`.\nThe default value is `png`.\n"]
9975    #[serde(rename = "output_format")]
9976    #[serde(skip_serializing_if = "Option::is_none")]
9977    #[builder(default)]
9978    pub output_format: Option<crate::__types::create_image_edit_request::OutputFormat>,
9979    #[doc = "The compression level (0-100%) for the generated images. This parameter \nis only supported for `gpt-image-1` with the `webp` or `jpeg` output \nformats, and defaults to 100.\n"]
9980    #[serde(rename = "output_compression")]
9981    #[serde(skip_serializing_if = "Option::is_none")]
9982    #[builder(default)]
9983    pub output_compression: Option<i64>,
9984    #[doc = "A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#end-user-ids).\n"]
9985    #[serde(rename = "user")]
9986    #[serde(skip_serializing_if = "Option::is_none")]
9987    #[builder(default)]
9988    pub user: Option<String>,
9989    #[serde(rename = "input_fidelity")]
9990    #[serde(skip_serializing_if = "Option::is_none")]
9991    #[builder(default)]
9992    pub input_fidelity: Option<crate::__types::ImageInputFidelity>,
9993    #[doc = "Edit the image in streaming mode. Defaults to `false`. See the \n[Image generation guide](https://platform.openai.com/docs/guides/image-generation) for more information.\n"]
9994    #[serde(rename = "stream")]
9995    #[serde(skip_serializing_if = "Option::is_none")]
9996    #[builder(default)]
9997    pub stream: Option<bool>,
9998    #[serde(rename = "partial_images")]
9999    #[serde(skip_serializing_if = "Option::is_none")]
10000    #[builder(default)]
10001    pub partial_images: Option<crate::__types::PartialImages>,
10002    #[doc = "The quality of the image that will be generated. `high`, `medium` and `low` are only supported for `gpt-image-1`. `dall-e-2` only supports `standard` quality. Defaults to `auto`.\n"]
10003    #[serde(rename = "quality")]
10004    #[serde(skip_serializing_if = "Option::is_none")]
10005    #[builder(default)]
10006    pub quality: Option<crate::__types::create_image_edit_request::Quality>,
10007}
10008#[allow(clippy::module_inception)]
10009pub mod create_image_request {
10010    #[allow(clippy::module_inception)]
10011    pub(crate) mod model {
10012        #[doc = "dall-e-2"]
10013        #[derive(Clone, Copy, Debug, Default, PartialEq)]
10014        pub(crate) struct DallE2;
10015        impl_serde!(DallE2, "dall-e-2");
10016        #[doc = "dall-e-3"]
10017        #[derive(Clone, Copy, Debug, Default, PartialEq)]
10018        pub(crate) struct DallE3;
10019        impl_serde!(DallE3, "dall-e-3");
10020        #[doc = "gpt-image-1"]
10021        #[derive(Clone, Copy, Debug, Default, PartialEq)]
10022        pub(crate) struct GptImage1;
10023        impl_serde!(GptImage1, "gpt-image-1");
10024    }
10025    #[doc = "The model to use for image generation. One of `dall-e-2`, `dall-e-3`, or `gpt-image-1`. Defaults to `dall-e-2` unless a parameter specific to `gpt-image-1` is used."]
10026    #[derive(Clone, Debug, PartialEq)]
10027    #[allow(clippy::large_enum_variant)]
10028    pub enum Model {
10029        Other(String),
10030        #[doc = "dall-e-2"]
10031        DallE2,
10032        #[doc = "dall-e-3"]
10033        DallE3,
10034        #[doc = "gpt-image-1"]
10035        GptImage1,
10036    }
10037    impl<'de> serde::Deserialize<'de> for Model {
10038        fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
10039        where
10040            D: serde::Deserializer<'de>,
10041        {
10042            #[serde_with::serde_as]
10043            #[derive(serde :: Deserialize)]
10044            #[serde(untagged)]
10045            #[allow(clippy::enum_variant_names, clippy::large_enum_variant)]
10046            enum Model {
10047                DallE2(crate::__types::create_image_request::model::DallE2),
10048                DallE3(crate::__types::create_image_request::model::DallE3),
10049                GptImage1(crate::__types::create_image_request::model::GptImage1),
10050                Other(String),
10051            }
10052            Ok(match Model::deserialize(deserializer)? {
10053                Model::Other(v) => Self::Other(v),
10054                Model::DallE2(_) => Self::DallE2,
10055                Model::DallE3(_) => Self::DallE3,
10056                Model::GptImage1(_) => Self::GptImage1,
10057            })
10058        }
10059    }
10060    impl serde::Serialize for Model {
10061        fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
10062        where
10063            S: serde::Serializer,
10064        {
10065            #[serde_with::serde_as]
10066            #[derive(serde :: Serialize)]
10067            #[serde(untagged)]
10068            #[allow(clippy::enum_variant_names)]
10069            enum Model<'a> {
10070                Other(&'a String),
10071                DallE2(crate::__types::create_image_request::model::DallE2),
10072                DallE3(crate::__types::create_image_request::model::DallE3),
10073                GptImage1(crate::__types::create_image_request::model::GptImage1),
10074            }
10075            match self {
10076                Self::Other(v) => Model::Other(v),
10077                Self::DallE2 => Model::DallE2(Default::default()),
10078                Self::DallE3 => Model::DallE3(Default::default()),
10079                Self::GptImage1 => Model::GptImage1(Default::default()),
10080            }
10081            .serialize(serializer)
10082        }
10083    }
10084    #[doc = "The quality of the image that will be generated. \n\n- `auto` (default value) will automatically select the best quality for the given model.\n- `high`, `medium` and `low` are supported for `gpt-image-1`.\n- `hd` and `standard` are supported for `dall-e-3`.\n- `standard` is the only option for `dall-e-2`.\n"]
10085    #[derive(Clone, Copy, Debug, Default, PartialEq, serde :: Deserialize, serde :: Serialize)]
10086    pub enum Quality {
10087        #[doc = "`standard`"]
10088        #[serde(rename = "standard")]
10089        Standard,
10090        #[doc = "`hd`"]
10091        #[serde(rename = "hd")]
10092        Hd,
10093        #[doc = "`low`"]
10094        #[serde(rename = "low")]
10095        Low,
10096        #[doc = "`medium`"]
10097        #[serde(rename = "medium")]
10098        Medium,
10099        #[doc = "`high`"]
10100        #[serde(rename = "high")]
10101        High,
10102        #[doc = "`auto`"]
10103        #[default]
10104        #[serde(rename = "auto")]
10105        Auto,
10106    }
10107    #[doc = "The format in which generated images with `dall-e-2` and `dall-e-3` are returned. Must be one of `url` or `b64_json`. URLs are only valid for 60 minutes after the image has been generated. This parameter isn't supported for `gpt-image-1` which will always return base64-encoded images."]
10108    #[derive(Clone, Copy, Debug, Default, PartialEq, serde :: Deserialize, serde :: Serialize)]
10109    pub enum ResponseFormat {
10110        #[doc = "`url`"]
10111        #[default]
10112        #[serde(rename = "url")]
10113        Url,
10114        #[doc = "`b64_json`"]
10115        #[serde(rename = "b64_json")]
10116        B64Json,
10117    }
10118    #[doc = "The format in which the generated images are returned. This parameter is only supported for `gpt-image-1`. Must be one of `png`, `jpeg`, or `webp`."]
10119    #[derive(Clone, Copy, Debug, Default, PartialEq, serde :: Deserialize, serde :: Serialize)]
10120    pub enum OutputFormat {
10121        #[doc = "`png`"]
10122        #[default]
10123        #[serde(rename = "png")]
10124        Png,
10125        #[doc = "`jpeg`"]
10126        #[serde(rename = "jpeg")]
10127        Jpeg,
10128        #[doc = "`webp`"]
10129        #[serde(rename = "webp")]
10130        Webp,
10131    }
10132    #[doc = "The size of the generated images. Must be one of `1024x1024`, `1536x1024` (landscape), `1024x1536` (portrait), or `auto` (default value) for `gpt-image-1`, one of `256x256`, `512x512`, or `1024x1024` for `dall-e-2`, and one of `1024x1024`, `1792x1024`, or `1024x1792` for `dall-e-3`."]
10133    #[derive(Clone, Copy, Debug, Default, PartialEq, serde :: Deserialize, serde :: Serialize)]
10134    pub enum Size {
10135        #[doc = "`auto`"]
10136        #[default]
10137        #[serde(rename = "auto")]
10138        Auto,
10139        #[doc = "`1024x1024`"]
10140        #[serde(rename = "1024x1024")]
10141        _1024x1024,
10142        #[doc = "`1536x1024`"]
10143        #[serde(rename = "1536x1024")]
10144        _1536x1024,
10145        #[doc = "`1024x1536`"]
10146        #[serde(rename = "1024x1536")]
10147        _1024x1536,
10148        #[doc = "`256x256`"]
10149        #[serde(rename = "256x256")]
10150        _256x256,
10151        #[doc = "`512x512`"]
10152        #[serde(rename = "512x512")]
10153        _512x512,
10154        #[doc = "`1792x1024`"]
10155        #[serde(rename = "1792x1024")]
10156        _1792x1024,
10157        #[doc = "`1024x1792`"]
10158        #[serde(rename = "1024x1792")]
10159        _1024x1792,
10160    }
10161    #[doc = "Control the content-moderation level for images generated by `gpt-image-1`. Must be either `low` for less restrictive filtering or `auto` (default value)."]
10162    #[derive(Clone, Copy, Debug, Default, PartialEq, serde :: Deserialize, serde :: Serialize)]
10163    pub enum Moderation {
10164        #[doc = "`low`"]
10165        #[serde(rename = "low")]
10166        Low,
10167        #[doc = "`auto`"]
10168        #[default]
10169        #[serde(rename = "auto")]
10170        Auto,
10171    }
10172    #[doc = "Allows to set transparency for the background of the generated image(s). \nThis parameter is only supported for `gpt-image-1`. Must be one of \n`transparent`, `opaque` or `auto` (default value). When `auto` is used, the \nmodel will automatically determine the best background for the image.\n\nIf `transparent`, the output format needs to support transparency, so it \nshould be set to either `png` (default value) or `webp`.\n"]
10173    #[derive(Clone, Copy, Debug, Default, PartialEq, serde :: Deserialize, serde :: Serialize)]
10174    pub enum Background {
10175        #[doc = "`transparent`"]
10176        #[serde(rename = "transparent")]
10177        Transparent,
10178        #[doc = "`opaque`"]
10179        #[serde(rename = "opaque")]
10180        Opaque,
10181        #[doc = "`auto`"]
10182        #[default]
10183        #[serde(rename = "auto")]
10184        Auto,
10185    }
10186    #[doc = "The style of the generated images. This parameter is only supported for `dall-e-3`. Must be one of `vivid` or `natural`. Vivid causes the model to lean towards generating hyper-real and dramatic images. Natural causes the model to produce more natural, less hyper-real looking images."]
10187    #[derive(Clone, Copy, Debug, Default, PartialEq, serde :: Deserialize, serde :: Serialize)]
10188    pub enum Style {
10189        #[doc = "`vivid`"]
10190        #[default]
10191        #[serde(rename = "vivid")]
10192        Vivid,
10193        #[doc = "`natural`"]
10194        #[serde(rename = "natural")]
10195        Natural,
10196    }
10197}
10198#[derive(Clone, Debug, PartialEq)]
10199#[serde_with::serde_as]
10200#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
10201pub struct CreateImageRequest {
10202    #[doc = "A text description of the desired image(s). The maximum length is 32000 characters for `gpt-image-1`, 1000 characters for `dall-e-2` and 4000 characters for `dall-e-3`."]
10203    #[serde(rename = "prompt")]
10204    pub prompt: String,
10205    #[doc = "The model to use for image generation. One of `dall-e-2`, `dall-e-3`, or `gpt-image-1`. Defaults to `dall-e-2` unless a parameter specific to `gpt-image-1` is used."]
10206    #[serde(rename = "model")]
10207    #[serde(skip_serializing_if = "Option::is_none")]
10208    #[builder(default)]
10209    pub model: Option<crate::__types::create_image_request::Model>,
10210    #[doc = "The number of images to generate. Must be between 1 and 10. For `dall-e-3`, only `n=1` is supported."]
10211    #[serde(rename = "n")]
10212    #[serde(skip_serializing_if = "Option::is_none")]
10213    #[builder(default)]
10214    pub n: Option<i64>,
10215    #[doc = "The quality of the image that will be generated. \n\n- `auto` (default value) will automatically select the best quality for the given model.\n- `high`, `medium` and `low` are supported for `gpt-image-1`.\n- `hd` and `standard` are supported for `dall-e-3`.\n- `standard` is the only option for `dall-e-2`.\n"]
10216    #[serde(rename = "quality")]
10217    #[serde(skip_serializing_if = "Option::is_none")]
10218    #[builder(default)]
10219    pub quality: Option<crate::__types::create_image_request::Quality>,
10220    #[doc = "The format in which generated images with `dall-e-2` and `dall-e-3` are returned. Must be one of `url` or `b64_json`. URLs are only valid for 60 minutes after the image has been generated. This parameter isn't supported for `gpt-image-1` which will always return base64-encoded images."]
10221    #[serde(rename = "response_format")]
10222    #[serde(skip_serializing_if = "Option::is_none")]
10223    #[builder(default)]
10224    pub response_format: Option<crate::__types::create_image_request::ResponseFormat>,
10225    #[doc = "The format in which the generated images are returned. This parameter is only supported for `gpt-image-1`. Must be one of `png`, `jpeg`, or `webp`."]
10226    #[serde(rename = "output_format")]
10227    #[serde(skip_serializing_if = "Option::is_none")]
10228    #[builder(default)]
10229    pub output_format: Option<crate::__types::create_image_request::OutputFormat>,
10230    #[doc = "The compression level (0-100%) for the generated images. This parameter is only supported for `gpt-image-1` with the `webp` or `jpeg` output formats, and defaults to 100."]
10231    #[serde(rename = "output_compression")]
10232    #[serde(skip_serializing_if = "Option::is_none")]
10233    #[builder(default)]
10234    pub output_compression: Option<i64>,
10235    #[doc = "Generate the image in streaming mode. Defaults to `false`. See the \n[Image generation guide](https://platform.openai.com/docs/guides/image-generation) for more information.\nThis parameter is only supported for `gpt-image-1`.\n"]
10236    #[serde(rename = "stream")]
10237    #[serde(skip_serializing_if = "Option::is_none")]
10238    #[builder(default)]
10239    pub stream: Option<bool>,
10240    #[serde(rename = "partial_images")]
10241    #[serde(skip_serializing_if = "Option::is_none")]
10242    #[builder(default)]
10243    pub partial_images: Option<crate::__types::PartialImages>,
10244    #[doc = "The size of the generated images. Must be one of `1024x1024`, `1536x1024` (landscape), `1024x1536` (portrait), or `auto` (default value) for `gpt-image-1`, one of `256x256`, `512x512`, or `1024x1024` for `dall-e-2`, and one of `1024x1024`, `1792x1024`, or `1024x1792` for `dall-e-3`."]
10245    #[serde(rename = "size")]
10246    #[serde(skip_serializing_if = "Option::is_none")]
10247    #[builder(default)]
10248    pub size: Option<crate::__types::create_image_request::Size>,
10249    #[doc = "Control the content-moderation level for images generated by `gpt-image-1`. Must be either `low` for less restrictive filtering or `auto` (default value)."]
10250    #[serde(rename = "moderation")]
10251    #[serde(skip_serializing_if = "Option::is_none")]
10252    #[builder(default)]
10253    pub moderation: Option<crate::__types::create_image_request::Moderation>,
10254    #[doc = "Allows to set transparency for the background of the generated image(s). \nThis parameter is only supported for `gpt-image-1`. Must be one of \n`transparent`, `opaque` or `auto` (default value). When `auto` is used, the \nmodel will automatically determine the best background for the image.\n\nIf `transparent`, the output format needs to support transparency, so it \nshould be set to either `png` (default value) or `webp`.\n"]
10255    #[serde(rename = "background")]
10256    #[serde(skip_serializing_if = "Option::is_none")]
10257    #[builder(default)]
10258    pub background: Option<crate::__types::create_image_request::Background>,
10259    #[doc = "The style of the generated images. This parameter is only supported for `dall-e-3`. Must be one of `vivid` or `natural`. Vivid causes the model to lean towards generating hyper-real and dramatic images. Natural causes the model to produce more natural, less hyper-real looking images."]
10260    #[serde(rename = "style")]
10261    #[serde(skip_serializing_if = "Option::is_none")]
10262    #[builder(default)]
10263    pub style: Option<crate::__types::create_image_request::Style>,
10264    #[doc = "A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#end-user-ids).\n"]
10265    #[serde(rename = "user")]
10266    #[serde(skip_serializing_if = "Option::is_none")]
10267    #[builder(default)]
10268    pub user: Option<String>,
10269}
10270#[allow(clippy::module_inception)]
10271pub mod create_image_variation_request {
10272    #[allow(clippy::module_inception)]
10273    pub(crate) mod model {
10274        #[doc = "dall-e-2"]
10275        #[derive(Clone, Copy, Debug, Default, PartialEq)]
10276        pub(crate) struct DallE2;
10277        impl_serde!(DallE2, "dall-e-2");
10278    }
10279    #[doc = "The model to use for image generation. Only `dall-e-2` is supported at this time."]
10280    #[derive(Clone, Debug, PartialEq)]
10281    #[allow(clippy::large_enum_variant)]
10282    pub enum Model {
10283        Other(String),
10284        #[doc = "dall-e-2"]
10285        DallE2,
10286    }
10287    impl<'de> serde::Deserialize<'de> for Model {
10288        fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
10289        where
10290            D: serde::Deserializer<'de>,
10291        {
10292            #[serde_with::serde_as]
10293            #[derive(serde :: Deserialize)]
10294            #[serde(untagged)]
10295            #[allow(clippy::enum_variant_names, clippy::large_enum_variant)]
10296            enum Model {
10297                DallE2(crate::__types::create_image_variation_request::model::DallE2),
10298                Other(String),
10299            }
10300            Ok(match Model::deserialize(deserializer)? {
10301                Model::Other(v) => Self::Other(v),
10302                Model::DallE2(_) => Self::DallE2,
10303            })
10304        }
10305    }
10306    impl serde::Serialize for Model {
10307        fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
10308        where
10309            S: serde::Serializer,
10310        {
10311            #[serde_with::serde_as]
10312            #[derive(serde :: Serialize)]
10313            #[serde(untagged)]
10314            #[allow(clippy::enum_variant_names)]
10315            enum Model<'a> {
10316                Other(&'a String),
10317                DallE2(crate::__types::create_image_variation_request::model::DallE2),
10318            }
10319            match self {
10320                Self::Other(v) => Model::Other(v),
10321                Self::DallE2 => Model::DallE2(Default::default()),
10322            }
10323            .serialize(serializer)
10324        }
10325    }
10326    #[doc = "The format in which the generated images are returned. Must be one of `url` or `b64_json`. URLs are only valid for 60 minutes after the image has been generated."]
10327    #[derive(Clone, Copy, Debug, Default, PartialEq, serde :: Deserialize, serde :: Serialize)]
10328    pub enum ResponseFormat {
10329        #[doc = "`url`"]
10330        #[default]
10331        #[serde(rename = "url")]
10332        Url,
10333        #[doc = "`b64_json`"]
10334        #[serde(rename = "b64_json")]
10335        B64Json,
10336    }
10337    #[doc = "The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`."]
10338    #[derive(Clone, Copy, Debug, Default, PartialEq, serde :: Deserialize, serde :: Serialize)]
10339    pub enum Size {
10340        #[doc = "`256x256`"]
10341        #[serde(rename = "256x256")]
10342        _256x256,
10343        #[doc = "`512x512`"]
10344        #[serde(rename = "512x512")]
10345        _512x512,
10346        #[doc = "`1024x1024`"]
10347        #[default]
10348        #[serde(rename = "1024x1024")]
10349        _1024x1024,
10350    }
10351}
10352#[derive(Clone, Debug, PartialEq)]
10353#[serde_with::serde_as]
10354#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
10355pub struct CreateImageVariationRequest {
10356    #[doc = "The image to use as the basis for the variation(s). Must be a valid PNG file, less than 4MB, and square."]
10357    #[serde_as(as = "serde_with::base64::Base64")]
10358    #[serde(rename = "image")]
10359    pub image: Vec<u8>,
10360    #[doc = "The model to use for image generation. Only `dall-e-2` is supported at this time."]
10361    #[serde(rename = "model")]
10362    #[serde(skip_serializing_if = "Option::is_none")]
10363    #[builder(default)]
10364    pub model: Option<crate::__types::create_image_variation_request::Model>,
10365    #[doc = "The number of images to generate. Must be between 1 and 10."]
10366    #[serde(rename = "n")]
10367    #[serde(skip_serializing_if = "Option::is_none")]
10368    #[builder(default)]
10369    pub n: Option<i64>,
10370    #[doc = "The format in which the generated images are returned. Must be one of `url` or `b64_json`. URLs are only valid for 60 minutes after the image has been generated."]
10371    #[serde(rename = "response_format")]
10372    #[serde(skip_serializing_if = "Option::is_none")]
10373    #[builder(default)]
10374    pub response_format: Option<crate::__types::create_image_variation_request::ResponseFormat>,
10375    #[doc = "The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`."]
10376    #[serde(rename = "size")]
10377    #[serde(skip_serializing_if = "Option::is_none")]
10378    #[builder(default)]
10379    pub size: Option<crate::__types::create_image_variation_request::Size>,
10380    #[doc = "A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#end-user-ids).\n"]
10381    #[serde(rename = "user")]
10382    #[serde(skip_serializing_if = "Option::is_none")]
10383    #[builder(default)]
10384    pub user: Option<String>,
10385}
10386#[allow(clippy::module_inception)]
10387pub mod create_message_request {
10388    #[doc = "The role of the entity that is creating the message. Allowed values include:\n- `user`: Indicates the message is sent by an actual user and should be used in most cases to represent user-generated messages.\n- `assistant`: Indicates the message is generated by the assistant. Use this value to insert messages from the assistant into the conversation.\n"]
10389    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
10390    pub enum Role {
10391        #[doc = "`user`"]
10392        #[serde(rename = "user")]
10393        User,
10394        #[doc = "`assistant`"]
10395        #[serde(rename = "assistant")]
10396        Assistant,
10397    }
10398    #[allow(clippy::module_inception)]
10399    pub mod content {
10400        #[allow(clippy::module_inception)]
10401        pub mod array {
10402            #[derive(Clone, Debug, PartialEq)]
10403            #[serde_with::serde_as]
10404            #[derive(serde :: Deserialize, serde :: Serialize)]
10405            #[serde(untagged)]
10406            #[allow(clippy::large_enum_variant)]
10407            pub enum Item {
10408                ImageFile(crate::__types::MessageContentImageFileObject),
10409                ImageUrl(crate::__types::MessageContentImageUrlObject),
10410                Text(crate::__types::MessageRequestContentTextObject),
10411            }
10412        }
10413    }
10414    #[derive(Clone, Debug, PartialEq)]
10415    #[serde_with::serde_as]
10416    #[derive(serde :: Deserialize, serde :: Serialize)]
10417    #[serde(untagged)]
10418    #[allow(clippy::large_enum_variant)]
10419    pub enum Content {
10420        #[doc = "The text contents of the message."]
10421        String(String),
10422        #[doc = "An array of content parts with a defined type, each can be of type `text` or images can be passed with `image_url` or `image_file`. Image types are only supported on [Vision-compatible models](https://platform.openai.com/docs/models)."]
10423        Array(Vec<crate::__types::create_message_request::content::array::Item>),
10424    }
10425    #[allow(clippy::module_inception)]
10426    pub mod attachments {
10427        #[allow(clippy::module_inception)]
10428        pub mod item {
10429            #[allow(clippy::module_inception)]
10430            pub mod tools {
10431                #[derive(Clone, Copy, Debug, PartialEq)]
10432                #[serde_with::serde_as]
10433                #[derive(serde :: Deserialize, serde :: Serialize)]
10434                #[serde(untagged)]
10435                #[allow(clippy::large_enum_variant)]
10436                pub enum Item {
10437                    CodeInterpreter(crate::__types::AssistantToolsCode),
10438                    FileSearch(crate::__types::AssistantToolsFileSearchTypeOnly),
10439                }
10440            }
10441        }
10442        #[derive(Clone, Debug, PartialEq)]
10443        #[serde_with::serde_as]
10444        #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
10445        pub struct Item {
10446            #[doc = "The ID of the file to attach to the message."]
10447            #[serde(rename = "file_id")]
10448            pub file_id: String,
10449            #[doc = "The tools to add this file to."]
10450            #[serde(rename = "tools")]
10451            pub tools: Vec<crate::__types::create_message_request::attachments::item::tools::Item>,
10452        }
10453    }
10454}
10455#[derive(Clone, Debug, PartialEq)]
10456#[serde_with::serde_as]
10457#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
10458pub struct CreateMessageRequest {
10459    #[doc = "The role of the entity that is creating the message. Allowed values include:\n- `user`: Indicates the message is sent by an actual user and should be used in most cases to represent user-generated messages.\n- `assistant`: Indicates the message is generated by the assistant. Use this value to insert messages from the assistant into the conversation.\n"]
10460    #[serde(rename = "role")]
10461    pub role: crate::__types::create_message_request::Role,
10462    #[serde(rename = "content")]
10463    pub content: crate::__types::create_message_request::Content,
10464    #[doc = "A list of files attached to the message, and the tools they should be added to."]
10465    #[serde(rename = "attachments")]
10466    #[serde(skip_serializing_if = "Option::is_none")]
10467    #[builder(default)]
10468    pub attachments: Option<Vec<crate::__types::create_message_request::attachments::Item>>,
10469    #[serde(rename = "metadata")]
10470    #[serde(skip_serializing_if = "Option::is_none")]
10471    #[builder(default)]
10472    pub metadata: Option<crate::__types::Metadata>,
10473}
10474#[derive(Clone, Debug, Default, PartialEq)]
10475#[serde_with::serde_as]
10476#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
10477pub struct CreateModelResponseProperties {
10478    #[serde(rename = "metadata")]
10479    #[serde(skip_serializing_if = "Option::is_none")]
10480    #[builder(default)]
10481    pub metadata: Option<crate::__types::Metadata>,
10482    #[doc = "An integer between 0 and 20 specifying the number of most likely tokens to\nreturn at each token position, each with an associated log probability.\n"]
10483    #[serde(rename = "top_logprobs")]
10484    #[serde(skip_serializing_if = "Option::is_none")]
10485    #[builder(default)]
10486    pub top_logprobs: Option<i64>,
10487    #[doc = "What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.\nWe generally recommend altering this or `top_p` but not both.\n"]
10488    #[serde(rename = "temperature")]
10489    #[serde(skip_serializing_if = "Option::is_none")]
10490    #[builder(default)]
10491    pub temperature: Option<serde_json::Number>,
10492    #[doc = "An alternative to sampling with temperature, called nucleus sampling,\nwhere the model considers the results of the tokens with top_p probability\nmass. So 0.1 means only the tokens comprising the top 10% probability mass\nare considered.\n\nWe generally recommend altering this or `temperature` but not both.\n"]
10493    #[serde(rename = "top_p")]
10494    #[serde(skip_serializing_if = "Option::is_none")]
10495    #[builder(default)]
10496    pub top_p: Option<serde_json::Number>,
10497    #[doc = "This field is being replaced by `safety_identifier` and `prompt_cache_key`. Use `prompt_cache_key` instead to maintain caching optimizations.\nA stable identifier for your end-users. \nUsed to boost cache hit rates by better bucketing similar requests and  to help OpenAI detect and prevent abuse. [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#safety-identifiers).\n"]
10498    #[serde(rename = "user")]
10499    #[serde(skip_serializing_if = "Option::is_none")]
10500    #[builder(default)]
10501    pub user: Option<String>,
10502    #[doc = "A stable identifier used to help detect users of your application that may be violating OpenAI's usage policies. \nThe IDs should be a string that uniquely identifies each user. We recommend hashing their username or email address, in order to avoid sending us any identifying information. [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#safety-identifiers).\n"]
10503    #[serde(rename = "safety_identifier")]
10504    #[serde(skip_serializing_if = "Option::is_none")]
10505    #[builder(default)]
10506    pub safety_identifier: Option<String>,
10507    #[doc = "Used by OpenAI to cache responses for similar requests to optimize your cache hit rates. Replaces the `user` field. [Learn more](https://platform.openai.com/docs/guides/prompt-caching).\n"]
10508    #[serde(rename = "prompt_cache_key")]
10509    #[serde(skip_serializing_if = "Option::is_none")]
10510    #[builder(default)]
10511    pub prompt_cache_key: Option<String>,
10512    #[serde(rename = "service_tier")]
10513    #[serde(skip_serializing_if = "Option::is_none")]
10514    #[builder(default)]
10515    pub service_tier: Option<crate::__types::ServiceTier>,
10516}
10517#[allow(clippy::module_inception)]
10518pub mod create_moderation_request {
10519    #[allow(clippy::module_inception)]
10520    pub mod input {
10521        #[allow(clippy::module_inception)]
10522        pub mod variant2 {
10523            #[derive(Clone, Debug, PartialEq)]
10524            #[serde_with::serde_as]
10525            #[derive(serde :: Deserialize, serde :: Serialize)]
10526            #[serde(untagged)]
10527            #[allow(clippy::large_enum_variant)]
10528            pub enum Item {
10529                ImageUrl(crate::__types::ModerationImageUrlInput),
10530                Text(crate::__types::ModerationTextInput),
10531            }
10532        }
10533    }
10534    #[doc = "Input (or inputs) to classify. Can be a single string, an array of strings, or\nan array of multi-modal input objects similar to other models.\n"]
10535    #[derive(Clone, Debug, PartialEq)]
10536    #[serde_with::serde_as]
10537    #[derive(serde :: Deserialize, serde :: Serialize)]
10538    #[serde(untagged)]
10539    #[allow(clippy::large_enum_variant)]
10540    pub enum Input {
10541        #[doc = "A string of text to classify for moderation."]
10542        String(String),
10543        #[doc = "An array of strings to classify for moderation."]
10544        ArrayOfString(Vec<String>),
10545        #[doc = "An array of multi-modal inputs to the moderation model."]
10546        Variant2(Vec<crate::__types::create_moderation_request::input::variant2::Item>),
10547    }
10548    #[allow(clippy::module_inception)]
10549    pub(crate) mod model {
10550        #[doc = "omni-moderation-latest"]
10551        #[derive(Clone, Copy, Debug, Default, PartialEq)]
10552        pub(crate) struct OmniModerationLatest;
10553        impl_serde!(OmniModerationLatest, "omni-moderation-latest");
10554        #[doc = "omni-moderation-2024-09-26"]
10555        #[derive(Clone, Copy, Debug, Default, PartialEq)]
10556        pub(crate) struct OmniModeration2024_09_26;
10557        impl_serde!(OmniModeration2024_09_26, "omni-moderation-2024-09-26");
10558        #[doc = "text-moderation-latest"]
10559        #[derive(Clone, Copy, Debug, Default, PartialEq)]
10560        pub(crate) struct TextModerationLatest;
10561        impl_serde!(TextModerationLatest, "text-moderation-latest");
10562        #[doc = "text-moderation-stable"]
10563        #[derive(Clone, Copy, Debug, Default, PartialEq)]
10564        pub(crate) struct TextModerationStable;
10565        impl_serde!(TextModerationStable, "text-moderation-stable");
10566    }
10567    #[doc = "The content moderation model you would like to use. Learn more in\n[the moderation guide](https://platform.openai.com/docs/guides/moderation), and learn about\navailable models [here](https://platform.openai.com/docs/models#moderation).\n"]
10568    #[derive(Clone, Debug, PartialEq)]
10569    #[allow(clippy::large_enum_variant)]
10570    pub enum Model {
10571        Other(String),
10572        #[doc = "omni-moderation-latest"]
10573        OmniModerationLatest,
10574        #[doc = "omni-moderation-2024-09-26"]
10575        OmniModeration2024_09_26,
10576        #[doc = "text-moderation-latest"]
10577        TextModerationLatest,
10578        #[doc = "text-moderation-stable"]
10579        TextModerationStable,
10580    }
10581    impl<'de> serde::Deserialize<'de> for Model {
10582        fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
10583        where
10584            D: serde::Deserializer<'de>,
10585        {
10586            #[serde_with::serde_as]
10587            #[derive(serde :: Deserialize)]
10588            #[serde(untagged)]
10589            #[allow(clippy::enum_variant_names, clippy::large_enum_variant)]
10590            enum Model {
10591                OmniModerationLatest(
10592                    crate::__types::create_moderation_request::model::OmniModerationLatest,
10593                ),
10594                OmniModeration2024_09_26(
10595                    crate::__types::create_moderation_request::model::OmniModeration2024_09_26,
10596                ),
10597                TextModerationLatest(
10598                    crate::__types::create_moderation_request::model::TextModerationLatest,
10599                ),
10600                TextModerationStable(
10601                    crate::__types::create_moderation_request::model::TextModerationStable,
10602                ),
10603                Other(String),
10604            }
10605            Ok(match Model::deserialize(deserializer)? {
10606                Model::Other(v) => Self::Other(v),
10607                Model::OmniModerationLatest(_) => Self::OmniModerationLatest,
10608                Model::OmniModeration2024_09_26(_) => Self::OmniModeration2024_09_26,
10609                Model::TextModerationLatest(_) => Self::TextModerationLatest,
10610                Model::TextModerationStable(_) => Self::TextModerationStable,
10611            })
10612        }
10613    }
10614    impl serde::Serialize for Model {
10615        fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
10616        where
10617            S: serde::Serializer,
10618        {
10619            #[serde_with::serde_as]
10620            #[derive(serde :: Serialize)]
10621            #[serde(untagged)]
10622            #[allow(clippy::enum_variant_names)]
10623            enum Model<'a> {
10624                Other(&'a String),
10625                OmniModerationLatest(
10626                    crate::__types::create_moderation_request::model::OmniModerationLatest,
10627                ),
10628                OmniModeration2024_09_26(
10629                    crate::__types::create_moderation_request::model::OmniModeration2024_09_26,
10630                ),
10631                TextModerationLatest(
10632                    crate::__types::create_moderation_request::model::TextModerationLatest,
10633                ),
10634                TextModerationStable(
10635                    crate::__types::create_moderation_request::model::TextModerationStable,
10636                ),
10637            }
10638            match self {
10639                Self::Other(v) => Model::Other(v),
10640                Self::OmniModerationLatest => Model::OmniModerationLatest(Default::default()),
10641                Self::OmniModeration2024_09_26 => {
10642                    Model::OmniModeration2024_09_26(Default::default())
10643                }
10644                Self::TextModerationLatest => Model::TextModerationLatest(Default::default()),
10645                Self::TextModerationStable => Model::TextModerationStable(Default::default()),
10646            }
10647            .serialize(serializer)
10648        }
10649    }
10650}
10651#[derive(Clone, Debug, PartialEq)]
10652#[serde_with::serde_as]
10653#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
10654pub struct CreateModerationRequest {
10655    #[doc = "Input (or inputs) to classify. Can be a single string, an array of strings, or\nan array of multi-modal input objects similar to other models.\n"]
10656    #[serde(rename = "input")]
10657    pub input: crate::__types::create_moderation_request::Input,
10658    #[doc = "The content moderation model you would like to use. Learn more in\n[the moderation guide](https://platform.openai.com/docs/guides/moderation), and learn about\navailable models [here](https://platform.openai.com/docs/models#moderation).\n"]
10659    #[serde(rename = "model")]
10660    #[serde(skip_serializing_if = "Option::is_none")]
10661    #[builder(default)]
10662    pub model: Option<crate::__types::create_moderation_request::Model>,
10663}
10664#[allow(clippy::module_inception)]
10665pub mod create_moderation_response {
10666    #[allow(clippy::module_inception)]
10667    pub mod results {
10668        #[allow(clippy::module_inception)]
10669        pub mod item {
10670            #[doc = "A list of the categories, and whether they are flagged or not."]
10671            #[derive(Clone, Copy, Debug, PartialEq)]
10672            #[serde_with::serde_as]
10673            #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
10674            pub struct Categories {
10675                #[doc = "Content that expresses, incites, or promotes hate based on race, gender, ethnicity, religion, nationality, sexual orientation, disability status, or caste. Hateful content aimed at non-protected groups (e.g., chess players) is harassment."]
10676                #[serde(rename = "hate")]
10677                pub hate: bool,
10678                #[doc = "Hateful content that also includes violence or serious harm towards the targeted group based on race, gender, ethnicity, religion, nationality, sexual orientation, disability status, or caste."]
10679                #[serde(rename = "hate/threatening")]
10680                pub hate_threatening: bool,
10681                #[doc = "Content that expresses, incites, or promotes harassing language towards any target."]
10682                #[serde(rename = "harassment")]
10683                pub harassment: bool,
10684                #[doc = "Harassment content that also includes violence or serious harm towards any target."]
10685                #[serde(rename = "harassment/threatening")]
10686                pub harassment_threatening: bool,
10687                #[doc = "Content that includes instructions or advice that facilitate the planning or execution of wrongdoing, or that gives advice or instruction on how to commit illicit acts. For example, \"how to shoplift\" would fit this category."]
10688                #[serde(rename = "illicit")]
10689                #[serde(skip_serializing_if = "Option::is_none")]
10690                #[builder(default)]
10691                pub illicit: Option<bool>,
10692                #[doc = "Content that includes instructions or advice that facilitate the planning or execution of wrongdoing that also includes violence, or that gives advice or instruction on the procurement of any weapon."]
10693                #[serde(rename = "illicit/violent")]
10694                #[serde(skip_serializing_if = "Option::is_none")]
10695                #[builder(default)]
10696                pub illicit_violent: Option<bool>,
10697                #[doc = "Content that promotes, encourages, or depicts acts of self-harm, such as suicide, cutting, and eating disorders."]
10698                #[serde(rename = "self-harm")]
10699                pub self_harm: bool,
10700                #[doc = "Content where the speaker expresses that they are engaging or intend to engage in acts of self-harm, such as suicide, cutting, and eating disorders."]
10701                #[serde(rename = "self-harm/intent")]
10702                pub self_harm_intent: bool,
10703                #[doc = "Content that encourages performing acts of self-harm, such as suicide, cutting, and eating disorders, or that gives instructions or advice on how to commit such acts."]
10704                #[serde(rename = "self-harm/instructions")]
10705                pub self_harm_instructions: bool,
10706                #[doc = "Content meant to arouse sexual excitement, such as the description of sexual activity, or that promotes sexual services (excluding sex education and wellness)."]
10707                #[serde(rename = "sexual")]
10708                pub sexual: bool,
10709                #[doc = "Sexual content that includes an individual who is under 18 years old."]
10710                #[serde(rename = "sexual/minors")]
10711                pub sexual_minors: bool,
10712                #[doc = "Content that depicts death, violence, or physical injury."]
10713                #[serde(rename = "violence")]
10714                pub violence: bool,
10715                #[doc = "Content that depicts death, violence, or physical injury in graphic detail."]
10716                #[serde(rename = "violence/graphic")]
10717                pub violence_graphic: bool,
10718            }
10719            #[doc = "A list of the categories along with their scores as predicted by model."]
10720            #[derive(Clone, Debug, PartialEq)]
10721            #[serde_with::serde_as]
10722            #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
10723            pub struct CategoryScores {
10724                #[doc = "The score for the category 'hate'."]
10725                #[serde(rename = "hate")]
10726                pub hate: serde_json::Number,
10727                #[doc = "The score for the category 'hate/threatening'."]
10728                #[serde(rename = "hate/threatening")]
10729                pub hate_threatening: serde_json::Number,
10730                #[doc = "The score for the category 'harassment'."]
10731                #[serde(rename = "harassment")]
10732                pub harassment: serde_json::Number,
10733                #[doc = "The score for the category 'harassment/threatening'."]
10734                #[serde(rename = "harassment/threatening")]
10735                pub harassment_threatening: serde_json::Number,
10736                #[doc = "The score for the category 'illicit'."]
10737                #[serde(rename = "illicit")]
10738                pub illicit: serde_json::Number,
10739                #[doc = "The score for the category 'illicit/violent'."]
10740                #[serde(rename = "illicit/violent")]
10741                pub illicit_violent: serde_json::Number,
10742                #[doc = "The score for the category 'self-harm'."]
10743                #[serde(rename = "self-harm")]
10744                pub self_harm: serde_json::Number,
10745                #[doc = "The score for the category 'self-harm/intent'."]
10746                #[serde(rename = "self-harm/intent")]
10747                pub self_harm_intent: serde_json::Number,
10748                #[doc = "The score for the category 'self-harm/instructions'."]
10749                #[serde(rename = "self-harm/instructions")]
10750                pub self_harm_instructions: serde_json::Number,
10751                #[doc = "The score for the category 'sexual'."]
10752                #[serde(rename = "sexual")]
10753                pub sexual: serde_json::Number,
10754                #[doc = "The score for the category 'sexual/minors'."]
10755                #[serde(rename = "sexual/minors")]
10756                pub sexual_minors: serde_json::Number,
10757                #[doc = "The score for the category 'violence'."]
10758                #[serde(rename = "violence")]
10759                pub violence: serde_json::Number,
10760                #[doc = "The score for the category 'violence/graphic'."]
10761                #[serde(rename = "violence/graphic")]
10762                pub violence_graphic: serde_json::Number,
10763            }
10764            #[allow(clippy::module_inception)]
10765            pub mod category_applied_input_types {
10766                #[allow(clippy::module_inception)]
10767                pub mod hate {
10768                    #[doc = "text"]
10769                    #[derive(Clone, Copy, Debug, Default, PartialEq)]
10770                    pub struct Item;
10771                    impl_serde!(Item, "text");
10772                }
10773                #[allow(clippy::module_inception)]
10774                pub mod hate_threatening {
10775                    #[doc = "text"]
10776                    #[derive(Clone, Copy, Debug, Default, PartialEq)]
10777                    pub struct Item;
10778                    impl_serde!(Item, "text");
10779                }
10780                #[allow(clippy::module_inception)]
10781                pub mod harassment {
10782                    #[doc = "text"]
10783                    #[derive(Clone, Copy, Debug, Default, PartialEq)]
10784                    pub struct Item;
10785                    impl_serde!(Item, "text");
10786                }
10787                #[allow(clippy::module_inception)]
10788                pub mod harassment_threatening {
10789                    #[doc = "text"]
10790                    #[derive(Clone, Copy, Debug, Default, PartialEq)]
10791                    pub struct Item;
10792                    impl_serde!(Item, "text");
10793                }
10794                #[allow(clippy::module_inception)]
10795                pub mod illicit {
10796                    #[doc = "text"]
10797                    #[derive(Clone, Copy, Debug, Default, PartialEq)]
10798                    pub struct Item;
10799                    impl_serde!(Item, "text");
10800                }
10801                #[allow(clippy::module_inception)]
10802                pub mod illicit_violent {
10803                    #[doc = "text"]
10804                    #[derive(Clone, Copy, Debug, Default, PartialEq)]
10805                    pub struct Item;
10806                    impl_serde!(Item, "text");
10807                }
10808                #[allow(clippy::module_inception)]
10809                pub mod self_harm {
10810                    #[derive(
10811                        Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize,
10812                    )]
10813                    pub enum Item {
10814                        #[doc = "`text`"]
10815                        #[serde(rename = "text")]
10816                        Text,
10817                        #[doc = "`image`"]
10818                        #[serde(rename = "image")]
10819                        Image,
10820                    }
10821                }
10822                #[allow(clippy::module_inception)]
10823                pub mod self_harm_intent {
10824                    #[derive(
10825                        Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize,
10826                    )]
10827                    pub enum Item {
10828                        #[doc = "`text`"]
10829                        #[serde(rename = "text")]
10830                        Text,
10831                        #[doc = "`image`"]
10832                        #[serde(rename = "image")]
10833                        Image,
10834                    }
10835                }
10836                #[allow(clippy::module_inception)]
10837                pub mod self_harm_instructions {
10838                    #[derive(
10839                        Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize,
10840                    )]
10841                    pub enum Item {
10842                        #[doc = "`text`"]
10843                        #[serde(rename = "text")]
10844                        Text,
10845                        #[doc = "`image`"]
10846                        #[serde(rename = "image")]
10847                        Image,
10848                    }
10849                }
10850                #[allow(clippy::module_inception)]
10851                pub mod sexual {
10852                    #[derive(
10853                        Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize,
10854                    )]
10855                    pub enum Item {
10856                        #[doc = "`text`"]
10857                        #[serde(rename = "text")]
10858                        Text,
10859                        #[doc = "`image`"]
10860                        #[serde(rename = "image")]
10861                        Image,
10862                    }
10863                }
10864                #[allow(clippy::module_inception)]
10865                pub mod sexual_minors {
10866                    #[doc = "text"]
10867                    #[derive(Clone, Copy, Debug, Default, PartialEq)]
10868                    pub struct Item;
10869                    impl_serde!(Item, "text");
10870                }
10871                #[allow(clippy::module_inception)]
10872                pub mod violence {
10873                    #[derive(
10874                        Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize,
10875                    )]
10876                    pub enum Item {
10877                        #[doc = "`text`"]
10878                        #[serde(rename = "text")]
10879                        Text,
10880                        #[doc = "`image`"]
10881                        #[serde(rename = "image")]
10882                        Image,
10883                    }
10884                }
10885                #[allow(clippy::module_inception)]
10886                pub mod violence_graphic {
10887                    #[derive(
10888                        Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize,
10889                    )]
10890                    pub enum Item {
10891                        #[doc = "`text`"]
10892                        #[serde(rename = "text")]
10893                        Text,
10894                        #[doc = "`image`"]
10895                        #[serde(rename = "image")]
10896                        Image,
10897                    }
10898                }
10899            }
10900            #[doc = "A list of the categories along with the input type(s) that the score applies to."]
10901            #[derive(Clone, Debug, PartialEq)]
10902            #[serde_with::serde_as]
10903            #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
10904            pub struct CategoryAppliedInputTypes { # [doc = "The applied input type(s) for the category 'hate'."] # [serde (rename = "hate")] pub hate : Vec < crate :: __types :: create_moderation_response :: results :: item :: category_applied_input_types :: hate :: Item > , # [doc = "The applied input type(s) for the category 'hate/threatening'."] # [serde (rename = "hate/threatening")] pub hate_threatening : Vec < crate :: __types :: create_moderation_response :: results :: item :: category_applied_input_types :: hate_threatening :: Item > , # [doc = "The applied input type(s) for the category 'harassment'."] # [serde (rename = "harassment")] pub harassment : Vec < crate :: __types :: create_moderation_response :: results :: item :: category_applied_input_types :: harassment :: Item > , # [doc = "The applied input type(s) for the category 'harassment/threatening'."] # [serde (rename = "harassment/threatening")] pub harassment_threatening : Vec < crate :: __types :: create_moderation_response :: results :: item :: category_applied_input_types :: harassment_threatening :: Item > , # [doc = "The applied input type(s) for the category 'illicit'."] # [serde (rename = "illicit")] pub illicit : Vec < crate :: __types :: create_moderation_response :: results :: item :: category_applied_input_types :: illicit :: Item > , # [doc = "The applied input type(s) for the category 'illicit/violent'."] # [serde (rename = "illicit/violent")] pub illicit_violent : Vec < crate :: __types :: create_moderation_response :: results :: item :: category_applied_input_types :: illicit_violent :: Item > , # [doc = "The applied input type(s) for the category 'self-harm'."] # [serde (rename = "self-harm")] pub self_harm : Vec < crate :: __types :: create_moderation_response :: results :: item :: category_applied_input_types :: self_harm :: Item > , # [doc = "The applied input type(s) for the category 'self-harm/intent'."] # [serde (rename = "self-harm/intent")] pub self_harm_intent : Vec < crate :: __types :: create_moderation_response :: results :: item :: category_applied_input_types :: self_harm_intent :: Item > , # [doc = "The applied input type(s) for the category 'self-harm/instructions'."] # [serde (rename = "self-harm/instructions")] pub self_harm_instructions : Vec < crate :: __types :: create_moderation_response :: results :: item :: category_applied_input_types :: self_harm_instructions :: Item > , # [doc = "The applied input type(s) for the category 'sexual'."] # [serde (rename = "sexual")] pub sexual : Vec < crate :: __types :: create_moderation_response :: results :: item :: category_applied_input_types :: sexual :: Item > , # [doc = "The applied input type(s) for the category 'sexual/minors'."] # [serde (rename = "sexual/minors")] pub sexual_minors : Vec < crate :: __types :: create_moderation_response :: results :: item :: category_applied_input_types :: sexual_minors :: Item > , # [doc = "The applied input type(s) for the category 'violence'."] # [serde (rename = "violence")] pub violence : Vec < crate :: __types :: create_moderation_response :: results :: item :: category_applied_input_types :: violence :: Item > , # [doc = "The applied input type(s) for the category 'violence/graphic'."] # [serde (rename = "violence/graphic")] pub violence_graphic : Vec < crate :: __types :: create_moderation_response :: results :: item :: category_applied_input_types :: violence_graphic :: Item > }
10905        }
10906        #[derive(Clone, Debug, PartialEq)]
10907        #[serde_with::serde_as]
10908        #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
10909        pub struct Item { # [doc = "Whether any of the below categories are flagged."] # [serde (rename = "flagged")] pub flagged : bool , # [doc = "A list of the categories, and whether they are flagged or not."] # [serde (rename = "categories")] pub categories : crate :: __types :: create_moderation_response :: results :: item :: Categories , # [doc = "A list of the categories along with their scores as predicted by model."] # [serde (rename = "category_scores")] pub category_scores : crate :: __types :: create_moderation_response :: results :: item :: CategoryScores , # [doc = "A list of the categories along with the input type(s) that the score applies to."] # [serde (rename = "category_applied_input_types")] pub category_applied_input_types : crate :: __types :: create_moderation_response :: results :: item :: CategoryAppliedInputTypes }
10910    }
10911}
10912#[doc = "Represents if a given text input is potentially harmful."]
10913#[derive(Clone, Debug, PartialEq)]
10914#[serde_with::serde_as]
10915#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
10916pub struct CreateModerationResponse {
10917    #[doc = "The unique identifier for the moderation request."]
10918    #[serde(rename = "id")]
10919    pub id: String,
10920    #[doc = "The model used to generate the moderation results."]
10921    #[serde(rename = "model")]
10922    pub model: String,
10923    #[doc = "A list of moderation objects."]
10924    #[serde(rename = "results")]
10925    pub results: Vec<crate::__types::create_moderation_response::results::Item>,
10926}
10927#[allow(clippy::module_inception)]
10928pub mod create_response {
10929    #[doc = "Configuration options for a text response from the model. Can be plain\ntext or structured JSON data. Learn more:\n- [Text inputs and outputs](https://platform.openai.com/docs/guides/text)\n- [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs)\n"]
10930    #[derive(Clone, Debug, Default, PartialEq)]
10931    #[serde_with::serde_as]
10932    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
10933    pub struct Text {
10934        #[serde(rename = "format")]
10935        #[serde(skip_serializing_if = "Option::is_none")]
10936        #[builder(default)]
10937        pub format: Option<crate::__types::TextResponseFormatConfiguration>,
10938        #[serde(rename = "verbosity")]
10939        #[serde(skip_serializing_if = "Option::is_none")]
10940        #[builder(default)]
10941        pub verbosity: Option<crate::__types::Verbosity>,
10942    }
10943    #[doc = "How the model should select which tool (or tools) to use when generating\na response. See the `tools` parameter to see how to specify which tools\nthe model can call.\n"]
10944    #[derive(Clone, Debug, PartialEq)]
10945    #[allow(clippy::large_enum_variant)]
10946    pub enum ToolChoice {
10947        ToolChoiceOptions(crate::__types::ToolChoiceOptions),
10948        ToolChoiceAllowed(crate::__types::ToolChoiceAllowed),
10949        ToolChoiceTypes(crate::__types::ToolChoiceTypes),
10950        ToolChoiceFunction(crate::__types::ToolChoiceFunction),
10951        ToolChoiceMcp(crate::__types::ToolChoiceMcp),
10952        ToolChoiceCustom(crate::__types::ToolChoiceCustom),
10953    }
10954    impl<'de> serde::Deserialize<'de> for ToolChoice {
10955        fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
10956        where
10957            D: serde::Deserializer<'de>,
10958        {
10959            #[serde_with::serde_as]
10960            #[derive(serde :: Deserialize)]
10961            #[serde(untagged)]
10962            #[allow(clippy::enum_variant_names, clippy::large_enum_variant)]
10963            enum ToolChoice {
10964                ToolChoiceOptions(crate::__types::ToolChoiceOptions),
10965                ToolChoiceAllowed(crate::__types::ToolChoiceAllowed),
10966                ToolChoiceTypes(crate::__types::ToolChoiceTypes),
10967                ToolChoiceFunction(crate::__types::ToolChoiceFunction),
10968                ToolChoiceMcp(crate::__types::ToolChoiceMcp),
10969                ToolChoiceCustom(crate::__types::ToolChoiceCustom),
10970            }
10971            Ok(match ToolChoice::deserialize(deserializer)? {
10972                ToolChoice::ToolChoiceOptions(v) => Self::ToolChoiceOptions(v),
10973                ToolChoice::ToolChoiceAllowed(v) => Self::ToolChoiceAllowed(v),
10974                ToolChoice::ToolChoiceTypes(v) => Self::ToolChoiceTypes(v),
10975                ToolChoice::ToolChoiceFunction(v) => Self::ToolChoiceFunction(v),
10976                ToolChoice::ToolChoiceMcp(v) => Self::ToolChoiceMcp(v),
10977                ToolChoice::ToolChoiceCustom(v) => Self::ToolChoiceCustom(v),
10978            })
10979        }
10980    }
10981    impl serde::Serialize for ToolChoice {
10982        fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
10983        where
10984            S: serde::Serializer,
10985        {
10986            #[serde_with::serde_as]
10987            #[derive(serde :: Serialize)]
10988            #[serde(untagged)]
10989            #[allow(clippy::enum_variant_names)]
10990            enum ToolChoice<'a> {
10991                ToolChoiceOptions(&'a crate::__types::ToolChoiceOptions),
10992                ToolChoiceAllowed(&'a crate::__types::ToolChoiceAllowed),
10993                ToolChoiceTypes(&'a crate::__types::ToolChoiceTypes),
10994                ToolChoiceFunction(&'a crate::__types::ToolChoiceFunction),
10995                ToolChoiceMcp(&'a crate::__types::ToolChoiceMcp),
10996                ToolChoiceCustom(&'a crate::__types::ToolChoiceCustom),
10997            }
10998            match self {
10999                Self::ToolChoiceOptions(v) => ToolChoice::ToolChoiceOptions(v),
11000                Self::ToolChoiceAllowed(v) => ToolChoice::ToolChoiceAllowed(v),
11001                Self::ToolChoiceTypes(v) => ToolChoice::ToolChoiceTypes(v),
11002                Self::ToolChoiceFunction(v) => ToolChoice::ToolChoiceFunction(v),
11003                Self::ToolChoiceMcp(v) => ToolChoice::ToolChoiceMcp(v),
11004                Self::ToolChoiceCustom(v) => ToolChoice::ToolChoiceCustom(v),
11005            }
11006            .serialize(serializer)
11007        }
11008    }
11009    #[doc = "The truncation strategy to use for the model response.\n- `auto`: If the context of this response and previous ones exceeds\n  the model's context window size, the model will truncate the\n  response to fit the context window by dropping input items in the\n  middle of the conversation.\n- `disabled` (default): If a model response will exceed the context window\n  size for a model, the request will fail with a 400 error.\n"]
11010    #[derive(Clone, Copy, Debug, Default, PartialEq, serde :: Deserialize, serde :: Serialize)]
11011    pub enum Truncation {
11012        #[doc = "`auto`"]
11013        #[serde(rename = "auto")]
11014        Auto,
11015        #[doc = "`disabled`"]
11016        #[default]
11017        #[serde(rename = "disabled")]
11018        Disabled,
11019    }
11020    #[doc = "Text, image, or file inputs to the model, used to generate a response.\n\nLearn more:\n- [Text inputs and outputs](https://platform.openai.com/docs/guides/text)\n- [Image inputs](https://platform.openai.com/docs/guides/images)\n- [File inputs](https://platform.openai.com/docs/guides/pdf-files)\n- [Conversation state](https://platform.openai.com/docs/guides/conversation-state)\n- [Function calling](https://platform.openai.com/docs/guides/function-calling)\n"]
11021    #[derive(Clone, Debug, PartialEq)]
11022    #[serde_with::serde_as]
11023    #[derive(serde :: Deserialize, serde :: Serialize)]
11024    #[serde(untagged)]
11025    #[allow(clippy::large_enum_variant)]
11026    pub enum Input {
11027        #[doc = "A text input to the model, equivalent to a text input with the\n`user` role.\n"]
11028        String(String),
11029        #[doc = "A list of one or many input items to the model, containing\ndifferent content types.\n"]
11030        Array(Vec<crate::__types::InputItem>),
11031    }
11032    #[doc = "The conversation that this response belongs to. Items from this conversation are prepended to `input_items` for this response request.\nInput items and output items from this response are automatically added to this conversation after this response completes.\n"]
11033    #[derive(Clone, Debug, PartialEq)]
11034    #[serde_with::serde_as]
11035    #[derive(serde :: Deserialize, serde :: Serialize)]
11036    #[serde(untagged)]
11037    #[allow(clippy::large_enum_variant)]
11038    pub enum Conversation {
11039        #[doc = "The unique ID of the conversation.\n"]
11040        String(String),
11041        ConversationParam(crate::__types::ConversationParam),
11042    }
11043}
11044#[derive(Clone, Debug, Default, PartialEq)]
11045#[serde_with::serde_as]
11046#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
11047pub struct CreateResponse {
11048    #[serde(rename = "metadata")]
11049    #[serde(skip_serializing_if = "Option::is_none")]
11050    #[builder(default)]
11051    pub metadata: Option<crate::__types::Metadata>,
11052    #[doc = "An integer between 0 and 20 specifying the number of most likely tokens to\nreturn at each token position, each with an associated log probability.\n"]
11053    #[serde(rename = "top_logprobs")]
11054    #[serde(skip_serializing_if = "Option::is_none")]
11055    #[builder(default)]
11056    pub top_logprobs: Option<i64>,
11057    #[doc = "What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.\nWe generally recommend altering this or `top_p` but not both.\n"]
11058    #[serde(rename = "temperature")]
11059    #[serde(skip_serializing_if = "Option::is_none")]
11060    #[builder(default)]
11061    pub temperature: Option<serde_json::Number>,
11062    #[doc = "An alternative to sampling with temperature, called nucleus sampling,\nwhere the model considers the results of the tokens with top_p probability\nmass. So 0.1 means only the tokens comprising the top 10% probability mass\nare considered.\n\nWe generally recommend altering this or `temperature` but not both.\n"]
11063    #[serde(rename = "top_p")]
11064    #[serde(skip_serializing_if = "Option::is_none")]
11065    #[builder(default)]
11066    pub top_p: Option<serde_json::Number>,
11067    #[doc = "This field is being replaced by `safety_identifier` and `prompt_cache_key`. Use `prompt_cache_key` instead to maintain caching optimizations.\nA stable identifier for your end-users. \nUsed to boost cache hit rates by better bucketing similar requests and  to help OpenAI detect and prevent abuse. [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#safety-identifiers).\n"]
11068    #[serde(rename = "user")]
11069    #[serde(skip_serializing_if = "Option::is_none")]
11070    #[builder(default)]
11071    pub user: Option<String>,
11072    #[doc = "A stable identifier used to help detect users of your application that may be violating OpenAI's usage policies. \nThe IDs should be a string that uniquely identifies each user. We recommend hashing their username or email address, in order to avoid sending us any identifying information. [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#safety-identifiers).\n"]
11073    #[serde(rename = "safety_identifier")]
11074    #[serde(skip_serializing_if = "Option::is_none")]
11075    #[builder(default)]
11076    pub safety_identifier: Option<String>,
11077    #[doc = "Used by OpenAI to cache responses for similar requests to optimize your cache hit rates. Replaces the `user` field. [Learn more](https://platform.openai.com/docs/guides/prompt-caching).\n"]
11078    #[serde(rename = "prompt_cache_key")]
11079    #[serde(skip_serializing_if = "Option::is_none")]
11080    #[builder(default)]
11081    pub prompt_cache_key: Option<String>,
11082    #[serde(rename = "service_tier")]
11083    #[serde(skip_serializing_if = "Option::is_none")]
11084    #[builder(default)]
11085    pub service_tier: Option<crate::__types::ServiceTier>,
11086    #[doc = "The unique ID of the previous response to the model. Use this to\ncreate multi-turn conversations. Learn more about\n[conversation state](https://platform.openai.com/docs/guides/conversation-state). Cannot be used in conjunction with `conversation`.\n"]
11087    #[serde(rename = "previous_response_id")]
11088    #[serde(skip_serializing_if = "Option::is_none")]
11089    #[builder(default)]
11090    pub previous_response_id: Option<String>,
11091    #[doc = "Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI\noffers a wide range of models with different capabilities, performance\ncharacteristics, and price points. Refer to the [model guide](https://platform.openai.com/docs/models)\nto browse and compare available models.\n"]
11092    #[serde(rename = "model")]
11093    #[serde(skip_serializing_if = "Option::is_none")]
11094    #[builder(default)]
11095    pub model: Option<crate::__types::ModelIdsResponses>,
11096    #[serde(rename = "reasoning")]
11097    #[serde(skip_serializing_if = "Option::is_none")]
11098    #[builder(default)]
11099    pub reasoning: Option<crate::__types::Reasoning>,
11100    #[doc = "Whether to run the model response in the background.\n[Learn more](https://platform.openai.com/docs/guides/background).\n"]
11101    #[serde(rename = "background")]
11102    #[serde(skip_serializing_if = "Option::is_none")]
11103    #[builder(default)]
11104    pub background: Option<bool>,
11105    #[doc = "An upper bound for the number of tokens that can be generated for a response, including visible output tokens and [reasoning tokens](https://platform.openai.com/docs/guides/reasoning).\n"]
11106    #[serde(rename = "max_output_tokens")]
11107    #[serde(skip_serializing_if = "Option::is_none")]
11108    #[builder(default)]
11109    pub max_output_tokens: Option<i64>,
11110    #[doc = "The maximum number of total calls to built-in tools that can be processed in a response. This maximum number applies across all built-in tool calls, not per individual tool. Any further attempts to call a tool by the model will be ignored.\n"]
11111    #[serde(rename = "max_tool_calls")]
11112    #[serde(skip_serializing_if = "Option::is_none")]
11113    #[builder(default)]
11114    pub max_tool_calls: Option<i64>,
11115    #[doc = "Configuration options for a text response from the model. Can be plain\ntext or structured JSON data. Learn more:\n- [Text inputs and outputs](https://platform.openai.com/docs/guides/text)\n- [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs)\n"]
11116    #[serde(rename = "text")]
11117    #[serde(skip_serializing_if = "Option::is_none")]
11118    #[builder(default)]
11119    pub text: Option<crate::__types::create_response::Text>,
11120    #[doc = "An array of tools the model may call while generating a response. You\ncan specify which tool to use by setting the `tool_choice` parameter.\n\nThe two categories of tools you can provide the model are:\n\n- **Built-in tools**: Tools that are provided by OpenAI that extend the\n  model's capabilities, like [web search](https://platform.openai.com/docs/guides/tools-web-search)\n  or [file search](https://platform.openai.com/docs/guides/tools-file-search). Learn more about\n  [built-in tools](https://platform.openai.com/docs/guides/tools).\n- **Function calls (custom tools)**: Functions that are defined by you,\n  enabling the model to call your own code with strongly typed arguments\n  and outputs. Learn more about\n  [function calling](https://platform.openai.com/docs/guides/function-calling). You can also use\n  custom tools to call your own code.\n"]
11121    #[serde(rename = "tools")]
11122    #[serde(skip_serializing_if = "Option::is_none")]
11123    #[builder(default)]
11124    pub tools: Option<Vec<crate::__types::Tool>>,
11125    #[doc = "How the model should select which tool (or tools) to use when generating\na response. See the `tools` parameter to see how to specify which tools\nthe model can call.\n"]
11126    #[serde(rename = "tool_choice")]
11127    #[serde(skip_serializing_if = "Option::is_none")]
11128    #[builder(default)]
11129    pub tool_choice: Option<crate::__types::create_response::ToolChoice>,
11130    #[serde(rename = "prompt")]
11131    #[serde(skip_serializing_if = "Option::is_none")]
11132    #[builder(default)]
11133    pub prompt: Option<crate::__types::Prompt>,
11134    #[doc = "The truncation strategy to use for the model response.\n- `auto`: If the context of this response and previous ones exceeds\n  the model's context window size, the model will truncate the\n  response to fit the context window by dropping input items in the\n  middle of the conversation.\n- `disabled` (default): If a model response will exceed the context window\n  size for a model, the request will fail with a 400 error.\n"]
11135    #[serde(rename = "truncation")]
11136    #[serde(skip_serializing_if = "Option::is_none")]
11137    #[builder(default)]
11138    pub truncation: Option<crate::__types::create_response::Truncation>,
11139    #[doc = "Text, image, or file inputs to the model, used to generate a response.\n\nLearn more:\n- [Text inputs and outputs](https://platform.openai.com/docs/guides/text)\n- [Image inputs](https://platform.openai.com/docs/guides/images)\n- [File inputs](https://platform.openai.com/docs/guides/pdf-files)\n- [Conversation state](https://platform.openai.com/docs/guides/conversation-state)\n- [Function calling](https://platform.openai.com/docs/guides/function-calling)\n"]
11140    #[serde(rename = "input")]
11141    #[serde(skip_serializing_if = "Option::is_none")]
11142    #[builder(default)]
11143    pub input: Option<crate::__types::create_response::Input>,
11144    #[doc = "Specify additional output data to include in the model response. Currently\nsupported values are:\n- `code_interpreter_call.outputs`: Includes the outputs of python code execution\n  in code interpreter tool call items.\n- `computer_call_output.output.image_url`: Include image urls from the computer call output.\n- `file_search_call.results`: Include the search results of\n  the file search tool call.\n- `message.input_image.image_url`: Include image urls from the input message.\n- `message.output_text.logprobs`: Include logprobs with assistant messages.\n- `reasoning.encrypted_content`: Includes an encrypted version of reasoning\n  tokens in reasoning item outputs. This enables reasoning items to be used in\n  multi-turn conversations when using the Responses API statelessly (like\n  when the `store` parameter is set to `false`, or when an organization is\n  enrolled in the zero data retention program).\n"]
11145    #[serde(rename = "include")]
11146    #[serde(skip_serializing_if = "Option::is_none")]
11147    #[builder(default)]
11148    pub include: Option<Vec<crate::__types::Includable>>,
11149    #[doc = "Whether to allow the model to run tool calls in parallel.\n"]
11150    #[serde(rename = "parallel_tool_calls")]
11151    #[serde(skip_serializing_if = "Option::is_none")]
11152    #[builder(default)]
11153    pub parallel_tool_calls: Option<bool>,
11154    #[doc = "Whether to store the generated model response for later retrieval via\nAPI.\n"]
11155    #[serde(rename = "store")]
11156    #[serde(skip_serializing_if = "Option::is_none")]
11157    #[builder(default)]
11158    pub store: Option<bool>,
11159    #[doc = "A system (or developer) message inserted into the model's context.\n\nWhen using along with `previous_response_id`, the instructions from a previous\nresponse will not be carried over to the next response. This makes it simple\nto swap out system (or developer) messages in new responses.\n"]
11160    #[serde(rename = "instructions")]
11161    #[serde(skip_serializing_if = "Option::is_none")]
11162    #[builder(default)]
11163    pub instructions: Option<String>,
11164    #[doc = "If set to true, the model response data will be streamed to the client\nas 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).\nSee the [Streaming section below](https://platform.openai.com/docs/api-reference/responses-streaming)\nfor more information.\n"]
11165    #[serde(rename = "stream")]
11166    #[serde(skip_serializing_if = "Option::is_none")]
11167    #[builder(default)]
11168    pub stream: Option<bool>,
11169    #[serde(rename = "stream_options")]
11170    #[serde(skip_serializing_if = "Option::is_none")]
11171    #[builder(default)]
11172    pub stream_options: Option<crate::__types::ResponseStreamOptions>,
11173    #[doc = "The conversation that this response belongs to. Items from this conversation are prepended to `input_items` for this response request.\nInput items and output items from this response are automatically added to this conversation after this response completes.\n"]
11174    #[serde(rename = "conversation")]
11175    #[serde(skip_serializing_if = "Option::is_none")]
11176    #[builder(default)]
11177    pub conversation: Option<crate::__types::create_response::Conversation>,
11178}
11179#[allow(clippy::module_inception)]
11180pub mod create_run_request {
11181    #[doc = "The ID of the [Model](https://platform.openai.com/docs/api-reference/models) to be used to execute this run. If a value is provided here, it will override the model associated with the assistant. If not, the model associated with the assistant will be used."]
11182    #[derive(Clone, Debug, PartialEq)]
11183    #[allow(clippy::large_enum_variant)]
11184    pub enum Model {
11185        Other(String),
11186        AssistantSupportedModels(crate::__types::AssistantSupportedModels),
11187    }
11188    impl<'de> serde::Deserialize<'de> for Model {
11189        fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
11190        where
11191            D: serde::Deserializer<'de>,
11192        {
11193            #[serde_with::serde_as]
11194            #[derive(serde :: Deserialize)]
11195            #[serde(untagged)]
11196            #[allow(clippy::enum_variant_names, clippy::large_enum_variant)]
11197            enum Model {
11198                AssistantSupportedModels(crate::__types::AssistantSupportedModels),
11199                Other(String),
11200            }
11201            Ok(match Model::deserialize(deserializer)? {
11202                Model::Other(v) => Self::Other(v),
11203                Model::AssistantSupportedModels(v) => Self::AssistantSupportedModels(v),
11204            })
11205        }
11206    }
11207    impl serde::Serialize for Model {
11208        fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
11209        where
11210            S: serde::Serializer,
11211        {
11212            #[serde_with::serde_as]
11213            #[derive(serde :: Serialize)]
11214            #[serde(untagged)]
11215            #[allow(clippy::enum_variant_names)]
11216            enum Model<'a> {
11217                Other(&'a String),
11218                AssistantSupportedModels(&'a crate::__types::AssistantSupportedModels),
11219            }
11220            match self {
11221                Self::Other(v) => Model::Other(v),
11222                Self::AssistantSupportedModels(v) => Model::AssistantSupportedModels(v),
11223            }
11224            .serialize(serializer)
11225        }
11226    }
11227}
11228#[derive(Clone, Debug, PartialEq)]
11229#[serde_with::serde_as]
11230#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
11231pub struct CreateRunRequest {
11232    #[doc = "The ID of the [assistant](https://platform.openai.com/docs/api-reference/assistants) to use to execute this run."]
11233    #[serde(rename = "assistant_id")]
11234    pub assistant_id: String,
11235    #[doc = "The ID of the [Model](https://platform.openai.com/docs/api-reference/models) to be used to execute this run. If a value is provided here, it will override the model associated with the assistant. If not, the model associated with the assistant will be used."]
11236    #[serde(rename = "model")]
11237    #[serde(skip_serializing_if = "Option::is_none")]
11238    #[builder(default)]
11239    pub model: Option<crate::__types::create_run_request::Model>,
11240    #[serde(rename = "reasoning_effort")]
11241    #[serde(skip_serializing_if = "Option::is_none")]
11242    #[builder(default)]
11243    pub reasoning_effort: Option<crate::__types::ReasoningEffort>,
11244    #[doc = "Overrides the [instructions](https://platform.openai.com/docs/api-reference/assistants/createAssistant) of the assistant. This is useful for modifying the behavior on a per-run basis."]
11245    #[serde(rename = "instructions")]
11246    #[serde(skip_serializing_if = "Option::is_none")]
11247    #[builder(default)]
11248    pub instructions: Option<String>,
11249    #[doc = "Appends additional instructions at the end of the instructions for the run. This is useful for modifying the behavior on a per-run basis without overriding other instructions."]
11250    #[serde(rename = "additional_instructions")]
11251    #[serde(skip_serializing_if = "Option::is_none")]
11252    #[builder(default)]
11253    pub additional_instructions: Option<String>,
11254    #[doc = "Adds additional messages to the thread before creating the run."]
11255    #[serde(rename = "additional_messages")]
11256    #[serde(skip_serializing_if = "Option::is_none")]
11257    #[builder(default)]
11258    pub additional_messages: Option<Vec<crate::__types::CreateMessageRequest>>,
11259    #[doc = "Override the tools the assistant can use for this run. This is useful for modifying the behavior on a per-run basis."]
11260    #[serde(rename = "tools")]
11261    #[serde(skip_serializing_if = "Option::is_none")]
11262    #[builder(default)]
11263    pub tools: Option<Vec<crate::__types::AssistantTool>>,
11264    #[serde(rename = "metadata")]
11265    #[serde(skip_serializing_if = "Option::is_none")]
11266    #[builder(default)]
11267    pub metadata: Option<crate::__types::Metadata>,
11268    #[doc = "What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.\n"]
11269    #[serde(rename = "temperature")]
11270    #[serde(skip_serializing_if = "Option::is_none")]
11271    #[builder(default)]
11272    pub temperature: Option<serde_json::Number>,
11273    #[doc = "An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.\n\nWe generally recommend altering this or temperature but not both.\n"]
11274    #[serde(rename = "top_p")]
11275    #[serde(skip_serializing_if = "Option::is_none")]
11276    #[builder(default)]
11277    pub top_p: Option<serde_json::Number>,
11278    #[doc = "If `true`, returns a stream of events that happen during the Run as server-sent events, terminating when the Run enters a terminal state with a `data: [DONE]` message.\n"]
11279    #[serde(rename = "stream")]
11280    #[serde(skip_serializing_if = "Option::is_none")]
11281    #[builder(default)]
11282    pub stream: Option<bool>,
11283    #[doc = "The maximum number of prompt tokens that may be used over the course of the run. The run will make a best effort to use only the number of prompt tokens specified, across multiple turns of the run. If the run exceeds the number of prompt tokens specified, the run will end with status `incomplete`. See `incomplete_details` for more info.\n"]
11284    #[serde(rename = "max_prompt_tokens")]
11285    #[serde(skip_serializing_if = "Option::is_none")]
11286    #[builder(default)]
11287    pub max_prompt_tokens: Option<i64>,
11288    #[doc = "The maximum number of completion tokens that may be used over the course of the run. The run will make a best effort to use only the number of completion tokens specified, across multiple turns of the run. If the run exceeds the number of completion tokens specified, the run will end with status `incomplete`. See `incomplete_details` for more info.\n"]
11289    #[serde(rename = "max_completion_tokens")]
11290    #[serde(skip_serializing_if = "Option::is_none")]
11291    #[builder(default)]
11292    pub max_completion_tokens: Option<i64>,
11293    #[serde(rename = "truncation_strategy")]
11294    #[serde(skip_serializing_if = "Option::is_none")]
11295    #[builder(default)]
11296    pub truncation_strategy: Option<crate::__types::TruncationObject>,
11297    #[serde(rename = "tool_choice")]
11298    #[serde(skip_serializing_if = "Option::is_none")]
11299    #[builder(default)]
11300    pub tool_choice: Option<crate::__types::AssistantsApiToolChoiceOption>,
11301    #[serde(rename = "parallel_tool_calls")]
11302    #[serde(skip_serializing_if = "Option::is_none")]
11303    #[builder(default)]
11304    pub parallel_tool_calls: Option<crate::__types::ParallelToolCalls>,
11305    #[serde(rename = "response_format")]
11306    #[serde(skip_serializing_if = "Option::is_none")]
11307    #[builder(default)]
11308    pub response_format: Option<crate::__types::AssistantsApiResponseFormatOption>,
11309}
11310#[allow(clippy::module_inception)]
11311pub mod create_speech_request {
11312    #[allow(clippy::module_inception)]
11313    pub(crate) mod model {
11314        #[doc = "tts-1"]
11315        #[derive(Clone, Copy, Debug, Default, PartialEq)]
11316        pub(crate) struct Tts1;
11317        impl_serde!(Tts1, "tts-1");
11318        #[doc = "tts-1-hd"]
11319        #[derive(Clone, Copy, Debug, Default, PartialEq)]
11320        pub(crate) struct Tts1Hd;
11321        impl_serde!(Tts1Hd, "tts-1-hd");
11322        #[doc = "gpt-4o-mini-tts"]
11323        #[derive(Clone, Copy, Debug, Default, PartialEq)]
11324        pub(crate) struct Gpt4oMiniTts;
11325        impl_serde!(Gpt4oMiniTts, "gpt-4o-mini-tts");
11326    }
11327    #[doc = "One of the available [TTS models](https://platform.openai.com/docs/models#tts): `tts-1`, `tts-1-hd` or `gpt-4o-mini-tts`.\n"]
11328    #[derive(Clone, Debug, PartialEq)]
11329    #[allow(clippy::large_enum_variant)]
11330    pub enum Model {
11331        Other(String),
11332        #[doc = "tts-1"]
11333        Tts1,
11334        #[doc = "tts-1-hd"]
11335        Tts1Hd,
11336        #[doc = "gpt-4o-mini-tts"]
11337        Gpt4oMiniTts,
11338    }
11339    impl<'de> serde::Deserialize<'de> for Model {
11340        fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
11341        where
11342            D: serde::Deserializer<'de>,
11343        {
11344            #[serde_with::serde_as]
11345            #[derive(serde :: Deserialize)]
11346            #[serde(untagged)]
11347            #[allow(clippy::enum_variant_names, clippy::large_enum_variant)]
11348            enum Model {
11349                Tts1(crate::__types::create_speech_request::model::Tts1),
11350                Tts1Hd(crate::__types::create_speech_request::model::Tts1Hd),
11351                Gpt4oMiniTts(crate::__types::create_speech_request::model::Gpt4oMiniTts),
11352                Other(String),
11353            }
11354            Ok(match Model::deserialize(deserializer)? {
11355                Model::Other(v) => Self::Other(v),
11356                Model::Tts1(_) => Self::Tts1,
11357                Model::Tts1Hd(_) => Self::Tts1Hd,
11358                Model::Gpt4oMiniTts(_) => Self::Gpt4oMiniTts,
11359            })
11360        }
11361    }
11362    impl serde::Serialize for Model {
11363        fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
11364        where
11365            S: serde::Serializer,
11366        {
11367            #[serde_with::serde_as]
11368            #[derive(serde :: Serialize)]
11369            #[serde(untagged)]
11370            #[allow(clippy::enum_variant_names)]
11371            enum Model<'a> {
11372                Other(&'a String),
11373                Tts1(crate::__types::create_speech_request::model::Tts1),
11374                Tts1Hd(crate::__types::create_speech_request::model::Tts1Hd),
11375                Gpt4oMiniTts(crate::__types::create_speech_request::model::Gpt4oMiniTts),
11376            }
11377            match self {
11378                Self::Other(v) => Model::Other(v),
11379                Self::Tts1 => Model::Tts1(Default::default()),
11380                Self::Tts1Hd => Model::Tts1Hd(Default::default()),
11381                Self::Gpt4oMiniTts => Model::Gpt4oMiniTts(Default::default()),
11382            }
11383            .serialize(serializer)
11384        }
11385    }
11386    #[doc = "The format to audio in. Supported formats are `mp3`, `opus`, `aac`, `flac`, `wav`, and `pcm`."]
11387    #[derive(Clone, Copy, Debug, Default, PartialEq, serde :: Deserialize, serde :: Serialize)]
11388    pub enum ResponseFormat {
11389        #[doc = "`mp3`"]
11390        #[default]
11391        #[serde(rename = "mp3")]
11392        Mp3,
11393        #[doc = "`opus`"]
11394        #[serde(rename = "opus")]
11395        Opus,
11396        #[doc = "`aac`"]
11397        #[serde(rename = "aac")]
11398        Aac,
11399        #[doc = "`flac`"]
11400        #[serde(rename = "flac")]
11401        Flac,
11402        #[doc = "`wav`"]
11403        #[serde(rename = "wav")]
11404        Wav,
11405        #[doc = "`pcm`"]
11406        #[serde(rename = "pcm")]
11407        Pcm,
11408    }
11409    #[doc = "The format to stream the audio in. Supported formats are `sse` and `audio`. `sse` is not supported for `tts-1` or `tts-1-hd`."]
11410    #[derive(Clone, Copy, Debug, Default, PartialEq, serde :: Deserialize, serde :: Serialize)]
11411    pub enum StreamFormat {
11412        #[doc = "`sse`"]
11413        #[serde(rename = "sse")]
11414        Sse,
11415        #[doc = "`audio`"]
11416        #[default]
11417        #[serde(rename = "audio")]
11418        Audio,
11419    }
11420}
11421#[derive(Clone, Debug, PartialEq)]
11422#[serde_with::serde_as]
11423#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
11424pub struct CreateSpeechRequest {
11425    #[doc = "One of the available [TTS models](https://platform.openai.com/docs/models#tts): `tts-1`, `tts-1-hd` or `gpt-4o-mini-tts`.\n"]
11426    #[serde(rename = "model")]
11427    pub model: crate::__types::create_speech_request::Model,
11428    #[doc = "The text to generate audio for. The maximum length is 4096 characters."]
11429    #[serde(rename = "input")]
11430    pub input: String,
11431    #[doc = "Control the voice of your generated audio with additional instructions. Does not work with `tts-1` or `tts-1-hd`."]
11432    #[serde(rename = "instructions")]
11433    #[serde(skip_serializing_if = "Option::is_none")]
11434    #[builder(default)]
11435    pub instructions: Option<String>,
11436    #[doc = "The voice to use when generating the audio. Supported voices are `alloy`, `ash`, `ballad`, `coral`, `echo`, `fable`, `onyx`, `nova`, `sage`, `shimmer`, and `verse`. Previews of the voices are available in the [Text to speech guide](https://platform.openai.com/docs/guides/text-to-speech#voice-options)."]
11437    #[serde(rename = "voice")]
11438    pub voice: crate::__types::VoiceIdsShared,
11439    #[doc = "The format to audio in. Supported formats are `mp3`, `opus`, `aac`, `flac`, `wav`, and `pcm`."]
11440    #[serde(rename = "response_format")]
11441    #[serde(skip_serializing_if = "Option::is_none")]
11442    #[builder(default)]
11443    pub response_format: Option<crate::__types::create_speech_request::ResponseFormat>,
11444    #[doc = "The speed of the generated audio. Select a value from `0.25` to `4.0`. `1.0` is the default."]
11445    #[serde(rename = "speed")]
11446    #[serde(skip_serializing_if = "Option::is_none")]
11447    #[builder(default)]
11448    pub speed: Option<serde_json::Number>,
11449    #[doc = "The format to stream the audio in. Supported formats are `sse` and `audio`. `sse` is not supported for `tts-1` or `tts-1-hd`."]
11450    #[serde(rename = "stream_format")]
11451    #[serde(skip_serializing_if = "Option::is_none")]
11452    #[builder(default)]
11453    pub stream_format: Option<crate::__types::create_speech_request::StreamFormat>,
11454}
11455#[derive(Clone, Debug, PartialEq)]
11456#[serde_with::serde_as]
11457#[derive(serde :: Deserialize, serde :: Serialize)]
11458#[serde(untagged)]
11459#[allow(clippy::large_enum_variant)]
11460pub enum CreateSpeechResponseStreamEvent {
11461    SpeechAudioDelta(crate::__types::SpeechAudioDeltaEvent),
11462    SpeechAudioDone(crate::__types::SpeechAudioDoneEvent),
11463}
11464#[allow(clippy::module_inception)]
11465pub mod create_thread_and_run_request {
11466    #[allow(clippy::module_inception)]
11467    pub(crate) mod model {
11468        #[doc = "gpt-5"]
11469        #[derive(Clone, Copy, Debug, Default, PartialEq)]
11470        pub(crate) struct Gpt5;
11471        impl_serde!(Gpt5, "gpt-5");
11472        #[doc = "gpt-5-mini"]
11473        #[derive(Clone, Copy, Debug, Default, PartialEq)]
11474        pub(crate) struct Gpt5Mini;
11475        impl_serde!(Gpt5Mini, "gpt-5-mini");
11476        #[doc = "gpt-5-nano"]
11477        #[derive(Clone, Copy, Debug, Default, PartialEq)]
11478        pub(crate) struct Gpt5Nano;
11479        impl_serde!(Gpt5Nano, "gpt-5-nano");
11480        #[doc = "gpt-5-2025-08-07"]
11481        #[derive(Clone, Copy, Debug, Default, PartialEq)]
11482        pub(crate) struct Gpt5_2025_08_07;
11483        impl_serde!(Gpt5_2025_08_07, "gpt-5-2025-08-07");
11484        #[doc = "gpt-5-mini-2025-08-07"]
11485        #[derive(Clone, Copy, Debug, Default, PartialEq)]
11486        pub(crate) struct Gpt5Mini2025_08_07;
11487        impl_serde!(Gpt5Mini2025_08_07, "gpt-5-mini-2025-08-07");
11488        #[doc = "gpt-5-nano-2025-08-07"]
11489        #[derive(Clone, Copy, Debug, Default, PartialEq)]
11490        pub(crate) struct Gpt5Nano2025_08_07;
11491        impl_serde!(Gpt5Nano2025_08_07, "gpt-5-nano-2025-08-07");
11492        #[doc = "gpt-4.1"]
11493        #[derive(Clone, Copy, Debug, Default, PartialEq)]
11494        pub(crate) struct Gpt4_1;
11495        impl_serde!(Gpt4_1, "gpt-4.1");
11496        #[doc = "gpt-4.1-mini"]
11497        #[derive(Clone, Copy, Debug, Default, PartialEq)]
11498        pub(crate) struct Gpt4_1Mini;
11499        impl_serde!(Gpt4_1Mini, "gpt-4.1-mini");
11500        #[doc = "gpt-4.1-nano"]
11501        #[derive(Clone, Copy, Debug, Default, PartialEq)]
11502        pub(crate) struct Gpt4_1Nano;
11503        impl_serde!(Gpt4_1Nano, "gpt-4.1-nano");
11504        #[doc = "gpt-4.1-2025-04-14"]
11505        #[derive(Clone, Copy, Debug, Default, PartialEq)]
11506        pub(crate) struct Gpt4_1_2025_04_14;
11507        impl_serde!(Gpt4_1_2025_04_14, "gpt-4.1-2025-04-14");
11508        #[doc = "gpt-4.1-mini-2025-04-14"]
11509        #[derive(Clone, Copy, Debug, Default, PartialEq)]
11510        pub(crate) struct Gpt4_1Mini2025_04_14;
11511        impl_serde!(Gpt4_1Mini2025_04_14, "gpt-4.1-mini-2025-04-14");
11512        #[doc = "gpt-4.1-nano-2025-04-14"]
11513        #[derive(Clone, Copy, Debug, Default, PartialEq)]
11514        pub(crate) struct Gpt4_1Nano2025_04_14;
11515        impl_serde!(Gpt4_1Nano2025_04_14, "gpt-4.1-nano-2025-04-14");
11516        #[doc = "gpt-4o"]
11517        #[derive(Clone, Copy, Debug, Default, PartialEq)]
11518        pub(crate) struct Gpt4o;
11519        impl_serde!(Gpt4o, "gpt-4o");
11520        #[doc = "gpt-4o-2024-11-20"]
11521        #[derive(Clone, Copy, Debug, Default, PartialEq)]
11522        pub(crate) struct Gpt4o2024_11_20;
11523        impl_serde!(Gpt4o2024_11_20, "gpt-4o-2024-11-20");
11524        #[doc = "gpt-4o-2024-08-06"]
11525        #[derive(Clone, Copy, Debug, Default, PartialEq)]
11526        pub(crate) struct Gpt4o2024_08_06;
11527        impl_serde!(Gpt4o2024_08_06, "gpt-4o-2024-08-06");
11528        #[doc = "gpt-4o-2024-05-13"]
11529        #[derive(Clone, Copy, Debug, Default, PartialEq)]
11530        pub(crate) struct Gpt4o2024_05_13;
11531        impl_serde!(Gpt4o2024_05_13, "gpt-4o-2024-05-13");
11532        #[doc = "gpt-4o-mini"]
11533        #[derive(Clone, Copy, Debug, Default, PartialEq)]
11534        pub(crate) struct Gpt4oMini;
11535        impl_serde!(Gpt4oMini, "gpt-4o-mini");
11536        #[doc = "gpt-4o-mini-2024-07-18"]
11537        #[derive(Clone, Copy, Debug, Default, PartialEq)]
11538        pub(crate) struct Gpt4oMini2024_07_18;
11539        impl_serde!(Gpt4oMini2024_07_18, "gpt-4o-mini-2024-07-18");
11540        #[doc = "gpt-4.5-preview"]
11541        #[derive(Clone, Copy, Debug, Default, PartialEq)]
11542        pub(crate) struct Gpt4_5Preview;
11543        impl_serde!(Gpt4_5Preview, "gpt-4.5-preview");
11544        #[doc = "gpt-4.5-preview-2025-02-27"]
11545        #[derive(Clone, Copy, Debug, Default, PartialEq)]
11546        pub(crate) struct Gpt4_5Preview2025_02_27;
11547        impl_serde!(Gpt4_5Preview2025_02_27, "gpt-4.5-preview-2025-02-27");
11548        #[doc = "gpt-4-turbo"]
11549        #[derive(Clone, Copy, Debug, Default, PartialEq)]
11550        pub(crate) struct Gpt4Turbo;
11551        impl_serde!(Gpt4Turbo, "gpt-4-turbo");
11552        #[doc = "gpt-4-turbo-2024-04-09"]
11553        #[derive(Clone, Copy, Debug, Default, PartialEq)]
11554        pub(crate) struct Gpt4Turbo2024_04_09;
11555        impl_serde!(Gpt4Turbo2024_04_09, "gpt-4-turbo-2024-04-09");
11556        #[doc = "gpt-4-0125-preview"]
11557        #[derive(Clone, Copy, Debug, Default, PartialEq)]
11558        pub(crate) struct Gpt4_0125Preview;
11559        impl_serde!(Gpt4_0125Preview, "gpt-4-0125-preview");
11560        #[doc = "gpt-4-turbo-preview"]
11561        #[derive(Clone, Copy, Debug, Default, PartialEq)]
11562        pub(crate) struct Gpt4TurboPreview;
11563        impl_serde!(Gpt4TurboPreview, "gpt-4-turbo-preview");
11564        #[doc = "gpt-4-1106-preview"]
11565        #[derive(Clone, Copy, Debug, Default, PartialEq)]
11566        pub(crate) struct Gpt4_1106Preview;
11567        impl_serde!(Gpt4_1106Preview, "gpt-4-1106-preview");
11568        #[doc = "gpt-4-vision-preview"]
11569        #[derive(Clone, Copy, Debug, Default, PartialEq)]
11570        pub(crate) struct Gpt4VisionPreview;
11571        impl_serde!(Gpt4VisionPreview, "gpt-4-vision-preview");
11572        #[doc = "gpt-4"]
11573        #[derive(Clone, Copy, Debug, Default, PartialEq)]
11574        pub(crate) struct Gpt4;
11575        impl_serde!(Gpt4, "gpt-4");
11576        #[doc = "gpt-4-0314"]
11577        #[derive(Clone, Copy, Debug, Default, PartialEq)]
11578        pub(crate) struct Gpt4_0314;
11579        impl_serde!(Gpt4_0314, "gpt-4-0314");
11580        #[doc = "gpt-4-0613"]
11581        #[derive(Clone, Copy, Debug, Default, PartialEq)]
11582        pub(crate) struct Gpt4_0613;
11583        impl_serde!(Gpt4_0613, "gpt-4-0613");
11584        #[doc = "gpt-4-32k"]
11585        #[derive(Clone, Copy, Debug, Default, PartialEq)]
11586        pub(crate) struct Gpt4_32k;
11587        impl_serde!(Gpt4_32k, "gpt-4-32k");
11588        #[doc = "gpt-4-32k-0314"]
11589        #[derive(Clone, Copy, Debug, Default, PartialEq)]
11590        pub(crate) struct Gpt4_32k0314;
11591        impl_serde!(Gpt4_32k0314, "gpt-4-32k-0314");
11592        #[doc = "gpt-4-32k-0613"]
11593        #[derive(Clone, Copy, Debug, Default, PartialEq)]
11594        pub(crate) struct Gpt4_32k0613;
11595        impl_serde!(Gpt4_32k0613, "gpt-4-32k-0613");
11596        #[doc = "gpt-3.5-turbo"]
11597        #[derive(Clone, Copy, Debug, Default, PartialEq)]
11598        pub(crate) struct Gpt3_5Turbo;
11599        impl_serde!(Gpt3_5Turbo, "gpt-3.5-turbo");
11600        #[doc = "gpt-3.5-turbo-16k"]
11601        #[derive(Clone, Copy, Debug, Default, PartialEq)]
11602        pub(crate) struct Gpt3_5Turbo16k;
11603        impl_serde!(Gpt3_5Turbo16k, "gpt-3.5-turbo-16k");
11604        #[doc = "gpt-3.5-turbo-0613"]
11605        #[derive(Clone, Copy, Debug, Default, PartialEq)]
11606        pub(crate) struct Gpt3_5Turbo0613;
11607        impl_serde!(Gpt3_5Turbo0613, "gpt-3.5-turbo-0613");
11608        #[doc = "gpt-3.5-turbo-1106"]
11609        #[derive(Clone, Copy, Debug, Default, PartialEq)]
11610        pub(crate) struct Gpt3_5Turbo1106;
11611        impl_serde!(Gpt3_5Turbo1106, "gpt-3.5-turbo-1106");
11612        #[doc = "gpt-3.5-turbo-0125"]
11613        #[derive(Clone, Copy, Debug, Default, PartialEq)]
11614        pub(crate) struct Gpt3_5Turbo0125;
11615        impl_serde!(Gpt3_5Turbo0125, "gpt-3.5-turbo-0125");
11616        #[doc = "gpt-3.5-turbo-16k-0613"]
11617        #[derive(Clone, Copy, Debug, Default, PartialEq)]
11618        pub(crate) struct Gpt3_5Turbo16k0613;
11619        impl_serde!(Gpt3_5Turbo16k0613, "gpt-3.5-turbo-16k-0613");
11620    }
11621    #[doc = "The ID of the [Model](https://platform.openai.com/docs/api-reference/models) to be used to execute this run. If a value is provided here, it will override the model associated with the assistant. If not, the model associated with the assistant will be used."]
11622    #[derive(Clone, Debug, PartialEq)]
11623    #[allow(clippy::large_enum_variant)]
11624    pub enum Model {
11625        Other(String),
11626        #[doc = "gpt-5"]
11627        Gpt5,
11628        #[doc = "gpt-5-mini"]
11629        Gpt5Mini,
11630        #[doc = "gpt-5-nano"]
11631        Gpt5Nano,
11632        #[doc = "gpt-5-2025-08-07"]
11633        Gpt5_2025_08_07,
11634        #[doc = "gpt-5-mini-2025-08-07"]
11635        Gpt5Mini2025_08_07,
11636        #[doc = "gpt-5-nano-2025-08-07"]
11637        Gpt5Nano2025_08_07,
11638        #[doc = "gpt-4.1"]
11639        Gpt4_1,
11640        #[doc = "gpt-4.1-mini"]
11641        Gpt4_1Mini,
11642        #[doc = "gpt-4.1-nano"]
11643        Gpt4_1Nano,
11644        #[doc = "gpt-4.1-2025-04-14"]
11645        Gpt4_1_2025_04_14,
11646        #[doc = "gpt-4.1-mini-2025-04-14"]
11647        Gpt4_1Mini2025_04_14,
11648        #[doc = "gpt-4.1-nano-2025-04-14"]
11649        Gpt4_1Nano2025_04_14,
11650        #[doc = "gpt-4o"]
11651        Gpt4o,
11652        #[doc = "gpt-4o-2024-11-20"]
11653        Gpt4o2024_11_20,
11654        #[doc = "gpt-4o-2024-08-06"]
11655        Gpt4o2024_08_06,
11656        #[doc = "gpt-4o-2024-05-13"]
11657        Gpt4o2024_05_13,
11658        #[doc = "gpt-4o-mini"]
11659        Gpt4oMini,
11660        #[doc = "gpt-4o-mini-2024-07-18"]
11661        Gpt4oMini2024_07_18,
11662        #[doc = "gpt-4.5-preview"]
11663        Gpt4_5Preview,
11664        #[doc = "gpt-4.5-preview-2025-02-27"]
11665        Gpt4_5Preview2025_02_27,
11666        #[doc = "gpt-4-turbo"]
11667        Gpt4Turbo,
11668        #[doc = "gpt-4-turbo-2024-04-09"]
11669        Gpt4Turbo2024_04_09,
11670        #[doc = "gpt-4-0125-preview"]
11671        Gpt4_0125Preview,
11672        #[doc = "gpt-4-turbo-preview"]
11673        Gpt4TurboPreview,
11674        #[doc = "gpt-4-1106-preview"]
11675        Gpt4_1106Preview,
11676        #[doc = "gpt-4-vision-preview"]
11677        Gpt4VisionPreview,
11678        #[doc = "gpt-4"]
11679        Gpt4,
11680        #[doc = "gpt-4-0314"]
11681        Gpt4_0314,
11682        #[doc = "gpt-4-0613"]
11683        Gpt4_0613,
11684        #[doc = "gpt-4-32k"]
11685        Gpt4_32k,
11686        #[doc = "gpt-4-32k-0314"]
11687        Gpt4_32k0314,
11688        #[doc = "gpt-4-32k-0613"]
11689        Gpt4_32k0613,
11690        #[doc = "gpt-3.5-turbo"]
11691        Gpt3_5Turbo,
11692        #[doc = "gpt-3.5-turbo-16k"]
11693        Gpt3_5Turbo16k,
11694        #[doc = "gpt-3.5-turbo-0613"]
11695        Gpt3_5Turbo0613,
11696        #[doc = "gpt-3.5-turbo-1106"]
11697        Gpt3_5Turbo1106,
11698        #[doc = "gpt-3.5-turbo-0125"]
11699        Gpt3_5Turbo0125,
11700        #[doc = "gpt-3.5-turbo-16k-0613"]
11701        Gpt3_5Turbo16k0613,
11702    }
11703    impl<'de> serde::Deserialize<'de> for Model {
11704        fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
11705        where
11706            D: serde::Deserializer<'de>,
11707        {
11708            #[serde_with::serde_as]
11709            #[derive(serde :: Deserialize)]
11710            #[serde(untagged)]
11711            #[allow(clippy::enum_variant_names, clippy::large_enum_variant)]
11712            enum Model {
11713                Gpt5(crate::__types::create_thread_and_run_request::model::Gpt5),
11714                Gpt5Mini(crate::__types::create_thread_and_run_request::model::Gpt5Mini),
11715                Gpt5Nano(crate::__types::create_thread_and_run_request::model::Gpt5Nano),
11716                Gpt5_2025_08_07(
11717                    crate::__types::create_thread_and_run_request::model::Gpt5_2025_08_07,
11718                ),
11719                Gpt5Mini2025_08_07(
11720                    crate::__types::create_thread_and_run_request::model::Gpt5Mini2025_08_07,
11721                ),
11722                Gpt5Nano2025_08_07(
11723                    crate::__types::create_thread_and_run_request::model::Gpt5Nano2025_08_07,
11724                ),
11725                Gpt4_1(crate::__types::create_thread_and_run_request::model::Gpt4_1),
11726                Gpt4_1Mini(crate::__types::create_thread_and_run_request::model::Gpt4_1Mini),
11727                Gpt4_1Nano(crate::__types::create_thread_and_run_request::model::Gpt4_1Nano),
11728                Gpt4_1_2025_04_14(
11729                    crate::__types::create_thread_and_run_request::model::Gpt4_1_2025_04_14,
11730                ),
11731                Gpt4_1Mini2025_04_14(
11732                    crate::__types::create_thread_and_run_request::model::Gpt4_1Mini2025_04_14,
11733                ),
11734                Gpt4_1Nano2025_04_14(
11735                    crate::__types::create_thread_and_run_request::model::Gpt4_1Nano2025_04_14,
11736                ),
11737                Gpt4o(crate::__types::create_thread_and_run_request::model::Gpt4o),
11738                Gpt4o2024_11_20(
11739                    crate::__types::create_thread_and_run_request::model::Gpt4o2024_11_20,
11740                ),
11741                Gpt4o2024_08_06(
11742                    crate::__types::create_thread_and_run_request::model::Gpt4o2024_08_06,
11743                ),
11744                Gpt4o2024_05_13(
11745                    crate::__types::create_thread_and_run_request::model::Gpt4o2024_05_13,
11746                ),
11747                Gpt4oMini(crate::__types::create_thread_and_run_request::model::Gpt4oMini),
11748                Gpt4oMini2024_07_18(
11749                    crate::__types::create_thread_and_run_request::model::Gpt4oMini2024_07_18,
11750                ),
11751                Gpt4_5Preview(crate::__types::create_thread_and_run_request::model::Gpt4_5Preview),
11752                Gpt4_5Preview2025_02_27(
11753                    crate::__types::create_thread_and_run_request::model::Gpt4_5Preview2025_02_27,
11754                ),
11755                Gpt4Turbo(crate::__types::create_thread_and_run_request::model::Gpt4Turbo),
11756                Gpt4Turbo2024_04_09(
11757                    crate::__types::create_thread_and_run_request::model::Gpt4Turbo2024_04_09,
11758                ),
11759                Gpt4_0125Preview(
11760                    crate::__types::create_thread_and_run_request::model::Gpt4_0125Preview,
11761                ),
11762                Gpt4TurboPreview(
11763                    crate::__types::create_thread_and_run_request::model::Gpt4TurboPreview,
11764                ),
11765                Gpt4_1106Preview(
11766                    crate::__types::create_thread_and_run_request::model::Gpt4_1106Preview,
11767                ),
11768                Gpt4VisionPreview(
11769                    crate::__types::create_thread_and_run_request::model::Gpt4VisionPreview,
11770                ),
11771                Gpt4(crate::__types::create_thread_and_run_request::model::Gpt4),
11772                Gpt4_0314(crate::__types::create_thread_and_run_request::model::Gpt4_0314),
11773                Gpt4_0613(crate::__types::create_thread_and_run_request::model::Gpt4_0613),
11774                Gpt4_32k(crate::__types::create_thread_and_run_request::model::Gpt4_32k),
11775                Gpt4_32k0314(crate::__types::create_thread_and_run_request::model::Gpt4_32k0314),
11776                Gpt4_32k0613(crate::__types::create_thread_and_run_request::model::Gpt4_32k0613),
11777                Gpt3_5Turbo(crate::__types::create_thread_and_run_request::model::Gpt3_5Turbo),
11778                Gpt3_5Turbo16k(
11779                    crate::__types::create_thread_and_run_request::model::Gpt3_5Turbo16k,
11780                ),
11781                Gpt3_5Turbo0613(
11782                    crate::__types::create_thread_and_run_request::model::Gpt3_5Turbo0613,
11783                ),
11784                Gpt3_5Turbo1106(
11785                    crate::__types::create_thread_and_run_request::model::Gpt3_5Turbo1106,
11786                ),
11787                Gpt3_5Turbo0125(
11788                    crate::__types::create_thread_and_run_request::model::Gpt3_5Turbo0125,
11789                ),
11790                Gpt3_5Turbo16k0613(
11791                    crate::__types::create_thread_and_run_request::model::Gpt3_5Turbo16k0613,
11792                ),
11793                Other(String),
11794            }
11795            Ok(match Model::deserialize(deserializer)? {
11796                Model::Other(v) => Self::Other(v),
11797                Model::Gpt5(_) => Self::Gpt5,
11798                Model::Gpt5Mini(_) => Self::Gpt5Mini,
11799                Model::Gpt5Nano(_) => Self::Gpt5Nano,
11800                Model::Gpt5_2025_08_07(_) => Self::Gpt5_2025_08_07,
11801                Model::Gpt5Mini2025_08_07(_) => Self::Gpt5Mini2025_08_07,
11802                Model::Gpt5Nano2025_08_07(_) => Self::Gpt5Nano2025_08_07,
11803                Model::Gpt4_1(_) => Self::Gpt4_1,
11804                Model::Gpt4_1Mini(_) => Self::Gpt4_1Mini,
11805                Model::Gpt4_1Nano(_) => Self::Gpt4_1Nano,
11806                Model::Gpt4_1_2025_04_14(_) => Self::Gpt4_1_2025_04_14,
11807                Model::Gpt4_1Mini2025_04_14(_) => Self::Gpt4_1Mini2025_04_14,
11808                Model::Gpt4_1Nano2025_04_14(_) => Self::Gpt4_1Nano2025_04_14,
11809                Model::Gpt4o(_) => Self::Gpt4o,
11810                Model::Gpt4o2024_11_20(_) => Self::Gpt4o2024_11_20,
11811                Model::Gpt4o2024_08_06(_) => Self::Gpt4o2024_08_06,
11812                Model::Gpt4o2024_05_13(_) => Self::Gpt4o2024_05_13,
11813                Model::Gpt4oMini(_) => Self::Gpt4oMini,
11814                Model::Gpt4oMini2024_07_18(_) => Self::Gpt4oMini2024_07_18,
11815                Model::Gpt4_5Preview(_) => Self::Gpt4_5Preview,
11816                Model::Gpt4_5Preview2025_02_27(_) => Self::Gpt4_5Preview2025_02_27,
11817                Model::Gpt4Turbo(_) => Self::Gpt4Turbo,
11818                Model::Gpt4Turbo2024_04_09(_) => Self::Gpt4Turbo2024_04_09,
11819                Model::Gpt4_0125Preview(_) => Self::Gpt4_0125Preview,
11820                Model::Gpt4TurboPreview(_) => Self::Gpt4TurboPreview,
11821                Model::Gpt4_1106Preview(_) => Self::Gpt4_1106Preview,
11822                Model::Gpt4VisionPreview(_) => Self::Gpt4VisionPreview,
11823                Model::Gpt4(_) => Self::Gpt4,
11824                Model::Gpt4_0314(_) => Self::Gpt4_0314,
11825                Model::Gpt4_0613(_) => Self::Gpt4_0613,
11826                Model::Gpt4_32k(_) => Self::Gpt4_32k,
11827                Model::Gpt4_32k0314(_) => Self::Gpt4_32k0314,
11828                Model::Gpt4_32k0613(_) => Self::Gpt4_32k0613,
11829                Model::Gpt3_5Turbo(_) => Self::Gpt3_5Turbo,
11830                Model::Gpt3_5Turbo16k(_) => Self::Gpt3_5Turbo16k,
11831                Model::Gpt3_5Turbo0613(_) => Self::Gpt3_5Turbo0613,
11832                Model::Gpt3_5Turbo1106(_) => Self::Gpt3_5Turbo1106,
11833                Model::Gpt3_5Turbo0125(_) => Self::Gpt3_5Turbo0125,
11834                Model::Gpt3_5Turbo16k0613(_) => Self::Gpt3_5Turbo16k0613,
11835            })
11836        }
11837    }
11838    impl serde::Serialize for Model {
11839        fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
11840        where
11841            S: serde::Serializer,
11842        {
11843            #[serde_with::serde_as]
11844            #[derive(serde :: Serialize)]
11845            #[serde(untagged)]
11846            #[allow(clippy::enum_variant_names)]
11847            enum Model<'a> {
11848                Other(&'a String),
11849                Gpt5(crate::__types::create_thread_and_run_request::model::Gpt5),
11850                Gpt5Mini(crate::__types::create_thread_and_run_request::model::Gpt5Mini),
11851                Gpt5Nano(crate::__types::create_thread_and_run_request::model::Gpt5Nano),
11852                Gpt5_2025_08_07(
11853                    crate::__types::create_thread_and_run_request::model::Gpt5_2025_08_07,
11854                ),
11855                Gpt5Mini2025_08_07(
11856                    crate::__types::create_thread_and_run_request::model::Gpt5Mini2025_08_07,
11857                ),
11858                Gpt5Nano2025_08_07(
11859                    crate::__types::create_thread_and_run_request::model::Gpt5Nano2025_08_07,
11860                ),
11861                Gpt4_1(crate::__types::create_thread_and_run_request::model::Gpt4_1),
11862                Gpt4_1Mini(crate::__types::create_thread_and_run_request::model::Gpt4_1Mini),
11863                Gpt4_1Nano(crate::__types::create_thread_and_run_request::model::Gpt4_1Nano),
11864                Gpt4_1_2025_04_14(
11865                    crate::__types::create_thread_and_run_request::model::Gpt4_1_2025_04_14,
11866                ),
11867                Gpt4_1Mini2025_04_14(
11868                    crate::__types::create_thread_and_run_request::model::Gpt4_1Mini2025_04_14,
11869                ),
11870                Gpt4_1Nano2025_04_14(
11871                    crate::__types::create_thread_and_run_request::model::Gpt4_1Nano2025_04_14,
11872                ),
11873                Gpt4o(crate::__types::create_thread_and_run_request::model::Gpt4o),
11874                Gpt4o2024_11_20(
11875                    crate::__types::create_thread_and_run_request::model::Gpt4o2024_11_20,
11876                ),
11877                Gpt4o2024_08_06(
11878                    crate::__types::create_thread_and_run_request::model::Gpt4o2024_08_06,
11879                ),
11880                Gpt4o2024_05_13(
11881                    crate::__types::create_thread_and_run_request::model::Gpt4o2024_05_13,
11882                ),
11883                Gpt4oMini(crate::__types::create_thread_and_run_request::model::Gpt4oMini),
11884                Gpt4oMini2024_07_18(
11885                    crate::__types::create_thread_and_run_request::model::Gpt4oMini2024_07_18,
11886                ),
11887                Gpt4_5Preview(crate::__types::create_thread_and_run_request::model::Gpt4_5Preview),
11888                Gpt4_5Preview2025_02_27(
11889                    crate::__types::create_thread_and_run_request::model::Gpt4_5Preview2025_02_27,
11890                ),
11891                Gpt4Turbo(crate::__types::create_thread_and_run_request::model::Gpt4Turbo),
11892                Gpt4Turbo2024_04_09(
11893                    crate::__types::create_thread_and_run_request::model::Gpt4Turbo2024_04_09,
11894                ),
11895                Gpt4_0125Preview(
11896                    crate::__types::create_thread_and_run_request::model::Gpt4_0125Preview,
11897                ),
11898                Gpt4TurboPreview(
11899                    crate::__types::create_thread_and_run_request::model::Gpt4TurboPreview,
11900                ),
11901                Gpt4_1106Preview(
11902                    crate::__types::create_thread_and_run_request::model::Gpt4_1106Preview,
11903                ),
11904                Gpt4VisionPreview(
11905                    crate::__types::create_thread_and_run_request::model::Gpt4VisionPreview,
11906                ),
11907                Gpt4(crate::__types::create_thread_and_run_request::model::Gpt4),
11908                Gpt4_0314(crate::__types::create_thread_and_run_request::model::Gpt4_0314),
11909                Gpt4_0613(crate::__types::create_thread_and_run_request::model::Gpt4_0613),
11910                Gpt4_32k(crate::__types::create_thread_and_run_request::model::Gpt4_32k),
11911                Gpt4_32k0314(crate::__types::create_thread_and_run_request::model::Gpt4_32k0314),
11912                Gpt4_32k0613(crate::__types::create_thread_and_run_request::model::Gpt4_32k0613),
11913                Gpt3_5Turbo(crate::__types::create_thread_and_run_request::model::Gpt3_5Turbo),
11914                Gpt3_5Turbo16k(
11915                    crate::__types::create_thread_and_run_request::model::Gpt3_5Turbo16k,
11916                ),
11917                Gpt3_5Turbo0613(
11918                    crate::__types::create_thread_and_run_request::model::Gpt3_5Turbo0613,
11919                ),
11920                Gpt3_5Turbo1106(
11921                    crate::__types::create_thread_and_run_request::model::Gpt3_5Turbo1106,
11922                ),
11923                Gpt3_5Turbo0125(
11924                    crate::__types::create_thread_and_run_request::model::Gpt3_5Turbo0125,
11925                ),
11926                Gpt3_5Turbo16k0613(
11927                    crate::__types::create_thread_and_run_request::model::Gpt3_5Turbo16k0613,
11928                ),
11929            }
11930            match self {
11931                Self::Other(v) => Model::Other(v),
11932                Self::Gpt5 => Model::Gpt5(Default::default()),
11933                Self::Gpt5Mini => Model::Gpt5Mini(Default::default()),
11934                Self::Gpt5Nano => Model::Gpt5Nano(Default::default()),
11935                Self::Gpt5_2025_08_07 => Model::Gpt5_2025_08_07(Default::default()),
11936                Self::Gpt5Mini2025_08_07 => Model::Gpt5Mini2025_08_07(Default::default()),
11937                Self::Gpt5Nano2025_08_07 => Model::Gpt5Nano2025_08_07(Default::default()),
11938                Self::Gpt4_1 => Model::Gpt4_1(Default::default()),
11939                Self::Gpt4_1Mini => Model::Gpt4_1Mini(Default::default()),
11940                Self::Gpt4_1Nano => Model::Gpt4_1Nano(Default::default()),
11941                Self::Gpt4_1_2025_04_14 => Model::Gpt4_1_2025_04_14(Default::default()),
11942                Self::Gpt4_1Mini2025_04_14 => Model::Gpt4_1Mini2025_04_14(Default::default()),
11943                Self::Gpt4_1Nano2025_04_14 => Model::Gpt4_1Nano2025_04_14(Default::default()),
11944                Self::Gpt4o => Model::Gpt4o(Default::default()),
11945                Self::Gpt4o2024_11_20 => Model::Gpt4o2024_11_20(Default::default()),
11946                Self::Gpt4o2024_08_06 => Model::Gpt4o2024_08_06(Default::default()),
11947                Self::Gpt4o2024_05_13 => Model::Gpt4o2024_05_13(Default::default()),
11948                Self::Gpt4oMini => Model::Gpt4oMini(Default::default()),
11949                Self::Gpt4oMini2024_07_18 => Model::Gpt4oMini2024_07_18(Default::default()),
11950                Self::Gpt4_5Preview => Model::Gpt4_5Preview(Default::default()),
11951                Self::Gpt4_5Preview2025_02_27 => Model::Gpt4_5Preview2025_02_27(Default::default()),
11952                Self::Gpt4Turbo => Model::Gpt4Turbo(Default::default()),
11953                Self::Gpt4Turbo2024_04_09 => Model::Gpt4Turbo2024_04_09(Default::default()),
11954                Self::Gpt4_0125Preview => Model::Gpt4_0125Preview(Default::default()),
11955                Self::Gpt4TurboPreview => Model::Gpt4TurboPreview(Default::default()),
11956                Self::Gpt4_1106Preview => Model::Gpt4_1106Preview(Default::default()),
11957                Self::Gpt4VisionPreview => Model::Gpt4VisionPreview(Default::default()),
11958                Self::Gpt4 => Model::Gpt4(Default::default()),
11959                Self::Gpt4_0314 => Model::Gpt4_0314(Default::default()),
11960                Self::Gpt4_0613 => Model::Gpt4_0613(Default::default()),
11961                Self::Gpt4_32k => Model::Gpt4_32k(Default::default()),
11962                Self::Gpt4_32k0314 => Model::Gpt4_32k0314(Default::default()),
11963                Self::Gpt4_32k0613 => Model::Gpt4_32k0613(Default::default()),
11964                Self::Gpt3_5Turbo => Model::Gpt3_5Turbo(Default::default()),
11965                Self::Gpt3_5Turbo16k => Model::Gpt3_5Turbo16k(Default::default()),
11966                Self::Gpt3_5Turbo0613 => Model::Gpt3_5Turbo0613(Default::default()),
11967                Self::Gpt3_5Turbo1106 => Model::Gpt3_5Turbo1106(Default::default()),
11968                Self::Gpt3_5Turbo0125 => Model::Gpt3_5Turbo0125(Default::default()),
11969                Self::Gpt3_5Turbo16k0613 => Model::Gpt3_5Turbo16k0613(Default::default()),
11970            }
11971            .serialize(serializer)
11972        }
11973    }
11974    #[allow(clippy::module_inception)]
11975    pub mod tool_resources {
11976        #[derive(Clone, Debug, Default, PartialEq)]
11977        #[serde_with::serde_as]
11978        #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
11979        pub struct CodeInterpreter {
11980            #[doc = "A list of [file](https://platform.openai.com/docs/api-reference/files) IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool.\n"]
11981            #[serde(rename = "file_ids")]
11982            #[serde(skip_serializing_if = "Option::is_none")]
11983            #[builder(default)]
11984            pub file_ids: Option<Vec<String>>,
11985        }
11986        #[derive(Clone, Debug, Default, PartialEq)]
11987        #[serde_with::serde_as]
11988        #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
11989        pub struct FileSearch {
11990            #[doc = "The ID of the [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object) attached to this assistant. There can be a maximum of 1 vector store attached to the assistant.\n"]
11991            #[serde(rename = "vector_store_ids")]
11992            #[serde(skip_serializing_if = "Option::is_none")]
11993            #[builder(default)]
11994            pub vector_store_ids: Option<Vec<String>>,
11995        }
11996    }
11997    #[doc = "A set of resources that are used by the assistant's tools. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.\n"]
11998    #[derive(Clone, Debug, Default, PartialEq)]
11999    #[serde_with::serde_as]
12000    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
12001    pub struct ToolResources {
12002        #[serde(rename = "code_interpreter")]
12003        #[serde(skip_serializing_if = "Option::is_none")]
12004        #[builder(default)]
12005        pub code_interpreter:
12006            Option<crate::__types::create_thread_and_run_request::tool_resources::CodeInterpreter>,
12007        #[serde(rename = "file_search")]
12008        #[serde(skip_serializing_if = "Option::is_none")]
12009        #[builder(default)]
12010        pub file_search:
12011            Option<crate::__types::create_thread_and_run_request::tool_resources::FileSearch>,
12012    }
12013}
12014#[derive(Clone, Debug, PartialEq)]
12015#[serde_with::serde_as]
12016#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
12017pub struct CreateThreadAndRunRequest {
12018    #[doc = "The ID of the [assistant](https://platform.openai.com/docs/api-reference/assistants) to use to execute this run."]
12019    #[serde(rename = "assistant_id")]
12020    pub assistant_id: String,
12021    #[serde(rename = "thread")]
12022    #[serde(skip_serializing_if = "Option::is_none")]
12023    #[builder(default)]
12024    pub thread: Option<crate::__types::CreateThreadRequest>,
12025    #[doc = "The ID of the [Model](https://platform.openai.com/docs/api-reference/models) to be used to execute this run. If a value is provided here, it will override the model associated with the assistant. If not, the model associated with the assistant will be used."]
12026    #[serde(rename = "model")]
12027    #[serde(skip_serializing_if = "Option::is_none")]
12028    #[builder(default)]
12029    pub model: Option<crate::__types::create_thread_and_run_request::Model>,
12030    #[doc = "Override the default system message of the assistant. This is useful for modifying the behavior on a per-run basis."]
12031    #[serde(rename = "instructions")]
12032    #[serde(skip_serializing_if = "Option::is_none")]
12033    #[builder(default)]
12034    pub instructions: Option<String>,
12035    #[doc = "Override the tools the assistant can use for this run. This is useful for modifying the behavior on a per-run basis."]
12036    #[serde(rename = "tools")]
12037    #[serde(skip_serializing_if = "Option::is_none")]
12038    #[builder(default)]
12039    pub tools: Option<Vec<crate::__types::AssistantTool>>,
12040    #[doc = "A set of resources that are used by the assistant's tools. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.\n"]
12041    #[serde(rename = "tool_resources")]
12042    #[serde(skip_serializing_if = "Option::is_none")]
12043    #[builder(default)]
12044    pub tool_resources: Option<crate::__types::create_thread_and_run_request::ToolResources>,
12045    #[serde(rename = "metadata")]
12046    #[serde(skip_serializing_if = "Option::is_none")]
12047    #[builder(default)]
12048    pub metadata: Option<crate::__types::Metadata>,
12049    #[doc = "What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.\n"]
12050    #[serde(rename = "temperature")]
12051    #[serde(skip_serializing_if = "Option::is_none")]
12052    #[builder(default)]
12053    pub temperature: Option<serde_json::Number>,
12054    #[doc = "An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.\n\nWe generally recommend altering this or temperature but not both.\n"]
12055    #[serde(rename = "top_p")]
12056    #[serde(skip_serializing_if = "Option::is_none")]
12057    #[builder(default)]
12058    pub top_p: Option<serde_json::Number>,
12059    #[doc = "If `true`, returns a stream of events that happen during the Run as server-sent events, terminating when the Run enters a terminal state with a `data: [DONE]` message.\n"]
12060    #[serde(rename = "stream")]
12061    #[serde(skip_serializing_if = "Option::is_none")]
12062    #[builder(default)]
12063    pub stream: Option<bool>,
12064    #[doc = "The maximum number of prompt tokens that may be used over the course of the run. The run will make a best effort to use only the number of prompt tokens specified, across multiple turns of the run. If the run exceeds the number of prompt tokens specified, the run will end with status `incomplete`. See `incomplete_details` for more info.\n"]
12065    #[serde(rename = "max_prompt_tokens")]
12066    #[serde(skip_serializing_if = "Option::is_none")]
12067    #[builder(default)]
12068    pub max_prompt_tokens: Option<i64>,
12069    #[doc = "The maximum number of completion tokens that may be used over the course of the run. The run will make a best effort to use only the number of completion tokens specified, across multiple turns of the run. If the run exceeds the number of completion tokens specified, the run will end with status `incomplete`. See `incomplete_details` for more info.\n"]
12070    #[serde(rename = "max_completion_tokens")]
12071    #[serde(skip_serializing_if = "Option::is_none")]
12072    #[builder(default)]
12073    pub max_completion_tokens: Option<i64>,
12074    #[serde(rename = "truncation_strategy")]
12075    #[serde(skip_serializing_if = "Option::is_none")]
12076    #[builder(default)]
12077    pub truncation_strategy: Option<crate::__types::TruncationObject>,
12078    #[serde(rename = "tool_choice")]
12079    #[serde(skip_serializing_if = "Option::is_none")]
12080    #[builder(default)]
12081    pub tool_choice: Option<crate::__types::AssistantsApiToolChoiceOption>,
12082    #[serde(rename = "parallel_tool_calls")]
12083    #[serde(skip_serializing_if = "Option::is_none")]
12084    #[builder(default)]
12085    pub parallel_tool_calls: Option<crate::__types::ParallelToolCalls>,
12086    #[serde(rename = "response_format")]
12087    #[serde(skip_serializing_if = "Option::is_none")]
12088    #[builder(default)]
12089    pub response_format: Option<crate::__types::AssistantsApiResponseFormatOption>,
12090}
12091#[allow(clippy::module_inception)]
12092pub mod create_thread_request {
12093    #[allow(clippy::module_inception)]
12094    pub mod tool_resources {
12095        #[derive(Clone, Debug, Default, PartialEq)]
12096        #[serde_with::serde_as]
12097        #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
12098        pub struct CodeInterpreter {
12099            #[doc = "A list of [file](https://platform.openai.com/docs/api-reference/files) IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool.\n"]
12100            #[serde(rename = "file_ids")]
12101            #[serde(skip_serializing_if = "Option::is_none")]
12102            #[builder(default)]
12103            pub file_ids: Option<Vec<String>>,
12104        }
12105        #[allow(clippy::module_inception)]
12106        pub mod file_search {
12107            #[allow(clippy::module_inception)]
12108            pub mod variant0 {
12109                #[allow(clippy::module_inception)]
12110                pub mod vector_stores {
12111                    #[allow(clippy::module_inception)]
12112                    pub mod item {
12113                        #[allow(clippy::module_inception)]
12114                        pub mod chunking_strategy {
12115                            #[allow(clippy::module_inception)]
12116                            pub(crate) mod auto {
12117                                #[doc = "Always `auto`."]
12118                                #[derive(Clone, Copy, Debug, Default, PartialEq)]
12119                                pub(crate) struct Type;
12120                                impl_serde!(Type, "auto");
12121                            }
12122                            #[doc = "The default strategy. This strategy currently uses a `max_chunk_size_tokens` of `800` and `chunk_overlap_tokens` of `400`."]
12123                            #[derive(
12124                                Clone,
12125                                Copy,
12126                                Debug,
12127                                Default,
12128                                PartialEq,
12129                                typed_builder :: TypedBuilder,
12130                            )]
12131                            pub struct Auto {}
12132                            impl<'de> serde::Deserialize<'de> for Auto {
12133                                fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
12134                                where
12135                                    D: serde::Deserializer<'de>,
12136                                {
12137                                    #[serde_with::serde_as]
12138                                    #[derive(serde :: Deserialize)]
12139                                    struct Auto { # [serde (rename = "type")] # [allow (dead_code)] r#type : crate :: __types :: create_thread_request :: tool_resources :: file_search :: variant0 :: vector_stores :: item :: chunking_strategy :: auto :: Type }
12140                                    let Auto { .. } = Auto::deserialize(deserializer)?;
12141                                    Ok(Self {})
12142                                }
12143                            }
12144                            impl serde::Serialize for Auto {
12145                                fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
12146                                where
12147                                    S: serde::Serializer,
12148                                {
12149                                    #[serde_with::serde_as]
12150                                    #[derive(serde :: Serialize)]
12151                                    struct Auto < 'a > { # [serde (rename = "type")] r#type : & 'a crate :: __types :: create_thread_request :: tool_resources :: file_search :: variant0 :: vector_stores :: item :: chunking_strategy :: auto :: Type }
12152                                    let Self {} = self;
12153                                    Auto {
12154                                        r#type: &Default::default(),
12155                                    }
12156                                    .serialize(serializer)
12157                                }
12158                            }
12159                            #[allow(clippy::module_inception)]
12160                            pub mod r#static {
12161                                #[doc = "Always `static`."]
12162                                #[derive(Clone, Copy, Debug, Default, PartialEq)]
12163                                pub(crate) struct Type;
12164                                impl_serde!(Type, "static");
12165                                #[derive(Clone, Copy, Debug, PartialEq)]
12166                                #[serde_with::serde_as]
12167                                #[derive(
12168                                    serde :: Deserialize,
12169                                    serde :: Serialize,
12170                                    typed_builder :: TypedBuilder,
12171                                )]
12172                                pub struct Static {
12173                                    #[doc = "The maximum number of tokens in each chunk. The default value is `800`. The minimum value is `100` and the maximum value is `4096`."]
12174                                    #[serde(rename = "max_chunk_size_tokens")]
12175                                    pub max_chunk_size_tokens: i64,
12176                                    #[doc = "The number of tokens that overlap between chunks. The default value is `400`.\n\nNote that the overlap must not exceed half of `max_chunk_size_tokens`.\n"]
12177                                    #[serde(rename = "chunk_overlap_tokens")]
12178                                    pub chunk_overlap_tokens: i64,
12179                                }
12180                            }
12181                            #[derive(
12182                                Clone, Copy, Debug, PartialEq, typed_builder :: TypedBuilder,
12183                            )]
12184                            pub struct Static { pub r#static : crate :: __types :: create_thread_request :: tool_resources :: file_search :: variant0 :: vector_stores :: item :: chunking_strategy :: r#static :: Static }
12185                            impl<'de> serde::Deserialize<'de> for Static {
12186                                fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
12187                                where
12188                                    D: serde::Deserializer<'de>,
12189                                {
12190                                    #[serde_with::serde_as]
12191                                    #[derive(serde :: Deserialize)]
12192                                    struct Static { # [serde (rename = "type")] # [allow (dead_code)] r#type : crate :: __types :: create_thread_request :: tool_resources :: file_search :: variant0 :: vector_stores :: item :: chunking_strategy :: r#static :: Type , # [serde (rename = "static")] r#static : crate :: __types :: create_thread_request :: tool_resources :: file_search :: variant0 :: vector_stores :: item :: chunking_strategy :: r#static :: Static }
12193                                    let Static { r#static, .. } =
12194                                        Static::deserialize(deserializer)?;
12195                                    Ok(Self { r#static })
12196                                }
12197                            }
12198                            impl serde::Serialize for Static {
12199                                fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
12200                                where
12201                                    S: serde::Serializer,
12202                                {
12203                                    #[serde_with::serde_as]
12204                                    #[derive(serde :: Serialize)]
12205                                    struct Static < 'a > { # [serde (rename = "type")] r#type : & 'a crate :: __types :: create_thread_request :: tool_resources :: file_search :: variant0 :: vector_stores :: item :: chunking_strategy :: r#static :: Type , # [serde (rename = "static")] r#static : & 'a crate :: __types :: create_thread_request :: tool_resources :: file_search :: variant0 :: vector_stores :: item :: chunking_strategy :: r#static :: Static }
12206                                    let Self { r#static } = self;
12207                                    Static {
12208                                        r#type: &Default::default(),
12209                                        r#static,
12210                                    }
12211                                    .serialize(serializer)
12212                                }
12213                            }
12214                        }
12215                        #[doc = "The chunking strategy used to chunk the file(s). If not set, will use the `auto` strategy."]
12216                        #[derive(Clone, Copy, Debug, PartialEq)]
12217                        #[serde_with::serde_as]
12218                        #[derive(serde :: Deserialize, serde :: Serialize)]
12219                        #[serde(untagged)]
12220                        #[allow(clippy::large_enum_variant)]
12221                        pub enum ChunkingStrategy {
12222                            # [doc = "The default strategy. This strategy currently uses a `max_chunk_size_tokens` of `800` and `chunk_overlap_tokens` of `400`."] Auto (crate :: __types :: create_thread_request :: tool_resources :: file_search :: variant0 :: vector_stores :: item :: chunking_strategy :: Auto) , Static (crate :: __types :: create_thread_request :: tool_resources :: file_search :: variant0 :: vector_stores :: item :: chunking_strategy :: Static) }
12223                    }
12224                    #[derive(Clone, Debug, Default, PartialEq)]
12225                    #[serde_with::serde_as]
12226                    #[derive(
12227                        serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder,
12228                    )]
12229                    pub struct Item { # [doc = "A list of [file](https://platform.openai.com/docs/api-reference/files) IDs to add to the vector store. There can be a maximum of 10000 files in a vector store.\n"] # [serde (rename = "file_ids")] # [serde (skip_serializing_if = "Option::is_none")] # [builder (default)] pub file_ids : Option < Vec < String > > , # [doc = "The chunking strategy used to chunk the file(s). If not set, will use the `auto` strategy."] # [serde (rename = "chunking_strategy")] # [serde (skip_serializing_if = "Option::is_none")] # [builder (default)] pub chunking_strategy : Option < crate :: __types :: create_thread_request :: tool_resources :: file_search :: variant0 :: vector_stores :: item :: ChunkingStrategy > , # [serde (rename = "metadata")] # [serde (skip_serializing_if = "Option::is_none")] # [builder (default)] pub metadata : Option < crate :: __types :: Metadata > }
12230                }
12231            }
12232            #[derive(Clone, Debug, PartialEq)]
12233            #[serde_with::serde_as]
12234            #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
12235            pub struct Variant0 { # [doc = "The [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object) attached to this thread. There can be a maximum of 1 vector store attached to the thread.\n"] # [serde (rename = "vector_store_ids")] pub vector_store_ids : Vec < String > , # [doc = "A helper to create a [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object) with file_ids and attach it to this thread. There can be a maximum of 1 vector store attached to the thread.\n"] # [serde (rename = "vector_stores")] # [serde (skip_serializing_if = "Option::is_none")] # [builder (default)] pub vector_stores : Option < Vec < crate :: __types :: create_thread_request :: tool_resources :: file_search :: variant0 :: vector_stores :: Item > > }
12236            #[allow(clippy::module_inception)]
12237            pub mod variant1 {
12238                #[allow(clippy::module_inception)]
12239                pub mod vector_stores {
12240                    #[allow(clippy::module_inception)]
12241                    pub mod item {
12242                        #[allow(clippy::module_inception)]
12243                        pub mod chunking_strategy {
12244                            #[allow(clippy::module_inception)]
12245                            pub(crate) mod auto {
12246                                #[doc = "Always `auto`."]
12247                                #[derive(Clone, Copy, Debug, Default, PartialEq)]
12248                                pub(crate) struct Type;
12249                                impl_serde!(Type, "auto");
12250                            }
12251                            #[doc = "The default strategy. This strategy currently uses a `max_chunk_size_tokens` of `800` and `chunk_overlap_tokens` of `400`."]
12252                            #[derive(
12253                                Clone,
12254                                Copy,
12255                                Debug,
12256                                Default,
12257                                PartialEq,
12258                                typed_builder :: TypedBuilder,
12259                            )]
12260                            pub struct Auto {}
12261                            impl<'de> serde::Deserialize<'de> for Auto {
12262                                fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
12263                                where
12264                                    D: serde::Deserializer<'de>,
12265                                {
12266                                    #[serde_with::serde_as]
12267                                    #[derive(serde :: Deserialize)]
12268                                    struct Auto { # [serde (rename = "type")] # [allow (dead_code)] r#type : crate :: __types :: create_thread_request :: tool_resources :: file_search :: variant1 :: vector_stores :: item :: chunking_strategy :: auto :: Type }
12269                                    let Auto { .. } = Auto::deserialize(deserializer)?;
12270                                    Ok(Self {})
12271                                }
12272                            }
12273                            impl serde::Serialize for Auto {
12274                                fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
12275                                where
12276                                    S: serde::Serializer,
12277                                {
12278                                    #[serde_with::serde_as]
12279                                    #[derive(serde :: Serialize)]
12280                                    struct Auto < 'a > { # [serde (rename = "type")] r#type : & 'a crate :: __types :: create_thread_request :: tool_resources :: file_search :: variant1 :: vector_stores :: item :: chunking_strategy :: auto :: Type }
12281                                    let Self {} = self;
12282                                    Auto {
12283                                        r#type: &Default::default(),
12284                                    }
12285                                    .serialize(serializer)
12286                                }
12287                            }
12288                            #[allow(clippy::module_inception)]
12289                            pub mod r#static {
12290                                #[doc = "Always `static`."]
12291                                #[derive(Clone, Copy, Debug, Default, PartialEq)]
12292                                pub(crate) struct Type;
12293                                impl_serde!(Type, "static");
12294                                #[derive(Clone, Copy, Debug, PartialEq)]
12295                                #[serde_with::serde_as]
12296                                #[derive(
12297                                    serde :: Deserialize,
12298                                    serde :: Serialize,
12299                                    typed_builder :: TypedBuilder,
12300                                )]
12301                                pub struct Static {
12302                                    #[doc = "The maximum number of tokens in each chunk. The default value is `800`. The minimum value is `100` and the maximum value is `4096`."]
12303                                    #[serde(rename = "max_chunk_size_tokens")]
12304                                    pub max_chunk_size_tokens: i64,
12305                                    #[doc = "The number of tokens that overlap between chunks. The default value is `400`.\n\nNote that the overlap must not exceed half of `max_chunk_size_tokens`.\n"]
12306                                    #[serde(rename = "chunk_overlap_tokens")]
12307                                    pub chunk_overlap_tokens: i64,
12308                                }
12309                            }
12310                            #[derive(
12311                                Clone, Copy, Debug, PartialEq, typed_builder :: TypedBuilder,
12312                            )]
12313                            pub struct Static { pub r#static : crate :: __types :: create_thread_request :: tool_resources :: file_search :: variant1 :: vector_stores :: item :: chunking_strategy :: r#static :: Static }
12314                            impl<'de> serde::Deserialize<'de> for Static {
12315                                fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
12316                                where
12317                                    D: serde::Deserializer<'de>,
12318                                {
12319                                    #[serde_with::serde_as]
12320                                    #[derive(serde :: Deserialize)]
12321                                    struct Static { # [serde (rename = "type")] # [allow (dead_code)] r#type : crate :: __types :: create_thread_request :: tool_resources :: file_search :: variant1 :: vector_stores :: item :: chunking_strategy :: r#static :: Type , # [serde (rename = "static")] r#static : crate :: __types :: create_thread_request :: tool_resources :: file_search :: variant1 :: vector_stores :: item :: chunking_strategy :: r#static :: Static }
12322                                    let Static { r#static, .. } =
12323                                        Static::deserialize(deserializer)?;
12324                                    Ok(Self { r#static })
12325                                }
12326                            }
12327                            impl serde::Serialize for Static {
12328                                fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
12329                                where
12330                                    S: serde::Serializer,
12331                                {
12332                                    #[serde_with::serde_as]
12333                                    #[derive(serde :: Serialize)]
12334                                    struct Static < 'a > { # [serde (rename = "type")] r#type : & 'a crate :: __types :: create_thread_request :: tool_resources :: file_search :: variant1 :: vector_stores :: item :: chunking_strategy :: r#static :: Type , # [serde (rename = "static")] r#static : & 'a crate :: __types :: create_thread_request :: tool_resources :: file_search :: variant1 :: vector_stores :: item :: chunking_strategy :: r#static :: Static }
12335                                    let Self { r#static } = self;
12336                                    Static {
12337                                        r#type: &Default::default(),
12338                                        r#static,
12339                                    }
12340                                    .serialize(serializer)
12341                                }
12342                            }
12343                        }
12344                        #[doc = "The chunking strategy used to chunk the file(s). If not set, will use the `auto` strategy."]
12345                        #[derive(Clone, Copy, Debug, PartialEq)]
12346                        #[serde_with::serde_as]
12347                        #[derive(serde :: Deserialize, serde :: Serialize)]
12348                        #[serde(untagged)]
12349                        #[allow(clippy::large_enum_variant)]
12350                        pub enum ChunkingStrategy {
12351                            # [doc = "The default strategy. This strategy currently uses a `max_chunk_size_tokens` of `800` and `chunk_overlap_tokens` of `400`."] Auto (crate :: __types :: create_thread_request :: tool_resources :: file_search :: variant1 :: vector_stores :: item :: chunking_strategy :: Auto) , Static (crate :: __types :: create_thread_request :: tool_resources :: file_search :: variant1 :: vector_stores :: item :: chunking_strategy :: Static) }
12352                    }
12353                    #[derive(Clone, Debug, Default, PartialEq)]
12354                    #[serde_with::serde_as]
12355                    #[derive(
12356                        serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder,
12357                    )]
12358                    pub struct Item { # [doc = "A list of [file](https://platform.openai.com/docs/api-reference/files) IDs to add to the vector store. There can be a maximum of 10000 files in a vector store.\n"] # [serde (rename = "file_ids")] # [serde (skip_serializing_if = "Option::is_none")] # [builder (default)] pub file_ids : Option < Vec < String > > , # [doc = "The chunking strategy used to chunk the file(s). If not set, will use the `auto` strategy."] # [serde (rename = "chunking_strategy")] # [serde (skip_serializing_if = "Option::is_none")] # [builder (default)] pub chunking_strategy : Option < crate :: __types :: create_thread_request :: tool_resources :: file_search :: variant1 :: vector_stores :: item :: ChunkingStrategy > , # [serde (rename = "metadata")] # [serde (skip_serializing_if = "Option::is_none")] # [builder (default)] pub metadata : Option < crate :: __types :: Metadata > }
12359                }
12360            }
12361            #[derive(Clone, Debug, PartialEq)]
12362            #[serde_with::serde_as]
12363            #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
12364            pub struct Variant1 { # [doc = "The [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object) attached to this thread. There can be a maximum of 1 vector store attached to the thread.\n"] # [serde (rename = "vector_store_ids")] # [serde (skip_serializing_if = "Option::is_none")] # [builder (default)] pub vector_store_ids : Option < Vec < String > > , # [doc = "A helper to create a [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object) with file_ids and attach it to this thread. There can be a maximum of 1 vector store attached to the thread.\n"] # [serde (rename = "vector_stores")] pub vector_stores : Vec < crate :: __types :: create_thread_request :: tool_resources :: file_search :: variant1 :: vector_stores :: Item > }
12365        }
12366        #[derive(Clone, Debug, PartialEq)]
12367        #[serde_with::serde_as]
12368        #[derive(serde :: Deserialize, serde :: Serialize)]
12369        #[serde(untagged)]
12370        #[allow(clippy::large_enum_variant)]
12371        pub enum FileSearch {
12372            Variant0(crate::__types::create_thread_request::tool_resources::file_search::Variant0),
12373            Variant1(crate::__types::create_thread_request::tool_resources::file_search::Variant1),
12374        }
12375    }
12376    #[doc = "A set of resources that are made available to the assistant's tools in this thread. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.\n"]
12377    #[derive(Clone, Debug, Default, PartialEq)]
12378    #[serde_with::serde_as]
12379    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
12380    pub struct ToolResources {
12381        #[serde(rename = "code_interpreter")]
12382        #[serde(skip_serializing_if = "Option::is_none")]
12383        #[builder(default)]
12384        pub code_interpreter:
12385            Option<crate::__types::create_thread_request::tool_resources::CodeInterpreter>,
12386        #[serde(rename = "file_search")]
12387        #[serde(skip_serializing_if = "Option::is_none")]
12388        #[builder(default)]
12389        pub file_search: Option<crate::__types::create_thread_request::tool_resources::FileSearch>,
12390    }
12391}
12392#[doc = "Options to create a new thread. If no thread is provided when running a \nrequest, an empty thread will be created.\n"]
12393#[derive(Clone, Debug, Default, PartialEq)]
12394#[serde_with::serde_as]
12395#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
12396pub struct CreateThreadRequest {
12397    #[doc = "A list of [messages](https://platform.openai.com/docs/api-reference/messages) to start the thread with."]
12398    #[serde(rename = "messages")]
12399    #[serde(skip_serializing_if = "Option::is_none")]
12400    #[builder(default)]
12401    pub messages: Option<Vec<crate::__types::CreateMessageRequest>>,
12402    #[doc = "A set of resources that are made available to the assistant's tools in this thread. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.\n"]
12403    #[serde(rename = "tool_resources")]
12404    #[serde(skip_serializing_if = "Option::is_none")]
12405    #[builder(default)]
12406    pub tool_resources: Option<crate::__types::create_thread_request::ToolResources>,
12407    #[serde(rename = "metadata")]
12408    #[serde(skip_serializing_if = "Option::is_none")]
12409    #[builder(default)]
12410    pub metadata: Option<crate::__types::Metadata>,
12411}
12412#[allow(clippy::module_inception)]
12413pub mod create_transcription_request {
12414    #[allow(clippy::module_inception)]
12415    pub(crate) mod model {
12416        #[doc = "whisper-1"]
12417        #[derive(Clone, Copy, Debug, Default, PartialEq)]
12418        pub(crate) struct Whisper1;
12419        impl_serde!(Whisper1, "whisper-1");
12420        #[doc = "gpt-4o-transcribe"]
12421        #[derive(Clone, Copy, Debug, Default, PartialEq)]
12422        pub(crate) struct Gpt4oTranscribe;
12423        impl_serde!(Gpt4oTranscribe, "gpt-4o-transcribe");
12424        #[doc = "gpt-4o-mini-transcribe"]
12425        #[derive(Clone, Copy, Debug, Default, PartialEq)]
12426        pub(crate) struct Gpt4oMiniTranscribe;
12427        impl_serde!(Gpt4oMiniTranscribe, "gpt-4o-mini-transcribe");
12428    }
12429    #[doc = "ID of the model to use. The options are `gpt-4o-transcribe`, `gpt-4o-mini-transcribe`, and `whisper-1` (which is powered by our open source Whisper V2 model).\n"]
12430    #[derive(Clone, Debug, PartialEq)]
12431    #[allow(clippy::large_enum_variant)]
12432    pub enum Model {
12433        Other(String),
12434        #[doc = "whisper-1"]
12435        Whisper1,
12436        #[doc = "gpt-4o-transcribe"]
12437        Gpt4oTranscribe,
12438        #[doc = "gpt-4o-mini-transcribe"]
12439        Gpt4oMiniTranscribe,
12440    }
12441    impl<'de> serde::Deserialize<'de> for Model {
12442        fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
12443        where
12444            D: serde::Deserializer<'de>,
12445        {
12446            #[serde_with::serde_as]
12447            #[derive(serde :: Deserialize)]
12448            #[serde(untagged)]
12449            #[allow(clippy::enum_variant_names, clippy::large_enum_variant)]
12450            enum Model {
12451                Whisper1(crate::__types::create_transcription_request::model::Whisper1),
12452                Gpt4oTranscribe(
12453                    crate::__types::create_transcription_request::model::Gpt4oTranscribe,
12454                ),
12455                Gpt4oMiniTranscribe(
12456                    crate::__types::create_transcription_request::model::Gpt4oMiniTranscribe,
12457                ),
12458                Other(String),
12459            }
12460            Ok(match Model::deserialize(deserializer)? {
12461                Model::Other(v) => Self::Other(v),
12462                Model::Whisper1(_) => Self::Whisper1,
12463                Model::Gpt4oTranscribe(_) => Self::Gpt4oTranscribe,
12464                Model::Gpt4oMiniTranscribe(_) => Self::Gpt4oMiniTranscribe,
12465            })
12466        }
12467    }
12468    impl serde::Serialize for Model {
12469        fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
12470        where
12471            S: serde::Serializer,
12472        {
12473            #[serde_with::serde_as]
12474            #[derive(serde :: Serialize)]
12475            #[serde(untagged)]
12476            #[allow(clippy::enum_variant_names)]
12477            enum Model<'a> {
12478                Other(&'a String),
12479                Whisper1(crate::__types::create_transcription_request::model::Whisper1),
12480                Gpt4oTranscribe(
12481                    crate::__types::create_transcription_request::model::Gpt4oTranscribe,
12482                ),
12483                Gpt4oMiniTranscribe(
12484                    crate::__types::create_transcription_request::model::Gpt4oMiniTranscribe,
12485                ),
12486            }
12487            match self {
12488                Self::Other(v) => Model::Other(v),
12489                Self::Whisper1 => Model::Whisper1(Default::default()),
12490                Self::Gpt4oTranscribe => Model::Gpt4oTranscribe(Default::default()),
12491                Self::Gpt4oMiniTranscribe => Model::Gpt4oMiniTranscribe(Default::default()),
12492            }
12493            .serialize(serializer)
12494        }
12495    }
12496    #[allow(clippy::module_inception)]
12497    pub mod timestamp_granularities {
12498        #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
12499        pub enum Item {
12500            #[doc = "`word`"]
12501            #[serde(rename = "word")]
12502            Word,
12503            #[doc = "`segment`"]
12504            #[serde(rename = "segment")]
12505            Segment,
12506        }
12507    }
12508}
12509#[derive(Clone, Debug, PartialEq)]
12510#[serde_with::serde_as]
12511#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
12512pub struct CreateTranscriptionRequest {
12513    #[doc = "The audio file object (not file name) to transcribe, in one of these formats: flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm.\n"]
12514    #[serde_as(as = "serde_with::base64::Base64")]
12515    #[serde(rename = "file")]
12516    pub file: Vec<u8>,
12517    #[doc = "ID of the model to use. The options are `gpt-4o-transcribe`, `gpt-4o-mini-transcribe`, and `whisper-1` (which is powered by our open source Whisper V2 model).\n"]
12518    #[serde(rename = "model")]
12519    pub model: crate::__types::create_transcription_request::Model,
12520    #[doc = "The language of the input audio. Supplying the input language in [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) (e.g. `en`) format will improve accuracy and latency.\n"]
12521    #[serde(rename = "language")]
12522    #[serde(skip_serializing_if = "Option::is_none")]
12523    #[builder(default)]
12524    pub language: Option<String>,
12525    #[doc = "An optional text to guide the model's style or continue a previous audio segment. The [prompt](https://platform.openai.com/docs/guides/speech-to-text#prompting) should match the audio language.\n"]
12526    #[serde(rename = "prompt")]
12527    #[serde(skip_serializing_if = "Option::is_none")]
12528    #[builder(default)]
12529    pub prompt: Option<String>,
12530    #[serde(rename = "response_format")]
12531    #[serde(skip_serializing_if = "Option::is_none")]
12532    #[builder(default)]
12533    pub response_format: Option<crate::__types::AudioResponseFormat>,
12534    #[doc = "The sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use [log probability](https://en.wikipedia.org/wiki/Log_probability) to automatically increase the temperature until certain thresholds are hit.\n"]
12535    #[serde(rename = "temperature")]
12536    #[serde(skip_serializing_if = "Option::is_none")]
12537    #[builder(default)]
12538    pub temperature: Option<serde_json::Number>,
12539    #[doc = "If set to true, the model response data will be streamed to the client\nas 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). \nSee the [Streaming section of the Speech-to-Text guide](https://platform.openai.com/docs/guides/speech-to-text?lang=curl#streaming-transcriptions)\nfor more information.\n\nNote: Streaming is not supported for the `whisper-1` model and will be ignored.\n"]
12540    #[serde(rename = "stream")]
12541    #[serde(skip_serializing_if = "Option::is_none")]
12542    #[builder(default)]
12543    pub stream: Option<bool>,
12544    #[serde(rename = "chunking_strategy")]
12545    #[serde(skip_serializing_if = "Option::is_none")]
12546    #[builder(default)]
12547    pub chunking_strategy: Option<crate::__types::TranscriptionChunkingStrategy>,
12548    #[doc = "The timestamp granularities to populate for this transcription. `response_format` must be set `verbose_json` to use timestamp granularities. Either or both of these options are supported: `word`, or `segment`. Note: There is no additional latency for segment timestamps, but generating word timestamps incurs additional latency.\n"]
12549    #[serde(rename = "timestamp_granularities")]
12550    #[serde(skip_serializing_if = "Option::is_none")]
12551    #[builder(default)]
12552    pub timestamp_granularities:
12553        Option<Vec<crate::__types::create_transcription_request::timestamp_granularities::Item>>,
12554    #[doc = "Additional information to include in the transcription response. \n`logprobs` will return the log probabilities of the tokens in the \nresponse to understand the model's confidence in the transcription. \n`logprobs` only works with response_format set to `json` and only with \nthe models `gpt-4o-transcribe` and `gpt-4o-mini-transcribe`.\n"]
12555    #[serde(rename = "include")]
12556    #[serde(skip_serializing_if = "Option::is_none")]
12557    #[builder(default)]
12558    pub include: Option<Vec<crate::__types::TranscriptionInclude>>,
12559}
12560#[allow(clippy::module_inception)]
12561pub mod create_transcription_response_json {
12562    #[allow(clippy::module_inception)]
12563    pub mod logprobs {
12564        #[derive(Clone, Debug, Default, PartialEq)]
12565        #[serde_with::serde_as]
12566        #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
12567        pub struct Item {
12568            #[doc = "The token in the transcription."]
12569            #[serde(rename = "token")]
12570            #[serde(skip_serializing_if = "Option::is_none")]
12571            #[builder(default)]
12572            pub token: Option<String>,
12573            #[doc = "The log probability of the token."]
12574            #[serde(rename = "logprob")]
12575            #[serde(skip_serializing_if = "Option::is_none")]
12576            #[builder(default)]
12577            pub logprob: Option<serde_json::Number>,
12578            #[doc = "The bytes of the token."]
12579            #[serde(rename = "bytes")]
12580            #[serde(skip_serializing_if = "Option::is_none")]
12581            #[builder(default)]
12582            pub bytes: Option<Vec<serde_json::Number>>,
12583        }
12584    }
12585    #[doc = "Token usage statistics for the request."]
12586    #[derive(Clone, Debug, PartialEq)]
12587    #[serde_with::serde_as]
12588    #[derive(serde :: Deserialize, serde :: Serialize)]
12589    #[serde(untagged)]
12590    #[allow(clippy::large_enum_variant)]
12591    pub enum Usage {
12592        Tokens(crate::__types::TranscriptTextUsageTokens),
12593        Duration(crate::__types::TranscriptTextUsageDuration),
12594    }
12595}
12596#[doc = "Represents a transcription response returned by model, based on the provided input."]
12597#[derive(Clone, Debug, PartialEq)]
12598#[serde_with::serde_as]
12599#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
12600pub struct CreateTranscriptionResponseJson {
12601    #[doc = "The transcribed text."]
12602    #[serde(rename = "text")]
12603    pub text: String,
12604    #[doc = "The log probabilities of the tokens in the transcription. Only returned with the models `gpt-4o-transcribe` and `gpt-4o-mini-transcribe` if `logprobs` is added to the `include` array.\n"]
12605    #[serde(rename = "logprobs")]
12606    #[serde(skip_serializing_if = "Option::is_none")]
12607    #[builder(default)]
12608    pub logprobs: Option<Vec<crate::__types::create_transcription_response_json::logprobs::Item>>,
12609    #[doc = "Token usage statistics for the request."]
12610    #[serde(rename = "usage")]
12611    #[serde(skip_serializing_if = "Option::is_none")]
12612    #[builder(default)]
12613    pub usage: Option<crate::__types::create_transcription_response_json::Usage>,
12614}
12615#[derive(Clone, Debug, PartialEq)]
12616#[serde_with::serde_as]
12617#[derive(serde :: Deserialize, serde :: Serialize)]
12618#[serde(untagged)]
12619#[allow(clippy::large_enum_variant)]
12620pub enum CreateTranscriptionResponseStreamEvent {
12621    TranscriptTextDelta(crate::__types::TranscriptTextDeltaEvent),
12622    TranscriptTextDone(crate::__types::TranscriptTextDoneEvent),
12623}
12624#[doc = "Represents a verbose json transcription response returned by model, based on the provided input."]
12625#[derive(Clone, Debug, PartialEq)]
12626#[serde_with::serde_as]
12627#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
12628pub struct CreateTranscriptionResponseVerboseJson {
12629    #[doc = "The language of the input audio."]
12630    #[serde(rename = "language")]
12631    pub language: String,
12632    #[doc = "The duration of the input audio."]
12633    #[serde(rename = "duration")]
12634    pub duration: serde_json::Number,
12635    #[doc = "The transcribed text."]
12636    #[serde(rename = "text")]
12637    pub text: String,
12638    #[doc = "Extracted words and their corresponding timestamps."]
12639    #[serde(rename = "words")]
12640    #[serde(skip_serializing_if = "Option::is_none")]
12641    #[builder(default)]
12642    pub words: Option<Vec<crate::__types::TranscriptionWord>>,
12643    #[doc = "Segments of the transcribed text and their corresponding details."]
12644    #[serde(rename = "segments")]
12645    #[serde(skip_serializing_if = "Option::is_none")]
12646    #[builder(default)]
12647    pub segments: Option<Vec<crate::__types::TranscriptionSegment>>,
12648    #[serde(rename = "usage")]
12649    #[serde(skip_serializing_if = "Option::is_none")]
12650    #[builder(default)]
12651    pub usage: Option<crate::__types::TranscriptTextUsageDuration>,
12652}
12653#[allow(clippy::module_inception)]
12654pub mod create_translation_request {
12655    #[allow(clippy::module_inception)]
12656    pub(crate) mod model {
12657        #[doc = "whisper-1"]
12658        #[derive(Clone, Copy, Debug, Default, PartialEq)]
12659        pub(crate) struct Whisper1;
12660        impl_serde!(Whisper1, "whisper-1");
12661    }
12662    #[doc = "ID of the model to use. Only `whisper-1` (which is powered by our open source Whisper V2 model) is currently available.\n"]
12663    #[derive(Clone, Debug, PartialEq)]
12664    #[allow(clippy::large_enum_variant)]
12665    pub enum Model {
12666        Other(String),
12667        #[doc = "whisper-1"]
12668        Whisper1,
12669    }
12670    impl<'de> serde::Deserialize<'de> for Model {
12671        fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
12672        where
12673            D: serde::Deserializer<'de>,
12674        {
12675            #[serde_with::serde_as]
12676            #[derive(serde :: Deserialize)]
12677            #[serde(untagged)]
12678            #[allow(clippy::enum_variant_names, clippy::large_enum_variant)]
12679            enum Model {
12680                Whisper1(crate::__types::create_translation_request::model::Whisper1),
12681                Other(String),
12682            }
12683            Ok(match Model::deserialize(deserializer)? {
12684                Model::Other(v) => Self::Other(v),
12685                Model::Whisper1(_) => Self::Whisper1,
12686            })
12687        }
12688    }
12689    impl serde::Serialize for Model {
12690        fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
12691        where
12692            S: serde::Serializer,
12693        {
12694            #[serde_with::serde_as]
12695            #[derive(serde :: Serialize)]
12696            #[serde(untagged)]
12697            #[allow(clippy::enum_variant_names)]
12698            enum Model<'a> {
12699                Other(&'a String),
12700                Whisper1(crate::__types::create_translation_request::model::Whisper1),
12701            }
12702            match self {
12703                Self::Other(v) => Model::Other(v),
12704                Self::Whisper1 => Model::Whisper1(Default::default()),
12705            }
12706            .serialize(serializer)
12707        }
12708    }
12709    #[doc = "The format of the output, in one of these options: `json`, `text`, `srt`, `verbose_json`, or `vtt`.\n"]
12710    #[derive(Clone, Copy, Debug, Default, PartialEq, serde :: Deserialize, serde :: Serialize)]
12711    pub enum ResponseFormat {
12712        #[doc = "`json`"]
12713        #[default]
12714        #[serde(rename = "json")]
12715        Json,
12716        #[doc = "`text`"]
12717        #[serde(rename = "text")]
12718        Text,
12719        #[doc = "`srt`"]
12720        #[serde(rename = "srt")]
12721        Srt,
12722        #[doc = "`verbose_json`"]
12723        #[serde(rename = "verbose_json")]
12724        VerboseJson,
12725        #[doc = "`vtt`"]
12726        #[serde(rename = "vtt")]
12727        Vtt,
12728    }
12729}
12730#[derive(Clone, Debug, PartialEq)]
12731#[serde_with::serde_as]
12732#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
12733pub struct CreateTranslationRequest {
12734    #[doc = "The audio file object (not file name) translate, in one of these formats: flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm.\n"]
12735    #[serde_as(as = "serde_with::base64::Base64")]
12736    #[serde(rename = "file")]
12737    pub file: Vec<u8>,
12738    #[doc = "ID of the model to use. Only `whisper-1` (which is powered by our open source Whisper V2 model) is currently available.\n"]
12739    #[serde(rename = "model")]
12740    pub model: crate::__types::create_translation_request::Model,
12741    #[doc = "An optional text to guide the model's style or continue a previous audio segment. The [prompt](https://platform.openai.com/docs/guides/speech-to-text#prompting) should be in English.\n"]
12742    #[serde(rename = "prompt")]
12743    #[serde(skip_serializing_if = "Option::is_none")]
12744    #[builder(default)]
12745    pub prompt: Option<String>,
12746    #[doc = "The format of the output, in one of these options: `json`, `text`, `srt`, `verbose_json`, or `vtt`.\n"]
12747    #[serde(rename = "response_format")]
12748    #[serde(skip_serializing_if = "Option::is_none")]
12749    #[builder(default)]
12750    pub response_format: Option<crate::__types::create_translation_request::ResponseFormat>,
12751    #[doc = "The sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use [log probability](https://en.wikipedia.org/wiki/Log_probability) to automatically increase the temperature until certain thresholds are hit.\n"]
12752    #[serde(rename = "temperature")]
12753    #[serde(skip_serializing_if = "Option::is_none")]
12754    #[builder(default)]
12755    pub temperature: Option<serde_json::Number>,
12756}
12757#[derive(Clone, Debug, PartialEq)]
12758#[serde_with::serde_as]
12759#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
12760pub struct CreateTranslationResponseJson {
12761    #[serde(rename = "text")]
12762    pub text: String,
12763}
12764#[derive(Clone, Debug, PartialEq)]
12765#[serde_with::serde_as]
12766#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
12767pub struct CreateTranslationResponseVerboseJson {
12768    #[doc = "The language of the output translation (always `english`)."]
12769    #[serde(rename = "language")]
12770    pub language: String,
12771    #[doc = "The duration of the input audio."]
12772    #[serde(rename = "duration")]
12773    pub duration: serde_json::Number,
12774    #[doc = "The translated text."]
12775    #[serde(rename = "text")]
12776    pub text: String,
12777    #[doc = "Segments of the translated text and their corresponding details."]
12778    #[serde(rename = "segments")]
12779    #[serde(skip_serializing_if = "Option::is_none")]
12780    #[builder(default)]
12781    pub segments: Option<Vec<crate::__types::TranscriptionSegment>>,
12782}
12783#[allow(clippy::module_inception)]
12784pub mod create_upload_request {
12785    #[doc = "The intended purpose of the uploaded file.\n\nSee the [documentation on File purposes](https://platform.openai.com/docs/api-reference/files/create#files-create-purpose).\n"]
12786    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
12787    pub enum Purpose {
12788        #[doc = "`assistants`"]
12789        #[serde(rename = "assistants")]
12790        Assistants,
12791        #[doc = "`batch`"]
12792        #[serde(rename = "batch")]
12793        Batch,
12794        #[doc = "`fine-tune`"]
12795        #[serde(rename = "fine-tune")]
12796        FineTune,
12797        #[doc = "`vision`"]
12798        #[serde(rename = "vision")]
12799        Vision,
12800    }
12801}
12802#[derive(Clone, Debug, PartialEq)]
12803#[serde_with::serde_as]
12804#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
12805pub struct CreateUploadRequest {
12806    #[doc = "The name of the file to upload.\n"]
12807    #[serde(rename = "filename")]
12808    pub filename: String,
12809    #[doc = "The intended purpose of the uploaded file.\n\nSee the [documentation on File purposes](https://platform.openai.com/docs/api-reference/files/create#files-create-purpose).\n"]
12810    #[serde(rename = "purpose")]
12811    pub purpose: crate::__types::create_upload_request::Purpose,
12812    #[doc = "The number of bytes in the file you are uploading.\n"]
12813    #[serde(rename = "bytes")]
12814    pub bytes: i64,
12815    #[doc = "The MIME type of the file.\n\nThis must fall within the supported MIME types for your file purpose. See the supported MIME types for assistants and vision.\n"]
12816    #[serde(rename = "mime_type")]
12817    pub mime_type: String,
12818    #[serde(rename = "expires_after")]
12819    #[serde(skip_serializing_if = "Option::is_none")]
12820    #[builder(default)]
12821    pub expires_after: Option<crate::__types::FileExpirationAfter>,
12822}
12823#[derive(Clone, Debug, PartialEq)]
12824#[serde_with::serde_as]
12825#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
12826pub struct CreateVectorStoreFileBatchRequest {
12827    #[doc = "A list of [File](https://platform.openai.com/docs/api-reference/files) IDs that the vector store should use. Useful for tools like `file_search` that can access files."]
12828    #[serde(rename = "file_ids")]
12829    pub file_ids: Vec<String>,
12830    #[serde(rename = "chunking_strategy")]
12831    #[serde(skip_serializing_if = "Option::is_none")]
12832    #[builder(default)]
12833    pub chunking_strategy: Option<crate::__types::ChunkingStrategyRequestParam>,
12834    #[serde(rename = "attributes")]
12835    #[serde(skip_serializing_if = "Option::is_none")]
12836    #[builder(default)]
12837    pub attributes: Option<crate::__types::VectorStoreFileAttributes>,
12838}
12839#[derive(Clone, Debug, PartialEq)]
12840#[serde_with::serde_as]
12841#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
12842pub struct CreateVectorStoreFileRequest {
12843    #[doc = "A [File](https://platform.openai.com/docs/api-reference/files) ID that the vector store should use. Useful for tools like `file_search` that can access files."]
12844    #[serde(rename = "file_id")]
12845    pub file_id: String,
12846    #[serde(rename = "chunking_strategy")]
12847    #[serde(skip_serializing_if = "Option::is_none")]
12848    #[builder(default)]
12849    pub chunking_strategy: Option<crate::__types::ChunkingStrategyRequestParam>,
12850    #[serde(rename = "attributes")]
12851    #[serde(skip_serializing_if = "Option::is_none")]
12852    #[builder(default)]
12853    pub attributes: Option<crate::__types::VectorStoreFileAttributes>,
12854}
12855#[derive(Clone, Debug, Default, PartialEq)]
12856#[serde_with::serde_as]
12857#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
12858pub struct CreateVectorStoreRequest {
12859    #[doc = "A list of [File](https://platform.openai.com/docs/api-reference/files) IDs that the vector store should use. Useful for tools like `file_search` that can access files."]
12860    #[serde(rename = "file_ids")]
12861    #[serde(skip_serializing_if = "Option::is_none")]
12862    #[builder(default)]
12863    pub file_ids: Option<Vec<String>>,
12864    #[doc = "The name of the vector store."]
12865    #[serde(rename = "name")]
12866    #[serde(skip_serializing_if = "Option::is_none")]
12867    #[builder(default)]
12868    pub name: Option<String>,
12869    #[serde(rename = "expires_after")]
12870    #[serde(skip_serializing_if = "Option::is_none")]
12871    #[builder(default)]
12872    pub expires_after: Option<crate::__types::VectorStoreExpirationAfter>,
12873    #[serde(rename = "chunking_strategy")]
12874    #[serde(skip_serializing_if = "Option::is_none")]
12875    #[builder(default)]
12876    pub chunking_strategy: Option<crate::__types::ChunkingStrategyRequestParam>,
12877    #[serde(rename = "metadata")]
12878    #[serde(skip_serializing_if = "Option::is_none")]
12879    #[builder(default)]
12880    pub metadata: Option<crate::__types::Metadata>,
12881}
12882#[allow(clippy::module_inception)]
12883pub mod custom_tool {
12884    #[doc = "The type of the custom tool. Always `custom`."]
12885    #[derive(Clone, Copy, Debug, Default, PartialEq)]
12886    pub(crate) struct Type;
12887    impl_serde!(Type, "custom");
12888    #[allow(clippy::module_inception)]
12889    pub mod format {
12890        #[allow(clippy::module_inception)]
12891        pub(crate) mod text {
12892            #[doc = "Unconstrained text format. Always `text`."]
12893            #[derive(Clone, Copy, Debug, Default, PartialEq)]
12894            pub(crate) struct Type;
12895            impl_serde!(Type, "text");
12896        }
12897        #[doc = "Unconstrained free-form text."]
12898        #[derive(Clone, Copy, Debug, Default, PartialEq, typed_builder :: TypedBuilder)]
12899        pub struct Text {}
12900        impl<'de> serde::Deserialize<'de> for Text {
12901            fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
12902            where
12903                D: serde::Deserializer<'de>,
12904            {
12905                #[serde_with::serde_as]
12906                #[derive(serde :: Deserialize)]
12907                struct Text {
12908                    #[serde(rename = "type")]
12909                    #[allow(dead_code)]
12910                    r#type: crate::__types::custom_tool::format::text::Type,
12911                }
12912                let Text { .. } = Text::deserialize(deserializer)?;
12913                Ok(Self {})
12914            }
12915        }
12916        impl serde::Serialize for Text {
12917            fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
12918            where
12919                S: serde::Serializer,
12920            {
12921                #[serde_with::serde_as]
12922                #[derive(serde :: Serialize)]
12923                struct Text<'a> {
12924                    #[serde(rename = "type")]
12925                    r#type: &'a crate::__types::custom_tool::format::text::Type,
12926                }
12927                let Self {} = self;
12928                Text {
12929                    r#type: &Default::default(),
12930                }
12931                .serialize(serializer)
12932            }
12933        }
12934        #[allow(clippy::module_inception)]
12935        pub mod grammar {
12936            #[doc = "Grammar format. Always `grammar`."]
12937            #[derive(Clone, Copy, Debug, Default, PartialEq)]
12938            pub(crate) struct Type;
12939            impl_serde!(Type, "grammar");
12940            #[doc = "The syntax of the grammar definition. One of `lark` or `regex`."]
12941            #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
12942            pub enum Syntax {
12943                #[doc = "`lark`"]
12944                #[serde(rename = "lark")]
12945                Lark,
12946                #[doc = "`regex`"]
12947                #[serde(rename = "regex")]
12948                Regex,
12949            }
12950        }
12951        #[doc = "A grammar defined by the user."]
12952        #[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
12953        pub struct Grammar {
12954            #[doc = "The grammar definition."]
12955            pub definition: String,
12956            #[doc = "The syntax of the grammar definition. One of `lark` or `regex`."]
12957            pub syntax: crate::__types::custom_tool::format::grammar::Syntax,
12958        }
12959        impl<'de> serde::Deserialize<'de> for Grammar {
12960            fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
12961            where
12962                D: serde::Deserializer<'de>,
12963            {
12964                #[serde_with::serde_as]
12965                #[derive(serde :: Deserialize)]
12966                struct Grammar {
12967                    #[serde(rename = "type")]
12968                    #[allow(dead_code)]
12969                    r#type: crate::__types::custom_tool::format::grammar::Type,
12970                    #[serde(rename = "definition")]
12971                    definition: String,
12972                    #[serde(rename = "syntax")]
12973                    syntax: crate::__types::custom_tool::format::grammar::Syntax,
12974                }
12975                let Grammar {
12976                    definition, syntax, ..
12977                } = Grammar::deserialize(deserializer)?;
12978                Ok(Self { definition, syntax })
12979            }
12980        }
12981        impl serde::Serialize for Grammar {
12982            fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
12983            where
12984                S: serde::Serializer,
12985            {
12986                #[serde_with::serde_as]
12987                #[derive(serde :: Serialize)]
12988                struct Grammar<'a> {
12989                    #[serde(rename = "type")]
12990                    r#type: &'a crate::__types::custom_tool::format::grammar::Type,
12991                    #[serde(rename = "definition")]
12992                    definition: &'a String,
12993                    #[serde(rename = "syntax")]
12994                    syntax: &'a crate::__types::custom_tool::format::grammar::Syntax,
12995                }
12996                let Self { definition, syntax } = self;
12997                Grammar {
12998                    r#type: &Default::default(),
12999                    definition,
13000                    syntax,
13001                }
13002                .serialize(serializer)
13003            }
13004        }
13005    }
13006    #[doc = "The input format for the custom tool. Default is unconstrained text.\n"]
13007    #[derive(Clone, Debug, PartialEq)]
13008    #[serde_with::serde_as]
13009    #[derive(serde :: Deserialize, serde :: Serialize)]
13010    #[serde(untagged)]
13011    #[allow(clippy::large_enum_variant)]
13012    pub enum Format {
13013        #[doc = "Unconstrained free-form text."]
13014        Text(crate::__types::custom_tool::format::Text),
13015        #[doc = "A grammar defined by the user."]
13016        Grammar(crate::__types::custom_tool::format::Grammar),
13017    }
13018}
13019#[doc = "A custom tool that processes input using a specified format. Learn more about\n[custom tools](https://platform.openai.com/docs/guides/function-calling#custom-tools).\n"]
13020#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
13021pub struct CustomTool {
13022    #[doc = "The name of the custom tool, used to identify it in tool calls."]
13023    pub name: String,
13024    #[doc = "Optional description of the custom tool, used to provide more context.\n"]
13025    #[builder(default)]
13026    pub description: Option<String>,
13027    #[doc = "The input format for the custom tool. Default is unconstrained text.\n"]
13028    #[builder(default)]
13029    pub format: Option<crate::__types::custom_tool::Format>,
13030}
13031impl<'de> serde::Deserialize<'de> for CustomTool {
13032    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
13033    where
13034        D: serde::Deserializer<'de>,
13035    {
13036        #[serde_with::serde_as]
13037        #[derive(serde :: Deserialize)]
13038        struct CustomTool {
13039            #[serde(rename = "type")]
13040            #[allow(dead_code)]
13041            r#type: crate::__types::custom_tool::Type,
13042            #[serde(rename = "name")]
13043            name: String,
13044            #[serde(rename = "description")]
13045            description: Option<String>,
13046            #[serde(rename = "format")]
13047            format: Option<crate::__types::custom_tool::Format>,
13048        }
13049        let CustomTool {
13050            name,
13051            description,
13052            format,
13053            ..
13054        } = CustomTool::deserialize(deserializer)?;
13055        Ok(Self {
13056            name,
13057            description,
13058            format,
13059        })
13060    }
13061}
13062impl serde::Serialize for CustomTool {
13063    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
13064    where
13065        S: serde::Serializer,
13066    {
13067        #[serde_with::serde_as]
13068        #[derive(serde :: Serialize)]
13069        struct CustomTool<'a> {
13070            #[serde(rename = "type")]
13071            r#type: &'a crate::__types::custom_tool::Type,
13072            #[serde(rename = "name")]
13073            name: &'a String,
13074            #[serde(rename = "description")]
13075            #[serde(skip_serializing_if = "Option::is_none")]
13076            description: &'a Option<String>,
13077            #[serde(rename = "format")]
13078            #[serde(skip_serializing_if = "Option::is_none")]
13079            format: &'a Option<crate::__types::custom_tool::Format>,
13080        }
13081        let Self {
13082            name,
13083            description,
13084            format,
13085        } = self;
13086        CustomTool {
13087            r#type: &Default::default(),
13088            name,
13089            description,
13090            format,
13091        }
13092        .serialize(serializer)
13093    }
13094}
13095#[allow(clippy::module_inception)]
13096pub(crate) mod custom_tool_call {
13097    #[doc = "The type of the custom tool call. Always `custom_tool_call`.\n"]
13098    #[derive(Clone, Copy, Debug, Default, PartialEq)]
13099    pub(crate) struct Type;
13100    impl_serde!(Type, "custom_tool_call");
13101}
13102#[doc = "A call to a custom tool created by the model.\n"]
13103#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
13104pub struct CustomToolCall {
13105    #[doc = "The unique ID of the custom tool call in the OpenAI platform.\n"]
13106    #[builder(default)]
13107    pub id: Option<String>,
13108    #[doc = "An identifier used to map this custom tool call to a tool call output.\n"]
13109    pub call_id: String,
13110    #[doc = "The name of the custom tool being called.\n"]
13111    pub name: String,
13112    #[doc = "The input for the custom tool call generated by the model.\n"]
13113    pub input: String,
13114}
13115impl<'de> serde::Deserialize<'de> for CustomToolCall {
13116    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
13117    where
13118        D: serde::Deserializer<'de>,
13119    {
13120        #[serde_with::serde_as]
13121        #[derive(serde :: Deserialize)]
13122        struct CustomToolCall {
13123            #[serde(rename = "type")]
13124            #[allow(dead_code)]
13125            r#type: crate::__types::custom_tool_call::Type,
13126            #[serde(rename = "id")]
13127            id: Option<String>,
13128            #[serde(rename = "call_id")]
13129            call_id: String,
13130            #[serde(rename = "name")]
13131            name: String,
13132            #[serde(rename = "input")]
13133            input: String,
13134        }
13135        let CustomToolCall {
13136            id,
13137            call_id,
13138            name,
13139            input,
13140            ..
13141        } = CustomToolCall::deserialize(deserializer)?;
13142        Ok(Self {
13143            id,
13144            call_id,
13145            name,
13146            input,
13147        })
13148    }
13149}
13150impl serde::Serialize for CustomToolCall {
13151    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
13152    where
13153        S: serde::Serializer,
13154    {
13155        #[serde_with::serde_as]
13156        #[derive(serde :: Serialize)]
13157        struct CustomToolCall<'a> {
13158            #[serde(rename = "type")]
13159            r#type: &'a crate::__types::custom_tool_call::Type,
13160            #[serde(rename = "id")]
13161            #[serde(skip_serializing_if = "Option::is_none")]
13162            id: &'a Option<String>,
13163            #[serde(rename = "call_id")]
13164            call_id: &'a String,
13165            #[serde(rename = "name")]
13166            name: &'a String,
13167            #[serde(rename = "input")]
13168            input: &'a String,
13169        }
13170        let Self {
13171            id,
13172            call_id,
13173            name,
13174            input,
13175        } = self;
13176        CustomToolCall {
13177            r#type: &Default::default(),
13178            id,
13179            call_id,
13180            name,
13181            input,
13182        }
13183        .serialize(serializer)
13184    }
13185}
13186#[allow(clippy::module_inception)]
13187pub(crate) mod custom_tool_call_output {
13188    #[doc = "The type of the custom tool call output. Always `custom_tool_call_output`.\n"]
13189    #[derive(Clone, Copy, Debug, Default, PartialEq)]
13190    pub(crate) struct Type;
13191    impl_serde!(Type, "custom_tool_call_output");
13192}
13193#[doc = "The output of a custom tool call from your code, being sent back to the model.\n"]
13194#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
13195pub struct CustomToolCallOutput {
13196    #[doc = "The unique ID of the custom tool call output in the OpenAI platform.\n"]
13197    #[builder(default)]
13198    pub id: Option<String>,
13199    #[doc = "The call ID, used to map this custom tool call output to a custom tool call.\n"]
13200    pub call_id: String,
13201    #[doc = "The output from the custom tool call generated by your code.\n"]
13202    pub output: String,
13203}
13204impl<'de> serde::Deserialize<'de> for CustomToolCallOutput {
13205    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
13206    where
13207        D: serde::Deserializer<'de>,
13208    {
13209        #[serde_with::serde_as]
13210        #[derive(serde :: Deserialize)]
13211        struct CustomToolCallOutput {
13212            #[serde(rename = "type")]
13213            #[allow(dead_code)]
13214            r#type: crate::__types::custom_tool_call_output::Type,
13215            #[serde(rename = "id")]
13216            id: Option<String>,
13217            #[serde(rename = "call_id")]
13218            call_id: String,
13219            #[serde(rename = "output")]
13220            output: String,
13221        }
13222        let CustomToolCallOutput {
13223            id,
13224            call_id,
13225            output,
13226            ..
13227        } = CustomToolCallOutput::deserialize(deserializer)?;
13228        Ok(Self {
13229            id,
13230            call_id,
13231            output,
13232        })
13233    }
13234}
13235impl serde::Serialize for CustomToolCallOutput {
13236    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
13237    where
13238        S: serde::Serializer,
13239    {
13240        #[serde_with::serde_as]
13241        #[derive(serde :: Serialize)]
13242        struct CustomToolCallOutput<'a> {
13243            #[serde(rename = "type")]
13244            r#type: &'a crate::__types::custom_tool_call_output::Type,
13245            #[serde(rename = "id")]
13246            #[serde(skip_serializing_if = "Option::is_none")]
13247            id: &'a Option<String>,
13248            #[serde(rename = "call_id")]
13249            call_id: &'a String,
13250            #[serde(rename = "output")]
13251            output: &'a String,
13252        }
13253        let Self {
13254            id,
13255            call_id,
13256            output,
13257        } = self;
13258        CustomToolCallOutput {
13259            r#type: &Default::default(),
13260            id,
13261            call_id,
13262            output,
13263        }
13264        .serialize(serializer)
13265    }
13266}
13267#[allow(clippy::module_inception)]
13268pub mod custom_tool_chat_completions {
13269    #[doc = "The type of the custom tool. Always `custom`."]
13270    #[derive(Clone, Copy, Debug, Default, PartialEq)]
13271    pub(crate) struct Type;
13272    impl_serde!(Type, "custom");
13273    #[allow(clippy::module_inception)]
13274    pub mod custom {
13275        #[allow(clippy::module_inception)]
13276        pub mod format {
13277            #[allow(clippy::module_inception)]
13278            pub(crate) mod text {
13279                #[doc = "Unconstrained text format. Always `text`."]
13280                #[derive(Clone, Copy, Debug, Default, PartialEq)]
13281                pub(crate) struct Type;
13282                impl_serde!(Type, "text");
13283            }
13284            #[doc = "Unconstrained free-form text."]
13285            #[derive(Clone, Copy, Debug, Default, PartialEq, typed_builder :: TypedBuilder)]
13286            pub struct Text {}
13287            impl<'de> serde::Deserialize<'de> for Text {
13288                fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
13289                where
13290                    D: serde::Deserializer<'de>,
13291                {
13292                    #[serde_with::serde_as]
13293                    #[derive(serde :: Deserialize)]
13294                    struct Text { # [serde (rename = "type")] # [allow (dead_code)] r#type : crate :: __types :: custom_tool_chat_completions :: custom :: format :: text :: Type }
13295                    let Text { .. } = Text::deserialize(deserializer)?;
13296                    Ok(Self {})
13297                }
13298            }
13299            impl serde::Serialize for Text {
13300                fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
13301                where
13302                    S: serde::Serializer,
13303                {
13304                    #[serde_with::serde_as]
13305                    #[derive(serde :: Serialize)]
13306                    struct Text < 'a > { # [serde (rename = "type")] r#type : & 'a crate :: __types :: custom_tool_chat_completions :: custom :: format :: text :: Type }
13307                    let Self {} = self;
13308                    Text {
13309                        r#type: &Default::default(),
13310                    }
13311                    .serialize(serializer)
13312                }
13313            }
13314            #[allow(clippy::module_inception)]
13315            pub mod grammar {
13316                #[doc = "Grammar format. Always `grammar`."]
13317                #[derive(Clone, Copy, Debug, Default, PartialEq)]
13318                pub(crate) struct Type;
13319                impl_serde!(Type, "grammar");
13320                #[allow(clippy::module_inception)]
13321                pub mod grammar {
13322                    #[doc = "The syntax of the grammar definition. One of `lark` or `regex`."]
13323                    #[derive(
13324                        Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize,
13325                    )]
13326                    pub enum Syntax {
13327                        #[doc = "`lark`"]
13328                        #[serde(rename = "lark")]
13329                        Lark,
13330                        #[doc = "`regex`"]
13331                        #[serde(rename = "regex")]
13332                        Regex,
13333                    }
13334                }
13335                #[doc = "Your chosen grammar."]
13336                #[derive(Clone, Debug, PartialEq)]
13337                #[serde_with::serde_as]
13338                #[derive(
13339                    serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder,
13340                )]
13341                pub struct Grammar { # [doc = "The grammar definition."] # [serde (rename = "definition")] pub definition : String , # [doc = "The syntax of the grammar definition. One of `lark` or `regex`."] # [serde (rename = "syntax")] pub syntax : crate :: __types :: custom_tool_chat_completions :: custom :: format :: grammar :: grammar :: Syntax }
13342            }
13343            #[doc = "A grammar defined by the user."]
13344            #[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
13345            pub struct Grammar {
13346                #[doc = "Your chosen grammar."]
13347                pub grammar:
13348                    crate::__types::custom_tool_chat_completions::custom::format::grammar::Grammar,
13349            }
13350            impl<'de> serde::Deserialize<'de> for Grammar {
13351                fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
13352                where
13353                    D: serde::Deserializer<'de>,
13354                {
13355                    #[serde_with::serde_as]
13356                    #[derive(serde :: Deserialize)]
13357                    struct Grammar { # [serde (rename = "type")] # [allow (dead_code)] r#type : crate :: __types :: custom_tool_chat_completions :: custom :: format :: grammar :: Type , # [serde (rename = "grammar")] grammar : crate :: __types :: custom_tool_chat_completions :: custom :: format :: grammar :: Grammar }
13358                    let Grammar { grammar, .. } = Grammar::deserialize(deserializer)?;
13359                    Ok(Self { grammar })
13360                }
13361            }
13362            impl serde::Serialize for Grammar {
13363                fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
13364                where
13365                    S: serde::Serializer,
13366                {
13367                    #[serde_with::serde_as]
13368                    #[derive(serde :: Serialize)]
13369                    struct Grammar < 'a > { # [serde (rename = "type")] r#type : & 'a crate :: __types :: custom_tool_chat_completions :: custom :: format :: grammar :: Type , # [serde (rename = "grammar")] grammar : & 'a crate :: __types :: custom_tool_chat_completions :: custom :: format :: grammar :: Grammar }
13370                    let Self { grammar } = self;
13371                    Grammar {
13372                        r#type: &Default::default(),
13373                        grammar,
13374                    }
13375                    .serialize(serializer)
13376                }
13377            }
13378        }
13379        #[doc = "The input format for the custom tool. Default is unconstrained text.\n"]
13380        #[derive(Clone, Debug, PartialEq)]
13381        #[serde_with::serde_as]
13382        #[derive(serde :: Deserialize, serde :: Serialize)]
13383        #[serde(untagged)]
13384        #[allow(clippy::large_enum_variant)]
13385        pub enum Format {
13386            #[doc = "Unconstrained free-form text."]
13387            Text(crate::__types::custom_tool_chat_completions::custom::format::Text),
13388            #[doc = "A grammar defined by the user."]
13389            Grammar(crate::__types::custom_tool_chat_completions::custom::format::Grammar),
13390        }
13391    }
13392    #[doc = "Properties of the custom tool.\n"]
13393    #[derive(Clone, Debug, PartialEq)]
13394    #[serde_with::serde_as]
13395    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
13396    pub struct Custom {
13397        #[doc = "The name of the custom tool, used to identify it in tool calls."]
13398        #[serde(rename = "name")]
13399        pub name: String,
13400        #[doc = "Optional description of the custom tool, used to provide more context.\n"]
13401        #[serde(rename = "description")]
13402        #[serde(skip_serializing_if = "Option::is_none")]
13403        #[builder(default)]
13404        pub description: Option<String>,
13405        #[doc = "The input format for the custom tool. Default is unconstrained text.\n"]
13406        #[serde(rename = "format")]
13407        #[serde(skip_serializing_if = "Option::is_none")]
13408        #[builder(default)]
13409        pub format: Option<crate::__types::custom_tool_chat_completions::custom::Format>,
13410    }
13411}
13412#[doc = "A custom tool that processes input using a specified format.\n"]
13413#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
13414pub struct CustomToolChatCompletions {
13415    #[doc = "Properties of the custom tool.\n"]
13416    pub custom: crate::__types::custom_tool_chat_completions::Custom,
13417}
13418impl<'de> serde::Deserialize<'de> for CustomToolChatCompletions {
13419    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
13420    where
13421        D: serde::Deserializer<'de>,
13422    {
13423        #[serde_with::serde_as]
13424        #[derive(serde :: Deserialize)]
13425        struct CustomToolChatCompletions {
13426            #[serde(rename = "type")]
13427            #[allow(dead_code)]
13428            r#type: crate::__types::custom_tool_chat_completions::Type,
13429            #[serde(rename = "custom")]
13430            custom: crate::__types::custom_tool_chat_completions::Custom,
13431        }
13432        let CustomToolChatCompletions { custom, .. } =
13433            CustomToolChatCompletions::deserialize(deserializer)?;
13434        Ok(Self { custom })
13435    }
13436}
13437impl serde::Serialize for CustomToolChatCompletions {
13438    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
13439    where
13440        S: serde::Serializer,
13441    {
13442        #[serde_with::serde_as]
13443        #[derive(serde :: Serialize)]
13444        struct CustomToolChatCompletions<'a> {
13445            #[serde(rename = "type")]
13446            r#type: &'a crate::__types::custom_tool_chat_completions::Type,
13447            #[serde(rename = "custom")]
13448            custom: &'a crate::__types::custom_tool_chat_completions::Custom,
13449        }
13450        let Self { custom } = self;
13451        CustomToolChatCompletions {
13452            r#type: &Default::default(),
13453            custom,
13454        }
13455        .serialize(serializer)
13456    }
13457}
13458#[allow(clippy::module_inception)]
13459pub(crate) mod delete_assistant_response {
13460    #[doc = "assistant.deleted"]
13461    #[derive(Clone, Copy, Debug, Default, PartialEq)]
13462    pub(crate) struct Object;
13463    impl_serde!(Object, "assistant.deleted");
13464}
13465#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
13466pub struct DeleteAssistantResponse {
13467    pub id: String,
13468    pub deleted: bool,
13469}
13470impl<'de> serde::Deserialize<'de> for DeleteAssistantResponse {
13471    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
13472    where
13473        D: serde::Deserializer<'de>,
13474    {
13475        #[serde_with::serde_as]
13476        #[derive(serde :: Deserialize)]
13477        struct DeleteAssistantResponse {
13478            #[serde(rename = "id")]
13479            id: String,
13480            #[serde(rename = "deleted")]
13481            deleted: bool,
13482            #[serde(rename = "object")]
13483            #[allow(dead_code)]
13484            object: crate::__types::delete_assistant_response::Object,
13485        }
13486        let DeleteAssistantResponse { id, deleted, .. } =
13487            DeleteAssistantResponse::deserialize(deserializer)?;
13488        Ok(Self { id, deleted })
13489    }
13490}
13491impl serde::Serialize for DeleteAssistantResponse {
13492    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
13493    where
13494        S: serde::Serializer,
13495    {
13496        #[serde_with::serde_as]
13497        #[derive(serde :: Serialize)]
13498        struct DeleteAssistantResponse<'a> {
13499            #[serde(rename = "id")]
13500            id: &'a String,
13501            #[serde(rename = "deleted")]
13502            deleted: &'a bool,
13503            #[serde(rename = "object")]
13504            object: &'a crate::__types::delete_assistant_response::Object,
13505        }
13506        let Self { id, deleted } = self;
13507        DeleteAssistantResponse {
13508            id,
13509            deleted,
13510            object: &Default::default(),
13511        }
13512        .serialize(serializer)
13513    }
13514}
13515#[allow(clippy::module_inception)]
13516pub(crate) mod delete_certificate_response {
13517    #[doc = "The object type, must be `certificate.deleted`."]
13518    #[derive(Clone, Copy, Debug, Default, PartialEq)]
13519    pub(crate) struct Object;
13520    impl_serde!(Object, "certificate.deleted");
13521}
13522#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
13523pub struct DeleteCertificateResponse {
13524    #[doc = "The ID of the certificate that was deleted."]
13525    pub id: String,
13526}
13527impl<'de> serde::Deserialize<'de> for DeleteCertificateResponse {
13528    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
13529    where
13530        D: serde::Deserializer<'de>,
13531    {
13532        #[serde_with::serde_as]
13533        #[derive(serde :: Deserialize)]
13534        struct DeleteCertificateResponse {
13535            #[serde(rename = "object")]
13536            #[allow(dead_code)]
13537            object: crate::__types::delete_certificate_response::Object,
13538            #[serde(rename = "id")]
13539            id: String,
13540        }
13541        let DeleteCertificateResponse { id, .. } =
13542            DeleteCertificateResponse::deserialize(deserializer)?;
13543        Ok(Self { id })
13544    }
13545}
13546impl serde::Serialize for DeleteCertificateResponse {
13547    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
13548    where
13549        S: serde::Serializer,
13550    {
13551        #[serde_with::serde_as]
13552        #[derive(serde :: Serialize)]
13553        struct DeleteCertificateResponse<'a> {
13554            #[serde(rename = "object")]
13555            object: &'a crate::__types::delete_certificate_response::Object,
13556            #[serde(rename = "id")]
13557            id: &'a String,
13558        }
13559        let Self { id } = self;
13560        DeleteCertificateResponse {
13561            object: &Default::default(),
13562            id,
13563        }
13564        .serialize(serializer)
13565    }
13566}
13567#[allow(clippy::module_inception)]
13568pub(crate) mod delete_file_response {
13569    #[doc = "file"]
13570    #[derive(Clone, Copy, Debug, Default, PartialEq)]
13571    pub(crate) struct Object;
13572    impl_serde!(Object, "file");
13573}
13574#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
13575pub struct DeleteFileResponse {
13576    pub id: String,
13577    pub deleted: bool,
13578}
13579impl<'de> serde::Deserialize<'de> for DeleteFileResponse {
13580    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
13581    where
13582        D: serde::Deserializer<'de>,
13583    {
13584        #[serde_with::serde_as]
13585        #[derive(serde :: Deserialize)]
13586        struct DeleteFileResponse {
13587            #[serde(rename = "id")]
13588            id: String,
13589            #[serde(rename = "object")]
13590            #[allow(dead_code)]
13591            object: crate::__types::delete_file_response::Object,
13592            #[serde(rename = "deleted")]
13593            deleted: bool,
13594        }
13595        let DeleteFileResponse { id, deleted, .. } = DeleteFileResponse::deserialize(deserializer)?;
13596        Ok(Self { id, deleted })
13597    }
13598}
13599impl serde::Serialize for DeleteFileResponse {
13600    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
13601    where
13602        S: serde::Serializer,
13603    {
13604        #[serde_with::serde_as]
13605        #[derive(serde :: Serialize)]
13606        struct DeleteFileResponse<'a> {
13607            #[serde(rename = "id")]
13608            id: &'a String,
13609            #[serde(rename = "object")]
13610            object: &'a crate::__types::delete_file_response::Object,
13611            #[serde(rename = "deleted")]
13612            deleted: &'a bool,
13613        }
13614        let Self { id, deleted } = self;
13615        DeleteFileResponse {
13616            id,
13617            object: &Default::default(),
13618            deleted,
13619        }
13620        .serialize(serializer)
13621    }
13622}
13623#[allow(clippy::module_inception)]
13624pub(crate) mod delete_fine_tuning_checkpoint_permission_response {
13625    #[doc = "The object type, which is always \"checkpoint.permission\"."]
13626    #[derive(Clone, Copy, Debug, Default, PartialEq)]
13627    pub(crate) struct Object;
13628    impl_serde!(Object, "checkpoint.permission");
13629}
13630#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
13631pub struct DeleteFineTuningCheckpointPermissionResponse {
13632    #[doc = "The ID of the fine-tuned model checkpoint permission that was deleted."]
13633    pub id: String,
13634    #[doc = "Whether the fine-tuned model checkpoint permission was successfully deleted."]
13635    pub deleted: bool,
13636}
13637impl<'de> serde::Deserialize<'de> for DeleteFineTuningCheckpointPermissionResponse {
13638    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
13639    where
13640        D: serde::Deserializer<'de>,
13641    {
13642        #[serde_with::serde_as]
13643        #[derive(serde :: Deserialize)]
13644        struct DeleteFineTuningCheckpointPermissionResponse {
13645            #[serde(rename = "id")]
13646            id: String,
13647            #[serde(rename = "object")]
13648            #[allow(dead_code)]
13649            object: crate::__types::delete_fine_tuning_checkpoint_permission_response::Object,
13650            #[serde(rename = "deleted")]
13651            deleted: bool,
13652        }
13653        let DeleteFineTuningCheckpointPermissionResponse { id, deleted, .. } =
13654            DeleteFineTuningCheckpointPermissionResponse::deserialize(deserializer)?;
13655        Ok(Self { id, deleted })
13656    }
13657}
13658impl serde::Serialize for DeleteFineTuningCheckpointPermissionResponse {
13659    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
13660    where
13661        S: serde::Serializer,
13662    {
13663        #[serde_with::serde_as]
13664        #[derive(serde :: Serialize)]
13665        struct DeleteFineTuningCheckpointPermissionResponse<'a> {
13666            #[serde(rename = "id")]
13667            id: &'a String,
13668            #[serde(rename = "object")]
13669            object: &'a crate::__types::delete_fine_tuning_checkpoint_permission_response::Object,
13670            #[serde(rename = "deleted")]
13671            deleted: &'a bool,
13672        }
13673        let Self { id, deleted } = self;
13674        DeleteFineTuningCheckpointPermissionResponse {
13675            id,
13676            object: &Default::default(),
13677            deleted,
13678        }
13679        .serialize(serializer)
13680    }
13681}
13682#[allow(clippy::module_inception)]
13683pub(crate) mod delete_message_response {
13684    #[doc = "thread.message.deleted"]
13685    #[derive(Clone, Copy, Debug, Default, PartialEq)]
13686    pub(crate) struct Object;
13687    impl_serde!(Object, "thread.message.deleted");
13688}
13689#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
13690pub struct DeleteMessageResponse {
13691    pub id: String,
13692    pub deleted: bool,
13693}
13694impl<'de> serde::Deserialize<'de> for DeleteMessageResponse {
13695    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
13696    where
13697        D: serde::Deserializer<'de>,
13698    {
13699        #[serde_with::serde_as]
13700        #[derive(serde :: Deserialize)]
13701        struct DeleteMessageResponse {
13702            #[serde(rename = "id")]
13703            id: String,
13704            #[serde(rename = "deleted")]
13705            deleted: bool,
13706            #[serde(rename = "object")]
13707            #[allow(dead_code)]
13708            object: crate::__types::delete_message_response::Object,
13709        }
13710        let DeleteMessageResponse { id, deleted, .. } =
13711            DeleteMessageResponse::deserialize(deserializer)?;
13712        Ok(Self { id, deleted })
13713    }
13714}
13715impl serde::Serialize for DeleteMessageResponse {
13716    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
13717    where
13718        S: serde::Serializer,
13719    {
13720        #[serde_with::serde_as]
13721        #[derive(serde :: Serialize)]
13722        struct DeleteMessageResponse<'a> {
13723            #[serde(rename = "id")]
13724            id: &'a String,
13725            #[serde(rename = "deleted")]
13726            deleted: &'a bool,
13727            #[serde(rename = "object")]
13728            object: &'a crate::__types::delete_message_response::Object,
13729        }
13730        let Self { id, deleted } = self;
13731        DeleteMessageResponse {
13732            id,
13733            deleted,
13734            object: &Default::default(),
13735        }
13736        .serialize(serializer)
13737    }
13738}
13739#[derive(Clone, Debug, PartialEq)]
13740#[serde_with::serde_as]
13741#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
13742pub struct DeleteModelResponse {
13743    #[serde(rename = "id")]
13744    pub id: String,
13745    #[serde(rename = "deleted")]
13746    pub deleted: bool,
13747    #[serde(rename = "object")]
13748    pub object: String,
13749}
13750#[allow(clippy::module_inception)]
13751pub(crate) mod delete_thread_response {
13752    #[doc = "thread.deleted"]
13753    #[derive(Clone, Copy, Debug, Default, PartialEq)]
13754    pub(crate) struct Object;
13755    impl_serde!(Object, "thread.deleted");
13756}
13757#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
13758pub struct DeleteThreadResponse {
13759    pub id: String,
13760    pub deleted: bool,
13761}
13762impl<'de> serde::Deserialize<'de> for DeleteThreadResponse {
13763    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
13764    where
13765        D: serde::Deserializer<'de>,
13766    {
13767        #[serde_with::serde_as]
13768        #[derive(serde :: Deserialize)]
13769        struct DeleteThreadResponse {
13770            #[serde(rename = "id")]
13771            id: String,
13772            #[serde(rename = "deleted")]
13773            deleted: bool,
13774            #[serde(rename = "object")]
13775            #[allow(dead_code)]
13776            object: crate::__types::delete_thread_response::Object,
13777        }
13778        let DeleteThreadResponse { id, deleted, .. } =
13779            DeleteThreadResponse::deserialize(deserializer)?;
13780        Ok(Self { id, deleted })
13781    }
13782}
13783impl serde::Serialize for DeleteThreadResponse {
13784    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
13785    where
13786        S: serde::Serializer,
13787    {
13788        #[serde_with::serde_as]
13789        #[derive(serde :: Serialize)]
13790        struct DeleteThreadResponse<'a> {
13791            #[serde(rename = "id")]
13792            id: &'a String,
13793            #[serde(rename = "deleted")]
13794            deleted: &'a bool,
13795            #[serde(rename = "object")]
13796            object: &'a crate::__types::delete_thread_response::Object,
13797        }
13798        let Self { id, deleted } = self;
13799        DeleteThreadResponse {
13800            id,
13801            deleted,
13802            object: &Default::default(),
13803        }
13804        .serialize(serializer)
13805    }
13806}
13807#[allow(clippy::module_inception)]
13808pub(crate) mod delete_vector_store_file_response {
13809    #[doc = "vector_store.file.deleted"]
13810    #[derive(Clone, Copy, Debug, Default, PartialEq)]
13811    pub(crate) struct Object;
13812    impl_serde!(Object, "vector_store.file.deleted");
13813}
13814#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
13815pub struct DeleteVectorStoreFileResponse {
13816    pub id: String,
13817    pub deleted: bool,
13818}
13819impl<'de> serde::Deserialize<'de> for DeleteVectorStoreFileResponse {
13820    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
13821    where
13822        D: serde::Deserializer<'de>,
13823    {
13824        #[serde_with::serde_as]
13825        #[derive(serde :: Deserialize)]
13826        struct DeleteVectorStoreFileResponse {
13827            #[serde(rename = "id")]
13828            id: String,
13829            #[serde(rename = "deleted")]
13830            deleted: bool,
13831            #[serde(rename = "object")]
13832            #[allow(dead_code)]
13833            object: crate::__types::delete_vector_store_file_response::Object,
13834        }
13835        let DeleteVectorStoreFileResponse { id, deleted, .. } =
13836            DeleteVectorStoreFileResponse::deserialize(deserializer)?;
13837        Ok(Self { id, deleted })
13838    }
13839}
13840impl serde::Serialize for DeleteVectorStoreFileResponse {
13841    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
13842    where
13843        S: serde::Serializer,
13844    {
13845        #[serde_with::serde_as]
13846        #[derive(serde :: Serialize)]
13847        struct DeleteVectorStoreFileResponse<'a> {
13848            #[serde(rename = "id")]
13849            id: &'a String,
13850            #[serde(rename = "deleted")]
13851            deleted: &'a bool,
13852            #[serde(rename = "object")]
13853            object: &'a crate::__types::delete_vector_store_file_response::Object,
13854        }
13855        let Self { id, deleted } = self;
13856        DeleteVectorStoreFileResponse {
13857            id,
13858            deleted,
13859            object: &Default::default(),
13860        }
13861        .serialize(serializer)
13862    }
13863}
13864#[allow(clippy::module_inception)]
13865pub(crate) mod delete_vector_store_response {
13866    #[doc = "vector_store.deleted"]
13867    #[derive(Clone, Copy, Debug, Default, PartialEq)]
13868    pub(crate) struct Object;
13869    impl_serde!(Object, "vector_store.deleted");
13870}
13871#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
13872pub struct DeleteVectorStoreResponse {
13873    pub id: String,
13874    pub deleted: bool,
13875}
13876impl<'de> serde::Deserialize<'de> for DeleteVectorStoreResponse {
13877    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
13878    where
13879        D: serde::Deserializer<'de>,
13880    {
13881        #[serde_with::serde_as]
13882        #[derive(serde :: Deserialize)]
13883        struct DeleteVectorStoreResponse {
13884            #[serde(rename = "id")]
13885            id: String,
13886            #[serde(rename = "deleted")]
13887            deleted: bool,
13888            #[serde(rename = "object")]
13889            #[allow(dead_code)]
13890            object: crate::__types::delete_vector_store_response::Object,
13891        }
13892        let DeleteVectorStoreResponse { id, deleted, .. } =
13893            DeleteVectorStoreResponse::deserialize(deserializer)?;
13894        Ok(Self { id, deleted })
13895    }
13896}
13897impl serde::Serialize for DeleteVectorStoreResponse {
13898    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
13899    where
13900        S: serde::Serializer,
13901    {
13902        #[serde_with::serde_as]
13903        #[derive(serde :: Serialize)]
13904        struct DeleteVectorStoreResponse<'a> {
13905            #[serde(rename = "id")]
13906            id: &'a String,
13907            #[serde(rename = "deleted")]
13908            deleted: &'a bool,
13909            #[serde(rename = "object")]
13910            object: &'a crate::__types::delete_vector_store_response::Object,
13911        }
13912        let Self { id, deleted } = self;
13913        DeleteVectorStoreResponse {
13914            id,
13915            deleted,
13916            object: &Default::default(),
13917        }
13918        .serialize(serializer)
13919    }
13920}
13921#[allow(clippy::module_inception)]
13922pub(crate) mod deleted_conversation {
13923    #[doc = "conversation.deleted"]
13924    #[derive(Clone, Copy, Debug, Default, PartialEq)]
13925    pub(crate) struct Object;
13926    impl_serde!(Object, "conversation.deleted");
13927}
13928#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
13929pub struct DeletedConversation {
13930    pub deleted: bool,
13931    pub id: String,
13932}
13933impl<'de> serde::Deserialize<'de> for DeletedConversation {
13934    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
13935    where
13936        D: serde::Deserializer<'de>,
13937    {
13938        #[serde_with::serde_as]
13939        #[derive(serde :: Deserialize)]
13940        struct DeletedConversation {
13941            #[serde(rename = "object")]
13942            #[allow(dead_code)]
13943            object: crate::__types::deleted_conversation::Object,
13944            #[serde(rename = "deleted")]
13945            deleted: bool,
13946            #[serde(rename = "id")]
13947            id: String,
13948        }
13949        let DeletedConversation { deleted, id, .. } =
13950            DeletedConversation::deserialize(deserializer)?;
13951        Ok(Self { deleted, id })
13952    }
13953}
13954impl serde::Serialize for DeletedConversation {
13955    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
13956    where
13957        S: serde::Serializer,
13958    {
13959        #[serde_with::serde_as]
13960        #[derive(serde :: Serialize)]
13961        struct DeletedConversation<'a> {
13962            #[serde(rename = "object")]
13963            object: &'a crate::__types::deleted_conversation::Object,
13964            #[serde(rename = "deleted")]
13965            deleted: &'a bool,
13966            #[serde(rename = "id")]
13967            id: &'a String,
13968        }
13969        let Self { deleted, id } = self;
13970        DeletedConversation {
13971            object: &Default::default(),
13972            deleted,
13973            id,
13974        }
13975        .serialize(serializer)
13976    }
13977}
13978#[allow(clippy::module_inception)]
13979pub(crate) mod done_event {
13980    #[doc = "done"]
13981    #[derive(Clone, Copy, Debug, Default, PartialEq)]
13982    pub(crate) struct Event;
13983    impl_serde!(Event, "done");
13984    #[doc = "[DONE]"]
13985    #[derive(Clone, Copy, Debug, Default, PartialEq)]
13986    pub(crate) struct Data;
13987    impl_serde!(Data, "[DONE]");
13988}
13989#[doc = "Occurs when a stream ends."]
13990#[derive(Clone, Copy, Debug, Default, PartialEq, typed_builder :: TypedBuilder)]
13991pub struct DoneEvent {}
13992impl<'de> serde::Deserialize<'de> for DoneEvent {
13993    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
13994    where
13995        D: serde::Deserializer<'de>,
13996    {
13997        #[serde_with::serde_as]
13998        #[derive(serde :: Deserialize)]
13999        struct DoneEvent {
14000            #[serde(rename = "event")]
14001            #[allow(dead_code)]
14002            event: crate::__types::done_event::Event,
14003            #[serde(rename = "data")]
14004            #[allow(dead_code)]
14005            data: crate::__types::done_event::Data,
14006        }
14007        let DoneEvent { .. } = DoneEvent::deserialize(deserializer)?;
14008        Ok(Self {})
14009    }
14010}
14011impl serde::Serialize for DoneEvent {
14012    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
14013    where
14014        S: serde::Serializer,
14015    {
14016        #[serde_with::serde_as]
14017        #[derive(serde :: Serialize)]
14018        struct DoneEvent<'a> {
14019            #[serde(rename = "event")]
14020            event: &'a crate::__types::done_event::Event,
14021            #[serde(rename = "data")]
14022            data: &'a crate::__types::done_event::Data,
14023        }
14024        let Self {} = self;
14025        DoneEvent {
14026            event: &Default::default(),
14027            data: &Default::default(),
14028        }
14029        .serialize(serializer)
14030    }
14031}
14032#[allow(clippy::module_inception)]
14033pub(crate) mod double_click {
14034    #[doc = "Specifies the event type. For a double click action, this property is \nalways set to `double_click`.\n"]
14035    #[derive(Clone, Copy, Debug, Default, PartialEq)]
14036    pub(crate) struct Type;
14037    impl_serde!(Type, "double_click");
14038}
14039#[doc = "A double click action.\n"]
14040#[derive(Clone, Copy, Debug, PartialEq, typed_builder :: TypedBuilder)]
14041pub struct DoubleClick {
14042    #[doc = "The x-coordinate where the double click occurred.\n"]
14043    pub x: i64,
14044    #[doc = "The y-coordinate where the double click occurred.\n"]
14045    pub y: i64,
14046}
14047impl<'de> serde::Deserialize<'de> for DoubleClick {
14048    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
14049    where
14050        D: serde::Deserializer<'de>,
14051    {
14052        #[serde_with::serde_as]
14053        #[derive(serde :: Deserialize)]
14054        struct DoubleClick {
14055            #[serde(rename = "type")]
14056            #[allow(dead_code)]
14057            r#type: crate::__types::double_click::Type,
14058            #[serde(rename = "x")]
14059            x: i64,
14060            #[serde(rename = "y")]
14061            y: i64,
14062        }
14063        let DoubleClick { x, y, .. } = DoubleClick::deserialize(deserializer)?;
14064        Ok(Self { x, y })
14065    }
14066}
14067impl serde::Serialize for DoubleClick {
14068    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
14069    where
14070        S: serde::Serializer,
14071    {
14072        #[serde_with::serde_as]
14073        #[derive(serde :: Serialize)]
14074        struct DoubleClick<'a> {
14075            #[serde(rename = "type")]
14076            r#type: &'a crate::__types::double_click::Type,
14077            #[serde(rename = "x")]
14078            x: &'a i64,
14079            #[serde(rename = "y")]
14080            y: &'a i64,
14081        }
14082        let Self { x, y } = self;
14083        DoubleClick {
14084            r#type: &Default::default(),
14085            x,
14086            y,
14087        }
14088        .serialize(serializer)
14089    }
14090}
14091#[allow(clippy::module_inception)]
14092pub(crate) mod drag {
14093    #[doc = "Specifies the event type. For a drag action, this property is \nalways set to `drag`.\n"]
14094    #[derive(Clone, Copy, Debug, Default, PartialEq)]
14095    pub(crate) struct Type;
14096    impl_serde!(Type, "drag");
14097}
14098#[doc = "A drag action.\n"]
14099#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
14100pub struct Drag {
14101    #[doc = "An array of coordinates representing the path of the drag action. Coordinates will appear as an array\nof objects, eg\n```text\n[\n  { x: 100, y: 200 },\n  { x: 200, y: 300 }\n]\n```\n"]
14102    pub path: Vec<crate::__types::Coordinate>,
14103}
14104impl<'de> serde::Deserialize<'de> for Drag {
14105    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
14106    where
14107        D: serde::Deserializer<'de>,
14108    {
14109        #[serde_with::serde_as]
14110        #[derive(serde :: Deserialize)]
14111        struct Drag {
14112            #[serde(rename = "type")]
14113            #[allow(dead_code)]
14114            r#type: crate::__types::drag::Type,
14115            #[serde(rename = "path")]
14116            path: Vec<crate::__types::Coordinate>,
14117        }
14118        let Drag { path, .. } = Drag::deserialize(deserializer)?;
14119        Ok(Self { path })
14120    }
14121}
14122impl serde::Serialize for Drag {
14123    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
14124    where
14125        S: serde::Serializer,
14126    {
14127        #[serde_with::serde_as]
14128        #[derive(serde :: Serialize)]
14129        struct Drag<'a> {
14130            #[serde(rename = "type")]
14131            r#type: &'a crate::__types::drag::Type,
14132            #[serde(rename = "path")]
14133            path: &'a Vec<crate::__types::Coordinate>,
14134        }
14135        let Self { path } = self;
14136        Drag {
14137            r#type: &Default::default(),
14138            path,
14139        }
14140        .serialize(serializer)
14141    }
14142}
14143#[allow(clippy::module_inception)]
14144pub mod easy_input_message {
14145    #[doc = "The role of the message input. One of `user`, `assistant`, `system`, or\n`developer`.\n"]
14146    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
14147    pub enum Role {
14148        #[doc = "`user`"]
14149        #[serde(rename = "user")]
14150        User,
14151        #[doc = "`assistant`"]
14152        #[serde(rename = "assistant")]
14153        Assistant,
14154        #[doc = "`system`"]
14155        #[serde(rename = "system")]
14156        System,
14157        #[doc = "`developer`"]
14158        #[serde(rename = "developer")]
14159        Developer,
14160    }
14161    #[doc = "Text, image, or audio input to the model, used to generate a response.\nCan also contain previous assistant responses.\n"]
14162    #[derive(Clone, Debug, PartialEq)]
14163    #[serde_with::serde_as]
14164    #[derive(serde :: Deserialize, serde :: Serialize)]
14165    #[serde(untagged)]
14166    #[allow(clippy::large_enum_variant)]
14167    pub enum Content {
14168        #[doc = "A text input to the model.\n"]
14169        String(String),
14170        InputMessageContentList(crate::__types::InputMessageContentList),
14171    }
14172    #[doc = "The type of the message input. Always `message`.\n"]
14173    #[derive(Clone, Copy, Debug, Default, PartialEq)]
14174    pub struct Type;
14175    impl_serde!(Type, "message");
14176}
14177#[doc = "A message input to the model with a role indicating instruction following\nhierarchy. Instructions given with the `developer` or `system` role take\nprecedence over instructions given with the `user` role. Messages with the\n`assistant` role are presumed to have been generated by the model in previous\ninteractions.\n"]
14178#[derive(Clone, Debug, PartialEq)]
14179#[serde_with::serde_as]
14180#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
14181pub struct EasyInputMessage {
14182    #[doc = "The role of the message input. One of `user`, `assistant`, `system`, or\n`developer`.\n"]
14183    #[serde(rename = "role")]
14184    pub role: crate::__types::easy_input_message::Role,
14185    #[doc = "Text, image, or audio input to the model, used to generate a response.\nCan also contain previous assistant responses.\n"]
14186    #[serde(rename = "content")]
14187    pub content: crate::__types::easy_input_message::Content,
14188    #[doc = "The type of the message input. Always `message`.\n"]
14189    #[serde(rename = "type")]
14190    #[serde(skip_serializing_if = "Option::is_none")]
14191    #[builder(default)]
14192    pub r#type: Option<crate::__types::easy_input_message::Type>,
14193}
14194#[allow(clippy::module_inception)]
14195pub(crate) mod embedding {
14196    #[doc = "The object type, which is always \"embedding\"."]
14197    #[derive(Clone, Copy, Debug, Default, PartialEq)]
14198    pub(crate) struct Object;
14199    impl_serde!(Object, "embedding");
14200}
14201#[doc = "Represents an embedding vector returned by embedding endpoint.\n"]
14202#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
14203pub struct Embedding {
14204    #[doc = "The index of the embedding in the list of embeddings."]
14205    pub index: i64,
14206    #[doc = "The embedding vector, which is a list of floats. The length of vector depends on the model as listed in the [embedding guide](https://platform.openai.com/docs/guides/embeddings).\n"]
14207    pub embedding: Vec<f64>,
14208}
14209impl<'de> serde::Deserialize<'de> for Embedding {
14210    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
14211    where
14212        D: serde::Deserializer<'de>,
14213    {
14214        #[serde_with::serde_as]
14215        #[derive(serde :: Deserialize)]
14216        struct Embedding {
14217            #[serde(rename = "index")]
14218            index: i64,
14219            #[serde(rename = "embedding")]
14220            embedding: Vec<f64>,
14221            #[serde(rename = "object")]
14222            #[allow(dead_code)]
14223            object: crate::__types::embedding::Object,
14224        }
14225        let Embedding {
14226            index, embedding, ..
14227        } = Embedding::deserialize(deserializer)?;
14228        Ok(Self { index, embedding })
14229    }
14230}
14231impl serde::Serialize for Embedding {
14232    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
14233    where
14234        S: serde::Serializer,
14235    {
14236        #[serde_with::serde_as]
14237        #[derive(serde :: Serialize)]
14238        struct Embedding<'a> {
14239            #[serde(rename = "index")]
14240            index: &'a i64,
14241            #[serde(rename = "embedding")]
14242            embedding: &'a Vec<f64>,
14243            #[serde(rename = "object")]
14244            object: &'a crate::__types::embedding::Object,
14245        }
14246        let Self { index, embedding } = self;
14247        Embedding {
14248            index,
14249            embedding,
14250            object: &Default::default(),
14251        }
14252        .serialize(serializer)
14253    }
14254}
14255#[derive(Clone, Debug, PartialEq)]
14256#[serde_with::serde_as]
14257#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
14258pub struct Error {
14259    #[serde(rename = "code")]
14260    #[serde(skip_serializing_if = "Option::is_none")]
14261    #[builder(default)]
14262    pub code: Option<String>,
14263    #[serde(rename = "message")]
14264    pub message: String,
14265    #[serde(rename = "param")]
14266    #[serde(skip_serializing_if = "Option::is_none")]
14267    #[builder(default)]
14268    pub param: Option<String>,
14269    #[serde(rename = "type")]
14270    pub r#type: String,
14271}
14272#[allow(clippy::module_inception)]
14273pub(crate) mod error_event {
14274    #[doc = "error"]
14275    #[derive(Clone, Copy, Debug, Default, PartialEq)]
14276    pub(crate) struct Event;
14277    impl_serde!(Event, "error");
14278}
14279#[doc = "Occurs when an [error](https://platform.openai.com/docs/guides/error-codes#api-errors) occurs. This can happen due to an internal server error or a timeout."]
14280#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
14281pub struct ErrorEvent {
14282    pub data: crate::__types::Error,
14283}
14284impl<'de> serde::Deserialize<'de> for ErrorEvent {
14285    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
14286    where
14287        D: serde::Deserializer<'de>,
14288    {
14289        #[serde_with::serde_as]
14290        #[derive(serde :: Deserialize)]
14291        struct ErrorEvent {
14292            #[serde(rename = "event")]
14293            #[allow(dead_code)]
14294            event: crate::__types::error_event::Event,
14295            #[serde(rename = "data")]
14296            data: crate::__types::Error,
14297        }
14298        let ErrorEvent { data, .. } = ErrorEvent::deserialize(deserializer)?;
14299        Ok(Self { data })
14300    }
14301}
14302impl serde::Serialize for ErrorEvent {
14303    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
14304    where
14305        S: serde::Serializer,
14306    {
14307        #[serde_with::serde_as]
14308        #[derive(serde :: Serialize)]
14309        struct ErrorEvent<'a> {
14310            #[serde(rename = "event")]
14311            event: &'a crate::__types::error_event::Event,
14312            #[serde(rename = "data")]
14313            data: &'a crate::__types::Error,
14314        }
14315        let Self { data } = self;
14316        ErrorEvent {
14317            event: &Default::default(),
14318            data,
14319        }
14320        .serialize(serializer)
14321    }
14322}
14323#[derive(Clone, Debug, PartialEq)]
14324#[serde_with::serde_as]
14325#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
14326pub struct ErrorResponse {
14327    #[serde(rename = "error")]
14328    pub error: crate::__types::Error,
14329}
14330#[allow(clippy::module_inception)]
14331pub mod eval {
14332    #[doc = "The object type."]
14333    #[derive(Clone, Copy, Debug, Default, PartialEq)]
14334    pub(crate) struct Object;
14335    impl_serde!(Object, "eval");
14336    #[doc = "Configuration of data sources used in runs of the evaluation."]
14337    #[derive(Clone, Debug, PartialEq)]
14338    #[serde_with::serde_as]
14339    #[derive(serde :: Deserialize, serde :: Serialize)]
14340    #[serde(untagged)]
14341    #[allow(clippy::large_enum_variant)]
14342    pub enum DataSourceConfig {
14343        Custom(crate::__types::EvalCustomDataSourceConfig),
14344        Logs(crate::__types::EvalLogsDataSourceConfig),
14345        StoredCompletions(crate::__types::EvalStoredCompletionsDataSourceConfig),
14346    }
14347    #[allow(clippy::module_inception)]
14348    pub mod testing_criteria {
14349        #[derive(Clone, Debug, PartialEq)]
14350        #[serde_with::serde_as]
14351        #[derive(serde :: Deserialize, serde :: Serialize)]
14352        #[serde(untagged)]
14353        #[allow(clippy::large_enum_variant)]
14354        pub enum Item {
14355            LabelModel(crate::__types::EvalGraderLabelModel),
14356            StringCheck(crate::__types::EvalGraderStringCheck),
14357            TextSimilarity(crate::__types::EvalGraderTextSimilarity),
14358            Python(crate::__types::EvalGraderPython),
14359            ScoreModel(crate::__types::EvalGraderScoreModel),
14360        }
14361    }
14362}
14363#[doc = "An Eval object with a data source config and testing criteria.\nAn Eval represents a task to be done for your LLM integration.\nLike:\n - Improve the quality of my chatbot\n - See how well my chatbot handles customer support\n - Check if o4-mini is better at my usecase than gpt-4o\n"]
14364#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
14365pub struct Eval {
14366    #[doc = "Unique identifier for the evaluation."]
14367    pub id: String,
14368    #[doc = "The name of the evaluation."]
14369    pub name: String,
14370    #[doc = "Configuration of data sources used in runs of the evaluation."]
14371    pub data_source_config: crate::__types::eval::DataSourceConfig,
14372    #[doc = "A list of testing criteria."]
14373    pub testing_criteria: Vec<crate::__types::eval::testing_criteria::Item>,
14374    #[doc = "The Unix timestamp (in seconds) for when the eval was created."]
14375    pub created_at: i64,
14376    #[builder(default)]
14377    pub metadata: Option<crate::__types::Metadata>,
14378}
14379impl<'de> serde::Deserialize<'de> for Eval {
14380    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
14381    where
14382        D: serde::Deserializer<'de>,
14383    {
14384        #[serde_with::serde_as]
14385        #[derive(serde :: Deserialize)]
14386        struct Eval {
14387            #[serde(rename = "object")]
14388            #[allow(dead_code)]
14389            object: crate::__types::eval::Object,
14390            #[serde(rename = "id")]
14391            id: String,
14392            #[serde(rename = "name")]
14393            name: String,
14394            #[serde(rename = "data_source_config")]
14395            data_source_config: crate::__types::eval::DataSourceConfig,
14396            #[serde(rename = "testing_criteria")]
14397            testing_criteria: Vec<crate::__types::eval::testing_criteria::Item>,
14398            #[serde(rename = "created_at")]
14399            created_at: i64,
14400            #[serde(rename = "metadata")]
14401            metadata: Option<crate::__types::Metadata>,
14402        }
14403        let Eval {
14404            id,
14405            name,
14406            data_source_config,
14407            testing_criteria,
14408            created_at,
14409            metadata,
14410            ..
14411        } = Eval::deserialize(deserializer)?;
14412        Ok(Self {
14413            id,
14414            name,
14415            data_source_config,
14416            testing_criteria,
14417            created_at,
14418            metadata,
14419        })
14420    }
14421}
14422impl serde::Serialize for Eval {
14423    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
14424    where
14425        S: serde::Serializer,
14426    {
14427        #[serde_with::serde_as]
14428        #[derive(serde :: Serialize)]
14429        struct Eval<'a> {
14430            #[serde(rename = "object")]
14431            object: &'a crate::__types::eval::Object,
14432            #[serde(rename = "id")]
14433            id: &'a String,
14434            #[serde(rename = "name")]
14435            name: &'a String,
14436            #[serde(rename = "data_source_config")]
14437            data_source_config: &'a crate::__types::eval::DataSourceConfig,
14438            #[serde(rename = "testing_criteria")]
14439            testing_criteria: &'a Vec<crate::__types::eval::testing_criteria::Item>,
14440            #[serde(rename = "created_at")]
14441            created_at: &'a i64,
14442            #[serde(rename = "metadata")]
14443            #[serde(skip_serializing_if = "Option::is_none")]
14444            metadata: &'a Option<crate::__types::Metadata>,
14445        }
14446        let Self {
14447            id,
14448            name,
14449            data_source_config,
14450            testing_criteria,
14451            created_at,
14452            metadata,
14453        } = self;
14454        Eval {
14455            object: &Default::default(),
14456            id,
14457            name,
14458            data_source_config,
14459            testing_criteria,
14460            created_at,
14461            metadata,
14462        }
14463        .serialize(serializer)
14464    }
14465}
14466#[doc = "An object representing an error response from the Eval API.\n"]
14467#[derive(Clone, Debug, PartialEq)]
14468#[serde_with::serde_as]
14469#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
14470pub struct EvalApiError {
14471    #[doc = "The error code."]
14472    #[serde(rename = "code")]
14473    pub code: String,
14474    #[doc = "The error message."]
14475    #[serde(rename = "message")]
14476    pub message: String,
14477}
14478#[allow(clippy::module_inception)]
14479pub(crate) mod eval_custom_data_source_config {
14480    #[doc = "The type of data source. Always `custom`."]
14481    #[derive(Clone, Copy, Debug, Default, PartialEq)]
14482    pub(crate) struct Type;
14483    impl_serde!(Type, "custom");
14484}
14485#[doc = "A CustomDataSourceConfig which specifies the schema of your `item` and optionally `sample` namespaces.\nThe response schema defines the shape of the data that will be:\n- Used to define your testing criteria and\n- What data is required when creating a run\n"]
14486#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
14487pub struct EvalCustomDataSourceConfig {
14488    #[doc = "The json schema for the run data source items.\nLearn how to build JSON schemas [here](https://json-schema.org/).\n"]
14489    pub schema: indexmap::IndexMap<String, serde_json::Value>,
14490}
14491impl<'de> serde::Deserialize<'de> for EvalCustomDataSourceConfig {
14492    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
14493    where
14494        D: serde::Deserializer<'de>,
14495    {
14496        #[serde_with::serde_as]
14497        #[derive(serde :: Deserialize)]
14498        struct EvalCustomDataSourceConfig {
14499            #[serde(rename = "type")]
14500            #[allow(dead_code)]
14501            r#type: crate::__types::eval_custom_data_source_config::Type,
14502            #[serde(rename = "schema")]
14503            schema: indexmap::IndexMap<String, serde_json::Value>,
14504        }
14505        let EvalCustomDataSourceConfig { schema, .. } =
14506            EvalCustomDataSourceConfig::deserialize(deserializer)?;
14507        Ok(Self { schema })
14508    }
14509}
14510impl serde::Serialize for EvalCustomDataSourceConfig {
14511    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
14512    where
14513        S: serde::Serializer,
14514    {
14515        #[serde_with::serde_as]
14516        #[derive(serde :: Serialize)]
14517        struct EvalCustomDataSourceConfig<'a> {
14518            #[serde(rename = "type")]
14519            r#type: &'a crate::__types::eval_custom_data_source_config::Type,
14520            #[serde(rename = "schema")]
14521            schema: &'a indexmap::IndexMap<String, serde_json::Value>,
14522        }
14523        let Self { schema } = self;
14524        EvalCustomDataSourceConfig {
14525            r#type: &Default::default(),
14526            schema,
14527        }
14528        .serialize(serializer)
14529    }
14530}
14531#[allow(clippy::module_inception)]
14532pub(crate) mod eval_grader_label_model {
14533    #[doc = "The object type, which is always `label_model`."]
14534    #[derive(Clone, Copy, Debug, Default, PartialEq)]
14535    pub(crate) struct Type;
14536    impl_serde!(Type, "label_model");
14537}
14538#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
14539pub struct EvalGraderLabelModel {
14540    #[doc = "The name of the grader."]
14541    pub name: String,
14542    #[doc = "The model to use for the evaluation. Must support structured outputs."]
14543    pub model: String,
14544    pub input: Vec<crate::__types::EvalItem>,
14545    #[doc = "The labels to assign to each item in the evaluation."]
14546    pub labels: Vec<String>,
14547    #[doc = "The labels that indicate a passing result. Must be a subset of labels."]
14548    pub passing_labels: Vec<String>,
14549}
14550impl<'de> serde::Deserialize<'de> for EvalGraderLabelModel {
14551    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
14552    where
14553        D: serde::Deserializer<'de>,
14554    {
14555        #[serde_with::serde_as]
14556        #[derive(serde :: Deserialize)]
14557        struct EvalGraderLabelModel {
14558            #[serde(rename = "type")]
14559            #[allow(dead_code)]
14560            r#type: crate::__types::eval_grader_label_model::Type,
14561            #[serde(rename = "name")]
14562            name: String,
14563            #[serde(rename = "model")]
14564            model: String,
14565            #[serde(rename = "input")]
14566            input: Vec<crate::__types::EvalItem>,
14567            #[serde(rename = "labels")]
14568            labels: Vec<String>,
14569            #[serde(rename = "passing_labels")]
14570            passing_labels: Vec<String>,
14571        }
14572        let EvalGraderLabelModel {
14573            name,
14574            model,
14575            input,
14576            labels,
14577            passing_labels,
14578            ..
14579        } = EvalGraderLabelModel::deserialize(deserializer)?;
14580        Ok(Self {
14581            name,
14582            model,
14583            input,
14584            labels,
14585            passing_labels,
14586        })
14587    }
14588}
14589impl serde::Serialize for EvalGraderLabelModel {
14590    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
14591    where
14592        S: serde::Serializer,
14593    {
14594        #[serde_with::serde_as]
14595        #[derive(serde :: Serialize)]
14596        struct EvalGraderLabelModel<'a> {
14597            #[serde(rename = "type")]
14598            r#type: &'a crate::__types::eval_grader_label_model::Type,
14599            #[serde(rename = "name")]
14600            name: &'a String,
14601            #[serde(rename = "model")]
14602            model: &'a String,
14603            #[serde(rename = "input")]
14604            input: &'a Vec<crate::__types::EvalItem>,
14605            #[serde(rename = "labels")]
14606            labels: &'a Vec<String>,
14607            #[serde(rename = "passing_labels")]
14608            passing_labels: &'a Vec<String>,
14609        }
14610        let Self {
14611            name,
14612            model,
14613            input,
14614            labels,
14615            passing_labels,
14616        } = self;
14617        EvalGraderLabelModel {
14618            r#type: &Default::default(),
14619            name,
14620            model,
14621            input,
14622            labels,
14623            passing_labels,
14624        }
14625        .serialize(serializer)
14626    }
14627}
14628#[allow(clippy::module_inception)]
14629pub(crate) mod eval_grader_python {
14630    #[doc = "The object type, which is always `python`."]
14631    #[derive(Clone, Copy, Debug, Default, PartialEq)]
14632    pub(crate) struct Type;
14633    impl_serde!(Type, "python");
14634}
14635#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
14636pub struct EvalGraderPython {
14637    #[doc = "The name of the grader."]
14638    pub name: String,
14639    #[doc = "The source code of the python script."]
14640    pub source: String,
14641    #[doc = "The image tag to use for the python script."]
14642    #[builder(default)]
14643    pub image_tag: Option<String>,
14644    #[doc = "The threshold for the score."]
14645    #[builder(default)]
14646    pub pass_threshold: Option<serde_json::Number>,
14647}
14648impl<'de> serde::Deserialize<'de> for EvalGraderPython {
14649    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
14650    where
14651        D: serde::Deserializer<'de>,
14652    {
14653        #[serde_with::serde_as]
14654        #[derive(serde :: Deserialize)]
14655        struct EvalGraderPython {
14656            #[serde(rename = "type")]
14657            #[allow(dead_code)]
14658            r#type: crate::__types::eval_grader_python::Type,
14659            #[serde(rename = "name")]
14660            name: String,
14661            #[serde(rename = "source")]
14662            source: String,
14663            #[serde(rename = "image_tag")]
14664            image_tag: Option<String>,
14665            #[serde(rename = "pass_threshold")]
14666            pass_threshold: Option<serde_json::Number>,
14667        }
14668        let EvalGraderPython {
14669            name,
14670            source,
14671            image_tag,
14672            pass_threshold,
14673            ..
14674        } = EvalGraderPython::deserialize(deserializer)?;
14675        Ok(Self {
14676            name,
14677            source,
14678            image_tag,
14679            pass_threshold,
14680        })
14681    }
14682}
14683impl serde::Serialize for EvalGraderPython {
14684    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
14685    where
14686        S: serde::Serializer,
14687    {
14688        #[serde_with::serde_as]
14689        #[derive(serde :: Serialize)]
14690        struct EvalGraderPython<'a> {
14691            #[serde(rename = "type")]
14692            r#type: &'a crate::__types::eval_grader_python::Type,
14693            #[serde(rename = "name")]
14694            name: &'a String,
14695            #[serde(rename = "source")]
14696            source: &'a String,
14697            #[serde(rename = "image_tag")]
14698            #[serde(skip_serializing_if = "Option::is_none")]
14699            image_tag: &'a Option<String>,
14700            #[serde(rename = "pass_threshold")]
14701            #[serde(skip_serializing_if = "Option::is_none")]
14702            pass_threshold: &'a Option<serde_json::Number>,
14703        }
14704        let Self {
14705            name,
14706            source,
14707            image_tag,
14708            pass_threshold,
14709        } = self;
14710        EvalGraderPython {
14711            r#type: &Default::default(),
14712            name,
14713            source,
14714            image_tag,
14715            pass_threshold,
14716        }
14717        .serialize(serializer)
14718    }
14719}
14720#[allow(clippy::module_inception)]
14721pub(crate) mod eval_grader_score_model {
14722    #[doc = "The object type, which is always `score_model`."]
14723    #[derive(Clone, Copy, Debug, Default, PartialEq)]
14724    pub(crate) struct Type;
14725    impl_serde!(Type, "score_model");
14726}
14727#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
14728pub struct EvalGraderScoreModel {
14729    #[doc = "The name of the grader."]
14730    pub name: String,
14731    #[doc = "The model to use for the evaluation."]
14732    pub model: String,
14733    #[doc = "The sampling parameters for the model."]
14734    #[builder(default)]
14735    pub sampling_params: Option<indexmap::IndexMap<String, serde_json::Value>>,
14736    #[doc = "The input text. This may include template strings."]
14737    pub input: Vec<crate::__types::EvalItem>,
14738    #[doc = "The range of the score. Defaults to `[0, 1]`."]
14739    #[builder(default)]
14740    pub range: Option<Vec<serde_json::Number>>,
14741    #[doc = "The threshold for the score."]
14742    #[builder(default)]
14743    pub pass_threshold: Option<serde_json::Number>,
14744}
14745impl<'de> serde::Deserialize<'de> for EvalGraderScoreModel {
14746    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
14747    where
14748        D: serde::Deserializer<'de>,
14749    {
14750        #[serde_with::serde_as]
14751        #[derive(serde :: Deserialize)]
14752        struct EvalGraderScoreModel {
14753            #[serde(rename = "type")]
14754            #[allow(dead_code)]
14755            r#type: crate::__types::eval_grader_score_model::Type,
14756            #[serde(rename = "name")]
14757            name: String,
14758            #[serde(rename = "model")]
14759            model: String,
14760            #[serde(rename = "sampling_params")]
14761            sampling_params: Option<indexmap::IndexMap<String, serde_json::Value>>,
14762            #[serde(rename = "input")]
14763            input: Vec<crate::__types::EvalItem>,
14764            #[serde(rename = "range")]
14765            range: Option<Vec<serde_json::Number>>,
14766            #[serde(rename = "pass_threshold")]
14767            pass_threshold: Option<serde_json::Number>,
14768        }
14769        let EvalGraderScoreModel {
14770            name,
14771            model,
14772            sampling_params,
14773            input,
14774            range,
14775            pass_threshold,
14776            ..
14777        } = EvalGraderScoreModel::deserialize(deserializer)?;
14778        Ok(Self {
14779            name,
14780            model,
14781            sampling_params,
14782            input,
14783            range,
14784            pass_threshold,
14785        })
14786    }
14787}
14788impl serde::Serialize for EvalGraderScoreModel {
14789    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
14790    where
14791        S: serde::Serializer,
14792    {
14793        #[serde_with::serde_as]
14794        #[derive(serde :: Serialize)]
14795        struct EvalGraderScoreModel<'a> {
14796            #[serde(rename = "type")]
14797            r#type: &'a crate::__types::eval_grader_score_model::Type,
14798            #[serde(rename = "name")]
14799            name: &'a String,
14800            #[serde(rename = "model")]
14801            model: &'a String,
14802            #[serde(rename = "sampling_params")]
14803            #[serde(skip_serializing_if = "Option::is_none")]
14804            sampling_params: &'a Option<indexmap::IndexMap<String, serde_json::Value>>,
14805            #[serde(rename = "input")]
14806            input: &'a Vec<crate::__types::EvalItem>,
14807            #[serde(rename = "range")]
14808            #[serde(skip_serializing_if = "Option::is_none")]
14809            range: &'a Option<Vec<serde_json::Number>>,
14810            #[serde(rename = "pass_threshold")]
14811            #[serde(skip_serializing_if = "Option::is_none")]
14812            pass_threshold: &'a Option<serde_json::Number>,
14813        }
14814        let Self {
14815            name,
14816            model,
14817            sampling_params,
14818            input,
14819            range,
14820            pass_threshold,
14821        } = self;
14822        EvalGraderScoreModel {
14823            r#type: &Default::default(),
14824            name,
14825            model,
14826            sampling_params,
14827            input,
14828            range,
14829            pass_threshold,
14830        }
14831        .serialize(serializer)
14832    }
14833}
14834#[allow(clippy::module_inception)]
14835pub mod eval_grader_string_check {
14836    #[doc = "The object type, which is always `string_check`."]
14837    #[derive(Clone, Copy, Debug, Default, PartialEq)]
14838    pub(crate) struct Type;
14839    impl_serde!(Type, "string_check");
14840    #[doc = "The string check operation to perform. One of `eq`, `ne`, `like`, or `ilike`."]
14841    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
14842    pub enum Operation {
14843        #[doc = "`eq`"]
14844        #[serde(rename = "eq")]
14845        Eq,
14846        #[doc = "`ne`"]
14847        #[serde(rename = "ne")]
14848        Ne,
14849        #[doc = "`like`"]
14850        #[serde(rename = "like")]
14851        Like,
14852        #[doc = "`ilike`"]
14853        #[serde(rename = "ilike")]
14854        Ilike,
14855    }
14856}
14857#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
14858pub struct EvalGraderStringCheck {
14859    #[doc = "The name of the grader."]
14860    pub name: String,
14861    #[doc = "The input text. This may include template strings."]
14862    pub input: String,
14863    #[doc = "The reference text. This may include template strings."]
14864    pub reference: String,
14865    #[doc = "The string check operation to perform. One of `eq`, `ne`, `like`, or `ilike`."]
14866    pub operation: crate::__types::eval_grader_string_check::Operation,
14867}
14868impl<'de> serde::Deserialize<'de> for EvalGraderStringCheck {
14869    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
14870    where
14871        D: serde::Deserializer<'de>,
14872    {
14873        #[serde_with::serde_as]
14874        #[derive(serde :: Deserialize)]
14875        struct EvalGraderStringCheck {
14876            #[serde(rename = "type")]
14877            #[allow(dead_code)]
14878            r#type: crate::__types::eval_grader_string_check::Type,
14879            #[serde(rename = "name")]
14880            name: String,
14881            #[serde(rename = "input")]
14882            input: String,
14883            #[serde(rename = "reference")]
14884            reference: String,
14885            #[serde(rename = "operation")]
14886            operation: crate::__types::eval_grader_string_check::Operation,
14887        }
14888        let EvalGraderStringCheck {
14889            name,
14890            input,
14891            reference,
14892            operation,
14893            ..
14894        } = EvalGraderStringCheck::deserialize(deserializer)?;
14895        Ok(Self {
14896            name,
14897            input,
14898            reference,
14899            operation,
14900        })
14901    }
14902}
14903impl serde::Serialize for EvalGraderStringCheck {
14904    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
14905    where
14906        S: serde::Serializer,
14907    {
14908        #[serde_with::serde_as]
14909        #[derive(serde :: Serialize)]
14910        struct EvalGraderStringCheck<'a> {
14911            #[serde(rename = "type")]
14912            r#type: &'a crate::__types::eval_grader_string_check::Type,
14913            #[serde(rename = "name")]
14914            name: &'a String,
14915            #[serde(rename = "input")]
14916            input: &'a String,
14917            #[serde(rename = "reference")]
14918            reference: &'a String,
14919            #[serde(rename = "operation")]
14920            operation: &'a crate::__types::eval_grader_string_check::Operation,
14921        }
14922        let Self {
14923            name,
14924            input,
14925            reference,
14926            operation,
14927        } = self;
14928        EvalGraderStringCheck {
14929            r#type: &Default::default(),
14930            name,
14931            input,
14932            reference,
14933            operation,
14934        }
14935        .serialize(serializer)
14936    }
14937}
14938#[allow(clippy::module_inception)]
14939pub mod eval_grader_text_similarity {
14940    #[doc = "The type of grader."]
14941    #[derive(Clone, Copy, Debug, Default, PartialEq)]
14942    pub(crate) struct Type;
14943    impl_serde!(Type, "text_similarity");
14944    #[doc = "The evaluation metric to use. One of `cosine`, `fuzzy_match`, `bleu`, \n`gleu`, `meteor`, `rouge_1`, `rouge_2`, `rouge_3`, `rouge_4`, `rouge_5`, \nor `rouge_l`.\n"]
14945    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
14946    pub enum EvaluationMetric {
14947        #[doc = "`cosine`"]
14948        #[serde(rename = "cosine")]
14949        Cosine,
14950        #[doc = "`fuzzy_match`"]
14951        #[serde(rename = "fuzzy_match")]
14952        FuzzyMatch,
14953        #[doc = "`bleu`"]
14954        #[serde(rename = "bleu")]
14955        Bleu,
14956        #[doc = "`gleu`"]
14957        #[serde(rename = "gleu")]
14958        Gleu,
14959        #[doc = "`meteor`"]
14960        #[serde(rename = "meteor")]
14961        Meteor,
14962        #[doc = "`rouge_1`"]
14963        #[serde(rename = "rouge_1")]
14964        Rouge1,
14965        #[doc = "`rouge_2`"]
14966        #[serde(rename = "rouge_2")]
14967        Rouge2,
14968        #[doc = "`rouge_3`"]
14969        #[serde(rename = "rouge_3")]
14970        Rouge3,
14971        #[doc = "`rouge_4`"]
14972        #[serde(rename = "rouge_4")]
14973        Rouge4,
14974        #[doc = "`rouge_5`"]
14975        #[serde(rename = "rouge_5")]
14976        Rouge5,
14977        #[doc = "`rouge_l`"]
14978        #[serde(rename = "rouge_l")]
14979        RougeL,
14980    }
14981}
14982#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
14983pub struct EvalGraderTextSimilarity {
14984    #[doc = "The name of the grader."]
14985    pub name: String,
14986    #[doc = "The text being graded."]
14987    pub input: String,
14988    #[doc = "The text being graded against."]
14989    pub reference: String,
14990    #[doc = "The evaluation metric to use. One of `cosine`, `fuzzy_match`, `bleu`, \n`gleu`, `meteor`, `rouge_1`, `rouge_2`, `rouge_3`, `rouge_4`, `rouge_5`, \nor `rouge_l`.\n"]
14991    pub evaluation_metric: crate::__types::eval_grader_text_similarity::EvaluationMetric,
14992    #[doc = "The threshold for the score."]
14993    pub pass_threshold: serde_json::Number,
14994}
14995impl<'de> serde::Deserialize<'de> for EvalGraderTextSimilarity {
14996    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
14997    where
14998        D: serde::Deserializer<'de>,
14999    {
15000        #[serde_with::serde_as]
15001        #[derive(serde :: Deserialize)]
15002        struct EvalGraderTextSimilarity {
15003            #[serde(rename = "type")]
15004            #[allow(dead_code)]
15005            r#type: crate::__types::eval_grader_text_similarity::Type,
15006            #[serde(rename = "name")]
15007            name: String,
15008            #[serde(rename = "input")]
15009            input: String,
15010            #[serde(rename = "reference")]
15011            reference: String,
15012            #[serde(rename = "evaluation_metric")]
15013            evaluation_metric: crate::__types::eval_grader_text_similarity::EvaluationMetric,
15014            #[serde(rename = "pass_threshold")]
15015            pass_threshold: serde_json::Number,
15016        }
15017        let EvalGraderTextSimilarity {
15018            name,
15019            input,
15020            reference,
15021            evaluation_metric,
15022            pass_threshold,
15023            ..
15024        } = EvalGraderTextSimilarity::deserialize(deserializer)?;
15025        Ok(Self {
15026            name,
15027            input,
15028            reference,
15029            evaluation_metric,
15030            pass_threshold,
15031        })
15032    }
15033}
15034impl serde::Serialize for EvalGraderTextSimilarity {
15035    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
15036    where
15037        S: serde::Serializer,
15038    {
15039        #[serde_with::serde_as]
15040        #[derive(serde :: Serialize)]
15041        struct EvalGraderTextSimilarity<'a> {
15042            #[serde(rename = "type")]
15043            r#type: &'a crate::__types::eval_grader_text_similarity::Type,
15044            #[serde(rename = "name")]
15045            name: &'a String,
15046            #[serde(rename = "input")]
15047            input: &'a String,
15048            #[serde(rename = "reference")]
15049            reference: &'a String,
15050            #[serde(rename = "evaluation_metric")]
15051            evaluation_metric: &'a crate::__types::eval_grader_text_similarity::EvaluationMetric,
15052            #[serde(rename = "pass_threshold")]
15053            pass_threshold: &'a serde_json::Number,
15054        }
15055        let Self {
15056            name,
15057            input,
15058            reference,
15059            evaluation_metric,
15060            pass_threshold,
15061        } = self;
15062        EvalGraderTextSimilarity {
15063            r#type: &Default::default(),
15064            name,
15065            input,
15066            reference,
15067            evaluation_metric,
15068            pass_threshold,
15069        }
15070        .serialize(serializer)
15071    }
15072}
15073#[allow(clippy::module_inception)]
15074pub mod eval_item {
15075    #[doc = "The role of the message input. One of `user`, `assistant`, `system`, or\n`developer`.\n"]
15076    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
15077    pub enum Role {
15078        #[doc = "`user`"]
15079        #[serde(rename = "user")]
15080        User,
15081        #[doc = "`assistant`"]
15082        #[serde(rename = "assistant")]
15083        Assistant,
15084        #[doc = "`system`"]
15085        #[serde(rename = "system")]
15086        System,
15087        #[doc = "`developer`"]
15088        #[serde(rename = "developer")]
15089        Developer,
15090    }
15091    #[allow(clippy::module_inception)]
15092    pub mod content {
15093        #[allow(clippy::module_inception)]
15094        pub(crate) mod output_text {
15095            #[doc = "The type of the output text. Always `output_text`.\n"]
15096            #[derive(Clone, Copy, Debug, Default, PartialEq)]
15097            pub(crate) struct Type;
15098            impl_serde!(Type, "output_text");
15099        }
15100        #[doc = "A text output from the model.\n"]
15101        #[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
15102        pub struct OutputText {
15103            #[doc = "The text output from the model.\n"]
15104            pub text: String,
15105        }
15106        impl<'de> serde::Deserialize<'de> for OutputText {
15107            fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
15108            where
15109                D: serde::Deserializer<'de>,
15110            {
15111                #[serde_with::serde_as]
15112                #[derive(serde :: Deserialize)]
15113                struct OutputText {
15114                    #[serde(rename = "type")]
15115                    #[allow(dead_code)]
15116                    r#type: crate::__types::eval_item::content::output_text::Type,
15117                    #[serde(rename = "text")]
15118                    text: String,
15119                }
15120                let OutputText { text, .. } = OutputText::deserialize(deserializer)?;
15121                Ok(Self { text })
15122            }
15123        }
15124        impl serde::Serialize for OutputText {
15125            fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
15126            where
15127                S: serde::Serializer,
15128            {
15129                #[serde_with::serde_as]
15130                #[derive(serde :: Serialize)]
15131                struct OutputText<'a> {
15132                    #[serde(rename = "type")]
15133                    r#type: &'a crate::__types::eval_item::content::output_text::Type,
15134                    #[serde(rename = "text")]
15135                    text: &'a String,
15136                }
15137                let Self { text } = self;
15138                OutputText {
15139                    r#type: &Default::default(),
15140                    text,
15141                }
15142                .serialize(serializer)
15143            }
15144        }
15145        #[allow(clippy::module_inception)]
15146        pub(crate) mod input_image {
15147            #[doc = "The type of the image input. Always `input_image`.\n"]
15148            #[derive(Clone, Copy, Debug, Default, PartialEq)]
15149            pub(crate) struct Type;
15150            impl_serde!(Type, "input_image");
15151        }
15152        #[doc = "An image input to the model.\n"]
15153        #[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
15154        pub struct InputImage {
15155            #[doc = "The URL of the image input.\n"]
15156            pub image_url: String,
15157            #[doc = "The detail level of the image to be sent to the model. One of `high`, `low`, or `auto`. Defaults to `auto`.\n"]
15158            #[builder(default)]
15159            pub detail: Option<String>,
15160        }
15161        impl<'de> serde::Deserialize<'de> for InputImage {
15162            fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
15163            where
15164                D: serde::Deserializer<'de>,
15165            {
15166                #[serde_with::serde_as]
15167                #[derive(serde :: Deserialize)]
15168                struct InputImage {
15169                    #[serde(rename = "type")]
15170                    #[allow(dead_code)]
15171                    r#type: crate::__types::eval_item::content::input_image::Type,
15172                    #[serde(rename = "image_url")]
15173                    image_url: String,
15174                    #[serde(rename = "detail")]
15175                    detail: Option<String>,
15176                }
15177                let InputImage {
15178                    image_url, detail, ..
15179                } = InputImage::deserialize(deserializer)?;
15180                Ok(Self { image_url, detail })
15181            }
15182        }
15183        impl serde::Serialize for InputImage {
15184            fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
15185            where
15186                S: serde::Serializer,
15187            {
15188                #[serde_with::serde_as]
15189                #[derive(serde :: Serialize)]
15190                struct InputImage<'a> {
15191                    #[serde(rename = "type")]
15192                    r#type: &'a crate::__types::eval_item::content::input_image::Type,
15193                    #[serde(rename = "image_url")]
15194                    image_url: &'a String,
15195                    #[serde(rename = "detail")]
15196                    #[serde(skip_serializing_if = "Option::is_none")]
15197                    detail: &'a Option<String>,
15198                }
15199                let Self { image_url, detail } = self;
15200                InputImage {
15201                    r#type: &Default::default(),
15202                    image_url,
15203                    detail,
15204                }
15205                .serialize(serializer)
15206            }
15207        }
15208    }
15209    #[doc = "Inputs to the model - can contain template strings.\n"]
15210    #[derive(Clone, Debug, PartialEq)]
15211    #[serde_with::serde_as]
15212    #[derive(serde :: Deserialize, serde :: Serialize)]
15213    #[serde(untagged)]
15214    #[allow(clippy::large_enum_variant)]
15215    pub enum Content {
15216        #[doc = "A text input to the model.\n"]
15217        String(String),
15218        InputText(crate::__types::InputTextContent),
15219        #[doc = "A text output from the model.\n"]
15220        OutputText(crate::__types::eval_item::content::OutputText),
15221        #[doc = "An image input to the model.\n"]
15222        InputImage(crate::__types::eval_item::content::InputImage),
15223        #[doc = "A list of inputs, each of which may be either an input text or input image object.\n"]
15224        Array(Vec<serde_json::Value>),
15225    }
15226    #[doc = "The type of the message input. Always `message`.\n"]
15227    #[derive(Clone, Copy, Debug, Default, PartialEq)]
15228    pub struct Type;
15229    impl_serde!(Type, "message");
15230}
15231#[doc = "A message input to the model with a role indicating instruction following\nhierarchy. Instructions given with the `developer` or `system` role take\nprecedence over instructions given with the `user` role. Messages with the\n`assistant` role are presumed to have been generated by the model in previous\ninteractions.\n"]
15232#[derive(Clone, Debug, PartialEq)]
15233#[serde_with::serde_as]
15234#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
15235pub struct EvalItem {
15236    #[doc = "The role of the message input. One of `user`, `assistant`, `system`, or\n`developer`.\n"]
15237    #[serde(rename = "role")]
15238    pub role: crate::__types::eval_item::Role,
15239    #[doc = "Inputs to the model - can contain template strings.\n"]
15240    #[serde(rename = "content")]
15241    pub content: crate::__types::eval_item::Content,
15242    #[doc = "The type of the message input. Always `message`.\n"]
15243    #[serde(rename = "type")]
15244    #[serde(skip_serializing_if = "Option::is_none")]
15245    #[builder(default)]
15246    pub r#type: Option<crate::__types::eval_item::Type>,
15247}
15248#[allow(clippy::module_inception)]
15249pub mod eval_jsonl_file_content_source {
15250    #[doc = "The type of jsonl source. Always `file_content`."]
15251    #[derive(Clone, Copy, Debug, Default, PartialEq)]
15252    pub(crate) struct Type;
15253    impl_serde!(Type, "file_content");
15254    #[allow(clippy::module_inception)]
15255    pub mod content {
15256        #[derive(Clone, Debug, PartialEq)]
15257        #[serde_with::serde_as]
15258        #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
15259        pub struct Item {
15260            #[serde(rename = "item")]
15261            pub item: indexmap::IndexMap<String, serde_json::Value>,
15262            #[serde(rename = "sample")]
15263            #[serde(skip_serializing_if = "Option::is_none")]
15264            #[builder(default)]
15265            pub sample: Option<indexmap::IndexMap<String, serde_json::Value>>,
15266        }
15267    }
15268}
15269#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
15270pub struct EvalJsonlFileContentSource {
15271    #[doc = "The content of the jsonl file."]
15272    pub content: Vec<crate::__types::eval_jsonl_file_content_source::content::Item>,
15273}
15274impl<'de> serde::Deserialize<'de> for EvalJsonlFileContentSource {
15275    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
15276    where
15277        D: serde::Deserializer<'de>,
15278    {
15279        #[serde_with::serde_as]
15280        #[derive(serde :: Deserialize)]
15281        struct EvalJsonlFileContentSource {
15282            #[serde(rename = "type")]
15283            #[allow(dead_code)]
15284            r#type: crate::__types::eval_jsonl_file_content_source::Type,
15285            #[serde(rename = "content")]
15286            content: Vec<crate::__types::eval_jsonl_file_content_source::content::Item>,
15287        }
15288        let EvalJsonlFileContentSource { content, .. } =
15289            EvalJsonlFileContentSource::deserialize(deserializer)?;
15290        Ok(Self { content })
15291    }
15292}
15293impl serde::Serialize for EvalJsonlFileContentSource {
15294    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
15295    where
15296        S: serde::Serializer,
15297    {
15298        #[serde_with::serde_as]
15299        #[derive(serde :: Serialize)]
15300        struct EvalJsonlFileContentSource<'a> {
15301            #[serde(rename = "type")]
15302            r#type: &'a crate::__types::eval_jsonl_file_content_source::Type,
15303            #[serde(rename = "content")]
15304            content: &'a Vec<crate::__types::eval_jsonl_file_content_source::content::Item>,
15305        }
15306        let Self { content } = self;
15307        EvalJsonlFileContentSource {
15308            r#type: &Default::default(),
15309            content,
15310        }
15311        .serialize(serializer)
15312    }
15313}
15314#[allow(clippy::module_inception)]
15315pub(crate) mod eval_jsonl_file_id_source {
15316    #[doc = "The type of jsonl source. Always `file_id`."]
15317    #[derive(Clone, Copy, Debug, Default, PartialEq)]
15318    pub(crate) struct Type;
15319    impl_serde!(Type, "file_id");
15320}
15321#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
15322pub struct EvalJsonlFileIdSource {
15323    #[doc = "The identifier of the file."]
15324    pub id: String,
15325}
15326impl<'de> serde::Deserialize<'de> for EvalJsonlFileIdSource {
15327    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
15328    where
15329        D: serde::Deserializer<'de>,
15330    {
15331        #[serde_with::serde_as]
15332        #[derive(serde :: Deserialize)]
15333        struct EvalJsonlFileIdSource {
15334            #[serde(rename = "type")]
15335            #[allow(dead_code)]
15336            r#type: crate::__types::eval_jsonl_file_id_source::Type,
15337            #[serde(rename = "id")]
15338            id: String,
15339        }
15340        let EvalJsonlFileIdSource { id, .. } = EvalJsonlFileIdSource::deserialize(deserializer)?;
15341        Ok(Self { id })
15342    }
15343}
15344impl serde::Serialize for EvalJsonlFileIdSource {
15345    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
15346    where
15347        S: serde::Serializer,
15348    {
15349        #[serde_with::serde_as]
15350        #[derive(serde :: Serialize)]
15351        struct EvalJsonlFileIdSource<'a> {
15352            #[serde(rename = "type")]
15353            r#type: &'a crate::__types::eval_jsonl_file_id_source::Type,
15354            #[serde(rename = "id")]
15355            id: &'a String,
15356        }
15357        let Self { id } = self;
15358        EvalJsonlFileIdSource {
15359            r#type: &Default::default(),
15360            id,
15361        }
15362        .serialize(serializer)
15363    }
15364}
15365#[allow(clippy::module_inception)]
15366pub(crate) mod eval_list {
15367    #[doc = "The type of this object. It is always set to \"list\".\n"]
15368    #[derive(Clone, Copy, Debug, Default, PartialEq)]
15369    pub(crate) struct Object;
15370    impl_serde!(Object, "list");
15371}
15372#[doc = "An object representing a list of evals.\n"]
15373#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
15374pub struct EvalList {
15375    #[doc = "An array of eval objects.\n"]
15376    pub data: Vec<crate::__types::Eval>,
15377    #[doc = "The identifier of the first eval in the data array."]
15378    pub first_id: String,
15379    #[doc = "The identifier of the last eval in the data array."]
15380    pub last_id: String,
15381    #[doc = "Indicates whether there are more evals available."]
15382    pub has_more: bool,
15383}
15384impl<'de> serde::Deserialize<'de> for EvalList {
15385    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
15386    where
15387        D: serde::Deserializer<'de>,
15388    {
15389        #[serde_with::serde_as]
15390        #[derive(serde :: Deserialize)]
15391        struct EvalList {
15392            #[serde(rename = "object")]
15393            #[allow(dead_code)]
15394            object: crate::__types::eval_list::Object,
15395            #[serde(rename = "data")]
15396            data: Vec<crate::__types::Eval>,
15397            #[serde(rename = "first_id")]
15398            first_id: String,
15399            #[serde(rename = "last_id")]
15400            last_id: String,
15401            #[serde(rename = "has_more")]
15402            has_more: bool,
15403        }
15404        let EvalList {
15405            data,
15406            first_id,
15407            last_id,
15408            has_more,
15409            ..
15410        } = EvalList::deserialize(deserializer)?;
15411        Ok(Self {
15412            data,
15413            first_id,
15414            last_id,
15415            has_more,
15416        })
15417    }
15418}
15419impl serde::Serialize for EvalList {
15420    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
15421    where
15422        S: serde::Serializer,
15423    {
15424        #[serde_with::serde_as]
15425        #[derive(serde :: Serialize)]
15426        struct EvalList<'a> {
15427            #[serde(rename = "object")]
15428            object: &'a crate::__types::eval_list::Object,
15429            #[serde(rename = "data")]
15430            data: &'a Vec<crate::__types::Eval>,
15431            #[serde(rename = "first_id")]
15432            first_id: &'a String,
15433            #[serde(rename = "last_id")]
15434            last_id: &'a String,
15435            #[serde(rename = "has_more")]
15436            has_more: &'a bool,
15437        }
15438        let Self {
15439            data,
15440            first_id,
15441            last_id,
15442            has_more,
15443        } = self;
15444        EvalList {
15445            object: &Default::default(),
15446            data,
15447            first_id,
15448            last_id,
15449            has_more,
15450        }
15451        .serialize(serializer)
15452    }
15453}
15454#[allow(clippy::module_inception)]
15455pub(crate) mod eval_logs_data_source_config {
15456    #[doc = "The type of data source. Always `logs`."]
15457    #[derive(Clone, Copy, Debug, Default, PartialEq)]
15458    pub(crate) struct Type;
15459    impl_serde!(Type, "logs");
15460}
15461#[doc = "A LogsDataSourceConfig which specifies the metadata property of your logs query.\nThis is usually metadata like `usecase=chatbot` or `prompt-version=v2`, etc.\nThe schema returned by this data source config is used to defined what variables are available in your evals.\n`item` and `sample` are both defined when using this data source config.\n"]
15462#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
15463pub struct EvalLogsDataSourceConfig {
15464    #[builder(default)]
15465    pub metadata: Option<crate::__types::Metadata>,
15466    #[doc = "The json schema for the run data source items.\nLearn how to build JSON schemas [here](https://json-schema.org/).\n"]
15467    pub schema: indexmap::IndexMap<String, serde_json::Value>,
15468}
15469impl<'de> serde::Deserialize<'de> for EvalLogsDataSourceConfig {
15470    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
15471    where
15472        D: serde::Deserializer<'de>,
15473    {
15474        #[serde_with::serde_as]
15475        #[derive(serde :: Deserialize)]
15476        struct EvalLogsDataSourceConfig {
15477            #[serde(rename = "type")]
15478            #[allow(dead_code)]
15479            r#type: crate::__types::eval_logs_data_source_config::Type,
15480            #[serde(rename = "metadata")]
15481            metadata: Option<crate::__types::Metadata>,
15482            #[serde(rename = "schema")]
15483            schema: indexmap::IndexMap<String, serde_json::Value>,
15484        }
15485        let EvalLogsDataSourceConfig {
15486            metadata, schema, ..
15487        } = EvalLogsDataSourceConfig::deserialize(deserializer)?;
15488        Ok(Self { metadata, schema })
15489    }
15490}
15491impl serde::Serialize for EvalLogsDataSourceConfig {
15492    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
15493    where
15494        S: serde::Serializer,
15495    {
15496        #[serde_with::serde_as]
15497        #[derive(serde :: Serialize)]
15498        struct EvalLogsDataSourceConfig<'a> {
15499            #[serde(rename = "type")]
15500            r#type: &'a crate::__types::eval_logs_data_source_config::Type,
15501            #[serde(rename = "metadata")]
15502            #[serde(skip_serializing_if = "Option::is_none")]
15503            metadata: &'a Option<crate::__types::Metadata>,
15504            #[serde(rename = "schema")]
15505            schema: &'a indexmap::IndexMap<String, serde_json::Value>,
15506        }
15507        let Self { metadata, schema } = self;
15508        EvalLogsDataSourceConfig {
15509            r#type: &Default::default(),
15510            metadata,
15511            schema,
15512        }
15513        .serialize(serializer)
15514    }
15515}
15516#[allow(clippy::module_inception)]
15517pub(crate) mod eval_responses_source {
15518    #[doc = "The type of run data source. Always `responses`."]
15519    #[derive(Clone, Copy, Debug, Default, PartialEq)]
15520    pub(crate) struct Type;
15521    impl_serde!(Type, "responses");
15522}
15523#[doc = "A EvalResponsesSource object describing a run data source configuration.\n"]
15524#[derive(Clone, Debug, Default, PartialEq, typed_builder :: TypedBuilder)]
15525pub struct EvalResponsesSource {
15526    #[doc = "Metadata filter for the responses. This is a query parameter used to select responses."]
15527    #[builder(default)]
15528    pub metadata: Option<indexmap::IndexMap<String, serde_json::Value>>,
15529    #[doc = "The name of the model to find responses for. This is a query parameter used to select responses."]
15530    #[builder(default)]
15531    pub model: Option<String>,
15532    #[doc = "Optional string to search the 'instructions' field. This is a query parameter used to select responses."]
15533    #[builder(default)]
15534    pub instructions_search: Option<String>,
15535    #[doc = "Only include items created after this timestamp (inclusive). This is a query parameter used to select responses."]
15536    #[builder(default)]
15537    pub created_after: Option<i64>,
15538    #[doc = "Only include items created before this timestamp (inclusive). This is a query parameter used to select responses."]
15539    #[builder(default)]
15540    pub created_before: Option<i64>,
15541    #[doc = "Optional reasoning effort parameter. This is a query parameter used to select responses."]
15542    #[builder(default)]
15543    pub reasoning_effort: Option<crate::__types::ReasoningEffort>,
15544    #[doc = "Sampling temperature. This is a query parameter used to select responses."]
15545    #[builder(default)]
15546    pub temperature: Option<serde_json::Number>,
15547    #[doc = "Nucleus sampling parameter. This is a query parameter used to select responses."]
15548    #[builder(default)]
15549    pub top_p: Option<serde_json::Number>,
15550    #[doc = "List of user identifiers. This is a query parameter used to select responses."]
15551    #[builder(default)]
15552    pub users: Option<Vec<String>>,
15553    #[doc = "List of tool names. This is a query parameter used to select responses."]
15554    #[builder(default)]
15555    pub tools: Option<Vec<String>>,
15556}
15557impl<'de> serde::Deserialize<'de> for EvalResponsesSource {
15558    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
15559    where
15560        D: serde::Deserializer<'de>,
15561    {
15562        #[serde_with::serde_as]
15563        #[derive(serde :: Deserialize)]
15564        struct EvalResponsesSource {
15565            #[serde(rename = "type")]
15566            #[allow(dead_code)]
15567            r#type: crate::__types::eval_responses_source::Type,
15568            #[serde(rename = "metadata")]
15569            metadata: Option<indexmap::IndexMap<String, serde_json::Value>>,
15570            #[serde(rename = "model")]
15571            model: Option<String>,
15572            #[serde(rename = "instructions_search")]
15573            instructions_search: Option<String>,
15574            #[serde(rename = "created_after")]
15575            created_after: Option<i64>,
15576            #[serde(rename = "created_before")]
15577            created_before: Option<i64>,
15578            #[serde(rename = "reasoning_effort")]
15579            reasoning_effort: Option<crate::__types::ReasoningEffort>,
15580            #[serde(rename = "temperature")]
15581            temperature: Option<serde_json::Number>,
15582            #[serde(rename = "top_p")]
15583            top_p: Option<serde_json::Number>,
15584            #[serde(rename = "users")]
15585            users: Option<Vec<String>>,
15586            #[serde(rename = "tools")]
15587            tools: Option<Vec<String>>,
15588        }
15589        let EvalResponsesSource {
15590            metadata,
15591            model,
15592            instructions_search,
15593            created_after,
15594            created_before,
15595            reasoning_effort,
15596            temperature,
15597            top_p,
15598            users,
15599            tools,
15600            ..
15601        } = EvalResponsesSource::deserialize(deserializer)?;
15602        Ok(Self {
15603            metadata,
15604            model,
15605            instructions_search,
15606            created_after,
15607            created_before,
15608            reasoning_effort,
15609            temperature,
15610            top_p,
15611            users,
15612            tools,
15613        })
15614    }
15615}
15616impl serde::Serialize for EvalResponsesSource {
15617    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
15618    where
15619        S: serde::Serializer,
15620    {
15621        #[serde_with::serde_as]
15622        #[derive(serde :: Serialize)]
15623        struct EvalResponsesSource<'a> {
15624            #[serde(rename = "type")]
15625            r#type: &'a crate::__types::eval_responses_source::Type,
15626            #[serde(rename = "metadata")]
15627            #[serde(skip_serializing_if = "Option::is_none")]
15628            metadata: &'a Option<indexmap::IndexMap<String, serde_json::Value>>,
15629            #[serde(rename = "model")]
15630            #[serde(skip_serializing_if = "Option::is_none")]
15631            model: &'a Option<String>,
15632            #[serde(rename = "instructions_search")]
15633            #[serde(skip_serializing_if = "Option::is_none")]
15634            instructions_search: &'a Option<String>,
15635            #[serde(rename = "created_after")]
15636            #[serde(skip_serializing_if = "Option::is_none")]
15637            created_after: &'a Option<i64>,
15638            #[serde(rename = "created_before")]
15639            #[serde(skip_serializing_if = "Option::is_none")]
15640            created_before: &'a Option<i64>,
15641            #[serde(rename = "reasoning_effort")]
15642            #[serde(skip_serializing_if = "Option::is_none")]
15643            reasoning_effort: &'a Option<crate::__types::ReasoningEffort>,
15644            #[serde(rename = "temperature")]
15645            #[serde(skip_serializing_if = "Option::is_none")]
15646            temperature: &'a Option<serde_json::Number>,
15647            #[serde(rename = "top_p")]
15648            #[serde(skip_serializing_if = "Option::is_none")]
15649            top_p: &'a Option<serde_json::Number>,
15650            #[serde(rename = "users")]
15651            #[serde(skip_serializing_if = "Option::is_none")]
15652            users: &'a Option<Vec<String>>,
15653            #[serde(rename = "tools")]
15654            #[serde(skip_serializing_if = "Option::is_none")]
15655            tools: &'a Option<Vec<String>>,
15656        }
15657        let Self {
15658            metadata,
15659            model,
15660            instructions_search,
15661            created_after,
15662            created_before,
15663            reasoning_effort,
15664            temperature,
15665            top_p,
15666            users,
15667            tools,
15668        } = self;
15669        EvalResponsesSource {
15670            r#type: &Default::default(),
15671            metadata,
15672            model,
15673            instructions_search,
15674            created_after,
15675            created_before,
15676            reasoning_effort,
15677            temperature,
15678            top_p,
15679            users,
15680            tools,
15681        }
15682        .serialize(serializer)
15683    }
15684}
15685#[allow(clippy::module_inception)]
15686pub mod eval_run {
15687    #[doc = "The type of the object. Always \"eval.run\"."]
15688    #[derive(Clone, Copy, Debug, Default, PartialEq)]
15689    pub(crate) struct Object;
15690    impl_serde!(Object, "eval.run");
15691    #[doc = "Counters summarizing the outcomes of the evaluation run."]
15692    #[derive(Clone, Copy, Debug, PartialEq)]
15693    #[serde_with::serde_as]
15694    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
15695    pub struct ResultCounts {
15696        #[doc = "Total number of executed output items."]
15697        #[serde(rename = "total")]
15698        pub total: i64,
15699        #[doc = "Number of output items that resulted in an error."]
15700        #[serde(rename = "errored")]
15701        pub errored: i64,
15702        #[doc = "Number of output items that failed to pass the evaluation."]
15703        #[serde(rename = "failed")]
15704        pub failed: i64,
15705        #[doc = "Number of output items that passed the evaluation."]
15706        #[serde(rename = "passed")]
15707        pub passed: i64,
15708    }
15709    #[allow(clippy::module_inception)]
15710    pub mod per_model_usage {
15711        #[derive(Clone, Debug, PartialEq)]
15712        #[serde_with::serde_as]
15713        #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
15714        pub struct Item {
15715            #[doc = "The name of the model."]
15716            #[serde(rename = "model_name")]
15717            pub model_name: String,
15718            #[doc = "The number of invocations."]
15719            #[serde(rename = "invocation_count")]
15720            pub invocation_count: i64,
15721            #[doc = "The number of prompt tokens used."]
15722            #[serde(rename = "prompt_tokens")]
15723            pub prompt_tokens: i64,
15724            #[doc = "The number of completion tokens generated."]
15725            #[serde(rename = "completion_tokens")]
15726            pub completion_tokens: i64,
15727            #[doc = "The total number of tokens used."]
15728            #[serde(rename = "total_tokens")]
15729            pub total_tokens: i64,
15730            #[doc = "The number of tokens retrieved from cache."]
15731            #[serde(rename = "cached_tokens")]
15732            pub cached_tokens: i64,
15733        }
15734    }
15735    #[allow(clippy::module_inception)]
15736    pub mod per_testing_criteria_results {
15737        #[derive(Clone, Debug, PartialEq)]
15738        #[serde_with::serde_as]
15739        #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
15740        pub struct Item {
15741            #[doc = "A description of the testing criteria."]
15742            #[serde(rename = "testing_criteria")]
15743            pub testing_criteria: String,
15744            #[doc = "Number of tests passed for this criteria."]
15745            #[serde(rename = "passed")]
15746            pub passed: i64,
15747            #[doc = "Number of tests failed for this criteria."]
15748            #[serde(rename = "failed")]
15749            pub failed: i64,
15750        }
15751    }
15752    #[doc = "Information about the run's data source."]
15753    #[derive(Clone, Debug, PartialEq)]
15754    #[serde_with::serde_as]
15755    #[derive(serde :: Deserialize, serde :: Serialize)]
15756    #[serde(untagged)]
15757    #[allow(clippy::large_enum_variant)]
15758    pub enum DataSource {
15759        Jsonl(crate::__types::CreateEvalJsonlRunDataSource),
15760        Completions(crate::__types::CreateEvalCompletionsRunDataSource),
15761        Responses(crate::__types::CreateEvalResponsesRunDataSource),
15762    }
15763}
15764#[doc = "A schema representing an evaluation run.\n"]
15765#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
15766pub struct EvalRun {
15767    #[doc = "Unique identifier for the evaluation run."]
15768    pub id: String,
15769    #[doc = "The identifier of the associated evaluation."]
15770    pub eval_id: String,
15771    #[doc = "The status of the evaluation run."]
15772    pub status: String,
15773    #[doc = "The model that is evaluated, if applicable."]
15774    pub model: String,
15775    #[doc = "The name of the evaluation run."]
15776    pub name: String,
15777    #[doc = "Unix timestamp (in seconds) when the evaluation run was created."]
15778    pub created_at: i64,
15779    #[doc = "The URL to the rendered evaluation run report on the UI dashboard."]
15780    pub report_url: String,
15781    #[doc = "Counters summarizing the outcomes of the evaluation run."]
15782    pub result_counts: crate::__types::eval_run::ResultCounts,
15783    #[doc = "Usage statistics for each model during the evaluation run."]
15784    pub per_model_usage: Vec<crate::__types::eval_run::per_model_usage::Item>,
15785    #[doc = "Results per testing criteria applied during the evaluation run."]
15786    pub per_testing_criteria_results:
15787        Vec<crate::__types::eval_run::per_testing_criteria_results::Item>,
15788    #[doc = "Information about the run's data source."]
15789    pub data_source: crate::__types::eval_run::DataSource,
15790    #[builder(default)]
15791    pub metadata: Option<crate::__types::Metadata>,
15792    pub error: crate::__types::EvalApiError,
15793}
15794impl<'de> serde::Deserialize<'de> for EvalRun {
15795    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
15796    where
15797        D: serde::Deserializer<'de>,
15798    {
15799        #[serde_with::serde_as]
15800        #[derive(serde :: Deserialize)]
15801        struct EvalRun {
15802            #[serde(rename = "object")]
15803            #[allow(dead_code)]
15804            object: crate::__types::eval_run::Object,
15805            #[serde(rename = "id")]
15806            id: String,
15807            #[serde(rename = "eval_id")]
15808            eval_id: String,
15809            #[serde(rename = "status")]
15810            status: String,
15811            #[serde(rename = "model")]
15812            model: String,
15813            #[serde(rename = "name")]
15814            name: String,
15815            #[serde(rename = "created_at")]
15816            created_at: i64,
15817            #[serde(rename = "report_url")]
15818            report_url: String,
15819            #[serde(rename = "result_counts")]
15820            result_counts: crate::__types::eval_run::ResultCounts,
15821            #[serde(rename = "per_model_usage")]
15822            per_model_usage: Vec<crate::__types::eval_run::per_model_usage::Item>,
15823            #[serde(rename = "per_testing_criteria_results")]
15824            per_testing_criteria_results:
15825                Vec<crate::__types::eval_run::per_testing_criteria_results::Item>,
15826            #[serde(rename = "data_source")]
15827            data_source: crate::__types::eval_run::DataSource,
15828            #[serde(rename = "metadata")]
15829            metadata: Option<crate::__types::Metadata>,
15830            #[serde(rename = "error")]
15831            error: crate::__types::EvalApiError,
15832        }
15833        let EvalRun {
15834            id,
15835            eval_id,
15836            status,
15837            model,
15838            name,
15839            created_at,
15840            report_url,
15841            result_counts,
15842            per_model_usage,
15843            per_testing_criteria_results,
15844            data_source,
15845            metadata,
15846            error,
15847            ..
15848        } = EvalRun::deserialize(deserializer)?;
15849        Ok(Self {
15850            id,
15851            eval_id,
15852            status,
15853            model,
15854            name,
15855            created_at,
15856            report_url,
15857            result_counts,
15858            per_model_usage,
15859            per_testing_criteria_results,
15860            data_source,
15861            metadata,
15862            error,
15863        })
15864    }
15865}
15866impl serde::Serialize for EvalRun {
15867    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
15868    where
15869        S: serde::Serializer,
15870    {
15871        #[serde_with::serde_as]
15872        #[derive(serde :: Serialize)]
15873        struct EvalRun<'a> {
15874            #[serde(rename = "object")]
15875            object: &'a crate::__types::eval_run::Object,
15876            #[serde(rename = "id")]
15877            id: &'a String,
15878            #[serde(rename = "eval_id")]
15879            eval_id: &'a String,
15880            #[serde(rename = "status")]
15881            status: &'a String,
15882            #[serde(rename = "model")]
15883            model: &'a String,
15884            #[serde(rename = "name")]
15885            name: &'a String,
15886            #[serde(rename = "created_at")]
15887            created_at: &'a i64,
15888            #[serde(rename = "report_url")]
15889            report_url: &'a String,
15890            #[serde(rename = "result_counts")]
15891            result_counts: &'a crate::__types::eval_run::ResultCounts,
15892            #[serde(rename = "per_model_usage")]
15893            per_model_usage: &'a Vec<crate::__types::eval_run::per_model_usage::Item>,
15894            #[serde(rename = "per_testing_criteria_results")]
15895            per_testing_criteria_results:
15896                &'a Vec<crate::__types::eval_run::per_testing_criteria_results::Item>,
15897            #[serde(rename = "data_source")]
15898            data_source: &'a crate::__types::eval_run::DataSource,
15899            #[serde(rename = "metadata")]
15900            #[serde(skip_serializing_if = "Option::is_none")]
15901            metadata: &'a Option<crate::__types::Metadata>,
15902            #[serde(rename = "error")]
15903            error: &'a crate::__types::EvalApiError,
15904        }
15905        let Self {
15906            id,
15907            eval_id,
15908            status,
15909            model,
15910            name,
15911            created_at,
15912            report_url,
15913            result_counts,
15914            per_model_usage,
15915            per_testing_criteria_results,
15916            data_source,
15917            metadata,
15918            error,
15919        } = self;
15920        EvalRun {
15921            object: &Default::default(),
15922            id,
15923            eval_id,
15924            status,
15925            model,
15926            name,
15927            created_at,
15928            report_url,
15929            result_counts,
15930            per_model_usage,
15931            per_testing_criteria_results,
15932            data_source,
15933            metadata,
15934            error,
15935        }
15936        .serialize(serializer)
15937    }
15938}
15939#[allow(clippy::module_inception)]
15940pub(crate) mod eval_run_list {
15941    #[doc = "The type of this object. It is always set to \"list\".\n"]
15942    #[derive(Clone, Copy, Debug, Default, PartialEq)]
15943    pub(crate) struct Object;
15944    impl_serde!(Object, "list");
15945}
15946#[doc = "An object representing a list of runs for an evaluation.\n"]
15947#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
15948pub struct EvalRunList {
15949    #[doc = "An array of eval run objects.\n"]
15950    pub data: Vec<crate::__types::EvalRun>,
15951    #[doc = "The identifier of the first eval run in the data array."]
15952    pub first_id: String,
15953    #[doc = "The identifier of the last eval run in the data array."]
15954    pub last_id: String,
15955    #[doc = "Indicates whether there are more evals available."]
15956    pub has_more: bool,
15957}
15958impl<'de> serde::Deserialize<'de> for EvalRunList {
15959    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
15960    where
15961        D: serde::Deserializer<'de>,
15962    {
15963        #[serde_with::serde_as]
15964        #[derive(serde :: Deserialize)]
15965        struct EvalRunList {
15966            #[serde(rename = "object")]
15967            #[allow(dead_code)]
15968            object: crate::__types::eval_run_list::Object,
15969            #[serde(rename = "data")]
15970            data: Vec<crate::__types::EvalRun>,
15971            #[serde(rename = "first_id")]
15972            first_id: String,
15973            #[serde(rename = "last_id")]
15974            last_id: String,
15975            #[serde(rename = "has_more")]
15976            has_more: bool,
15977        }
15978        let EvalRunList {
15979            data,
15980            first_id,
15981            last_id,
15982            has_more,
15983            ..
15984        } = EvalRunList::deserialize(deserializer)?;
15985        Ok(Self {
15986            data,
15987            first_id,
15988            last_id,
15989            has_more,
15990        })
15991    }
15992}
15993impl serde::Serialize for EvalRunList {
15994    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
15995    where
15996        S: serde::Serializer,
15997    {
15998        #[serde_with::serde_as]
15999        #[derive(serde :: Serialize)]
16000        struct EvalRunList<'a> {
16001            #[serde(rename = "object")]
16002            object: &'a crate::__types::eval_run_list::Object,
16003            #[serde(rename = "data")]
16004            data: &'a Vec<crate::__types::EvalRun>,
16005            #[serde(rename = "first_id")]
16006            first_id: &'a String,
16007            #[serde(rename = "last_id")]
16008            last_id: &'a String,
16009            #[serde(rename = "has_more")]
16010            has_more: &'a bool,
16011        }
16012        let Self {
16013            data,
16014            first_id,
16015            last_id,
16016            has_more,
16017        } = self;
16018        EvalRunList {
16019            object: &Default::default(),
16020            data,
16021            first_id,
16022            last_id,
16023            has_more,
16024        }
16025        .serialize(serializer)
16026    }
16027}
16028#[allow(clippy::module_inception)]
16029pub mod eval_run_output_item {
16030    #[doc = "The type of the object. Always \"eval.run.output_item\"."]
16031    #[derive(Clone, Copy, Debug, Default, PartialEq)]
16032    pub(crate) struct Object;
16033    impl_serde!(Object, "eval.run.output_item");
16034    #[allow(clippy::module_inception)]
16035    pub mod sample {
16036        #[allow(clippy::module_inception)]
16037        pub mod input {
16038            #[doc = "An input message."]
16039            #[derive(Clone, Debug, PartialEq)]
16040            #[serde_with::serde_as]
16041            #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
16042            pub struct Item {
16043                #[doc = "The role of the message sender (e.g., system, user, developer)."]
16044                #[serde(rename = "role")]
16045                pub role: String,
16046                #[doc = "The content of the message."]
16047                #[serde(rename = "content")]
16048                pub content: String,
16049            }
16050        }
16051        #[allow(clippy::module_inception)]
16052        pub mod output {
16053            #[derive(Clone, Debug, Default, PartialEq)]
16054            #[serde_with::serde_as]
16055            #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
16056            pub struct Item {
16057                #[doc = "The role of the message (e.g. \"system\", \"assistant\", \"user\")."]
16058                #[serde(rename = "role")]
16059                #[serde(skip_serializing_if = "Option::is_none")]
16060                #[builder(default)]
16061                pub role: Option<String>,
16062                #[doc = "The content of the message."]
16063                #[serde(rename = "content")]
16064                #[serde(skip_serializing_if = "Option::is_none")]
16065                #[builder(default)]
16066                pub content: Option<String>,
16067            }
16068        }
16069        #[doc = "Token usage details for the sample."]
16070        #[derive(Clone, Copy, Debug, PartialEq)]
16071        #[serde_with::serde_as]
16072        #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
16073        pub struct Usage {
16074            #[doc = "The total number of tokens used."]
16075            #[serde(rename = "total_tokens")]
16076            pub total_tokens: i64,
16077            #[doc = "The number of completion tokens generated."]
16078            #[serde(rename = "completion_tokens")]
16079            pub completion_tokens: i64,
16080            #[doc = "The number of prompt tokens used."]
16081            #[serde(rename = "prompt_tokens")]
16082            pub prompt_tokens: i64,
16083            #[doc = "The number of tokens retrieved from cache."]
16084            #[serde(rename = "cached_tokens")]
16085            pub cached_tokens: i64,
16086        }
16087    }
16088    #[doc = "A sample containing the input and output of the evaluation run."]
16089    #[derive(Clone, Debug, PartialEq)]
16090    #[serde_with::serde_as]
16091    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
16092    pub struct Sample {
16093        #[doc = "An array of input messages."]
16094        #[serde(rename = "input")]
16095        pub input: Vec<crate::__types::eval_run_output_item::sample::input::Item>,
16096        #[doc = "An array of output messages."]
16097        #[serde(rename = "output")]
16098        pub output: Vec<crate::__types::eval_run_output_item::sample::output::Item>,
16099        #[doc = "The reason why the sample generation was finished."]
16100        #[serde(rename = "finish_reason")]
16101        pub finish_reason: String,
16102        #[doc = "The model used for generating the sample."]
16103        #[serde(rename = "model")]
16104        pub model: String,
16105        #[doc = "Token usage details for the sample."]
16106        #[serde(rename = "usage")]
16107        pub usage: crate::__types::eval_run_output_item::sample::Usage,
16108        #[serde(rename = "error")]
16109        pub error: crate::__types::EvalApiError,
16110        #[doc = "The sampling temperature used."]
16111        #[serde(rename = "temperature")]
16112        pub temperature: serde_json::Number,
16113        #[doc = "The maximum number of tokens allowed for completion."]
16114        #[serde(rename = "max_completion_tokens")]
16115        pub max_completion_tokens: i64,
16116        #[doc = "The top_p value used for sampling."]
16117        #[serde(rename = "top_p")]
16118        pub top_p: serde_json::Number,
16119        #[doc = "The seed used for generating the sample."]
16120        #[serde(rename = "seed")]
16121        pub seed: i64,
16122    }
16123}
16124#[doc = "A schema representing an evaluation run output item.\n"]
16125#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
16126pub struct EvalRunOutputItem {
16127    #[doc = "Unique identifier for the evaluation run output item."]
16128    pub id: String,
16129    #[doc = "The identifier of the evaluation run associated with this output item."]
16130    pub run_id: String,
16131    #[doc = "The identifier of the evaluation group."]
16132    pub eval_id: String,
16133    #[doc = "Unix timestamp (in seconds) when the evaluation run was created."]
16134    pub created_at: i64,
16135    #[doc = "The status of the evaluation run."]
16136    pub status: String,
16137    #[doc = "The identifier for the data source item."]
16138    pub datasource_item_id: i64,
16139    #[doc = "Details of the input data source item."]
16140    pub datasource_item: indexmap::IndexMap<String, serde_json::Value>,
16141    #[doc = "A list of results from the evaluation run."]
16142    pub results: Vec<indexmap::IndexMap<String, serde_json::Value>>,
16143    #[doc = "A sample containing the input and output of the evaluation run."]
16144    pub sample: crate::__types::eval_run_output_item::Sample,
16145}
16146impl<'de> serde::Deserialize<'de> for EvalRunOutputItem {
16147    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
16148    where
16149        D: serde::Deserializer<'de>,
16150    {
16151        #[serde_with::serde_as]
16152        #[derive(serde :: Deserialize)]
16153        struct EvalRunOutputItem {
16154            #[serde(rename = "object")]
16155            #[allow(dead_code)]
16156            object: crate::__types::eval_run_output_item::Object,
16157            #[serde(rename = "id")]
16158            id: String,
16159            #[serde(rename = "run_id")]
16160            run_id: String,
16161            #[serde(rename = "eval_id")]
16162            eval_id: String,
16163            #[serde(rename = "created_at")]
16164            created_at: i64,
16165            #[serde(rename = "status")]
16166            status: String,
16167            #[serde(rename = "datasource_item_id")]
16168            datasource_item_id: i64,
16169            #[serde(rename = "datasource_item")]
16170            datasource_item: indexmap::IndexMap<String, serde_json::Value>,
16171            #[serde(rename = "results")]
16172            results: Vec<indexmap::IndexMap<String, serde_json::Value>>,
16173            #[serde(rename = "sample")]
16174            sample: crate::__types::eval_run_output_item::Sample,
16175        }
16176        let EvalRunOutputItem {
16177            id,
16178            run_id,
16179            eval_id,
16180            created_at,
16181            status,
16182            datasource_item_id,
16183            datasource_item,
16184            results,
16185            sample,
16186            ..
16187        } = EvalRunOutputItem::deserialize(deserializer)?;
16188        Ok(Self {
16189            id,
16190            run_id,
16191            eval_id,
16192            created_at,
16193            status,
16194            datasource_item_id,
16195            datasource_item,
16196            results,
16197            sample,
16198        })
16199    }
16200}
16201impl serde::Serialize for EvalRunOutputItem {
16202    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
16203    where
16204        S: serde::Serializer,
16205    {
16206        #[serde_with::serde_as]
16207        #[derive(serde :: Serialize)]
16208        struct EvalRunOutputItem<'a> {
16209            #[serde(rename = "object")]
16210            object: &'a crate::__types::eval_run_output_item::Object,
16211            #[serde(rename = "id")]
16212            id: &'a String,
16213            #[serde(rename = "run_id")]
16214            run_id: &'a String,
16215            #[serde(rename = "eval_id")]
16216            eval_id: &'a String,
16217            #[serde(rename = "created_at")]
16218            created_at: &'a i64,
16219            #[serde(rename = "status")]
16220            status: &'a String,
16221            #[serde(rename = "datasource_item_id")]
16222            datasource_item_id: &'a i64,
16223            #[serde(rename = "datasource_item")]
16224            datasource_item: &'a indexmap::IndexMap<String, serde_json::Value>,
16225            #[serde(rename = "results")]
16226            results: &'a Vec<indexmap::IndexMap<String, serde_json::Value>>,
16227            #[serde(rename = "sample")]
16228            sample: &'a crate::__types::eval_run_output_item::Sample,
16229        }
16230        let Self {
16231            id,
16232            run_id,
16233            eval_id,
16234            created_at,
16235            status,
16236            datasource_item_id,
16237            datasource_item,
16238            results,
16239            sample,
16240        } = self;
16241        EvalRunOutputItem {
16242            object: &Default::default(),
16243            id,
16244            run_id,
16245            eval_id,
16246            created_at,
16247            status,
16248            datasource_item_id,
16249            datasource_item,
16250            results,
16251            sample,
16252        }
16253        .serialize(serializer)
16254    }
16255}
16256#[allow(clippy::module_inception)]
16257pub(crate) mod eval_run_output_item_list {
16258    #[doc = "The type of this object. It is always set to \"list\".\n"]
16259    #[derive(Clone, Copy, Debug, Default, PartialEq)]
16260    pub(crate) struct Object;
16261    impl_serde!(Object, "list");
16262}
16263#[doc = "An object representing a list of output items for an evaluation run.\n"]
16264#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
16265pub struct EvalRunOutputItemList {
16266    #[doc = "An array of eval run output item objects.\n"]
16267    pub data: Vec<crate::__types::EvalRunOutputItem>,
16268    #[doc = "The identifier of the first eval run output item in the data array."]
16269    pub first_id: String,
16270    #[doc = "The identifier of the last eval run output item in the data array."]
16271    pub last_id: String,
16272    #[doc = "Indicates whether there are more eval run output items available."]
16273    pub has_more: bool,
16274}
16275impl<'de> serde::Deserialize<'de> for EvalRunOutputItemList {
16276    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
16277    where
16278        D: serde::Deserializer<'de>,
16279    {
16280        #[serde_with::serde_as]
16281        #[derive(serde :: Deserialize)]
16282        struct EvalRunOutputItemList {
16283            #[serde(rename = "object")]
16284            #[allow(dead_code)]
16285            object: crate::__types::eval_run_output_item_list::Object,
16286            #[serde(rename = "data")]
16287            data: Vec<crate::__types::EvalRunOutputItem>,
16288            #[serde(rename = "first_id")]
16289            first_id: String,
16290            #[serde(rename = "last_id")]
16291            last_id: String,
16292            #[serde(rename = "has_more")]
16293            has_more: bool,
16294        }
16295        let EvalRunOutputItemList {
16296            data,
16297            first_id,
16298            last_id,
16299            has_more,
16300            ..
16301        } = EvalRunOutputItemList::deserialize(deserializer)?;
16302        Ok(Self {
16303            data,
16304            first_id,
16305            last_id,
16306            has_more,
16307        })
16308    }
16309}
16310impl serde::Serialize for EvalRunOutputItemList {
16311    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
16312    where
16313        S: serde::Serializer,
16314    {
16315        #[serde_with::serde_as]
16316        #[derive(serde :: Serialize)]
16317        struct EvalRunOutputItemList<'a> {
16318            #[serde(rename = "object")]
16319            object: &'a crate::__types::eval_run_output_item_list::Object,
16320            #[serde(rename = "data")]
16321            data: &'a Vec<crate::__types::EvalRunOutputItem>,
16322            #[serde(rename = "first_id")]
16323            first_id: &'a String,
16324            #[serde(rename = "last_id")]
16325            last_id: &'a String,
16326            #[serde(rename = "has_more")]
16327            has_more: &'a bool,
16328        }
16329        let Self {
16330            data,
16331            first_id,
16332            last_id,
16333            has_more,
16334        } = self;
16335        EvalRunOutputItemList {
16336            object: &Default::default(),
16337            data,
16338            first_id,
16339            last_id,
16340            has_more,
16341        }
16342        .serialize(serializer)
16343    }
16344}
16345#[allow(clippy::module_inception)]
16346pub(crate) mod eval_stored_completions_data_source_config {
16347    #[doc = "The type of data source. Always `stored_completions`."]
16348    #[derive(Clone, Copy, Debug, Default, PartialEq)]
16349    pub(crate) struct Type;
16350    impl_serde!(Type, "stored_completions");
16351}
16352#[doc = "Deprecated in favor of LogsDataSourceConfig.\n"]
16353#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
16354pub struct EvalStoredCompletionsDataSourceConfig {
16355    #[builder(default)]
16356    pub metadata: Option<crate::__types::Metadata>,
16357    #[doc = "The json schema for the run data source items.\nLearn how to build JSON schemas [here](https://json-schema.org/).\n"]
16358    pub schema: indexmap::IndexMap<String, serde_json::Value>,
16359}
16360impl<'de> serde::Deserialize<'de> for EvalStoredCompletionsDataSourceConfig {
16361    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
16362    where
16363        D: serde::Deserializer<'de>,
16364    {
16365        #[serde_with::serde_as]
16366        #[derive(serde :: Deserialize)]
16367        struct EvalStoredCompletionsDataSourceConfig {
16368            #[serde(rename = "type")]
16369            #[allow(dead_code)]
16370            r#type: crate::__types::eval_stored_completions_data_source_config::Type,
16371            #[serde(rename = "metadata")]
16372            metadata: Option<crate::__types::Metadata>,
16373            #[serde(rename = "schema")]
16374            schema: indexmap::IndexMap<String, serde_json::Value>,
16375        }
16376        let EvalStoredCompletionsDataSourceConfig {
16377            metadata, schema, ..
16378        } = EvalStoredCompletionsDataSourceConfig::deserialize(deserializer)?;
16379        Ok(Self { metadata, schema })
16380    }
16381}
16382impl serde::Serialize for EvalStoredCompletionsDataSourceConfig {
16383    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
16384    where
16385        S: serde::Serializer,
16386    {
16387        #[serde_with::serde_as]
16388        #[derive(serde :: Serialize)]
16389        struct EvalStoredCompletionsDataSourceConfig<'a> {
16390            #[serde(rename = "type")]
16391            r#type: &'a crate::__types::eval_stored_completions_data_source_config::Type,
16392            #[serde(rename = "metadata")]
16393            #[serde(skip_serializing_if = "Option::is_none")]
16394            metadata: &'a Option<crate::__types::Metadata>,
16395            #[serde(rename = "schema")]
16396            schema: &'a indexmap::IndexMap<String, serde_json::Value>,
16397        }
16398        let Self { metadata, schema } = self;
16399        EvalStoredCompletionsDataSourceConfig {
16400            r#type: &Default::default(),
16401            metadata,
16402            schema,
16403        }
16404        .serialize(serializer)
16405    }
16406}
16407#[allow(clippy::module_inception)]
16408pub(crate) mod eval_stored_completions_source {
16409    #[doc = "The type of source. Always `stored_completions`."]
16410    #[derive(Clone, Copy, Debug, Default, PartialEq)]
16411    pub(crate) struct Type;
16412    impl_serde!(Type, "stored_completions");
16413}
16414#[doc = "A StoredCompletionsRunDataSource configuration describing a set of filters\n"]
16415#[derive(Clone, Debug, Default, PartialEq, typed_builder :: TypedBuilder)]
16416pub struct EvalStoredCompletionsSource {
16417    #[builder(default)]
16418    pub metadata: Option<crate::__types::Metadata>,
16419    #[doc = "An optional model to filter by (e.g., 'gpt-4o')."]
16420    #[builder(default)]
16421    pub model: Option<String>,
16422    #[doc = "An optional Unix timestamp to filter items created after this time."]
16423    #[builder(default)]
16424    pub created_after: Option<i64>,
16425    #[doc = "An optional Unix timestamp to filter items created before this time."]
16426    #[builder(default)]
16427    pub created_before: Option<i64>,
16428    #[doc = "An optional maximum number of items to return."]
16429    #[builder(default)]
16430    pub limit: Option<i64>,
16431}
16432impl<'de> serde::Deserialize<'de> for EvalStoredCompletionsSource {
16433    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
16434    where
16435        D: serde::Deserializer<'de>,
16436    {
16437        #[serde_with::serde_as]
16438        #[derive(serde :: Deserialize)]
16439        struct EvalStoredCompletionsSource {
16440            #[serde(rename = "type")]
16441            #[allow(dead_code)]
16442            r#type: crate::__types::eval_stored_completions_source::Type,
16443            #[serde(rename = "metadata")]
16444            metadata: Option<crate::__types::Metadata>,
16445            #[serde(rename = "model")]
16446            model: Option<String>,
16447            #[serde(rename = "created_after")]
16448            created_after: Option<i64>,
16449            #[serde(rename = "created_before")]
16450            created_before: Option<i64>,
16451            #[serde(rename = "limit")]
16452            limit: Option<i64>,
16453        }
16454        let EvalStoredCompletionsSource {
16455            metadata,
16456            model,
16457            created_after,
16458            created_before,
16459            limit,
16460            ..
16461        } = EvalStoredCompletionsSource::deserialize(deserializer)?;
16462        Ok(Self {
16463            metadata,
16464            model,
16465            created_after,
16466            created_before,
16467            limit,
16468        })
16469    }
16470}
16471impl serde::Serialize for EvalStoredCompletionsSource {
16472    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
16473    where
16474        S: serde::Serializer,
16475    {
16476        #[serde_with::serde_as]
16477        #[derive(serde :: Serialize)]
16478        struct EvalStoredCompletionsSource<'a> {
16479            #[serde(rename = "type")]
16480            r#type: &'a crate::__types::eval_stored_completions_source::Type,
16481            #[serde(rename = "metadata")]
16482            #[serde(skip_serializing_if = "Option::is_none")]
16483            metadata: &'a Option<crate::__types::Metadata>,
16484            #[serde(rename = "model")]
16485            #[serde(skip_serializing_if = "Option::is_none")]
16486            model: &'a Option<String>,
16487            #[serde(rename = "created_after")]
16488            #[serde(skip_serializing_if = "Option::is_none")]
16489            created_after: &'a Option<i64>,
16490            #[serde(rename = "created_before")]
16491            #[serde(skip_serializing_if = "Option::is_none")]
16492            created_before: &'a Option<i64>,
16493            #[serde(rename = "limit")]
16494            #[serde(skip_serializing_if = "Option::is_none")]
16495            limit: &'a Option<i64>,
16496        }
16497        let Self {
16498            metadata,
16499            model,
16500            created_after,
16501            created_before,
16502            limit,
16503        } = self;
16504        EvalStoredCompletionsSource {
16505            r#type: &Default::default(),
16506            metadata,
16507            model,
16508            created_after,
16509            created_before,
16510            limit,
16511        }
16512        .serialize(serializer)
16513    }
16514}
16515#[allow(clippy::module_inception)]
16516pub(crate) mod file_expiration_after {
16517    #[doc = "Anchor timestamp after which the expiration policy applies. Supported anchors: `created_at`."]
16518    #[derive(Clone, Copy, Debug, Default, PartialEq)]
16519    pub(crate) struct Anchor;
16520    impl_serde!(Anchor, "created_at");
16521}
16522#[doc = "The expiration policy for a file. By default, files with `purpose=batch` expire after 30 days and all other files are persisted until they are manually deleted."]
16523#[derive(Clone, Copy, Debug, PartialEq, typed_builder :: TypedBuilder)]
16524pub struct FileExpirationAfter {
16525    #[doc = "The number of seconds after the anchor time that the file will expire. Must be between 3600 (1 hour) and 2592000 (30 days)."]
16526    pub seconds: i64,
16527}
16528impl<'de> serde::Deserialize<'de> for FileExpirationAfter {
16529    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
16530    where
16531        D: serde::Deserializer<'de>,
16532    {
16533        #[serde_with::serde_as]
16534        #[derive(serde :: Deserialize)]
16535        struct FileExpirationAfter {
16536            #[serde(rename = "anchor")]
16537            #[allow(dead_code)]
16538            anchor: crate::__types::file_expiration_after::Anchor,
16539            #[serde(rename = "seconds")]
16540            seconds: i64,
16541        }
16542        let FileExpirationAfter { seconds, .. } = FileExpirationAfter::deserialize(deserializer)?;
16543        Ok(Self { seconds })
16544    }
16545}
16546impl serde::Serialize for FileExpirationAfter {
16547    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
16548    where
16549        S: serde::Serializer,
16550    {
16551        #[serde_with::serde_as]
16552        #[derive(serde :: Serialize)]
16553        struct FileExpirationAfter<'a> {
16554            #[serde(rename = "anchor")]
16555            anchor: &'a crate::__types::file_expiration_after::Anchor,
16556            #[serde(rename = "seconds")]
16557            seconds: &'a i64,
16558        }
16559        let Self { seconds } = self;
16560        FileExpirationAfter {
16561            anchor: &Default::default(),
16562            seconds,
16563        }
16564        .serialize(serializer)
16565    }
16566}
16567#[allow(clippy::module_inception)]
16568pub(crate) mod file_path {
16569    #[doc = "The type of the file path. Always `file_path`.\n"]
16570    #[derive(Clone, Copy, Debug, Default, PartialEq)]
16571    pub(crate) struct Type;
16572    impl_serde!(Type, "file_path");
16573}
16574#[doc = "A path to a file.\n"]
16575#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
16576pub struct FilePath {
16577    #[doc = "The ID of the file.\n"]
16578    pub file_id: String,
16579    #[doc = "The index of the file in the list of files.\n"]
16580    pub index: i64,
16581}
16582impl<'de> serde::Deserialize<'de> for FilePath {
16583    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
16584    where
16585        D: serde::Deserializer<'de>,
16586    {
16587        #[serde_with::serde_as]
16588        #[derive(serde :: Deserialize)]
16589        struct FilePath {
16590            #[serde(rename = "type")]
16591            #[allow(dead_code)]
16592            r#type: crate::__types::file_path::Type,
16593            #[serde(rename = "file_id")]
16594            file_id: String,
16595            #[serde(rename = "index")]
16596            index: i64,
16597        }
16598        let FilePath { file_id, index, .. } = FilePath::deserialize(deserializer)?;
16599        Ok(Self { file_id, index })
16600    }
16601}
16602impl serde::Serialize for FilePath {
16603    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
16604    where
16605        S: serde::Serializer,
16606    {
16607        #[serde_with::serde_as]
16608        #[derive(serde :: Serialize)]
16609        struct FilePath<'a> {
16610            #[serde(rename = "type")]
16611            r#type: &'a crate::__types::file_path::Type,
16612            #[serde(rename = "file_id")]
16613            file_id: &'a String,
16614            #[serde(rename = "index")]
16615            index: &'a i64,
16616        }
16617        let Self { file_id, index } = self;
16618        FilePath {
16619            r#type: &Default::default(),
16620            file_id,
16621            index,
16622        }
16623        .serialize(serializer)
16624    }
16625}
16626#[doc = "The ranker to use for the file search. If not specified will use the `auto` ranker."]
16627#[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
16628pub enum FileSearchRanker {
16629    #[doc = "`auto`"]
16630    #[serde(rename = "auto")]
16631    Auto,
16632    #[doc = "`default_2024_08_21`"]
16633    #[serde(rename = "default_2024_08_21")]
16634    Default2024_08_21,
16635}
16636#[doc = "The ranking options for the file search. If not specified, the file search tool will use the `auto` ranker and a score_threshold of 0.\n\nSee the [file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search#customizing-file-search-settings) for more information.\n"]
16637#[derive(Clone, Debug, PartialEq)]
16638#[serde_with::serde_as]
16639#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
16640pub struct FileSearchRankingOptions {
16641    #[serde(rename = "ranker")]
16642    #[serde(skip_serializing_if = "Option::is_none")]
16643    #[builder(default)]
16644    pub ranker: Option<crate::__types::FileSearchRanker>,
16645    #[doc = "The score threshold for the file search. All values must be a floating point number between 0 and 1."]
16646    #[serde(rename = "score_threshold")]
16647    pub score_threshold: serde_json::Number,
16648}
16649#[allow(clippy::module_inception)]
16650pub mod file_search_tool_call {
16651    #[doc = "The type of the file search tool call. Always `file_search_call`.\n"]
16652    #[derive(Clone, Copy, Debug, Default, PartialEq)]
16653    pub(crate) struct Type;
16654    impl_serde!(Type, "file_search_call");
16655    #[doc = "The status of the file search tool call. One of `in_progress`, \n`searching`, `incomplete` or `failed`,\n"]
16656    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
16657    pub enum Status {
16658        #[doc = "`in_progress`"]
16659        #[serde(rename = "in_progress")]
16660        InProgress,
16661        #[doc = "`searching`"]
16662        #[serde(rename = "searching")]
16663        Searching,
16664        #[doc = "`completed`"]
16665        #[serde(rename = "completed")]
16666        Completed,
16667        #[doc = "`incomplete`"]
16668        #[serde(rename = "incomplete")]
16669        Incomplete,
16670        #[doc = "`failed`"]
16671        #[serde(rename = "failed")]
16672        Failed,
16673    }
16674    #[allow(clippy::module_inception)]
16675    pub mod results {
16676        #[derive(Clone, Debug, Default, PartialEq)]
16677        #[serde_with::serde_as]
16678        #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
16679        pub struct Item {
16680            #[doc = "The unique ID of the file.\n"]
16681            #[serde(rename = "file_id")]
16682            #[serde(skip_serializing_if = "Option::is_none")]
16683            #[builder(default)]
16684            pub file_id: Option<String>,
16685            #[doc = "The text that was retrieved from the file.\n"]
16686            #[serde(rename = "text")]
16687            #[serde(skip_serializing_if = "Option::is_none")]
16688            #[builder(default)]
16689            pub text: Option<String>,
16690            #[doc = "The name of the file.\n"]
16691            #[serde(rename = "filename")]
16692            #[serde(skip_serializing_if = "Option::is_none")]
16693            #[builder(default)]
16694            pub filename: Option<String>,
16695            #[serde(rename = "attributes")]
16696            #[serde(skip_serializing_if = "Option::is_none")]
16697            #[builder(default)]
16698            pub attributes: Option<crate::__types::VectorStoreFileAttributes>,
16699            #[doc = "The relevance score of the file - a value between 0 and 1.\n"]
16700            #[serde(rename = "score")]
16701            #[serde(skip_serializing_if = "Option::is_none")]
16702            #[builder(default)]
16703            pub score: Option<f64>,
16704        }
16705    }
16706}
16707#[doc = "The results of a file search tool call. See the \n[file search guide](https://platform.openai.com/docs/guides/tools-file-search) for more information.\n"]
16708#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
16709pub struct FileSearchToolCall {
16710    #[doc = "The unique ID of the file search tool call.\n"]
16711    pub id: String,
16712    #[doc = "The status of the file search tool call. One of `in_progress`, \n`searching`, `incomplete` or `failed`,\n"]
16713    pub status: crate::__types::file_search_tool_call::Status,
16714    #[doc = "The queries used to search for files.\n"]
16715    pub queries: Vec<String>,
16716    #[doc = "The results of the file search tool call.\n"]
16717    #[builder(default)]
16718    pub results: Option<Vec<crate::__types::file_search_tool_call::results::Item>>,
16719}
16720impl<'de> serde::Deserialize<'de> for FileSearchToolCall {
16721    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
16722    where
16723        D: serde::Deserializer<'de>,
16724    {
16725        #[serde_with::serde_as]
16726        #[derive(serde :: Deserialize)]
16727        struct FileSearchToolCall {
16728            #[serde(rename = "id")]
16729            id: String,
16730            #[serde(rename = "type")]
16731            #[allow(dead_code)]
16732            r#type: crate::__types::file_search_tool_call::Type,
16733            #[serde(rename = "status")]
16734            status: crate::__types::file_search_tool_call::Status,
16735            #[serde(rename = "queries")]
16736            queries: Vec<String>,
16737            #[serde(rename = "results")]
16738            results: Option<Vec<crate::__types::file_search_tool_call::results::Item>>,
16739        }
16740        let FileSearchToolCall {
16741            id,
16742            status,
16743            queries,
16744            results,
16745            ..
16746        } = FileSearchToolCall::deserialize(deserializer)?;
16747        Ok(Self {
16748            id,
16749            status,
16750            queries,
16751            results,
16752        })
16753    }
16754}
16755impl serde::Serialize for FileSearchToolCall {
16756    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
16757    where
16758        S: serde::Serializer,
16759    {
16760        #[serde_with::serde_as]
16761        #[derive(serde :: Serialize)]
16762        struct FileSearchToolCall<'a> {
16763            #[serde(rename = "id")]
16764            id: &'a String,
16765            #[serde(rename = "type")]
16766            r#type: &'a crate::__types::file_search_tool_call::Type,
16767            #[serde(rename = "status")]
16768            status: &'a crate::__types::file_search_tool_call::Status,
16769            #[serde(rename = "queries")]
16770            queries: &'a Vec<String>,
16771            #[serde(rename = "results")]
16772            #[serde(skip_serializing_if = "Option::is_none")]
16773            results: &'a Option<Vec<crate::__types::file_search_tool_call::results::Item>>,
16774        }
16775        let Self {
16776            id,
16777            status,
16778            queries,
16779            results,
16780        } = self;
16781        FileSearchToolCall {
16782            id,
16783            r#type: &Default::default(),
16784            status,
16785            queries,
16786            results,
16787        }
16788        .serialize(serializer)
16789    }
16790}
16791#[allow(clippy::module_inception)]
16792pub mod fine_tune_chat_completion_request_assistant_message {
16793    #[doc = "The contents of the assistant message. Required unless `tool_calls` or `function_call` is specified.\n"]
16794    #[derive(Clone, Debug, PartialEq)]
16795    #[serde_with::serde_as]
16796    #[derive(serde :: Deserialize, serde :: Serialize)]
16797    #[serde(untagged)]
16798    #[allow(clippy::large_enum_variant)]
16799    pub enum Content {
16800        #[doc = "The contents of the assistant message."]
16801        String(String),
16802        #[doc = "An array of content parts with a defined type. Can be one or more of type `text`, or exactly one of type `refusal`."]
16803        Array(Vec<crate::__types::ChatCompletionRequestAssistantMessageContentPart>),
16804    }
16805    #[doc = "The role of the messages author, in this case `assistant`."]
16806    #[derive(Clone, Copy, Debug, Default, PartialEq)]
16807    pub(crate) struct Role;
16808    impl_serde!(Role, "assistant");
16809    #[doc = "Data about a previous audio response from the model. \n[Learn more](https://platform.openai.com/docs/guides/audio).\n"]
16810    #[derive(Clone, Debug, PartialEq)]
16811    #[serde_with::serde_as]
16812    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
16813    pub struct Audio {
16814        #[doc = "Unique identifier for a previous audio response from the model.\n"]
16815        #[serde(rename = "id")]
16816        pub id: String,
16817    }
16818    #[doc = "Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model."]
16819    #[derive(Clone, Debug, PartialEq)]
16820    #[serde_with::serde_as]
16821    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
16822    pub struct FunctionCall {
16823        #[doc = "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."]
16824        #[serde(rename = "arguments")]
16825        pub arguments: String,
16826        #[doc = "The name of the function to call."]
16827        #[serde(rename = "name")]
16828        pub name: String,
16829    }
16830}
16831#[derive(Clone, Debug, Default, PartialEq, typed_builder :: TypedBuilder)]
16832pub struct FineTuneChatCompletionRequestAssistantMessage {
16833    #[doc = "Controls whether the assistant message is trained against (0 or 1)"]
16834    #[builder(default)]
16835    pub weight: Option<i64>,
16836    #[doc = "The contents of the assistant message. Required unless `tool_calls` or `function_call` is specified.\n"]
16837    #[builder(default)]
16838    pub content:
16839        Option<crate::__types::fine_tune_chat_completion_request_assistant_message::Content>,
16840    #[doc = "The refusal message by the assistant."]
16841    #[builder(default)]
16842    pub refusal: Option<String>,
16843    #[doc = "An optional name for the participant. Provides the model information to differentiate between participants of the same role."]
16844    #[builder(default)]
16845    pub name: Option<String>,
16846    #[doc = "Data about a previous audio response from the model. \n[Learn more](https://platform.openai.com/docs/guides/audio).\n"]
16847    #[builder(default)]
16848    pub audio: Option<crate::__types::fine_tune_chat_completion_request_assistant_message::Audio>,
16849    #[builder(default)]
16850    pub tool_calls: Option<crate::__types::ChatCompletionMessageToolCalls>,
16851    #[doc = "Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model."]
16852    #[builder(default)]
16853    pub function_call:
16854        Option<crate::__types::fine_tune_chat_completion_request_assistant_message::FunctionCall>,
16855}
16856impl<'de> serde::Deserialize<'de> for FineTuneChatCompletionRequestAssistantMessage {
16857    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
16858    where
16859        D: serde::Deserializer<'de>,
16860    {
16861        #[serde_with::serde_as]
16862        #[derive(serde :: Deserialize)]
16863        struct FineTuneChatCompletionRequestAssistantMessage {
16864            #[serde(rename = "weight")]
16865            weight: Option<i64>,
16866            #[serde(rename = "content")]
16867            content: Option<
16868                crate::__types::fine_tune_chat_completion_request_assistant_message::Content,
16869            >,
16870            #[serde(rename = "refusal")]
16871            refusal: Option<String>,
16872            #[serde(rename = "role")]
16873            #[allow(dead_code)]
16874            role: crate::__types::fine_tune_chat_completion_request_assistant_message::Role,
16875            #[serde(rename = "name")]
16876            name: Option<String>,
16877            #[serde(rename = "audio")]
16878            audio:
16879                Option<crate::__types::fine_tune_chat_completion_request_assistant_message::Audio>,
16880            #[serde(rename = "tool_calls")]
16881            tool_calls: Option<crate::__types::ChatCompletionMessageToolCalls>,
16882            #[serde(rename = "function_call")]
16883            function_call: Option<
16884                crate::__types::fine_tune_chat_completion_request_assistant_message::FunctionCall,
16885            >,
16886        }
16887        let FineTuneChatCompletionRequestAssistantMessage {
16888            weight,
16889            content,
16890            refusal,
16891            name,
16892            audio,
16893            tool_calls,
16894            function_call,
16895            ..
16896        } = FineTuneChatCompletionRequestAssistantMessage::deserialize(deserializer)?;
16897        Ok(Self {
16898            weight,
16899            content,
16900            refusal,
16901            name,
16902            audio,
16903            tool_calls,
16904            function_call,
16905        })
16906    }
16907}
16908impl serde::Serialize for FineTuneChatCompletionRequestAssistantMessage {
16909    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
16910    where
16911        S: serde::Serializer,
16912    {
16913        #[serde_with::serde_as]
16914        #[derive(serde :: Serialize)]
16915        struct FineTuneChatCompletionRequestAssistantMessage<'a> {
16916            #[serde(rename = "weight")]
16917            #[serde(skip_serializing_if = "Option::is_none")]
16918            weight: &'a Option<i64>,
16919            #[serde(rename = "content")]
16920            #[serde(skip_serializing_if = "Option::is_none")]
16921            content: &'a Option<
16922                crate::__types::fine_tune_chat_completion_request_assistant_message::Content,
16923            >,
16924            #[serde(rename = "refusal")]
16925            #[serde(skip_serializing_if = "Option::is_none")]
16926            refusal: &'a Option<String>,
16927            #[serde(rename = "role")]
16928            role: &'a crate::__types::fine_tune_chat_completion_request_assistant_message::Role,
16929            #[serde(rename = "name")]
16930            #[serde(skip_serializing_if = "Option::is_none")]
16931            name: &'a Option<String>,
16932            #[serde(rename = "audio")]
16933            #[serde(skip_serializing_if = "Option::is_none")]
16934            audio: &'a Option<
16935                crate::__types::fine_tune_chat_completion_request_assistant_message::Audio,
16936            >,
16937            #[serde(rename = "tool_calls")]
16938            #[serde(skip_serializing_if = "Option::is_none")]
16939            tool_calls: &'a Option<crate::__types::ChatCompletionMessageToolCalls>,
16940            #[serde(rename = "function_call")]
16941            #[serde(skip_serializing_if = "Option::is_none")]
16942            function_call: &'a Option<
16943                crate::__types::fine_tune_chat_completion_request_assistant_message::FunctionCall,
16944            >,
16945        }
16946        let Self {
16947            weight,
16948            content,
16949            refusal,
16950            name,
16951            audio,
16952            tool_calls,
16953            function_call,
16954        } = self;
16955        FineTuneChatCompletionRequestAssistantMessage {
16956            weight,
16957            content,
16958            refusal,
16959            role: &Default::default(),
16960            name,
16961            audio,
16962            tool_calls,
16963            function_call,
16964        }
16965        .serialize(serializer)
16966    }
16967}
16968#[allow(clippy::module_inception)]
16969pub mod fine_tune_chat_request_input {
16970    #[allow(clippy::module_inception)]
16971    pub mod messages {
16972        #[derive(Clone, Debug, PartialEq)]
16973        #[serde_with::serde_as]
16974        #[derive(serde :: Deserialize, serde :: Serialize)]
16975        #[serde(untagged)]
16976        #[allow(clippy::large_enum_variant)]
16977        pub enum Item {
16978            System(crate::__types::ChatCompletionRequestSystemMessage),
16979            User(crate::__types::ChatCompletionRequestUserMessage),
16980            Assistant(crate::__types::FineTuneChatCompletionRequestAssistantMessage),
16981            Tool(crate::__types::ChatCompletionRequestToolMessage),
16982            Function(crate::__types::ChatCompletionRequestFunctionMessage),
16983        }
16984    }
16985}
16986#[doc = "The per-line training example of a fine-tuning input file for chat models using the supervised method.\nInput messages may contain text or image content only. Audio and file input messages\nare not currently supported for fine-tuning.\n"]
16987#[derive(Clone, Debug, Default, PartialEq)]
16988#[serde_with::serde_as]
16989#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
16990pub struct FineTuneChatRequestInput {
16991    #[serde(rename = "messages")]
16992    #[serde(skip_serializing_if = "Option::is_none")]
16993    #[builder(default)]
16994    pub messages: Option<Vec<crate::__types::fine_tune_chat_request_input::messages::Item>>,
16995    #[doc = "A list of tools the model may generate JSON inputs for."]
16996    #[serde(rename = "tools")]
16997    #[serde(skip_serializing_if = "Option::is_none")]
16998    #[builder(default)]
16999    pub tools: Option<Vec<crate::__types::ChatCompletionTool>>,
17000    #[serde(rename = "parallel_tool_calls")]
17001    #[serde(skip_serializing_if = "Option::is_none")]
17002    #[builder(default)]
17003    pub parallel_tool_calls: Option<crate::__types::ParallelToolCalls>,
17004    #[doc = "A list of functions the model may generate JSON inputs for."]
17005    #[serde(rename = "functions")]
17006    #[serde(skip_serializing_if = "Option::is_none")]
17007    #[builder(default)]
17008    pub functions: Option<Vec<crate::__types::ChatCompletionFunctions>>,
17009}
17010#[allow(clippy::module_inception)]
17011pub mod fine_tune_dpo_hyperparameters {
17012    #[allow(clippy::module_inception)]
17013    pub(crate) mod beta {
17014        #[doc = "auto"]
17015        #[derive(Clone, Copy, Debug, Default, PartialEq)]
17016        pub(crate) struct Auto;
17017        impl_serde!(Auto, "auto");
17018    }
17019    #[doc = "The beta value for the DPO method. A higher beta value will increase the weight of the penalty between the policy and reference model.\n"]
17020    #[derive(Clone, Debug, PartialEq)]
17021    #[allow(clippy::large_enum_variant)]
17022    pub enum Beta {
17023        #[doc = "auto"]
17024        Auto,
17025        Number(serde_json::Number),
17026    }
17027    impl<'de> serde::Deserialize<'de> for Beta {
17028        fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
17029        where
17030            D: serde::Deserializer<'de>,
17031        {
17032            #[serde_with::serde_as]
17033            #[derive(serde :: Deserialize)]
17034            #[serde(untagged)]
17035            #[allow(clippy::enum_variant_names, clippy::large_enum_variant)]
17036            enum Beta {
17037                Auto(crate::__types::fine_tune_dpo_hyperparameters::beta::Auto),
17038                Number(serde_json::Number),
17039            }
17040            Ok(match Beta::deserialize(deserializer)? {
17041                Beta::Auto(_) => Self::Auto,
17042                Beta::Number(v) => Self::Number(v),
17043            })
17044        }
17045    }
17046    impl serde::Serialize for Beta {
17047        fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
17048        where
17049            S: serde::Serializer,
17050        {
17051            #[serde_with::serde_as]
17052            #[derive(serde :: Serialize)]
17053            #[serde(untagged)]
17054            #[allow(clippy::enum_variant_names)]
17055            enum Beta<'a> {
17056                Auto(crate::__types::fine_tune_dpo_hyperparameters::beta::Auto),
17057                Number(&'a serde_json::Number),
17058            }
17059            match self {
17060                Self::Auto => Beta::Auto(Default::default()),
17061                Self::Number(v) => Beta::Number(v),
17062            }
17063            .serialize(serializer)
17064        }
17065    }
17066    #[allow(clippy::module_inception)]
17067    pub(crate) mod batch_size {
17068        #[doc = "auto"]
17069        #[derive(Clone, Copy, Debug, Default, PartialEq)]
17070        pub(crate) struct Auto;
17071        impl_serde!(Auto, "auto");
17072    }
17073    #[doc = "Number of examples in each batch. A larger batch size means that model parameters are updated less frequently, but with lower variance.\n"]
17074    #[derive(Clone, Copy, Debug, PartialEq)]
17075    #[allow(clippy::large_enum_variant)]
17076    pub enum BatchSize {
17077        #[doc = "auto"]
17078        Auto,
17079        Integer(i64),
17080    }
17081    impl<'de> serde::Deserialize<'de> for BatchSize {
17082        fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
17083        where
17084            D: serde::Deserializer<'de>,
17085        {
17086            #[serde_with::serde_as]
17087            #[derive(serde :: Deserialize)]
17088            #[serde(untagged)]
17089            #[allow(clippy::enum_variant_names, clippy::large_enum_variant)]
17090            enum BatchSize {
17091                Auto(crate::__types::fine_tune_dpo_hyperparameters::batch_size::Auto),
17092                Integer(i64),
17093            }
17094            Ok(match BatchSize::deserialize(deserializer)? {
17095                BatchSize::Auto(_) => Self::Auto,
17096                BatchSize::Integer(v) => Self::Integer(v),
17097            })
17098        }
17099    }
17100    impl serde::Serialize for BatchSize {
17101        fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
17102        where
17103            S: serde::Serializer,
17104        {
17105            #[serde_with::serde_as]
17106            #[derive(serde :: Serialize)]
17107            #[serde(untagged)]
17108            #[allow(clippy::enum_variant_names)]
17109            enum BatchSize<'a> {
17110                Auto(crate::__types::fine_tune_dpo_hyperparameters::batch_size::Auto),
17111                Integer(&'a i64),
17112            }
17113            match self {
17114                Self::Auto => BatchSize::Auto(Default::default()),
17115                Self::Integer(v) => BatchSize::Integer(v),
17116            }
17117            .serialize(serializer)
17118        }
17119    }
17120    #[allow(clippy::module_inception)]
17121    pub(crate) mod learning_rate_multiplier {
17122        #[doc = "auto"]
17123        #[derive(Clone, Copy, Debug, Default, PartialEq)]
17124        pub(crate) struct Auto;
17125        impl_serde!(Auto, "auto");
17126    }
17127    #[doc = "Scaling factor for the learning rate. A smaller learning rate may be useful to avoid overfitting.\n"]
17128    #[derive(Clone, Debug, PartialEq)]
17129    #[allow(clippy::large_enum_variant)]
17130    pub enum LearningRateMultiplier {
17131        #[doc = "auto"]
17132        Auto,
17133        Number(serde_json::Number),
17134    }
17135    impl<'de> serde::Deserialize<'de> for LearningRateMultiplier {
17136        fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
17137        where
17138            D: serde::Deserializer<'de>,
17139        {
17140            #[serde_with::serde_as]
17141            #[derive(serde :: Deserialize)]
17142            #[serde(untagged)]
17143            #[allow(clippy::enum_variant_names, clippy::large_enum_variant)]
17144            enum LearningRateMultiplier {
17145                Auto(crate::__types::fine_tune_dpo_hyperparameters::learning_rate_multiplier::Auto),
17146                Number(serde_json::Number),
17147            }
17148            Ok(match LearningRateMultiplier::deserialize(deserializer)? {
17149                LearningRateMultiplier::Auto(_) => Self::Auto,
17150                LearningRateMultiplier::Number(v) => Self::Number(v),
17151            })
17152        }
17153    }
17154    impl serde::Serialize for LearningRateMultiplier {
17155        fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
17156        where
17157            S: serde::Serializer,
17158        {
17159            #[serde_with::serde_as]
17160            #[derive(serde :: Serialize)]
17161            #[serde(untagged)]
17162            #[allow(clippy::enum_variant_names)]
17163            enum LearningRateMultiplier<'a> {
17164                Auto(crate::__types::fine_tune_dpo_hyperparameters::learning_rate_multiplier::Auto),
17165                Number(&'a serde_json::Number),
17166            }
17167            match self {
17168                Self::Auto => LearningRateMultiplier::Auto(Default::default()),
17169                Self::Number(v) => LearningRateMultiplier::Number(v),
17170            }
17171            .serialize(serializer)
17172        }
17173    }
17174    #[allow(clippy::module_inception)]
17175    pub(crate) mod n_epochs {
17176        #[doc = "auto"]
17177        #[derive(Clone, Copy, Debug, Default, PartialEq)]
17178        pub(crate) struct Auto;
17179        impl_serde!(Auto, "auto");
17180    }
17181    #[doc = "The number of epochs to train the model for. An epoch refers to one full cycle through the training dataset.\n"]
17182    #[derive(Clone, Copy, Debug, PartialEq)]
17183    #[allow(clippy::large_enum_variant)]
17184    pub enum NEpochs {
17185        #[doc = "auto"]
17186        Auto,
17187        Integer(i64),
17188    }
17189    impl<'de> serde::Deserialize<'de> for NEpochs {
17190        fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
17191        where
17192            D: serde::Deserializer<'de>,
17193        {
17194            #[serde_with::serde_as]
17195            #[derive(serde :: Deserialize)]
17196            #[serde(untagged)]
17197            #[allow(clippy::enum_variant_names, clippy::large_enum_variant)]
17198            enum NEpochs {
17199                Auto(crate::__types::fine_tune_dpo_hyperparameters::n_epochs::Auto),
17200                Integer(i64),
17201            }
17202            Ok(match NEpochs::deserialize(deserializer)? {
17203                NEpochs::Auto(_) => Self::Auto,
17204                NEpochs::Integer(v) => Self::Integer(v),
17205            })
17206        }
17207    }
17208    impl serde::Serialize for NEpochs {
17209        fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
17210        where
17211            S: serde::Serializer,
17212        {
17213            #[serde_with::serde_as]
17214            #[derive(serde :: Serialize)]
17215            #[serde(untagged)]
17216            #[allow(clippy::enum_variant_names)]
17217            enum NEpochs<'a> {
17218                Auto(crate::__types::fine_tune_dpo_hyperparameters::n_epochs::Auto),
17219                Integer(&'a i64),
17220            }
17221            match self {
17222                Self::Auto => NEpochs::Auto(Default::default()),
17223                Self::Integer(v) => NEpochs::Integer(v),
17224            }
17225            .serialize(serializer)
17226        }
17227    }
17228}
17229#[doc = "The hyperparameters used for the DPO fine-tuning job."]
17230#[derive(Clone, Debug, Default, PartialEq)]
17231#[serde_with::serde_as]
17232#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
17233pub struct FineTuneDpoHyperparameters {
17234    #[doc = "The beta value for the DPO method. A higher beta value will increase the weight of the penalty between the policy and reference model.\n"]
17235    #[serde(rename = "beta")]
17236    #[serde(skip_serializing_if = "Option::is_none")]
17237    #[builder(default)]
17238    pub beta: Option<crate::__types::fine_tune_dpo_hyperparameters::Beta>,
17239    #[doc = "Number of examples in each batch. A larger batch size means that model parameters are updated less frequently, but with lower variance.\n"]
17240    #[serde(rename = "batch_size")]
17241    #[serde(skip_serializing_if = "Option::is_none")]
17242    #[builder(default)]
17243    pub batch_size: Option<crate::__types::fine_tune_dpo_hyperparameters::BatchSize>,
17244    #[doc = "Scaling factor for the learning rate. A smaller learning rate may be useful to avoid overfitting.\n"]
17245    #[serde(rename = "learning_rate_multiplier")]
17246    #[serde(skip_serializing_if = "Option::is_none")]
17247    #[builder(default)]
17248    pub learning_rate_multiplier:
17249        Option<crate::__types::fine_tune_dpo_hyperparameters::LearningRateMultiplier>,
17250    #[doc = "The number of epochs to train the model for. An epoch refers to one full cycle through the training dataset.\n"]
17251    #[serde(rename = "n_epochs")]
17252    #[serde(skip_serializing_if = "Option::is_none")]
17253    #[builder(default)]
17254    pub n_epochs: Option<crate::__types::fine_tune_dpo_hyperparameters::NEpochs>,
17255}
17256#[doc = "Configuration for the DPO fine-tuning method."]
17257#[derive(Clone, Debug, Default, PartialEq)]
17258#[serde_with::serde_as]
17259#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
17260pub struct FineTuneDpoMethod {
17261    #[serde(rename = "hyperparameters")]
17262    #[serde(skip_serializing_if = "Option::is_none")]
17263    #[builder(default)]
17264    pub hyperparameters: Option<crate::__types::FineTuneDpoHyperparameters>,
17265}
17266#[allow(clippy::module_inception)]
17267pub mod fine_tune_method {
17268    #[doc = "The type of method. Is either `supervised`, `dpo`, or `reinforcement`."]
17269    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
17270    pub enum Type {
17271        #[doc = "`supervised`"]
17272        #[serde(rename = "supervised")]
17273        Supervised,
17274        #[doc = "`dpo`"]
17275        #[serde(rename = "dpo")]
17276        Dpo,
17277        #[doc = "`reinforcement`"]
17278        #[serde(rename = "reinforcement")]
17279        Reinforcement,
17280    }
17281}
17282#[doc = "The method used for fine-tuning."]
17283#[derive(Clone, Debug, PartialEq)]
17284#[serde_with::serde_as]
17285#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
17286pub struct FineTuneMethod {
17287    #[doc = "The type of method. Is either `supervised`, `dpo`, or `reinforcement`."]
17288    #[serde(rename = "type")]
17289    pub r#type: crate::__types::fine_tune_method::Type,
17290    #[serde(rename = "supervised")]
17291    #[serde(skip_serializing_if = "Option::is_none")]
17292    #[builder(default)]
17293    pub supervised: Option<crate::__types::FineTuneSupervisedMethod>,
17294    #[serde(rename = "dpo")]
17295    #[serde(skip_serializing_if = "Option::is_none")]
17296    #[builder(default)]
17297    pub dpo: Option<crate::__types::FineTuneDpoMethod>,
17298    #[serde(rename = "reinforcement")]
17299    #[serde(skip_serializing_if = "Option::is_none")]
17300    #[builder(default)]
17301    pub reinforcement: Option<crate::__types::FineTuneReinforcementMethod>,
17302}
17303#[allow(clippy::module_inception)]
17304pub mod fine_tune_preference_request_input {
17305    #[allow(clippy::module_inception)]
17306    pub mod input {
17307        #[allow(clippy::module_inception)]
17308        pub mod messages {
17309            #[derive(Clone, Debug, PartialEq)]
17310            #[serde_with::serde_as]
17311            #[derive(serde :: Deserialize, serde :: Serialize)]
17312            #[serde(untagged)]
17313            #[allow(clippy::large_enum_variant)]
17314            pub enum Item {
17315                System(crate::__types::ChatCompletionRequestSystemMessage),
17316                User(crate::__types::ChatCompletionRequestUserMessage),
17317                Assistant(crate::__types::FineTuneChatCompletionRequestAssistantMessage),
17318                Tool(crate::__types::ChatCompletionRequestToolMessage),
17319                Function(crate::__types::ChatCompletionRequestFunctionMessage),
17320            }
17321        }
17322    }
17323    #[derive(Clone, Debug, Default, PartialEq)]
17324    #[serde_with::serde_as]
17325    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
17326    pub struct Input {
17327        #[serde(rename = "messages")]
17328        #[serde(skip_serializing_if = "Option::is_none")]
17329        #[builder(default)]
17330        pub messages:
17331            Option<Vec<crate::__types::fine_tune_preference_request_input::input::messages::Item>>,
17332        #[doc = "A list of tools the model may generate JSON inputs for."]
17333        #[serde(rename = "tools")]
17334        #[serde(skip_serializing_if = "Option::is_none")]
17335        #[builder(default)]
17336        pub tools: Option<Vec<crate::__types::ChatCompletionTool>>,
17337        #[serde(rename = "parallel_tool_calls")]
17338        #[serde(skip_serializing_if = "Option::is_none")]
17339        #[builder(default)]
17340        pub parallel_tool_calls: Option<crate::__types::ParallelToolCalls>,
17341    }
17342    #[allow(clippy::module_inception)]
17343    pub mod preferred_output {
17344        #[derive(Clone, Debug, PartialEq)]
17345        #[serde_with::serde_as]
17346        #[derive(serde :: Deserialize, serde :: Serialize)]
17347        #[serde(untagged)]
17348        #[allow(clippy::large_enum_variant)]
17349        pub enum Item {
17350            ChatCompletionRequestAssistantMessage(
17351                crate::__types::ChatCompletionRequestAssistantMessage,
17352            ),
17353        }
17354    }
17355    #[allow(clippy::module_inception)]
17356    pub mod non_preferred_output {
17357        #[derive(Clone, Debug, PartialEq)]
17358        #[serde_with::serde_as]
17359        #[derive(serde :: Deserialize, serde :: Serialize)]
17360        #[serde(untagged)]
17361        #[allow(clippy::large_enum_variant)]
17362        pub enum Item {
17363            ChatCompletionRequestAssistantMessage(
17364                crate::__types::ChatCompletionRequestAssistantMessage,
17365            ),
17366        }
17367    }
17368}
17369#[doc = "The per-line training example of a fine-tuning input file for chat models using the dpo method.\nInput messages may contain text or image content only. Audio and file input messages\nare not currently supported for fine-tuning.\n"]
17370#[derive(Clone, Debug, Default, PartialEq)]
17371#[serde_with::serde_as]
17372#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
17373pub struct FineTunePreferenceRequestInput {
17374    #[serde(rename = "input")]
17375    #[serde(skip_serializing_if = "Option::is_none")]
17376    #[builder(default)]
17377    pub input: Option<crate::__types::fine_tune_preference_request_input::Input>,
17378    #[doc = "The preferred completion message for the output."]
17379    #[serde(rename = "preferred_output")]
17380    #[serde(skip_serializing_if = "Option::is_none")]
17381    #[builder(default)]
17382    pub preferred_output:
17383        Option<Vec<crate::__types::fine_tune_preference_request_input::preferred_output::Item>>,
17384    #[doc = "The non-preferred completion message for the output."]
17385    #[serde(rename = "non_preferred_output")]
17386    #[serde(skip_serializing_if = "Option::is_none")]
17387    #[builder(default)]
17388    pub non_preferred_output:
17389        Option<Vec<crate::__types::fine_tune_preference_request_input::non_preferred_output::Item>>,
17390}
17391#[allow(clippy::module_inception)]
17392pub mod fine_tune_reinforcement_hyperparameters {
17393    #[allow(clippy::module_inception)]
17394    pub(crate) mod batch_size {
17395        #[doc = "auto"]
17396        #[derive(Clone, Copy, Debug, Default, PartialEq)]
17397        pub(crate) struct Auto;
17398        impl_serde!(Auto, "auto");
17399    }
17400    #[doc = "Number of examples in each batch. A larger batch size means that model parameters are updated less frequently, but with lower variance.\n"]
17401    #[derive(Clone, Copy, Debug, PartialEq)]
17402    #[allow(clippy::large_enum_variant)]
17403    pub enum BatchSize {
17404        #[doc = "auto"]
17405        Auto,
17406        Integer(i64),
17407    }
17408    impl<'de> serde::Deserialize<'de> for BatchSize {
17409        fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
17410        where
17411            D: serde::Deserializer<'de>,
17412        {
17413            #[serde_with::serde_as]
17414            #[derive(serde :: Deserialize)]
17415            #[serde(untagged)]
17416            #[allow(clippy::enum_variant_names, clippy::large_enum_variant)]
17417            enum BatchSize {
17418                Auto(crate::__types::fine_tune_reinforcement_hyperparameters::batch_size::Auto),
17419                Integer(i64),
17420            }
17421            Ok(match BatchSize::deserialize(deserializer)? {
17422                BatchSize::Auto(_) => Self::Auto,
17423                BatchSize::Integer(v) => Self::Integer(v),
17424            })
17425        }
17426    }
17427    impl serde::Serialize for BatchSize {
17428        fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
17429        where
17430            S: serde::Serializer,
17431        {
17432            #[serde_with::serde_as]
17433            #[derive(serde :: Serialize)]
17434            #[serde(untagged)]
17435            #[allow(clippy::enum_variant_names)]
17436            enum BatchSize<'a> {
17437                Auto(crate::__types::fine_tune_reinforcement_hyperparameters::batch_size::Auto),
17438                Integer(&'a i64),
17439            }
17440            match self {
17441                Self::Auto => BatchSize::Auto(Default::default()),
17442                Self::Integer(v) => BatchSize::Integer(v),
17443            }
17444            .serialize(serializer)
17445        }
17446    }
17447    #[allow(clippy::module_inception)]
17448    pub(crate) mod learning_rate_multiplier {
17449        #[doc = "auto"]
17450        #[derive(Clone, Copy, Debug, Default, PartialEq)]
17451        pub(crate) struct Auto;
17452        impl_serde!(Auto, "auto");
17453    }
17454    #[doc = "Scaling factor for the learning rate. A smaller learning rate may be useful to avoid overfitting.\n"]
17455    #[derive(Clone, Debug, PartialEq)]
17456    #[allow(clippy::large_enum_variant)]
17457    pub enum LearningRateMultiplier {
17458        #[doc = "auto"]
17459        Auto,
17460        Number(serde_json::Number),
17461    }
17462    impl<'de> serde::Deserialize<'de> for LearningRateMultiplier {
17463        fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
17464        where
17465            D: serde::Deserializer<'de>,
17466        {
17467            #[serde_with::serde_as]
17468            #[derive(serde :: Deserialize)]
17469            #[serde(untagged)]
17470            #[allow(clippy::enum_variant_names, clippy::large_enum_variant)]
17471            enum LearningRateMultiplier {
17472                Auto (crate :: __types :: fine_tune_reinforcement_hyperparameters :: learning_rate_multiplier :: Auto) , Number (serde_json :: Number) }
17473            Ok(match LearningRateMultiplier::deserialize(deserializer)? {
17474                LearningRateMultiplier::Auto(_) => Self::Auto,
17475                LearningRateMultiplier::Number(v) => Self::Number(v),
17476            })
17477        }
17478    }
17479    impl serde::Serialize for LearningRateMultiplier {
17480        fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
17481        where
17482            S: serde::Serializer,
17483        {
17484            #[serde_with::serde_as]
17485            #[derive(serde :: Serialize)]
17486            #[serde(untagged)]
17487            #[allow(clippy::enum_variant_names)]
17488            enum LearningRateMultiplier<'a> {
17489                Auto (crate :: __types :: fine_tune_reinforcement_hyperparameters :: learning_rate_multiplier :: Auto) , Number (& 'a serde_json :: Number) }
17490            match self {
17491                Self::Auto => LearningRateMultiplier::Auto(Default::default()),
17492                Self::Number(v) => LearningRateMultiplier::Number(v),
17493            }
17494            .serialize(serializer)
17495        }
17496    }
17497    #[allow(clippy::module_inception)]
17498    pub(crate) mod n_epochs {
17499        #[doc = "auto"]
17500        #[derive(Clone, Copy, Debug, Default, PartialEq)]
17501        pub(crate) struct Auto;
17502        impl_serde!(Auto, "auto");
17503    }
17504    #[doc = "The number of epochs to train the model for. An epoch refers to one full cycle through the training dataset.\n"]
17505    #[derive(Clone, Copy, Debug, PartialEq)]
17506    #[allow(clippy::large_enum_variant)]
17507    pub enum NEpochs {
17508        #[doc = "auto"]
17509        Auto,
17510        Integer(i64),
17511    }
17512    impl<'de> serde::Deserialize<'de> for NEpochs {
17513        fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
17514        where
17515            D: serde::Deserializer<'de>,
17516        {
17517            #[serde_with::serde_as]
17518            #[derive(serde :: Deserialize)]
17519            #[serde(untagged)]
17520            #[allow(clippy::enum_variant_names, clippy::large_enum_variant)]
17521            enum NEpochs {
17522                Auto(crate::__types::fine_tune_reinforcement_hyperparameters::n_epochs::Auto),
17523                Integer(i64),
17524            }
17525            Ok(match NEpochs::deserialize(deserializer)? {
17526                NEpochs::Auto(_) => Self::Auto,
17527                NEpochs::Integer(v) => Self::Integer(v),
17528            })
17529        }
17530    }
17531    impl serde::Serialize for NEpochs {
17532        fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
17533        where
17534            S: serde::Serializer,
17535        {
17536            #[serde_with::serde_as]
17537            #[derive(serde :: Serialize)]
17538            #[serde(untagged)]
17539            #[allow(clippy::enum_variant_names)]
17540            enum NEpochs<'a> {
17541                Auto(crate::__types::fine_tune_reinforcement_hyperparameters::n_epochs::Auto),
17542                Integer(&'a i64),
17543            }
17544            match self {
17545                Self::Auto => NEpochs::Auto(Default::default()),
17546                Self::Integer(v) => NEpochs::Integer(v),
17547            }
17548            .serialize(serializer)
17549        }
17550    }
17551    #[doc = "Level of reasoning effort.\n"]
17552    #[derive(Clone, Copy, Debug, Default, PartialEq, serde :: Deserialize, serde :: Serialize)]
17553    pub enum ReasoningEffort {
17554        #[doc = "`default`"]
17555        #[default]
17556        #[serde(rename = "default")]
17557        Default,
17558        #[doc = "`low`"]
17559        #[serde(rename = "low")]
17560        Low,
17561        #[doc = "`medium`"]
17562        #[serde(rename = "medium")]
17563        Medium,
17564        #[doc = "`high`"]
17565        #[serde(rename = "high")]
17566        High,
17567    }
17568    #[allow(clippy::module_inception)]
17569    pub(crate) mod compute_multiplier {
17570        #[doc = "auto"]
17571        #[derive(Clone, Copy, Debug, Default, PartialEq)]
17572        pub(crate) struct Auto;
17573        impl_serde!(Auto, "auto");
17574    }
17575    #[doc = "Multiplier on amount of compute used for exploring search space during training.\n"]
17576    #[derive(Clone, Debug, PartialEq)]
17577    #[allow(clippy::large_enum_variant)]
17578    pub enum ComputeMultiplier {
17579        #[doc = "auto"]
17580        Auto,
17581        Number(serde_json::Number),
17582    }
17583    impl<'de> serde::Deserialize<'de> for ComputeMultiplier {
17584        fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
17585        where
17586            D: serde::Deserializer<'de>,
17587        {
17588            #[serde_with::serde_as]
17589            #[derive(serde :: Deserialize)]
17590            #[serde(untagged)]
17591            #[allow(clippy::enum_variant_names, clippy::large_enum_variant)]
17592            enum ComputeMultiplier {
17593                Auto (crate :: __types :: fine_tune_reinforcement_hyperparameters :: compute_multiplier :: Auto) , Number (serde_json :: Number) }
17594            Ok(match ComputeMultiplier::deserialize(deserializer)? {
17595                ComputeMultiplier::Auto(_) => Self::Auto,
17596                ComputeMultiplier::Number(v) => Self::Number(v),
17597            })
17598        }
17599    }
17600    impl serde::Serialize for ComputeMultiplier {
17601        fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
17602        where
17603            S: serde::Serializer,
17604        {
17605            #[serde_with::serde_as]
17606            #[derive(serde :: Serialize)]
17607            #[serde(untagged)]
17608            #[allow(clippy::enum_variant_names)]
17609            enum ComputeMultiplier<'a> {
17610                Auto (crate :: __types :: fine_tune_reinforcement_hyperparameters :: compute_multiplier :: Auto) , Number (& 'a serde_json :: Number) }
17611            match self {
17612                Self::Auto => ComputeMultiplier::Auto(Default::default()),
17613                Self::Number(v) => ComputeMultiplier::Number(v),
17614            }
17615            .serialize(serializer)
17616        }
17617    }
17618    #[allow(clippy::module_inception)]
17619    pub(crate) mod eval_interval {
17620        #[doc = "auto"]
17621        #[derive(Clone, Copy, Debug, Default, PartialEq)]
17622        pub(crate) struct Auto;
17623        impl_serde!(Auto, "auto");
17624    }
17625    #[doc = "The number of training steps between evaluation runs.\n"]
17626    #[derive(Clone, Copy, Debug, PartialEq)]
17627    #[allow(clippy::large_enum_variant)]
17628    pub enum EvalInterval {
17629        #[doc = "auto"]
17630        Auto,
17631        Integer(i64),
17632    }
17633    impl<'de> serde::Deserialize<'de> for EvalInterval {
17634        fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
17635        where
17636            D: serde::Deserializer<'de>,
17637        {
17638            #[serde_with::serde_as]
17639            #[derive(serde :: Deserialize)]
17640            #[serde(untagged)]
17641            #[allow(clippy::enum_variant_names, clippy::large_enum_variant)]
17642            enum EvalInterval {
17643                Auto(crate::__types::fine_tune_reinforcement_hyperparameters::eval_interval::Auto),
17644                Integer(i64),
17645            }
17646            Ok(match EvalInterval::deserialize(deserializer)? {
17647                EvalInterval::Auto(_) => Self::Auto,
17648                EvalInterval::Integer(v) => Self::Integer(v),
17649            })
17650        }
17651    }
17652    impl serde::Serialize for EvalInterval {
17653        fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
17654        where
17655            S: serde::Serializer,
17656        {
17657            #[serde_with::serde_as]
17658            #[derive(serde :: Serialize)]
17659            #[serde(untagged)]
17660            #[allow(clippy::enum_variant_names)]
17661            enum EvalInterval<'a> {
17662                Auto(crate::__types::fine_tune_reinforcement_hyperparameters::eval_interval::Auto),
17663                Integer(&'a i64),
17664            }
17665            match self {
17666                Self::Auto => EvalInterval::Auto(Default::default()),
17667                Self::Integer(v) => EvalInterval::Integer(v),
17668            }
17669            .serialize(serializer)
17670        }
17671    }
17672    #[allow(clippy::module_inception)]
17673    pub(crate) mod eval_samples {
17674        #[doc = "auto"]
17675        #[derive(Clone, Copy, Debug, Default, PartialEq)]
17676        pub(crate) struct Auto;
17677        impl_serde!(Auto, "auto");
17678    }
17679    #[doc = "Number of evaluation samples to generate per training step.\n"]
17680    #[derive(Clone, Copy, Debug, PartialEq)]
17681    #[allow(clippy::large_enum_variant)]
17682    pub enum EvalSamples {
17683        #[doc = "auto"]
17684        Auto,
17685        Integer(i64),
17686    }
17687    impl<'de> serde::Deserialize<'de> for EvalSamples {
17688        fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
17689        where
17690            D: serde::Deserializer<'de>,
17691        {
17692            #[serde_with::serde_as]
17693            #[derive(serde :: Deserialize)]
17694            #[serde(untagged)]
17695            #[allow(clippy::enum_variant_names, clippy::large_enum_variant)]
17696            enum EvalSamples {
17697                Auto(crate::__types::fine_tune_reinforcement_hyperparameters::eval_samples::Auto),
17698                Integer(i64),
17699            }
17700            Ok(match EvalSamples::deserialize(deserializer)? {
17701                EvalSamples::Auto(_) => Self::Auto,
17702                EvalSamples::Integer(v) => Self::Integer(v),
17703            })
17704        }
17705    }
17706    impl serde::Serialize for EvalSamples {
17707        fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
17708        where
17709            S: serde::Serializer,
17710        {
17711            #[serde_with::serde_as]
17712            #[derive(serde :: Serialize)]
17713            #[serde(untagged)]
17714            #[allow(clippy::enum_variant_names)]
17715            enum EvalSamples<'a> {
17716                Auto(crate::__types::fine_tune_reinforcement_hyperparameters::eval_samples::Auto),
17717                Integer(&'a i64),
17718            }
17719            match self {
17720                Self::Auto => EvalSamples::Auto(Default::default()),
17721                Self::Integer(v) => EvalSamples::Integer(v),
17722            }
17723            .serialize(serializer)
17724        }
17725    }
17726}
17727#[doc = "The hyperparameters used for the reinforcement fine-tuning job."]
17728#[derive(Clone, Debug, Default, PartialEq)]
17729#[serde_with::serde_as]
17730#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
17731pub struct FineTuneReinforcementHyperparameters {
17732    #[doc = "Number of examples in each batch. A larger batch size means that model parameters are updated less frequently, but with lower variance.\n"]
17733    #[serde(rename = "batch_size")]
17734    #[serde(skip_serializing_if = "Option::is_none")]
17735    #[builder(default)]
17736    pub batch_size: Option<crate::__types::fine_tune_reinforcement_hyperparameters::BatchSize>,
17737    #[doc = "Scaling factor for the learning rate. A smaller learning rate may be useful to avoid overfitting.\n"]
17738    #[serde(rename = "learning_rate_multiplier")]
17739    #[serde(skip_serializing_if = "Option::is_none")]
17740    #[builder(default)]
17741    pub learning_rate_multiplier:
17742        Option<crate::__types::fine_tune_reinforcement_hyperparameters::LearningRateMultiplier>,
17743    #[doc = "The number of epochs to train the model for. An epoch refers to one full cycle through the training dataset.\n"]
17744    #[serde(rename = "n_epochs")]
17745    #[serde(skip_serializing_if = "Option::is_none")]
17746    #[builder(default)]
17747    pub n_epochs: Option<crate::__types::fine_tune_reinforcement_hyperparameters::NEpochs>,
17748    #[doc = "Level of reasoning effort.\n"]
17749    #[serde(rename = "reasoning_effort")]
17750    #[serde(skip_serializing_if = "Option::is_none")]
17751    #[builder(default)]
17752    pub reasoning_effort:
17753        Option<crate::__types::fine_tune_reinforcement_hyperparameters::ReasoningEffort>,
17754    #[doc = "Multiplier on amount of compute used for exploring search space during training.\n"]
17755    #[serde(rename = "compute_multiplier")]
17756    #[serde(skip_serializing_if = "Option::is_none")]
17757    #[builder(default)]
17758    pub compute_multiplier:
17759        Option<crate::__types::fine_tune_reinforcement_hyperparameters::ComputeMultiplier>,
17760    #[doc = "The number of training steps between evaluation runs.\n"]
17761    #[serde(rename = "eval_interval")]
17762    #[serde(skip_serializing_if = "Option::is_none")]
17763    #[builder(default)]
17764    pub eval_interval:
17765        Option<crate::__types::fine_tune_reinforcement_hyperparameters::EvalInterval>,
17766    #[doc = "Number of evaluation samples to generate per training step.\n"]
17767    #[serde(rename = "eval_samples")]
17768    #[serde(skip_serializing_if = "Option::is_none")]
17769    #[builder(default)]
17770    pub eval_samples: Option<crate::__types::fine_tune_reinforcement_hyperparameters::EvalSamples>,
17771}
17772#[allow(clippy::module_inception)]
17773pub mod fine_tune_reinforcement_method {
17774    #[doc = "The grader used for the fine-tuning job."]
17775    #[derive(Clone, Debug, PartialEq)]
17776    #[serde_with::serde_as]
17777    #[derive(serde :: Deserialize, serde :: Serialize)]
17778    #[serde(untagged)]
17779    #[allow(clippy::large_enum_variant)]
17780    pub enum Grader {
17781        StringCheck(crate::__types::GraderStringCheck),
17782        TextSimilarity(crate::__types::GraderTextSimilarity),
17783        Python(crate::__types::GraderPython),
17784        ScoreModel(crate::__types::GraderScoreModel),
17785        Multi(crate::__types::GraderMulti),
17786    }
17787}
17788#[doc = "Configuration for the reinforcement fine-tuning method."]
17789#[derive(Clone, Debug, PartialEq)]
17790#[serde_with::serde_as]
17791#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
17792pub struct FineTuneReinforcementMethod {
17793    #[doc = "The grader used for the fine-tuning job."]
17794    #[serde(rename = "grader")]
17795    pub grader: crate::__types::fine_tune_reinforcement_method::Grader,
17796    #[serde(rename = "hyperparameters")]
17797    #[serde(skip_serializing_if = "Option::is_none")]
17798    #[builder(default)]
17799    pub hyperparameters: Option<crate::__types::FineTuneReinforcementHyperparameters>,
17800}
17801#[allow(clippy::module_inception)]
17802pub mod fine_tune_reinforcement_request_input {
17803    #[allow(clippy::module_inception)]
17804    pub mod messages {
17805        #[derive(Clone, Debug, PartialEq)]
17806        #[serde_with::serde_as]
17807        #[derive(serde :: Deserialize, serde :: Serialize)]
17808        #[serde(untagged)]
17809        #[allow(clippy::large_enum_variant)]
17810        pub enum Item {
17811            Developer(crate::__types::ChatCompletionRequestDeveloperMessage),
17812            User(crate::__types::ChatCompletionRequestUserMessage),
17813            Assistant(crate::__types::FineTuneChatCompletionRequestAssistantMessage),
17814            Tool(crate::__types::ChatCompletionRequestToolMessage),
17815        }
17816    }
17817}
17818#[doc = "Per-line training example for reinforcement fine-tuning. Note that `messages` and `tools` are the only reserved keywords.\nAny other arbitrary key-value data can be included on training datapoints and will be available to reference during grading under the `{{ item.XXX }}` template variable.\nInput messages may contain text or image content only. Audio and file input messages\nare not currently supported for fine-tuning.\n"]
17819#[derive(Clone, Debug, PartialEq)]
17820#[serde_with::serde_as]
17821#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
17822pub struct FineTuneReinforcementRequestInput {
17823    #[serde(rename = "messages")]
17824    pub messages: Vec<crate::__types::fine_tune_reinforcement_request_input::messages::Item>,
17825    #[doc = "A list of tools the model may generate JSON inputs for."]
17826    #[serde(rename = "tools")]
17827    #[serde(skip_serializing_if = "Option::is_none")]
17828    #[builder(default)]
17829    pub tools: Option<Vec<crate::__types::ChatCompletionTool>>,
17830}
17831#[allow(clippy::module_inception)]
17832pub mod fine_tune_supervised_hyperparameters {
17833    #[allow(clippy::module_inception)]
17834    pub(crate) mod batch_size {
17835        #[doc = "auto"]
17836        #[derive(Clone, Copy, Debug, Default, PartialEq)]
17837        pub(crate) struct Auto;
17838        impl_serde!(Auto, "auto");
17839    }
17840    #[doc = "Number of examples in each batch. A larger batch size means that model parameters are updated less frequently, but with lower variance.\n"]
17841    #[derive(Clone, Copy, Debug, PartialEq)]
17842    #[allow(clippy::large_enum_variant)]
17843    pub enum BatchSize {
17844        #[doc = "auto"]
17845        Auto,
17846        Integer(i64),
17847    }
17848    impl<'de> serde::Deserialize<'de> for BatchSize {
17849        fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
17850        where
17851            D: serde::Deserializer<'de>,
17852        {
17853            #[serde_with::serde_as]
17854            #[derive(serde :: Deserialize)]
17855            #[serde(untagged)]
17856            #[allow(clippy::enum_variant_names, clippy::large_enum_variant)]
17857            enum BatchSize {
17858                Auto(crate::__types::fine_tune_supervised_hyperparameters::batch_size::Auto),
17859                Integer(i64),
17860            }
17861            Ok(match BatchSize::deserialize(deserializer)? {
17862                BatchSize::Auto(_) => Self::Auto,
17863                BatchSize::Integer(v) => Self::Integer(v),
17864            })
17865        }
17866    }
17867    impl serde::Serialize for BatchSize {
17868        fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
17869        where
17870            S: serde::Serializer,
17871        {
17872            #[serde_with::serde_as]
17873            #[derive(serde :: Serialize)]
17874            #[serde(untagged)]
17875            #[allow(clippy::enum_variant_names)]
17876            enum BatchSize<'a> {
17877                Auto(crate::__types::fine_tune_supervised_hyperparameters::batch_size::Auto),
17878                Integer(&'a i64),
17879            }
17880            match self {
17881                Self::Auto => BatchSize::Auto(Default::default()),
17882                Self::Integer(v) => BatchSize::Integer(v),
17883            }
17884            .serialize(serializer)
17885        }
17886    }
17887    #[allow(clippy::module_inception)]
17888    pub(crate) mod learning_rate_multiplier {
17889        #[doc = "auto"]
17890        #[derive(Clone, Copy, Debug, Default, PartialEq)]
17891        pub(crate) struct Auto;
17892        impl_serde!(Auto, "auto");
17893    }
17894    #[doc = "Scaling factor for the learning rate. A smaller learning rate may be useful to avoid overfitting.\n"]
17895    #[derive(Clone, Debug, PartialEq)]
17896    #[allow(clippy::large_enum_variant)]
17897    pub enum LearningRateMultiplier {
17898        #[doc = "auto"]
17899        Auto,
17900        Number(serde_json::Number),
17901    }
17902    impl<'de> serde::Deserialize<'de> for LearningRateMultiplier {
17903        fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
17904        where
17905            D: serde::Deserializer<'de>,
17906        {
17907            #[serde_with::serde_as]
17908            #[derive(serde :: Deserialize)]
17909            #[serde(untagged)]
17910            #[allow(clippy::enum_variant_names, clippy::large_enum_variant)]
17911            enum LearningRateMultiplier {
17912                Auto (crate :: __types :: fine_tune_supervised_hyperparameters :: learning_rate_multiplier :: Auto) , Number (serde_json :: Number) }
17913            Ok(match LearningRateMultiplier::deserialize(deserializer)? {
17914                LearningRateMultiplier::Auto(_) => Self::Auto,
17915                LearningRateMultiplier::Number(v) => Self::Number(v),
17916            })
17917        }
17918    }
17919    impl serde::Serialize for LearningRateMultiplier {
17920        fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
17921        where
17922            S: serde::Serializer,
17923        {
17924            #[serde_with::serde_as]
17925            #[derive(serde :: Serialize)]
17926            #[serde(untagged)]
17927            #[allow(clippy::enum_variant_names)]
17928            enum LearningRateMultiplier<'a> {
17929                Auto (crate :: __types :: fine_tune_supervised_hyperparameters :: learning_rate_multiplier :: Auto) , Number (& 'a serde_json :: Number) }
17930            match self {
17931                Self::Auto => LearningRateMultiplier::Auto(Default::default()),
17932                Self::Number(v) => LearningRateMultiplier::Number(v),
17933            }
17934            .serialize(serializer)
17935        }
17936    }
17937    #[allow(clippy::module_inception)]
17938    pub(crate) mod n_epochs {
17939        #[doc = "auto"]
17940        #[derive(Clone, Copy, Debug, Default, PartialEq)]
17941        pub(crate) struct Auto;
17942        impl_serde!(Auto, "auto");
17943    }
17944    #[doc = "The number of epochs to train the model for. An epoch refers to one full cycle through the training dataset.\n"]
17945    #[derive(Clone, Copy, Debug, PartialEq)]
17946    #[allow(clippy::large_enum_variant)]
17947    pub enum NEpochs {
17948        #[doc = "auto"]
17949        Auto,
17950        Integer(i64),
17951    }
17952    impl<'de> serde::Deserialize<'de> for NEpochs {
17953        fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
17954        where
17955            D: serde::Deserializer<'de>,
17956        {
17957            #[serde_with::serde_as]
17958            #[derive(serde :: Deserialize)]
17959            #[serde(untagged)]
17960            #[allow(clippy::enum_variant_names, clippy::large_enum_variant)]
17961            enum NEpochs {
17962                Auto(crate::__types::fine_tune_supervised_hyperparameters::n_epochs::Auto),
17963                Integer(i64),
17964            }
17965            Ok(match NEpochs::deserialize(deserializer)? {
17966                NEpochs::Auto(_) => Self::Auto,
17967                NEpochs::Integer(v) => Self::Integer(v),
17968            })
17969        }
17970    }
17971    impl serde::Serialize for NEpochs {
17972        fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
17973        where
17974            S: serde::Serializer,
17975        {
17976            #[serde_with::serde_as]
17977            #[derive(serde :: Serialize)]
17978            #[serde(untagged)]
17979            #[allow(clippy::enum_variant_names)]
17980            enum NEpochs<'a> {
17981                Auto(crate::__types::fine_tune_supervised_hyperparameters::n_epochs::Auto),
17982                Integer(&'a i64),
17983            }
17984            match self {
17985                Self::Auto => NEpochs::Auto(Default::default()),
17986                Self::Integer(v) => NEpochs::Integer(v),
17987            }
17988            .serialize(serializer)
17989        }
17990    }
17991}
17992#[doc = "The hyperparameters used for the fine-tuning job."]
17993#[derive(Clone, Debug, Default, PartialEq)]
17994#[serde_with::serde_as]
17995#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
17996pub struct FineTuneSupervisedHyperparameters {
17997    #[doc = "Number of examples in each batch. A larger batch size means that model parameters are updated less frequently, but with lower variance.\n"]
17998    #[serde(rename = "batch_size")]
17999    #[serde(skip_serializing_if = "Option::is_none")]
18000    #[builder(default)]
18001    pub batch_size: Option<crate::__types::fine_tune_supervised_hyperparameters::BatchSize>,
18002    #[doc = "Scaling factor for the learning rate. A smaller learning rate may be useful to avoid overfitting.\n"]
18003    #[serde(rename = "learning_rate_multiplier")]
18004    #[serde(skip_serializing_if = "Option::is_none")]
18005    #[builder(default)]
18006    pub learning_rate_multiplier:
18007        Option<crate::__types::fine_tune_supervised_hyperparameters::LearningRateMultiplier>,
18008    #[doc = "The number of epochs to train the model for. An epoch refers to one full cycle through the training dataset.\n"]
18009    #[serde(rename = "n_epochs")]
18010    #[serde(skip_serializing_if = "Option::is_none")]
18011    #[builder(default)]
18012    pub n_epochs: Option<crate::__types::fine_tune_supervised_hyperparameters::NEpochs>,
18013}
18014#[doc = "Configuration for the supervised fine-tuning method."]
18015#[derive(Clone, Debug, Default, PartialEq)]
18016#[serde_with::serde_as]
18017#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
18018pub struct FineTuneSupervisedMethod {
18019    #[serde(rename = "hyperparameters")]
18020    #[serde(skip_serializing_if = "Option::is_none")]
18021    #[builder(default)]
18022    pub hyperparameters: Option<crate::__types::FineTuneSupervisedHyperparameters>,
18023}
18024#[allow(clippy::module_inception)]
18025pub(crate) mod fine_tuning_checkpoint_permission {
18026    #[doc = "The object type, which is always \"checkpoint.permission\"."]
18027    #[derive(Clone, Copy, Debug, Default, PartialEq)]
18028    pub(crate) struct Object;
18029    impl_serde!(Object, "checkpoint.permission");
18030}
18031#[doc = "The `checkpoint.permission` object represents a permission for a fine-tuned model checkpoint.\n"]
18032#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
18033pub struct FineTuningCheckpointPermission {
18034    #[doc = "The permission identifier, which can be referenced in the API endpoints."]
18035    pub id: String,
18036    #[doc = "The Unix timestamp (in seconds) for when the permission was created."]
18037    pub created_at: i64,
18038    #[doc = "The project identifier that the permission is for."]
18039    pub project_id: String,
18040}
18041impl<'de> serde::Deserialize<'de> for FineTuningCheckpointPermission {
18042    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
18043    where
18044        D: serde::Deserializer<'de>,
18045    {
18046        #[serde_with::serde_as]
18047        #[derive(serde :: Deserialize)]
18048        struct FineTuningCheckpointPermission {
18049            #[serde(rename = "id")]
18050            id: String,
18051            #[serde(rename = "created_at")]
18052            created_at: i64,
18053            #[serde(rename = "project_id")]
18054            project_id: String,
18055            #[serde(rename = "object")]
18056            #[allow(dead_code)]
18057            object: crate::__types::fine_tuning_checkpoint_permission::Object,
18058        }
18059        let FineTuningCheckpointPermission {
18060            id,
18061            created_at,
18062            project_id,
18063            ..
18064        } = FineTuningCheckpointPermission::deserialize(deserializer)?;
18065        Ok(Self {
18066            id,
18067            created_at,
18068            project_id,
18069        })
18070    }
18071}
18072impl serde::Serialize for FineTuningCheckpointPermission {
18073    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
18074    where
18075        S: serde::Serializer,
18076    {
18077        #[serde_with::serde_as]
18078        #[derive(serde :: Serialize)]
18079        struct FineTuningCheckpointPermission<'a> {
18080            #[serde(rename = "id")]
18081            id: &'a String,
18082            #[serde(rename = "created_at")]
18083            created_at: &'a i64,
18084            #[serde(rename = "project_id")]
18085            project_id: &'a String,
18086            #[serde(rename = "object")]
18087            object: &'a crate::__types::fine_tuning_checkpoint_permission::Object,
18088        }
18089        let Self {
18090            id,
18091            created_at,
18092            project_id,
18093        } = self;
18094        FineTuningCheckpointPermission {
18095            id,
18096            created_at,
18097            project_id,
18098            object: &Default::default(),
18099        }
18100        .serialize(serializer)
18101    }
18102}
18103#[allow(clippy::module_inception)]
18104pub mod fine_tuning_integration {
18105    #[doc = "The type of the integration being enabled for the fine-tuning job"]
18106    #[derive(Clone, Copy, Debug, Default, PartialEq)]
18107    pub(crate) struct Type;
18108    impl_serde!(Type, "wandb");
18109    #[doc = "The settings for your integration with Weights and Biases. This payload specifies the project that\nmetrics will be sent to. Optionally, you can set an explicit display name for your run, add tags\nto your run, and set a default entity (team, username, etc) to be associated with your run.\n"]
18110    #[derive(Clone, Debug, PartialEq)]
18111    #[serde_with::serde_as]
18112    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
18113    pub struct Wandb {
18114        #[doc = "The name of the project that the new run will be created under.\n"]
18115        #[serde(rename = "project")]
18116        pub project: String,
18117        #[doc = "A display name to set for the run. If not set, we will use the Job ID as the name.\n"]
18118        #[serde(rename = "name")]
18119        #[serde(skip_serializing_if = "Option::is_none")]
18120        #[builder(default)]
18121        pub name: Option<String>,
18122        #[doc = "The entity to use for the run. This allows you to set the team or username of the WandB user that you would\nlike associated with the run. If not set, the default entity for the registered WandB API key is used.\n"]
18123        #[serde(rename = "entity")]
18124        #[serde(skip_serializing_if = "Option::is_none")]
18125        #[builder(default)]
18126        pub entity: Option<String>,
18127        #[doc = "A list of tags to be attached to the newly created run. These tags are passed through directly to WandB. Some\ndefault tags are generated by OpenAI: \"openai/finetune\", \"openai/{base-model}\", \"openai/{ftjob-abcdef}\".\n"]
18128        #[serde(rename = "tags")]
18129        #[serde(skip_serializing_if = "Option::is_none")]
18130        #[builder(default)]
18131        pub tags: Option<Vec<String>>,
18132    }
18133}
18134#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
18135pub struct FineTuningIntegration {
18136    #[doc = "The settings for your integration with Weights and Biases. This payload specifies the project that\nmetrics will be sent to. Optionally, you can set an explicit display name for your run, add tags\nto your run, and set a default entity (team, username, etc) to be associated with your run.\n"]
18137    pub wandb: crate::__types::fine_tuning_integration::Wandb,
18138}
18139impl<'de> serde::Deserialize<'de> for FineTuningIntegration {
18140    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
18141    where
18142        D: serde::Deserializer<'de>,
18143    {
18144        #[serde_with::serde_as]
18145        #[derive(serde :: Deserialize)]
18146        struct FineTuningIntegration {
18147            #[serde(rename = "type")]
18148            #[allow(dead_code)]
18149            r#type: crate::__types::fine_tuning_integration::Type,
18150            #[serde(rename = "wandb")]
18151            wandb: crate::__types::fine_tuning_integration::Wandb,
18152        }
18153        let FineTuningIntegration { wandb, .. } = FineTuningIntegration::deserialize(deserializer)?;
18154        Ok(Self { wandb })
18155    }
18156}
18157impl serde::Serialize for FineTuningIntegration {
18158    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
18159    where
18160        S: serde::Serializer,
18161    {
18162        #[serde_with::serde_as]
18163        #[derive(serde :: Serialize)]
18164        struct FineTuningIntegration<'a> {
18165            #[serde(rename = "type")]
18166            r#type: &'a crate::__types::fine_tuning_integration::Type,
18167            #[serde(rename = "wandb")]
18168            wandb: &'a crate::__types::fine_tuning_integration::Wandb,
18169        }
18170        let Self { wandb } = self;
18171        FineTuningIntegration {
18172            r#type: &Default::default(),
18173            wandb,
18174        }
18175        .serialize(serializer)
18176    }
18177}
18178#[allow(clippy::module_inception)]
18179pub mod fine_tuning_job {
18180    #[doc = "For fine-tuning jobs that have `failed`, this will contain more information on the cause of the failure."]
18181    #[derive(Clone, Debug, PartialEq)]
18182    #[serde_with::serde_as]
18183    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
18184    pub struct Error {
18185        #[doc = "A machine-readable error code."]
18186        #[serde(rename = "code")]
18187        pub code: String,
18188        #[doc = "A human-readable error message."]
18189        #[serde(rename = "message")]
18190        pub message: String,
18191        #[doc = "The parameter that was invalid, usually `training_file` or `validation_file`. This field will be null if the failure was not parameter-specific."]
18192        #[serde(rename = "param")]
18193        #[serde(skip_serializing_if = "Option::is_none")]
18194        #[builder(default)]
18195        pub param: Option<String>,
18196    }
18197    #[allow(clippy::module_inception)]
18198    pub mod hyperparameters {
18199        #[allow(clippy::module_inception)]
18200        pub(crate) mod batch_size {
18201            #[doc = "auto"]
18202            #[derive(Clone, Copy, Debug, Default, PartialEq)]
18203            pub(crate) struct Auto;
18204            impl_serde!(Auto, "auto");
18205        }
18206        #[doc = "Number of examples in each batch. A larger batch size means that model parameters\nare updated less frequently, but with lower variance.\n"]
18207        #[derive(Clone, Copy, Debug, PartialEq)]
18208        #[allow(clippy::large_enum_variant)]
18209        pub enum BatchSize {
18210            #[doc = "auto"]
18211            Auto,
18212            Integer(i64),
18213        }
18214        impl<'de> serde::Deserialize<'de> for BatchSize {
18215            fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
18216            where
18217                D: serde::Deserializer<'de>,
18218            {
18219                #[serde_with::serde_as]
18220                #[derive(serde :: Deserialize)]
18221                #[serde(untagged)]
18222                #[allow(clippy::enum_variant_names, clippy::large_enum_variant)]
18223                enum BatchSize {
18224                    Auto(crate::__types::fine_tuning_job::hyperparameters::batch_size::Auto),
18225                    Integer(i64),
18226                }
18227                Ok(match BatchSize::deserialize(deserializer)? {
18228                    BatchSize::Auto(_) => Self::Auto,
18229                    BatchSize::Integer(v) => Self::Integer(v),
18230                })
18231            }
18232        }
18233        impl serde::Serialize for BatchSize {
18234            fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
18235            where
18236                S: serde::Serializer,
18237            {
18238                #[serde_with::serde_as]
18239                #[derive(serde :: Serialize)]
18240                #[serde(untagged)]
18241                #[allow(clippy::enum_variant_names)]
18242                enum BatchSize<'a> {
18243                    Auto(crate::__types::fine_tuning_job::hyperparameters::batch_size::Auto),
18244                    Integer(&'a i64),
18245                }
18246                match self {
18247                    Self::Auto => BatchSize::Auto(Default::default()),
18248                    Self::Integer(v) => BatchSize::Integer(v),
18249                }
18250                .serialize(serializer)
18251            }
18252        }
18253        #[allow(clippy::module_inception)]
18254        pub(crate) mod learning_rate_multiplier {
18255            #[doc = "auto"]
18256            #[derive(Clone, Copy, Debug, Default, PartialEq)]
18257            pub(crate) struct Auto;
18258            impl_serde!(Auto, "auto");
18259        }
18260        #[doc = "Scaling factor for the learning rate. A smaller learning rate may be useful to avoid\noverfitting.\n"]
18261        #[derive(Clone, Debug, PartialEq)]
18262        #[allow(clippy::large_enum_variant)]
18263        pub enum LearningRateMultiplier {
18264            #[doc = "auto"]
18265            Auto,
18266            Number(serde_json::Number),
18267        }
18268        impl<'de> serde::Deserialize<'de> for LearningRateMultiplier {
18269            fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
18270            where
18271                D: serde::Deserializer<'de>,
18272            {
18273                #[serde_with::serde_as]
18274                #[derive(serde :: Deserialize)]
18275                #[serde(untagged)]
18276                #[allow(clippy::enum_variant_names, clippy::large_enum_variant)]
18277                enum LearningRateMultiplier {
18278                    Auto (crate :: __types :: fine_tuning_job :: hyperparameters :: learning_rate_multiplier :: Auto) , Number (serde_json :: Number) }
18279                Ok(match LearningRateMultiplier::deserialize(deserializer)? {
18280                    LearningRateMultiplier::Auto(_) => Self::Auto,
18281                    LearningRateMultiplier::Number(v) => Self::Number(v),
18282                })
18283            }
18284        }
18285        impl serde::Serialize for LearningRateMultiplier {
18286            fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
18287            where
18288                S: serde::Serializer,
18289            {
18290                #[serde_with::serde_as]
18291                #[derive(serde :: Serialize)]
18292                #[serde(untagged)]
18293                #[allow(clippy::enum_variant_names)]
18294                enum LearningRateMultiplier<'a> {
18295                    Auto (crate :: __types :: fine_tuning_job :: hyperparameters :: learning_rate_multiplier :: Auto) , Number (& 'a serde_json :: Number) }
18296                match self {
18297                    Self::Auto => LearningRateMultiplier::Auto(Default::default()),
18298                    Self::Number(v) => LearningRateMultiplier::Number(v),
18299                }
18300                .serialize(serializer)
18301            }
18302        }
18303        #[allow(clippy::module_inception)]
18304        pub(crate) mod n_epochs {
18305            #[doc = "auto"]
18306            #[derive(Clone, Copy, Debug, Default, PartialEq)]
18307            pub(crate) struct Auto;
18308            impl_serde!(Auto, "auto");
18309        }
18310        #[doc = "The number of epochs to train the model for. An epoch refers to one full cycle\nthrough the training dataset.\n"]
18311        #[derive(Clone, Copy, Debug, PartialEq)]
18312        #[allow(clippy::large_enum_variant)]
18313        pub enum NEpochs {
18314            #[doc = "auto"]
18315            Auto,
18316            Integer(i64),
18317        }
18318        impl<'de> serde::Deserialize<'de> for NEpochs {
18319            fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
18320            where
18321                D: serde::Deserializer<'de>,
18322            {
18323                #[serde_with::serde_as]
18324                #[derive(serde :: Deserialize)]
18325                #[serde(untagged)]
18326                #[allow(clippy::enum_variant_names, clippy::large_enum_variant)]
18327                enum NEpochs {
18328                    Auto(crate::__types::fine_tuning_job::hyperparameters::n_epochs::Auto),
18329                    Integer(i64),
18330                }
18331                Ok(match NEpochs::deserialize(deserializer)? {
18332                    NEpochs::Auto(_) => Self::Auto,
18333                    NEpochs::Integer(v) => Self::Integer(v),
18334                })
18335            }
18336        }
18337        impl serde::Serialize for NEpochs {
18338            fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
18339            where
18340                S: serde::Serializer,
18341            {
18342                #[serde_with::serde_as]
18343                #[derive(serde :: Serialize)]
18344                #[serde(untagged)]
18345                #[allow(clippy::enum_variant_names)]
18346                enum NEpochs<'a> {
18347                    Auto(crate::__types::fine_tuning_job::hyperparameters::n_epochs::Auto),
18348                    Integer(&'a i64),
18349                }
18350                match self {
18351                    Self::Auto => NEpochs::Auto(Default::default()),
18352                    Self::Integer(v) => NEpochs::Integer(v),
18353                }
18354                .serialize(serializer)
18355            }
18356        }
18357    }
18358    #[doc = "The hyperparameters used for the fine-tuning job. This value will only be returned when running `supervised` jobs."]
18359    #[derive(Clone, Debug, Default, PartialEq)]
18360    #[serde_with::serde_as]
18361    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
18362    pub struct Hyperparameters {
18363        #[doc = "Number of examples in each batch. A larger batch size means that model parameters\nare updated less frequently, but with lower variance.\n"]
18364        #[serde(rename = "batch_size")]
18365        #[serde(skip_serializing_if = "Option::is_none")]
18366        #[builder(default)]
18367        pub batch_size: Option<crate::__types::fine_tuning_job::hyperparameters::BatchSize>,
18368        #[doc = "Scaling factor for the learning rate. A smaller learning rate may be useful to avoid\noverfitting.\n"]
18369        #[serde(rename = "learning_rate_multiplier")]
18370        #[serde(skip_serializing_if = "Option::is_none")]
18371        #[builder(default)]
18372        pub learning_rate_multiplier:
18373            Option<crate::__types::fine_tuning_job::hyperparameters::LearningRateMultiplier>,
18374        #[doc = "The number of epochs to train the model for. An epoch refers to one full cycle\nthrough the training dataset.\n"]
18375        #[serde(rename = "n_epochs")]
18376        #[serde(skip_serializing_if = "Option::is_none")]
18377        #[builder(default)]
18378        pub n_epochs: Option<crate::__types::fine_tuning_job::hyperparameters::NEpochs>,
18379    }
18380    #[doc = "The object type, which is always \"fine_tuning.job\"."]
18381    #[derive(Clone, Copy, Debug, Default, PartialEq)]
18382    pub(crate) struct Object;
18383    impl_serde!(Object, "fine_tuning.job");
18384    #[doc = "The current status of the fine-tuning job, which can be either `validating_files`, `queued`, `running`, `succeeded`, `failed`, or `cancelled`."]
18385    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
18386    pub enum Status {
18387        #[doc = "`validating_files`"]
18388        #[serde(rename = "validating_files")]
18389        ValidatingFiles,
18390        #[doc = "`queued`"]
18391        #[serde(rename = "queued")]
18392        Queued,
18393        #[doc = "`running`"]
18394        #[serde(rename = "running")]
18395        Running,
18396        #[doc = "`succeeded`"]
18397        #[serde(rename = "succeeded")]
18398        Succeeded,
18399        #[doc = "`failed`"]
18400        #[serde(rename = "failed")]
18401        Failed,
18402        #[doc = "`cancelled`"]
18403        #[serde(rename = "cancelled")]
18404        Cancelled,
18405    }
18406    #[allow(clippy::module_inception)]
18407    pub mod integrations {
18408        #[derive(Clone, Debug, PartialEq)]
18409        #[serde_with::serde_as]
18410        #[derive(serde :: Deserialize, serde :: Serialize)]
18411        #[serde(untagged)]
18412        #[allow(clippy::large_enum_variant)]
18413        pub enum Item {
18414            FineTuningIntegration(crate::__types::FineTuningIntegration),
18415        }
18416    }
18417}
18418#[doc = "The `fine_tuning.job` object represents a fine-tuning job that has been created through the API.\n"]
18419#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
18420pub struct FineTuningJob {
18421    #[doc = "The object identifier, which can be referenced in the API endpoints."]
18422    pub id: String,
18423    #[doc = "The Unix timestamp (in seconds) for when the fine-tuning job was created."]
18424    pub created_at: i64,
18425    #[doc = "For fine-tuning jobs that have `failed`, this will contain more information on the cause of the failure."]
18426    #[builder(default)]
18427    pub error: Option<crate::__types::fine_tuning_job::Error>,
18428    #[doc = "The name of the fine-tuned model that is being created. The value will be null if the fine-tuning job is still running."]
18429    #[builder(default)]
18430    pub fine_tuned_model: Option<String>,
18431    #[doc = "The Unix timestamp (in seconds) for when the fine-tuning job was finished. The value will be null if the fine-tuning job is still running."]
18432    #[builder(default)]
18433    pub finished_at: Option<i64>,
18434    #[doc = "The hyperparameters used for the fine-tuning job. This value will only be returned when running `supervised` jobs."]
18435    #[builder(default)]
18436    pub hyperparameters: crate::__types::fine_tuning_job::Hyperparameters,
18437    #[doc = "The base model that is being fine-tuned."]
18438    pub model: String,
18439    #[doc = "The organization that owns the fine-tuning job."]
18440    pub organization_id: String,
18441    #[doc = "The compiled results file ID(s) for the fine-tuning job. You can retrieve the results with the [Files API](https://platform.openai.com/docs/api-reference/files/retrieve-contents)."]
18442    pub result_files: Vec<String>,
18443    #[doc = "The current status of the fine-tuning job, which can be either `validating_files`, `queued`, `running`, `succeeded`, `failed`, or `cancelled`."]
18444    pub status: crate::__types::fine_tuning_job::Status,
18445    #[doc = "The total number of billable tokens processed by this fine-tuning job. The value will be null if the fine-tuning job is still running."]
18446    #[builder(default)]
18447    pub trained_tokens: Option<i64>,
18448    #[doc = "The file ID used for training. You can retrieve the training data with the [Files API](https://platform.openai.com/docs/api-reference/files/retrieve-contents)."]
18449    pub training_file: String,
18450    #[doc = "The file ID used for validation. You can retrieve the validation results with the [Files API](https://platform.openai.com/docs/api-reference/files/retrieve-contents)."]
18451    #[builder(default)]
18452    pub validation_file: Option<String>,
18453    #[doc = "A list of integrations to enable for this fine-tuning job."]
18454    #[builder(default)]
18455    pub integrations: Option<Vec<crate::__types::fine_tuning_job::integrations::Item>>,
18456    #[doc = "The seed used for the fine-tuning job."]
18457    pub seed: i64,
18458    #[doc = "The Unix timestamp (in seconds) for when the fine-tuning job is estimated to finish. The value will be null if the fine-tuning job is not running."]
18459    #[builder(default)]
18460    pub estimated_finish: Option<i64>,
18461    #[builder(default)]
18462    pub method: Option<crate::__types::FineTuneMethod>,
18463    #[builder(default)]
18464    pub metadata: Option<crate::__types::Metadata>,
18465}
18466impl<'de> serde::Deserialize<'de> for FineTuningJob {
18467    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
18468    where
18469        D: serde::Deserializer<'de>,
18470    {
18471        #[serde_with::serde_as]
18472        #[derive(serde :: Deserialize)]
18473        struct FineTuningJob {
18474            #[serde(rename = "id")]
18475            id: String,
18476            #[serde(rename = "created_at")]
18477            created_at: i64,
18478            #[serde(rename = "error")]
18479            error: Option<crate::__types::fine_tuning_job::Error>,
18480            #[serde(rename = "fine_tuned_model")]
18481            fine_tuned_model: Option<String>,
18482            #[serde(rename = "finished_at")]
18483            finished_at: Option<i64>,
18484            #[serde(rename = "hyperparameters")]
18485            hyperparameters: crate::__types::fine_tuning_job::Hyperparameters,
18486            #[serde(rename = "model")]
18487            model: String,
18488            #[serde(rename = "object")]
18489            #[allow(dead_code)]
18490            object: crate::__types::fine_tuning_job::Object,
18491            #[serde(rename = "organization_id")]
18492            organization_id: String,
18493            #[serde(rename = "result_files")]
18494            result_files: Vec<String>,
18495            #[serde(rename = "status")]
18496            status: crate::__types::fine_tuning_job::Status,
18497            #[serde(rename = "trained_tokens")]
18498            trained_tokens: Option<i64>,
18499            #[serde(rename = "training_file")]
18500            training_file: String,
18501            #[serde(rename = "validation_file")]
18502            validation_file: Option<String>,
18503            #[serde(rename = "integrations")]
18504            integrations: Option<Vec<crate::__types::fine_tuning_job::integrations::Item>>,
18505            #[serde(rename = "seed")]
18506            seed: i64,
18507            #[serde(rename = "estimated_finish")]
18508            estimated_finish: Option<i64>,
18509            #[serde(rename = "method")]
18510            method: Option<crate::__types::FineTuneMethod>,
18511            #[serde(rename = "metadata")]
18512            metadata: Option<crate::__types::Metadata>,
18513        }
18514        let FineTuningJob {
18515            id,
18516            created_at,
18517            error,
18518            fine_tuned_model,
18519            finished_at,
18520            hyperparameters,
18521            model,
18522            organization_id,
18523            result_files,
18524            status,
18525            trained_tokens,
18526            training_file,
18527            validation_file,
18528            integrations,
18529            seed,
18530            estimated_finish,
18531            method,
18532            metadata,
18533            ..
18534        } = FineTuningJob::deserialize(deserializer)?;
18535        Ok(Self {
18536            id,
18537            created_at,
18538            error,
18539            fine_tuned_model,
18540            finished_at,
18541            hyperparameters,
18542            model,
18543            organization_id,
18544            result_files,
18545            status,
18546            trained_tokens,
18547            training_file,
18548            validation_file,
18549            integrations,
18550            seed,
18551            estimated_finish,
18552            method,
18553            metadata,
18554        })
18555    }
18556}
18557impl serde::Serialize for FineTuningJob {
18558    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
18559    where
18560        S: serde::Serializer,
18561    {
18562        #[serde_with::serde_as]
18563        #[derive(serde :: Serialize)]
18564        struct FineTuningJob<'a> {
18565            #[serde(rename = "id")]
18566            id: &'a String,
18567            #[serde(rename = "created_at")]
18568            created_at: &'a i64,
18569            #[serde(rename = "error")]
18570            #[serde(skip_serializing_if = "Option::is_none")]
18571            error: &'a Option<crate::__types::fine_tuning_job::Error>,
18572            #[serde(rename = "fine_tuned_model")]
18573            #[serde(skip_serializing_if = "Option::is_none")]
18574            fine_tuned_model: &'a Option<String>,
18575            #[serde(rename = "finished_at")]
18576            #[serde(skip_serializing_if = "Option::is_none")]
18577            finished_at: &'a Option<i64>,
18578            #[serde(rename = "hyperparameters")]
18579            hyperparameters: &'a crate::__types::fine_tuning_job::Hyperparameters,
18580            #[serde(rename = "model")]
18581            model: &'a String,
18582            #[serde(rename = "object")]
18583            object: &'a crate::__types::fine_tuning_job::Object,
18584            #[serde(rename = "organization_id")]
18585            organization_id: &'a String,
18586            #[serde(rename = "result_files")]
18587            result_files: &'a Vec<String>,
18588            #[serde(rename = "status")]
18589            status: &'a crate::__types::fine_tuning_job::Status,
18590            #[serde(rename = "trained_tokens")]
18591            #[serde(skip_serializing_if = "Option::is_none")]
18592            trained_tokens: &'a Option<i64>,
18593            #[serde(rename = "training_file")]
18594            training_file: &'a String,
18595            #[serde(rename = "validation_file")]
18596            #[serde(skip_serializing_if = "Option::is_none")]
18597            validation_file: &'a Option<String>,
18598            #[serde(rename = "integrations")]
18599            #[serde(skip_serializing_if = "Option::is_none")]
18600            integrations: &'a Option<Vec<crate::__types::fine_tuning_job::integrations::Item>>,
18601            #[serde(rename = "seed")]
18602            seed: &'a i64,
18603            #[serde(rename = "estimated_finish")]
18604            #[serde(skip_serializing_if = "Option::is_none")]
18605            estimated_finish: &'a Option<i64>,
18606            #[serde(rename = "method")]
18607            #[serde(skip_serializing_if = "Option::is_none")]
18608            method: &'a Option<crate::__types::FineTuneMethod>,
18609            #[serde(rename = "metadata")]
18610            #[serde(skip_serializing_if = "Option::is_none")]
18611            metadata: &'a Option<crate::__types::Metadata>,
18612        }
18613        let Self {
18614            id,
18615            created_at,
18616            error,
18617            fine_tuned_model,
18618            finished_at,
18619            hyperparameters,
18620            model,
18621            organization_id,
18622            result_files,
18623            status,
18624            trained_tokens,
18625            training_file,
18626            validation_file,
18627            integrations,
18628            seed,
18629            estimated_finish,
18630            method,
18631            metadata,
18632        } = self;
18633        FineTuningJob {
18634            id,
18635            created_at,
18636            error,
18637            fine_tuned_model,
18638            finished_at,
18639            hyperparameters,
18640            model,
18641            object: &Default::default(),
18642            organization_id,
18643            result_files,
18644            status,
18645            trained_tokens,
18646            training_file,
18647            validation_file,
18648            integrations,
18649            seed,
18650            estimated_finish,
18651            method,
18652            metadata,
18653        }
18654        .serialize(serializer)
18655    }
18656}
18657#[allow(clippy::module_inception)]
18658pub mod fine_tuning_job_checkpoint {
18659    #[doc = "Metrics at the step number during the fine-tuning job."]
18660    #[derive(Clone, Debug, Default, PartialEq)]
18661    #[serde_with::serde_as]
18662    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
18663    pub struct Metrics {
18664        #[serde(rename = "step")]
18665        #[serde(skip_serializing_if = "Option::is_none")]
18666        #[builder(default)]
18667        pub step: Option<serde_json::Number>,
18668        #[serde(rename = "train_loss")]
18669        #[serde(skip_serializing_if = "Option::is_none")]
18670        #[builder(default)]
18671        pub train_loss: Option<serde_json::Number>,
18672        #[serde(rename = "train_mean_token_accuracy")]
18673        #[serde(skip_serializing_if = "Option::is_none")]
18674        #[builder(default)]
18675        pub train_mean_token_accuracy: Option<serde_json::Number>,
18676        #[serde(rename = "valid_loss")]
18677        #[serde(skip_serializing_if = "Option::is_none")]
18678        #[builder(default)]
18679        pub valid_loss: Option<serde_json::Number>,
18680        #[serde(rename = "valid_mean_token_accuracy")]
18681        #[serde(skip_serializing_if = "Option::is_none")]
18682        #[builder(default)]
18683        pub valid_mean_token_accuracy: Option<serde_json::Number>,
18684        #[serde(rename = "full_valid_loss")]
18685        #[serde(skip_serializing_if = "Option::is_none")]
18686        #[builder(default)]
18687        pub full_valid_loss: Option<serde_json::Number>,
18688        #[serde(rename = "full_valid_mean_token_accuracy")]
18689        #[serde(skip_serializing_if = "Option::is_none")]
18690        #[builder(default)]
18691        pub full_valid_mean_token_accuracy: Option<serde_json::Number>,
18692    }
18693    #[doc = "The object type, which is always \"fine_tuning.job.checkpoint\"."]
18694    #[derive(Clone, Copy, Debug, Default, PartialEq)]
18695    pub(crate) struct Object;
18696    impl_serde!(Object, "fine_tuning.job.checkpoint");
18697}
18698#[doc = "The `fine_tuning.job.checkpoint` object represents a model checkpoint for a fine-tuning job that is ready to use.\n"]
18699#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
18700pub struct FineTuningJobCheckpoint {
18701    #[doc = "The checkpoint identifier, which can be referenced in the API endpoints."]
18702    pub id: String,
18703    #[doc = "The Unix timestamp (in seconds) for when the checkpoint was created."]
18704    pub created_at: i64,
18705    #[doc = "The name of the fine-tuned checkpoint model that is created."]
18706    pub fine_tuned_model_checkpoint: String,
18707    #[doc = "The step number that the checkpoint was created at."]
18708    pub step_number: i64,
18709    #[doc = "Metrics at the step number during the fine-tuning job."]
18710    #[builder(default)]
18711    pub metrics: crate::__types::fine_tuning_job_checkpoint::Metrics,
18712    #[doc = "The name of the fine-tuning job that this checkpoint was created from."]
18713    pub fine_tuning_job_id: String,
18714}
18715impl<'de> serde::Deserialize<'de> for FineTuningJobCheckpoint {
18716    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
18717    where
18718        D: serde::Deserializer<'de>,
18719    {
18720        #[serde_with::serde_as]
18721        #[derive(serde :: Deserialize)]
18722        struct FineTuningJobCheckpoint {
18723            #[serde(rename = "id")]
18724            id: String,
18725            #[serde(rename = "created_at")]
18726            created_at: i64,
18727            #[serde(rename = "fine_tuned_model_checkpoint")]
18728            fine_tuned_model_checkpoint: String,
18729            #[serde(rename = "step_number")]
18730            step_number: i64,
18731            #[serde(rename = "metrics")]
18732            metrics: crate::__types::fine_tuning_job_checkpoint::Metrics,
18733            #[serde(rename = "fine_tuning_job_id")]
18734            fine_tuning_job_id: String,
18735            #[serde(rename = "object")]
18736            #[allow(dead_code)]
18737            object: crate::__types::fine_tuning_job_checkpoint::Object,
18738        }
18739        let FineTuningJobCheckpoint {
18740            id,
18741            created_at,
18742            fine_tuned_model_checkpoint,
18743            step_number,
18744            metrics,
18745            fine_tuning_job_id,
18746            ..
18747        } = FineTuningJobCheckpoint::deserialize(deserializer)?;
18748        Ok(Self {
18749            id,
18750            created_at,
18751            fine_tuned_model_checkpoint,
18752            step_number,
18753            metrics,
18754            fine_tuning_job_id,
18755        })
18756    }
18757}
18758impl serde::Serialize for FineTuningJobCheckpoint {
18759    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
18760    where
18761        S: serde::Serializer,
18762    {
18763        #[serde_with::serde_as]
18764        #[derive(serde :: Serialize)]
18765        struct FineTuningJobCheckpoint<'a> {
18766            #[serde(rename = "id")]
18767            id: &'a String,
18768            #[serde(rename = "created_at")]
18769            created_at: &'a i64,
18770            #[serde(rename = "fine_tuned_model_checkpoint")]
18771            fine_tuned_model_checkpoint: &'a String,
18772            #[serde(rename = "step_number")]
18773            step_number: &'a i64,
18774            #[serde(rename = "metrics")]
18775            metrics: &'a crate::__types::fine_tuning_job_checkpoint::Metrics,
18776            #[serde(rename = "fine_tuning_job_id")]
18777            fine_tuning_job_id: &'a String,
18778            #[serde(rename = "object")]
18779            object: &'a crate::__types::fine_tuning_job_checkpoint::Object,
18780        }
18781        let Self {
18782            id,
18783            created_at,
18784            fine_tuned_model_checkpoint,
18785            step_number,
18786            metrics,
18787            fine_tuning_job_id,
18788        } = self;
18789        FineTuningJobCheckpoint {
18790            id,
18791            created_at,
18792            fine_tuned_model_checkpoint,
18793            step_number,
18794            metrics,
18795            fine_tuning_job_id,
18796            object: &Default::default(),
18797        }
18798        .serialize(serializer)
18799    }
18800}
18801#[allow(clippy::module_inception)]
18802pub mod fine_tuning_job_event {
18803    #[doc = "The object type, which is always \"fine_tuning.job.event\"."]
18804    #[derive(Clone, Copy, Debug, Default, PartialEq)]
18805    pub(crate) struct Object;
18806    impl_serde!(Object, "fine_tuning.job.event");
18807    #[doc = "The log level of the event."]
18808    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
18809    pub enum Level {
18810        #[doc = "`info`"]
18811        #[serde(rename = "info")]
18812        Info,
18813        #[doc = "`warn`"]
18814        #[serde(rename = "warn")]
18815        Warn,
18816        #[doc = "`error`"]
18817        #[serde(rename = "error")]
18818        Error,
18819    }
18820    #[doc = "The type of event."]
18821    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
18822    pub enum Type {
18823        #[doc = "`message`"]
18824        #[serde(rename = "message")]
18825        Message,
18826        #[doc = "`metrics`"]
18827        #[serde(rename = "metrics")]
18828        Metrics,
18829    }
18830}
18831#[doc = "Fine-tuning job event object"]
18832#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
18833pub struct FineTuningJobEvent {
18834    #[doc = "The object identifier."]
18835    pub id: String,
18836    #[doc = "The Unix timestamp (in seconds) for when the fine-tuning job was created."]
18837    pub created_at: i64,
18838    #[doc = "The log level of the event."]
18839    pub level: crate::__types::fine_tuning_job_event::Level,
18840    #[doc = "The message of the event."]
18841    pub message: String,
18842    #[doc = "The type of event."]
18843    #[builder(default)]
18844    pub r#type: Option<crate::__types::fine_tuning_job_event::Type>,
18845    #[doc = "The data associated with the event."]
18846    #[builder(default)]
18847    pub data: Option<indexmap::IndexMap<String, serde_json::Value>>,
18848}
18849impl<'de> serde::Deserialize<'de> for FineTuningJobEvent {
18850    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
18851    where
18852        D: serde::Deserializer<'de>,
18853    {
18854        #[serde_with::serde_as]
18855        #[derive(serde :: Deserialize)]
18856        struct FineTuningJobEvent {
18857            #[serde(rename = "object")]
18858            #[allow(dead_code)]
18859            object: crate::__types::fine_tuning_job_event::Object,
18860            #[serde(rename = "id")]
18861            id: String,
18862            #[serde(rename = "created_at")]
18863            created_at: i64,
18864            #[serde(rename = "level")]
18865            level: crate::__types::fine_tuning_job_event::Level,
18866            #[serde(rename = "message")]
18867            message: String,
18868            #[serde(rename = "type")]
18869            r#type: Option<crate::__types::fine_tuning_job_event::Type>,
18870            #[serde(rename = "data")]
18871            data: Option<indexmap::IndexMap<String, serde_json::Value>>,
18872        }
18873        let FineTuningJobEvent {
18874            id,
18875            created_at,
18876            level,
18877            message,
18878            r#type,
18879            data,
18880            ..
18881        } = FineTuningJobEvent::deserialize(deserializer)?;
18882        Ok(Self {
18883            id,
18884            created_at,
18885            level,
18886            message,
18887            r#type,
18888            data,
18889        })
18890    }
18891}
18892impl serde::Serialize for FineTuningJobEvent {
18893    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
18894    where
18895        S: serde::Serializer,
18896    {
18897        #[serde_with::serde_as]
18898        #[derive(serde :: Serialize)]
18899        struct FineTuningJobEvent<'a> {
18900            #[serde(rename = "object")]
18901            object: &'a crate::__types::fine_tuning_job_event::Object,
18902            #[serde(rename = "id")]
18903            id: &'a String,
18904            #[serde(rename = "created_at")]
18905            created_at: &'a i64,
18906            #[serde(rename = "level")]
18907            level: &'a crate::__types::fine_tuning_job_event::Level,
18908            #[serde(rename = "message")]
18909            message: &'a String,
18910            #[serde(rename = "type")]
18911            #[serde(skip_serializing_if = "Option::is_none")]
18912            r#type: &'a Option<crate::__types::fine_tuning_job_event::Type>,
18913            #[serde(rename = "data")]
18914            #[serde(skip_serializing_if = "Option::is_none")]
18915            data: &'a Option<indexmap::IndexMap<String, serde_json::Value>>,
18916        }
18917        let Self {
18918            id,
18919            created_at,
18920            level,
18921            message,
18922            r#type,
18923            data,
18924        } = self;
18925        FineTuningJobEvent {
18926            object: &Default::default(),
18927            id,
18928            created_at,
18929            level,
18930            message,
18931            r#type,
18932            data,
18933        }
18934        .serialize(serializer)
18935    }
18936}
18937#[derive(Clone, Debug, PartialEq)]
18938#[serde_with::serde_as]
18939#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
18940pub struct FunctionObject {
18941    #[doc = "A description of what the function does, used by the model to choose when and how to call the function."]
18942    #[serde(rename = "description")]
18943    #[serde(skip_serializing_if = "Option::is_none")]
18944    #[builder(default)]
18945    pub description: Option<String>,
18946    #[doc = "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."]
18947    #[serde(rename = "name")]
18948    pub name: String,
18949    #[serde(rename = "parameters")]
18950    #[serde(skip_serializing_if = "Option::is_none")]
18951    #[builder(default)]
18952    pub parameters: Option<crate::__types::FunctionParameters>,
18953    #[doc = "Whether to enable strict schema adherence when generating the function call. If set to true, the model will follow the exact schema defined in the `parameters` field. Only a subset of JSON Schema is supported when `strict` is `true`. Learn more about Structured Outputs in the [function calling guide](https://platform.openai.com/docs/guides/function-calling)."]
18954    #[serde(rename = "strict")]
18955    #[serde(skip_serializing_if = "Option::is_none")]
18956    #[builder(default)]
18957    pub strict: Option<bool>,
18958}
18959#[doc = "The parameters the functions accepts, described as a JSON Schema object. See the [guide](https://platform.openai.com/docs/guides/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format. \n\nOmitting `parameters` defines a function with an empty parameter list."]
18960pub type FunctionParameters = indexmap::IndexMap<String, serde_json::Value>;
18961#[allow(clippy::module_inception)]
18962pub mod function_tool_call {
18963    #[doc = "The type of the function tool call. Always `function_call`.\n"]
18964    #[derive(Clone, Copy, Debug, Default, PartialEq)]
18965    pub(crate) struct Type;
18966    impl_serde!(Type, "function_call");
18967    #[doc = "The status of the item. One of `in_progress`, `completed`, or\n`incomplete`. Populated when items are returned via API.\n"]
18968    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
18969    pub enum Status {
18970        #[doc = "`in_progress`"]
18971        #[serde(rename = "in_progress")]
18972        InProgress,
18973        #[doc = "`completed`"]
18974        #[serde(rename = "completed")]
18975        Completed,
18976        #[doc = "`incomplete`"]
18977        #[serde(rename = "incomplete")]
18978        Incomplete,
18979    }
18980}
18981#[doc = "A tool call to run a function. See the \n[function calling guide](https://platform.openai.com/docs/guides/function-calling) for more information.\n"]
18982#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
18983pub struct FunctionToolCall {
18984    #[doc = "The unique ID of the function tool call.\n"]
18985    #[builder(default)]
18986    pub id: Option<String>,
18987    #[doc = "The unique ID of the function tool call generated by the model.\n"]
18988    pub call_id: String,
18989    #[doc = "The name of the function to run.\n"]
18990    pub name: String,
18991    #[doc = "A JSON string of the arguments to pass to the function.\n"]
18992    pub arguments: String,
18993    #[doc = "The status of the item. One of `in_progress`, `completed`, or\n`incomplete`. Populated when items are returned via API.\n"]
18994    #[builder(default)]
18995    pub status: Option<crate::__types::function_tool_call::Status>,
18996}
18997impl<'de> serde::Deserialize<'de> for FunctionToolCall {
18998    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
18999    where
19000        D: serde::Deserializer<'de>,
19001    {
19002        #[serde_with::serde_as]
19003        #[derive(serde :: Deserialize)]
19004        struct FunctionToolCall {
19005            #[serde(rename = "id")]
19006            id: Option<String>,
19007            #[serde(rename = "type")]
19008            #[allow(dead_code)]
19009            r#type: crate::__types::function_tool_call::Type,
19010            #[serde(rename = "call_id")]
19011            call_id: String,
19012            #[serde(rename = "name")]
19013            name: String,
19014            #[serde(rename = "arguments")]
19015            arguments: String,
19016            #[serde(rename = "status")]
19017            status: Option<crate::__types::function_tool_call::Status>,
19018        }
19019        let FunctionToolCall {
19020            id,
19021            call_id,
19022            name,
19023            arguments,
19024            status,
19025            ..
19026        } = FunctionToolCall::deserialize(deserializer)?;
19027        Ok(Self {
19028            id,
19029            call_id,
19030            name,
19031            arguments,
19032            status,
19033        })
19034    }
19035}
19036impl serde::Serialize for FunctionToolCall {
19037    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
19038    where
19039        S: serde::Serializer,
19040    {
19041        #[serde_with::serde_as]
19042        #[derive(serde :: Serialize)]
19043        struct FunctionToolCall<'a> {
19044            #[serde(rename = "id")]
19045            #[serde(skip_serializing_if = "Option::is_none")]
19046            id: &'a Option<String>,
19047            #[serde(rename = "type")]
19048            r#type: &'a crate::__types::function_tool_call::Type,
19049            #[serde(rename = "call_id")]
19050            call_id: &'a String,
19051            #[serde(rename = "name")]
19052            name: &'a String,
19053            #[serde(rename = "arguments")]
19054            arguments: &'a String,
19055            #[serde(rename = "status")]
19056            #[serde(skip_serializing_if = "Option::is_none")]
19057            status: &'a Option<crate::__types::function_tool_call::Status>,
19058        }
19059        let Self {
19060            id,
19061            call_id,
19062            name,
19063            arguments,
19064            status,
19065        } = self;
19066        FunctionToolCall {
19067            id,
19068            r#type: &Default::default(),
19069            call_id,
19070            name,
19071            arguments,
19072            status,
19073        }
19074        .serialize(serializer)
19075    }
19076}
19077#[allow(clippy::module_inception)]
19078pub mod function_tool_call_output {
19079    #[doc = "The type of the function tool call output. Always `function_call_output`.\n"]
19080    #[derive(Clone, Copy, Debug, Default, PartialEq)]
19081    pub(crate) struct Type;
19082    impl_serde!(Type, "function_call_output");
19083    #[doc = "The status of the item. One of `in_progress`, `completed`, or\n`incomplete`. Populated when items are returned via API.\n"]
19084    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
19085    pub enum Status {
19086        #[doc = "`in_progress`"]
19087        #[serde(rename = "in_progress")]
19088        InProgress,
19089        #[doc = "`completed`"]
19090        #[serde(rename = "completed")]
19091        Completed,
19092        #[doc = "`incomplete`"]
19093        #[serde(rename = "incomplete")]
19094        Incomplete,
19095    }
19096}
19097#[doc = "The output of a function tool call.\n"]
19098#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
19099pub struct FunctionToolCallOutput {
19100    #[doc = "The unique ID of the function tool call output. Populated when this item\nis returned via API.\n"]
19101    #[builder(default)]
19102    pub id: Option<String>,
19103    #[doc = "The unique ID of the function tool call generated by the model.\n"]
19104    pub call_id: String,
19105    #[doc = "A JSON string of the output of the function tool call.\n"]
19106    pub output: String,
19107    #[doc = "The status of the item. One of `in_progress`, `completed`, or\n`incomplete`. Populated when items are returned via API.\n"]
19108    #[builder(default)]
19109    pub status: Option<crate::__types::function_tool_call_output::Status>,
19110}
19111impl<'de> serde::Deserialize<'de> for FunctionToolCallOutput {
19112    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
19113    where
19114        D: serde::Deserializer<'de>,
19115    {
19116        #[serde_with::serde_as]
19117        #[derive(serde :: Deserialize)]
19118        struct FunctionToolCallOutput {
19119            #[serde(rename = "id")]
19120            id: Option<String>,
19121            #[serde(rename = "type")]
19122            #[allow(dead_code)]
19123            r#type: crate::__types::function_tool_call_output::Type,
19124            #[serde(rename = "call_id")]
19125            call_id: String,
19126            #[serde(rename = "output")]
19127            output: String,
19128            #[serde(rename = "status")]
19129            status: Option<crate::__types::function_tool_call_output::Status>,
19130        }
19131        let FunctionToolCallOutput {
19132            id,
19133            call_id,
19134            output,
19135            status,
19136            ..
19137        } = FunctionToolCallOutput::deserialize(deserializer)?;
19138        Ok(Self {
19139            id,
19140            call_id,
19141            output,
19142            status,
19143        })
19144    }
19145}
19146impl serde::Serialize for FunctionToolCallOutput {
19147    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
19148    where
19149        S: serde::Serializer,
19150    {
19151        #[serde_with::serde_as]
19152        #[derive(serde :: Serialize)]
19153        struct FunctionToolCallOutput<'a> {
19154            #[serde(rename = "id")]
19155            #[serde(skip_serializing_if = "Option::is_none")]
19156            id: &'a Option<String>,
19157            #[serde(rename = "type")]
19158            r#type: &'a crate::__types::function_tool_call_output::Type,
19159            #[serde(rename = "call_id")]
19160            call_id: &'a String,
19161            #[serde(rename = "output")]
19162            output: &'a String,
19163            #[serde(rename = "status")]
19164            #[serde(skip_serializing_if = "Option::is_none")]
19165            status: &'a Option<crate::__types::function_tool_call_output::Status>,
19166        }
19167        let Self {
19168            id,
19169            call_id,
19170            output,
19171            status,
19172        } = self;
19173        FunctionToolCallOutput {
19174            id,
19175            r#type: &Default::default(),
19176            call_id,
19177            output,
19178            status,
19179        }
19180        .serialize(serializer)
19181    }
19182}
19183#[allow(clippy::module_inception)]
19184pub mod function_tool_call_output_resource {
19185    #[doc = "The type of the function tool call output. Always `function_call_output`.\n"]
19186    #[derive(Clone, Copy, Debug, Default, PartialEq)]
19187    pub(crate) struct Type;
19188    impl_serde!(Type, "function_call_output");
19189    #[doc = "The status of the item. One of `in_progress`, `completed`, or\n`incomplete`. Populated when items are returned via API.\n"]
19190    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
19191    pub enum Status {
19192        #[doc = "`in_progress`"]
19193        #[serde(rename = "in_progress")]
19194        InProgress,
19195        #[doc = "`completed`"]
19196        #[serde(rename = "completed")]
19197        Completed,
19198        #[doc = "`incomplete`"]
19199        #[serde(rename = "incomplete")]
19200        Incomplete,
19201    }
19202}
19203#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
19204pub struct FunctionToolCallOutputResource {
19205    #[doc = "The unique ID of the function tool call output. Populated when this item\nis returned via API.\n"]
19206    pub id: String,
19207    #[doc = "The unique ID of the function tool call generated by the model.\n"]
19208    pub call_id: String,
19209    #[doc = "A JSON string of the output of the function tool call.\n"]
19210    pub output: String,
19211    #[doc = "The status of the item. One of `in_progress`, `completed`, or\n`incomplete`. Populated when items are returned via API.\n"]
19212    #[builder(default)]
19213    pub status: Option<crate::__types::function_tool_call_output_resource::Status>,
19214}
19215impl<'de> serde::Deserialize<'de> for FunctionToolCallOutputResource {
19216    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
19217    where
19218        D: serde::Deserializer<'de>,
19219    {
19220        #[serde_with::serde_as]
19221        #[derive(serde :: Deserialize)]
19222        struct FunctionToolCallOutputResource {
19223            #[serde(rename = "id")]
19224            id: String,
19225            #[serde(rename = "type")]
19226            #[allow(dead_code)]
19227            r#type: crate::__types::function_tool_call_output_resource::Type,
19228            #[serde(rename = "call_id")]
19229            call_id: String,
19230            #[serde(rename = "output")]
19231            output: String,
19232            #[serde(rename = "status")]
19233            status: Option<crate::__types::function_tool_call_output_resource::Status>,
19234        }
19235        let FunctionToolCallOutputResource {
19236            id,
19237            call_id,
19238            output,
19239            status,
19240            ..
19241        } = FunctionToolCallOutputResource::deserialize(deserializer)?;
19242        Ok(Self {
19243            id,
19244            call_id,
19245            output,
19246            status,
19247        })
19248    }
19249}
19250impl serde::Serialize for FunctionToolCallOutputResource {
19251    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
19252    where
19253        S: serde::Serializer,
19254    {
19255        #[serde_with::serde_as]
19256        #[derive(serde :: Serialize)]
19257        struct FunctionToolCallOutputResource<'a> {
19258            #[serde(rename = "id")]
19259            id: &'a String,
19260            #[serde(rename = "type")]
19261            r#type: &'a crate::__types::function_tool_call_output_resource::Type,
19262            #[serde(rename = "call_id")]
19263            call_id: &'a String,
19264            #[serde(rename = "output")]
19265            output: &'a String,
19266            #[serde(rename = "status")]
19267            #[serde(skip_serializing_if = "Option::is_none")]
19268            status: &'a Option<crate::__types::function_tool_call_output_resource::Status>,
19269        }
19270        let Self {
19271            id,
19272            call_id,
19273            output,
19274            status,
19275        } = self;
19276        FunctionToolCallOutputResource {
19277            id,
19278            r#type: &Default::default(),
19279            call_id,
19280            output,
19281            status,
19282        }
19283        .serialize(serializer)
19284    }
19285}
19286#[allow(clippy::module_inception)]
19287pub mod function_tool_call_resource {
19288    #[doc = "The type of the function tool call. Always `function_call`.\n"]
19289    #[derive(Clone, Copy, Debug, Default, PartialEq)]
19290    pub(crate) struct Type;
19291    impl_serde!(Type, "function_call");
19292    #[doc = "The status of the item. One of `in_progress`, `completed`, or\n`incomplete`. Populated when items are returned via API.\n"]
19293    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
19294    pub enum Status {
19295        #[doc = "`in_progress`"]
19296        #[serde(rename = "in_progress")]
19297        InProgress,
19298        #[doc = "`completed`"]
19299        #[serde(rename = "completed")]
19300        Completed,
19301        #[doc = "`incomplete`"]
19302        #[serde(rename = "incomplete")]
19303        Incomplete,
19304    }
19305}
19306#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
19307pub struct FunctionToolCallResource {
19308    #[doc = "The unique ID of the function tool call.\n"]
19309    pub id: String,
19310    #[doc = "The unique ID of the function tool call generated by the model.\n"]
19311    pub call_id: String,
19312    #[doc = "The name of the function to run.\n"]
19313    pub name: String,
19314    #[doc = "A JSON string of the arguments to pass to the function.\n"]
19315    pub arguments: String,
19316    #[doc = "The status of the item. One of `in_progress`, `completed`, or\n`incomplete`. Populated when items are returned via API.\n"]
19317    #[builder(default)]
19318    pub status: Option<crate::__types::function_tool_call_resource::Status>,
19319}
19320impl<'de> serde::Deserialize<'de> for FunctionToolCallResource {
19321    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
19322    where
19323        D: serde::Deserializer<'de>,
19324    {
19325        #[serde_with::serde_as]
19326        #[derive(serde :: Deserialize)]
19327        struct FunctionToolCallResource {
19328            #[serde(rename = "id")]
19329            id: String,
19330            #[serde(rename = "type")]
19331            #[allow(dead_code)]
19332            r#type: crate::__types::function_tool_call_resource::Type,
19333            #[serde(rename = "call_id")]
19334            call_id: String,
19335            #[serde(rename = "name")]
19336            name: String,
19337            #[serde(rename = "arguments")]
19338            arguments: String,
19339            #[serde(rename = "status")]
19340            status: Option<crate::__types::function_tool_call_resource::Status>,
19341        }
19342        let FunctionToolCallResource {
19343            id,
19344            call_id,
19345            name,
19346            arguments,
19347            status,
19348            ..
19349        } = FunctionToolCallResource::deserialize(deserializer)?;
19350        Ok(Self {
19351            id,
19352            call_id,
19353            name,
19354            arguments,
19355            status,
19356        })
19357    }
19358}
19359impl serde::Serialize for FunctionToolCallResource {
19360    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
19361    where
19362        S: serde::Serializer,
19363    {
19364        #[serde_with::serde_as]
19365        #[derive(serde :: Serialize)]
19366        struct FunctionToolCallResource<'a> {
19367            #[serde(rename = "id")]
19368            id: &'a String,
19369            #[serde(rename = "type")]
19370            r#type: &'a crate::__types::function_tool_call_resource::Type,
19371            #[serde(rename = "call_id")]
19372            call_id: &'a String,
19373            #[serde(rename = "name")]
19374            name: &'a String,
19375            #[serde(rename = "arguments")]
19376            arguments: &'a String,
19377            #[serde(rename = "status")]
19378            #[serde(skip_serializing_if = "Option::is_none")]
19379            status: &'a Option<crate::__types::function_tool_call_resource::Status>,
19380        }
19381        let Self {
19382            id,
19383            call_id,
19384            name,
19385            arguments,
19386            status,
19387        } = self;
19388        FunctionToolCallResource {
19389            id,
19390            r#type: &Default::default(),
19391            call_id,
19392            name,
19393            arguments,
19394            status,
19395        }
19396        .serialize(serializer)
19397    }
19398}
19399#[allow(clippy::module_inception)]
19400pub(crate) mod grader_label_model {
19401    #[doc = "The object type, which is always `label_model`."]
19402    #[derive(Clone, Copy, Debug, Default, PartialEq)]
19403    pub(crate) struct Type;
19404    impl_serde!(Type, "label_model");
19405}
19406#[doc = "A LabelModelGrader object which uses a model to assign labels to each item\nin the evaluation.\n"]
19407#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
19408pub struct GraderLabelModel {
19409    #[doc = "The name of the grader."]
19410    pub name: String,
19411    #[doc = "The model to use for the evaluation. Must support structured outputs."]
19412    pub model: String,
19413    pub input: Vec<crate::__types::EvalItem>,
19414    #[doc = "The labels to assign to each item in the evaluation."]
19415    pub labels: Vec<String>,
19416    #[doc = "The labels that indicate a passing result. Must be a subset of labels."]
19417    pub passing_labels: Vec<String>,
19418}
19419impl<'de> serde::Deserialize<'de> for GraderLabelModel {
19420    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
19421    where
19422        D: serde::Deserializer<'de>,
19423    {
19424        #[serde_with::serde_as]
19425        #[derive(serde :: Deserialize)]
19426        struct GraderLabelModel {
19427            #[serde(rename = "type")]
19428            #[allow(dead_code)]
19429            r#type: crate::__types::grader_label_model::Type,
19430            #[serde(rename = "name")]
19431            name: String,
19432            #[serde(rename = "model")]
19433            model: String,
19434            #[serde(rename = "input")]
19435            input: Vec<crate::__types::EvalItem>,
19436            #[serde(rename = "labels")]
19437            labels: Vec<String>,
19438            #[serde(rename = "passing_labels")]
19439            passing_labels: Vec<String>,
19440        }
19441        let GraderLabelModel {
19442            name,
19443            model,
19444            input,
19445            labels,
19446            passing_labels,
19447            ..
19448        } = GraderLabelModel::deserialize(deserializer)?;
19449        Ok(Self {
19450            name,
19451            model,
19452            input,
19453            labels,
19454            passing_labels,
19455        })
19456    }
19457}
19458impl serde::Serialize for GraderLabelModel {
19459    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
19460    where
19461        S: serde::Serializer,
19462    {
19463        #[serde_with::serde_as]
19464        #[derive(serde :: Serialize)]
19465        struct GraderLabelModel<'a> {
19466            #[serde(rename = "type")]
19467            r#type: &'a crate::__types::grader_label_model::Type,
19468            #[serde(rename = "name")]
19469            name: &'a String,
19470            #[serde(rename = "model")]
19471            model: &'a String,
19472            #[serde(rename = "input")]
19473            input: &'a Vec<crate::__types::EvalItem>,
19474            #[serde(rename = "labels")]
19475            labels: &'a Vec<String>,
19476            #[serde(rename = "passing_labels")]
19477            passing_labels: &'a Vec<String>,
19478        }
19479        let Self {
19480            name,
19481            model,
19482            input,
19483            labels,
19484            passing_labels,
19485        } = self;
19486        GraderLabelModel {
19487            r#type: &Default::default(),
19488            name,
19489            model,
19490            input,
19491            labels,
19492            passing_labels,
19493        }
19494        .serialize(serializer)
19495    }
19496}
19497#[allow(clippy::module_inception)]
19498pub mod grader_multi {
19499    #[doc = "The object type, which is always `multi`."]
19500    #[derive(Clone, Copy, Debug, Default, PartialEq)]
19501    pub(crate) struct Type;
19502    impl_serde!(Type, "multi");
19503    #[derive(Clone, Debug, PartialEq)]
19504    #[serde_with::serde_as]
19505    #[derive(serde :: Deserialize, serde :: Serialize)]
19506    #[serde(untagged)]
19507    #[allow(clippy::large_enum_variant)]
19508    pub enum Graders {
19509        StringCheck(crate::__types::GraderStringCheck),
19510        TextSimilarity(crate::__types::GraderTextSimilarity),
19511        Python(crate::__types::GraderPython),
19512        ScoreModel(crate::__types::GraderScoreModel),
19513        LabelModel(crate::__types::GraderLabelModel),
19514    }
19515}
19516#[doc = "A MultiGrader object combines the output of multiple graders to produce a single score."]
19517#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
19518pub struct GraderMulti {
19519    #[doc = "The name of the grader."]
19520    pub name: String,
19521    pub graders: crate::__types::grader_multi::Graders,
19522    #[doc = "A formula to calculate the output based on grader results."]
19523    pub calculate_output: String,
19524}
19525impl<'de> serde::Deserialize<'de> for GraderMulti {
19526    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
19527    where
19528        D: serde::Deserializer<'de>,
19529    {
19530        #[serde_with::serde_as]
19531        #[derive(serde :: Deserialize)]
19532        struct GraderMulti {
19533            #[serde(rename = "type")]
19534            #[allow(dead_code)]
19535            r#type: crate::__types::grader_multi::Type,
19536            #[serde(rename = "name")]
19537            name: String,
19538            #[serde(rename = "graders")]
19539            graders: crate::__types::grader_multi::Graders,
19540            #[serde(rename = "calculate_output")]
19541            calculate_output: String,
19542        }
19543        let GraderMulti {
19544            name,
19545            graders,
19546            calculate_output,
19547            ..
19548        } = GraderMulti::deserialize(deserializer)?;
19549        Ok(Self {
19550            name,
19551            graders,
19552            calculate_output,
19553        })
19554    }
19555}
19556impl serde::Serialize for GraderMulti {
19557    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
19558    where
19559        S: serde::Serializer,
19560    {
19561        #[serde_with::serde_as]
19562        #[derive(serde :: Serialize)]
19563        struct GraderMulti<'a> {
19564            #[serde(rename = "type")]
19565            r#type: &'a crate::__types::grader_multi::Type,
19566            #[serde(rename = "name")]
19567            name: &'a String,
19568            #[serde(rename = "graders")]
19569            graders: &'a crate::__types::grader_multi::Graders,
19570            #[serde(rename = "calculate_output")]
19571            calculate_output: &'a String,
19572        }
19573        let Self {
19574            name,
19575            graders,
19576            calculate_output,
19577        } = self;
19578        GraderMulti {
19579            r#type: &Default::default(),
19580            name,
19581            graders,
19582            calculate_output,
19583        }
19584        .serialize(serializer)
19585    }
19586}
19587#[allow(clippy::module_inception)]
19588pub(crate) mod grader_python {
19589    #[doc = "The object type, which is always `python`."]
19590    #[derive(Clone, Copy, Debug, Default, PartialEq)]
19591    pub(crate) struct Type;
19592    impl_serde!(Type, "python");
19593}
19594#[doc = "A PythonGrader object that runs a python script on the input.\n"]
19595#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
19596pub struct GraderPython {
19597    #[doc = "The name of the grader."]
19598    pub name: String,
19599    #[doc = "The source code of the python script."]
19600    pub source: String,
19601    #[doc = "The image tag to use for the python script."]
19602    #[builder(default)]
19603    pub image_tag: Option<String>,
19604}
19605impl<'de> serde::Deserialize<'de> for GraderPython {
19606    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
19607    where
19608        D: serde::Deserializer<'de>,
19609    {
19610        #[serde_with::serde_as]
19611        #[derive(serde :: Deserialize)]
19612        struct GraderPython {
19613            #[serde(rename = "type")]
19614            #[allow(dead_code)]
19615            r#type: crate::__types::grader_python::Type,
19616            #[serde(rename = "name")]
19617            name: String,
19618            #[serde(rename = "source")]
19619            source: String,
19620            #[serde(rename = "image_tag")]
19621            image_tag: Option<String>,
19622        }
19623        let GraderPython {
19624            name,
19625            source,
19626            image_tag,
19627            ..
19628        } = GraderPython::deserialize(deserializer)?;
19629        Ok(Self {
19630            name,
19631            source,
19632            image_tag,
19633        })
19634    }
19635}
19636impl serde::Serialize for GraderPython {
19637    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
19638    where
19639        S: serde::Serializer,
19640    {
19641        #[serde_with::serde_as]
19642        #[derive(serde :: Serialize)]
19643        struct GraderPython<'a> {
19644            #[serde(rename = "type")]
19645            r#type: &'a crate::__types::grader_python::Type,
19646            #[serde(rename = "name")]
19647            name: &'a String,
19648            #[serde(rename = "source")]
19649            source: &'a String,
19650            #[serde(rename = "image_tag")]
19651            #[serde(skip_serializing_if = "Option::is_none")]
19652            image_tag: &'a Option<String>,
19653        }
19654        let Self {
19655            name,
19656            source,
19657            image_tag,
19658        } = self;
19659        GraderPython {
19660            r#type: &Default::default(),
19661            name,
19662            source,
19663            image_tag,
19664        }
19665        .serialize(serializer)
19666    }
19667}
19668#[allow(clippy::module_inception)]
19669pub(crate) mod grader_score_model {
19670    #[doc = "The object type, which is always `score_model`."]
19671    #[derive(Clone, Copy, Debug, Default, PartialEq)]
19672    pub(crate) struct Type;
19673    impl_serde!(Type, "score_model");
19674}
19675#[doc = "A ScoreModelGrader object that uses a model to assign a score to the input.\n"]
19676#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
19677pub struct GraderScoreModel {
19678    #[doc = "The name of the grader."]
19679    pub name: String,
19680    #[doc = "The model to use for the evaluation."]
19681    pub model: String,
19682    #[doc = "The sampling parameters for the model."]
19683    #[builder(default)]
19684    pub sampling_params: Option<indexmap::IndexMap<String, serde_json::Value>>,
19685    #[doc = "The input text. This may include template strings."]
19686    pub input: Vec<crate::__types::EvalItem>,
19687    #[doc = "The range of the score. Defaults to `[0, 1]`."]
19688    #[builder(default)]
19689    pub range: Option<Vec<serde_json::Number>>,
19690}
19691impl<'de> serde::Deserialize<'de> for GraderScoreModel {
19692    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
19693    where
19694        D: serde::Deserializer<'de>,
19695    {
19696        #[serde_with::serde_as]
19697        #[derive(serde :: Deserialize)]
19698        struct GraderScoreModel {
19699            #[serde(rename = "type")]
19700            #[allow(dead_code)]
19701            r#type: crate::__types::grader_score_model::Type,
19702            #[serde(rename = "name")]
19703            name: String,
19704            #[serde(rename = "model")]
19705            model: String,
19706            #[serde(rename = "sampling_params")]
19707            sampling_params: Option<indexmap::IndexMap<String, serde_json::Value>>,
19708            #[serde(rename = "input")]
19709            input: Vec<crate::__types::EvalItem>,
19710            #[serde(rename = "range")]
19711            range: Option<Vec<serde_json::Number>>,
19712        }
19713        let GraderScoreModel {
19714            name,
19715            model,
19716            sampling_params,
19717            input,
19718            range,
19719            ..
19720        } = GraderScoreModel::deserialize(deserializer)?;
19721        Ok(Self {
19722            name,
19723            model,
19724            sampling_params,
19725            input,
19726            range,
19727        })
19728    }
19729}
19730impl serde::Serialize for GraderScoreModel {
19731    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
19732    where
19733        S: serde::Serializer,
19734    {
19735        #[serde_with::serde_as]
19736        #[derive(serde :: Serialize)]
19737        struct GraderScoreModel<'a> {
19738            #[serde(rename = "type")]
19739            r#type: &'a crate::__types::grader_score_model::Type,
19740            #[serde(rename = "name")]
19741            name: &'a String,
19742            #[serde(rename = "model")]
19743            model: &'a String,
19744            #[serde(rename = "sampling_params")]
19745            #[serde(skip_serializing_if = "Option::is_none")]
19746            sampling_params: &'a Option<indexmap::IndexMap<String, serde_json::Value>>,
19747            #[serde(rename = "input")]
19748            input: &'a Vec<crate::__types::EvalItem>,
19749            #[serde(rename = "range")]
19750            #[serde(skip_serializing_if = "Option::is_none")]
19751            range: &'a Option<Vec<serde_json::Number>>,
19752        }
19753        let Self {
19754            name,
19755            model,
19756            sampling_params,
19757            input,
19758            range,
19759        } = self;
19760        GraderScoreModel {
19761            r#type: &Default::default(),
19762            name,
19763            model,
19764            sampling_params,
19765            input,
19766            range,
19767        }
19768        .serialize(serializer)
19769    }
19770}
19771#[allow(clippy::module_inception)]
19772pub mod grader_string_check {
19773    #[doc = "The object type, which is always `string_check`."]
19774    #[derive(Clone, Copy, Debug, Default, PartialEq)]
19775    pub(crate) struct Type;
19776    impl_serde!(Type, "string_check");
19777    #[doc = "The string check operation to perform. One of `eq`, `ne`, `like`, or `ilike`."]
19778    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
19779    pub enum Operation {
19780        #[doc = "`eq`"]
19781        #[serde(rename = "eq")]
19782        Eq,
19783        #[doc = "`ne`"]
19784        #[serde(rename = "ne")]
19785        Ne,
19786        #[doc = "`like`"]
19787        #[serde(rename = "like")]
19788        Like,
19789        #[doc = "`ilike`"]
19790        #[serde(rename = "ilike")]
19791        Ilike,
19792    }
19793}
19794#[doc = "A StringCheckGrader object that performs a string comparison between input and reference using a specified operation.\n"]
19795#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
19796pub struct GraderStringCheck {
19797    #[doc = "The name of the grader."]
19798    pub name: String,
19799    #[doc = "The input text. This may include template strings."]
19800    pub input: String,
19801    #[doc = "The reference text. This may include template strings."]
19802    pub reference: String,
19803    #[doc = "The string check operation to perform. One of `eq`, `ne`, `like`, or `ilike`."]
19804    pub operation: crate::__types::grader_string_check::Operation,
19805}
19806impl<'de> serde::Deserialize<'de> for GraderStringCheck {
19807    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
19808    where
19809        D: serde::Deserializer<'de>,
19810    {
19811        #[serde_with::serde_as]
19812        #[derive(serde :: Deserialize)]
19813        struct GraderStringCheck {
19814            #[serde(rename = "type")]
19815            #[allow(dead_code)]
19816            r#type: crate::__types::grader_string_check::Type,
19817            #[serde(rename = "name")]
19818            name: String,
19819            #[serde(rename = "input")]
19820            input: String,
19821            #[serde(rename = "reference")]
19822            reference: String,
19823            #[serde(rename = "operation")]
19824            operation: crate::__types::grader_string_check::Operation,
19825        }
19826        let GraderStringCheck {
19827            name,
19828            input,
19829            reference,
19830            operation,
19831            ..
19832        } = GraderStringCheck::deserialize(deserializer)?;
19833        Ok(Self {
19834            name,
19835            input,
19836            reference,
19837            operation,
19838        })
19839    }
19840}
19841impl serde::Serialize for GraderStringCheck {
19842    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
19843    where
19844        S: serde::Serializer,
19845    {
19846        #[serde_with::serde_as]
19847        #[derive(serde :: Serialize)]
19848        struct GraderStringCheck<'a> {
19849            #[serde(rename = "type")]
19850            r#type: &'a crate::__types::grader_string_check::Type,
19851            #[serde(rename = "name")]
19852            name: &'a String,
19853            #[serde(rename = "input")]
19854            input: &'a String,
19855            #[serde(rename = "reference")]
19856            reference: &'a String,
19857            #[serde(rename = "operation")]
19858            operation: &'a crate::__types::grader_string_check::Operation,
19859        }
19860        let Self {
19861            name,
19862            input,
19863            reference,
19864            operation,
19865        } = self;
19866        GraderStringCheck {
19867            r#type: &Default::default(),
19868            name,
19869            input,
19870            reference,
19871            operation,
19872        }
19873        .serialize(serializer)
19874    }
19875}
19876#[allow(clippy::module_inception)]
19877pub mod grader_text_similarity {
19878    #[doc = "The type of grader."]
19879    #[derive(Clone, Copy, Debug, Default, PartialEq)]
19880    pub(crate) struct Type;
19881    impl_serde!(Type, "text_similarity");
19882    #[doc = "The evaluation metric to use. One of `cosine`, `fuzzy_match`, `bleu`, \n`gleu`, `meteor`, `rouge_1`, `rouge_2`, `rouge_3`, `rouge_4`, `rouge_5`, \nor `rouge_l`.\n"]
19883    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
19884    pub enum EvaluationMetric {
19885        #[doc = "`cosine`"]
19886        #[serde(rename = "cosine")]
19887        Cosine,
19888        #[doc = "`fuzzy_match`"]
19889        #[serde(rename = "fuzzy_match")]
19890        FuzzyMatch,
19891        #[doc = "`bleu`"]
19892        #[serde(rename = "bleu")]
19893        Bleu,
19894        #[doc = "`gleu`"]
19895        #[serde(rename = "gleu")]
19896        Gleu,
19897        #[doc = "`meteor`"]
19898        #[serde(rename = "meteor")]
19899        Meteor,
19900        #[doc = "`rouge_1`"]
19901        #[serde(rename = "rouge_1")]
19902        Rouge1,
19903        #[doc = "`rouge_2`"]
19904        #[serde(rename = "rouge_2")]
19905        Rouge2,
19906        #[doc = "`rouge_3`"]
19907        #[serde(rename = "rouge_3")]
19908        Rouge3,
19909        #[doc = "`rouge_4`"]
19910        #[serde(rename = "rouge_4")]
19911        Rouge4,
19912        #[doc = "`rouge_5`"]
19913        #[serde(rename = "rouge_5")]
19914        Rouge5,
19915        #[doc = "`rouge_l`"]
19916        #[serde(rename = "rouge_l")]
19917        RougeL,
19918    }
19919}
19920#[doc = "A TextSimilarityGrader object which grades text based on similarity metrics.\n"]
19921#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
19922pub struct GraderTextSimilarity {
19923    #[doc = "The name of the grader."]
19924    pub name: String,
19925    #[doc = "The text being graded."]
19926    pub input: String,
19927    #[doc = "The text being graded against."]
19928    pub reference: String,
19929    #[doc = "The evaluation metric to use. One of `cosine`, `fuzzy_match`, `bleu`, \n`gleu`, `meteor`, `rouge_1`, `rouge_2`, `rouge_3`, `rouge_4`, `rouge_5`, \nor `rouge_l`.\n"]
19930    pub evaluation_metric: crate::__types::grader_text_similarity::EvaluationMetric,
19931}
19932impl<'de> serde::Deserialize<'de> for GraderTextSimilarity {
19933    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
19934    where
19935        D: serde::Deserializer<'de>,
19936    {
19937        #[serde_with::serde_as]
19938        #[derive(serde :: Deserialize)]
19939        struct GraderTextSimilarity {
19940            #[serde(rename = "type")]
19941            #[allow(dead_code)]
19942            r#type: crate::__types::grader_text_similarity::Type,
19943            #[serde(rename = "name")]
19944            name: String,
19945            #[serde(rename = "input")]
19946            input: String,
19947            #[serde(rename = "reference")]
19948            reference: String,
19949            #[serde(rename = "evaluation_metric")]
19950            evaluation_metric: crate::__types::grader_text_similarity::EvaluationMetric,
19951        }
19952        let GraderTextSimilarity {
19953            name,
19954            input,
19955            reference,
19956            evaluation_metric,
19957            ..
19958        } = GraderTextSimilarity::deserialize(deserializer)?;
19959        Ok(Self {
19960            name,
19961            input,
19962            reference,
19963            evaluation_metric,
19964        })
19965    }
19966}
19967impl serde::Serialize for GraderTextSimilarity {
19968    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
19969    where
19970        S: serde::Serializer,
19971    {
19972        #[serde_with::serde_as]
19973        #[derive(serde :: Serialize)]
19974        struct GraderTextSimilarity<'a> {
19975            #[serde(rename = "type")]
19976            r#type: &'a crate::__types::grader_text_similarity::Type,
19977            #[serde(rename = "name")]
19978            name: &'a String,
19979            #[serde(rename = "input")]
19980            input: &'a String,
19981            #[serde(rename = "reference")]
19982            reference: &'a String,
19983            #[serde(rename = "evaluation_metric")]
19984            evaluation_metric: &'a crate::__types::grader_text_similarity::EvaluationMetric,
19985        }
19986        let Self {
19987            name,
19988            input,
19989            reference,
19990            evaluation_metric,
19991        } = self;
19992        GraderTextSimilarity {
19993            r#type: &Default::default(),
19994            name,
19995            input,
19996            reference,
19997            evaluation_metric,
19998        }
19999        .serialize(serializer)
20000    }
20001}
20002#[doc = "Represents the content or the URL of an image generated by the OpenAI API."]
20003#[derive(Clone, Debug, Default, PartialEq)]
20004#[serde_with::serde_as]
20005#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
20006pub struct Image {
20007    #[doc = "The base64-encoded JSON of the generated image. Default value for `gpt-image-1`, and only present if `response_format` is set to `b64_json` for `dall-e-2` and `dall-e-3`."]
20008    #[serde(rename = "b64_json")]
20009    #[serde(skip_serializing_if = "Option::is_none")]
20010    #[builder(default)]
20011    pub b64_json: Option<String>,
20012    #[doc = "When using `dall-e-2` or `dall-e-3`, the URL of the generated image if `response_format` is set to `url` (default value). Unsupported for `gpt-image-1`."]
20013    #[serde(rename = "url")]
20014    #[serde(skip_serializing_if = "Option::is_none")]
20015    #[builder(default)]
20016    pub url: Option<String>,
20017    #[doc = "For `dall-e-3` only, the revised prompt that was used to generate the image."]
20018    #[serde(rename = "revised_prompt")]
20019    #[serde(skip_serializing_if = "Option::is_none")]
20020    #[builder(default)]
20021    pub revised_prompt: Option<String>,
20022}
20023#[allow(clippy::module_inception)]
20024pub mod image_edit_completed_event {
20025    #[doc = "The type of the event. Always `image_edit.completed`.\n"]
20026    #[derive(Clone, Copy, Debug, Default, PartialEq)]
20027    pub(crate) struct Type;
20028    impl_serde!(Type, "image_edit.completed");
20029    #[doc = "The size of the edited image.\n"]
20030    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
20031    pub enum Size {
20032        #[doc = "`1024x1024`"]
20033        #[serde(rename = "1024x1024")]
20034        _1024x1024,
20035        #[doc = "`1024x1536`"]
20036        #[serde(rename = "1024x1536")]
20037        _1024x1536,
20038        #[doc = "`1536x1024`"]
20039        #[serde(rename = "1536x1024")]
20040        _1536x1024,
20041        #[doc = "`auto`"]
20042        #[serde(rename = "auto")]
20043        Auto,
20044    }
20045    #[doc = "The quality setting for the edited image.\n"]
20046    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
20047    pub enum Quality {
20048        #[doc = "`low`"]
20049        #[serde(rename = "low")]
20050        Low,
20051        #[doc = "`medium`"]
20052        #[serde(rename = "medium")]
20053        Medium,
20054        #[doc = "`high`"]
20055        #[serde(rename = "high")]
20056        High,
20057        #[doc = "`auto`"]
20058        #[serde(rename = "auto")]
20059        Auto,
20060    }
20061    #[doc = "The background setting for the edited image.\n"]
20062    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
20063    pub enum Background {
20064        #[doc = "`transparent`"]
20065        #[serde(rename = "transparent")]
20066        Transparent,
20067        #[doc = "`opaque`"]
20068        #[serde(rename = "opaque")]
20069        Opaque,
20070        #[doc = "`auto`"]
20071        #[serde(rename = "auto")]
20072        Auto,
20073    }
20074    #[doc = "The output format for the edited image.\n"]
20075    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
20076    pub enum OutputFormat {
20077        #[doc = "`png`"]
20078        #[serde(rename = "png")]
20079        Png,
20080        #[doc = "`webp`"]
20081        #[serde(rename = "webp")]
20082        Webp,
20083        #[doc = "`jpeg`"]
20084        #[serde(rename = "jpeg")]
20085        Jpeg,
20086    }
20087}
20088#[doc = "Emitted when image editing has completed and the final image is available.\n"]
20089#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
20090pub struct ImageEditCompletedEvent {
20091    #[doc = "Base64-encoded final edited image data, suitable for rendering as an image.\n"]
20092    pub b64_json: String,
20093    #[doc = "The Unix timestamp when the event was created.\n"]
20094    pub created_at: i64,
20095    #[doc = "The size of the edited image.\n"]
20096    pub size: crate::__types::image_edit_completed_event::Size,
20097    #[doc = "The quality setting for the edited image.\n"]
20098    pub quality: crate::__types::image_edit_completed_event::Quality,
20099    #[doc = "The background setting for the edited image.\n"]
20100    pub background: crate::__types::image_edit_completed_event::Background,
20101    #[doc = "The output format for the edited image.\n"]
20102    pub output_format: crate::__types::image_edit_completed_event::OutputFormat,
20103    pub usage: crate::__types::ImagesUsage,
20104}
20105impl<'de> serde::Deserialize<'de> for ImageEditCompletedEvent {
20106    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
20107    where
20108        D: serde::Deserializer<'de>,
20109    {
20110        #[serde_with::serde_as]
20111        #[derive(serde :: Deserialize)]
20112        struct ImageEditCompletedEvent {
20113            #[serde(rename = "type")]
20114            #[allow(dead_code)]
20115            r#type: crate::__types::image_edit_completed_event::Type,
20116            #[serde(rename = "b64_json")]
20117            b64_json: String,
20118            #[serde(rename = "created_at")]
20119            created_at: i64,
20120            #[serde(rename = "size")]
20121            size: crate::__types::image_edit_completed_event::Size,
20122            #[serde(rename = "quality")]
20123            quality: crate::__types::image_edit_completed_event::Quality,
20124            #[serde(rename = "background")]
20125            background: crate::__types::image_edit_completed_event::Background,
20126            #[serde(rename = "output_format")]
20127            output_format: crate::__types::image_edit_completed_event::OutputFormat,
20128            #[serde(rename = "usage")]
20129            usage: crate::__types::ImagesUsage,
20130        }
20131        let ImageEditCompletedEvent {
20132            b64_json,
20133            created_at,
20134            size,
20135            quality,
20136            background,
20137            output_format,
20138            usage,
20139            ..
20140        } = ImageEditCompletedEvent::deserialize(deserializer)?;
20141        Ok(Self {
20142            b64_json,
20143            created_at,
20144            size,
20145            quality,
20146            background,
20147            output_format,
20148            usage,
20149        })
20150    }
20151}
20152impl serde::Serialize for ImageEditCompletedEvent {
20153    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
20154    where
20155        S: serde::Serializer,
20156    {
20157        #[serde_with::serde_as]
20158        #[derive(serde :: Serialize)]
20159        struct ImageEditCompletedEvent<'a> {
20160            #[serde(rename = "type")]
20161            r#type: &'a crate::__types::image_edit_completed_event::Type,
20162            #[serde(rename = "b64_json")]
20163            b64_json: &'a String,
20164            #[serde(rename = "created_at")]
20165            created_at: &'a i64,
20166            #[serde(rename = "size")]
20167            size: &'a crate::__types::image_edit_completed_event::Size,
20168            #[serde(rename = "quality")]
20169            quality: &'a crate::__types::image_edit_completed_event::Quality,
20170            #[serde(rename = "background")]
20171            background: &'a crate::__types::image_edit_completed_event::Background,
20172            #[serde(rename = "output_format")]
20173            output_format: &'a crate::__types::image_edit_completed_event::OutputFormat,
20174            #[serde(rename = "usage")]
20175            usage: &'a crate::__types::ImagesUsage,
20176        }
20177        let Self {
20178            b64_json,
20179            created_at,
20180            size,
20181            quality,
20182            background,
20183            output_format,
20184            usage,
20185        } = self;
20186        ImageEditCompletedEvent {
20187            r#type: &Default::default(),
20188            b64_json,
20189            created_at,
20190            size,
20191            quality,
20192            background,
20193            output_format,
20194            usage,
20195        }
20196        .serialize(serializer)
20197    }
20198}
20199#[allow(clippy::module_inception)]
20200pub mod image_edit_partial_image_event {
20201    #[doc = "The type of the event. Always `image_edit.partial_image`.\n"]
20202    #[derive(Clone, Copy, Debug, Default, PartialEq)]
20203    pub(crate) struct Type;
20204    impl_serde!(Type, "image_edit.partial_image");
20205    #[doc = "The size of the requested edited image.\n"]
20206    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
20207    pub enum Size {
20208        #[doc = "`1024x1024`"]
20209        #[serde(rename = "1024x1024")]
20210        _1024x1024,
20211        #[doc = "`1024x1536`"]
20212        #[serde(rename = "1024x1536")]
20213        _1024x1536,
20214        #[doc = "`1536x1024`"]
20215        #[serde(rename = "1536x1024")]
20216        _1536x1024,
20217        #[doc = "`auto`"]
20218        #[serde(rename = "auto")]
20219        Auto,
20220    }
20221    #[doc = "The quality setting for the requested edited image.\n"]
20222    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
20223    pub enum Quality {
20224        #[doc = "`low`"]
20225        #[serde(rename = "low")]
20226        Low,
20227        #[doc = "`medium`"]
20228        #[serde(rename = "medium")]
20229        Medium,
20230        #[doc = "`high`"]
20231        #[serde(rename = "high")]
20232        High,
20233        #[doc = "`auto`"]
20234        #[serde(rename = "auto")]
20235        Auto,
20236    }
20237    #[doc = "The background setting for the requested edited image.\n"]
20238    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
20239    pub enum Background {
20240        #[doc = "`transparent`"]
20241        #[serde(rename = "transparent")]
20242        Transparent,
20243        #[doc = "`opaque`"]
20244        #[serde(rename = "opaque")]
20245        Opaque,
20246        #[doc = "`auto`"]
20247        #[serde(rename = "auto")]
20248        Auto,
20249    }
20250    #[doc = "The output format for the requested edited image.\n"]
20251    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
20252    pub enum OutputFormat {
20253        #[doc = "`png`"]
20254        #[serde(rename = "png")]
20255        Png,
20256        #[doc = "`webp`"]
20257        #[serde(rename = "webp")]
20258        Webp,
20259        #[doc = "`jpeg`"]
20260        #[serde(rename = "jpeg")]
20261        Jpeg,
20262    }
20263}
20264#[doc = "Emitted when a partial image is available during image editing streaming.\n"]
20265#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
20266pub struct ImageEditPartialImageEvent {
20267    #[doc = "Base64-encoded partial image data, suitable for rendering as an image.\n"]
20268    pub b64_json: String,
20269    #[doc = "The Unix timestamp when the event was created.\n"]
20270    pub created_at: i64,
20271    #[doc = "The size of the requested edited image.\n"]
20272    pub size: crate::__types::image_edit_partial_image_event::Size,
20273    #[doc = "The quality setting for the requested edited image.\n"]
20274    pub quality: crate::__types::image_edit_partial_image_event::Quality,
20275    #[doc = "The background setting for the requested edited image.\n"]
20276    pub background: crate::__types::image_edit_partial_image_event::Background,
20277    #[doc = "The output format for the requested edited image.\n"]
20278    pub output_format: crate::__types::image_edit_partial_image_event::OutputFormat,
20279    #[doc = "0-based index for the partial image (streaming).\n"]
20280    pub partial_image_index: i64,
20281}
20282impl<'de> serde::Deserialize<'de> for ImageEditPartialImageEvent {
20283    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
20284    where
20285        D: serde::Deserializer<'de>,
20286    {
20287        #[serde_with::serde_as]
20288        #[derive(serde :: Deserialize)]
20289        struct ImageEditPartialImageEvent {
20290            #[serde(rename = "type")]
20291            #[allow(dead_code)]
20292            r#type: crate::__types::image_edit_partial_image_event::Type,
20293            #[serde(rename = "b64_json")]
20294            b64_json: String,
20295            #[serde(rename = "created_at")]
20296            created_at: i64,
20297            #[serde(rename = "size")]
20298            size: crate::__types::image_edit_partial_image_event::Size,
20299            #[serde(rename = "quality")]
20300            quality: crate::__types::image_edit_partial_image_event::Quality,
20301            #[serde(rename = "background")]
20302            background: crate::__types::image_edit_partial_image_event::Background,
20303            #[serde(rename = "output_format")]
20304            output_format: crate::__types::image_edit_partial_image_event::OutputFormat,
20305            #[serde(rename = "partial_image_index")]
20306            partial_image_index: i64,
20307        }
20308        let ImageEditPartialImageEvent {
20309            b64_json,
20310            created_at,
20311            size,
20312            quality,
20313            background,
20314            output_format,
20315            partial_image_index,
20316            ..
20317        } = ImageEditPartialImageEvent::deserialize(deserializer)?;
20318        Ok(Self {
20319            b64_json,
20320            created_at,
20321            size,
20322            quality,
20323            background,
20324            output_format,
20325            partial_image_index,
20326        })
20327    }
20328}
20329impl serde::Serialize for ImageEditPartialImageEvent {
20330    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
20331    where
20332        S: serde::Serializer,
20333    {
20334        #[serde_with::serde_as]
20335        #[derive(serde :: Serialize)]
20336        struct ImageEditPartialImageEvent<'a> {
20337            #[serde(rename = "type")]
20338            r#type: &'a crate::__types::image_edit_partial_image_event::Type,
20339            #[serde(rename = "b64_json")]
20340            b64_json: &'a String,
20341            #[serde(rename = "created_at")]
20342            created_at: &'a i64,
20343            #[serde(rename = "size")]
20344            size: &'a crate::__types::image_edit_partial_image_event::Size,
20345            #[serde(rename = "quality")]
20346            quality: &'a crate::__types::image_edit_partial_image_event::Quality,
20347            #[serde(rename = "background")]
20348            background: &'a crate::__types::image_edit_partial_image_event::Background,
20349            #[serde(rename = "output_format")]
20350            output_format: &'a crate::__types::image_edit_partial_image_event::OutputFormat,
20351            #[serde(rename = "partial_image_index")]
20352            partial_image_index: &'a i64,
20353        }
20354        let Self {
20355            b64_json,
20356            created_at,
20357            size,
20358            quality,
20359            background,
20360            output_format,
20361            partial_image_index,
20362        } = self;
20363        ImageEditPartialImageEvent {
20364            r#type: &Default::default(),
20365            b64_json,
20366            created_at,
20367            size,
20368            quality,
20369            background,
20370            output_format,
20371            partial_image_index,
20372        }
20373        .serialize(serializer)
20374    }
20375}
20376#[derive(Clone, Debug, PartialEq)]
20377#[serde_with::serde_as]
20378#[derive(serde :: Deserialize, serde :: Serialize)]
20379#[serde(untagged)]
20380#[allow(clippy::large_enum_variant)]
20381pub enum ImageEditStreamEvent {
20382    ImageEditPartialImage(crate::__types::ImageEditPartialImageEvent),
20383    ImageEditCompleted(crate::__types::ImageEditCompletedEvent),
20384}
20385#[allow(clippy::module_inception)]
20386pub mod image_gen_completed_event {
20387    #[doc = "The type of the event. Always `image_generation.completed`.\n"]
20388    #[derive(Clone, Copy, Debug, Default, PartialEq)]
20389    pub(crate) struct Type;
20390    impl_serde!(Type, "image_generation.completed");
20391    #[doc = "The size of the generated image.\n"]
20392    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
20393    pub enum Size {
20394        #[doc = "`1024x1024`"]
20395        #[serde(rename = "1024x1024")]
20396        _1024x1024,
20397        #[doc = "`1024x1536`"]
20398        #[serde(rename = "1024x1536")]
20399        _1024x1536,
20400        #[doc = "`1536x1024`"]
20401        #[serde(rename = "1536x1024")]
20402        _1536x1024,
20403        #[doc = "`auto`"]
20404        #[serde(rename = "auto")]
20405        Auto,
20406    }
20407    #[doc = "The quality setting for the generated image.\n"]
20408    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
20409    pub enum Quality {
20410        #[doc = "`low`"]
20411        #[serde(rename = "low")]
20412        Low,
20413        #[doc = "`medium`"]
20414        #[serde(rename = "medium")]
20415        Medium,
20416        #[doc = "`high`"]
20417        #[serde(rename = "high")]
20418        High,
20419        #[doc = "`auto`"]
20420        #[serde(rename = "auto")]
20421        Auto,
20422    }
20423    #[doc = "The background setting for the generated image.\n"]
20424    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
20425    pub enum Background {
20426        #[doc = "`transparent`"]
20427        #[serde(rename = "transparent")]
20428        Transparent,
20429        #[doc = "`opaque`"]
20430        #[serde(rename = "opaque")]
20431        Opaque,
20432        #[doc = "`auto`"]
20433        #[serde(rename = "auto")]
20434        Auto,
20435    }
20436    #[doc = "The output format for the generated image.\n"]
20437    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
20438    pub enum OutputFormat {
20439        #[doc = "`png`"]
20440        #[serde(rename = "png")]
20441        Png,
20442        #[doc = "`webp`"]
20443        #[serde(rename = "webp")]
20444        Webp,
20445        #[doc = "`jpeg`"]
20446        #[serde(rename = "jpeg")]
20447        Jpeg,
20448    }
20449}
20450#[doc = "Emitted when image generation has completed and the final image is available.\n"]
20451#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
20452pub struct ImageGenCompletedEvent {
20453    #[doc = "Base64-encoded image data, suitable for rendering as an image.\n"]
20454    pub b64_json: String,
20455    #[doc = "The Unix timestamp when the event was created.\n"]
20456    pub created_at: i64,
20457    #[doc = "The size of the generated image.\n"]
20458    pub size: crate::__types::image_gen_completed_event::Size,
20459    #[doc = "The quality setting for the generated image.\n"]
20460    pub quality: crate::__types::image_gen_completed_event::Quality,
20461    #[doc = "The background setting for the generated image.\n"]
20462    pub background: crate::__types::image_gen_completed_event::Background,
20463    #[doc = "The output format for the generated image.\n"]
20464    pub output_format: crate::__types::image_gen_completed_event::OutputFormat,
20465    pub usage: crate::__types::ImagesUsage,
20466}
20467impl<'de> serde::Deserialize<'de> for ImageGenCompletedEvent {
20468    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
20469    where
20470        D: serde::Deserializer<'de>,
20471    {
20472        #[serde_with::serde_as]
20473        #[derive(serde :: Deserialize)]
20474        struct ImageGenCompletedEvent {
20475            #[serde(rename = "type")]
20476            #[allow(dead_code)]
20477            r#type: crate::__types::image_gen_completed_event::Type,
20478            #[serde(rename = "b64_json")]
20479            b64_json: String,
20480            #[serde(rename = "created_at")]
20481            created_at: i64,
20482            #[serde(rename = "size")]
20483            size: crate::__types::image_gen_completed_event::Size,
20484            #[serde(rename = "quality")]
20485            quality: crate::__types::image_gen_completed_event::Quality,
20486            #[serde(rename = "background")]
20487            background: crate::__types::image_gen_completed_event::Background,
20488            #[serde(rename = "output_format")]
20489            output_format: crate::__types::image_gen_completed_event::OutputFormat,
20490            #[serde(rename = "usage")]
20491            usage: crate::__types::ImagesUsage,
20492        }
20493        let ImageGenCompletedEvent {
20494            b64_json,
20495            created_at,
20496            size,
20497            quality,
20498            background,
20499            output_format,
20500            usage,
20501            ..
20502        } = ImageGenCompletedEvent::deserialize(deserializer)?;
20503        Ok(Self {
20504            b64_json,
20505            created_at,
20506            size,
20507            quality,
20508            background,
20509            output_format,
20510            usage,
20511        })
20512    }
20513}
20514impl serde::Serialize for ImageGenCompletedEvent {
20515    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
20516    where
20517        S: serde::Serializer,
20518    {
20519        #[serde_with::serde_as]
20520        #[derive(serde :: Serialize)]
20521        struct ImageGenCompletedEvent<'a> {
20522            #[serde(rename = "type")]
20523            r#type: &'a crate::__types::image_gen_completed_event::Type,
20524            #[serde(rename = "b64_json")]
20525            b64_json: &'a String,
20526            #[serde(rename = "created_at")]
20527            created_at: &'a i64,
20528            #[serde(rename = "size")]
20529            size: &'a crate::__types::image_gen_completed_event::Size,
20530            #[serde(rename = "quality")]
20531            quality: &'a crate::__types::image_gen_completed_event::Quality,
20532            #[serde(rename = "background")]
20533            background: &'a crate::__types::image_gen_completed_event::Background,
20534            #[serde(rename = "output_format")]
20535            output_format: &'a crate::__types::image_gen_completed_event::OutputFormat,
20536            #[serde(rename = "usage")]
20537            usage: &'a crate::__types::ImagesUsage,
20538        }
20539        let Self {
20540            b64_json,
20541            created_at,
20542            size,
20543            quality,
20544            background,
20545            output_format,
20546            usage,
20547        } = self;
20548        ImageGenCompletedEvent {
20549            r#type: &Default::default(),
20550            b64_json,
20551            created_at,
20552            size,
20553            quality,
20554            background,
20555            output_format,
20556            usage,
20557        }
20558        .serialize(serializer)
20559    }
20560}
20561#[allow(clippy::module_inception)]
20562pub mod image_gen_partial_image_event {
20563    #[doc = "The type of the event. Always `image_generation.partial_image`.\n"]
20564    #[derive(Clone, Copy, Debug, Default, PartialEq)]
20565    pub(crate) struct Type;
20566    impl_serde!(Type, "image_generation.partial_image");
20567    #[doc = "The size of the requested image.\n"]
20568    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
20569    pub enum Size {
20570        #[doc = "`1024x1024`"]
20571        #[serde(rename = "1024x1024")]
20572        _1024x1024,
20573        #[doc = "`1024x1536`"]
20574        #[serde(rename = "1024x1536")]
20575        _1024x1536,
20576        #[doc = "`1536x1024`"]
20577        #[serde(rename = "1536x1024")]
20578        _1536x1024,
20579        #[doc = "`auto`"]
20580        #[serde(rename = "auto")]
20581        Auto,
20582    }
20583    #[doc = "The quality setting for the requested image.\n"]
20584    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
20585    pub enum Quality {
20586        #[doc = "`low`"]
20587        #[serde(rename = "low")]
20588        Low,
20589        #[doc = "`medium`"]
20590        #[serde(rename = "medium")]
20591        Medium,
20592        #[doc = "`high`"]
20593        #[serde(rename = "high")]
20594        High,
20595        #[doc = "`auto`"]
20596        #[serde(rename = "auto")]
20597        Auto,
20598    }
20599    #[doc = "The background setting for the requested image.\n"]
20600    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
20601    pub enum Background {
20602        #[doc = "`transparent`"]
20603        #[serde(rename = "transparent")]
20604        Transparent,
20605        #[doc = "`opaque`"]
20606        #[serde(rename = "opaque")]
20607        Opaque,
20608        #[doc = "`auto`"]
20609        #[serde(rename = "auto")]
20610        Auto,
20611    }
20612    #[doc = "The output format for the requested image.\n"]
20613    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
20614    pub enum OutputFormat {
20615        #[doc = "`png`"]
20616        #[serde(rename = "png")]
20617        Png,
20618        #[doc = "`webp`"]
20619        #[serde(rename = "webp")]
20620        Webp,
20621        #[doc = "`jpeg`"]
20622        #[serde(rename = "jpeg")]
20623        Jpeg,
20624    }
20625}
20626#[doc = "Emitted when a partial image is available during image generation streaming.\n"]
20627#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
20628pub struct ImageGenPartialImageEvent {
20629    #[doc = "Base64-encoded partial image data, suitable for rendering as an image.\n"]
20630    pub b64_json: String,
20631    #[doc = "The Unix timestamp when the event was created.\n"]
20632    pub created_at: i64,
20633    #[doc = "The size of the requested image.\n"]
20634    pub size: crate::__types::image_gen_partial_image_event::Size,
20635    #[doc = "The quality setting for the requested image.\n"]
20636    pub quality: crate::__types::image_gen_partial_image_event::Quality,
20637    #[doc = "The background setting for the requested image.\n"]
20638    pub background: crate::__types::image_gen_partial_image_event::Background,
20639    #[doc = "The output format for the requested image.\n"]
20640    pub output_format: crate::__types::image_gen_partial_image_event::OutputFormat,
20641    #[doc = "0-based index for the partial image (streaming).\n"]
20642    pub partial_image_index: i64,
20643}
20644impl<'de> serde::Deserialize<'de> for ImageGenPartialImageEvent {
20645    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
20646    where
20647        D: serde::Deserializer<'de>,
20648    {
20649        #[serde_with::serde_as]
20650        #[derive(serde :: Deserialize)]
20651        struct ImageGenPartialImageEvent {
20652            #[serde(rename = "type")]
20653            #[allow(dead_code)]
20654            r#type: crate::__types::image_gen_partial_image_event::Type,
20655            #[serde(rename = "b64_json")]
20656            b64_json: String,
20657            #[serde(rename = "created_at")]
20658            created_at: i64,
20659            #[serde(rename = "size")]
20660            size: crate::__types::image_gen_partial_image_event::Size,
20661            #[serde(rename = "quality")]
20662            quality: crate::__types::image_gen_partial_image_event::Quality,
20663            #[serde(rename = "background")]
20664            background: crate::__types::image_gen_partial_image_event::Background,
20665            #[serde(rename = "output_format")]
20666            output_format: crate::__types::image_gen_partial_image_event::OutputFormat,
20667            #[serde(rename = "partial_image_index")]
20668            partial_image_index: i64,
20669        }
20670        let ImageGenPartialImageEvent {
20671            b64_json,
20672            created_at,
20673            size,
20674            quality,
20675            background,
20676            output_format,
20677            partial_image_index,
20678            ..
20679        } = ImageGenPartialImageEvent::deserialize(deserializer)?;
20680        Ok(Self {
20681            b64_json,
20682            created_at,
20683            size,
20684            quality,
20685            background,
20686            output_format,
20687            partial_image_index,
20688        })
20689    }
20690}
20691impl serde::Serialize for ImageGenPartialImageEvent {
20692    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
20693    where
20694        S: serde::Serializer,
20695    {
20696        #[serde_with::serde_as]
20697        #[derive(serde :: Serialize)]
20698        struct ImageGenPartialImageEvent<'a> {
20699            #[serde(rename = "type")]
20700            r#type: &'a crate::__types::image_gen_partial_image_event::Type,
20701            #[serde(rename = "b64_json")]
20702            b64_json: &'a String,
20703            #[serde(rename = "created_at")]
20704            created_at: &'a i64,
20705            #[serde(rename = "size")]
20706            size: &'a crate::__types::image_gen_partial_image_event::Size,
20707            #[serde(rename = "quality")]
20708            quality: &'a crate::__types::image_gen_partial_image_event::Quality,
20709            #[serde(rename = "background")]
20710            background: &'a crate::__types::image_gen_partial_image_event::Background,
20711            #[serde(rename = "output_format")]
20712            output_format: &'a crate::__types::image_gen_partial_image_event::OutputFormat,
20713            #[serde(rename = "partial_image_index")]
20714            partial_image_index: &'a i64,
20715        }
20716        let Self {
20717            b64_json,
20718            created_at,
20719            size,
20720            quality,
20721            background,
20722            output_format,
20723            partial_image_index,
20724        } = self;
20725        ImageGenPartialImageEvent {
20726            r#type: &Default::default(),
20727            b64_json,
20728            created_at,
20729            size,
20730            quality,
20731            background,
20732            output_format,
20733            partial_image_index,
20734        }
20735        .serialize(serializer)
20736    }
20737}
20738#[derive(Clone, Debug, PartialEq)]
20739#[serde_with::serde_as]
20740#[derive(serde :: Deserialize, serde :: Serialize)]
20741#[serde(untagged)]
20742#[allow(clippy::large_enum_variant)]
20743pub enum ImageGenStreamEvent {
20744    ImageGenerationPartialImage(crate::__types::ImageGenPartialImageEvent),
20745    ImageGenerationCompleted(crate::__types::ImageGenCompletedEvent),
20746}
20747#[allow(clippy::module_inception)]
20748pub mod image_gen_tool {
20749    #[doc = "The type of the image generation tool. Always `image_generation`.\n"]
20750    #[derive(Clone, Copy, Debug, Default, PartialEq)]
20751    pub(crate) struct Type;
20752    impl_serde!(Type, "image_generation");
20753    #[doc = "The image generation model to use. Default: `gpt-image-1`.\n"]
20754    #[derive(Clone, Copy, Debug, Default, PartialEq, serde :: Deserialize, serde :: Serialize)]
20755    pub enum Model {
20756        #[doc = "`gpt-image-1`"]
20757        #[default]
20758        #[serde(rename = "gpt-image-1")]
20759        GptImage1,
20760    }
20761    #[doc = "The quality of the generated image. One of `low`, `medium`, `high`, \nor `auto`. Default: `auto`.\n"]
20762    #[derive(Clone, Copy, Debug, Default, PartialEq, serde :: Deserialize, serde :: Serialize)]
20763    pub enum Quality {
20764        #[doc = "`low`"]
20765        #[serde(rename = "low")]
20766        Low,
20767        #[doc = "`medium`"]
20768        #[serde(rename = "medium")]
20769        Medium,
20770        #[doc = "`high`"]
20771        #[serde(rename = "high")]
20772        High,
20773        #[doc = "`auto`"]
20774        #[default]
20775        #[serde(rename = "auto")]
20776        Auto,
20777    }
20778    #[doc = "The size of the generated image. One of `1024x1024`, `1024x1536`, \n`1536x1024`, or `auto`. Default: `auto`.\n"]
20779    #[derive(Clone, Copy, Debug, Default, PartialEq, serde :: Deserialize, serde :: Serialize)]
20780    pub enum Size {
20781        #[doc = "`1024x1024`"]
20782        #[serde(rename = "1024x1024")]
20783        _1024x1024,
20784        #[doc = "`1024x1536`"]
20785        #[serde(rename = "1024x1536")]
20786        _1024x1536,
20787        #[doc = "`1536x1024`"]
20788        #[serde(rename = "1536x1024")]
20789        _1536x1024,
20790        #[doc = "`auto`"]
20791        #[default]
20792        #[serde(rename = "auto")]
20793        Auto,
20794    }
20795    #[doc = "The output format of the generated image. One of `png`, `webp`, or \n`jpeg`. Default: `png`.\n"]
20796    #[derive(Clone, Copy, Debug, Default, PartialEq, serde :: Deserialize, serde :: Serialize)]
20797    pub enum OutputFormat {
20798        #[doc = "`png`"]
20799        #[default]
20800        #[serde(rename = "png")]
20801        Png,
20802        #[doc = "`webp`"]
20803        #[serde(rename = "webp")]
20804        Webp,
20805        #[doc = "`jpeg`"]
20806        #[serde(rename = "jpeg")]
20807        Jpeg,
20808    }
20809    #[doc = "Moderation level for the generated image. Default: `auto`.\n"]
20810    #[derive(Clone, Copy, Debug, Default, PartialEq, serde :: Deserialize, serde :: Serialize)]
20811    pub enum Moderation {
20812        #[doc = "`auto`"]
20813        #[default]
20814        #[serde(rename = "auto")]
20815        Auto,
20816        #[doc = "`low`"]
20817        #[serde(rename = "low")]
20818        Low,
20819    }
20820    #[doc = "Background type for the generated image. One of `transparent`, \n`opaque`, or `auto`. Default: `auto`.\n"]
20821    #[derive(Clone, Copy, Debug, Default, PartialEq, serde :: Deserialize, serde :: Serialize)]
20822    pub enum Background {
20823        #[doc = "`transparent`"]
20824        #[serde(rename = "transparent")]
20825        Transparent,
20826        #[doc = "`opaque`"]
20827        #[serde(rename = "opaque")]
20828        Opaque,
20829        #[doc = "`auto`"]
20830        #[default]
20831        #[serde(rename = "auto")]
20832        Auto,
20833    }
20834    #[doc = "Optional mask for inpainting. Contains `image_url` \n(string, optional) and `file_id` (string, optional).\n"]
20835    #[derive(Clone, Debug, Default, PartialEq)]
20836    #[serde_with::serde_as]
20837    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
20838    pub struct InputImageMask {
20839        #[doc = "Base64-encoded mask image.\n"]
20840        #[serde(rename = "image_url")]
20841        #[serde(skip_serializing_if = "Option::is_none")]
20842        #[builder(default)]
20843        pub image_url: Option<String>,
20844        #[doc = "File ID for the mask image.\n"]
20845        #[serde(rename = "file_id")]
20846        #[serde(skip_serializing_if = "Option::is_none")]
20847        #[builder(default)]
20848        pub file_id: Option<String>,
20849    }
20850}
20851#[doc = "A tool that generates images using a model like `gpt-image-1`.\n"]
20852#[derive(Clone, Debug, Default, PartialEq, typed_builder :: TypedBuilder)]
20853pub struct ImageGenTool {
20854    #[doc = "The image generation model to use. Default: `gpt-image-1`.\n"]
20855    #[builder(default)]
20856    pub model: Option<crate::__types::image_gen_tool::Model>,
20857    #[doc = "The quality of the generated image. One of `low`, `medium`, `high`, \nor `auto`. Default: `auto`.\n"]
20858    #[builder(default)]
20859    pub quality: Option<crate::__types::image_gen_tool::Quality>,
20860    #[doc = "The size of the generated image. One of `1024x1024`, `1024x1536`, \n`1536x1024`, or `auto`. Default: `auto`.\n"]
20861    #[builder(default)]
20862    pub size: Option<crate::__types::image_gen_tool::Size>,
20863    #[doc = "The output format of the generated image. One of `png`, `webp`, or \n`jpeg`. Default: `png`.\n"]
20864    #[builder(default)]
20865    pub output_format: Option<crate::__types::image_gen_tool::OutputFormat>,
20866    #[doc = "Compression level for the output image. Default: 100.\n"]
20867    #[builder(default)]
20868    pub output_compression: Option<i64>,
20869    #[doc = "Moderation level for the generated image. Default: `auto`.\n"]
20870    #[builder(default)]
20871    pub moderation: Option<crate::__types::image_gen_tool::Moderation>,
20872    #[doc = "Background type for the generated image. One of `transparent`, \n`opaque`, or `auto`. Default: `auto`.\n"]
20873    #[builder(default)]
20874    pub background: Option<crate::__types::image_gen_tool::Background>,
20875    #[builder(default)]
20876    pub input_fidelity: Option<crate::__types::ImageInputFidelity>,
20877    #[doc = "Optional mask for inpainting. Contains `image_url` \n(string, optional) and `file_id` (string, optional).\n"]
20878    #[builder(default)]
20879    pub input_image_mask: Option<crate::__types::image_gen_tool::InputImageMask>,
20880    #[doc = "Number of partial images to generate in streaming mode, from 0 (default value) to 3.\n"]
20881    #[builder(default)]
20882    pub partial_images: Option<i64>,
20883}
20884impl<'de> serde::Deserialize<'de> for ImageGenTool {
20885    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
20886    where
20887        D: serde::Deserializer<'de>,
20888    {
20889        #[serde_with::serde_as]
20890        #[derive(serde :: Deserialize)]
20891        struct ImageGenTool {
20892            #[serde(rename = "type")]
20893            #[allow(dead_code)]
20894            r#type: crate::__types::image_gen_tool::Type,
20895            #[serde(rename = "model")]
20896            model: Option<crate::__types::image_gen_tool::Model>,
20897            #[serde(rename = "quality")]
20898            quality: Option<crate::__types::image_gen_tool::Quality>,
20899            #[serde(rename = "size")]
20900            size: Option<crate::__types::image_gen_tool::Size>,
20901            #[serde(rename = "output_format")]
20902            output_format: Option<crate::__types::image_gen_tool::OutputFormat>,
20903            #[serde(rename = "output_compression")]
20904            output_compression: Option<i64>,
20905            #[serde(rename = "moderation")]
20906            moderation: Option<crate::__types::image_gen_tool::Moderation>,
20907            #[serde(rename = "background")]
20908            background: Option<crate::__types::image_gen_tool::Background>,
20909            #[serde(rename = "input_fidelity")]
20910            input_fidelity: Option<crate::__types::ImageInputFidelity>,
20911            #[serde(rename = "input_image_mask")]
20912            input_image_mask: Option<crate::__types::image_gen_tool::InputImageMask>,
20913            #[serde(rename = "partial_images")]
20914            partial_images: Option<i64>,
20915        }
20916        let ImageGenTool {
20917            model,
20918            quality,
20919            size,
20920            output_format,
20921            output_compression,
20922            moderation,
20923            background,
20924            input_fidelity,
20925            input_image_mask,
20926            partial_images,
20927            ..
20928        } = ImageGenTool::deserialize(deserializer)?;
20929        Ok(Self {
20930            model,
20931            quality,
20932            size,
20933            output_format,
20934            output_compression,
20935            moderation,
20936            background,
20937            input_fidelity,
20938            input_image_mask,
20939            partial_images,
20940        })
20941    }
20942}
20943impl serde::Serialize for ImageGenTool {
20944    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
20945    where
20946        S: serde::Serializer,
20947    {
20948        #[serde_with::serde_as]
20949        #[derive(serde :: Serialize)]
20950        struct ImageGenTool<'a> {
20951            #[serde(rename = "type")]
20952            r#type: &'a crate::__types::image_gen_tool::Type,
20953            #[serde(rename = "model")]
20954            #[serde(skip_serializing_if = "Option::is_none")]
20955            model: &'a Option<crate::__types::image_gen_tool::Model>,
20956            #[serde(rename = "quality")]
20957            #[serde(skip_serializing_if = "Option::is_none")]
20958            quality: &'a Option<crate::__types::image_gen_tool::Quality>,
20959            #[serde(rename = "size")]
20960            #[serde(skip_serializing_if = "Option::is_none")]
20961            size: &'a Option<crate::__types::image_gen_tool::Size>,
20962            #[serde(rename = "output_format")]
20963            #[serde(skip_serializing_if = "Option::is_none")]
20964            output_format: &'a Option<crate::__types::image_gen_tool::OutputFormat>,
20965            #[serde(rename = "output_compression")]
20966            #[serde(skip_serializing_if = "Option::is_none")]
20967            output_compression: &'a Option<i64>,
20968            #[serde(rename = "moderation")]
20969            #[serde(skip_serializing_if = "Option::is_none")]
20970            moderation: &'a Option<crate::__types::image_gen_tool::Moderation>,
20971            #[serde(rename = "background")]
20972            #[serde(skip_serializing_if = "Option::is_none")]
20973            background: &'a Option<crate::__types::image_gen_tool::Background>,
20974            #[serde(rename = "input_fidelity")]
20975            #[serde(skip_serializing_if = "Option::is_none")]
20976            input_fidelity: &'a Option<crate::__types::ImageInputFidelity>,
20977            #[serde(rename = "input_image_mask")]
20978            #[serde(skip_serializing_if = "Option::is_none")]
20979            input_image_mask: &'a Option<crate::__types::image_gen_tool::InputImageMask>,
20980            #[serde(rename = "partial_images")]
20981            #[serde(skip_serializing_if = "Option::is_none")]
20982            partial_images: &'a Option<i64>,
20983        }
20984        let Self {
20985            model,
20986            quality,
20987            size,
20988            output_format,
20989            output_compression,
20990            moderation,
20991            background,
20992            input_fidelity,
20993            input_image_mask,
20994            partial_images,
20995        } = self;
20996        ImageGenTool {
20997            r#type: &Default::default(),
20998            model,
20999            quality,
21000            size,
21001            output_format,
21002            output_compression,
21003            moderation,
21004            background,
21005            input_fidelity,
21006            input_image_mask,
21007            partial_images,
21008        }
21009        .serialize(serializer)
21010    }
21011}
21012#[allow(clippy::module_inception)]
21013pub mod image_gen_tool_call {
21014    #[doc = "The type of the image generation call. Always `image_generation_call`.\n"]
21015    #[derive(Clone, Copy, Debug, Default, PartialEq)]
21016    pub(crate) struct Type;
21017    impl_serde!(Type, "image_generation_call");
21018    #[doc = "The status of the image generation call.\n"]
21019    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
21020    pub enum Status {
21021        #[doc = "`in_progress`"]
21022        #[serde(rename = "in_progress")]
21023        InProgress,
21024        #[doc = "`completed`"]
21025        #[serde(rename = "completed")]
21026        Completed,
21027        #[doc = "`generating`"]
21028        #[serde(rename = "generating")]
21029        Generating,
21030        #[doc = "`failed`"]
21031        #[serde(rename = "failed")]
21032        Failed,
21033    }
21034}
21035#[doc = "An image generation request made by the model.\n"]
21036#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
21037pub struct ImageGenToolCall {
21038    #[doc = "The unique ID of the image generation call.\n"]
21039    pub id: String,
21040    #[doc = "The status of the image generation call.\n"]
21041    pub status: crate::__types::image_gen_tool_call::Status,
21042    #[doc = "The generated image encoded in base64.\n"]
21043    #[builder(default)]
21044    pub result: Option<String>,
21045}
21046impl<'de> serde::Deserialize<'de> for ImageGenToolCall {
21047    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
21048    where
21049        D: serde::Deserializer<'de>,
21050    {
21051        #[serde_with::serde_as]
21052        #[derive(serde :: Deserialize)]
21053        struct ImageGenToolCall {
21054            #[serde(rename = "type")]
21055            #[allow(dead_code)]
21056            r#type: crate::__types::image_gen_tool_call::Type,
21057            #[serde(rename = "id")]
21058            id: String,
21059            #[serde(rename = "status")]
21060            status: crate::__types::image_gen_tool_call::Status,
21061            #[serde(rename = "result")]
21062            result: Option<String>,
21063        }
21064        let ImageGenToolCall {
21065            id, status, result, ..
21066        } = ImageGenToolCall::deserialize(deserializer)?;
21067        Ok(Self { id, status, result })
21068    }
21069}
21070impl serde::Serialize for ImageGenToolCall {
21071    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
21072    where
21073        S: serde::Serializer,
21074    {
21075        #[serde_with::serde_as]
21076        #[derive(serde :: Serialize)]
21077        struct ImageGenToolCall<'a> {
21078            #[serde(rename = "type")]
21079            r#type: &'a crate::__types::image_gen_tool_call::Type,
21080            #[serde(rename = "id")]
21081            id: &'a String,
21082            #[serde(rename = "status")]
21083            status: &'a crate::__types::image_gen_tool_call::Status,
21084            #[serde(rename = "result")]
21085            #[serde(skip_serializing_if = "Option::is_none")]
21086            result: &'a Option<String>,
21087        }
21088        let Self { id, status, result } = self;
21089        ImageGenToolCall {
21090            r#type: &Default::default(),
21091            id,
21092            status,
21093            result,
21094        }
21095        .serialize(serializer)
21096    }
21097}
21098#[doc = "Control how much effort the model will exert to match the style and features,\nespecially facial features, of input images. This parameter is only supported\nfor `gpt-image-1`. Supports `high` and `low`. Defaults to `low`.\n"]
21099#[derive(Clone, Copy, Debug, Default, PartialEq, serde :: Deserialize, serde :: Serialize)]
21100pub enum ImageInputFidelity {
21101    #[doc = "`high`"]
21102    #[serde(rename = "high")]
21103    High,
21104    #[doc = "`low`"]
21105    #[default]
21106    #[serde(rename = "low")]
21107    Low,
21108}
21109#[allow(clippy::module_inception)]
21110pub mod images_response {
21111    #[doc = "The background parameter used for the image generation. Either `transparent` or `opaque`."]
21112    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
21113    pub enum Background {
21114        #[doc = "`transparent`"]
21115        #[serde(rename = "transparent")]
21116        Transparent,
21117        #[doc = "`opaque`"]
21118        #[serde(rename = "opaque")]
21119        Opaque,
21120    }
21121    #[doc = "The output format of the image generation. Either `png`, `webp`, or `jpeg`."]
21122    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
21123    pub enum OutputFormat {
21124        #[doc = "`png`"]
21125        #[serde(rename = "png")]
21126        Png,
21127        #[doc = "`webp`"]
21128        #[serde(rename = "webp")]
21129        Webp,
21130        #[doc = "`jpeg`"]
21131        #[serde(rename = "jpeg")]
21132        Jpeg,
21133    }
21134    #[doc = "The size of the image generated. Either `1024x1024`, `1024x1536`, or `1536x1024`."]
21135    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
21136    pub enum Size {
21137        #[doc = "`1024x1024`"]
21138        #[serde(rename = "1024x1024")]
21139        _1024x1024,
21140        #[doc = "`1024x1536`"]
21141        #[serde(rename = "1024x1536")]
21142        _1024x1536,
21143        #[doc = "`1536x1024`"]
21144        #[serde(rename = "1536x1024")]
21145        _1536x1024,
21146    }
21147    #[doc = "The quality of the image generated. Either `low`, `medium`, or `high`."]
21148    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
21149    pub enum Quality {
21150        #[doc = "`low`"]
21151        #[serde(rename = "low")]
21152        Low,
21153        #[doc = "`medium`"]
21154        #[serde(rename = "medium")]
21155        Medium,
21156        #[doc = "`high`"]
21157        #[serde(rename = "high")]
21158        High,
21159    }
21160}
21161#[doc = "The response from the image generation endpoint."]
21162#[derive(Clone, Debug, PartialEq)]
21163#[serde_with::serde_as]
21164#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
21165pub struct ImagesResponse {
21166    #[doc = "The Unix timestamp (in seconds) of when the image was created."]
21167    #[serde(rename = "created")]
21168    pub created: i64,
21169    #[doc = "The list of generated images."]
21170    #[serde(rename = "data")]
21171    #[serde(skip_serializing_if = "Option::is_none")]
21172    #[builder(default)]
21173    pub data: Option<Vec<crate::__types::Image>>,
21174    #[doc = "The background parameter used for the image generation. Either `transparent` or `opaque`."]
21175    #[serde(rename = "background")]
21176    #[serde(skip_serializing_if = "Option::is_none")]
21177    #[builder(default)]
21178    pub background: Option<crate::__types::images_response::Background>,
21179    #[doc = "The output format of the image generation. Either `png`, `webp`, or `jpeg`."]
21180    #[serde(rename = "output_format")]
21181    #[serde(skip_serializing_if = "Option::is_none")]
21182    #[builder(default)]
21183    pub output_format: Option<crate::__types::images_response::OutputFormat>,
21184    #[doc = "The size of the image generated. Either `1024x1024`, `1024x1536`, or `1536x1024`."]
21185    #[serde(rename = "size")]
21186    #[serde(skip_serializing_if = "Option::is_none")]
21187    #[builder(default)]
21188    pub size: Option<crate::__types::images_response::Size>,
21189    #[doc = "The quality of the image generated. Either `low`, `medium`, or `high`."]
21190    #[serde(rename = "quality")]
21191    #[serde(skip_serializing_if = "Option::is_none")]
21192    #[builder(default)]
21193    pub quality: Option<crate::__types::images_response::Quality>,
21194    #[serde(rename = "usage")]
21195    #[serde(skip_serializing_if = "Option::is_none")]
21196    #[builder(default)]
21197    pub usage: Option<crate::__types::ImageGenUsage>,
21198}
21199#[allow(clippy::module_inception)]
21200pub mod images_usage {
21201    #[doc = "The input tokens detailed information for the image generation."]
21202    #[derive(Clone, Copy, Debug, PartialEq)]
21203    #[serde_with::serde_as]
21204    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
21205    pub struct InputTokensDetails {
21206        #[doc = "The number of text tokens in the input prompt."]
21207        #[serde(rename = "text_tokens")]
21208        pub text_tokens: i64,
21209        #[doc = "The number of image tokens in the input prompt."]
21210        #[serde(rename = "image_tokens")]
21211        pub image_tokens: i64,
21212    }
21213}
21214#[doc = "For `gpt-image-1` only, the token usage information for the image generation.\n"]
21215#[derive(Clone, Copy, Debug, PartialEq)]
21216#[serde_with::serde_as]
21217#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
21218pub struct ImagesUsage {
21219    #[doc = "The total number of tokens (images and text) used for the image generation.\n"]
21220    #[serde(rename = "total_tokens")]
21221    pub total_tokens: i64,
21222    #[doc = "The number of tokens (images and text) in the input prompt."]
21223    #[serde(rename = "input_tokens")]
21224    pub input_tokens: i64,
21225    #[doc = "The number of image tokens in the output image."]
21226    #[serde(rename = "output_tokens")]
21227    pub output_tokens: i64,
21228    #[doc = "The input tokens detailed information for the image generation."]
21229    #[serde(rename = "input_tokens_details")]
21230    pub input_tokens_details: crate::__types::images_usage::InputTokensDetails,
21231}
21232#[doc = "Specify additional output data to include in the model response. Currently\nsupported values are:\n- `code_interpreter_call.outputs`: Includes the outputs of python code execution\n  in code interpreter tool call items.\n- `computer_call_output.output.image_url`: Include image urls from the computer call output.\n- `file_search_call.results`: Include the search results of\n  the file search tool call.\n- `message.input_image.image_url`: Include image urls from the input message.\n- `message.output_text.logprobs`: Include logprobs with assistant messages.\n- `reasoning.encrypted_content`: Includes an encrypted version of reasoning\n  tokens in reasoning item outputs. This enables reasoning items to be used in\n  multi-turn conversations when using the Responses API statelessly (like\n  when the `store` parameter is set to `false`, or when an organization is\n  enrolled in the zero data retention program).\n"]
21233#[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
21234pub enum Includable {
21235    #[doc = "`code_interpreter_call.outputs`"]
21236    #[serde(rename = "code_interpreter_call.outputs")]
21237    CodeInterpreterCallOutputs,
21238    #[doc = "`computer_call_output.output.image_url`"]
21239    #[serde(rename = "computer_call_output.output.image_url")]
21240    ComputerCallOutputOutputImageUrl,
21241    #[doc = "`file_search_call.results`"]
21242    #[serde(rename = "file_search_call.results")]
21243    FileSearchCallResults,
21244    #[doc = "`message.input_image.image_url`"]
21245    #[serde(rename = "message.input_image.image_url")]
21246    MessageInputImageImageUrl,
21247    #[doc = "`message.output_text.logprobs`"]
21248    #[serde(rename = "message.output_text.logprobs")]
21249    MessageOutputTextLogprobs,
21250    #[doc = "`reasoning.encrypted_content`"]
21251    #[serde(rename = "reasoning.encrypted_content")]
21252    ReasoningEncryptedContent,
21253}
21254#[allow(clippy::module_inception)]
21255pub mod input_audio {
21256    #[doc = "The type of the input item. Always `input_audio`.\n"]
21257    #[derive(Clone, Copy, Debug, Default, PartialEq)]
21258    pub(crate) struct Type;
21259    impl_serde!(Type, "input_audio");
21260    #[doc = "The format of the audio data. Currently supported formats are `mp3` and\n`wav`.\n"]
21261    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
21262    pub enum Format {
21263        #[doc = "`mp3`"]
21264        #[serde(rename = "mp3")]
21265        Mp3,
21266        #[doc = "`wav`"]
21267        #[serde(rename = "wav")]
21268        Wav,
21269    }
21270}
21271#[doc = "An audio input to the model.\n"]
21272#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
21273pub struct InputAudio {
21274    #[doc = "Base64-encoded audio data.\n"]
21275    pub data: String,
21276    #[doc = "The format of the audio data. Currently supported formats are `mp3` and\n`wav`.\n"]
21277    pub format: crate::__types::input_audio::Format,
21278}
21279impl<'de> serde::Deserialize<'de> for InputAudio {
21280    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
21281    where
21282        D: serde::Deserializer<'de>,
21283    {
21284        #[serde_with::serde_as]
21285        #[derive(serde :: Deserialize)]
21286        struct InputAudio {
21287            #[serde(rename = "type")]
21288            #[allow(dead_code)]
21289            r#type: crate::__types::input_audio::Type,
21290            #[serde(rename = "data")]
21291            data: String,
21292            #[serde(rename = "format")]
21293            format: crate::__types::input_audio::Format,
21294        }
21295        let InputAudio { data, format, .. } = InputAudio::deserialize(deserializer)?;
21296        Ok(Self { data, format })
21297    }
21298}
21299impl serde::Serialize for InputAudio {
21300    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
21301    where
21302        S: serde::Serializer,
21303    {
21304        #[serde_with::serde_as]
21305        #[derive(serde :: Serialize)]
21306        struct InputAudio<'a> {
21307            #[serde(rename = "type")]
21308            r#type: &'a crate::__types::input_audio::Type,
21309            #[serde(rename = "data")]
21310            data: &'a String,
21311            #[serde(rename = "format")]
21312            format: &'a crate::__types::input_audio::Format,
21313        }
21314        let Self { data, format } = self;
21315        InputAudio {
21316            r#type: &Default::default(),
21317            data,
21318            format,
21319        }
21320        .serialize(serializer)
21321    }
21322}
21323#[derive(Clone, Debug, PartialEq)]
21324#[serde_with::serde_as]
21325#[derive(serde :: Deserialize, serde :: Serialize)]
21326#[serde(untagged)]
21327#[allow(clippy::large_enum_variant)]
21328pub enum InputContent {
21329    InputText(crate::__types::InputTextContent),
21330    InputImage(crate::__types::InputImageContent),
21331    InputFile(crate::__types::InputFileContent),
21332}
21333#[derive(Clone, Debug, PartialEq)]
21334#[serde_with::serde_as]
21335#[derive(serde :: Deserialize, serde :: Serialize)]
21336#[serde(untagged)]
21337#[allow(clippy::large_enum_variant)]
21338pub enum InputItem {
21339    EasyInputMessage(crate::__types::EasyInputMessage),
21340    #[doc = "An item representing part of the context for the response to be \ngenerated by the model. Can contain text, images, and audio inputs,\nas well as previous assistant responses and tool call outputs.\n"]
21341    Item(crate::__types::Item),
21342    ItemReferenceParam(crate::__types::ItemReferenceParam),
21343}
21344#[allow(clippy::module_inception)]
21345pub mod input_message {
21346    #[doc = "The type of the message input. Always set to `message`.\n"]
21347    #[derive(Clone, Copy, Debug, Default, PartialEq)]
21348    pub struct Type;
21349    impl_serde!(Type, "message");
21350    #[doc = "The role of the message input. One of `user`, `system`, or `developer`.\n"]
21351    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
21352    pub enum Role {
21353        #[doc = "`user`"]
21354        #[serde(rename = "user")]
21355        User,
21356        #[doc = "`system`"]
21357        #[serde(rename = "system")]
21358        System,
21359        #[doc = "`developer`"]
21360        #[serde(rename = "developer")]
21361        Developer,
21362    }
21363    #[doc = "The status of item. One of `in_progress`, `completed`, or\n`incomplete`. Populated when items are returned via API.\n"]
21364    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
21365    pub enum Status {
21366        #[doc = "`in_progress`"]
21367        #[serde(rename = "in_progress")]
21368        InProgress,
21369        #[doc = "`completed`"]
21370        #[serde(rename = "completed")]
21371        Completed,
21372        #[doc = "`incomplete`"]
21373        #[serde(rename = "incomplete")]
21374        Incomplete,
21375    }
21376}
21377#[doc = "A message input to the model with a role indicating instruction following\nhierarchy. Instructions given with the `developer` or `system` role take\nprecedence over instructions given with the `user` role.\n"]
21378#[derive(Clone, Debug, PartialEq)]
21379#[serde_with::serde_as]
21380#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
21381pub struct InputMessage {
21382    #[doc = "The type of the message input. Always set to `message`.\n"]
21383    #[serde(rename = "type")]
21384    #[serde(skip_serializing_if = "Option::is_none")]
21385    #[builder(default)]
21386    pub r#type: Option<crate::__types::input_message::Type>,
21387    #[doc = "The role of the message input. One of `user`, `system`, or `developer`.\n"]
21388    #[serde(rename = "role")]
21389    pub role: crate::__types::input_message::Role,
21390    #[doc = "The status of item. One of `in_progress`, `completed`, or\n`incomplete`. Populated when items are returned via API.\n"]
21391    #[serde(rename = "status")]
21392    #[serde(skip_serializing_if = "Option::is_none")]
21393    #[builder(default)]
21394    pub status: Option<crate::__types::input_message::Status>,
21395    #[serde(rename = "content")]
21396    pub content: crate::__types::InputMessageContentList,
21397}
21398#[doc = "A list of one or many input items to the model, containing different content \ntypes.\n"]
21399pub type InputMessageContentList = Vec<crate::__types::InputContent>;
21400#[allow(clippy::module_inception)]
21401pub mod input_message_resource {
21402    #[doc = "The type of the message input. Always set to `message`.\n"]
21403    #[derive(Clone, Copy, Debug, Default, PartialEq)]
21404    pub struct Type;
21405    impl_serde!(Type, "message");
21406    #[doc = "The role of the message input. One of `user`, `system`, or `developer`.\n"]
21407    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
21408    pub enum Role {
21409        #[doc = "`user`"]
21410        #[serde(rename = "user")]
21411        User,
21412        #[doc = "`system`"]
21413        #[serde(rename = "system")]
21414        System,
21415        #[doc = "`developer`"]
21416        #[serde(rename = "developer")]
21417        Developer,
21418    }
21419    #[doc = "The status of item. One of `in_progress`, `completed`, or\n`incomplete`. Populated when items are returned via API.\n"]
21420    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
21421    pub enum Status {
21422        #[doc = "`in_progress`"]
21423        #[serde(rename = "in_progress")]
21424        InProgress,
21425        #[doc = "`completed`"]
21426        #[serde(rename = "completed")]
21427        Completed,
21428        #[doc = "`incomplete`"]
21429        #[serde(rename = "incomplete")]
21430        Incomplete,
21431    }
21432}
21433#[derive(Clone, Debug, PartialEq)]
21434#[serde_with::serde_as]
21435#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
21436pub struct InputMessageResource {
21437    #[doc = "The type of the message input. Always set to `message`.\n"]
21438    #[serde(rename = "type")]
21439    #[serde(skip_serializing_if = "Option::is_none")]
21440    #[builder(default)]
21441    pub r#type: Option<crate::__types::input_message_resource::Type>,
21442    #[doc = "The role of the message input. One of `user`, `system`, or `developer`.\n"]
21443    #[serde(rename = "role")]
21444    pub role: crate::__types::input_message_resource::Role,
21445    #[doc = "The status of item. One of `in_progress`, `completed`, or\n`incomplete`. Populated when items are returned via API.\n"]
21446    #[serde(rename = "status")]
21447    #[serde(skip_serializing_if = "Option::is_none")]
21448    #[builder(default)]
21449    pub status: Option<crate::__types::input_message_resource::Status>,
21450    #[serde(rename = "content")]
21451    pub content: crate::__types::InputMessageContentList,
21452    #[doc = "The unique ID of the message input.\n"]
21453    #[serde(rename = "id")]
21454    pub id: String,
21455}
21456#[allow(clippy::module_inception)]
21457pub mod invite {
21458    #[doc = "The object type, which is always `organization.invite`"]
21459    #[derive(Clone, Copy, Debug, Default, PartialEq)]
21460    pub(crate) struct Object;
21461    impl_serde!(Object, "organization.invite");
21462    #[doc = "`owner` or `reader`"]
21463    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
21464    pub enum Role {
21465        #[doc = "`owner`"]
21466        #[serde(rename = "owner")]
21467        Owner,
21468        #[doc = "`reader`"]
21469        #[serde(rename = "reader")]
21470        Reader,
21471    }
21472    #[doc = "`accepted`,`expired`, or `pending`"]
21473    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
21474    pub enum Status {
21475        #[doc = "`accepted`"]
21476        #[serde(rename = "accepted")]
21477        Accepted,
21478        #[doc = "`expired`"]
21479        #[serde(rename = "expired")]
21480        Expired,
21481        #[doc = "`pending`"]
21482        #[serde(rename = "pending")]
21483        Pending,
21484    }
21485    #[allow(clippy::module_inception)]
21486    pub mod projects {
21487        #[allow(clippy::module_inception)]
21488        pub mod item {
21489            #[doc = "Project membership role"]
21490            #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
21491            pub enum Role {
21492                #[doc = "`member`"]
21493                #[serde(rename = "member")]
21494                Member,
21495                #[doc = "`owner`"]
21496                #[serde(rename = "owner")]
21497                Owner,
21498            }
21499        }
21500        #[derive(Clone, Debug, Default, PartialEq)]
21501        #[serde_with::serde_as]
21502        #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
21503        pub struct Item {
21504            #[doc = "Project's public ID"]
21505            #[serde(rename = "id")]
21506            #[serde(skip_serializing_if = "Option::is_none")]
21507            #[builder(default)]
21508            pub id: Option<String>,
21509            #[doc = "Project membership role"]
21510            #[serde(rename = "role")]
21511            #[serde(skip_serializing_if = "Option::is_none")]
21512            #[builder(default)]
21513            pub role: Option<crate::__types::invite::projects::item::Role>,
21514        }
21515    }
21516}
21517#[doc = "Represents an individual `invite` to the organization."]
21518#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
21519pub struct Invite {
21520    #[doc = "The identifier, which can be referenced in API endpoints"]
21521    pub id: String,
21522    #[doc = "The email address of the individual to whom the invite was sent"]
21523    pub email: String,
21524    #[doc = "`owner` or `reader`"]
21525    pub role: crate::__types::invite::Role,
21526    #[doc = "`accepted`,`expired`, or `pending`"]
21527    pub status: crate::__types::invite::Status,
21528    #[doc = "The Unix timestamp (in seconds) of when the invite was sent."]
21529    pub invited_at: i64,
21530    #[doc = "The Unix timestamp (in seconds) of when the invite expires."]
21531    pub expires_at: i64,
21532    #[doc = "The Unix timestamp (in seconds) of when the invite was accepted."]
21533    #[builder(default)]
21534    pub accepted_at: Option<i64>,
21535    #[doc = "The projects that were granted membership upon acceptance of the invite."]
21536    #[builder(default)]
21537    pub projects: Option<Vec<crate::__types::invite::projects::Item>>,
21538}
21539impl<'de> serde::Deserialize<'de> for Invite {
21540    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
21541    where
21542        D: serde::Deserializer<'de>,
21543    {
21544        #[serde_with::serde_as]
21545        #[derive(serde :: Deserialize)]
21546        struct Invite {
21547            #[serde(rename = "object")]
21548            #[allow(dead_code)]
21549            object: crate::__types::invite::Object,
21550            #[serde(rename = "id")]
21551            id: String,
21552            #[serde(rename = "email")]
21553            email: String,
21554            #[serde(rename = "role")]
21555            role: crate::__types::invite::Role,
21556            #[serde(rename = "status")]
21557            status: crate::__types::invite::Status,
21558            #[serde(rename = "invited_at")]
21559            invited_at: i64,
21560            #[serde(rename = "expires_at")]
21561            expires_at: i64,
21562            #[serde(rename = "accepted_at")]
21563            accepted_at: Option<i64>,
21564            #[serde(rename = "projects")]
21565            projects: Option<Vec<crate::__types::invite::projects::Item>>,
21566        }
21567        let Invite {
21568            id,
21569            email,
21570            role,
21571            status,
21572            invited_at,
21573            expires_at,
21574            accepted_at,
21575            projects,
21576            ..
21577        } = Invite::deserialize(deserializer)?;
21578        Ok(Self {
21579            id,
21580            email,
21581            role,
21582            status,
21583            invited_at,
21584            expires_at,
21585            accepted_at,
21586            projects,
21587        })
21588    }
21589}
21590impl serde::Serialize for Invite {
21591    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
21592    where
21593        S: serde::Serializer,
21594    {
21595        #[serde_with::serde_as]
21596        #[derive(serde :: Serialize)]
21597        struct Invite<'a> {
21598            #[serde(rename = "object")]
21599            object: &'a crate::__types::invite::Object,
21600            #[serde(rename = "id")]
21601            id: &'a String,
21602            #[serde(rename = "email")]
21603            email: &'a String,
21604            #[serde(rename = "role")]
21605            role: &'a crate::__types::invite::Role,
21606            #[serde(rename = "status")]
21607            status: &'a crate::__types::invite::Status,
21608            #[serde(rename = "invited_at")]
21609            invited_at: &'a i64,
21610            #[serde(rename = "expires_at")]
21611            expires_at: &'a i64,
21612            #[serde(rename = "accepted_at")]
21613            #[serde(skip_serializing_if = "Option::is_none")]
21614            accepted_at: &'a Option<i64>,
21615            #[serde(rename = "projects")]
21616            #[serde(skip_serializing_if = "Option::is_none")]
21617            projects: &'a Option<Vec<crate::__types::invite::projects::Item>>,
21618        }
21619        let Self {
21620            id,
21621            email,
21622            role,
21623            status,
21624            invited_at,
21625            expires_at,
21626            accepted_at,
21627            projects,
21628        } = self;
21629        Invite {
21630            object: &Default::default(),
21631            id,
21632            email,
21633            role,
21634            status,
21635            invited_at,
21636            expires_at,
21637            accepted_at,
21638            projects,
21639        }
21640        .serialize(serializer)
21641    }
21642}
21643#[allow(clippy::module_inception)]
21644pub(crate) mod invite_delete_response {
21645    #[doc = "The object type, which is always `organization.invite.deleted`"]
21646    #[derive(Clone, Copy, Debug, Default, PartialEq)]
21647    pub(crate) struct Object;
21648    impl_serde!(Object, "organization.invite.deleted");
21649}
21650#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
21651pub struct InviteDeleteResponse {
21652    pub id: String,
21653    pub deleted: bool,
21654}
21655impl<'de> serde::Deserialize<'de> for InviteDeleteResponse {
21656    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
21657    where
21658        D: serde::Deserializer<'de>,
21659    {
21660        #[serde_with::serde_as]
21661        #[derive(serde :: Deserialize)]
21662        struct InviteDeleteResponse {
21663            #[serde(rename = "object")]
21664            #[allow(dead_code)]
21665            object: crate::__types::invite_delete_response::Object,
21666            #[serde(rename = "id")]
21667            id: String,
21668            #[serde(rename = "deleted")]
21669            deleted: bool,
21670        }
21671        let InviteDeleteResponse { id, deleted, .. } =
21672            InviteDeleteResponse::deserialize(deserializer)?;
21673        Ok(Self { id, deleted })
21674    }
21675}
21676impl serde::Serialize for InviteDeleteResponse {
21677    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
21678    where
21679        S: serde::Serializer,
21680    {
21681        #[serde_with::serde_as]
21682        #[derive(serde :: Serialize)]
21683        struct InviteDeleteResponse<'a> {
21684            #[serde(rename = "object")]
21685            object: &'a crate::__types::invite_delete_response::Object,
21686            #[serde(rename = "id")]
21687            id: &'a String,
21688            #[serde(rename = "deleted")]
21689            deleted: &'a bool,
21690        }
21691        let Self { id, deleted } = self;
21692        InviteDeleteResponse {
21693            object: &Default::default(),
21694            id,
21695            deleted,
21696        }
21697        .serialize(serializer)
21698    }
21699}
21700#[allow(clippy::module_inception)]
21701pub(crate) mod invite_list_response {
21702    #[doc = "The object type, which is always `list`"]
21703    #[derive(Clone, Copy, Debug, Default, PartialEq)]
21704    pub(crate) struct Object;
21705    impl_serde!(Object, "list");
21706}
21707#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
21708pub struct InviteListResponse {
21709    pub data: Vec<crate::__types::Invite>,
21710    #[doc = "The first `invite_id` in the retrieved `list`"]
21711    #[builder(default)]
21712    pub first_id: Option<String>,
21713    #[doc = "The last `invite_id` in the retrieved `list`"]
21714    #[builder(default)]
21715    pub last_id: Option<String>,
21716    #[doc = "The `has_more` property is used for pagination to indicate there are additional results."]
21717    #[builder(default)]
21718    pub has_more: Option<bool>,
21719}
21720impl<'de> serde::Deserialize<'de> for InviteListResponse {
21721    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
21722    where
21723        D: serde::Deserializer<'de>,
21724    {
21725        #[serde_with::serde_as]
21726        #[derive(serde :: Deserialize)]
21727        struct InviteListResponse {
21728            #[serde(rename = "object")]
21729            #[allow(dead_code)]
21730            object: crate::__types::invite_list_response::Object,
21731            #[serde(rename = "data")]
21732            data: Vec<crate::__types::Invite>,
21733            #[serde(rename = "first_id")]
21734            first_id: Option<String>,
21735            #[serde(rename = "last_id")]
21736            last_id: Option<String>,
21737            #[serde(rename = "has_more")]
21738            has_more: Option<bool>,
21739        }
21740        let InviteListResponse {
21741            data,
21742            first_id,
21743            last_id,
21744            has_more,
21745            ..
21746        } = InviteListResponse::deserialize(deserializer)?;
21747        Ok(Self {
21748            data,
21749            first_id,
21750            last_id,
21751            has_more,
21752        })
21753    }
21754}
21755impl serde::Serialize for InviteListResponse {
21756    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
21757    where
21758        S: serde::Serializer,
21759    {
21760        #[serde_with::serde_as]
21761        #[derive(serde :: Serialize)]
21762        struct InviteListResponse<'a> {
21763            #[serde(rename = "object")]
21764            object: &'a crate::__types::invite_list_response::Object,
21765            #[serde(rename = "data")]
21766            data: &'a Vec<crate::__types::Invite>,
21767            #[serde(rename = "first_id")]
21768            #[serde(skip_serializing_if = "Option::is_none")]
21769            first_id: &'a Option<String>,
21770            #[serde(rename = "last_id")]
21771            #[serde(skip_serializing_if = "Option::is_none")]
21772            last_id: &'a Option<String>,
21773            #[serde(rename = "has_more")]
21774            #[serde(skip_serializing_if = "Option::is_none")]
21775            has_more: &'a Option<bool>,
21776        }
21777        let Self {
21778            data,
21779            first_id,
21780            last_id,
21781            has_more,
21782        } = self;
21783        InviteListResponse {
21784            object: &Default::default(),
21785            data,
21786            first_id,
21787            last_id,
21788            has_more,
21789        }
21790        .serialize(serializer)
21791    }
21792}
21793#[allow(clippy::module_inception)]
21794pub mod invite_request {
21795    #[doc = "`owner` or `reader`"]
21796    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
21797    pub enum Role {
21798        #[doc = "`reader`"]
21799        #[serde(rename = "reader")]
21800        Reader,
21801        #[doc = "`owner`"]
21802        #[serde(rename = "owner")]
21803        Owner,
21804    }
21805    #[allow(clippy::module_inception)]
21806    pub mod projects {
21807        #[allow(clippy::module_inception)]
21808        pub mod item {
21809            #[doc = "Project membership role"]
21810            #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
21811            pub enum Role {
21812                #[doc = "`member`"]
21813                #[serde(rename = "member")]
21814                Member,
21815                #[doc = "`owner`"]
21816                #[serde(rename = "owner")]
21817                Owner,
21818            }
21819        }
21820        #[derive(Clone, Debug, PartialEq)]
21821        #[serde_with::serde_as]
21822        #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
21823        pub struct Item {
21824            #[doc = "Project's public ID"]
21825            #[serde(rename = "id")]
21826            pub id: String,
21827            #[doc = "Project membership role"]
21828            #[serde(rename = "role")]
21829            pub role: crate::__types::invite_request::projects::item::Role,
21830        }
21831    }
21832}
21833#[derive(Clone, Debug, PartialEq)]
21834#[serde_with::serde_as]
21835#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
21836pub struct InviteRequest {
21837    #[doc = "Send an email to this address"]
21838    #[serde(rename = "email")]
21839    pub email: String,
21840    #[doc = "`owner` or `reader`"]
21841    #[serde(rename = "role")]
21842    pub role: crate::__types::invite_request::Role,
21843    #[doc = "An array of projects to which membership is granted at the same time the org invite is accepted. If omitted, the user will be invited to the default project for compatibility with legacy behavior."]
21844    #[serde(rename = "projects")]
21845    #[serde(skip_serializing_if = "Option::is_none")]
21846    #[builder(default)]
21847    pub projects: Option<Vec<crate::__types::invite_request::projects::Item>>,
21848}
21849#[doc = "Content item used to generate a response.\n"]
21850#[derive(Clone, Debug, PartialEq)]
21851#[serde_with::serde_as]
21852#[derive(serde :: Deserialize, serde :: Serialize)]
21853#[serde(untagged)]
21854#[allow(clippy::large_enum_variant)]
21855pub enum Item {
21856    InputMessage(crate::__types::InputMessage),
21857    OutputMessage(crate::__types::OutputMessage),
21858    FileSearchToolCall(crate::__types::FileSearchToolCall),
21859    ComputerToolCall(crate::__types::ComputerToolCall),
21860    ComputerCallOutputItemParam(crate::__types::ComputerCallOutputItemParam),
21861    WebSearchToolCall(crate::__types::WebSearchToolCall),
21862    FunctionToolCall(crate::__types::FunctionToolCall),
21863    FunctionCallOutputItemParam(crate::__types::FunctionCallOutputItemParam),
21864    ReasoningItem(crate::__types::ReasoningItem),
21865    ImageGenToolCall(crate::__types::ImageGenToolCall),
21866    CodeInterpreterToolCall(crate::__types::CodeInterpreterToolCall),
21867    LocalShellToolCall(crate::__types::LocalShellToolCall),
21868    LocalShellToolCallOutput(crate::__types::LocalShellToolCallOutput),
21869    McpListTools(crate::__types::McpListTools),
21870    McpApprovalRequest(crate::__types::McpApprovalRequest),
21871    McpApprovalResponse(crate::__types::McpApprovalResponse),
21872    McpToolCall(crate::__types::McpToolCall),
21873    CustomToolCallOutput(crate::__types::CustomToolCallOutput),
21874    CustomToolCall(crate::__types::CustomToolCall),
21875}
21876#[doc = "Content item used to generate a response.\n"]
21877#[derive(Clone, Debug, PartialEq)]
21878#[serde_with::serde_as]
21879#[derive(serde :: Deserialize, serde :: Serialize)]
21880#[serde(untagged)]
21881#[allow(clippy::large_enum_variant)]
21882pub enum ItemResource {
21883    InputMessageResource(crate::__types::InputMessageResource),
21884    OutputMessage(crate::__types::OutputMessage),
21885    FileSearchToolCall(crate::__types::FileSearchToolCall),
21886    ComputerToolCall(crate::__types::ComputerToolCall),
21887    ComputerToolCallOutputResource(crate::__types::ComputerToolCallOutputResource),
21888    WebSearchToolCall(crate::__types::WebSearchToolCall),
21889    FunctionToolCallResource(crate::__types::FunctionToolCallResource),
21890    FunctionToolCallOutputResource(crate::__types::FunctionToolCallOutputResource),
21891    ImageGenToolCall(crate::__types::ImageGenToolCall),
21892    CodeInterpreterToolCall(crate::__types::CodeInterpreterToolCall),
21893    LocalShellToolCall(crate::__types::LocalShellToolCall),
21894    LocalShellToolCallOutput(crate::__types::LocalShellToolCallOutput),
21895    McpListTools(crate::__types::McpListTools),
21896    McpApprovalRequest(crate::__types::McpApprovalRequest),
21897    McpApprovalResponseResource(crate::__types::McpApprovalResponseResource),
21898    McpToolCall(crate::__types::McpToolCall),
21899}
21900#[allow(clippy::module_inception)]
21901pub(crate) mod key_press {
21902    #[doc = "Specifies the event type. For a keypress action, this property is \nalways set to `keypress`.\n"]
21903    #[derive(Clone, Copy, Debug, Default, PartialEq)]
21904    pub(crate) struct Type;
21905    impl_serde!(Type, "keypress");
21906}
21907#[doc = "A collection of keypresses the model would like to perform.\n"]
21908#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
21909pub struct KeyPress {
21910    #[doc = "The combination of keys the model is requesting to be pressed. This is an\narray of strings, each representing a key.\n"]
21911    pub keys: Vec<String>,
21912}
21913impl<'de> serde::Deserialize<'de> for KeyPress {
21914    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
21915    where
21916        D: serde::Deserializer<'de>,
21917    {
21918        #[serde_with::serde_as]
21919        #[derive(serde :: Deserialize)]
21920        struct KeyPress {
21921            #[serde(rename = "type")]
21922            #[allow(dead_code)]
21923            r#type: crate::__types::key_press::Type,
21924            #[serde(rename = "keys")]
21925            keys: Vec<String>,
21926        }
21927        let KeyPress { keys, .. } = KeyPress::deserialize(deserializer)?;
21928        Ok(Self { keys })
21929    }
21930}
21931impl serde::Serialize for KeyPress {
21932    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
21933    where
21934        S: serde::Serializer,
21935    {
21936        #[serde_with::serde_as]
21937        #[derive(serde :: Serialize)]
21938        struct KeyPress<'a> {
21939            #[serde(rename = "type")]
21940            r#type: &'a crate::__types::key_press::Type,
21941            #[serde(rename = "keys")]
21942            keys: &'a Vec<String>,
21943        }
21944        let Self { keys } = self;
21945        KeyPress {
21946            r#type: &Default::default(),
21947            keys,
21948        }
21949        .serialize(serializer)
21950    }
21951}
21952#[derive(Clone, Debug, PartialEq)]
21953#[serde_with::serde_as]
21954#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
21955pub struct ListAssistantsResponse {
21956    #[serde(rename = "object")]
21957    pub object: String,
21958    #[serde(rename = "data")]
21959    pub data: Vec<crate::__types::AssistantObject>,
21960    #[serde(rename = "first_id")]
21961    pub first_id: String,
21962    #[serde(rename = "last_id")]
21963    pub last_id: String,
21964    #[serde(rename = "has_more")]
21965    pub has_more: bool,
21966}
21967#[allow(clippy::module_inception)]
21968pub(crate) mod list_audit_logs_response {
21969    #[doc = "list"]
21970    #[derive(Clone, Copy, Debug, Default, PartialEq)]
21971    pub(crate) struct Object;
21972    impl_serde!(Object, "list");
21973}
21974#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
21975pub struct ListAuditLogsResponse {
21976    pub data: Vec<crate::__types::AuditLog>,
21977    pub first_id: String,
21978    pub last_id: String,
21979    pub has_more: bool,
21980}
21981impl<'de> serde::Deserialize<'de> for ListAuditLogsResponse {
21982    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
21983    where
21984        D: serde::Deserializer<'de>,
21985    {
21986        #[serde_with::serde_as]
21987        #[derive(serde :: Deserialize)]
21988        struct ListAuditLogsResponse {
21989            #[serde(rename = "object")]
21990            #[allow(dead_code)]
21991            object: crate::__types::list_audit_logs_response::Object,
21992            #[serde(rename = "data")]
21993            data: Vec<crate::__types::AuditLog>,
21994            #[serde(rename = "first_id")]
21995            first_id: String,
21996            #[serde(rename = "last_id")]
21997            last_id: String,
21998            #[serde(rename = "has_more")]
21999            has_more: bool,
22000        }
22001        let ListAuditLogsResponse {
22002            data,
22003            first_id,
22004            last_id,
22005            has_more,
22006            ..
22007        } = ListAuditLogsResponse::deserialize(deserializer)?;
22008        Ok(Self {
22009            data,
22010            first_id,
22011            last_id,
22012            has_more,
22013        })
22014    }
22015}
22016impl serde::Serialize for ListAuditLogsResponse {
22017    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
22018    where
22019        S: serde::Serializer,
22020    {
22021        #[serde_with::serde_as]
22022        #[derive(serde :: Serialize)]
22023        struct ListAuditLogsResponse<'a> {
22024            #[serde(rename = "object")]
22025            object: &'a crate::__types::list_audit_logs_response::Object,
22026            #[serde(rename = "data")]
22027            data: &'a Vec<crate::__types::AuditLog>,
22028            #[serde(rename = "first_id")]
22029            first_id: &'a String,
22030            #[serde(rename = "last_id")]
22031            last_id: &'a String,
22032            #[serde(rename = "has_more")]
22033            has_more: &'a bool,
22034        }
22035        let Self {
22036            data,
22037            first_id,
22038            last_id,
22039            has_more,
22040        } = self;
22041        ListAuditLogsResponse {
22042            object: &Default::default(),
22043            data,
22044            first_id,
22045            last_id,
22046            has_more,
22047        }
22048        .serialize(serializer)
22049    }
22050}
22051#[allow(clippy::module_inception)]
22052pub(crate) mod list_batches_response {
22053    #[doc = "list"]
22054    #[derive(Clone, Copy, Debug, Default, PartialEq)]
22055    pub(crate) struct Object;
22056    impl_serde!(Object, "list");
22057}
22058#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
22059pub struct ListBatchesResponse {
22060    pub data: Vec<crate::__types::Batch>,
22061    #[builder(default)]
22062    pub first_id: Option<String>,
22063    #[builder(default)]
22064    pub last_id: Option<String>,
22065    pub has_more: bool,
22066}
22067impl<'de> serde::Deserialize<'de> for ListBatchesResponse {
22068    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
22069    where
22070        D: serde::Deserializer<'de>,
22071    {
22072        #[serde_with::serde_as]
22073        #[derive(serde :: Deserialize)]
22074        struct ListBatchesResponse {
22075            #[serde(rename = "data")]
22076            data: Vec<crate::__types::Batch>,
22077            #[serde(rename = "first_id")]
22078            first_id: Option<String>,
22079            #[serde(rename = "last_id")]
22080            last_id: Option<String>,
22081            #[serde(rename = "has_more")]
22082            has_more: bool,
22083            #[serde(rename = "object")]
22084            #[allow(dead_code)]
22085            object: crate::__types::list_batches_response::Object,
22086        }
22087        let ListBatchesResponse {
22088            data,
22089            first_id,
22090            last_id,
22091            has_more,
22092            ..
22093        } = ListBatchesResponse::deserialize(deserializer)?;
22094        Ok(Self {
22095            data,
22096            first_id,
22097            last_id,
22098            has_more,
22099        })
22100    }
22101}
22102impl serde::Serialize for ListBatchesResponse {
22103    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
22104    where
22105        S: serde::Serializer,
22106    {
22107        #[serde_with::serde_as]
22108        #[derive(serde :: Serialize)]
22109        struct ListBatchesResponse<'a> {
22110            #[serde(rename = "data")]
22111            data: &'a Vec<crate::__types::Batch>,
22112            #[serde(rename = "first_id")]
22113            #[serde(skip_serializing_if = "Option::is_none")]
22114            first_id: &'a Option<String>,
22115            #[serde(rename = "last_id")]
22116            #[serde(skip_serializing_if = "Option::is_none")]
22117            last_id: &'a Option<String>,
22118            #[serde(rename = "has_more")]
22119            has_more: &'a bool,
22120            #[serde(rename = "object")]
22121            object: &'a crate::__types::list_batches_response::Object,
22122        }
22123        let Self {
22124            data,
22125            first_id,
22126            last_id,
22127            has_more,
22128        } = self;
22129        ListBatchesResponse {
22130            data,
22131            first_id,
22132            last_id,
22133            has_more,
22134            object: &Default::default(),
22135        }
22136        .serialize(serializer)
22137    }
22138}
22139#[allow(clippy::module_inception)]
22140pub(crate) mod list_certificates_response {
22141    #[doc = "list"]
22142    #[derive(Clone, Copy, Debug, Default, PartialEq)]
22143    pub(crate) struct Object;
22144    impl_serde!(Object, "list");
22145}
22146#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
22147pub struct ListCertificatesResponse {
22148    pub data: Vec<crate::__types::Certificate>,
22149    #[builder(default)]
22150    pub first_id: Option<String>,
22151    #[builder(default)]
22152    pub last_id: Option<String>,
22153    pub has_more: bool,
22154}
22155impl<'de> serde::Deserialize<'de> for ListCertificatesResponse {
22156    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
22157    where
22158        D: serde::Deserializer<'de>,
22159    {
22160        #[serde_with::serde_as]
22161        #[derive(serde :: Deserialize)]
22162        struct ListCertificatesResponse {
22163            #[serde(rename = "data")]
22164            data: Vec<crate::__types::Certificate>,
22165            #[serde(rename = "first_id")]
22166            first_id: Option<String>,
22167            #[serde(rename = "last_id")]
22168            last_id: Option<String>,
22169            #[serde(rename = "has_more")]
22170            has_more: bool,
22171            #[serde(rename = "object")]
22172            #[allow(dead_code)]
22173            object: crate::__types::list_certificates_response::Object,
22174        }
22175        let ListCertificatesResponse {
22176            data,
22177            first_id,
22178            last_id,
22179            has_more,
22180            ..
22181        } = ListCertificatesResponse::deserialize(deserializer)?;
22182        Ok(Self {
22183            data,
22184            first_id,
22185            last_id,
22186            has_more,
22187        })
22188    }
22189}
22190impl serde::Serialize for ListCertificatesResponse {
22191    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
22192    where
22193        S: serde::Serializer,
22194    {
22195        #[serde_with::serde_as]
22196        #[derive(serde :: Serialize)]
22197        struct ListCertificatesResponse<'a> {
22198            #[serde(rename = "data")]
22199            data: &'a Vec<crate::__types::Certificate>,
22200            #[serde(rename = "first_id")]
22201            #[serde(skip_serializing_if = "Option::is_none")]
22202            first_id: &'a Option<String>,
22203            #[serde(rename = "last_id")]
22204            #[serde(skip_serializing_if = "Option::is_none")]
22205            last_id: &'a Option<String>,
22206            #[serde(rename = "has_more")]
22207            has_more: &'a bool,
22208            #[serde(rename = "object")]
22209            object: &'a crate::__types::list_certificates_response::Object,
22210        }
22211        let Self {
22212            data,
22213            first_id,
22214            last_id,
22215            has_more,
22216        } = self;
22217        ListCertificatesResponse {
22218            data,
22219            first_id,
22220            last_id,
22221            has_more,
22222            object: &Default::default(),
22223        }
22224        .serialize(serializer)
22225    }
22226}
22227#[derive(Clone, Debug, PartialEq)]
22228#[serde_with::serde_as]
22229#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
22230pub struct ListFilesResponse {
22231    #[serde(rename = "object")]
22232    pub object: String,
22233    #[serde(rename = "data")]
22234    pub data: Vec<crate::__types::OpenAiFile>,
22235    #[serde(rename = "first_id")]
22236    pub first_id: String,
22237    #[serde(rename = "last_id")]
22238    pub last_id: String,
22239    #[serde(rename = "has_more")]
22240    pub has_more: bool,
22241}
22242#[allow(clippy::module_inception)]
22243pub(crate) mod list_fine_tuning_checkpoint_permission_response {
22244    #[doc = "list"]
22245    #[derive(Clone, Copy, Debug, Default, PartialEq)]
22246    pub(crate) struct Object;
22247    impl_serde!(Object, "list");
22248}
22249#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
22250pub struct ListFineTuningCheckpointPermissionResponse {
22251    pub data: Vec<crate::__types::FineTuningCheckpointPermission>,
22252    #[builder(default)]
22253    pub first_id: Option<String>,
22254    #[builder(default)]
22255    pub last_id: Option<String>,
22256    pub has_more: bool,
22257}
22258impl<'de> serde::Deserialize<'de> for ListFineTuningCheckpointPermissionResponse {
22259    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
22260    where
22261        D: serde::Deserializer<'de>,
22262    {
22263        #[serde_with::serde_as]
22264        #[derive(serde :: Deserialize)]
22265        struct ListFineTuningCheckpointPermissionResponse {
22266            #[serde(rename = "data")]
22267            data: Vec<crate::__types::FineTuningCheckpointPermission>,
22268            #[serde(rename = "object")]
22269            #[allow(dead_code)]
22270            object: crate::__types::list_fine_tuning_checkpoint_permission_response::Object,
22271            #[serde(rename = "first_id")]
22272            first_id: Option<String>,
22273            #[serde(rename = "last_id")]
22274            last_id: Option<String>,
22275            #[serde(rename = "has_more")]
22276            has_more: bool,
22277        }
22278        let ListFineTuningCheckpointPermissionResponse {
22279            data,
22280            first_id,
22281            last_id,
22282            has_more,
22283            ..
22284        } = ListFineTuningCheckpointPermissionResponse::deserialize(deserializer)?;
22285        Ok(Self {
22286            data,
22287            first_id,
22288            last_id,
22289            has_more,
22290        })
22291    }
22292}
22293impl serde::Serialize for ListFineTuningCheckpointPermissionResponse {
22294    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
22295    where
22296        S: serde::Serializer,
22297    {
22298        #[serde_with::serde_as]
22299        #[derive(serde :: Serialize)]
22300        struct ListFineTuningCheckpointPermissionResponse<'a> {
22301            #[serde(rename = "data")]
22302            data: &'a Vec<crate::__types::FineTuningCheckpointPermission>,
22303            #[serde(rename = "object")]
22304            object: &'a crate::__types::list_fine_tuning_checkpoint_permission_response::Object,
22305            #[serde(rename = "first_id")]
22306            #[serde(skip_serializing_if = "Option::is_none")]
22307            first_id: &'a Option<String>,
22308            #[serde(rename = "last_id")]
22309            #[serde(skip_serializing_if = "Option::is_none")]
22310            last_id: &'a Option<String>,
22311            #[serde(rename = "has_more")]
22312            has_more: &'a bool,
22313        }
22314        let Self {
22315            data,
22316            first_id,
22317            last_id,
22318            has_more,
22319        } = self;
22320        ListFineTuningCheckpointPermissionResponse {
22321            data,
22322            object: &Default::default(),
22323            first_id,
22324            last_id,
22325            has_more,
22326        }
22327        .serialize(serializer)
22328    }
22329}
22330#[allow(clippy::module_inception)]
22331pub(crate) mod list_fine_tuning_job_checkpoints_response {
22332    #[doc = "list"]
22333    #[derive(Clone, Copy, Debug, Default, PartialEq)]
22334    pub(crate) struct Object;
22335    impl_serde!(Object, "list");
22336}
22337#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
22338pub struct ListFineTuningJobCheckpointsResponse {
22339    pub data: Vec<crate::__types::FineTuningJobCheckpoint>,
22340    #[builder(default)]
22341    pub first_id: Option<String>,
22342    #[builder(default)]
22343    pub last_id: Option<String>,
22344    pub has_more: bool,
22345}
22346impl<'de> serde::Deserialize<'de> for ListFineTuningJobCheckpointsResponse {
22347    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
22348    where
22349        D: serde::Deserializer<'de>,
22350    {
22351        #[serde_with::serde_as]
22352        #[derive(serde :: Deserialize)]
22353        struct ListFineTuningJobCheckpointsResponse {
22354            #[serde(rename = "data")]
22355            data: Vec<crate::__types::FineTuningJobCheckpoint>,
22356            #[serde(rename = "object")]
22357            #[allow(dead_code)]
22358            object: crate::__types::list_fine_tuning_job_checkpoints_response::Object,
22359            #[serde(rename = "first_id")]
22360            first_id: Option<String>,
22361            #[serde(rename = "last_id")]
22362            last_id: Option<String>,
22363            #[serde(rename = "has_more")]
22364            has_more: bool,
22365        }
22366        let ListFineTuningJobCheckpointsResponse {
22367            data,
22368            first_id,
22369            last_id,
22370            has_more,
22371            ..
22372        } = ListFineTuningJobCheckpointsResponse::deserialize(deserializer)?;
22373        Ok(Self {
22374            data,
22375            first_id,
22376            last_id,
22377            has_more,
22378        })
22379    }
22380}
22381impl serde::Serialize for ListFineTuningJobCheckpointsResponse {
22382    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
22383    where
22384        S: serde::Serializer,
22385    {
22386        #[serde_with::serde_as]
22387        #[derive(serde :: Serialize)]
22388        struct ListFineTuningJobCheckpointsResponse<'a> {
22389            #[serde(rename = "data")]
22390            data: &'a Vec<crate::__types::FineTuningJobCheckpoint>,
22391            #[serde(rename = "object")]
22392            object: &'a crate::__types::list_fine_tuning_job_checkpoints_response::Object,
22393            #[serde(rename = "first_id")]
22394            #[serde(skip_serializing_if = "Option::is_none")]
22395            first_id: &'a Option<String>,
22396            #[serde(rename = "last_id")]
22397            #[serde(skip_serializing_if = "Option::is_none")]
22398            last_id: &'a Option<String>,
22399            #[serde(rename = "has_more")]
22400            has_more: &'a bool,
22401        }
22402        let Self {
22403            data,
22404            first_id,
22405            last_id,
22406            has_more,
22407        } = self;
22408        ListFineTuningJobCheckpointsResponse {
22409            data,
22410            object: &Default::default(),
22411            first_id,
22412            last_id,
22413            has_more,
22414        }
22415        .serialize(serializer)
22416    }
22417}
22418#[allow(clippy::module_inception)]
22419pub(crate) mod list_fine_tuning_job_events_response {
22420    #[doc = "list"]
22421    #[derive(Clone, Copy, Debug, Default, PartialEq)]
22422    pub(crate) struct Object;
22423    impl_serde!(Object, "list");
22424}
22425#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
22426pub struct ListFineTuningJobEventsResponse {
22427    pub data: Vec<crate::__types::FineTuningJobEvent>,
22428    pub has_more: bool,
22429}
22430impl<'de> serde::Deserialize<'de> for ListFineTuningJobEventsResponse {
22431    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
22432    where
22433        D: serde::Deserializer<'de>,
22434    {
22435        #[serde_with::serde_as]
22436        #[derive(serde :: Deserialize)]
22437        struct ListFineTuningJobEventsResponse {
22438            #[serde(rename = "data")]
22439            data: Vec<crate::__types::FineTuningJobEvent>,
22440            #[serde(rename = "object")]
22441            #[allow(dead_code)]
22442            object: crate::__types::list_fine_tuning_job_events_response::Object,
22443            #[serde(rename = "has_more")]
22444            has_more: bool,
22445        }
22446        let ListFineTuningJobEventsResponse { data, has_more, .. } =
22447            ListFineTuningJobEventsResponse::deserialize(deserializer)?;
22448        Ok(Self { data, has_more })
22449    }
22450}
22451impl serde::Serialize for ListFineTuningJobEventsResponse {
22452    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
22453    where
22454        S: serde::Serializer,
22455    {
22456        #[serde_with::serde_as]
22457        #[derive(serde :: Serialize)]
22458        struct ListFineTuningJobEventsResponse<'a> {
22459            #[serde(rename = "data")]
22460            data: &'a Vec<crate::__types::FineTuningJobEvent>,
22461            #[serde(rename = "object")]
22462            object: &'a crate::__types::list_fine_tuning_job_events_response::Object,
22463            #[serde(rename = "has_more")]
22464            has_more: &'a bool,
22465        }
22466        let Self { data, has_more } = self;
22467        ListFineTuningJobEventsResponse {
22468            data,
22469            object: &Default::default(),
22470            has_more,
22471        }
22472        .serialize(serializer)
22473    }
22474}
22475#[derive(Clone, Debug, PartialEq)]
22476#[serde_with::serde_as]
22477#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
22478pub struct ListMessagesResponse {
22479    #[serde(rename = "object")]
22480    pub object: String,
22481    #[serde(rename = "data")]
22482    pub data: Vec<crate::__types::MessageObject>,
22483    #[serde(rename = "first_id")]
22484    pub first_id: String,
22485    #[serde(rename = "last_id")]
22486    pub last_id: String,
22487    #[serde(rename = "has_more")]
22488    pub has_more: bool,
22489}
22490#[allow(clippy::module_inception)]
22491pub(crate) mod list_models_response {
22492    #[doc = "list"]
22493    #[derive(Clone, Copy, Debug, Default, PartialEq)]
22494    pub(crate) struct Object;
22495    impl_serde!(Object, "list");
22496}
22497#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
22498pub struct ListModelsResponse {
22499    pub data: Vec<crate::__types::Model>,
22500}
22501impl<'de> serde::Deserialize<'de> for ListModelsResponse {
22502    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
22503    where
22504        D: serde::Deserializer<'de>,
22505    {
22506        #[serde_with::serde_as]
22507        #[derive(serde :: Deserialize)]
22508        struct ListModelsResponse {
22509            #[serde(rename = "object")]
22510            #[allow(dead_code)]
22511            object: crate::__types::list_models_response::Object,
22512            #[serde(rename = "data")]
22513            data: Vec<crate::__types::Model>,
22514        }
22515        let ListModelsResponse { data, .. } = ListModelsResponse::deserialize(deserializer)?;
22516        Ok(Self { data })
22517    }
22518}
22519impl serde::Serialize for ListModelsResponse {
22520    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
22521    where
22522        S: serde::Serializer,
22523    {
22524        #[serde_with::serde_as]
22525        #[derive(serde :: Serialize)]
22526        struct ListModelsResponse<'a> {
22527            #[serde(rename = "object")]
22528            object: &'a crate::__types::list_models_response::Object,
22529            #[serde(rename = "data")]
22530            data: &'a Vec<crate::__types::Model>,
22531        }
22532        let Self { data } = self;
22533        ListModelsResponse {
22534            object: &Default::default(),
22535            data,
22536        }
22537        .serialize(serializer)
22538    }
22539}
22540#[allow(clippy::module_inception)]
22541pub(crate) mod list_paginated_fine_tuning_jobs_response {
22542    #[doc = "list"]
22543    #[derive(Clone, Copy, Debug, Default, PartialEq)]
22544    pub(crate) struct Object;
22545    impl_serde!(Object, "list");
22546}
22547#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
22548pub struct ListPaginatedFineTuningJobsResponse {
22549    pub data: Vec<crate::__types::FineTuningJob>,
22550    pub has_more: bool,
22551}
22552impl<'de> serde::Deserialize<'de> for ListPaginatedFineTuningJobsResponse {
22553    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
22554    where
22555        D: serde::Deserializer<'de>,
22556    {
22557        #[serde_with::serde_as]
22558        #[derive(serde :: Deserialize)]
22559        struct ListPaginatedFineTuningJobsResponse {
22560            #[serde(rename = "data")]
22561            data: Vec<crate::__types::FineTuningJob>,
22562            #[serde(rename = "has_more")]
22563            has_more: bool,
22564            #[serde(rename = "object")]
22565            #[allow(dead_code)]
22566            object: crate::__types::list_paginated_fine_tuning_jobs_response::Object,
22567        }
22568        let ListPaginatedFineTuningJobsResponse { data, has_more, .. } =
22569            ListPaginatedFineTuningJobsResponse::deserialize(deserializer)?;
22570        Ok(Self { data, has_more })
22571    }
22572}
22573impl serde::Serialize for ListPaginatedFineTuningJobsResponse {
22574    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
22575    where
22576        S: serde::Serializer,
22577    {
22578        #[serde_with::serde_as]
22579        #[derive(serde :: Serialize)]
22580        struct ListPaginatedFineTuningJobsResponse<'a> {
22581            #[serde(rename = "data")]
22582            data: &'a Vec<crate::__types::FineTuningJob>,
22583            #[serde(rename = "has_more")]
22584            has_more: &'a bool,
22585            #[serde(rename = "object")]
22586            object: &'a crate::__types::list_paginated_fine_tuning_jobs_response::Object,
22587        }
22588        let Self { data, has_more } = self;
22589        ListPaginatedFineTuningJobsResponse {
22590            data,
22591            has_more,
22592            object: &Default::default(),
22593        }
22594        .serialize(serializer)
22595    }
22596}
22597#[derive(Clone, Debug, PartialEq)]
22598#[serde_with::serde_as]
22599#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
22600pub struct ListRunStepsResponse {
22601    #[serde(rename = "object")]
22602    pub object: String,
22603    #[serde(rename = "data")]
22604    pub data: Vec<crate::__types::RunStepObject>,
22605    #[serde(rename = "first_id")]
22606    pub first_id: String,
22607    #[serde(rename = "last_id")]
22608    pub last_id: String,
22609    #[serde(rename = "has_more")]
22610    pub has_more: bool,
22611}
22612#[derive(Clone, Debug, PartialEq)]
22613#[serde_with::serde_as]
22614#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
22615pub struct ListRunsResponse {
22616    #[serde(rename = "object")]
22617    pub object: String,
22618    #[serde(rename = "data")]
22619    pub data: Vec<crate::__types::RunObject>,
22620    #[serde(rename = "first_id")]
22621    pub first_id: String,
22622    #[serde(rename = "last_id")]
22623    pub last_id: String,
22624    #[serde(rename = "has_more")]
22625    pub has_more: bool,
22626}
22627#[derive(Clone, Debug, PartialEq)]
22628#[serde_with::serde_as]
22629#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
22630pub struct ListVectorStoreFilesResponse {
22631    #[serde(rename = "object")]
22632    pub object: String,
22633    #[serde(rename = "data")]
22634    pub data: Vec<crate::__types::VectorStoreFileObject>,
22635    #[serde(rename = "first_id")]
22636    pub first_id: String,
22637    #[serde(rename = "last_id")]
22638    pub last_id: String,
22639    #[serde(rename = "has_more")]
22640    pub has_more: bool,
22641}
22642#[derive(Clone, Debug, PartialEq)]
22643#[serde_with::serde_as]
22644#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
22645pub struct ListVectorStoresResponse {
22646    #[serde(rename = "object")]
22647    pub object: String,
22648    #[serde(rename = "data")]
22649    pub data: Vec<crate::__types::VectorStoreObject>,
22650    #[serde(rename = "first_id")]
22651    pub first_id: String,
22652    #[serde(rename = "last_id")]
22653    pub last_id: String,
22654    #[serde(rename = "has_more")]
22655    pub has_more: bool,
22656}
22657#[allow(clippy::module_inception)]
22658pub(crate) mod local_shell_exec_action {
22659    #[doc = "The type of the local shell action. Always `exec`.\n"]
22660    #[derive(Clone, Copy, Debug, Default, PartialEq)]
22661    pub(crate) struct Type;
22662    impl_serde!(Type, "exec");
22663}
22664#[doc = "Execute a shell command on the server.\n"]
22665#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
22666pub struct LocalShellExecAction {
22667    #[doc = "The command to run.\n"]
22668    pub command: Vec<String>,
22669    #[doc = "Optional timeout in milliseconds for the command.\n"]
22670    #[builder(default)]
22671    pub timeout_ms: Option<i64>,
22672    #[doc = "Optional working directory to run the command in.\n"]
22673    #[builder(default)]
22674    pub working_directory: Option<String>,
22675    #[doc = "Environment variables to set for the command.\n"]
22676    pub env: indexmap::IndexMap<String, String>,
22677    #[doc = "Optional user to run the command as.\n"]
22678    #[builder(default)]
22679    pub user: Option<String>,
22680}
22681impl<'de> serde::Deserialize<'de> for LocalShellExecAction {
22682    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
22683    where
22684        D: serde::Deserializer<'de>,
22685    {
22686        #[serde_with::serde_as]
22687        #[derive(serde :: Deserialize)]
22688        struct LocalShellExecAction {
22689            #[serde(rename = "type")]
22690            #[allow(dead_code)]
22691            r#type: crate::__types::local_shell_exec_action::Type,
22692            #[serde(rename = "command")]
22693            command: Vec<String>,
22694            #[serde(rename = "timeout_ms")]
22695            timeout_ms: Option<i64>,
22696            #[serde(rename = "working_directory")]
22697            working_directory: Option<String>,
22698            #[serde(rename = "env")]
22699            env: indexmap::IndexMap<String, String>,
22700            #[serde(rename = "user")]
22701            user: Option<String>,
22702        }
22703        let LocalShellExecAction {
22704            command,
22705            timeout_ms,
22706            working_directory,
22707            env,
22708            user,
22709            ..
22710        } = LocalShellExecAction::deserialize(deserializer)?;
22711        Ok(Self {
22712            command,
22713            timeout_ms,
22714            working_directory,
22715            env,
22716            user,
22717        })
22718    }
22719}
22720impl serde::Serialize for LocalShellExecAction {
22721    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
22722    where
22723        S: serde::Serializer,
22724    {
22725        #[serde_with::serde_as]
22726        #[derive(serde :: Serialize)]
22727        struct LocalShellExecAction<'a> {
22728            #[serde(rename = "type")]
22729            r#type: &'a crate::__types::local_shell_exec_action::Type,
22730            #[serde(rename = "command")]
22731            command: &'a Vec<String>,
22732            #[serde(rename = "timeout_ms")]
22733            #[serde(skip_serializing_if = "Option::is_none")]
22734            timeout_ms: &'a Option<i64>,
22735            #[serde(rename = "working_directory")]
22736            #[serde(skip_serializing_if = "Option::is_none")]
22737            working_directory: &'a Option<String>,
22738            #[serde(rename = "env")]
22739            env: &'a indexmap::IndexMap<String, String>,
22740            #[serde(rename = "user")]
22741            #[serde(skip_serializing_if = "Option::is_none")]
22742            user: &'a Option<String>,
22743        }
22744        let Self {
22745            command,
22746            timeout_ms,
22747            working_directory,
22748            env,
22749            user,
22750        } = self;
22751        LocalShellExecAction {
22752            r#type: &Default::default(),
22753            command,
22754            timeout_ms,
22755            working_directory,
22756            env,
22757            user,
22758        }
22759        .serialize(serializer)
22760    }
22761}
22762#[allow(clippy::module_inception)]
22763pub(crate) mod local_shell_tool {
22764    #[doc = "The type of the local shell tool. Always `local_shell`."]
22765    #[derive(Clone, Copy, Debug, Default, PartialEq)]
22766    pub(crate) struct Type;
22767    impl_serde!(Type, "local_shell");
22768}
22769#[doc = "A tool that allows the model to execute shell commands in a local environment.\n"]
22770#[derive(Clone, Copy, Debug, Default, PartialEq, typed_builder :: TypedBuilder)]
22771pub struct LocalShellTool {}
22772impl<'de> serde::Deserialize<'de> for LocalShellTool {
22773    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
22774    where
22775        D: serde::Deserializer<'de>,
22776    {
22777        #[serde_with::serde_as]
22778        #[derive(serde :: Deserialize)]
22779        struct LocalShellTool {
22780            #[serde(rename = "type")]
22781            #[allow(dead_code)]
22782            r#type: crate::__types::local_shell_tool::Type,
22783        }
22784        let LocalShellTool { .. } = LocalShellTool::deserialize(deserializer)?;
22785        Ok(Self {})
22786    }
22787}
22788impl serde::Serialize for LocalShellTool {
22789    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
22790    where
22791        S: serde::Serializer,
22792    {
22793        #[serde_with::serde_as]
22794        #[derive(serde :: Serialize)]
22795        struct LocalShellTool<'a> {
22796            #[serde(rename = "type")]
22797            r#type: &'a crate::__types::local_shell_tool::Type,
22798        }
22799        let Self {} = self;
22800        LocalShellTool {
22801            r#type: &Default::default(),
22802        }
22803        .serialize(serializer)
22804    }
22805}
22806#[allow(clippy::module_inception)]
22807pub mod local_shell_tool_call {
22808    #[doc = "The type of the local shell call. Always `local_shell_call`.\n"]
22809    #[derive(Clone, Copy, Debug, Default, PartialEq)]
22810    pub(crate) struct Type;
22811    impl_serde!(Type, "local_shell_call");
22812    #[doc = "The status of the local shell call.\n"]
22813    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
22814    pub enum Status {
22815        #[doc = "`in_progress`"]
22816        #[serde(rename = "in_progress")]
22817        InProgress,
22818        #[doc = "`completed`"]
22819        #[serde(rename = "completed")]
22820        Completed,
22821        #[doc = "`incomplete`"]
22822        #[serde(rename = "incomplete")]
22823        Incomplete,
22824    }
22825}
22826#[doc = "A tool call to run a command on the local shell.\n"]
22827#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
22828pub struct LocalShellToolCall {
22829    #[doc = "The unique ID of the local shell call.\n"]
22830    pub id: String,
22831    #[doc = "The unique ID of the local shell tool call generated by the model.\n"]
22832    pub call_id: String,
22833    pub action: crate::__types::LocalShellExecAction,
22834    #[doc = "The status of the local shell call.\n"]
22835    pub status: crate::__types::local_shell_tool_call::Status,
22836}
22837impl<'de> serde::Deserialize<'de> for LocalShellToolCall {
22838    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
22839    where
22840        D: serde::Deserializer<'de>,
22841    {
22842        #[serde_with::serde_as]
22843        #[derive(serde :: Deserialize)]
22844        struct LocalShellToolCall {
22845            #[serde(rename = "type")]
22846            #[allow(dead_code)]
22847            r#type: crate::__types::local_shell_tool_call::Type,
22848            #[serde(rename = "id")]
22849            id: String,
22850            #[serde(rename = "call_id")]
22851            call_id: String,
22852            #[serde(rename = "action")]
22853            action: crate::__types::LocalShellExecAction,
22854            #[serde(rename = "status")]
22855            status: crate::__types::local_shell_tool_call::Status,
22856        }
22857        let LocalShellToolCall {
22858            id,
22859            call_id,
22860            action,
22861            status,
22862            ..
22863        } = LocalShellToolCall::deserialize(deserializer)?;
22864        Ok(Self {
22865            id,
22866            call_id,
22867            action,
22868            status,
22869        })
22870    }
22871}
22872impl serde::Serialize for LocalShellToolCall {
22873    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
22874    where
22875        S: serde::Serializer,
22876    {
22877        #[serde_with::serde_as]
22878        #[derive(serde :: Serialize)]
22879        struct LocalShellToolCall<'a> {
22880            #[serde(rename = "type")]
22881            r#type: &'a crate::__types::local_shell_tool_call::Type,
22882            #[serde(rename = "id")]
22883            id: &'a String,
22884            #[serde(rename = "call_id")]
22885            call_id: &'a String,
22886            #[serde(rename = "action")]
22887            action: &'a crate::__types::LocalShellExecAction,
22888            #[serde(rename = "status")]
22889            status: &'a crate::__types::local_shell_tool_call::Status,
22890        }
22891        let Self {
22892            id,
22893            call_id,
22894            action,
22895            status,
22896        } = self;
22897        LocalShellToolCall {
22898            r#type: &Default::default(),
22899            id,
22900            call_id,
22901            action,
22902            status,
22903        }
22904        .serialize(serializer)
22905    }
22906}
22907#[allow(clippy::module_inception)]
22908pub mod local_shell_tool_call_output {
22909    #[doc = "The type of the local shell tool call output. Always `local_shell_call_output`.\n"]
22910    #[derive(Clone, Copy, Debug, Default, PartialEq)]
22911    pub(crate) struct Type;
22912    impl_serde!(Type, "local_shell_call_output");
22913    #[doc = "The status of the item. One of `in_progress`, `completed`, or `incomplete`.\n"]
22914    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
22915    pub enum Status {
22916        #[doc = "`in_progress`"]
22917        #[serde(rename = "in_progress")]
22918        InProgress,
22919        #[doc = "`completed`"]
22920        #[serde(rename = "completed")]
22921        Completed,
22922        #[doc = "`incomplete`"]
22923        #[serde(rename = "incomplete")]
22924        Incomplete,
22925    }
22926}
22927#[doc = "The output of a local shell tool call.\n"]
22928#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
22929pub struct LocalShellToolCallOutput {
22930    #[doc = "The unique ID of the local shell tool call generated by the model.\n"]
22931    pub id: String,
22932    #[doc = "A JSON string of the output of the local shell tool call.\n"]
22933    pub output: String,
22934    #[doc = "The status of the item. One of `in_progress`, `completed`, or `incomplete`.\n"]
22935    #[builder(default)]
22936    pub status: Option<crate::__types::local_shell_tool_call_output::Status>,
22937    pub call_id: serde_json::Value,
22938}
22939impl<'de> serde::Deserialize<'de> for LocalShellToolCallOutput {
22940    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
22941    where
22942        D: serde::Deserializer<'de>,
22943    {
22944        #[serde_with::serde_as]
22945        #[derive(serde :: Deserialize)]
22946        struct LocalShellToolCallOutput {
22947            #[serde(rename = "type")]
22948            #[allow(dead_code)]
22949            r#type: crate::__types::local_shell_tool_call_output::Type,
22950            #[serde(rename = "id")]
22951            id: String,
22952            #[serde(rename = "output")]
22953            output: String,
22954            #[serde(rename = "status")]
22955            status: Option<crate::__types::local_shell_tool_call_output::Status>,
22956            #[serde(rename = "call_id")]
22957            call_id: serde_json::Value,
22958        }
22959        let LocalShellToolCallOutput {
22960            id,
22961            output,
22962            status,
22963            call_id,
22964            ..
22965        } = LocalShellToolCallOutput::deserialize(deserializer)?;
22966        Ok(Self {
22967            id,
22968            output,
22969            status,
22970            call_id,
22971        })
22972    }
22973}
22974impl serde::Serialize for LocalShellToolCallOutput {
22975    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
22976    where
22977        S: serde::Serializer,
22978    {
22979        #[serde_with::serde_as]
22980        #[derive(serde :: Serialize)]
22981        struct LocalShellToolCallOutput<'a> {
22982            #[serde(rename = "type")]
22983            r#type: &'a crate::__types::local_shell_tool_call_output::Type,
22984            #[serde(rename = "id")]
22985            id: &'a String,
22986            #[serde(rename = "output")]
22987            output: &'a String,
22988            #[serde(rename = "status")]
22989            #[serde(skip_serializing_if = "Option::is_none")]
22990            status: &'a Option<crate::__types::local_shell_tool_call_output::Status>,
22991            #[serde(rename = "call_id")]
22992            call_id: &'a serde_json::Value,
22993        }
22994        let Self {
22995            id,
22996            output,
22997            status,
22998            call_id,
22999        } = self;
23000        LocalShellToolCallOutput {
23001            r#type: &Default::default(),
23002            id,
23003            output,
23004            status,
23005            call_id,
23006        }
23007        .serialize(serializer)
23008    }
23009}
23010#[doc = "A log probability object.\n"]
23011#[derive(Clone, Debug, PartialEq)]
23012#[serde_with::serde_as]
23013#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
23014pub struct LogProbProperties {
23015    #[doc = "The token that was used to generate the log probability.\n"]
23016    #[serde(rename = "token")]
23017    pub token: String,
23018    #[doc = "The log probability of the token.\n"]
23019    #[serde(rename = "logprob")]
23020    pub logprob: serde_json::Number,
23021    #[doc = "The bytes that were used to generate the log probability.\n"]
23022    #[serde(rename = "bytes")]
23023    pub bytes: Vec<i64>,
23024}
23025#[allow(clippy::module_inception)]
23026pub(crate) mod mcp_approval_request {
23027    #[doc = "The type of the item. Always `mcp_approval_request`.\n"]
23028    #[derive(Clone, Copy, Debug, Default, PartialEq)]
23029    pub(crate) struct Type;
23030    impl_serde!(Type, "mcp_approval_request");
23031}
23032#[doc = "A request for human approval of a tool invocation.\n"]
23033#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
23034pub struct McpApprovalRequest {
23035    #[doc = "The unique ID of the approval request.\n"]
23036    pub id: String,
23037    #[doc = "The label of the MCP server making the request.\n"]
23038    pub server_label: String,
23039    #[doc = "The name of the tool to run.\n"]
23040    pub name: String,
23041    #[doc = "A JSON string of arguments for the tool.\n"]
23042    pub arguments: String,
23043}
23044impl<'de> serde::Deserialize<'de> for McpApprovalRequest {
23045    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
23046    where
23047        D: serde::Deserializer<'de>,
23048    {
23049        #[serde_with::serde_as]
23050        #[derive(serde :: Deserialize)]
23051        struct McpApprovalRequest {
23052            #[serde(rename = "type")]
23053            #[allow(dead_code)]
23054            r#type: crate::__types::mcp_approval_request::Type,
23055            #[serde(rename = "id")]
23056            id: String,
23057            #[serde(rename = "server_label")]
23058            server_label: String,
23059            #[serde(rename = "name")]
23060            name: String,
23061            #[serde(rename = "arguments")]
23062            arguments: String,
23063        }
23064        let McpApprovalRequest {
23065            id,
23066            server_label,
23067            name,
23068            arguments,
23069            ..
23070        } = McpApprovalRequest::deserialize(deserializer)?;
23071        Ok(Self {
23072            id,
23073            server_label,
23074            name,
23075            arguments,
23076        })
23077    }
23078}
23079impl serde::Serialize for McpApprovalRequest {
23080    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
23081    where
23082        S: serde::Serializer,
23083    {
23084        #[serde_with::serde_as]
23085        #[derive(serde :: Serialize)]
23086        struct McpApprovalRequest<'a> {
23087            #[serde(rename = "type")]
23088            r#type: &'a crate::__types::mcp_approval_request::Type,
23089            #[serde(rename = "id")]
23090            id: &'a String,
23091            #[serde(rename = "server_label")]
23092            server_label: &'a String,
23093            #[serde(rename = "name")]
23094            name: &'a String,
23095            #[serde(rename = "arguments")]
23096            arguments: &'a String,
23097        }
23098        let Self {
23099            id,
23100            server_label,
23101            name,
23102            arguments,
23103        } = self;
23104        McpApprovalRequest {
23105            r#type: &Default::default(),
23106            id,
23107            server_label,
23108            name,
23109            arguments,
23110        }
23111        .serialize(serializer)
23112    }
23113}
23114#[allow(clippy::module_inception)]
23115pub(crate) mod mcp_approval_response {
23116    #[doc = "The type of the item. Always `mcp_approval_response`.\n"]
23117    #[derive(Clone, Copy, Debug, Default, PartialEq)]
23118    pub(crate) struct Type;
23119    impl_serde!(Type, "mcp_approval_response");
23120}
23121#[doc = "A response to an MCP approval request.\n"]
23122#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
23123pub struct McpApprovalResponse {
23124    #[doc = "The unique ID of the approval response\n"]
23125    #[builder(default)]
23126    pub id: Option<String>,
23127    #[doc = "The ID of the approval request being answered.\n"]
23128    pub approval_request_id: String,
23129    #[doc = "Whether the request was approved.\n"]
23130    pub approve: bool,
23131    #[doc = "Optional reason for the decision.\n"]
23132    #[builder(default)]
23133    pub reason: Option<String>,
23134    pub request_id: serde_json::Value,
23135}
23136impl<'de> serde::Deserialize<'de> for McpApprovalResponse {
23137    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
23138    where
23139        D: serde::Deserializer<'de>,
23140    {
23141        #[serde_with::serde_as]
23142        #[derive(serde :: Deserialize)]
23143        struct McpApprovalResponse {
23144            #[serde(rename = "type")]
23145            #[allow(dead_code)]
23146            r#type: crate::__types::mcp_approval_response::Type,
23147            #[serde(rename = "id")]
23148            id: Option<String>,
23149            #[serde(rename = "approval_request_id")]
23150            approval_request_id: String,
23151            #[serde(rename = "approve")]
23152            approve: bool,
23153            #[serde(rename = "reason")]
23154            reason: Option<String>,
23155            #[serde(rename = "request_id")]
23156            request_id: serde_json::Value,
23157        }
23158        let McpApprovalResponse {
23159            id,
23160            approval_request_id,
23161            approve,
23162            reason,
23163            request_id,
23164            ..
23165        } = McpApprovalResponse::deserialize(deserializer)?;
23166        Ok(Self {
23167            id,
23168            approval_request_id,
23169            approve,
23170            reason,
23171            request_id,
23172        })
23173    }
23174}
23175impl serde::Serialize for McpApprovalResponse {
23176    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
23177    where
23178        S: serde::Serializer,
23179    {
23180        #[serde_with::serde_as]
23181        #[derive(serde :: Serialize)]
23182        struct McpApprovalResponse<'a> {
23183            #[serde(rename = "type")]
23184            r#type: &'a crate::__types::mcp_approval_response::Type,
23185            #[serde(rename = "id")]
23186            #[serde(skip_serializing_if = "Option::is_none")]
23187            id: &'a Option<String>,
23188            #[serde(rename = "approval_request_id")]
23189            approval_request_id: &'a String,
23190            #[serde(rename = "approve")]
23191            approve: &'a bool,
23192            #[serde(rename = "reason")]
23193            #[serde(skip_serializing_if = "Option::is_none")]
23194            reason: &'a Option<String>,
23195            #[serde(rename = "request_id")]
23196            request_id: &'a serde_json::Value,
23197        }
23198        let Self {
23199            id,
23200            approval_request_id,
23201            approve,
23202            reason,
23203            request_id,
23204        } = self;
23205        McpApprovalResponse {
23206            r#type: &Default::default(),
23207            id,
23208            approval_request_id,
23209            approve,
23210            reason,
23211            request_id,
23212        }
23213        .serialize(serializer)
23214    }
23215}
23216#[allow(clippy::module_inception)]
23217pub(crate) mod mcp_approval_response_resource {
23218    #[doc = "The type of the item. Always `mcp_approval_response`.\n"]
23219    #[derive(Clone, Copy, Debug, Default, PartialEq)]
23220    pub(crate) struct Type;
23221    impl_serde!(Type, "mcp_approval_response");
23222}
23223#[doc = "A response to an MCP approval request.\n"]
23224#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
23225pub struct McpApprovalResponseResource {
23226    #[doc = "The unique ID of the approval response\n"]
23227    pub id: String,
23228    #[doc = "The ID of the approval request being answered.\n"]
23229    pub approval_request_id: String,
23230    #[doc = "Whether the request was approved.\n"]
23231    pub approve: bool,
23232    #[doc = "Optional reason for the decision.\n"]
23233    #[builder(default)]
23234    pub reason: Option<String>,
23235    pub request_id: serde_json::Value,
23236}
23237impl<'de> serde::Deserialize<'de> for McpApprovalResponseResource {
23238    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
23239    where
23240        D: serde::Deserializer<'de>,
23241    {
23242        #[serde_with::serde_as]
23243        #[derive(serde :: Deserialize)]
23244        struct McpApprovalResponseResource {
23245            #[serde(rename = "type")]
23246            #[allow(dead_code)]
23247            r#type: crate::__types::mcp_approval_response_resource::Type,
23248            #[serde(rename = "id")]
23249            id: String,
23250            #[serde(rename = "approval_request_id")]
23251            approval_request_id: String,
23252            #[serde(rename = "approve")]
23253            approve: bool,
23254            #[serde(rename = "reason")]
23255            reason: Option<String>,
23256            #[serde(rename = "request_id")]
23257            request_id: serde_json::Value,
23258        }
23259        let McpApprovalResponseResource {
23260            id,
23261            approval_request_id,
23262            approve,
23263            reason,
23264            request_id,
23265            ..
23266        } = McpApprovalResponseResource::deserialize(deserializer)?;
23267        Ok(Self {
23268            id,
23269            approval_request_id,
23270            approve,
23271            reason,
23272            request_id,
23273        })
23274    }
23275}
23276impl serde::Serialize for McpApprovalResponseResource {
23277    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
23278    where
23279        S: serde::Serializer,
23280    {
23281        #[serde_with::serde_as]
23282        #[derive(serde :: Serialize)]
23283        struct McpApprovalResponseResource<'a> {
23284            #[serde(rename = "type")]
23285            r#type: &'a crate::__types::mcp_approval_response_resource::Type,
23286            #[serde(rename = "id")]
23287            id: &'a String,
23288            #[serde(rename = "approval_request_id")]
23289            approval_request_id: &'a String,
23290            #[serde(rename = "approve")]
23291            approve: &'a bool,
23292            #[serde(rename = "reason")]
23293            #[serde(skip_serializing_if = "Option::is_none")]
23294            reason: &'a Option<String>,
23295            #[serde(rename = "request_id")]
23296            request_id: &'a serde_json::Value,
23297        }
23298        let Self {
23299            id,
23300            approval_request_id,
23301            approve,
23302            reason,
23303            request_id,
23304        } = self;
23305        McpApprovalResponseResource {
23306            r#type: &Default::default(),
23307            id,
23308            approval_request_id,
23309            approve,
23310            reason,
23311            request_id,
23312        }
23313        .serialize(serializer)
23314    }
23315}
23316#[allow(clippy::module_inception)]
23317pub(crate) mod mcp_list_tools {
23318    #[doc = "The type of the item. Always `mcp_list_tools`.\n"]
23319    #[derive(Clone, Copy, Debug, Default, PartialEq)]
23320    pub(crate) struct Type;
23321    impl_serde!(Type, "mcp_list_tools");
23322}
23323#[doc = "A list of tools available on an MCP server.\n"]
23324#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
23325pub struct McpListTools {
23326    #[doc = "The unique ID of the list.\n"]
23327    pub id: String,
23328    #[doc = "The label of the MCP server.\n"]
23329    pub server_label: String,
23330    #[doc = "The tools available on the server.\n"]
23331    pub tools: Vec<crate::__types::McpListToolsTool>,
23332    #[doc = "Error message if the server could not list tools.\n"]
23333    #[builder(default)]
23334    pub error: Option<String>,
23335}
23336impl<'de> serde::Deserialize<'de> for McpListTools {
23337    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
23338    where
23339        D: serde::Deserializer<'de>,
23340    {
23341        #[serde_with::serde_as]
23342        #[derive(serde :: Deserialize)]
23343        struct McpListTools {
23344            #[serde(rename = "type")]
23345            #[allow(dead_code)]
23346            r#type: crate::__types::mcp_list_tools::Type,
23347            #[serde(rename = "id")]
23348            id: String,
23349            #[serde(rename = "server_label")]
23350            server_label: String,
23351            #[serde(rename = "tools")]
23352            tools: Vec<crate::__types::McpListToolsTool>,
23353            #[serde(rename = "error")]
23354            error: Option<String>,
23355        }
23356        let McpListTools {
23357            id,
23358            server_label,
23359            tools,
23360            error,
23361            ..
23362        } = McpListTools::deserialize(deserializer)?;
23363        Ok(Self {
23364            id,
23365            server_label,
23366            tools,
23367            error,
23368        })
23369    }
23370}
23371impl serde::Serialize for McpListTools {
23372    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
23373    where
23374        S: serde::Serializer,
23375    {
23376        #[serde_with::serde_as]
23377        #[derive(serde :: Serialize)]
23378        struct McpListTools<'a> {
23379            #[serde(rename = "type")]
23380            r#type: &'a crate::__types::mcp_list_tools::Type,
23381            #[serde(rename = "id")]
23382            id: &'a String,
23383            #[serde(rename = "server_label")]
23384            server_label: &'a String,
23385            #[serde(rename = "tools")]
23386            tools: &'a Vec<crate::__types::McpListToolsTool>,
23387            #[serde(rename = "error")]
23388            #[serde(skip_serializing_if = "Option::is_none")]
23389            error: &'a Option<String>,
23390        }
23391        let Self {
23392            id,
23393            server_label,
23394            tools,
23395            error,
23396        } = self;
23397        McpListTools {
23398            r#type: &Default::default(),
23399            id,
23400            server_label,
23401            tools,
23402            error,
23403        }
23404        .serialize(serializer)
23405    }
23406}
23407#[doc = "A tool available on an MCP server.\n"]
23408#[derive(Clone, Debug, PartialEq)]
23409#[serde_with::serde_as]
23410#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
23411pub struct McpListToolsTool {
23412    #[doc = "The name of the tool.\n"]
23413    #[serde(rename = "name")]
23414    pub name: String,
23415    #[doc = "The description of the tool.\n"]
23416    #[serde(rename = "description")]
23417    #[serde(skip_serializing_if = "Option::is_none")]
23418    #[builder(default)]
23419    pub description: Option<String>,
23420    #[doc = "The JSON schema describing the tool's input.\n"]
23421    #[serde(rename = "input_schema")]
23422    pub input_schema: indexmap::IndexMap<String, serde_json::Value>,
23423    #[doc = "Additional annotations about the tool.\n"]
23424    #[serde(rename = "annotations")]
23425    #[serde(skip_serializing_if = "Option::is_none")]
23426    #[builder(default)]
23427    pub annotations: Option<indexmap::IndexMap<String, serde_json::Value>>,
23428}
23429#[allow(clippy::module_inception)]
23430pub mod mcp_tool {
23431    #[doc = "The type of the MCP tool. Always `mcp`."]
23432    #[derive(Clone, Copy, Debug, Default, PartialEq)]
23433    pub(crate) struct Type;
23434    impl_serde!(Type, "mcp");
23435    #[doc = "Identifier for service connectors, like those available in ChatGPT. One of\n`server_url` or `connector_id` must be provided. Learn more about service\nconnectors [here](https://platform.openai.com/docs/guides/tools-remote-mcp#connectors).\n\nCurrently supported `connector_id` values are:\n\n- Dropbox: `connector_dropbox`\n- Gmail: `connector_gmail`\n- Google Calendar: `connector_googlecalendar`\n- Google Drive: `connector_googledrive`\n- Microsoft Teams: `connector_microsoftteams`\n- Outlook Calendar: `connector_outlookcalendar`\n- Outlook Email: `connector_outlookemail`\n- SharePoint: `connector_sharepoint`\n"]
23436    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
23437    pub enum ConnectorId {
23438        #[doc = "`connector_dropbox`"]
23439        #[serde(rename = "connector_dropbox")]
23440        ConnectorDropbox,
23441        #[doc = "`connector_gmail`"]
23442        #[serde(rename = "connector_gmail")]
23443        ConnectorGmail,
23444        #[doc = "`connector_googlecalendar`"]
23445        #[serde(rename = "connector_googlecalendar")]
23446        ConnectorGooglecalendar,
23447        #[doc = "`connector_googledrive`"]
23448        #[serde(rename = "connector_googledrive")]
23449        ConnectorGoogledrive,
23450        #[doc = "`connector_microsoftteams`"]
23451        #[serde(rename = "connector_microsoftteams")]
23452        ConnectorMicrosoftteams,
23453        #[doc = "`connector_outlookcalendar`"]
23454        #[serde(rename = "connector_outlookcalendar")]
23455        ConnectorOutlookcalendar,
23456        #[doc = "`connector_outlookemail`"]
23457        #[serde(rename = "connector_outlookemail")]
23458        ConnectorOutlookemail,
23459        #[doc = "`connector_sharepoint`"]
23460        #[serde(rename = "connector_sharepoint")]
23461        ConnectorSharepoint,
23462    }
23463    #[doc = "List of allowed tool names or a filter object.\n"]
23464    #[derive(Clone, Debug, PartialEq)]
23465    #[serde_with::serde_as]
23466    #[derive(serde :: Deserialize, serde :: Serialize)]
23467    #[serde(untagged)]
23468    #[allow(clippy::large_enum_variant)]
23469    pub enum AllowedTools {
23470        #[doc = "A string array of allowed tool names"]
23471        Array(Vec<String>),
23472        McpToolFilter(crate::__types::McpToolFilter),
23473    }
23474    #[allow(clippy::module_inception)]
23475    pub mod require_approval {
23476        #[doc = "Specify which of the MCP server's tools require approval. Can be\n`always`, `never`, or a filter object associated with tools\nthat require approval.\n"]
23477        #[derive(Clone, Debug, Default, PartialEq)]
23478        #[serde_with::serde_as]
23479        #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
23480        pub struct Variant0 {
23481            #[serde(rename = "always")]
23482            #[serde(skip_serializing_if = "Option::is_none")]
23483            #[builder(default)]
23484            pub always: Option<crate::__types::McpToolFilter>,
23485            #[serde(rename = "never")]
23486            #[serde(skip_serializing_if = "Option::is_none")]
23487            #[builder(default)]
23488            pub never: Option<crate::__types::McpToolFilter>,
23489        }
23490        #[doc = "always"]
23491        #[derive(Clone, Copy, Debug, Default, PartialEq)]
23492        pub(crate) struct Always;
23493        impl_serde!(Always, "always");
23494        #[doc = "never"]
23495        #[derive(Clone, Copy, Debug, Default, PartialEq)]
23496        pub(crate) struct Never;
23497        impl_serde!(Never, "never");
23498    }
23499    #[doc = "Specify which of the MCP server's tools require approval."]
23500    #[derive(Clone, Debug, PartialEq)]
23501    #[allow(clippy::large_enum_variant)]
23502    pub enum RequireApproval {
23503        #[doc = "Specify which of the MCP server's tools require approval. Can be\n`always`, `never`, or a filter object associated with tools\nthat require approval.\n"]
23504        Variant0(crate::__types::mcp_tool::require_approval::Variant0),
23505        #[doc = "always"]
23506        Always,
23507        #[doc = "never"]
23508        Never,
23509    }
23510    impl<'de> serde::Deserialize<'de> for RequireApproval {
23511        fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
23512        where
23513            D: serde::Deserializer<'de>,
23514        {
23515            #[serde_with::serde_as]
23516            #[derive(serde :: Deserialize)]
23517            #[serde(untagged)]
23518            #[allow(clippy::enum_variant_names, clippy::large_enum_variant)]
23519            enum RequireApproval {
23520                Always(crate::__types::mcp_tool::require_approval::Always),
23521                Never(crate::__types::mcp_tool::require_approval::Never),
23522                Variant0(crate::__types::mcp_tool::require_approval::Variant0),
23523            }
23524            Ok(match RequireApproval::deserialize(deserializer)? {
23525                RequireApproval::Variant0(v) => Self::Variant0(v),
23526                RequireApproval::Always(_) => Self::Always,
23527                RequireApproval::Never(_) => Self::Never,
23528            })
23529        }
23530    }
23531    impl serde::Serialize for RequireApproval {
23532        fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
23533        where
23534            S: serde::Serializer,
23535        {
23536            #[serde_with::serde_as]
23537            #[derive(serde :: Serialize)]
23538            #[serde(untagged)]
23539            #[allow(clippy::enum_variant_names)]
23540            enum RequireApproval<'a> {
23541                Variant0(&'a crate::__types::mcp_tool::require_approval::Variant0),
23542                Always(crate::__types::mcp_tool::require_approval::Always),
23543                Never(crate::__types::mcp_tool::require_approval::Never),
23544            }
23545            match self {
23546                Self::Variant0(v) => RequireApproval::Variant0(v),
23547                Self::Always => RequireApproval::Always(Default::default()),
23548                Self::Never => RequireApproval::Never(Default::default()),
23549            }
23550            .serialize(serializer)
23551        }
23552    }
23553}
23554#[doc = "Give the model access to additional tools via remote Model Context Protocol \n(MCP) servers. [Learn more about MCP](https://platform.openai.com/docs/guides/tools-remote-mcp).\n"]
23555#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
23556pub struct McpTool {
23557    #[doc = "A label for this MCP server, used to identify it in tool calls.\n"]
23558    pub server_label: String,
23559    #[doc = "The URL for the MCP server. One of `server_url` or `connector_id` must be \nprovided.\n"]
23560    #[builder(default)]
23561    pub server_url: Option<String>,
23562    #[doc = "Identifier for service connectors, like those available in ChatGPT. One of\n`server_url` or `connector_id` must be provided. Learn more about service\nconnectors [here](https://platform.openai.com/docs/guides/tools-remote-mcp#connectors).\n\nCurrently supported `connector_id` values are:\n\n- Dropbox: `connector_dropbox`\n- Gmail: `connector_gmail`\n- Google Calendar: `connector_googlecalendar`\n- Google Drive: `connector_googledrive`\n- Microsoft Teams: `connector_microsoftteams`\n- Outlook Calendar: `connector_outlookcalendar`\n- Outlook Email: `connector_outlookemail`\n- SharePoint: `connector_sharepoint`\n"]
23563    #[builder(default)]
23564    pub connector_id: Option<crate::__types::mcp_tool::ConnectorId>,
23565    #[doc = "An OAuth access token that can be used with a remote MCP server, either \nwith a custom MCP server URL or a service connector. Your application\nmust handle the OAuth authorization flow and provide the token here.\n"]
23566    #[builder(default)]
23567    pub authorization: Option<String>,
23568    #[doc = "Optional description of the MCP server, used to provide more context.\n"]
23569    #[builder(default)]
23570    pub server_description: Option<String>,
23571    #[doc = "Optional HTTP headers to send to the MCP server. Use for authentication\nor other purposes.\n"]
23572    #[builder(default)]
23573    pub headers: Option<indexmap::IndexMap<String, String>>,
23574    #[doc = "List of allowed tool names or a filter object.\n"]
23575    #[builder(default)]
23576    pub allowed_tools: Option<crate::__types::mcp_tool::AllowedTools>,
23577    #[doc = "Specify which of the MCP server's tools require approval."]
23578    #[builder(default)]
23579    pub require_approval: Option<crate::__types::mcp_tool::RequireApproval>,
23580}
23581impl<'de> serde::Deserialize<'de> for McpTool {
23582    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
23583    where
23584        D: serde::Deserializer<'de>,
23585    {
23586        #[serde_with::serde_as]
23587        #[derive(serde :: Deserialize)]
23588        struct McpTool {
23589            #[serde(rename = "type")]
23590            #[allow(dead_code)]
23591            r#type: crate::__types::mcp_tool::Type,
23592            #[serde(rename = "server_label")]
23593            server_label: String,
23594            #[serde(rename = "server_url")]
23595            server_url: Option<String>,
23596            #[serde(rename = "connector_id")]
23597            connector_id: Option<crate::__types::mcp_tool::ConnectorId>,
23598            #[serde(rename = "authorization")]
23599            authorization: Option<String>,
23600            #[serde(rename = "server_description")]
23601            server_description: Option<String>,
23602            #[serde(rename = "headers")]
23603            headers: Option<indexmap::IndexMap<String, String>>,
23604            #[serde(rename = "allowed_tools")]
23605            allowed_tools: Option<crate::__types::mcp_tool::AllowedTools>,
23606            #[serde(rename = "require_approval")]
23607            require_approval: Option<crate::__types::mcp_tool::RequireApproval>,
23608        }
23609        let McpTool {
23610            server_label,
23611            server_url,
23612            connector_id,
23613            authorization,
23614            server_description,
23615            headers,
23616            allowed_tools,
23617            require_approval,
23618            ..
23619        } = McpTool::deserialize(deserializer)?;
23620        Ok(Self {
23621            server_label,
23622            server_url,
23623            connector_id,
23624            authorization,
23625            server_description,
23626            headers,
23627            allowed_tools,
23628            require_approval,
23629        })
23630    }
23631}
23632impl serde::Serialize for McpTool {
23633    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
23634    where
23635        S: serde::Serializer,
23636    {
23637        #[serde_with::serde_as]
23638        #[derive(serde :: Serialize)]
23639        struct McpTool<'a> {
23640            #[serde(rename = "type")]
23641            r#type: &'a crate::__types::mcp_tool::Type,
23642            #[serde(rename = "server_label")]
23643            server_label: &'a String,
23644            #[serde(rename = "server_url")]
23645            #[serde(skip_serializing_if = "Option::is_none")]
23646            server_url: &'a Option<String>,
23647            #[serde(rename = "connector_id")]
23648            #[serde(skip_serializing_if = "Option::is_none")]
23649            connector_id: &'a Option<crate::__types::mcp_tool::ConnectorId>,
23650            #[serde(rename = "authorization")]
23651            #[serde(skip_serializing_if = "Option::is_none")]
23652            authorization: &'a Option<String>,
23653            #[serde(rename = "server_description")]
23654            #[serde(skip_serializing_if = "Option::is_none")]
23655            server_description: &'a Option<String>,
23656            #[serde(rename = "headers")]
23657            #[serde(skip_serializing_if = "Option::is_none")]
23658            headers: &'a Option<indexmap::IndexMap<String, String>>,
23659            #[serde(rename = "allowed_tools")]
23660            #[serde(skip_serializing_if = "Option::is_none")]
23661            allowed_tools: &'a Option<crate::__types::mcp_tool::AllowedTools>,
23662            #[serde(rename = "require_approval")]
23663            #[serde(skip_serializing_if = "Option::is_none")]
23664            require_approval: &'a Option<crate::__types::mcp_tool::RequireApproval>,
23665        }
23666        let Self {
23667            server_label,
23668            server_url,
23669            connector_id,
23670            authorization,
23671            server_description,
23672            headers,
23673            allowed_tools,
23674            require_approval,
23675        } = self;
23676        McpTool {
23677            r#type: &Default::default(),
23678            server_label,
23679            server_url,
23680            connector_id,
23681            authorization,
23682            server_description,
23683            headers,
23684            allowed_tools,
23685            require_approval,
23686        }
23687        .serialize(serializer)
23688    }
23689}
23690#[allow(clippy::module_inception)]
23691pub(crate) mod mcp_tool_call {
23692    #[doc = "The type of the item. Always `mcp_call`.\n"]
23693    #[derive(Clone, Copy, Debug, Default, PartialEq)]
23694    pub(crate) struct Type;
23695    impl_serde!(Type, "mcp_call");
23696}
23697#[doc = "An invocation of a tool on an MCP server.\n"]
23698#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
23699pub struct McpToolCall {
23700    #[doc = "The unique ID of the tool call.\n"]
23701    pub id: String,
23702    #[doc = "The label of the MCP server running the tool.\n"]
23703    pub server_label: String,
23704    #[doc = "The name of the tool that was run.\n"]
23705    pub name: String,
23706    #[doc = "A JSON string of the arguments passed to the tool.\n"]
23707    pub arguments: String,
23708    #[doc = "The output from the tool call.\n"]
23709    #[builder(default)]
23710    pub output: Option<String>,
23711    #[doc = "The error from the tool call, if any.\n"]
23712    #[builder(default)]
23713    pub error: Option<String>,
23714}
23715impl<'de> serde::Deserialize<'de> for McpToolCall {
23716    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
23717    where
23718        D: serde::Deserializer<'de>,
23719    {
23720        #[serde_with::serde_as]
23721        #[derive(serde :: Deserialize)]
23722        struct McpToolCall {
23723            #[serde(rename = "type")]
23724            #[allow(dead_code)]
23725            r#type: crate::__types::mcp_tool_call::Type,
23726            #[serde(rename = "id")]
23727            id: String,
23728            #[serde(rename = "server_label")]
23729            server_label: String,
23730            #[serde(rename = "name")]
23731            name: String,
23732            #[serde(rename = "arguments")]
23733            arguments: String,
23734            #[serde(rename = "output")]
23735            output: Option<String>,
23736            #[serde(rename = "error")]
23737            error: Option<String>,
23738        }
23739        let McpToolCall {
23740            id,
23741            server_label,
23742            name,
23743            arguments,
23744            output,
23745            error,
23746            ..
23747        } = McpToolCall::deserialize(deserializer)?;
23748        Ok(Self {
23749            id,
23750            server_label,
23751            name,
23752            arguments,
23753            output,
23754            error,
23755        })
23756    }
23757}
23758impl serde::Serialize for McpToolCall {
23759    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
23760    where
23761        S: serde::Serializer,
23762    {
23763        #[serde_with::serde_as]
23764        #[derive(serde :: Serialize)]
23765        struct McpToolCall<'a> {
23766            #[serde(rename = "type")]
23767            r#type: &'a crate::__types::mcp_tool_call::Type,
23768            #[serde(rename = "id")]
23769            id: &'a String,
23770            #[serde(rename = "server_label")]
23771            server_label: &'a String,
23772            #[serde(rename = "name")]
23773            name: &'a String,
23774            #[serde(rename = "arguments")]
23775            arguments: &'a String,
23776            #[serde(rename = "output")]
23777            #[serde(skip_serializing_if = "Option::is_none")]
23778            output: &'a Option<String>,
23779            #[serde(rename = "error")]
23780            #[serde(skip_serializing_if = "Option::is_none")]
23781            error: &'a Option<String>,
23782        }
23783        let Self {
23784            id,
23785            server_label,
23786            name,
23787            arguments,
23788            output,
23789            error,
23790        } = self;
23791        McpToolCall {
23792            r#type: &Default::default(),
23793            id,
23794            server_label,
23795            name,
23796            arguments,
23797            output,
23798            error,
23799        }
23800        .serialize(serializer)
23801    }
23802}
23803#[doc = "A filter object to specify which tools are allowed.\n"]
23804#[derive(Clone, Debug, Default, PartialEq)]
23805#[serde_with::serde_as]
23806#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
23807pub struct McpToolFilter {
23808    #[doc = "List of allowed tool names."]
23809    #[serde(rename = "tool_names")]
23810    #[serde(skip_serializing_if = "Option::is_none")]
23811    #[builder(default)]
23812    pub tool_names: Option<Vec<String>>,
23813    #[doc = "Indicates whether or not a tool modifies data or is read-only. If an\nMCP server is [annotated with `readOnlyHint`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),\nit will match this filter.\n"]
23814    #[serde(rename = "read_only")]
23815    #[serde(skip_serializing_if = "Option::is_none")]
23816    #[builder(default)]
23817    pub read_only: Option<bool>,
23818}
23819#[allow(clippy::module_inception)]
23820pub mod message_content_image_file_object {
23821    #[doc = "Always `image_file`."]
23822    #[derive(Clone, Copy, Debug, Default, PartialEq)]
23823    pub(crate) struct Type;
23824    impl_serde!(Type, "image_file");
23825    #[allow(clippy::module_inception)]
23826    pub mod image_file {
23827        #[doc = "Specifies the detail level of the image if specified by the user. `low` uses fewer tokens, you can opt in to high resolution using `high`."]
23828        #[derive(
23829            Clone, Copy, Debug, Default, PartialEq, serde :: Deserialize, serde :: Serialize,
23830        )]
23831        pub enum Detail {
23832            #[doc = "`auto`"]
23833            #[default]
23834            #[serde(rename = "auto")]
23835            Auto,
23836            #[doc = "`low`"]
23837            #[serde(rename = "low")]
23838            Low,
23839            #[doc = "`high`"]
23840            #[serde(rename = "high")]
23841            High,
23842        }
23843    }
23844    #[derive(Clone, Debug, PartialEq)]
23845    #[serde_with::serde_as]
23846    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
23847    pub struct ImageFile {
23848        #[doc = "The [File](https://platform.openai.com/docs/api-reference/files) ID of the image in the message content. Set `purpose=\"vision\"` when uploading the File if you need to later display the file content."]
23849        #[serde(rename = "file_id")]
23850        pub file_id: String,
23851        #[doc = "Specifies the detail level of the image if specified by the user. `low` uses fewer tokens, you can opt in to high resolution using `high`."]
23852        #[serde(rename = "detail")]
23853        #[serde(skip_serializing_if = "Option::is_none")]
23854        #[builder(default)]
23855        pub detail: Option<crate::__types::message_content_image_file_object::image_file::Detail>,
23856    }
23857}
23858#[doc = "References an image [File](https://platform.openai.com/docs/api-reference/files) in the content of a message."]
23859#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
23860pub struct MessageContentImageFileObject {
23861    pub image_file: crate::__types::message_content_image_file_object::ImageFile,
23862}
23863impl<'de> serde::Deserialize<'de> for MessageContentImageFileObject {
23864    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
23865    where
23866        D: serde::Deserializer<'de>,
23867    {
23868        #[serde_with::serde_as]
23869        #[derive(serde :: Deserialize)]
23870        struct MessageContentImageFileObject {
23871            #[serde(rename = "type")]
23872            #[allow(dead_code)]
23873            r#type: crate::__types::message_content_image_file_object::Type,
23874            #[serde(rename = "image_file")]
23875            image_file: crate::__types::message_content_image_file_object::ImageFile,
23876        }
23877        let MessageContentImageFileObject { image_file, .. } =
23878            MessageContentImageFileObject::deserialize(deserializer)?;
23879        Ok(Self { image_file })
23880    }
23881}
23882impl serde::Serialize for MessageContentImageFileObject {
23883    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
23884    where
23885        S: serde::Serializer,
23886    {
23887        #[serde_with::serde_as]
23888        #[derive(serde :: Serialize)]
23889        struct MessageContentImageFileObject<'a> {
23890            #[serde(rename = "type")]
23891            r#type: &'a crate::__types::message_content_image_file_object::Type,
23892            #[serde(rename = "image_file")]
23893            image_file: &'a crate::__types::message_content_image_file_object::ImageFile,
23894        }
23895        let Self { image_file } = self;
23896        MessageContentImageFileObject {
23897            r#type: &Default::default(),
23898            image_file,
23899        }
23900        .serialize(serializer)
23901    }
23902}
23903#[allow(clippy::module_inception)]
23904pub mod message_content_image_url_object {
23905    #[doc = "The type of the content part."]
23906    #[derive(Clone, Copy, Debug, Default, PartialEq)]
23907    pub(crate) struct Type;
23908    impl_serde!(Type, "image_url");
23909    #[allow(clippy::module_inception)]
23910    pub mod image_url {
23911        #[doc = "Specifies the detail level of the image. `low` uses fewer tokens, you can opt in to high resolution using `high`. Default value is `auto`"]
23912        #[derive(
23913            Clone, Copy, Debug, Default, PartialEq, serde :: Deserialize, serde :: Serialize,
23914        )]
23915        pub enum Detail {
23916            #[doc = "`auto`"]
23917            #[default]
23918            #[serde(rename = "auto")]
23919            Auto,
23920            #[doc = "`low`"]
23921            #[serde(rename = "low")]
23922            Low,
23923            #[doc = "`high`"]
23924            #[serde(rename = "high")]
23925            High,
23926        }
23927    }
23928    #[derive(Clone, Debug, PartialEq)]
23929    #[serde_with::serde_as]
23930    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
23931    pub struct ImageUrl {
23932        #[doc = "The external URL of the image, must be a supported image types: jpeg, jpg, png, gif, webp."]
23933        #[serde(rename = "url")]
23934        pub url: String,
23935        #[doc = "Specifies the detail level of the image. `low` uses fewer tokens, you can opt in to high resolution using `high`. Default value is `auto`"]
23936        #[serde(rename = "detail")]
23937        #[serde(skip_serializing_if = "Option::is_none")]
23938        #[builder(default)]
23939        pub detail: Option<crate::__types::message_content_image_url_object::image_url::Detail>,
23940    }
23941}
23942#[doc = "References an image URL in the content of a message."]
23943#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
23944pub struct MessageContentImageUrlObject {
23945    pub image_url: crate::__types::message_content_image_url_object::ImageUrl,
23946}
23947impl<'de> serde::Deserialize<'de> for MessageContentImageUrlObject {
23948    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
23949    where
23950        D: serde::Deserializer<'de>,
23951    {
23952        #[serde_with::serde_as]
23953        #[derive(serde :: Deserialize)]
23954        struct MessageContentImageUrlObject {
23955            #[serde(rename = "type")]
23956            #[allow(dead_code)]
23957            r#type: crate::__types::message_content_image_url_object::Type,
23958            #[serde(rename = "image_url")]
23959            image_url: crate::__types::message_content_image_url_object::ImageUrl,
23960        }
23961        let MessageContentImageUrlObject { image_url, .. } =
23962            MessageContentImageUrlObject::deserialize(deserializer)?;
23963        Ok(Self { image_url })
23964    }
23965}
23966impl serde::Serialize for MessageContentImageUrlObject {
23967    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
23968    where
23969        S: serde::Serializer,
23970    {
23971        #[serde_with::serde_as]
23972        #[derive(serde :: Serialize)]
23973        struct MessageContentImageUrlObject<'a> {
23974            #[serde(rename = "type")]
23975            r#type: &'a crate::__types::message_content_image_url_object::Type,
23976            #[serde(rename = "image_url")]
23977            image_url: &'a crate::__types::message_content_image_url_object::ImageUrl,
23978        }
23979        let Self { image_url } = self;
23980        MessageContentImageUrlObject {
23981            r#type: &Default::default(),
23982            image_url,
23983        }
23984        .serialize(serializer)
23985    }
23986}
23987#[allow(clippy::module_inception)]
23988pub(crate) mod message_content_refusal_object {
23989    #[doc = "Always `refusal`."]
23990    #[derive(Clone, Copy, Debug, Default, PartialEq)]
23991    pub(crate) struct Type;
23992    impl_serde!(Type, "refusal");
23993}
23994#[doc = "The refusal content generated by the assistant."]
23995#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
23996pub struct MessageContentRefusalObject {
23997    pub refusal: String,
23998}
23999impl<'de> serde::Deserialize<'de> for MessageContentRefusalObject {
24000    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
24001    where
24002        D: serde::Deserializer<'de>,
24003    {
24004        #[serde_with::serde_as]
24005        #[derive(serde :: Deserialize)]
24006        struct MessageContentRefusalObject {
24007            #[serde(rename = "type")]
24008            #[allow(dead_code)]
24009            r#type: crate::__types::message_content_refusal_object::Type,
24010            #[serde(rename = "refusal")]
24011            refusal: String,
24012        }
24013        let MessageContentRefusalObject { refusal, .. } =
24014            MessageContentRefusalObject::deserialize(deserializer)?;
24015        Ok(Self { refusal })
24016    }
24017}
24018impl serde::Serialize for MessageContentRefusalObject {
24019    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
24020    where
24021        S: serde::Serializer,
24022    {
24023        #[serde_with::serde_as]
24024        #[derive(serde :: Serialize)]
24025        struct MessageContentRefusalObject<'a> {
24026            #[serde(rename = "type")]
24027            r#type: &'a crate::__types::message_content_refusal_object::Type,
24028            #[serde(rename = "refusal")]
24029            refusal: &'a String,
24030        }
24031        let Self { refusal } = self;
24032        MessageContentRefusalObject {
24033            r#type: &Default::default(),
24034            refusal,
24035        }
24036        .serialize(serializer)
24037    }
24038}
24039#[allow(clippy::module_inception)]
24040pub mod message_content_text_annotations_file_citation_object {
24041    #[doc = "Always `file_citation`."]
24042    #[derive(Clone, Copy, Debug, Default, PartialEq)]
24043    pub(crate) struct Type;
24044    impl_serde!(Type, "file_citation");
24045    #[derive(Clone, Debug, PartialEq)]
24046    #[serde_with::serde_as]
24047    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
24048    pub struct FileCitation {
24049        #[doc = "The ID of the specific File the citation is from."]
24050        #[serde(rename = "file_id")]
24051        pub file_id: String,
24052    }
24053}
24054#[doc = "A citation within the message that points to a specific quote from a specific File associated with the assistant or the message. Generated when the assistant uses the \"file_search\" tool to search files."]
24055#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
24056pub struct MessageContentTextAnnotationsFileCitationObject {
24057    #[doc = "The text in the message content that needs to be replaced."]
24058    pub text: String,
24059    pub file_citation:
24060        crate::__types::message_content_text_annotations_file_citation_object::FileCitation,
24061    pub start_index: i64,
24062    pub end_index: i64,
24063}
24064impl<'de> serde::Deserialize<'de> for MessageContentTextAnnotationsFileCitationObject {
24065    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
24066    where
24067        D: serde::Deserializer<'de>,
24068    {
24069        #[serde_with::serde_as]
24070        #[derive(serde :: Deserialize)]
24071        struct MessageContentTextAnnotationsFileCitationObject {
24072            #[serde(rename = "type")]
24073            #[allow(dead_code)]
24074            r#type: crate::__types::message_content_text_annotations_file_citation_object::Type,
24075            #[serde(rename = "text")]
24076            text: String,
24077            #[serde(rename = "file_citation")]
24078            file_citation:
24079                crate::__types::message_content_text_annotations_file_citation_object::FileCitation,
24080            #[serde(rename = "start_index")]
24081            start_index: i64,
24082            #[serde(rename = "end_index")]
24083            end_index: i64,
24084        }
24085        let MessageContentTextAnnotationsFileCitationObject {
24086            text,
24087            file_citation,
24088            start_index,
24089            end_index,
24090            ..
24091        } = MessageContentTextAnnotationsFileCitationObject::deserialize(deserializer)?;
24092        Ok(Self {
24093            text,
24094            file_citation,
24095            start_index,
24096            end_index,
24097        })
24098    }
24099}
24100impl serde::Serialize for MessageContentTextAnnotationsFileCitationObject {
24101    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
24102    where
24103        S: serde::Serializer,
24104    {
24105        #[serde_with::serde_as]
24106        #[derive(serde :: Serialize)]
24107        struct MessageContentTextAnnotationsFileCitationObject < 'a > { # [serde (rename = "type")] r#type : & 'a crate :: __types :: message_content_text_annotations_file_citation_object :: Type , # [serde (rename = "text")] text : & 'a String , # [serde (rename = "file_citation")] file_citation : & 'a crate :: __types :: message_content_text_annotations_file_citation_object :: FileCitation , # [serde (rename = "start_index")] start_index : & 'a i64 , # [serde (rename = "end_index")] end_index : & 'a i64 }
24108        let Self {
24109            text,
24110            file_citation,
24111            start_index,
24112            end_index,
24113        } = self;
24114        MessageContentTextAnnotationsFileCitationObject {
24115            r#type: &Default::default(),
24116            text,
24117            file_citation,
24118            start_index,
24119            end_index,
24120        }
24121        .serialize(serializer)
24122    }
24123}
24124#[allow(clippy::module_inception)]
24125pub mod message_content_text_annotations_file_path_object {
24126    #[doc = "Always `file_path`."]
24127    #[derive(Clone, Copy, Debug, Default, PartialEq)]
24128    pub(crate) struct Type;
24129    impl_serde!(Type, "file_path");
24130    #[derive(Clone, Debug, PartialEq)]
24131    #[serde_with::serde_as]
24132    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
24133    pub struct FilePath {
24134        #[doc = "The ID of the file that was generated."]
24135        #[serde(rename = "file_id")]
24136        pub file_id: String,
24137    }
24138}
24139#[doc = "A URL for the file that's generated when the assistant used the `code_interpreter` tool to generate a file."]
24140#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
24141pub struct MessageContentTextAnnotationsFilePathObject {
24142    #[doc = "The text in the message content that needs to be replaced."]
24143    pub text: String,
24144    pub file_path: crate::__types::message_content_text_annotations_file_path_object::FilePath,
24145    pub start_index: i64,
24146    pub end_index: i64,
24147}
24148impl<'de> serde::Deserialize<'de> for MessageContentTextAnnotationsFilePathObject {
24149    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
24150    where
24151        D: serde::Deserializer<'de>,
24152    {
24153        #[serde_with::serde_as]
24154        #[derive(serde :: Deserialize)]
24155        struct MessageContentTextAnnotationsFilePathObject {
24156            #[serde(rename = "type")]
24157            #[allow(dead_code)]
24158            r#type: crate::__types::message_content_text_annotations_file_path_object::Type,
24159            #[serde(rename = "text")]
24160            text: String,
24161            #[serde(rename = "file_path")]
24162            file_path: crate::__types::message_content_text_annotations_file_path_object::FilePath,
24163            #[serde(rename = "start_index")]
24164            start_index: i64,
24165            #[serde(rename = "end_index")]
24166            end_index: i64,
24167        }
24168        let MessageContentTextAnnotationsFilePathObject {
24169            text,
24170            file_path,
24171            start_index,
24172            end_index,
24173            ..
24174        } = MessageContentTextAnnotationsFilePathObject::deserialize(deserializer)?;
24175        Ok(Self {
24176            text,
24177            file_path,
24178            start_index,
24179            end_index,
24180        })
24181    }
24182}
24183impl serde::Serialize for MessageContentTextAnnotationsFilePathObject {
24184    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
24185    where
24186        S: serde::Serializer,
24187    {
24188        #[serde_with::serde_as]
24189        #[derive(serde :: Serialize)]
24190        struct MessageContentTextAnnotationsFilePathObject<'a> {
24191            #[serde(rename = "type")]
24192            r#type: &'a crate::__types::message_content_text_annotations_file_path_object::Type,
24193            #[serde(rename = "text")]
24194            text: &'a String,
24195            #[serde(rename = "file_path")]
24196            file_path:
24197                &'a crate::__types::message_content_text_annotations_file_path_object::FilePath,
24198            #[serde(rename = "start_index")]
24199            start_index: &'a i64,
24200            #[serde(rename = "end_index")]
24201            end_index: &'a i64,
24202        }
24203        let Self {
24204            text,
24205            file_path,
24206            start_index,
24207            end_index,
24208        } = self;
24209        MessageContentTextAnnotationsFilePathObject {
24210            r#type: &Default::default(),
24211            text,
24212            file_path,
24213            start_index,
24214            end_index,
24215        }
24216        .serialize(serializer)
24217    }
24218}
24219#[allow(clippy::module_inception)]
24220pub mod message_content_text_object {
24221    #[doc = "Always `text`."]
24222    #[derive(Clone, Copy, Debug, Default, PartialEq)]
24223    pub(crate) struct Type;
24224    impl_serde!(Type, "text");
24225    #[derive(Clone, Debug, PartialEq)]
24226    #[serde_with::serde_as]
24227    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
24228    pub struct Text {
24229        #[doc = "The data that makes up the text."]
24230        #[serde(rename = "value")]
24231        pub value: String,
24232        #[serde(rename = "annotations")]
24233        pub annotations: Vec<crate::__types::TextAnnotation>,
24234    }
24235}
24236#[doc = "The text content that is part of a message."]
24237#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
24238pub struct MessageContentTextObject {
24239    pub text: crate::__types::message_content_text_object::Text,
24240}
24241impl<'de> serde::Deserialize<'de> for MessageContentTextObject {
24242    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
24243    where
24244        D: serde::Deserializer<'de>,
24245    {
24246        #[serde_with::serde_as]
24247        #[derive(serde :: Deserialize)]
24248        struct MessageContentTextObject {
24249            #[serde(rename = "type")]
24250            #[allow(dead_code)]
24251            r#type: crate::__types::message_content_text_object::Type,
24252            #[serde(rename = "text")]
24253            text: crate::__types::message_content_text_object::Text,
24254        }
24255        let MessageContentTextObject { text, .. } =
24256            MessageContentTextObject::deserialize(deserializer)?;
24257        Ok(Self { text })
24258    }
24259}
24260impl serde::Serialize for MessageContentTextObject {
24261    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
24262    where
24263        S: serde::Serializer,
24264    {
24265        #[serde_with::serde_as]
24266        #[derive(serde :: Serialize)]
24267        struct MessageContentTextObject<'a> {
24268            #[serde(rename = "type")]
24269            r#type: &'a crate::__types::message_content_text_object::Type,
24270            #[serde(rename = "text")]
24271            text: &'a crate::__types::message_content_text_object::Text,
24272        }
24273        let Self { text } = self;
24274        MessageContentTextObject {
24275            r#type: &Default::default(),
24276            text,
24277        }
24278        .serialize(serializer)
24279    }
24280}
24281#[allow(clippy::module_inception)]
24282pub mod message_delta_content_image_file_object {
24283    #[doc = "Always `image_file`."]
24284    #[derive(Clone, Copy, Debug, Default, PartialEq)]
24285    pub(crate) struct Type;
24286    impl_serde!(Type, "image_file");
24287    #[allow(clippy::module_inception)]
24288    pub mod image_file {
24289        #[doc = "Specifies the detail level of the image if specified by the user. `low` uses fewer tokens, you can opt in to high resolution using `high`."]
24290        #[derive(
24291            Clone, Copy, Debug, Default, PartialEq, serde :: Deserialize, serde :: Serialize,
24292        )]
24293        pub enum Detail {
24294            #[doc = "`auto`"]
24295            #[default]
24296            #[serde(rename = "auto")]
24297            Auto,
24298            #[doc = "`low`"]
24299            #[serde(rename = "low")]
24300            Low,
24301            #[doc = "`high`"]
24302            #[serde(rename = "high")]
24303            High,
24304        }
24305    }
24306    #[derive(Clone, Debug, Default, PartialEq)]
24307    #[serde_with::serde_as]
24308    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
24309    pub struct ImageFile {
24310        #[doc = "The [File](https://platform.openai.com/docs/api-reference/files) ID of the image in the message content. Set `purpose=\"vision\"` when uploading the File if you need to later display the file content."]
24311        #[serde(rename = "file_id")]
24312        #[serde(skip_serializing_if = "Option::is_none")]
24313        #[builder(default)]
24314        pub file_id: Option<String>,
24315        #[doc = "Specifies the detail level of the image if specified by the user. `low` uses fewer tokens, you can opt in to high resolution using `high`."]
24316        #[serde(rename = "detail")]
24317        #[serde(skip_serializing_if = "Option::is_none")]
24318        #[builder(default)]
24319        pub detail:
24320            Option<crate::__types::message_delta_content_image_file_object::image_file::Detail>,
24321    }
24322}
24323#[doc = "References an image [File](https://platform.openai.com/docs/api-reference/files) in the content of a message."]
24324#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
24325pub struct MessageDeltaContentImageFileObject {
24326    #[doc = "The index of the content part in the message."]
24327    pub index: i64,
24328    #[builder(default)]
24329    pub image_file: Option<crate::__types::message_delta_content_image_file_object::ImageFile>,
24330}
24331impl<'de> serde::Deserialize<'de> for MessageDeltaContentImageFileObject {
24332    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
24333    where
24334        D: serde::Deserializer<'de>,
24335    {
24336        #[serde_with::serde_as]
24337        #[derive(serde :: Deserialize)]
24338        struct MessageDeltaContentImageFileObject {
24339            #[serde(rename = "index")]
24340            index: i64,
24341            #[serde(rename = "type")]
24342            #[allow(dead_code)]
24343            r#type: crate::__types::message_delta_content_image_file_object::Type,
24344            #[serde(rename = "image_file")]
24345            image_file: Option<crate::__types::message_delta_content_image_file_object::ImageFile>,
24346        }
24347        let MessageDeltaContentImageFileObject {
24348            index, image_file, ..
24349        } = MessageDeltaContentImageFileObject::deserialize(deserializer)?;
24350        Ok(Self { index, image_file })
24351    }
24352}
24353impl serde::Serialize for MessageDeltaContentImageFileObject {
24354    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
24355    where
24356        S: serde::Serializer,
24357    {
24358        #[serde_with::serde_as]
24359        #[derive(serde :: Serialize)]
24360        struct MessageDeltaContentImageFileObject<'a> {
24361            #[serde(rename = "index")]
24362            index: &'a i64,
24363            #[serde(rename = "type")]
24364            r#type: &'a crate::__types::message_delta_content_image_file_object::Type,
24365            #[serde(rename = "image_file")]
24366            #[serde(skip_serializing_if = "Option::is_none")]
24367            image_file:
24368                &'a Option<crate::__types::message_delta_content_image_file_object::ImageFile>,
24369        }
24370        let Self { index, image_file } = self;
24371        MessageDeltaContentImageFileObject {
24372            index,
24373            r#type: &Default::default(),
24374            image_file,
24375        }
24376        .serialize(serializer)
24377    }
24378}
24379#[allow(clippy::module_inception)]
24380pub mod message_delta_content_image_url_object {
24381    #[doc = "Always `image_url`."]
24382    #[derive(Clone, Copy, Debug, Default, PartialEq)]
24383    pub(crate) struct Type;
24384    impl_serde!(Type, "image_url");
24385    #[allow(clippy::module_inception)]
24386    pub mod image_url {
24387        #[doc = "Specifies the detail level of the image. `low` uses fewer tokens, you can opt in to high resolution using `high`."]
24388        #[derive(
24389            Clone, Copy, Debug, Default, PartialEq, serde :: Deserialize, serde :: Serialize,
24390        )]
24391        pub enum Detail {
24392            #[doc = "`auto`"]
24393            #[default]
24394            #[serde(rename = "auto")]
24395            Auto,
24396            #[doc = "`low`"]
24397            #[serde(rename = "low")]
24398            Low,
24399            #[doc = "`high`"]
24400            #[serde(rename = "high")]
24401            High,
24402        }
24403    }
24404    #[derive(Clone, Debug, Default, PartialEq)]
24405    #[serde_with::serde_as]
24406    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
24407    pub struct ImageUrl {
24408        #[doc = "The URL of the image, must be a supported image types: jpeg, jpg, png, gif, webp."]
24409        #[serde(rename = "url")]
24410        #[serde(skip_serializing_if = "Option::is_none")]
24411        #[builder(default)]
24412        pub url: Option<String>,
24413        #[doc = "Specifies the detail level of the image. `low` uses fewer tokens, you can opt in to high resolution using `high`."]
24414        #[serde(rename = "detail")]
24415        #[serde(skip_serializing_if = "Option::is_none")]
24416        #[builder(default)]
24417        pub detail:
24418            Option<crate::__types::message_delta_content_image_url_object::image_url::Detail>,
24419    }
24420}
24421#[doc = "References an image URL in the content of a message."]
24422#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
24423pub struct MessageDeltaContentImageUrlObject {
24424    #[doc = "The index of the content part in the message."]
24425    pub index: i64,
24426    #[builder(default)]
24427    pub image_url: Option<crate::__types::message_delta_content_image_url_object::ImageUrl>,
24428}
24429impl<'de> serde::Deserialize<'de> for MessageDeltaContentImageUrlObject {
24430    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
24431    where
24432        D: serde::Deserializer<'de>,
24433    {
24434        #[serde_with::serde_as]
24435        #[derive(serde :: Deserialize)]
24436        struct MessageDeltaContentImageUrlObject {
24437            #[serde(rename = "index")]
24438            index: i64,
24439            #[serde(rename = "type")]
24440            #[allow(dead_code)]
24441            r#type: crate::__types::message_delta_content_image_url_object::Type,
24442            #[serde(rename = "image_url")]
24443            image_url: Option<crate::__types::message_delta_content_image_url_object::ImageUrl>,
24444        }
24445        let MessageDeltaContentImageUrlObject {
24446            index, image_url, ..
24447        } = MessageDeltaContentImageUrlObject::deserialize(deserializer)?;
24448        Ok(Self { index, image_url })
24449    }
24450}
24451impl serde::Serialize for MessageDeltaContentImageUrlObject {
24452    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
24453    where
24454        S: serde::Serializer,
24455    {
24456        #[serde_with::serde_as]
24457        #[derive(serde :: Serialize)]
24458        struct MessageDeltaContentImageUrlObject<'a> {
24459            #[serde(rename = "index")]
24460            index: &'a i64,
24461            #[serde(rename = "type")]
24462            r#type: &'a crate::__types::message_delta_content_image_url_object::Type,
24463            #[serde(rename = "image_url")]
24464            #[serde(skip_serializing_if = "Option::is_none")]
24465            image_url: &'a Option<crate::__types::message_delta_content_image_url_object::ImageUrl>,
24466        }
24467        let Self { index, image_url } = self;
24468        MessageDeltaContentImageUrlObject {
24469            index,
24470            r#type: &Default::default(),
24471            image_url,
24472        }
24473        .serialize(serializer)
24474    }
24475}
24476#[allow(clippy::module_inception)]
24477pub(crate) mod message_delta_content_refusal_object {
24478    #[doc = "Always `refusal`."]
24479    #[derive(Clone, Copy, Debug, Default, PartialEq)]
24480    pub(crate) struct Type;
24481    impl_serde!(Type, "refusal");
24482}
24483#[doc = "The refusal content that is part of a message."]
24484#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
24485pub struct MessageDeltaContentRefusalObject {
24486    #[doc = "The index of the refusal part in the message."]
24487    pub index: i64,
24488    #[builder(default)]
24489    pub refusal: Option<String>,
24490}
24491impl<'de> serde::Deserialize<'de> for MessageDeltaContentRefusalObject {
24492    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
24493    where
24494        D: serde::Deserializer<'de>,
24495    {
24496        #[serde_with::serde_as]
24497        #[derive(serde :: Deserialize)]
24498        struct MessageDeltaContentRefusalObject {
24499            #[serde(rename = "index")]
24500            index: i64,
24501            #[serde(rename = "type")]
24502            #[allow(dead_code)]
24503            r#type: crate::__types::message_delta_content_refusal_object::Type,
24504            #[serde(rename = "refusal")]
24505            refusal: Option<String>,
24506        }
24507        let MessageDeltaContentRefusalObject { index, refusal, .. } =
24508            MessageDeltaContentRefusalObject::deserialize(deserializer)?;
24509        Ok(Self { index, refusal })
24510    }
24511}
24512impl serde::Serialize for MessageDeltaContentRefusalObject {
24513    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
24514    where
24515        S: serde::Serializer,
24516    {
24517        #[serde_with::serde_as]
24518        #[derive(serde :: Serialize)]
24519        struct MessageDeltaContentRefusalObject<'a> {
24520            #[serde(rename = "index")]
24521            index: &'a i64,
24522            #[serde(rename = "type")]
24523            r#type: &'a crate::__types::message_delta_content_refusal_object::Type,
24524            #[serde(rename = "refusal")]
24525            #[serde(skip_serializing_if = "Option::is_none")]
24526            refusal: &'a Option<String>,
24527        }
24528        let Self { index, refusal } = self;
24529        MessageDeltaContentRefusalObject {
24530            index,
24531            r#type: &Default::default(),
24532            refusal,
24533        }
24534        .serialize(serializer)
24535    }
24536}
24537#[allow(clippy::module_inception)]
24538pub mod message_delta_content_text_annotations_file_citation_object {
24539    #[doc = "Always `file_citation`."]
24540    #[derive(Clone, Copy, Debug, Default, PartialEq)]
24541    pub(crate) struct Type;
24542    impl_serde!(Type, "file_citation");
24543    #[derive(Clone, Debug, Default, PartialEq)]
24544    #[serde_with::serde_as]
24545    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
24546    pub struct FileCitation {
24547        #[doc = "The ID of the specific File the citation is from."]
24548        #[serde(rename = "file_id")]
24549        #[serde(skip_serializing_if = "Option::is_none")]
24550        #[builder(default)]
24551        pub file_id: Option<String>,
24552        #[doc = "The specific quote in the file."]
24553        #[serde(rename = "quote")]
24554        #[serde(skip_serializing_if = "Option::is_none")]
24555        #[builder(default)]
24556        pub quote: Option<String>,
24557    }
24558}
24559#[doc = "A citation within the message that points to a specific quote from a specific File associated with the assistant or the message. Generated when the assistant uses the \"file_search\" tool to search files."]
24560#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
24561pub struct MessageDeltaContentTextAnnotationsFileCitationObject {
24562    #[doc = "The index of the annotation in the text content part."]
24563    pub index: i64,
24564    #[doc = "The text in the message content that needs to be replaced."]
24565    #[builder(default)]
24566    pub text: Option<String>,
24567    #[builder(default)]
24568    pub file_citation: Option<
24569        crate::__types::message_delta_content_text_annotations_file_citation_object::FileCitation,
24570    >,
24571    #[builder(default)]
24572    pub start_index: Option<i64>,
24573    #[builder(default)]
24574    pub end_index: Option<i64>,
24575}
24576impl<'de> serde::Deserialize<'de> for MessageDeltaContentTextAnnotationsFileCitationObject {
24577    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
24578    where
24579        D: serde::Deserializer<'de>,
24580    {
24581        #[serde_with::serde_as]
24582        #[derive(serde :: Deserialize)]
24583        struct MessageDeltaContentTextAnnotationsFileCitationObject { # [serde (rename = "index")] index : i64 , # [serde (rename = "type")] # [allow (dead_code)] r#type : crate :: __types :: message_delta_content_text_annotations_file_citation_object :: Type , # [serde (rename = "text")] text : Option < String > , # [serde (rename = "file_citation")] file_citation : Option < crate :: __types :: message_delta_content_text_annotations_file_citation_object :: FileCitation > , # [serde (rename = "start_index")] start_index : Option < i64 > , # [serde (rename = "end_index")] end_index : Option < i64 > }
24584        let MessageDeltaContentTextAnnotationsFileCitationObject {
24585            index,
24586            text,
24587            file_citation,
24588            start_index,
24589            end_index,
24590            ..
24591        } = MessageDeltaContentTextAnnotationsFileCitationObject::deserialize(deserializer)?;
24592        Ok(Self {
24593            index,
24594            text,
24595            file_citation,
24596            start_index,
24597            end_index,
24598        })
24599    }
24600}
24601impl serde::Serialize for MessageDeltaContentTextAnnotationsFileCitationObject {
24602    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
24603    where
24604        S: serde::Serializer,
24605    {
24606        #[serde_with::serde_as]
24607        #[derive(serde :: Serialize)]
24608        struct MessageDeltaContentTextAnnotationsFileCitationObject < 'a > { # [serde (rename = "index")] index : & 'a i64 , # [serde (rename = "type")] r#type : & 'a crate :: __types :: message_delta_content_text_annotations_file_citation_object :: Type , # [serde (rename = "text")] # [serde (skip_serializing_if = "Option::is_none")] text : & 'a Option < String > , # [serde (rename = "file_citation")] # [serde (skip_serializing_if = "Option::is_none")] file_citation : & 'a Option < crate :: __types :: message_delta_content_text_annotations_file_citation_object :: FileCitation > , # [serde (rename = "start_index")] # [serde (skip_serializing_if = "Option::is_none")] start_index : & 'a Option < i64 > , # [serde (rename = "end_index")] # [serde (skip_serializing_if = "Option::is_none")] end_index : & 'a Option < i64 > }
24609        let Self {
24610            index,
24611            text,
24612            file_citation,
24613            start_index,
24614            end_index,
24615        } = self;
24616        MessageDeltaContentTextAnnotationsFileCitationObject {
24617            index,
24618            r#type: &Default::default(),
24619            text,
24620            file_citation,
24621            start_index,
24622            end_index,
24623        }
24624        .serialize(serializer)
24625    }
24626}
24627#[allow(clippy::module_inception)]
24628pub mod message_delta_content_text_annotations_file_path_object {
24629    #[doc = "Always `file_path`."]
24630    #[derive(Clone, Copy, Debug, Default, PartialEq)]
24631    pub(crate) struct Type;
24632    impl_serde!(Type, "file_path");
24633    #[derive(Clone, Debug, Default, PartialEq)]
24634    #[serde_with::serde_as]
24635    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
24636    pub struct FilePath {
24637        #[doc = "The ID of the file that was generated."]
24638        #[serde(rename = "file_id")]
24639        #[serde(skip_serializing_if = "Option::is_none")]
24640        #[builder(default)]
24641        pub file_id: Option<String>,
24642    }
24643}
24644#[doc = "A URL for the file that's generated when the assistant used the `code_interpreter` tool to generate a file."]
24645#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
24646pub struct MessageDeltaContentTextAnnotationsFilePathObject {
24647    #[doc = "The index of the annotation in the text content part."]
24648    pub index: i64,
24649    #[doc = "The text in the message content that needs to be replaced."]
24650    #[builder(default)]
24651    pub text: Option<String>,
24652    #[builder(default)]
24653    pub file_path:
24654        Option<crate::__types::message_delta_content_text_annotations_file_path_object::FilePath>,
24655    #[builder(default)]
24656    pub start_index: Option<i64>,
24657    #[builder(default)]
24658    pub end_index: Option<i64>,
24659}
24660impl<'de> serde::Deserialize<'de> for MessageDeltaContentTextAnnotationsFilePathObject {
24661    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
24662    where
24663        D: serde::Deserializer<'de>,
24664    {
24665        #[serde_with::serde_as]
24666        #[derive(serde :: Deserialize)]
24667        struct MessageDeltaContentTextAnnotationsFilePathObject {
24668            #[serde(rename = "index")]
24669            index: i64,
24670            #[serde(rename = "type")]
24671            #[allow(dead_code)]
24672            r#type: crate::__types::message_delta_content_text_annotations_file_path_object::Type,
24673            #[serde(rename = "text")]
24674            text: Option<String>,
24675            #[serde(rename = "file_path")]
24676            file_path: Option<
24677                crate::__types::message_delta_content_text_annotations_file_path_object::FilePath,
24678            >,
24679            #[serde(rename = "start_index")]
24680            start_index: Option<i64>,
24681            #[serde(rename = "end_index")]
24682            end_index: Option<i64>,
24683        }
24684        let MessageDeltaContentTextAnnotationsFilePathObject {
24685            index,
24686            text,
24687            file_path,
24688            start_index,
24689            end_index,
24690            ..
24691        } = MessageDeltaContentTextAnnotationsFilePathObject::deserialize(deserializer)?;
24692        Ok(Self {
24693            index,
24694            text,
24695            file_path,
24696            start_index,
24697            end_index,
24698        })
24699    }
24700}
24701impl serde::Serialize for MessageDeltaContentTextAnnotationsFilePathObject {
24702    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
24703    where
24704        S: serde::Serializer,
24705    {
24706        #[serde_with::serde_as]
24707        #[derive(serde :: Serialize)]
24708        struct MessageDeltaContentTextAnnotationsFilePathObject<'a> {
24709            #[serde(rename = "index")]
24710            index: &'a i64,
24711            #[serde(rename = "type")]
24712            r#type:
24713                &'a crate::__types::message_delta_content_text_annotations_file_path_object::Type,
24714            #[serde(rename = "text")]
24715            #[serde(skip_serializing_if = "Option::is_none")]
24716            text: &'a Option<String>,
24717            #[serde(rename = "file_path")]
24718            #[serde(skip_serializing_if = "Option::is_none")]
24719            file_path: &'a Option<
24720                crate::__types::message_delta_content_text_annotations_file_path_object::FilePath,
24721            >,
24722            #[serde(rename = "start_index")]
24723            #[serde(skip_serializing_if = "Option::is_none")]
24724            start_index: &'a Option<i64>,
24725            #[serde(rename = "end_index")]
24726            #[serde(skip_serializing_if = "Option::is_none")]
24727            end_index: &'a Option<i64>,
24728        }
24729        let Self {
24730            index,
24731            text,
24732            file_path,
24733            start_index,
24734            end_index,
24735        } = self;
24736        MessageDeltaContentTextAnnotationsFilePathObject {
24737            index,
24738            r#type: &Default::default(),
24739            text,
24740            file_path,
24741            start_index,
24742            end_index,
24743        }
24744        .serialize(serializer)
24745    }
24746}
24747#[allow(clippy::module_inception)]
24748pub mod message_delta_content_text_object {
24749    #[doc = "Always `text`."]
24750    #[derive(Clone, Copy, Debug, Default, PartialEq)]
24751    pub(crate) struct Type;
24752    impl_serde!(Type, "text");
24753    #[derive(Clone, Debug, Default, PartialEq)]
24754    #[serde_with::serde_as]
24755    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
24756    pub struct Text {
24757        #[doc = "The data that makes up the text."]
24758        #[serde(rename = "value")]
24759        #[serde(skip_serializing_if = "Option::is_none")]
24760        #[builder(default)]
24761        pub value: Option<String>,
24762        #[serde(rename = "annotations")]
24763        #[serde(skip_serializing_if = "Option::is_none")]
24764        #[builder(default)]
24765        pub annotations: Option<Vec<crate::__types::TextAnnotationDelta>>,
24766    }
24767}
24768#[doc = "The text content that is part of a message."]
24769#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
24770pub struct MessageDeltaContentTextObject {
24771    #[doc = "The index of the content part in the message."]
24772    pub index: i64,
24773    #[builder(default)]
24774    pub text: Option<crate::__types::message_delta_content_text_object::Text>,
24775}
24776impl<'de> serde::Deserialize<'de> for MessageDeltaContentTextObject {
24777    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
24778    where
24779        D: serde::Deserializer<'de>,
24780    {
24781        #[serde_with::serde_as]
24782        #[derive(serde :: Deserialize)]
24783        struct MessageDeltaContentTextObject {
24784            #[serde(rename = "index")]
24785            index: i64,
24786            #[serde(rename = "type")]
24787            #[allow(dead_code)]
24788            r#type: crate::__types::message_delta_content_text_object::Type,
24789            #[serde(rename = "text")]
24790            text: Option<crate::__types::message_delta_content_text_object::Text>,
24791        }
24792        let MessageDeltaContentTextObject { index, text, .. } =
24793            MessageDeltaContentTextObject::deserialize(deserializer)?;
24794        Ok(Self { index, text })
24795    }
24796}
24797impl serde::Serialize for MessageDeltaContentTextObject {
24798    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
24799    where
24800        S: serde::Serializer,
24801    {
24802        #[serde_with::serde_as]
24803        #[derive(serde :: Serialize)]
24804        struct MessageDeltaContentTextObject<'a> {
24805            #[serde(rename = "index")]
24806            index: &'a i64,
24807            #[serde(rename = "type")]
24808            r#type: &'a crate::__types::message_delta_content_text_object::Type,
24809            #[serde(rename = "text")]
24810            #[serde(skip_serializing_if = "Option::is_none")]
24811            text: &'a Option<crate::__types::message_delta_content_text_object::Text>,
24812        }
24813        let Self { index, text } = self;
24814        MessageDeltaContentTextObject {
24815            index,
24816            r#type: &Default::default(),
24817            text,
24818        }
24819        .serialize(serializer)
24820    }
24821}
24822#[allow(clippy::module_inception)]
24823pub mod message_delta_object {
24824    #[doc = "The object type, which is always `thread.message.delta`."]
24825    #[derive(Clone, Copy, Debug, Default, PartialEq)]
24826    pub(crate) struct Object;
24827    impl_serde!(Object, "thread.message.delta");
24828    #[allow(clippy::module_inception)]
24829    pub mod delta {
24830        #[doc = "The entity that produced the message. One of `user` or `assistant`."]
24831        #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
24832        pub enum Role {
24833            #[doc = "`user`"]
24834            #[serde(rename = "user")]
24835            User,
24836            #[doc = "`assistant`"]
24837            #[serde(rename = "assistant")]
24838            Assistant,
24839        }
24840    }
24841    #[doc = "The delta containing the fields that have changed on the Message."]
24842    #[derive(Clone, Debug, Default, PartialEq)]
24843    #[serde_with::serde_as]
24844    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
24845    pub struct Delta {
24846        #[doc = "The entity that produced the message. One of `user` or `assistant`."]
24847        #[serde(rename = "role")]
24848        #[serde(skip_serializing_if = "Option::is_none")]
24849        #[builder(default)]
24850        pub role: Option<crate::__types::message_delta_object::delta::Role>,
24851        #[doc = "The content of the message in array of text and/or images."]
24852        #[serde(rename = "content")]
24853        #[serde(skip_serializing_if = "Option::is_none")]
24854        #[builder(default)]
24855        pub content: Option<Vec<crate::__types::MessageContentDelta>>,
24856    }
24857}
24858#[doc = "Represents a message delta i.e. any changed fields on a message during streaming.\n"]
24859#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
24860pub struct MessageDeltaObject {
24861    #[doc = "The identifier of the message, which can be referenced in API endpoints."]
24862    pub id: String,
24863    #[doc = "The delta containing the fields that have changed on the Message."]
24864    #[builder(default)]
24865    pub delta: crate::__types::message_delta_object::Delta,
24866}
24867impl<'de> serde::Deserialize<'de> for MessageDeltaObject {
24868    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
24869    where
24870        D: serde::Deserializer<'de>,
24871    {
24872        #[serde_with::serde_as]
24873        #[derive(serde :: Deserialize)]
24874        struct MessageDeltaObject {
24875            #[serde(rename = "id")]
24876            id: String,
24877            #[serde(rename = "object")]
24878            #[allow(dead_code)]
24879            object: crate::__types::message_delta_object::Object,
24880            #[serde(rename = "delta")]
24881            delta: crate::__types::message_delta_object::Delta,
24882        }
24883        let MessageDeltaObject { id, delta, .. } = MessageDeltaObject::deserialize(deserializer)?;
24884        Ok(Self { id, delta })
24885    }
24886}
24887impl serde::Serialize for MessageDeltaObject {
24888    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
24889    where
24890        S: serde::Serializer,
24891    {
24892        #[serde_with::serde_as]
24893        #[derive(serde :: Serialize)]
24894        struct MessageDeltaObject<'a> {
24895            #[serde(rename = "id")]
24896            id: &'a String,
24897            #[serde(rename = "object")]
24898            object: &'a crate::__types::message_delta_object::Object,
24899            #[serde(rename = "delta")]
24900            delta: &'a crate::__types::message_delta_object::Delta,
24901        }
24902        let Self { id, delta } = self;
24903        MessageDeltaObject {
24904            id,
24905            object: &Default::default(),
24906            delta,
24907        }
24908        .serialize(serializer)
24909    }
24910}
24911#[allow(clippy::module_inception)]
24912pub mod message_object {
24913    #[doc = "The object type, which is always `thread.message`."]
24914    #[derive(Clone, Copy, Debug, Default, PartialEq)]
24915    pub(crate) struct Object;
24916    impl_serde!(Object, "thread.message");
24917    #[doc = "The status of the message, which can be either `in_progress`, `incomplete`, or `completed`."]
24918    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
24919    pub enum Status {
24920        #[doc = "`in_progress`"]
24921        #[serde(rename = "in_progress")]
24922        InProgress,
24923        #[doc = "`incomplete`"]
24924        #[serde(rename = "incomplete")]
24925        Incomplete,
24926        #[doc = "`completed`"]
24927        #[serde(rename = "completed")]
24928        Completed,
24929    }
24930    #[allow(clippy::module_inception)]
24931    pub mod incomplete_details {
24932        #[doc = "The reason the message is incomplete."]
24933        #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
24934        pub enum Reason {
24935            #[doc = "`content_filter`"]
24936            #[serde(rename = "content_filter")]
24937            ContentFilter,
24938            #[doc = "`max_tokens`"]
24939            #[serde(rename = "max_tokens")]
24940            MaxTokens,
24941            #[doc = "`run_cancelled`"]
24942            #[serde(rename = "run_cancelled")]
24943            RunCancelled,
24944            #[doc = "`run_expired`"]
24945            #[serde(rename = "run_expired")]
24946            RunExpired,
24947            #[doc = "`run_failed`"]
24948            #[serde(rename = "run_failed")]
24949            RunFailed,
24950        }
24951    }
24952    #[doc = "On an incomplete message, details about why the message is incomplete."]
24953    #[derive(Clone, Copy, Debug, PartialEq)]
24954    #[serde_with::serde_as]
24955    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
24956    pub struct IncompleteDetails {
24957        #[doc = "The reason the message is incomplete."]
24958        #[serde(rename = "reason")]
24959        pub reason: crate::__types::message_object::incomplete_details::Reason,
24960    }
24961    #[doc = "The entity that produced the message. One of `user` or `assistant`."]
24962    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
24963    pub enum Role {
24964        #[doc = "`user`"]
24965        #[serde(rename = "user")]
24966        User,
24967        #[doc = "`assistant`"]
24968        #[serde(rename = "assistant")]
24969        Assistant,
24970    }
24971    #[allow(clippy::module_inception)]
24972    pub mod attachments {
24973        #[allow(clippy::module_inception)]
24974        pub mod item {
24975            #[allow(clippy::module_inception)]
24976            pub mod tools {
24977                #[derive(Clone, Copy, Debug, PartialEq)]
24978                #[serde_with::serde_as]
24979                #[derive(serde :: Deserialize, serde :: Serialize)]
24980                #[serde(untagged)]
24981                #[allow(clippy::large_enum_variant)]
24982                pub enum Item {
24983                    CodeInterpreter(crate::__types::AssistantToolsCode),
24984                    FileSearch(crate::__types::AssistantToolsFileSearchTypeOnly),
24985                }
24986            }
24987        }
24988        #[derive(Clone, Debug, Default, PartialEq)]
24989        #[serde_with::serde_as]
24990        #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
24991        pub struct Item {
24992            #[doc = "The ID of the file to attach to the message."]
24993            #[serde(rename = "file_id")]
24994            #[serde(skip_serializing_if = "Option::is_none")]
24995            #[builder(default)]
24996            pub file_id: Option<String>,
24997            #[doc = "The tools to add this file to."]
24998            #[serde(rename = "tools")]
24999            #[serde(skip_serializing_if = "Option::is_none")]
25000            #[builder(default)]
25001            pub tools: Option<Vec<crate::__types::message_object::attachments::item::tools::Item>>,
25002        }
25003    }
25004}
25005#[doc = "Represents a message within a [thread](https://platform.openai.com/docs/api-reference/threads)."]
25006#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
25007pub struct MessageObject {
25008    #[doc = "The identifier, which can be referenced in API endpoints."]
25009    pub id: String,
25010    #[doc = "The Unix timestamp (in seconds) for when the message was created."]
25011    pub created_at: i64,
25012    #[doc = "The [thread](https://platform.openai.com/docs/api-reference/threads) ID that this message belongs to."]
25013    pub thread_id: String,
25014    #[doc = "The status of the message, which can be either `in_progress`, `incomplete`, or `completed`."]
25015    pub status: crate::__types::message_object::Status,
25016    #[doc = "On an incomplete message, details about why the message is incomplete."]
25017    #[builder(default)]
25018    pub incomplete_details: Option<crate::__types::message_object::IncompleteDetails>,
25019    #[doc = "The Unix timestamp (in seconds) for when the message was completed."]
25020    #[builder(default)]
25021    pub completed_at: Option<i64>,
25022    #[doc = "The Unix timestamp (in seconds) for when the message was marked as incomplete."]
25023    #[builder(default)]
25024    pub incomplete_at: Option<i64>,
25025    #[doc = "The entity that produced the message. One of `user` or `assistant`."]
25026    pub role: crate::__types::message_object::Role,
25027    #[doc = "The content of the message in array of text and/or images."]
25028    pub content: Vec<crate::__types::MessageContent>,
25029    #[doc = "If applicable, the ID of the [assistant](https://platform.openai.com/docs/api-reference/assistants) that authored this message."]
25030    #[builder(default)]
25031    pub assistant_id: Option<String>,
25032    #[doc = "The ID of the [run](https://platform.openai.com/docs/api-reference/runs) associated with the creation of this message. Value is `null` when messages are created manually using the create message or create thread endpoints."]
25033    #[builder(default)]
25034    pub run_id: Option<String>,
25035    #[doc = "A list of files attached to the message, and the tools they were added to."]
25036    #[builder(default)]
25037    pub attachments: Option<Vec<crate::__types::message_object::attachments::Item>>,
25038    #[builder(default)]
25039    pub metadata: Option<crate::__types::Metadata>,
25040}
25041impl<'de> serde::Deserialize<'de> for MessageObject {
25042    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
25043    where
25044        D: serde::Deserializer<'de>,
25045    {
25046        #[serde_with::serde_as]
25047        #[derive(serde :: Deserialize)]
25048        struct MessageObject {
25049            #[serde(rename = "id")]
25050            id: String,
25051            #[serde(rename = "object")]
25052            #[allow(dead_code)]
25053            object: crate::__types::message_object::Object,
25054            #[serde(rename = "created_at")]
25055            created_at: i64,
25056            #[serde(rename = "thread_id")]
25057            thread_id: String,
25058            #[serde(rename = "status")]
25059            status: crate::__types::message_object::Status,
25060            #[serde(rename = "incomplete_details")]
25061            incomplete_details: Option<crate::__types::message_object::IncompleteDetails>,
25062            #[serde(rename = "completed_at")]
25063            completed_at: Option<i64>,
25064            #[serde(rename = "incomplete_at")]
25065            incomplete_at: Option<i64>,
25066            #[serde(rename = "role")]
25067            role: crate::__types::message_object::Role,
25068            #[serde(rename = "content")]
25069            content: Vec<crate::__types::MessageContent>,
25070            #[serde(rename = "assistant_id")]
25071            assistant_id: Option<String>,
25072            #[serde(rename = "run_id")]
25073            run_id: Option<String>,
25074            #[serde(rename = "attachments")]
25075            attachments: Option<Vec<crate::__types::message_object::attachments::Item>>,
25076            #[serde(rename = "metadata")]
25077            metadata: Option<crate::__types::Metadata>,
25078        }
25079        let MessageObject {
25080            id,
25081            created_at,
25082            thread_id,
25083            status,
25084            incomplete_details,
25085            completed_at,
25086            incomplete_at,
25087            role,
25088            content,
25089            assistant_id,
25090            run_id,
25091            attachments,
25092            metadata,
25093            ..
25094        } = MessageObject::deserialize(deserializer)?;
25095        Ok(Self {
25096            id,
25097            created_at,
25098            thread_id,
25099            status,
25100            incomplete_details,
25101            completed_at,
25102            incomplete_at,
25103            role,
25104            content,
25105            assistant_id,
25106            run_id,
25107            attachments,
25108            metadata,
25109        })
25110    }
25111}
25112impl serde::Serialize for MessageObject {
25113    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
25114    where
25115        S: serde::Serializer,
25116    {
25117        #[serde_with::serde_as]
25118        #[derive(serde :: Serialize)]
25119        struct MessageObject<'a> {
25120            #[serde(rename = "id")]
25121            id: &'a String,
25122            #[serde(rename = "object")]
25123            object: &'a crate::__types::message_object::Object,
25124            #[serde(rename = "created_at")]
25125            created_at: &'a i64,
25126            #[serde(rename = "thread_id")]
25127            thread_id: &'a String,
25128            #[serde(rename = "status")]
25129            status: &'a crate::__types::message_object::Status,
25130            #[serde(rename = "incomplete_details")]
25131            #[serde(skip_serializing_if = "Option::is_none")]
25132            incomplete_details: &'a Option<crate::__types::message_object::IncompleteDetails>,
25133            #[serde(rename = "completed_at")]
25134            #[serde(skip_serializing_if = "Option::is_none")]
25135            completed_at: &'a Option<i64>,
25136            #[serde(rename = "incomplete_at")]
25137            #[serde(skip_serializing_if = "Option::is_none")]
25138            incomplete_at: &'a Option<i64>,
25139            #[serde(rename = "role")]
25140            role: &'a crate::__types::message_object::Role,
25141            #[serde(rename = "content")]
25142            content: &'a Vec<crate::__types::MessageContent>,
25143            #[serde(rename = "assistant_id")]
25144            #[serde(skip_serializing_if = "Option::is_none")]
25145            assistant_id: &'a Option<String>,
25146            #[serde(rename = "run_id")]
25147            #[serde(skip_serializing_if = "Option::is_none")]
25148            run_id: &'a Option<String>,
25149            #[serde(rename = "attachments")]
25150            #[serde(skip_serializing_if = "Option::is_none")]
25151            attachments: &'a Option<Vec<crate::__types::message_object::attachments::Item>>,
25152            #[serde(rename = "metadata")]
25153            #[serde(skip_serializing_if = "Option::is_none")]
25154            metadata: &'a Option<crate::__types::Metadata>,
25155        }
25156        let Self {
25157            id,
25158            created_at,
25159            thread_id,
25160            status,
25161            incomplete_details,
25162            completed_at,
25163            incomplete_at,
25164            role,
25165            content,
25166            assistant_id,
25167            run_id,
25168            attachments,
25169            metadata,
25170        } = self;
25171        MessageObject {
25172            id,
25173            object: &Default::default(),
25174            created_at,
25175            thread_id,
25176            status,
25177            incomplete_details,
25178            completed_at,
25179            incomplete_at,
25180            role,
25181            content,
25182            assistant_id,
25183            run_id,
25184            attachments,
25185            metadata,
25186        }
25187        .serialize(serializer)
25188    }
25189}
25190#[allow(clippy::module_inception)]
25191pub(crate) mod message_request_content_text_object {
25192    #[doc = "Always `text`."]
25193    #[derive(Clone, Copy, Debug, Default, PartialEq)]
25194    pub(crate) struct Type;
25195    impl_serde!(Type, "text");
25196}
25197#[doc = "The text content that is part of a message."]
25198#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
25199pub struct MessageRequestContentTextObject {
25200    #[doc = "Text content to be sent to the model"]
25201    pub text: String,
25202}
25203impl<'de> serde::Deserialize<'de> for MessageRequestContentTextObject {
25204    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
25205    where
25206        D: serde::Deserializer<'de>,
25207    {
25208        #[serde_with::serde_as]
25209        #[derive(serde :: Deserialize)]
25210        struct MessageRequestContentTextObject {
25211            #[serde(rename = "type")]
25212            #[allow(dead_code)]
25213            r#type: crate::__types::message_request_content_text_object::Type,
25214            #[serde(rename = "text")]
25215            text: String,
25216        }
25217        let MessageRequestContentTextObject { text, .. } =
25218            MessageRequestContentTextObject::deserialize(deserializer)?;
25219        Ok(Self { text })
25220    }
25221}
25222impl serde::Serialize for MessageRequestContentTextObject {
25223    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
25224    where
25225        S: serde::Serializer,
25226    {
25227        #[serde_with::serde_as]
25228        #[derive(serde :: Serialize)]
25229        struct MessageRequestContentTextObject<'a> {
25230            #[serde(rename = "type")]
25231            r#type: &'a crate::__types::message_request_content_text_object::Type,
25232            #[serde(rename = "text")]
25233            text: &'a String,
25234        }
25235        let Self { text } = self;
25236        MessageRequestContentTextObject {
25237            r#type: &Default::default(),
25238            text,
25239        }
25240        .serialize(serializer)
25241    }
25242}
25243#[allow(clippy::module_inception)]
25244pub mod message_stream_event {
25245    #[allow(clippy::module_inception)]
25246    pub(crate) mod thread_message_created {
25247        #[doc = "thread.message.created"]
25248        #[derive(Clone, Copy, Debug, Default, PartialEq)]
25249        pub(crate) struct Event;
25250        impl_serde!(Event, "thread.message.created");
25251    }
25252    #[doc = "Occurs when a [message](https://platform.openai.com/docs/api-reference/messages/object) is created."]
25253    #[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
25254    pub struct ThreadMessageCreated {
25255        pub data: crate::__types::MessageObject,
25256    }
25257    impl<'de> serde::Deserialize<'de> for ThreadMessageCreated {
25258        fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
25259        where
25260            D: serde::Deserializer<'de>,
25261        {
25262            #[serde_with::serde_as]
25263            #[derive(serde :: Deserialize)]
25264            struct ThreadMessageCreated {
25265                #[serde(rename = "event")]
25266                #[allow(dead_code)]
25267                event: crate::__types::message_stream_event::thread_message_created::Event,
25268                #[serde(rename = "data")]
25269                data: crate::__types::MessageObject,
25270            }
25271            let ThreadMessageCreated { data, .. } =
25272                ThreadMessageCreated::deserialize(deserializer)?;
25273            Ok(Self { data })
25274        }
25275    }
25276    impl serde::Serialize for ThreadMessageCreated {
25277        fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
25278        where
25279            S: serde::Serializer,
25280        {
25281            #[serde_with::serde_as]
25282            #[derive(serde :: Serialize)]
25283            struct ThreadMessageCreated<'a> {
25284                #[serde(rename = "event")]
25285                event: &'a crate::__types::message_stream_event::thread_message_created::Event,
25286                #[serde(rename = "data")]
25287                data: &'a crate::__types::MessageObject,
25288            }
25289            let Self { data } = self;
25290            ThreadMessageCreated {
25291                event: &Default::default(),
25292                data,
25293            }
25294            .serialize(serializer)
25295        }
25296    }
25297    #[allow(clippy::module_inception)]
25298    pub(crate) mod thread_message_in_progress {
25299        #[doc = "thread.message.in_progress"]
25300        #[derive(Clone, Copy, Debug, Default, PartialEq)]
25301        pub(crate) struct Event;
25302        impl_serde!(Event, "thread.message.in_progress");
25303    }
25304    #[doc = "Occurs when a [message](https://platform.openai.com/docs/api-reference/messages/object) moves to an `in_progress` state."]
25305    #[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
25306    pub struct ThreadMessageInProgress {
25307        pub data: crate::__types::MessageObject,
25308    }
25309    impl<'de> serde::Deserialize<'de> for ThreadMessageInProgress {
25310        fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
25311        where
25312            D: serde::Deserializer<'de>,
25313        {
25314            #[serde_with::serde_as]
25315            #[derive(serde :: Deserialize)]
25316            struct ThreadMessageInProgress {
25317                #[serde(rename = "event")]
25318                #[allow(dead_code)]
25319                event: crate::__types::message_stream_event::thread_message_in_progress::Event,
25320                #[serde(rename = "data")]
25321                data: crate::__types::MessageObject,
25322            }
25323            let ThreadMessageInProgress { data, .. } =
25324                ThreadMessageInProgress::deserialize(deserializer)?;
25325            Ok(Self { data })
25326        }
25327    }
25328    impl serde::Serialize for ThreadMessageInProgress {
25329        fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
25330        where
25331            S: serde::Serializer,
25332        {
25333            #[serde_with::serde_as]
25334            #[derive(serde :: Serialize)]
25335            struct ThreadMessageInProgress<'a> {
25336                #[serde(rename = "event")]
25337                event: &'a crate::__types::message_stream_event::thread_message_in_progress::Event,
25338                #[serde(rename = "data")]
25339                data: &'a crate::__types::MessageObject,
25340            }
25341            let Self { data } = self;
25342            ThreadMessageInProgress {
25343                event: &Default::default(),
25344                data,
25345            }
25346            .serialize(serializer)
25347        }
25348    }
25349    #[allow(clippy::module_inception)]
25350    pub(crate) mod thread_message_delta {
25351        #[doc = "thread.message.delta"]
25352        #[derive(Clone, Copy, Debug, Default, PartialEq)]
25353        pub(crate) struct Event;
25354        impl_serde!(Event, "thread.message.delta");
25355    }
25356    #[doc = "Occurs when parts of a [Message](https://platform.openai.com/docs/api-reference/messages/object) are being streamed."]
25357    #[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
25358    pub struct ThreadMessageDelta {
25359        pub data: crate::__types::MessageDeltaObject,
25360    }
25361    impl<'de> serde::Deserialize<'de> for ThreadMessageDelta {
25362        fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
25363        where
25364            D: serde::Deserializer<'de>,
25365        {
25366            #[serde_with::serde_as]
25367            #[derive(serde :: Deserialize)]
25368            struct ThreadMessageDelta {
25369                #[serde(rename = "event")]
25370                #[allow(dead_code)]
25371                event: crate::__types::message_stream_event::thread_message_delta::Event,
25372                #[serde(rename = "data")]
25373                data: crate::__types::MessageDeltaObject,
25374            }
25375            let ThreadMessageDelta { data, .. } = ThreadMessageDelta::deserialize(deserializer)?;
25376            Ok(Self { data })
25377        }
25378    }
25379    impl serde::Serialize for ThreadMessageDelta {
25380        fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
25381        where
25382            S: serde::Serializer,
25383        {
25384            #[serde_with::serde_as]
25385            #[derive(serde :: Serialize)]
25386            struct ThreadMessageDelta<'a> {
25387                #[serde(rename = "event")]
25388                event: &'a crate::__types::message_stream_event::thread_message_delta::Event,
25389                #[serde(rename = "data")]
25390                data: &'a crate::__types::MessageDeltaObject,
25391            }
25392            let Self { data } = self;
25393            ThreadMessageDelta {
25394                event: &Default::default(),
25395                data,
25396            }
25397            .serialize(serializer)
25398        }
25399    }
25400    #[allow(clippy::module_inception)]
25401    pub(crate) mod thread_message_completed {
25402        #[doc = "thread.message.completed"]
25403        #[derive(Clone, Copy, Debug, Default, PartialEq)]
25404        pub(crate) struct Event;
25405        impl_serde!(Event, "thread.message.completed");
25406    }
25407    #[doc = "Occurs when a [message](https://platform.openai.com/docs/api-reference/messages/object) is completed."]
25408    #[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
25409    pub struct ThreadMessageCompleted {
25410        pub data: crate::__types::MessageObject,
25411    }
25412    impl<'de> serde::Deserialize<'de> for ThreadMessageCompleted {
25413        fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
25414        where
25415            D: serde::Deserializer<'de>,
25416        {
25417            #[serde_with::serde_as]
25418            #[derive(serde :: Deserialize)]
25419            struct ThreadMessageCompleted {
25420                #[serde(rename = "event")]
25421                #[allow(dead_code)]
25422                event: crate::__types::message_stream_event::thread_message_completed::Event,
25423                #[serde(rename = "data")]
25424                data: crate::__types::MessageObject,
25425            }
25426            let ThreadMessageCompleted { data, .. } =
25427                ThreadMessageCompleted::deserialize(deserializer)?;
25428            Ok(Self { data })
25429        }
25430    }
25431    impl serde::Serialize for ThreadMessageCompleted {
25432        fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
25433        where
25434            S: serde::Serializer,
25435        {
25436            #[serde_with::serde_as]
25437            #[derive(serde :: Serialize)]
25438            struct ThreadMessageCompleted<'a> {
25439                #[serde(rename = "event")]
25440                event: &'a crate::__types::message_stream_event::thread_message_completed::Event,
25441                #[serde(rename = "data")]
25442                data: &'a crate::__types::MessageObject,
25443            }
25444            let Self { data } = self;
25445            ThreadMessageCompleted {
25446                event: &Default::default(),
25447                data,
25448            }
25449            .serialize(serializer)
25450        }
25451    }
25452    #[allow(clippy::module_inception)]
25453    pub(crate) mod thread_message_incomplete {
25454        #[doc = "thread.message.incomplete"]
25455        #[derive(Clone, Copy, Debug, Default, PartialEq)]
25456        pub(crate) struct Event;
25457        impl_serde!(Event, "thread.message.incomplete");
25458    }
25459    #[doc = "Occurs when a [message](https://platform.openai.com/docs/api-reference/messages/object) ends before it is completed."]
25460    #[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
25461    pub struct ThreadMessageIncomplete {
25462        pub data: crate::__types::MessageObject,
25463    }
25464    impl<'de> serde::Deserialize<'de> for ThreadMessageIncomplete {
25465        fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
25466        where
25467            D: serde::Deserializer<'de>,
25468        {
25469            #[serde_with::serde_as]
25470            #[derive(serde :: Deserialize)]
25471            struct ThreadMessageIncomplete {
25472                #[serde(rename = "event")]
25473                #[allow(dead_code)]
25474                event: crate::__types::message_stream_event::thread_message_incomplete::Event,
25475                #[serde(rename = "data")]
25476                data: crate::__types::MessageObject,
25477            }
25478            let ThreadMessageIncomplete { data, .. } =
25479                ThreadMessageIncomplete::deserialize(deserializer)?;
25480            Ok(Self { data })
25481        }
25482    }
25483    impl serde::Serialize for ThreadMessageIncomplete {
25484        fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
25485        where
25486            S: serde::Serializer,
25487        {
25488            #[serde_with::serde_as]
25489            #[derive(serde :: Serialize)]
25490            struct ThreadMessageIncomplete<'a> {
25491                #[serde(rename = "event")]
25492                event: &'a crate::__types::message_stream_event::thread_message_incomplete::Event,
25493                #[serde(rename = "data")]
25494                data: &'a crate::__types::MessageObject,
25495            }
25496            let Self { data } = self;
25497            ThreadMessageIncomplete {
25498                event: &Default::default(),
25499                data,
25500            }
25501            .serialize(serializer)
25502        }
25503    }
25504}
25505#[derive(Clone, Debug, PartialEq)]
25506#[serde_with::serde_as]
25507#[derive(serde :: Deserialize, serde :: Serialize)]
25508#[serde(untagged)]
25509#[allow(clippy::large_enum_variant)]
25510pub enum MessageStreamEvent {
25511    #[doc = "Occurs when a [message](https://platform.openai.com/docs/api-reference/messages/object) is created."]
25512    ThreadMessageCreated(crate::__types::message_stream_event::ThreadMessageCreated),
25513    #[doc = "Occurs when a [message](https://platform.openai.com/docs/api-reference/messages/object) moves to an `in_progress` state."]
25514    ThreadMessageInProgress(crate::__types::message_stream_event::ThreadMessageInProgress),
25515    #[doc = "Occurs when parts of a [Message](https://platform.openai.com/docs/api-reference/messages/object) are being streamed."]
25516    ThreadMessageDelta(crate::__types::message_stream_event::ThreadMessageDelta),
25517    #[doc = "Occurs when a [message](https://platform.openai.com/docs/api-reference/messages/object) is completed."]
25518    ThreadMessageCompleted(crate::__types::message_stream_event::ThreadMessageCompleted),
25519    #[doc = "Occurs when a [message](https://platform.openai.com/docs/api-reference/messages/object) ends before it is completed."]
25520    ThreadMessageIncomplete(crate::__types::message_stream_event::ThreadMessageIncomplete),
25521}
25522#[doc = "Set of 16 key-value pairs that can be attached to an object. This can be\nuseful for storing additional information about the object in a structured\nformat, and querying for objects via API or the dashboard. \n\nKeys are strings with a maximum length of 64 characters. Values are strings\nwith a maximum length of 512 characters.\n"]
25523pub type Metadata = indexmap::IndexMap<String, String>;
25524#[allow(clippy::module_inception)]
25525pub(crate) mod model {
25526    #[doc = "The object type, which is always \"model\"."]
25527    #[derive(Clone, Copy, Debug, Default, PartialEq)]
25528    pub(crate) struct Object;
25529    impl_serde!(Object, "model");
25530}
25531#[doc = "Describes an OpenAI model offering that can be used with the API."]
25532#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
25533pub struct Model {
25534    #[doc = "The model identifier, which can be referenced in the API endpoints."]
25535    pub id: String,
25536    #[doc = "The Unix timestamp (in seconds) when the model was created."]
25537    pub created: i64,
25538    #[doc = "The organization that owns the model."]
25539    pub owned_by: String,
25540}
25541impl<'de> serde::Deserialize<'de> for Model {
25542    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
25543    where
25544        D: serde::Deserializer<'de>,
25545    {
25546        #[serde_with::serde_as]
25547        #[derive(serde :: Deserialize)]
25548        struct Model {
25549            #[serde(rename = "id")]
25550            id: String,
25551            #[serde(rename = "created")]
25552            created: i64,
25553            #[serde(rename = "object")]
25554            #[allow(dead_code)]
25555            object: crate::__types::model::Object,
25556            #[serde(rename = "owned_by")]
25557            owned_by: String,
25558        }
25559        let Model {
25560            id,
25561            created,
25562            owned_by,
25563            ..
25564        } = Model::deserialize(deserializer)?;
25565        Ok(Self {
25566            id,
25567            created,
25568            owned_by,
25569        })
25570    }
25571}
25572impl serde::Serialize for Model {
25573    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
25574    where
25575        S: serde::Serializer,
25576    {
25577        #[serde_with::serde_as]
25578        #[derive(serde :: Serialize)]
25579        struct Model<'a> {
25580            #[serde(rename = "id")]
25581            id: &'a String,
25582            #[serde(rename = "created")]
25583            created: &'a i64,
25584            #[serde(rename = "object")]
25585            object: &'a crate::__types::model::Object,
25586            #[serde(rename = "owned_by")]
25587            owned_by: &'a String,
25588        }
25589        let Self {
25590            id,
25591            created,
25592            owned_by,
25593        } = self;
25594        Model {
25595            id,
25596            created,
25597            object: &Default::default(),
25598            owned_by,
25599        }
25600        .serialize(serializer)
25601    }
25602}
25603#[derive(Clone, Debug, PartialEq)]
25604#[serde_with::serde_as]
25605#[derive(serde :: Deserialize, serde :: Serialize)]
25606#[serde(untagged)]
25607#[allow(clippy::large_enum_variant)]
25608pub enum ModelIds {
25609    ModelIdsShared(crate::__types::ModelIdsShared),
25610    ModelIdsResponses(crate::__types::ModelIdsResponses),
25611}
25612#[allow(clippy::module_inception)]
25613pub(crate) mod model_ids_responses {
25614    #[doc = "o1-pro"]
25615    #[derive(Clone, Copy, Debug, Default, PartialEq)]
25616    pub(crate) struct O1Pro;
25617    impl_serde!(O1Pro, "o1-pro");
25618    #[doc = "o1-pro-2025-03-19"]
25619    #[derive(Clone, Copy, Debug, Default, PartialEq)]
25620    pub(crate) struct O1Pro2025_03_19;
25621    impl_serde!(O1Pro2025_03_19, "o1-pro-2025-03-19");
25622    #[doc = "o3-pro"]
25623    #[derive(Clone, Copy, Debug, Default, PartialEq)]
25624    pub(crate) struct O3Pro;
25625    impl_serde!(O3Pro, "o3-pro");
25626    #[doc = "o3-pro-2025-06-10"]
25627    #[derive(Clone, Copy, Debug, Default, PartialEq)]
25628    pub(crate) struct O3Pro2025_06_10;
25629    impl_serde!(O3Pro2025_06_10, "o3-pro-2025-06-10");
25630    #[doc = "o3-deep-research"]
25631    #[derive(Clone, Copy, Debug, Default, PartialEq)]
25632    pub(crate) struct O3DeepResearch;
25633    impl_serde!(O3DeepResearch, "o3-deep-research");
25634    #[doc = "o3-deep-research-2025-06-26"]
25635    #[derive(Clone, Copy, Debug, Default, PartialEq)]
25636    pub(crate) struct O3DeepResearch2025_06_26;
25637    impl_serde!(O3DeepResearch2025_06_26, "o3-deep-research-2025-06-26");
25638    #[doc = "o4-mini-deep-research"]
25639    #[derive(Clone, Copy, Debug, Default, PartialEq)]
25640    pub(crate) struct O4MiniDeepResearch;
25641    impl_serde!(O4MiniDeepResearch, "o4-mini-deep-research");
25642    #[doc = "o4-mini-deep-research-2025-06-26"]
25643    #[derive(Clone, Copy, Debug, Default, PartialEq)]
25644    pub(crate) struct O4MiniDeepResearch2025_06_26;
25645    impl_serde!(
25646        O4MiniDeepResearch2025_06_26,
25647        "o4-mini-deep-research-2025-06-26"
25648    );
25649    #[doc = "computer-use-preview"]
25650    #[derive(Clone, Copy, Debug, Default, PartialEq)]
25651    pub(crate) struct ComputerUsePreview;
25652    impl_serde!(ComputerUsePreview, "computer-use-preview");
25653    #[doc = "computer-use-preview-2025-03-11"]
25654    #[derive(Clone, Copy, Debug, Default, PartialEq)]
25655    pub(crate) struct ComputerUsePreview2025_03_11;
25656    impl_serde!(
25657        ComputerUsePreview2025_03_11,
25658        "computer-use-preview-2025-03-11"
25659    );
25660}
25661#[derive(Clone, Debug, PartialEq)]
25662#[allow(clippy::large_enum_variant)]
25663pub enum ModelIdsResponses {
25664    ModelIdsShared(crate::__types::ModelIdsShared),
25665    #[doc = "o1-pro"]
25666    O1Pro,
25667    #[doc = "o1-pro-2025-03-19"]
25668    O1Pro2025_03_19,
25669    #[doc = "o3-pro"]
25670    O3Pro,
25671    #[doc = "o3-pro-2025-06-10"]
25672    O3Pro2025_06_10,
25673    #[doc = "o3-deep-research"]
25674    O3DeepResearch,
25675    #[doc = "o3-deep-research-2025-06-26"]
25676    O3DeepResearch2025_06_26,
25677    #[doc = "o4-mini-deep-research"]
25678    O4MiniDeepResearch,
25679    #[doc = "o4-mini-deep-research-2025-06-26"]
25680    O4MiniDeepResearch2025_06_26,
25681    #[doc = "computer-use-preview"]
25682    ComputerUsePreview,
25683    #[doc = "computer-use-preview-2025-03-11"]
25684    ComputerUsePreview2025_03_11,
25685}
25686impl<'de> serde::Deserialize<'de> for ModelIdsResponses {
25687    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
25688    where
25689        D: serde::Deserializer<'de>,
25690    {
25691        #[serde_with::serde_as]
25692        #[derive(serde :: Deserialize)]
25693        #[serde(untagged)]
25694        #[allow(clippy::enum_variant_names, clippy::large_enum_variant)]
25695        enum ModelIdsResponses {
25696            O1Pro(crate::__types::model_ids_responses::O1Pro),
25697            O1Pro2025_03_19(crate::__types::model_ids_responses::O1Pro2025_03_19),
25698            O3Pro(crate::__types::model_ids_responses::O3Pro),
25699            O3Pro2025_06_10(crate::__types::model_ids_responses::O3Pro2025_06_10),
25700            O3DeepResearch(crate::__types::model_ids_responses::O3DeepResearch),
25701            O3DeepResearch2025_06_26(crate::__types::model_ids_responses::O3DeepResearch2025_06_26),
25702            O4MiniDeepResearch(crate::__types::model_ids_responses::O4MiniDeepResearch),
25703            O4MiniDeepResearch2025_06_26(
25704                crate::__types::model_ids_responses::O4MiniDeepResearch2025_06_26,
25705            ),
25706            ComputerUsePreview(crate::__types::model_ids_responses::ComputerUsePreview),
25707            ComputerUsePreview2025_03_11(
25708                crate::__types::model_ids_responses::ComputerUsePreview2025_03_11,
25709            ),
25710            ModelIdsShared(crate::__types::ModelIdsShared),
25711        }
25712        Ok(match ModelIdsResponses::deserialize(deserializer)? {
25713            ModelIdsResponses::ModelIdsShared(v) => Self::ModelIdsShared(v),
25714            ModelIdsResponses::O1Pro(_) => Self::O1Pro,
25715            ModelIdsResponses::O1Pro2025_03_19(_) => Self::O1Pro2025_03_19,
25716            ModelIdsResponses::O3Pro(_) => Self::O3Pro,
25717            ModelIdsResponses::O3Pro2025_06_10(_) => Self::O3Pro2025_06_10,
25718            ModelIdsResponses::O3DeepResearch(_) => Self::O3DeepResearch,
25719            ModelIdsResponses::O3DeepResearch2025_06_26(_) => Self::O3DeepResearch2025_06_26,
25720            ModelIdsResponses::O4MiniDeepResearch(_) => Self::O4MiniDeepResearch,
25721            ModelIdsResponses::O4MiniDeepResearch2025_06_26(_) => {
25722                Self::O4MiniDeepResearch2025_06_26
25723            }
25724            ModelIdsResponses::ComputerUsePreview(_) => Self::ComputerUsePreview,
25725            ModelIdsResponses::ComputerUsePreview2025_03_11(_) => {
25726                Self::ComputerUsePreview2025_03_11
25727            }
25728        })
25729    }
25730}
25731impl serde::Serialize for ModelIdsResponses {
25732    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
25733    where
25734        S: serde::Serializer,
25735    {
25736        #[serde_with::serde_as]
25737        #[derive(serde :: Serialize)]
25738        #[serde(untagged)]
25739        #[allow(clippy::enum_variant_names)]
25740        enum ModelIdsResponses<'a> {
25741            ModelIdsShared(&'a crate::__types::ModelIdsShared),
25742            O1Pro(crate::__types::model_ids_responses::O1Pro),
25743            O1Pro2025_03_19(crate::__types::model_ids_responses::O1Pro2025_03_19),
25744            O3Pro(crate::__types::model_ids_responses::O3Pro),
25745            O3Pro2025_06_10(crate::__types::model_ids_responses::O3Pro2025_06_10),
25746            O3DeepResearch(crate::__types::model_ids_responses::O3DeepResearch),
25747            O3DeepResearch2025_06_26(crate::__types::model_ids_responses::O3DeepResearch2025_06_26),
25748            O4MiniDeepResearch(crate::__types::model_ids_responses::O4MiniDeepResearch),
25749            O4MiniDeepResearch2025_06_26(
25750                crate::__types::model_ids_responses::O4MiniDeepResearch2025_06_26,
25751            ),
25752            ComputerUsePreview(crate::__types::model_ids_responses::ComputerUsePreview),
25753            ComputerUsePreview2025_03_11(
25754                crate::__types::model_ids_responses::ComputerUsePreview2025_03_11,
25755            ),
25756        }
25757        match self {
25758            Self::ModelIdsShared(v) => ModelIdsResponses::ModelIdsShared(v),
25759            Self::O1Pro => ModelIdsResponses::O1Pro(Default::default()),
25760            Self::O1Pro2025_03_19 => ModelIdsResponses::O1Pro2025_03_19(Default::default()),
25761            Self::O3Pro => ModelIdsResponses::O3Pro(Default::default()),
25762            Self::O3Pro2025_06_10 => ModelIdsResponses::O3Pro2025_06_10(Default::default()),
25763            Self::O3DeepResearch => ModelIdsResponses::O3DeepResearch(Default::default()),
25764            Self::O3DeepResearch2025_06_26 => {
25765                ModelIdsResponses::O3DeepResearch2025_06_26(Default::default())
25766            }
25767            Self::O4MiniDeepResearch => ModelIdsResponses::O4MiniDeepResearch(Default::default()),
25768            Self::O4MiniDeepResearch2025_06_26 => {
25769                ModelIdsResponses::O4MiniDeepResearch2025_06_26(Default::default())
25770            }
25771            Self::ComputerUsePreview => ModelIdsResponses::ComputerUsePreview(Default::default()),
25772            Self::ComputerUsePreview2025_03_11 => {
25773                ModelIdsResponses::ComputerUsePreview2025_03_11(Default::default())
25774            }
25775        }
25776        .serialize(serializer)
25777    }
25778}
25779#[derive(Clone, Debug, PartialEq)]
25780#[allow(clippy::large_enum_variant)]
25781pub enum ModelIdsShared {
25782    Other(String),
25783    ChatModel(crate::__types::ChatModel),
25784}
25785impl<'de> serde::Deserialize<'de> for ModelIdsShared {
25786    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
25787    where
25788        D: serde::Deserializer<'de>,
25789    {
25790        #[serde_with::serde_as]
25791        #[derive(serde :: Deserialize)]
25792        #[serde(untagged)]
25793        #[allow(clippy::enum_variant_names, clippy::large_enum_variant)]
25794        enum ModelIdsShared {
25795            ChatModel(crate::__types::ChatModel),
25796            Other(String),
25797        }
25798        Ok(match ModelIdsShared::deserialize(deserializer)? {
25799            ModelIdsShared::Other(v) => Self::Other(v),
25800            ModelIdsShared::ChatModel(v) => Self::ChatModel(v),
25801        })
25802    }
25803}
25804impl serde::Serialize for ModelIdsShared {
25805    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
25806    where
25807        S: serde::Serializer,
25808    {
25809        #[serde_with::serde_as]
25810        #[derive(serde :: Serialize)]
25811        #[serde(untagged)]
25812        #[allow(clippy::enum_variant_names)]
25813        enum ModelIdsShared<'a> {
25814            Other(&'a String),
25815            ChatModel(&'a crate::__types::ChatModel),
25816        }
25817        match self {
25818            Self::Other(v) => ModelIdsShared::Other(v),
25819            Self::ChatModel(v) => ModelIdsShared::ChatModel(v),
25820        }
25821        .serialize(serializer)
25822    }
25823}
25824#[derive(Clone, Debug, Default, PartialEq)]
25825#[serde_with::serde_as]
25826#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
25827pub struct ModelResponseProperties {
25828    #[serde(rename = "metadata")]
25829    #[serde(skip_serializing_if = "Option::is_none")]
25830    #[builder(default)]
25831    pub metadata: Option<crate::__types::Metadata>,
25832    #[doc = "An integer between 0 and 20 specifying the number of most likely tokens to\nreturn at each token position, each with an associated log probability.\n"]
25833    #[serde(rename = "top_logprobs")]
25834    #[serde(skip_serializing_if = "Option::is_none")]
25835    #[builder(default)]
25836    pub top_logprobs: Option<i64>,
25837    #[doc = "What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.\nWe generally recommend altering this or `top_p` but not both.\n"]
25838    #[serde(rename = "temperature")]
25839    #[serde(skip_serializing_if = "Option::is_none")]
25840    #[builder(default)]
25841    pub temperature: Option<serde_json::Number>,
25842    #[doc = "An alternative to sampling with temperature, called nucleus sampling,\nwhere the model considers the results of the tokens with top_p probability\nmass. So 0.1 means only the tokens comprising the top 10% probability mass\nare considered.\n\nWe generally recommend altering this or `temperature` but not both.\n"]
25843    #[serde(rename = "top_p")]
25844    #[serde(skip_serializing_if = "Option::is_none")]
25845    #[builder(default)]
25846    pub top_p: Option<serde_json::Number>,
25847    #[doc = "This field is being replaced by `safety_identifier` and `prompt_cache_key`. Use `prompt_cache_key` instead to maintain caching optimizations.\nA stable identifier for your end-users. \nUsed to boost cache hit rates by better bucketing similar requests and  to help OpenAI detect and prevent abuse. [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#safety-identifiers).\n"]
25848    #[serde(rename = "user")]
25849    #[serde(skip_serializing_if = "Option::is_none")]
25850    #[builder(default)]
25851    pub user: Option<String>,
25852    #[doc = "A stable identifier used to help detect users of your application that may be violating OpenAI's usage policies. \nThe IDs should be a string that uniquely identifies each user. We recommend hashing their username or email address, in order to avoid sending us any identifying information. [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#safety-identifiers).\n"]
25853    #[serde(rename = "safety_identifier")]
25854    #[serde(skip_serializing_if = "Option::is_none")]
25855    #[builder(default)]
25856    pub safety_identifier: Option<String>,
25857    #[doc = "Used by OpenAI to cache responses for similar requests to optimize your cache hit rates. Replaces the `user` field. [Learn more](https://platform.openai.com/docs/guides/prompt-caching).\n"]
25858    #[serde(rename = "prompt_cache_key")]
25859    #[serde(skip_serializing_if = "Option::is_none")]
25860    #[builder(default)]
25861    pub prompt_cache_key: Option<String>,
25862    #[serde(rename = "service_tier")]
25863    #[serde(skip_serializing_if = "Option::is_none")]
25864    #[builder(default)]
25865    pub service_tier: Option<crate::__types::ServiceTier>,
25866}
25867#[allow(clippy::module_inception)]
25868pub mod modify_assistant_request {
25869    #[doc = "ID of the model to use. You can use the [List models](https://platform.openai.com/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](https://platform.openai.com/docs/models) for descriptions of them.\n"]
25870    #[derive(Clone, Debug, PartialEq)]
25871    #[allow(clippy::large_enum_variant)]
25872    pub enum Model {
25873        Other(String),
25874        AssistantSupportedModels(crate::__types::AssistantSupportedModels),
25875    }
25876    impl<'de> serde::Deserialize<'de> for Model {
25877        fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
25878        where
25879            D: serde::Deserializer<'de>,
25880        {
25881            #[serde_with::serde_as]
25882            #[derive(serde :: Deserialize)]
25883            #[serde(untagged)]
25884            #[allow(clippy::enum_variant_names, clippy::large_enum_variant)]
25885            enum Model {
25886                AssistantSupportedModels(crate::__types::AssistantSupportedModels),
25887                Other(String),
25888            }
25889            Ok(match Model::deserialize(deserializer)? {
25890                Model::Other(v) => Self::Other(v),
25891                Model::AssistantSupportedModels(v) => Self::AssistantSupportedModels(v),
25892            })
25893        }
25894    }
25895    impl serde::Serialize for Model {
25896        fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
25897        where
25898            S: serde::Serializer,
25899        {
25900            #[serde_with::serde_as]
25901            #[derive(serde :: Serialize)]
25902            #[serde(untagged)]
25903            #[allow(clippy::enum_variant_names)]
25904            enum Model<'a> {
25905                Other(&'a String),
25906                AssistantSupportedModels(&'a crate::__types::AssistantSupportedModels),
25907            }
25908            match self {
25909                Self::Other(v) => Model::Other(v),
25910                Self::AssistantSupportedModels(v) => Model::AssistantSupportedModels(v),
25911            }
25912            .serialize(serializer)
25913        }
25914    }
25915    #[allow(clippy::module_inception)]
25916    pub mod tool_resources {
25917        #[derive(Clone, Debug, Default, PartialEq)]
25918        #[serde_with::serde_as]
25919        #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
25920        pub struct CodeInterpreter {
25921            #[doc = "Overrides the list of [file](https://platform.openai.com/docs/api-reference/files) IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool.\n"]
25922            #[serde(rename = "file_ids")]
25923            #[serde(skip_serializing_if = "Option::is_none")]
25924            #[builder(default)]
25925            pub file_ids: Option<Vec<String>>,
25926        }
25927        #[derive(Clone, Debug, Default, PartialEq)]
25928        #[serde_with::serde_as]
25929        #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
25930        pub struct FileSearch {
25931            #[doc = "Overrides the [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object) attached to this assistant. There can be a maximum of 1 vector store attached to the assistant.\n"]
25932            #[serde(rename = "vector_store_ids")]
25933            #[serde(skip_serializing_if = "Option::is_none")]
25934            #[builder(default)]
25935            pub vector_store_ids: Option<Vec<String>>,
25936        }
25937    }
25938    #[doc = "A set of resources that are used by the assistant's tools. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.\n"]
25939    #[derive(Clone, Debug, Default, PartialEq)]
25940    #[serde_with::serde_as]
25941    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
25942    pub struct ToolResources {
25943        #[serde(rename = "code_interpreter")]
25944        #[serde(skip_serializing_if = "Option::is_none")]
25945        #[builder(default)]
25946        pub code_interpreter:
25947            Option<crate::__types::modify_assistant_request::tool_resources::CodeInterpreter>,
25948        #[serde(rename = "file_search")]
25949        #[serde(skip_serializing_if = "Option::is_none")]
25950        #[builder(default)]
25951        pub file_search:
25952            Option<crate::__types::modify_assistant_request::tool_resources::FileSearch>,
25953    }
25954}
25955#[derive(Clone, Debug, Default, PartialEq)]
25956#[serde_with::serde_as]
25957#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
25958pub struct ModifyAssistantRequest {
25959    #[doc = "ID of the model to use. You can use the [List models](https://platform.openai.com/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](https://platform.openai.com/docs/models) for descriptions of them.\n"]
25960    #[serde(rename = "model")]
25961    #[serde(skip_serializing_if = "Option::is_none")]
25962    #[builder(default)]
25963    pub model: Option<crate::__types::modify_assistant_request::Model>,
25964    #[serde(rename = "reasoning_effort")]
25965    #[serde(skip_serializing_if = "Option::is_none")]
25966    #[builder(default)]
25967    pub reasoning_effort: Option<crate::__types::ReasoningEffort>,
25968    #[doc = "The name of the assistant. The maximum length is 256 characters.\n"]
25969    #[serde(rename = "name")]
25970    #[serde(skip_serializing_if = "Option::is_none")]
25971    #[builder(default)]
25972    pub name: Option<String>,
25973    #[doc = "The description of the assistant. The maximum length is 512 characters.\n"]
25974    #[serde(rename = "description")]
25975    #[serde(skip_serializing_if = "Option::is_none")]
25976    #[builder(default)]
25977    pub description: Option<String>,
25978    #[doc = "The system instructions that the assistant uses. The maximum length is 256,000 characters.\n"]
25979    #[serde(rename = "instructions")]
25980    #[serde(skip_serializing_if = "Option::is_none")]
25981    #[builder(default)]
25982    pub instructions: Option<String>,
25983    #[doc = "A list of tool enabled on the assistant. There can be a maximum of 128 tools per assistant. Tools can be of types `code_interpreter`, `file_search`, or `function`.\n"]
25984    #[serde(rename = "tools")]
25985    #[serde(skip_serializing_if = "Option::is_none")]
25986    #[builder(default)]
25987    pub tools: Option<Vec<crate::__types::AssistantTool>>,
25988    #[doc = "A set of resources that are used by the assistant's tools. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.\n"]
25989    #[serde(rename = "tool_resources")]
25990    #[serde(skip_serializing_if = "Option::is_none")]
25991    #[builder(default)]
25992    pub tool_resources: Option<crate::__types::modify_assistant_request::ToolResources>,
25993    #[serde(rename = "metadata")]
25994    #[serde(skip_serializing_if = "Option::is_none")]
25995    #[builder(default)]
25996    pub metadata: Option<crate::__types::Metadata>,
25997    #[doc = "What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.\n"]
25998    #[serde(rename = "temperature")]
25999    #[serde(skip_serializing_if = "Option::is_none")]
26000    #[builder(default)]
26001    pub temperature: Option<serde_json::Number>,
26002    #[doc = "An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.\n\nWe generally recommend altering this or temperature but not both.\n"]
26003    #[serde(rename = "top_p")]
26004    #[serde(skip_serializing_if = "Option::is_none")]
26005    #[builder(default)]
26006    pub top_p: Option<serde_json::Number>,
26007    #[serde(rename = "response_format")]
26008    #[serde(skip_serializing_if = "Option::is_none")]
26009    #[builder(default)]
26010    pub response_format: Option<crate::__types::AssistantsApiResponseFormatOption>,
26011}
26012#[derive(Clone, Debug, PartialEq)]
26013#[serde_with::serde_as]
26014#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
26015pub struct ModifyCertificateRequest {
26016    #[doc = "The updated name for the certificate"]
26017    #[serde(rename = "name")]
26018    pub name: String,
26019}
26020#[derive(Clone, Debug, Default, PartialEq)]
26021#[serde_with::serde_as]
26022#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
26023pub struct ModifyMessageRequest {
26024    #[serde(rename = "metadata")]
26025    #[serde(skip_serializing_if = "Option::is_none")]
26026    #[builder(default)]
26027    pub metadata: Option<crate::__types::Metadata>,
26028}
26029#[derive(Clone, Debug, Default, PartialEq)]
26030#[serde_with::serde_as]
26031#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
26032pub struct ModifyRunRequest {
26033    #[serde(rename = "metadata")]
26034    #[serde(skip_serializing_if = "Option::is_none")]
26035    #[builder(default)]
26036    pub metadata: Option<crate::__types::Metadata>,
26037}
26038#[allow(clippy::module_inception)]
26039pub mod modify_thread_request {
26040    #[allow(clippy::module_inception)]
26041    pub mod tool_resources {
26042        #[derive(Clone, Debug, Default, PartialEq)]
26043        #[serde_with::serde_as]
26044        #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
26045        pub struct CodeInterpreter {
26046            #[doc = "A list of [file](https://platform.openai.com/docs/api-reference/files) IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool.\n"]
26047            #[serde(rename = "file_ids")]
26048            #[serde(skip_serializing_if = "Option::is_none")]
26049            #[builder(default)]
26050            pub file_ids: Option<Vec<String>>,
26051        }
26052        #[derive(Clone, Debug, Default, PartialEq)]
26053        #[serde_with::serde_as]
26054        #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
26055        pub struct FileSearch {
26056            #[doc = "The [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object) attached to this thread. There can be a maximum of 1 vector store attached to the thread.\n"]
26057            #[serde(rename = "vector_store_ids")]
26058            #[serde(skip_serializing_if = "Option::is_none")]
26059            #[builder(default)]
26060            pub vector_store_ids: Option<Vec<String>>,
26061        }
26062    }
26063    #[doc = "A set of resources that are made available to the assistant's tools in this thread. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.\n"]
26064    #[derive(Clone, Debug, Default, PartialEq)]
26065    #[serde_with::serde_as]
26066    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
26067    pub struct ToolResources {
26068        #[serde(rename = "code_interpreter")]
26069        #[serde(skip_serializing_if = "Option::is_none")]
26070        #[builder(default)]
26071        pub code_interpreter:
26072            Option<crate::__types::modify_thread_request::tool_resources::CodeInterpreter>,
26073        #[serde(rename = "file_search")]
26074        #[serde(skip_serializing_if = "Option::is_none")]
26075        #[builder(default)]
26076        pub file_search: Option<crate::__types::modify_thread_request::tool_resources::FileSearch>,
26077    }
26078}
26079#[derive(Clone, Debug, Default, PartialEq)]
26080#[serde_with::serde_as]
26081#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
26082pub struct ModifyThreadRequest {
26083    #[doc = "A set of resources that are made available to the assistant's tools in this thread. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.\n"]
26084    #[serde(rename = "tool_resources")]
26085    #[serde(skip_serializing_if = "Option::is_none")]
26086    #[builder(default)]
26087    pub tool_resources: Option<crate::__types::modify_thread_request::ToolResources>,
26088    #[serde(rename = "metadata")]
26089    #[serde(skip_serializing_if = "Option::is_none")]
26090    #[builder(default)]
26091    pub metadata: Option<crate::__types::Metadata>,
26092}
26093#[allow(clippy::module_inception)]
26094pub(crate) mod r#move {
26095    #[doc = "Specifies the event type. For a move action, this property is \nalways set to `move`.\n"]
26096    #[derive(Clone, Copy, Debug, Default, PartialEq)]
26097    pub(crate) struct Type;
26098    impl_serde!(Type, "move");
26099}
26100#[doc = "A mouse move action.\n"]
26101#[derive(Clone, Copy, Debug, PartialEq, typed_builder :: TypedBuilder)]
26102pub struct Move {
26103    #[doc = "The x-coordinate to move to.\n"]
26104    pub x: i64,
26105    #[doc = "The y-coordinate to move to.\n"]
26106    pub y: i64,
26107}
26108impl<'de> serde::Deserialize<'de> for Move {
26109    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
26110    where
26111        D: serde::Deserializer<'de>,
26112    {
26113        #[serde_with::serde_as]
26114        #[derive(serde :: Deserialize)]
26115        struct Move {
26116            #[serde(rename = "type")]
26117            #[allow(dead_code)]
26118            r#type: crate::__types::r#move::Type,
26119            #[serde(rename = "x")]
26120            x: i64,
26121            #[serde(rename = "y")]
26122            y: i64,
26123        }
26124        let Move { x, y, .. } = Move::deserialize(deserializer)?;
26125        Ok(Self { x, y })
26126    }
26127}
26128impl serde::Serialize for Move {
26129    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
26130    where
26131        S: serde::Serializer,
26132    {
26133        #[serde_with::serde_as]
26134        #[derive(serde :: Serialize)]
26135        struct Move<'a> {
26136            #[serde(rename = "type")]
26137            r#type: &'a crate::__types::r#move::Type,
26138            #[serde(rename = "x")]
26139            x: &'a i64,
26140            #[serde(rename = "y")]
26141            y: &'a i64,
26142        }
26143        let Self { x, y } = self;
26144        Move {
26145            r#type: &Default::default(),
26146            x,
26147            y,
26148        }
26149        .serialize(serializer)
26150    }
26151}
26152#[allow(clippy::module_inception)]
26153pub mod open_ai_file {
26154    #[doc = "The object type, which is always `file`."]
26155    #[derive(Clone, Copy, Debug, Default, PartialEq)]
26156    pub(crate) struct Object;
26157    impl_serde!(Object, "file");
26158    #[doc = "The intended purpose of the file. Supported values are `assistants`, `assistants_output`, `batch`, `batch_output`, `fine-tune`, `fine-tune-results`, `vision`, and `user_data`."]
26159    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
26160    pub enum Purpose {
26161        #[doc = "`assistants`"]
26162        #[serde(rename = "assistants")]
26163        Assistants,
26164        #[doc = "`assistants_output`"]
26165        #[serde(rename = "assistants_output")]
26166        AssistantsOutput,
26167        #[doc = "`batch`"]
26168        #[serde(rename = "batch")]
26169        Batch,
26170        #[doc = "`batch_output`"]
26171        #[serde(rename = "batch_output")]
26172        BatchOutput,
26173        #[doc = "`fine-tune`"]
26174        #[serde(rename = "fine-tune")]
26175        FineTune,
26176        #[doc = "`fine-tune-results`"]
26177        #[serde(rename = "fine-tune-results")]
26178        FineTuneResults,
26179        #[doc = "`vision`"]
26180        #[serde(rename = "vision")]
26181        Vision,
26182        #[doc = "`user_data`"]
26183        #[serde(rename = "user_data")]
26184        UserData,
26185    }
26186    #[doc = "Deprecated. The current status of the file, which can be either `uploaded`, `processed`, or `error`."]
26187    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
26188    pub enum Status {
26189        #[doc = "`uploaded`"]
26190        #[serde(rename = "uploaded")]
26191        Uploaded,
26192        #[doc = "`processed`"]
26193        #[serde(rename = "processed")]
26194        Processed,
26195        #[doc = "`error`"]
26196        #[serde(rename = "error")]
26197        Error,
26198    }
26199}
26200#[doc = "The `File` object represents a document that has been uploaded to OpenAI."]
26201#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
26202pub struct OpenAiFile {
26203    #[doc = "The file identifier, which can be referenced in the API endpoints."]
26204    pub id: String,
26205    #[doc = "The size of the file, in bytes."]
26206    pub bytes: i64,
26207    #[doc = "The Unix timestamp (in seconds) for when the file was created."]
26208    pub created_at: i64,
26209    #[doc = "The Unix timestamp (in seconds) for when the file will expire."]
26210    #[builder(default)]
26211    pub expires_at: Option<i64>,
26212    #[doc = "The name of the file."]
26213    pub filename: String,
26214    #[doc = "The intended purpose of the file. Supported values are `assistants`, `assistants_output`, `batch`, `batch_output`, `fine-tune`, `fine-tune-results`, `vision`, and `user_data`."]
26215    pub purpose: crate::__types::open_ai_file::Purpose,
26216    #[doc = "Deprecated. The current status of the file, which can be either `uploaded`, `processed`, or `error`."]
26217    pub status: crate::__types::open_ai_file::Status,
26218    #[doc = "Deprecated. For details on why a fine-tuning training file failed validation, see the `error` field on `fine_tuning.job`."]
26219    #[builder(default)]
26220    pub status_details: Option<String>,
26221}
26222impl<'de> serde::Deserialize<'de> for OpenAiFile {
26223    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
26224    where
26225        D: serde::Deserializer<'de>,
26226    {
26227        #[serde_with::serde_as]
26228        #[derive(serde :: Deserialize)]
26229        struct OpenAiFile {
26230            #[serde(rename = "id")]
26231            id: String,
26232            #[serde(rename = "bytes")]
26233            bytes: i64,
26234            #[serde(rename = "created_at")]
26235            created_at: i64,
26236            #[serde(rename = "expires_at")]
26237            expires_at: Option<i64>,
26238            #[serde(rename = "filename")]
26239            filename: String,
26240            #[serde(rename = "object")]
26241            #[allow(dead_code)]
26242            object: crate::__types::open_ai_file::Object,
26243            #[serde(rename = "purpose")]
26244            purpose: crate::__types::open_ai_file::Purpose,
26245            #[serde(rename = "status")]
26246            status: crate::__types::open_ai_file::Status,
26247            #[serde(rename = "status_details")]
26248            status_details: Option<String>,
26249        }
26250        let OpenAiFile {
26251            id,
26252            bytes,
26253            created_at,
26254            expires_at,
26255            filename,
26256            purpose,
26257            status,
26258            status_details,
26259            ..
26260        } = OpenAiFile::deserialize(deserializer)?;
26261        Ok(Self {
26262            id,
26263            bytes,
26264            created_at,
26265            expires_at,
26266            filename,
26267            purpose,
26268            status,
26269            status_details,
26270        })
26271    }
26272}
26273impl serde::Serialize for OpenAiFile {
26274    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
26275    where
26276        S: serde::Serializer,
26277    {
26278        #[serde_with::serde_as]
26279        #[derive(serde :: Serialize)]
26280        struct OpenAiFile<'a> {
26281            #[serde(rename = "id")]
26282            id: &'a String,
26283            #[serde(rename = "bytes")]
26284            bytes: &'a i64,
26285            #[serde(rename = "created_at")]
26286            created_at: &'a i64,
26287            #[serde(rename = "expires_at")]
26288            #[serde(skip_serializing_if = "Option::is_none")]
26289            expires_at: &'a Option<i64>,
26290            #[serde(rename = "filename")]
26291            filename: &'a String,
26292            #[serde(rename = "object")]
26293            object: &'a crate::__types::open_ai_file::Object,
26294            #[serde(rename = "purpose")]
26295            purpose: &'a crate::__types::open_ai_file::Purpose,
26296            #[serde(rename = "status")]
26297            status: &'a crate::__types::open_ai_file::Status,
26298            #[serde(rename = "status_details")]
26299            #[serde(skip_serializing_if = "Option::is_none")]
26300            status_details: &'a Option<String>,
26301        }
26302        let Self {
26303            id,
26304            bytes,
26305            created_at,
26306            expires_at,
26307            filename,
26308            purpose,
26309            status,
26310            status_details,
26311        } = self;
26312        OpenAiFile {
26313            id,
26314            bytes,
26315            created_at,
26316            expires_at,
26317            filename,
26318            object: &Default::default(),
26319            purpose,
26320            status,
26321            status_details,
26322        }
26323        .serialize(serializer)
26324    }
26325}
26326#[allow(clippy::module_inception)]
26327pub(crate) mod other_chunking_strategy_response_param {
26328    #[doc = "Always `other`."]
26329    #[derive(Clone, Copy, Debug, Default, PartialEq)]
26330    pub(crate) struct Type;
26331    impl_serde!(Type, "other");
26332}
26333#[doc = "This is returned when the chunking strategy is unknown. Typically, this is because the file was indexed before the `chunking_strategy` concept was introduced in the API."]
26334#[derive(Clone, Copy, Debug, Default, PartialEq, typed_builder :: TypedBuilder)]
26335pub struct OtherChunkingStrategyResponseParam {}
26336impl<'de> serde::Deserialize<'de> for OtherChunkingStrategyResponseParam {
26337    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
26338    where
26339        D: serde::Deserializer<'de>,
26340    {
26341        #[serde_with::serde_as]
26342        #[derive(serde :: Deserialize)]
26343        struct OtherChunkingStrategyResponseParam {
26344            #[serde(rename = "type")]
26345            #[allow(dead_code)]
26346            r#type: crate::__types::other_chunking_strategy_response_param::Type,
26347        }
26348        let OtherChunkingStrategyResponseParam { .. } =
26349            OtherChunkingStrategyResponseParam::deserialize(deserializer)?;
26350        Ok(Self {})
26351    }
26352}
26353impl serde::Serialize for OtherChunkingStrategyResponseParam {
26354    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
26355    where
26356        S: serde::Serializer,
26357    {
26358        #[serde_with::serde_as]
26359        #[derive(serde :: Serialize)]
26360        struct OtherChunkingStrategyResponseParam<'a> {
26361            #[serde(rename = "type")]
26362            r#type: &'a crate::__types::other_chunking_strategy_response_param::Type,
26363        }
26364        let Self {} = self;
26365        OtherChunkingStrategyResponseParam {
26366            r#type: &Default::default(),
26367        }
26368        .serialize(serializer)
26369    }
26370}
26371#[allow(clippy::module_inception)]
26372pub(crate) mod output_audio {
26373    #[doc = "The type of the output audio. Always `output_audio`.\n"]
26374    #[derive(Clone, Copy, Debug, Default, PartialEq)]
26375    pub(crate) struct Type;
26376    impl_serde!(Type, "output_audio");
26377}
26378#[doc = "An audio output from the model.\n"]
26379#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
26380pub struct OutputAudio {
26381    #[doc = "Base64-encoded audio data from the model.\n"]
26382    pub data: String,
26383    #[doc = "The transcript of the audio data from the model.\n"]
26384    pub transcript: String,
26385}
26386impl<'de> serde::Deserialize<'de> for OutputAudio {
26387    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
26388    where
26389        D: serde::Deserializer<'de>,
26390    {
26391        #[serde_with::serde_as]
26392        #[derive(serde :: Deserialize)]
26393        struct OutputAudio {
26394            #[serde(rename = "type")]
26395            #[allow(dead_code)]
26396            r#type: crate::__types::output_audio::Type,
26397            #[serde(rename = "data")]
26398            data: String,
26399            #[serde(rename = "transcript")]
26400            transcript: String,
26401        }
26402        let OutputAudio {
26403            data, transcript, ..
26404        } = OutputAudio::deserialize(deserializer)?;
26405        Ok(Self { data, transcript })
26406    }
26407}
26408impl serde::Serialize for OutputAudio {
26409    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
26410    where
26411        S: serde::Serializer,
26412    {
26413        #[serde_with::serde_as]
26414        #[derive(serde :: Serialize)]
26415        struct OutputAudio<'a> {
26416            #[serde(rename = "type")]
26417            r#type: &'a crate::__types::output_audio::Type,
26418            #[serde(rename = "data")]
26419            data: &'a String,
26420            #[serde(rename = "transcript")]
26421            transcript: &'a String,
26422        }
26423        let Self { data, transcript } = self;
26424        OutputAudio {
26425            r#type: &Default::default(),
26426            data,
26427            transcript,
26428        }
26429        .serialize(serializer)
26430    }
26431}
26432#[derive(Clone, Debug, PartialEq)]
26433#[serde_with::serde_as]
26434#[derive(serde :: Deserialize, serde :: Serialize)]
26435#[serde(untagged)]
26436#[allow(clippy::large_enum_variant)]
26437pub enum OutputContent {
26438    OutputText(crate::__types::OutputTextContent),
26439    Refusal(crate::__types::RefusalContent),
26440}
26441#[derive(Clone, Debug, PartialEq)]
26442#[serde_with::serde_as]
26443#[derive(serde :: Deserialize, serde :: Serialize)]
26444#[serde(untagged)]
26445#[allow(clippy::large_enum_variant)]
26446pub enum OutputItem {
26447    Message(crate::__types::OutputMessage),
26448    FileSearchCall(crate::__types::FileSearchToolCall),
26449    FunctionCall(crate::__types::FunctionToolCall),
26450    WebSearchCall(crate::__types::WebSearchToolCall),
26451    ComputerCall(crate::__types::ComputerToolCall),
26452    Reasoning(crate::__types::ReasoningItem),
26453    ImageGenerationCall(crate::__types::ImageGenToolCall),
26454    CodeInterpreterCall(crate::__types::CodeInterpreterToolCall),
26455    LocalShellCall(crate::__types::LocalShellToolCall),
26456    McpCall(crate::__types::McpToolCall),
26457    McpListTools(crate::__types::McpListTools),
26458    McpApprovalRequest(crate::__types::McpApprovalRequest),
26459    CustomToolCall(crate::__types::CustomToolCall),
26460}
26461#[allow(clippy::module_inception)]
26462pub mod output_message {
26463    #[doc = "The type of the output message. Always `message`.\n"]
26464    #[derive(Clone, Copy, Debug, Default, PartialEq)]
26465    pub(crate) struct Type;
26466    impl_serde!(Type, "message");
26467    #[doc = "The role of the output message. Always `assistant`.\n"]
26468    #[derive(Clone, Copy, Debug, Default, PartialEq)]
26469    pub(crate) struct Role;
26470    impl_serde!(Role, "assistant");
26471    #[doc = "The status of the message input. One of `in_progress`, `completed`, or\n`incomplete`. Populated when input items are returned via API.\n"]
26472    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
26473    pub enum Status {
26474        #[doc = "`in_progress`"]
26475        #[serde(rename = "in_progress")]
26476        InProgress,
26477        #[doc = "`completed`"]
26478        #[serde(rename = "completed")]
26479        Completed,
26480        #[doc = "`incomplete`"]
26481        #[serde(rename = "incomplete")]
26482        Incomplete,
26483    }
26484}
26485#[doc = "An output message from the model.\n"]
26486#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
26487pub struct OutputMessage {
26488    #[doc = "The unique ID of the output message.\n"]
26489    pub id: String,
26490    #[doc = "The content of the output message.\n"]
26491    pub content: Vec<crate::__types::OutputContent>,
26492    #[doc = "The status of the message input. One of `in_progress`, `completed`, or\n`incomplete`. Populated when input items are returned via API.\n"]
26493    pub status: crate::__types::output_message::Status,
26494}
26495impl<'de> serde::Deserialize<'de> for OutputMessage {
26496    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
26497    where
26498        D: serde::Deserializer<'de>,
26499    {
26500        #[serde_with::serde_as]
26501        #[derive(serde :: Deserialize)]
26502        struct OutputMessage {
26503            #[serde(rename = "id")]
26504            id: String,
26505            #[serde(rename = "type")]
26506            #[allow(dead_code)]
26507            r#type: crate::__types::output_message::Type,
26508            #[serde(rename = "role")]
26509            #[allow(dead_code)]
26510            role: crate::__types::output_message::Role,
26511            #[serde(rename = "content")]
26512            content: Vec<crate::__types::OutputContent>,
26513            #[serde(rename = "status")]
26514            status: crate::__types::output_message::Status,
26515        }
26516        let OutputMessage {
26517            id,
26518            content,
26519            status,
26520            ..
26521        } = OutputMessage::deserialize(deserializer)?;
26522        Ok(Self {
26523            id,
26524            content,
26525            status,
26526        })
26527    }
26528}
26529impl serde::Serialize for OutputMessage {
26530    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
26531    where
26532        S: serde::Serializer,
26533    {
26534        #[serde_with::serde_as]
26535        #[derive(serde :: Serialize)]
26536        struct OutputMessage<'a> {
26537            #[serde(rename = "id")]
26538            id: &'a String,
26539            #[serde(rename = "type")]
26540            r#type: &'a crate::__types::output_message::Type,
26541            #[serde(rename = "role")]
26542            role: &'a crate::__types::output_message::Role,
26543            #[serde(rename = "content")]
26544            content: &'a Vec<crate::__types::OutputContent>,
26545            #[serde(rename = "status")]
26546            status: &'a crate::__types::output_message::Status,
26547        }
26548        let Self {
26549            id,
26550            content,
26551            status,
26552        } = self;
26553        OutputMessage {
26554            id,
26555            r#type: &Default::default(),
26556            role: &Default::default(),
26557            content,
26558            status,
26559        }
26560        .serialize(serializer)
26561    }
26562}
26563#[doc = "Whether to enable [parallel function calling](https://platform.openai.com/docs/guides/function-calling#configuring-parallel-function-calling) during tool use."]
26564pub type ParallelToolCalls = bool;
26565#[doc = "The number of partial images to generate. This parameter is used for\nstreaming responses that return partial images. Value must be between 0 and 3.\nWhen set to 0, the response will be a single image sent in one streaming event.\n\nNote that the final image may be sent before the full number of partial images \nare generated if the full image is generated more quickly.\n"]
26566pub type PartialImages = i64;
26567#[allow(clippy::module_inception)]
26568pub mod prediction_content {
26569    #[doc = "The type of the predicted content you want to provide. This type is\ncurrently always `content`.\n"]
26570    #[derive(Clone, Copy, Debug, Default, PartialEq)]
26571    pub(crate) struct Type;
26572    impl_serde!(Type, "content");
26573    #[doc = "The content that should be matched when generating a model response.\nIf generated tokens would match this content, the entire model response\ncan be returned much more quickly.\n"]
26574    #[derive(Clone, Debug, PartialEq)]
26575    #[serde_with::serde_as]
26576    #[derive(serde :: Deserialize, serde :: Serialize)]
26577    #[serde(untagged)]
26578    #[allow(clippy::large_enum_variant)]
26579    pub enum Content {
26580        #[doc = "The content used for a Predicted Output. This is often the\ntext of a file you are regenerating with minor changes.\n"]
26581        String(String),
26582        #[doc = "An array of content parts with a defined type. Supported options differ based on the [model](https://platform.openai.com/docs/models) being used to generate the response. Can contain text inputs."]
26583        Array(Vec<crate::__types::ChatCompletionRequestMessageContentPartText>),
26584    }
26585}
26586#[doc = "Static predicted output content, such as the content of a text file that is\nbeing regenerated.\n"]
26587#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
26588pub struct PredictionContent {
26589    #[doc = "The content that should be matched when generating a model response.\nIf generated tokens would match this content, the entire model response\ncan be returned much more quickly.\n"]
26590    pub content: crate::__types::prediction_content::Content,
26591}
26592impl<'de> serde::Deserialize<'de> for PredictionContent {
26593    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
26594    where
26595        D: serde::Deserializer<'de>,
26596    {
26597        #[serde_with::serde_as]
26598        #[derive(serde :: Deserialize)]
26599        struct PredictionContent {
26600            #[serde(rename = "type")]
26601            #[allow(dead_code)]
26602            r#type: crate::__types::prediction_content::Type,
26603            #[serde(rename = "content")]
26604            content: crate::__types::prediction_content::Content,
26605        }
26606        let PredictionContent { content, .. } = PredictionContent::deserialize(deserializer)?;
26607        Ok(Self { content })
26608    }
26609}
26610impl serde::Serialize for PredictionContent {
26611    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
26612    where
26613        S: serde::Serializer,
26614    {
26615        #[serde_with::serde_as]
26616        #[derive(serde :: Serialize)]
26617        struct PredictionContent<'a> {
26618            #[serde(rename = "type")]
26619            r#type: &'a crate::__types::prediction_content::Type,
26620            #[serde(rename = "content")]
26621            content: &'a crate::__types::prediction_content::Content,
26622        }
26623        let Self { content } = self;
26624        PredictionContent {
26625            r#type: &Default::default(),
26626            content,
26627        }
26628        .serialize(serializer)
26629    }
26630}
26631#[allow(clippy::module_inception)]
26632pub mod project {
26633    #[doc = "The object type, which is always `organization.project`"]
26634    #[derive(Clone, Copy, Debug, Default, PartialEq)]
26635    pub(crate) struct Object;
26636    impl_serde!(Object, "organization.project");
26637    #[doc = "`active` or `archived`"]
26638    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
26639    pub enum Status {
26640        #[doc = "`active`"]
26641        #[serde(rename = "active")]
26642        Active,
26643        #[doc = "`archived`"]
26644        #[serde(rename = "archived")]
26645        Archived,
26646    }
26647}
26648#[doc = "Represents an individual project."]
26649#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
26650pub struct Project {
26651    #[doc = "The identifier, which can be referenced in API endpoints"]
26652    pub id: String,
26653    #[doc = "The name of the project. This appears in reporting."]
26654    pub name: String,
26655    #[doc = "The Unix timestamp (in seconds) of when the project was created."]
26656    pub created_at: i64,
26657    #[doc = "The Unix timestamp (in seconds) of when the project was archived or `null`."]
26658    #[builder(default)]
26659    pub archived_at: Option<i64>,
26660    #[doc = "`active` or `archived`"]
26661    pub status: crate::__types::project::Status,
26662}
26663impl<'de> serde::Deserialize<'de> for Project {
26664    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
26665    where
26666        D: serde::Deserializer<'de>,
26667    {
26668        #[serde_with::serde_as]
26669        #[derive(serde :: Deserialize)]
26670        struct Project {
26671            #[serde(rename = "id")]
26672            id: String,
26673            #[serde(rename = "object")]
26674            #[allow(dead_code)]
26675            object: crate::__types::project::Object,
26676            #[serde(rename = "name")]
26677            name: String,
26678            #[serde(rename = "created_at")]
26679            created_at: i64,
26680            #[serde(rename = "archived_at")]
26681            archived_at: Option<i64>,
26682            #[serde(rename = "status")]
26683            status: crate::__types::project::Status,
26684        }
26685        let Project {
26686            id,
26687            name,
26688            created_at,
26689            archived_at,
26690            status,
26691            ..
26692        } = Project::deserialize(deserializer)?;
26693        Ok(Self {
26694            id,
26695            name,
26696            created_at,
26697            archived_at,
26698            status,
26699        })
26700    }
26701}
26702impl serde::Serialize for Project {
26703    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
26704    where
26705        S: serde::Serializer,
26706    {
26707        #[serde_with::serde_as]
26708        #[derive(serde :: Serialize)]
26709        struct Project<'a> {
26710            #[serde(rename = "id")]
26711            id: &'a String,
26712            #[serde(rename = "object")]
26713            object: &'a crate::__types::project::Object,
26714            #[serde(rename = "name")]
26715            name: &'a String,
26716            #[serde(rename = "created_at")]
26717            created_at: &'a i64,
26718            #[serde(rename = "archived_at")]
26719            #[serde(skip_serializing_if = "Option::is_none")]
26720            archived_at: &'a Option<i64>,
26721            #[serde(rename = "status")]
26722            status: &'a crate::__types::project::Status,
26723        }
26724        let Self {
26725            id,
26726            name,
26727            created_at,
26728            archived_at,
26729            status,
26730        } = self;
26731        Project {
26732            id,
26733            object: &Default::default(),
26734            name,
26735            created_at,
26736            archived_at,
26737            status,
26738        }
26739        .serialize(serializer)
26740    }
26741}
26742#[allow(clippy::module_inception)]
26743pub mod project_api_key {
26744    #[doc = "The object type, which is always `organization.project.api_key`"]
26745    #[derive(Clone, Copy, Debug, Default, PartialEq)]
26746    pub(crate) struct Object;
26747    impl_serde!(Object, "organization.project.api_key");
26748    #[allow(clippy::module_inception)]
26749    pub mod owner {
26750        #[doc = "`user` or `service_account`"]
26751        #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
26752        pub enum Type {
26753            #[doc = "`user`"]
26754            #[serde(rename = "user")]
26755            User,
26756            #[doc = "`service_account`"]
26757            #[serde(rename = "service_account")]
26758            ServiceAccount,
26759        }
26760    }
26761    #[derive(Clone, Debug, Default, PartialEq)]
26762    #[serde_with::serde_as]
26763    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
26764    pub struct Owner {
26765        #[doc = "`user` or `service_account`"]
26766        #[serde(rename = "type")]
26767        #[serde(skip_serializing_if = "Option::is_none")]
26768        #[builder(default)]
26769        pub r#type: Option<crate::__types::project_api_key::owner::Type>,
26770        #[serde(rename = "user")]
26771        #[serde(skip_serializing_if = "Option::is_none")]
26772        #[builder(default)]
26773        pub user: Option<crate::__types::ProjectUser>,
26774        #[serde(rename = "service_account")]
26775        #[serde(skip_serializing_if = "Option::is_none")]
26776        #[builder(default)]
26777        pub service_account: Option<crate::__types::ProjectServiceAccount>,
26778    }
26779}
26780#[doc = "Represents an individual API key in a project."]
26781#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
26782pub struct ProjectApiKey {
26783    #[doc = "The redacted value of the API key"]
26784    pub redacted_value: String,
26785    #[doc = "The name of the API key"]
26786    pub name: String,
26787    #[doc = "The Unix timestamp (in seconds) of when the API key was created"]
26788    pub created_at: i64,
26789    #[doc = "The Unix timestamp (in seconds) of when the API key was last used."]
26790    pub last_used_at: i64,
26791    #[doc = "The identifier, which can be referenced in API endpoints"]
26792    pub id: String,
26793    #[builder(default)]
26794    pub owner: crate::__types::project_api_key::Owner,
26795}
26796impl<'de> serde::Deserialize<'de> for ProjectApiKey {
26797    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
26798    where
26799        D: serde::Deserializer<'de>,
26800    {
26801        #[serde_with::serde_as]
26802        #[derive(serde :: Deserialize)]
26803        struct ProjectApiKey {
26804            #[serde(rename = "object")]
26805            #[allow(dead_code)]
26806            object: crate::__types::project_api_key::Object,
26807            #[serde(rename = "redacted_value")]
26808            redacted_value: String,
26809            #[serde(rename = "name")]
26810            name: String,
26811            #[serde(rename = "created_at")]
26812            created_at: i64,
26813            #[serde(rename = "last_used_at")]
26814            last_used_at: i64,
26815            #[serde(rename = "id")]
26816            id: String,
26817            #[serde(rename = "owner")]
26818            owner: crate::__types::project_api_key::Owner,
26819        }
26820        let ProjectApiKey {
26821            redacted_value,
26822            name,
26823            created_at,
26824            last_used_at,
26825            id,
26826            owner,
26827            ..
26828        } = ProjectApiKey::deserialize(deserializer)?;
26829        Ok(Self {
26830            redacted_value,
26831            name,
26832            created_at,
26833            last_used_at,
26834            id,
26835            owner,
26836        })
26837    }
26838}
26839impl serde::Serialize for ProjectApiKey {
26840    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
26841    where
26842        S: serde::Serializer,
26843    {
26844        #[serde_with::serde_as]
26845        #[derive(serde :: Serialize)]
26846        struct ProjectApiKey<'a> {
26847            #[serde(rename = "object")]
26848            object: &'a crate::__types::project_api_key::Object,
26849            #[serde(rename = "redacted_value")]
26850            redacted_value: &'a String,
26851            #[serde(rename = "name")]
26852            name: &'a String,
26853            #[serde(rename = "created_at")]
26854            created_at: &'a i64,
26855            #[serde(rename = "last_used_at")]
26856            last_used_at: &'a i64,
26857            #[serde(rename = "id")]
26858            id: &'a String,
26859            #[serde(rename = "owner")]
26860            owner: &'a crate::__types::project_api_key::Owner,
26861        }
26862        let Self {
26863            redacted_value,
26864            name,
26865            created_at,
26866            last_used_at,
26867            id,
26868            owner,
26869        } = self;
26870        ProjectApiKey {
26871            object: &Default::default(),
26872            redacted_value,
26873            name,
26874            created_at,
26875            last_used_at,
26876            id,
26877            owner,
26878        }
26879        .serialize(serializer)
26880    }
26881}
26882#[allow(clippy::module_inception)]
26883pub(crate) mod project_api_key_delete_response {
26884    #[doc = "organization.project.api_key.deleted"]
26885    #[derive(Clone, Copy, Debug, Default, PartialEq)]
26886    pub(crate) struct Object;
26887    impl_serde!(Object, "organization.project.api_key.deleted");
26888}
26889#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
26890pub struct ProjectApiKeyDeleteResponse {
26891    pub id: String,
26892    pub deleted: bool,
26893}
26894impl<'de> serde::Deserialize<'de> for ProjectApiKeyDeleteResponse {
26895    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
26896    where
26897        D: serde::Deserializer<'de>,
26898    {
26899        #[serde_with::serde_as]
26900        #[derive(serde :: Deserialize)]
26901        struct ProjectApiKeyDeleteResponse {
26902            #[serde(rename = "object")]
26903            #[allow(dead_code)]
26904            object: crate::__types::project_api_key_delete_response::Object,
26905            #[serde(rename = "id")]
26906            id: String,
26907            #[serde(rename = "deleted")]
26908            deleted: bool,
26909        }
26910        let ProjectApiKeyDeleteResponse { id, deleted, .. } =
26911            ProjectApiKeyDeleteResponse::deserialize(deserializer)?;
26912        Ok(Self { id, deleted })
26913    }
26914}
26915impl serde::Serialize for ProjectApiKeyDeleteResponse {
26916    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
26917    where
26918        S: serde::Serializer,
26919    {
26920        #[serde_with::serde_as]
26921        #[derive(serde :: Serialize)]
26922        struct ProjectApiKeyDeleteResponse<'a> {
26923            #[serde(rename = "object")]
26924            object: &'a crate::__types::project_api_key_delete_response::Object,
26925            #[serde(rename = "id")]
26926            id: &'a String,
26927            #[serde(rename = "deleted")]
26928            deleted: &'a bool,
26929        }
26930        let Self { id, deleted } = self;
26931        ProjectApiKeyDeleteResponse {
26932            object: &Default::default(),
26933            id,
26934            deleted,
26935        }
26936        .serialize(serializer)
26937    }
26938}
26939#[allow(clippy::module_inception)]
26940pub(crate) mod project_api_key_list_response {
26941    #[doc = "list"]
26942    #[derive(Clone, Copy, Debug, Default, PartialEq)]
26943    pub(crate) struct Object;
26944    impl_serde!(Object, "list");
26945}
26946#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
26947pub struct ProjectApiKeyListResponse {
26948    pub data: Vec<crate::__types::ProjectApiKey>,
26949    pub first_id: String,
26950    pub last_id: String,
26951    pub has_more: bool,
26952}
26953impl<'de> serde::Deserialize<'de> for ProjectApiKeyListResponse {
26954    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
26955    where
26956        D: serde::Deserializer<'de>,
26957    {
26958        #[serde_with::serde_as]
26959        #[derive(serde :: Deserialize)]
26960        struct ProjectApiKeyListResponse {
26961            #[serde(rename = "object")]
26962            #[allow(dead_code)]
26963            object: crate::__types::project_api_key_list_response::Object,
26964            #[serde(rename = "data")]
26965            data: Vec<crate::__types::ProjectApiKey>,
26966            #[serde(rename = "first_id")]
26967            first_id: String,
26968            #[serde(rename = "last_id")]
26969            last_id: String,
26970            #[serde(rename = "has_more")]
26971            has_more: bool,
26972        }
26973        let ProjectApiKeyListResponse {
26974            data,
26975            first_id,
26976            last_id,
26977            has_more,
26978            ..
26979        } = ProjectApiKeyListResponse::deserialize(deserializer)?;
26980        Ok(Self {
26981            data,
26982            first_id,
26983            last_id,
26984            has_more,
26985        })
26986    }
26987}
26988impl serde::Serialize for ProjectApiKeyListResponse {
26989    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
26990    where
26991        S: serde::Serializer,
26992    {
26993        #[serde_with::serde_as]
26994        #[derive(serde :: Serialize)]
26995        struct ProjectApiKeyListResponse<'a> {
26996            #[serde(rename = "object")]
26997            object: &'a crate::__types::project_api_key_list_response::Object,
26998            #[serde(rename = "data")]
26999            data: &'a Vec<crate::__types::ProjectApiKey>,
27000            #[serde(rename = "first_id")]
27001            first_id: &'a String,
27002            #[serde(rename = "last_id")]
27003            last_id: &'a String,
27004            #[serde(rename = "has_more")]
27005            has_more: &'a bool,
27006        }
27007        let Self {
27008            data,
27009            first_id,
27010            last_id,
27011            has_more,
27012        } = self;
27013        ProjectApiKeyListResponse {
27014            object: &Default::default(),
27015            data,
27016            first_id,
27017            last_id,
27018            has_more,
27019        }
27020        .serialize(serializer)
27021    }
27022}
27023#[derive(Clone, Debug, PartialEq)]
27024#[serde_with::serde_as]
27025#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
27026pub struct ProjectCreateRequest {
27027    #[doc = "The friendly name of the project, this name appears in reports."]
27028    #[serde(rename = "name")]
27029    pub name: String,
27030}
27031#[allow(clippy::module_inception)]
27032pub(crate) mod project_list_response {
27033    #[doc = "list"]
27034    #[derive(Clone, Copy, Debug, Default, PartialEq)]
27035    pub(crate) struct Object;
27036    impl_serde!(Object, "list");
27037}
27038#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
27039pub struct ProjectListResponse {
27040    pub data: Vec<crate::__types::Project>,
27041    pub first_id: String,
27042    pub last_id: String,
27043    pub has_more: bool,
27044}
27045impl<'de> serde::Deserialize<'de> for ProjectListResponse {
27046    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
27047    where
27048        D: serde::Deserializer<'de>,
27049    {
27050        #[serde_with::serde_as]
27051        #[derive(serde :: Deserialize)]
27052        struct ProjectListResponse {
27053            #[serde(rename = "object")]
27054            #[allow(dead_code)]
27055            object: crate::__types::project_list_response::Object,
27056            #[serde(rename = "data")]
27057            data: Vec<crate::__types::Project>,
27058            #[serde(rename = "first_id")]
27059            first_id: String,
27060            #[serde(rename = "last_id")]
27061            last_id: String,
27062            #[serde(rename = "has_more")]
27063            has_more: bool,
27064        }
27065        let ProjectListResponse {
27066            data,
27067            first_id,
27068            last_id,
27069            has_more,
27070            ..
27071        } = ProjectListResponse::deserialize(deserializer)?;
27072        Ok(Self {
27073            data,
27074            first_id,
27075            last_id,
27076            has_more,
27077        })
27078    }
27079}
27080impl serde::Serialize for ProjectListResponse {
27081    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
27082    where
27083        S: serde::Serializer,
27084    {
27085        #[serde_with::serde_as]
27086        #[derive(serde :: Serialize)]
27087        struct ProjectListResponse<'a> {
27088            #[serde(rename = "object")]
27089            object: &'a crate::__types::project_list_response::Object,
27090            #[serde(rename = "data")]
27091            data: &'a Vec<crate::__types::Project>,
27092            #[serde(rename = "first_id")]
27093            first_id: &'a String,
27094            #[serde(rename = "last_id")]
27095            last_id: &'a String,
27096            #[serde(rename = "has_more")]
27097            has_more: &'a bool,
27098        }
27099        let Self {
27100            data,
27101            first_id,
27102            last_id,
27103            has_more,
27104        } = self;
27105        ProjectListResponse {
27106            object: &Default::default(),
27107            data,
27108            first_id,
27109            last_id,
27110            has_more,
27111        }
27112        .serialize(serializer)
27113    }
27114}
27115#[allow(clippy::module_inception)]
27116pub(crate) mod project_rate_limit {
27117    #[doc = "The object type, which is always `project.rate_limit`"]
27118    #[derive(Clone, Copy, Debug, Default, PartialEq)]
27119    pub(crate) struct Object;
27120    impl_serde!(Object, "project.rate_limit");
27121}
27122#[doc = "Represents a project rate limit config."]
27123#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
27124pub struct ProjectRateLimit {
27125    #[doc = "The identifier, which can be referenced in API endpoints."]
27126    pub id: String,
27127    #[doc = "The model this rate limit applies to."]
27128    pub model: String,
27129    #[doc = "The maximum requests per minute."]
27130    pub max_requests_per_1_minute: i64,
27131    #[doc = "The maximum tokens per minute."]
27132    pub max_tokens_per_1_minute: i64,
27133    #[doc = "The maximum images per minute. Only present for relevant models."]
27134    #[builder(default)]
27135    pub max_images_per_1_minute: Option<i64>,
27136    #[doc = "The maximum audio megabytes per minute. Only present for relevant models."]
27137    #[builder(default)]
27138    pub max_audio_megabytes_per_1_minute: Option<i64>,
27139    #[doc = "The maximum requests per day. Only present for relevant models."]
27140    #[builder(default)]
27141    pub max_requests_per_1_day: Option<i64>,
27142    #[doc = "The maximum batch input tokens per day. Only present for relevant models."]
27143    #[builder(default)]
27144    pub batch_1_day_max_input_tokens: Option<i64>,
27145}
27146impl<'de> serde::Deserialize<'de> for ProjectRateLimit {
27147    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
27148    where
27149        D: serde::Deserializer<'de>,
27150    {
27151        #[serde_with::serde_as]
27152        #[derive(serde :: Deserialize)]
27153        struct ProjectRateLimit {
27154            #[serde(rename = "object")]
27155            #[allow(dead_code)]
27156            object: crate::__types::project_rate_limit::Object,
27157            #[serde(rename = "id")]
27158            id: String,
27159            #[serde(rename = "model")]
27160            model: String,
27161            #[serde(rename = "max_requests_per_1_minute")]
27162            max_requests_per_1_minute: i64,
27163            #[serde(rename = "max_tokens_per_1_minute")]
27164            max_tokens_per_1_minute: i64,
27165            #[serde(rename = "max_images_per_1_minute")]
27166            max_images_per_1_minute: Option<i64>,
27167            #[serde(rename = "max_audio_megabytes_per_1_minute")]
27168            max_audio_megabytes_per_1_minute: Option<i64>,
27169            #[serde(rename = "max_requests_per_1_day")]
27170            max_requests_per_1_day: Option<i64>,
27171            #[serde(rename = "batch_1_day_max_input_tokens")]
27172            batch_1_day_max_input_tokens: Option<i64>,
27173        }
27174        let ProjectRateLimit {
27175            id,
27176            model,
27177            max_requests_per_1_minute,
27178            max_tokens_per_1_minute,
27179            max_images_per_1_minute,
27180            max_audio_megabytes_per_1_minute,
27181            max_requests_per_1_day,
27182            batch_1_day_max_input_tokens,
27183            ..
27184        } = ProjectRateLimit::deserialize(deserializer)?;
27185        Ok(Self {
27186            id,
27187            model,
27188            max_requests_per_1_minute,
27189            max_tokens_per_1_minute,
27190            max_images_per_1_minute,
27191            max_audio_megabytes_per_1_minute,
27192            max_requests_per_1_day,
27193            batch_1_day_max_input_tokens,
27194        })
27195    }
27196}
27197impl serde::Serialize for ProjectRateLimit {
27198    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
27199    where
27200        S: serde::Serializer,
27201    {
27202        #[serde_with::serde_as]
27203        #[derive(serde :: Serialize)]
27204        struct ProjectRateLimit<'a> {
27205            #[serde(rename = "object")]
27206            object: &'a crate::__types::project_rate_limit::Object,
27207            #[serde(rename = "id")]
27208            id: &'a String,
27209            #[serde(rename = "model")]
27210            model: &'a String,
27211            #[serde(rename = "max_requests_per_1_minute")]
27212            max_requests_per_1_minute: &'a i64,
27213            #[serde(rename = "max_tokens_per_1_minute")]
27214            max_tokens_per_1_minute: &'a i64,
27215            #[serde(rename = "max_images_per_1_minute")]
27216            #[serde(skip_serializing_if = "Option::is_none")]
27217            max_images_per_1_minute: &'a Option<i64>,
27218            #[serde(rename = "max_audio_megabytes_per_1_minute")]
27219            #[serde(skip_serializing_if = "Option::is_none")]
27220            max_audio_megabytes_per_1_minute: &'a Option<i64>,
27221            #[serde(rename = "max_requests_per_1_day")]
27222            #[serde(skip_serializing_if = "Option::is_none")]
27223            max_requests_per_1_day: &'a Option<i64>,
27224            #[serde(rename = "batch_1_day_max_input_tokens")]
27225            #[serde(skip_serializing_if = "Option::is_none")]
27226            batch_1_day_max_input_tokens: &'a Option<i64>,
27227        }
27228        let Self {
27229            id,
27230            model,
27231            max_requests_per_1_minute,
27232            max_tokens_per_1_minute,
27233            max_images_per_1_minute,
27234            max_audio_megabytes_per_1_minute,
27235            max_requests_per_1_day,
27236            batch_1_day_max_input_tokens,
27237        } = self;
27238        ProjectRateLimit {
27239            object: &Default::default(),
27240            id,
27241            model,
27242            max_requests_per_1_minute,
27243            max_tokens_per_1_minute,
27244            max_images_per_1_minute,
27245            max_audio_megabytes_per_1_minute,
27246            max_requests_per_1_day,
27247            batch_1_day_max_input_tokens,
27248        }
27249        .serialize(serializer)
27250    }
27251}
27252#[allow(clippy::module_inception)]
27253pub(crate) mod project_rate_limit_list_response {
27254    #[doc = "list"]
27255    #[derive(Clone, Copy, Debug, Default, PartialEq)]
27256    pub(crate) struct Object;
27257    impl_serde!(Object, "list");
27258}
27259#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
27260pub struct ProjectRateLimitListResponse {
27261    pub data: Vec<crate::__types::ProjectRateLimit>,
27262    pub first_id: String,
27263    pub last_id: String,
27264    pub has_more: bool,
27265}
27266impl<'de> serde::Deserialize<'de> for ProjectRateLimitListResponse {
27267    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
27268    where
27269        D: serde::Deserializer<'de>,
27270    {
27271        #[serde_with::serde_as]
27272        #[derive(serde :: Deserialize)]
27273        struct ProjectRateLimitListResponse {
27274            #[serde(rename = "object")]
27275            #[allow(dead_code)]
27276            object: crate::__types::project_rate_limit_list_response::Object,
27277            #[serde(rename = "data")]
27278            data: Vec<crate::__types::ProjectRateLimit>,
27279            #[serde(rename = "first_id")]
27280            first_id: String,
27281            #[serde(rename = "last_id")]
27282            last_id: String,
27283            #[serde(rename = "has_more")]
27284            has_more: bool,
27285        }
27286        let ProjectRateLimitListResponse {
27287            data,
27288            first_id,
27289            last_id,
27290            has_more,
27291            ..
27292        } = ProjectRateLimitListResponse::deserialize(deserializer)?;
27293        Ok(Self {
27294            data,
27295            first_id,
27296            last_id,
27297            has_more,
27298        })
27299    }
27300}
27301impl serde::Serialize for ProjectRateLimitListResponse {
27302    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
27303    where
27304        S: serde::Serializer,
27305    {
27306        #[serde_with::serde_as]
27307        #[derive(serde :: Serialize)]
27308        struct ProjectRateLimitListResponse<'a> {
27309            #[serde(rename = "object")]
27310            object: &'a crate::__types::project_rate_limit_list_response::Object,
27311            #[serde(rename = "data")]
27312            data: &'a Vec<crate::__types::ProjectRateLimit>,
27313            #[serde(rename = "first_id")]
27314            first_id: &'a String,
27315            #[serde(rename = "last_id")]
27316            last_id: &'a String,
27317            #[serde(rename = "has_more")]
27318            has_more: &'a bool,
27319        }
27320        let Self {
27321            data,
27322            first_id,
27323            last_id,
27324            has_more,
27325        } = self;
27326        ProjectRateLimitListResponse {
27327            object: &Default::default(),
27328            data,
27329            first_id,
27330            last_id,
27331            has_more,
27332        }
27333        .serialize(serializer)
27334    }
27335}
27336#[derive(Clone, Copy, Debug, Default, PartialEq)]
27337#[serde_with::serde_as]
27338#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
27339pub struct ProjectRateLimitUpdateRequest {
27340    #[doc = "The maximum requests per minute."]
27341    #[serde(rename = "max_requests_per_1_minute")]
27342    #[serde(skip_serializing_if = "Option::is_none")]
27343    #[builder(default)]
27344    pub max_requests_per_1_minute: Option<i64>,
27345    #[doc = "The maximum tokens per minute."]
27346    #[serde(rename = "max_tokens_per_1_minute")]
27347    #[serde(skip_serializing_if = "Option::is_none")]
27348    #[builder(default)]
27349    pub max_tokens_per_1_minute: Option<i64>,
27350    #[doc = "The maximum images per minute. Only relevant for certain models."]
27351    #[serde(rename = "max_images_per_1_minute")]
27352    #[serde(skip_serializing_if = "Option::is_none")]
27353    #[builder(default)]
27354    pub max_images_per_1_minute: Option<i64>,
27355    #[doc = "The maximum audio megabytes per minute. Only relevant for certain models."]
27356    #[serde(rename = "max_audio_megabytes_per_1_minute")]
27357    #[serde(skip_serializing_if = "Option::is_none")]
27358    #[builder(default)]
27359    pub max_audio_megabytes_per_1_minute: Option<i64>,
27360    #[doc = "The maximum requests per day. Only relevant for certain models."]
27361    #[serde(rename = "max_requests_per_1_day")]
27362    #[serde(skip_serializing_if = "Option::is_none")]
27363    #[builder(default)]
27364    pub max_requests_per_1_day: Option<i64>,
27365    #[doc = "The maximum batch input tokens per day. Only relevant for certain models."]
27366    #[serde(rename = "batch_1_day_max_input_tokens")]
27367    #[serde(skip_serializing_if = "Option::is_none")]
27368    #[builder(default)]
27369    pub batch_1_day_max_input_tokens: Option<i64>,
27370}
27371#[allow(clippy::module_inception)]
27372pub mod project_service_account {
27373    #[doc = "The object type, which is always `organization.project.service_account`"]
27374    #[derive(Clone, Copy, Debug, Default, PartialEq)]
27375    pub(crate) struct Object;
27376    impl_serde!(Object, "organization.project.service_account");
27377    #[doc = "`owner` or `member`"]
27378    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
27379    pub enum Role {
27380        #[doc = "`owner`"]
27381        #[serde(rename = "owner")]
27382        Owner,
27383        #[doc = "`member`"]
27384        #[serde(rename = "member")]
27385        Member,
27386    }
27387}
27388#[doc = "Represents an individual service account in a project."]
27389#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
27390pub struct ProjectServiceAccount {
27391    #[doc = "The identifier, which can be referenced in API endpoints"]
27392    pub id: String,
27393    #[doc = "The name of the service account"]
27394    pub name: String,
27395    #[doc = "`owner` or `member`"]
27396    pub role: crate::__types::project_service_account::Role,
27397    #[doc = "The Unix timestamp (in seconds) of when the service account was created"]
27398    pub created_at: i64,
27399}
27400impl<'de> serde::Deserialize<'de> for ProjectServiceAccount {
27401    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
27402    where
27403        D: serde::Deserializer<'de>,
27404    {
27405        #[serde_with::serde_as]
27406        #[derive(serde :: Deserialize)]
27407        struct ProjectServiceAccount {
27408            #[serde(rename = "object")]
27409            #[allow(dead_code)]
27410            object: crate::__types::project_service_account::Object,
27411            #[serde(rename = "id")]
27412            id: String,
27413            #[serde(rename = "name")]
27414            name: String,
27415            #[serde(rename = "role")]
27416            role: crate::__types::project_service_account::Role,
27417            #[serde(rename = "created_at")]
27418            created_at: i64,
27419        }
27420        let ProjectServiceAccount {
27421            id,
27422            name,
27423            role,
27424            created_at,
27425            ..
27426        } = ProjectServiceAccount::deserialize(deserializer)?;
27427        Ok(Self {
27428            id,
27429            name,
27430            role,
27431            created_at,
27432        })
27433    }
27434}
27435impl serde::Serialize for ProjectServiceAccount {
27436    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
27437    where
27438        S: serde::Serializer,
27439    {
27440        #[serde_with::serde_as]
27441        #[derive(serde :: Serialize)]
27442        struct ProjectServiceAccount<'a> {
27443            #[serde(rename = "object")]
27444            object: &'a crate::__types::project_service_account::Object,
27445            #[serde(rename = "id")]
27446            id: &'a String,
27447            #[serde(rename = "name")]
27448            name: &'a String,
27449            #[serde(rename = "role")]
27450            role: &'a crate::__types::project_service_account::Role,
27451            #[serde(rename = "created_at")]
27452            created_at: &'a i64,
27453        }
27454        let Self {
27455            id,
27456            name,
27457            role,
27458            created_at,
27459        } = self;
27460        ProjectServiceAccount {
27461            object: &Default::default(),
27462            id,
27463            name,
27464            role,
27465            created_at,
27466        }
27467        .serialize(serializer)
27468    }
27469}
27470#[allow(clippy::module_inception)]
27471pub(crate) mod project_service_account_api_key {
27472    #[doc = "The object type, which is always `organization.project.service_account.api_key`"]
27473    #[derive(Clone, Copy, Debug, Default, PartialEq)]
27474    pub(crate) struct Object;
27475    impl_serde!(Object, "organization.project.service_account.api_key");
27476}
27477#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
27478pub struct ProjectServiceAccountApiKey {
27479    pub value: String,
27480    pub name: String,
27481    pub created_at: i64,
27482    pub id: String,
27483}
27484impl<'de> serde::Deserialize<'de> for ProjectServiceAccountApiKey {
27485    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
27486    where
27487        D: serde::Deserializer<'de>,
27488    {
27489        #[serde_with::serde_as]
27490        #[derive(serde :: Deserialize)]
27491        struct ProjectServiceAccountApiKey {
27492            #[serde(rename = "object")]
27493            #[allow(dead_code)]
27494            object: crate::__types::project_service_account_api_key::Object,
27495            #[serde(rename = "value")]
27496            value: String,
27497            #[serde(rename = "name")]
27498            name: String,
27499            #[serde(rename = "created_at")]
27500            created_at: i64,
27501            #[serde(rename = "id")]
27502            id: String,
27503        }
27504        let ProjectServiceAccountApiKey {
27505            value,
27506            name,
27507            created_at,
27508            id,
27509            ..
27510        } = ProjectServiceAccountApiKey::deserialize(deserializer)?;
27511        Ok(Self {
27512            value,
27513            name,
27514            created_at,
27515            id,
27516        })
27517    }
27518}
27519impl serde::Serialize for ProjectServiceAccountApiKey {
27520    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
27521    where
27522        S: serde::Serializer,
27523    {
27524        #[serde_with::serde_as]
27525        #[derive(serde :: Serialize)]
27526        struct ProjectServiceAccountApiKey<'a> {
27527            #[serde(rename = "object")]
27528            object: &'a crate::__types::project_service_account_api_key::Object,
27529            #[serde(rename = "value")]
27530            value: &'a String,
27531            #[serde(rename = "name")]
27532            name: &'a String,
27533            #[serde(rename = "created_at")]
27534            created_at: &'a i64,
27535            #[serde(rename = "id")]
27536            id: &'a String,
27537        }
27538        let Self {
27539            value,
27540            name,
27541            created_at,
27542            id,
27543        } = self;
27544        ProjectServiceAccountApiKey {
27545            object: &Default::default(),
27546            value,
27547            name,
27548            created_at,
27549            id,
27550        }
27551        .serialize(serializer)
27552    }
27553}
27554#[derive(Clone, Debug, PartialEq)]
27555#[serde_with::serde_as]
27556#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
27557pub struct ProjectServiceAccountCreateRequest {
27558    #[doc = "The name of the service account being created."]
27559    #[serde(rename = "name")]
27560    pub name: String,
27561}
27562#[allow(clippy::module_inception)]
27563pub(crate) mod project_service_account_create_response {
27564    #[doc = "organization.project.service_account"]
27565    #[derive(Clone, Copy, Debug, Default, PartialEq)]
27566    pub(crate) struct Object;
27567    impl_serde!(Object, "organization.project.service_account");
27568    #[doc = "Service accounts can only have one role of type `member`"]
27569    #[derive(Clone, Copy, Debug, Default, PartialEq)]
27570    pub(crate) struct Role;
27571    impl_serde!(Role, "member");
27572}
27573#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
27574pub struct ProjectServiceAccountCreateResponse {
27575    pub id: String,
27576    pub name: String,
27577    pub created_at: i64,
27578    pub api_key: crate::__types::ProjectServiceAccountApiKey,
27579}
27580impl<'de> serde::Deserialize<'de> for ProjectServiceAccountCreateResponse {
27581    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
27582    where
27583        D: serde::Deserializer<'de>,
27584    {
27585        #[serde_with::serde_as]
27586        #[derive(serde :: Deserialize)]
27587        struct ProjectServiceAccountCreateResponse {
27588            #[serde(rename = "object")]
27589            #[allow(dead_code)]
27590            object: crate::__types::project_service_account_create_response::Object,
27591            #[serde(rename = "id")]
27592            id: String,
27593            #[serde(rename = "name")]
27594            name: String,
27595            #[serde(rename = "role")]
27596            #[allow(dead_code)]
27597            role: crate::__types::project_service_account_create_response::Role,
27598            #[serde(rename = "created_at")]
27599            created_at: i64,
27600            #[serde(rename = "api_key")]
27601            api_key: crate::__types::ProjectServiceAccountApiKey,
27602        }
27603        let ProjectServiceAccountCreateResponse {
27604            id,
27605            name,
27606            created_at,
27607            api_key,
27608            ..
27609        } = ProjectServiceAccountCreateResponse::deserialize(deserializer)?;
27610        Ok(Self {
27611            id,
27612            name,
27613            created_at,
27614            api_key,
27615        })
27616    }
27617}
27618impl serde::Serialize for ProjectServiceAccountCreateResponse {
27619    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
27620    where
27621        S: serde::Serializer,
27622    {
27623        #[serde_with::serde_as]
27624        #[derive(serde :: Serialize)]
27625        struct ProjectServiceAccountCreateResponse<'a> {
27626            #[serde(rename = "object")]
27627            object: &'a crate::__types::project_service_account_create_response::Object,
27628            #[serde(rename = "id")]
27629            id: &'a String,
27630            #[serde(rename = "name")]
27631            name: &'a String,
27632            #[serde(rename = "role")]
27633            role: &'a crate::__types::project_service_account_create_response::Role,
27634            #[serde(rename = "created_at")]
27635            created_at: &'a i64,
27636            #[serde(rename = "api_key")]
27637            api_key: &'a crate::__types::ProjectServiceAccountApiKey,
27638        }
27639        let Self {
27640            id,
27641            name,
27642            created_at,
27643            api_key,
27644        } = self;
27645        ProjectServiceAccountCreateResponse {
27646            object: &Default::default(),
27647            id,
27648            name,
27649            role: &Default::default(),
27650            created_at,
27651            api_key,
27652        }
27653        .serialize(serializer)
27654    }
27655}
27656#[allow(clippy::module_inception)]
27657pub(crate) mod project_service_account_delete_response {
27658    #[doc = "organization.project.service_account.deleted"]
27659    #[derive(Clone, Copy, Debug, Default, PartialEq)]
27660    pub(crate) struct Object;
27661    impl_serde!(Object, "organization.project.service_account.deleted");
27662}
27663#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
27664pub struct ProjectServiceAccountDeleteResponse {
27665    pub id: String,
27666    pub deleted: bool,
27667}
27668impl<'de> serde::Deserialize<'de> for ProjectServiceAccountDeleteResponse {
27669    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
27670    where
27671        D: serde::Deserializer<'de>,
27672    {
27673        #[serde_with::serde_as]
27674        #[derive(serde :: Deserialize)]
27675        struct ProjectServiceAccountDeleteResponse {
27676            #[serde(rename = "object")]
27677            #[allow(dead_code)]
27678            object: crate::__types::project_service_account_delete_response::Object,
27679            #[serde(rename = "id")]
27680            id: String,
27681            #[serde(rename = "deleted")]
27682            deleted: bool,
27683        }
27684        let ProjectServiceAccountDeleteResponse { id, deleted, .. } =
27685            ProjectServiceAccountDeleteResponse::deserialize(deserializer)?;
27686        Ok(Self { id, deleted })
27687    }
27688}
27689impl serde::Serialize for ProjectServiceAccountDeleteResponse {
27690    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
27691    where
27692        S: serde::Serializer,
27693    {
27694        #[serde_with::serde_as]
27695        #[derive(serde :: Serialize)]
27696        struct ProjectServiceAccountDeleteResponse<'a> {
27697            #[serde(rename = "object")]
27698            object: &'a crate::__types::project_service_account_delete_response::Object,
27699            #[serde(rename = "id")]
27700            id: &'a String,
27701            #[serde(rename = "deleted")]
27702            deleted: &'a bool,
27703        }
27704        let Self { id, deleted } = self;
27705        ProjectServiceAccountDeleteResponse {
27706            object: &Default::default(),
27707            id,
27708            deleted,
27709        }
27710        .serialize(serializer)
27711    }
27712}
27713#[allow(clippy::module_inception)]
27714pub(crate) mod project_service_account_list_response {
27715    #[doc = "list"]
27716    #[derive(Clone, Copy, Debug, Default, PartialEq)]
27717    pub(crate) struct Object;
27718    impl_serde!(Object, "list");
27719}
27720#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
27721pub struct ProjectServiceAccountListResponse {
27722    pub data: Vec<crate::__types::ProjectServiceAccount>,
27723    pub first_id: String,
27724    pub last_id: String,
27725    pub has_more: bool,
27726}
27727impl<'de> serde::Deserialize<'de> for ProjectServiceAccountListResponse {
27728    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
27729    where
27730        D: serde::Deserializer<'de>,
27731    {
27732        #[serde_with::serde_as]
27733        #[derive(serde :: Deserialize)]
27734        struct ProjectServiceAccountListResponse {
27735            #[serde(rename = "object")]
27736            #[allow(dead_code)]
27737            object: crate::__types::project_service_account_list_response::Object,
27738            #[serde(rename = "data")]
27739            data: Vec<crate::__types::ProjectServiceAccount>,
27740            #[serde(rename = "first_id")]
27741            first_id: String,
27742            #[serde(rename = "last_id")]
27743            last_id: String,
27744            #[serde(rename = "has_more")]
27745            has_more: bool,
27746        }
27747        let ProjectServiceAccountListResponse {
27748            data,
27749            first_id,
27750            last_id,
27751            has_more,
27752            ..
27753        } = ProjectServiceAccountListResponse::deserialize(deserializer)?;
27754        Ok(Self {
27755            data,
27756            first_id,
27757            last_id,
27758            has_more,
27759        })
27760    }
27761}
27762impl serde::Serialize for ProjectServiceAccountListResponse {
27763    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
27764    where
27765        S: serde::Serializer,
27766    {
27767        #[serde_with::serde_as]
27768        #[derive(serde :: Serialize)]
27769        struct ProjectServiceAccountListResponse<'a> {
27770            #[serde(rename = "object")]
27771            object: &'a crate::__types::project_service_account_list_response::Object,
27772            #[serde(rename = "data")]
27773            data: &'a Vec<crate::__types::ProjectServiceAccount>,
27774            #[serde(rename = "first_id")]
27775            first_id: &'a String,
27776            #[serde(rename = "last_id")]
27777            last_id: &'a String,
27778            #[serde(rename = "has_more")]
27779            has_more: &'a bool,
27780        }
27781        let Self {
27782            data,
27783            first_id,
27784            last_id,
27785            has_more,
27786        } = self;
27787        ProjectServiceAccountListResponse {
27788            object: &Default::default(),
27789            data,
27790            first_id,
27791            last_id,
27792            has_more,
27793        }
27794        .serialize(serializer)
27795    }
27796}
27797#[derive(Clone, Debug, PartialEq)]
27798#[serde_with::serde_as]
27799#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
27800pub struct ProjectUpdateRequest {
27801    #[doc = "The updated name of the project, this name appears in reports."]
27802    #[serde(rename = "name")]
27803    pub name: String,
27804}
27805#[allow(clippy::module_inception)]
27806pub mod project_user {
27807    #[doc = "The object type, which is always `organization.project.user`"]
27808    #[derive(Clone, Copy, Debug, Default, PartialEq)]
27809    pub(crate) struct Object;
27810    impl_serde!(Object, "organization.project.user");
27811    #[doc = "`owner` or `member`"]
27812    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
27813    pub enum Role {
27814        #[doc = "`owner`"]
27815        #[serde(rename = "owner")]
27816        Owner,
27817        #[doc = "`member`"]
27818        #[serde(rename = "member")]
27819        Member,
27820    }
27821}
27822#[doc = "Represents an individual user in a project."]
27823#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
27824pub struct ProjectUser {
27825    #[doc = "The identifier, which can be referenced in API endpoints"]
27826    pub id: String,
27827    #[doc = "The name of the user"]
27828    pub name: String,
27829    #[doc = "The email address of the user"]
27830    pub email: String,
27831    #[doc = "`owner` or `member`"]
27832    pub role: crate::__types::project_user::Role,
27833    #[doc = "The Unix timestamp (in seconds) of when the project was added."]
27834    pub added_at: i64,
27835}
27836impl<'de> serde::Deserialize<'de> for ProjectUser {
27837    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
27838    where
27839        D: serde::Deserializer<'de>,
27840    {
27841        #[serde_with::serde_as]
27842        #[derive(serde :: Deserialize)]
27843        struct ProjectUser {
27844            #[serde(rename = "object")]
27845            #[allow(dead_code)]
27846            object: crate::__types::project_user::Object,
27847            #[serde(rename = "id")]
27848            id: String,
27849            #[serde(rename = "name")]
27850            name: String,
27851            #[serde(rename = "email")]
27852            email: String,
27853            #[serde(rename = "role")]
27854            role: crate::__types::project_user::Role,
27855            #[serde(rename = "added_at")]
27856            added_at: i64,
27857        }
27858        let ProjectUser {
27859            id,
27860            name,
27861            email,
27862            role,
27863            added_at,
27864            ..
27865        } = ProjectUser::deserialize(deserializer)?;
27866        Ok(Self {
27867            id,
27868            name,
27869            email,
27870            role,
27871            added_at,
27872        })
27873    }
27874}
27875impl serde::Serialize for ProjectUser {
27876    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
27877    where
27878        S: serde::Serializer,
27879    {
27880        #[serde_with::serde_as]
27881        #[derive(serde :: Serialize)]
27882        struct ProjectUser<'a> {
27883            #[serde(rename = "object")]
27884            object: &'a crate::__types::project_user::Object,
27885            #[serde(rename = "id")]
27886            id: &'a String,
27887            #[serde(rename = "name")]
27888            name: &'a String,
27889            #[serde(rename = "email")]
27890            email: &'a String,
27891            #[serde(rename = "role")]
27892            role: &'a crate::__types::project_user::Role,
27893            #[serde(rename = "added_at")]
27894            added_at: &'a i64,
27895        }
27896        let Self {
27897            id,
27898            name,
27899            email,
27900            role,
27901            added_at,
27902        } = self;
27903        ProjectUser {
27904            object: &Default::default(),
27905            id,
27906            name,
27907            email,
27908            role,
27909            added_at,
27910        }
27911        .serialize(serializer)
27912    }
27913}
27914#[allow(clippy::module_inception)]
27915pub mod project_user_create_request {
27916    #[doc = "`owner` or `member`"]
27917    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
27918    pub enum Role {
27919        #[doc = "`owner`"]
27920        #[serde(rename = "owner")]
27921        Owner,
27922        #[doc = "`member`"]
27923        #[serde(rename = "member")]
27924        Member,
27925    }
27926}
27927#[derive(Clone, Debug, PartialEq)]
27928#[serde_with::serde_as]
27929#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
27930pub struct ProjectUserCreateRequest {
27931    #[doc = "The ID of the user."]
27932    #[serde(rename = "user_id")]
27933    pub user_id: String,
27934    #[doc = "`owner` or `member`"]
27935    #[serde(rename = "role")]
27936    pub role: crate::__types::project_user_create_request::Role,
27937}
27938#[allow(clippy::module_inception)]
27939pub(crate) mod project_user_delete_response {
27940    #[doc = "organization.project.user.deleted"]
27941    #[derive(Clone, Copy, Debug, Default, PartialEq)]
27942    pub(crate) struct Object;
27943    impl_serde!(Object, "organization.project.user.deleted");
27944}
27945#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
27946pub struct ProjectUserDeleteResponse {
27947    pub id: String,
27948    pub deleted: bool,
27949}
27950impl<'de> serde::Deserialize<'de> for ProjectUserDeleteResponse {
27951    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
27952    where
27953        D: serde::Deserializer<'de>,
27954    {
27955        #[serde_with::serde_as]
27956        #[derive(serde :: Deserialize)]
27957        struct ProjectUserDeleteResponse {
27958            #[serde(rename = "object")]
27959            #[allow(dead_code)]
27960            object: crate::__types::project_user_delete_response::Object,
27961            #[serde(rename = "id")]
27962            id: String,
27963            #[serde(rename = "deleted")]
27964            deleted: bool,
27965        }
27966        let ProjectUserDeleteResponse { id, deleted, .. } =
27967            ProjectUserDeleteResponse::deserialize(deserializer)?;
27968        Ok(Self { id, deleted })
27969    }
27970}
27971impl serde::Serialize for ProjectUserDeleteResponse {
27972    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
27973    where
27974        S: serde::Serializer,
27975    {
27976        #[serde_with::serde_as]
27977        #[derive(serde :: Serialize)]
27978        struct ProjectUserDeleteResponse<'a> {
27979            #[serde(rename = "object")]
27980            object: &'a crate::__types::project_user_delete_response::Object,
27981            #[serde(rename = "id")]
27982            id: &'a String,
27983            #[serde(rename = "deleted")]
27984            deleted: &'a bool,
27985        }
27986        let Self { id, deleted } = self;
27987        ProjectUserDeleteResponse {
27988            object: &Default::default(),
27989            id,
27990            deleted,
27991        }
27992        .serialize(serializer)
27993    }
27994}
27995#[derive(Clone, Debug, PartialEq)]
27996#[serde_with::serde_as]
27997#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
27998pub struct ProjectUserListResponse {
27999    #[serde(rename = "object")]
28000    pub object: String,
28001    #[serde(rename = "data")]
28002    pub data: Vec<crate::__types::ProjectUser>,
28003    #[serde(rename = "first_id")]
28004    pub first_id: String,
28005    #[serde(rename = "last_id")]
28006    pub last_id: String,
28007    #[serde(rename = "has_more")]
28008    pub has_more: bool,
28009}
28010#[allow(clippy::module_inception)]
28011pub mod project_user_update_request {
28012    #[doc = "`owner` or `member`"]
28013    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
28014    pub enum Role {
28015        #[doc = "`owner`"]
28016        #[serde(rename = "owner")]
28017        Owner,
28018        #[doc = "`member`"]
28019        #[serde(rename = "member")]
28020        Member,
28021    }
28022}
28023#[derive(Clone, Copy, Debug, PartialEq)]
28024#[serde_with::serde_as]
28025#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
28026pub struct ProjectUserUpdateRequest {
28027    #[doc = "`owner` or `member`"]
28028    #[serde(rename = "role")]
28029    pub role: crate::__types::project_user_update_request::Role,
28030}
28031#[doc = "Reference to a prompt template and its variables. \n[Learn more](https://platform.openai.com/docs/guides/text?api-mode=responses#reusable-prompts).\n"]
28032#[derive(Clone, Debug, PartialEq)]
28033#[serde_with::serde_as]
28034#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
28035pub struct Prompt {
28036    #[doc = "The unique identifier of the prompt template to use."]
28037    #[serde(rename = "id")]
28038    pub id: String,
28039    #[doc = "Optional version of the prompt template."]
28040    #[serde(rename = "version")]
28041    #[serde(skip_serializing_if = "Option::is_none")]
28042    #[builder(default)]
28043    pub version: Option<String>,
28044    #[serde(rename = "variables")]
28045    #[serde(skip_serializing_if = "Option::is_none")]
28046    #[builder(default)]
28047    pub variables: Option<crate::__types::ResponsePromptVariables>,
28048}
28049#[doc = "A realtime client event.\n"]
28050#[derive(Clone, Debug, PartialEq)]
28051#[serde_with::serde_as]
28052#[derive(serde :: Deserialize, serde :: Serialize)]
28053#[serde(untagged)]
28054#[allow(clippy::large_enum_variant)]
28055pub enum RealtimeClientEvent {
28056    ConversationItemCreate(crate::__types::RealtimeClientEventConversationItemCreate),
28057    ConversationItemDelete(crate::__types::RealtimeClientEventConversationItemDelete),
28058    ConversationItemRetrieve(crate::__types::RealtimeClientEventConversationItemRetrieve),
28059    ConversationItemTruncate(crate::__types::RealtimeClientEventConversationItemTruncate),
28060    InputAudioBufferAppend(crate::__types::RealtimeClientEventInputAudioBufferAppend),
28061    InputAudioBufferClear(crate::__types::RealtimeClientEventInputAudioBufferClear),
28062    OutputAudioBufferClear(crate::__types::RealtimeClientEventOutputAudioBufferClear),
28063    InputAudioBufferCommit(crate::__types::RealtimeClientEventInputAudioBufferCommit),
28064    ResponseCancel(crate::__types::RealtimeClientEventResponseCancel),
28065    ResponseCreate(crate::__types::RealtimeClientEventResponseCreate),
28066    SessionUpdate(crate::__types::RealtimeClientEventSessionUpdate),
28067    TranscriptionSessionUpdate(crate::__types::RealtimeClientEventTranscriptionSessionUpdate),
28068}
28069#[allow(clippy::module_inception)]
28070pub(crate) mod realtime_client_event_conversation_item_create {
28071    #[doc = "The event type, must be `conversation.item.create`."]
28072    #[derive(Clone, Copy, Debug, Default, PartialEq)]
28073    pub(crate) struct Type;
28074    impl_serde!(Type, "conversation.item.create");
28075}
28076#[doc = "Add a new Item to the Conversation's context, including messages, function \ncalls, and function call responses. This event can be used both to populate a \n\"history\" of the conversation and to add new items mid-stream, but has the \ncurrent limitation that it cannot populate assistant audio messages.\n\nIf successful, the server will respond with a `conversation.item.created` \nevent, otherwise an `error` event will be sent.\n"]
28077#[derive(Clone, Debug, Default, PartialEq, typed_builder :: TypedBuilder)]
28078pub struct RealtimeClientEventConversationItemCreate {
28079    #[doc = "Optional client-generated ID used to identify this event."]
28080    #[builder(default)]
28081    pub event_id: Option<String>,
28082    #[doc = "The ID of the preceding item after which the new item will be inserted. \nIf not set, the new item will be appended to the end of the conversation.\nIf set to `root`, the new item will be added to the beginning of the conversation.\nIf set to an existing ID, it allows an item to be inserted mid-conversation. If the\nID cannot be found, an error will be returned and the item will not be added.\n"]
28083    #[builder(default)]
28084    pub previous_item_id: Option<String>,
28085    #[builder(default)]
28086    pub item: crate::__types::RealtimeConversationItem,
28087}
28088impl<'de> serde::Deserialize<'de> for RealtimeClientEventConversationItemCreate {
28089    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
28090    where
28091        D: serde::Deserializer<'de>,
28092    {
28093        #[serde_with::serde_as]
28094        #[derive(serde :: Deserialize)]
28095        struct RealtimeClientEventConversationItemCreate {
28096            #[serde(rename = "event_id")]
28097            event_id: Option<String>,
28098            #[serde(rename = "type")]
28099            #[allow(dead_code)]
28100            r#type: crate::__types::realtime_client_event_conversation_item_create::Type,
28101            #[serde(rename = "previous_item_id")]
28102            previous_item_id: Option<String>,
28103            #[serde(rename = "item")]
28104            item: crate::__types::RealtimeConversationItem,
28105        }
28106        let RealtimeClientEventConversationItemCreate {
28107            event_id,
28108            previous_item_id,
28109            item,
28110            ..
28111        } = RealtimeClientEventConversationItemCreate::deserialize(deserializer)?;
28112        Ok(Self {
28113            event_id,
28114            previous_item_id,
28115            item,
28116        })
28117    }
28118}
28119impl serde::Serialize for RealtimeClientEventConversationItemCreate {
28120    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
28121    where
28122        S: serde::Serializer,
28123    {
28124        #[serde_with::serde_as]
28125        #[derive(serde :: Serialize)]
28126        struct RealtimeClientEventConversationItemCreate<'a> {
28127            #[serde(rename = "event_id")]
28128            #[serde(skip_serializing_if = "Option::is_none")]
28129            event_id: &'a Option<String>,
28130            #[serde(rename = "type")]
28131            r#type: &'a crate::__types::realtime_client_event_conversation_item_create::Type,
28132            #[serde(rename = "previous_item_id")]
28133            #[serde(skip_serializing_if = "Option::is_none")]
28134            previous_item_id: &'a Option<String>,
28135            #[serde(rename = "item")]
28136            item: &'a crate::__types::RealtimeConversationItem,
28137        }
28138        let Self {
28139            event_id,
28140            previous_item_id,
28141            item,
28142        } = self;
28143        RealtimeClientEventConversationItemCreate {
28144            event_id,
28145            r#type: &Default::default(),
28146            previous_item_id,
28147            item,
28148        }
28149        .serialize(serializer)
28150    }
28151}
28152#[allow(clippy::module_inception)]
28153pub(crate) mod realtime_client_event_conversation_item_delete {
28154    #[doc = "The event type, must be `conversation.item.delete`."]
28155    #[derive(Clone, Copy, Debug, Default, PartialEq)]
28156    pub(crate) struct Type;
28157    impl_serde!(Type, "conversation.item.delete");
28158}
28159#[doc = "Send this event when you want to remove any item from the conversation \nhistory. The server will respond with a `conversation.item.deleted` event, \nunless the item does not exist in the conversation history, in which case the \nserver will respond with an error.\n"]
28160#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
28161pub struct RealtimeClientEventConversationItemDelete {
28162    #[doc = "Optional client-generated ID used to identify this event."]
28163    #[builder(default)]
28164    pub event_id: Option<String>,
28165    #[doc = "The ID of the item to delete."]
28166    pub item_id: String,
28167}
28168impl<'de> serde::Deserialize<'de> for RealtimeClientEventConversationItemDelete {
28169    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
28170    where
28171        D: serde::Deserializer<'de>,
28172    {
28173        #[serde_with::serde_as]
28174        #[derive(serde :: Deserialize)]
28175        struct RealtimeClientEventConversationItemDelete {
28176            #[serde(rename = "event_id")]
28177            event_id: Option<String>,
28178            #[serde(rename = "type")]
28179            #[allow(dead_code)]
28180            r#type: crate::__types::realtime_client_event_conversation_item_delete::Type,
28181            #[serde(rename = "item_id")]
28182            item_id: String,
28183        }
28184        let RealtimeClientEventConversationItemDelete {
28185            event_id, item_id, ..
28186        } = RealtimeClientEventConversationItemDelete::deserialize(deserializer)?;
28187        Ok(Self { event_id, item_id })
28188    }
28189}
28190impl serde::Serialize for RealtimeClientEventConversationItemDelete {
28191    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
28192    where
28193        S: serde::Serializer,
28194    {
28195        #[serde_with::serde_as]
28196        #[derive(serde :: Serialize)]
28197        struct RealtimeClientEventConversationItemDelete<'a> {
28198            #[serde(rename = "event_id")]
28199            #[serde(skip_serializing_if = "Option::is_none")]
28200            event_id: &'a Option<String>,
28201            #[serde(rename = "type")]
28202            r#type: &'a crate::__types::realtime_client_event_conversation_item_delete::Type,
28203            #[serde(rename = "item_id")]
28204            item_id: &'a String,
28205        }
28206        let Self { event_id, item_id } = self;
28207        RealtimeClientEventConversationItemDelete {
28208            event_id,
28209            r#type: &Default::default(),
28210            item_id,
28211        }
28212        .serialize(serializer)
28213    }
28214}
28215#[allow(clippy::module_inception)]
28216pub(crate) mod realtime_client_event_conversation_item_retrieve {
28217    #[doc = "The event type, must be `conversation.item.retrieve`."]
28218    #[derive(Clone, Copy, Debug, Default, PartialEq)]
28219    pub(crate) struct Type;
28220    impl_serde!(Type, "conversation.item.retrieve");
28221}
28222#[doc = "Send this event when you want to retrieve the server's representation of a specific item in the conversation history. This is useful, for example, to inspect user audio after noise cancellation and VAD.\nThe server will respond with a `conversation.item.retrieved` event, \nunless the item does not exist in the conversation history, in which case the \nserver will respond with an error.\n"]
28223#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
28224pub struct RealtimeClientEventConversationItemRetrieve {
28225    #[doc = "Optional client-generated ID used to identify this event."]
28226    #[builder(default)]
28227    pub event_id: Option<String>,
28228    #[doc = "The ID of the item to retrieve."]
28229    pub item_id: String,
28230}
28231impl<'de> serde::Deserialize<'de> for RealtimeClientEventConversationItemRetrieve {
28232    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
28233    where
28234        D: serde::Deserializer<'de>,
28235    {
28236        #[serde_with::serde_as]
28237        #[derive(serde :: Deserialize)]
28238        struct RealtimeClientEventConversationItemRetrieve {
28239            #[serde(rename = "event_id")]
28240            event_id: Option<String>,
28241            #[serde(rename = "type")]
28242            #[allow(dead_code)]
28243            r#type: crate::__types::realtime_client_event_conversation_item_retrieve::Type,
28244            #[serde(rename = "item_id")]
28245            item_id: String,
28246        }
28247        let RealtimeClientEventConversationItemRetrieve {
28248            event_id, item_id, ..
28249        } = RealtimeClientEventConversationItemRetrieve::deserialize(deserializer)?;
28250        Ok(Self { event_id, item_id })
28251    }
28252}
28253impl serde::Serialize for RealtimeClientEventConversationItemRetrieve {
28254    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
28255    where
28256        S: serde::Serializer,
28257    {
28258        #[serde_with::serde_as]
28259        #[derive(serde :: Serialize)]
28260        struct RealtimeClientEventConversationItemRetrieve<'a> {
28261            #[serde(rename = "event_id")]
28262            #[serde(skip_serializing_if = "Option::is_none")]
28263            event_id: &'a Option<String>,
28264            #[serde(rename = "type")]
28265            r#type: &'a crate::__types::realtime_client_event_conversation_item_retrieve::Type,
28266            #[serde(rename = "item_id")]
28267            item_id: &'a String,
28268        }
28269        let Self { event_id, item_id } = self;
28270        RealtimeClientEventConversationItemRetrieve {
28271            event_id,
28272            r#type: &Default::default(),
28273            item_id,
28274        }
28275        .serialize(serializer)
28276    }
28277}
28278#[allow(clippy::module_inception)]
28279pub(crate) mod realtime_client_event_conversation_item_truncate {
28280    #[doc = "The event type, must be `conversation.item.truncate`."]
28281    #[derive(Clone, Copy, Debug, Default, PartialEq)]
28282    pub(crate) struct Type;
28283    impl_serde!(Type, "conversation.item.truncate");
28284}
28285#[doc = "Send this event to truncate a previous assistant message’s audio. The server \nwill produce audio faster than realtime, so this event is useful when the user \ninterrupts to truncate audio that has already been sent to the client but not \nyet played. This will synchronize the server's understanding of the audio with \nthe client's playback.\n\nTruncating audio will delete the server-side text transcript to ensure there \nis not text in the context that hasn't been heard by the user.\n\nIf successful, the server will respond with a `conversation.item.truncated` \nevent. \n"]
28286#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
28287pub struct RealtimeClientEventConversationItemTruncate {
28288    #[doc = "Optional client-generated ID used to identify this event."]
28289    #[builder(default)]
28290    pub event_id: Option<String>,
28291    #[doc = "The ID of the assistant message item to truncate. Only assistant message \nitems can be truncated.\n"]
28292    pub item_id: String,
28293    #[doc = "The index of the content part to truncate. Set this to 0."]
28294    pub content_index: i64,
28295    #[doc = "Inclusive duration up to which audio is truncated, in milliseconds. If \nthe audio_end_ms is greater than the actual audio duration, the server \nwill respond with an error.\n"]
28296    pub audio_end_ms: i64,
28297}
28298impl<'de> serde::Deserialize<'de> for RealtimeClientEventConversationItemTruncate {
28299    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
28300    where
28301        D: serde::Deserializer<'de>,
28302    {
28303        #[serde_with::serde_as]
28304        #[derive(serde :: Deserialize)]
28305        struct RealtimeClientEventConversationItemTruncate {
28306            #[serde(rename = "event_id")]
28307            event_id: Option<String>,
28308            #[serde(rename = "type")]
28309            #[allow(dead_code)]
28310            r#type: crate::__types::realtime_client_event_conversation_item_truncate::Type,
28311            #[serde(rename = "item_id")]
28312            item_id: String,
28313            #[serde(rename = "content_index")]
28314            content_index: i64,
28315            #[serde(rename = "audio_end_ms")]
28316            audio_end_ms: i64,
28317        }
28318        let RealtimeClientEventConversationItemTruncate {
28319            event_id,
28320            item_id,
28321            content_index,
28322            audio_end_ms,
28323            ..
28324        } = RealtimeClientEventConversationItemTruncate::deserialize(deserializer)?;
28325        Ok(Self {
28326            event_id,
28327            item_id,
28328            content_index,
28329            audio_end_ms,
28330        })
28331    }
28332}
28333impl serde::Serialize for RealtimeClientEventConversationItemTruncate {
28334    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
28335    where
28336        S: serde::Serializer,
28337    {
28338        #[serde_with::serde_as]
28339        #[derive(serde :: Serialize)]
28340        struct RealtimeClientEventConversationItemTruncate<'a> {
28341            #[serde(rename = "event_id")]
28342            #[serde(skip_serializing_if = "Option::is_none")]
28343            event_id: &'a Option<String>,
28344            #[serde(rename = "type")]
28345            r#type: &'a crate::__types::realtime_client_event_conversation_item_truncate::Type,
28346            #[serde(rename = "item_id")]
28347            item_id: &'a String,
28348            #[serde(rename = "content_index")]
28349            content_index: &'a i64,
28350            #[serde(rename = "audio_end_ms")]
28351            audio_end_ms: &'a i64,
28352        }
28353        let Self {
28354            event_id,
28355            item_id,
28356            content_index,
28357            audio_end_ms,
28358        } = self;
28359        RealtimeClientEventConversationItemTruncate {
28360            event_id,
28361            r#type: &Default::default(),
28362            item_id,
28363            content_index,
28364            audio_end_ms,
28365        }
28366        .serialize(serializer)
28367    }
28368}
28369#[allow(clippy::module_inception)]
28370pub(crate) mod realtime_client_event_input_audio_buffer_append {
28371    #[doc = "The event type, must be `input_audio_buffer.append`."]
28372    #[derive(Clone, Copy, Debug, Default, PartialEq)]
28373    pub(crate) struct Type;
28374    impl_serde!(Type, "input_audio_buffer.append");
28375}
28376#[doc = "Send this event to append audio bytes to the input audio buffer. The audio \nbuffer is temporary storage you can write to and later commit. In Server VAD \nmode, the audio buffer is used to detect speech and the server will decide \nwhen to commit. When Server VAD is disabled, you must commit the audio buffer\nmanually.\n\nThe client may choose how much audio to place in each event up to a maximum \nof 15 MiB, for example streaming smaller chunks from the client may allow the \nVAD to be more responsive. Unlike made other client events, the server will \nnot send a confirmation response to this event.\n"]
28377#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
28378pub struct RealtimeClientEventInputAudioBufferAppend {
28379    #[doc = "Optional client-generated ID used to identify this event."]
28380    #[builder(default)]
28381    pub event_id: Option<String>,
28382    #[doc = "Base64-encoded audio bytes. This must be in the format specified by the \n`input_audio_format` field in the session configuration.\n"]
28383    pub audio: String,
28384}
28385impl<'de> serde::Deserialize<'de> for RealtimeClientEventInputAudioBufferAppend {
28386    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
28387    where
28388        D: serde::Deserializer<'de>,
28389    {
28390        #[serde_with::serde_as]
28391        #[derive(serde :: Deserialize)]
28392        struct RealtimeClientEventInputAudioBufferAppend {
28393            #[serde(rename = "event_id")]
28394            event_id: Option<String>,
28395            #[serde(rename = "type")]
28396            #[allow(dead_code)]
28397            r#type: crate::__types::realtime_client_event_input_audio_buffer_append::Type,
28398            #[serde(rename = "audio")]
28399            audio: String,
28400        }
28401        let RealtimeClientEventInputAudioBufferAppend {
28402            event_id, audio, ..
28403        } = RealtimeClientEventInputAudioBufferAppend::deserialize(deserializer)?;
28404        Ok(Self { event_id, audio })
28405    }
28406}
28407impl serde::Serialize for RealtimeClientEventInputAudioBufferAppend {
28408    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
28409    where
28410        S: serde::Serializer,
28411    {
28412        #[serde_with::serde_as]
28413        #[derive(serde :: Serialize)]
28414        struct RealtimeClientEventInputAudioBufferAppend<'a> {
28415            #[serde(rename = "event_id")]
28416            #[serde(skip_serializing_if = "Option::is_none")]
28417            event_id: &'a Option<String>,
28418            #[serde(rename = "type")]
28419            r#type: &'a crate::__types::realtime_client_event_input_audio_buffer_append::Type,
28420            #[serde(rename = "audio")]
28421            audio: &'a String,
28422        }
28423        let Self { event_id, audio } = self;
28424        RealtimeClientEventInputAudioBufferAppend {
28425            event_id,
28426            r#type: &Default::default(),
28427            audio,
28428        }
28429        .serialize(serializer)
28430    }
28431}
28432#[allow(clippy::module_inception)]
28433pub(crate) mod realtime_client_event_input_audio_buffer_clear {
28434    #[doc = "The event type, must be `input_audio_buffer.clear`."]
28435    #[derive(Clone, Copy, Debug, Default, PartialEq)]
28436    pub(crate) struct Type;
28437    impl_serde!(Type, "input_audio_buffer.clear");
28438}
28439#[doc = "Send this event to clear the audio bytes in the buffer. The server will \nrespond with an `input_audio_buffer.cleared` event.\n"]
28440#[derive(Clone, Debug, Default, PartialEq, typed_builder :: TypedBuilder)]
28441pub struct RealtimeClientEventInputAudioBufferClear {
28442    #[doc = "Optional client-generated ID used to identify this event."]
28443    #[builder(default)]
28444    pub event_id: Option<String>,
28445}
28446impl<'de> serde::Deserialize<'de> for RealtimeClientEventInputAudioBufferClear {
28447    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
28448    where
28449        D: serde::Deserializer<'de>,
28450    {
28451        #[serde_with::serde_as]
28452        #[derive(serde :: Deserialize)]
28453        struct RealtimeClientEventInputAudioBufferClear {
28454            #[serde(rename = "event_id")]
28455            event_id: Option<String>,
28456            #[serde(rename = "type")]
28457            #[allow(dead_code)]
28458            r#type: crate::__types::realtime_client_event_input_audio_buffer_clear::Type,
28459        }
28460        let RealtimeClientEventInputAudioBufferClear { event_id, .. } =
28461            RealtimeClientEventInputAudioBufferClear::deserialize(deserializer)?;
28462        Ok(Self { event_id })
28463    }
28464}
28465impl serde::Serialize for RealtimeClientEventInputAudioBufferClear {
28466    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
28467    where
28468        S: serde::Serializer,
28469    {
28470        #[serde_with::serde_as]
28471        #[derive(serde :: Serialize)]
28472        struct RealtimeClientEventInputAudioBufferClear<'a> {
28473            #[serde(rename = "event_id")]
28474            #[serde(skip_serializing_if = "Option::is_none")]
28475            event_id: &'a Option<String>,
28476            #[serde(rename = "type")]
28477            r#type: &'a crate::__types::realtime_client_event_input_audio_buffer_clear::Type,
28478        }
28479        let Self { event_id } = self;
28480        RealtimeClientEventInputAudioBufferClear {
28481            event_id,
28482            r#type: &Default::default(),
28483        }
28484        .serialize(serializer)
28485    }
28486}
28487#[allow(clippy::module_inception)]
28488pub(crate) mod realtime_client_event_input_audio_buffer_commit {
28489    #[doc = "The event type, must be `input_audio_buffer.commit`."]
28490    #[derive(Clone, Copy, Debug, Default, PartialEq)]
28491    pub(crate) struct Type;
28492    impl_serde!(Type, "input_audio_buffer.commit");
28493}
28494#[doc = "Send this event to commit the user input audio buffer, which will create a \nnew user message item in the conversation. This event will produce an error \nif the input audio buffer is empty. When in Server VAD mode, the client does \nnot need to send this event, the server will commit the audio buffer \nautomatically.\n\nCommitting the input audio buffer will trigger input audio transcription \n(if enabled in session configuration), but it will not create a response \nfrom the model. The server will respond with an `input_audio_buffer.committed` \nevent.\n"]
28495#[derive(Clone, Debug, Default, PartialEq, typed_builder :: TypedBuilder)]
28496pub struct RealtimeClientEventInputAudioBufferCommit {
28497    #[doc = "Optional client-generated ID used to identify this event."]
28498    #[builder(default)]
28499    pub event_id: Option<String>,
28500}
28501impl<'de> serde::Deserialize<'de> for RealtimeClientEventInputAudioBufferCommit {
28502    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
28503    where
28504        D: serde::Deserializer<'de>,
28505    {
28506        #[serde_with::serde_as]
28507        #[derive(serde :: Deserialize)]
28508        struct RealtimeClientEventInputAudioBufferCommit {
28509            #[serde(rename = "event_id")]
28510            event_id: Option<String>,
28511            #[serde(rename = "type")]
28512            #[allow(dead_code)]
28513            r#type: crate::__types::realtime_client_event_input_audio_buffer_commit::Type,
28514        }
28515        let RealtimeClientEventInputAudioBufferCommit { event_id, .. } =
28516            RealtimeClientEventInputAudioBufferCommit::deserialize(deserializer)?;
28517        Ok(Self { event_id })
28518    }
28519}
28520impl serde::Serialize for RealtimeClientEventInputAudioBufferCommit {
28521    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
28522    where
28523        S: serde::Serializer,
28524    {
28525        #[serde_with::serde_as]
28526        #[derive(serde :: Serialize)]
28527        struct RealtimeClientEventInputAudioBufferCommit<'a> {
28528            #[serde(rename = "event_id")]
28529            #[serde(skip_serializing_if = "Option::is_none")]
28530            event_id: &'a Option<String>,
28531            #[serde(rename = "type")]
28532            r#type: &'a crate::__types::realtime_client_event_input_audio_buffer_commit::Type,
28533        }
28534        let Self { event_id } = self;
28535        RealtimeClientEventInputAudioBufferCommit {
28536            event_id,
28537            r#type: &Default::default(),
28538        }
28539        .serialize(serializer)
28540    }
28541}
28542#[allow(clippy::module_inception)]
28543pub(crate) mod realtime_client_event_output_audio_buffer_clear {
28544    #[doc = "The event type, must be `output_audio_buffer.clear`."]
28545    #[derive(Clone, Copy, Debug, Default, PartialEq)]
28546    pub(crate) struct Type;
28547    impl_serde!(Type, "output_audio_buffer.clear");
28548}
28549#[doc = "**WebRTC Only:** Emit to cut off the current audio response. This will trigger the server to\nstop generating audio and emit a `output_audio_buffer.cleared` event. This \nevent should be preceded by a `response.cancel` client event to stop the \ngeneration of the current response.\n[Learn more](https://platform.openai.com/docs/guides/realtime-conversations#client-and-server-events-for-audio-in-webrtc).\n"]
28550#[derive(Clone, Debug, Default, PartialEq, typed_builder :: TypedBuilder)]
28551pub struct RealtimeClientEventOutputAudioBufferClear {
28552    #[doc = "The unique ID of the client event used for error handling."]
28553    #[builder(default)]
28554    pub event_id: Option<String>,
28555}
28556impl<'de> serde::Deserialize<'de> for RealtimeClientEventOutputAudioBufferClear {
28557    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
28558    where
28559        D: serde::Deserializer<'de>,
28560    {
28561        #[serde_with::serde_as]
28562        #[derive(serde :: Deserialize)]
28563        struct RealtimeClientEventOutputAudioBufferClear {
28564            #[serde(rename = "event_id")]
28565            event_id: Option<String>,
28566            #[serde(rename = "type")]
28567            #[allow(dead_code)]
28568            r#type: crate::__types::realtime_client_event_output_audio_buffer_clear::Type,
28569        }
28570        let RealtimeClientEventOutputAudioBufferClear { event_id, .. } =
28571            RealtimeClientEventOutputAudioBufferClear::deserialize(deserializer)?;
28572        Ok(Self { event_id })
28573    }
28574}
28575impl serde::Serialize for RealtimeClientEventOutputAudioBufferClear {
28576    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
28577    where
28578        S: serde::Serializer,
28579    {
28580        #[serde_with::serde_as]
28581        #[derive(serde :: Serialize)]
28582        struct RealtimeClientEventOutputAudioBufferClear<'a> {
28583            #[serde(rename = "event_id")]
28584            #[serde(skip_serializing_if = "Option::is_none")]
28585            event_id: &'a Option<String>,
28586            #[serde(rename = "type")]
28587            r#type: &'a crate::__types::realtime_client_event_output_audio_buffer_clear::Type,
28588        }
28589        let Self { event_id } = self;
28590        RealtimeClientEventOutputAudioBufferClear {
28591            event_id,
28592            r#type: &Default::default(),
28593        }
28594        .serialize(serializer)
28595    }
28596}
28597#[allow(clippy::module_inception)]
28598pub(crate) mod realtime_client_event_response_cancel {
28599    #[doc = "The event type, must be `response.cancel`."]
28600    #[derive(Clone, Copy, Debug, Default, PartialEq)]
28601    pub(crate) struct Type;
28602    impl_serde!(Type, "response.cancel");
28603}
28604#[doc = "Send this event to cancel an in-progress response. The server will respond \nwith a `response.done` event with a status of `response.status=cancelled`. If \nthere is no response to cancel, the server will respond with an error.\n"]
28605#[derive(Clone, Debug, Default, PartialEq, typed_builder :: TypedBuilder)]
28606pub struct RealtimeClientEventResponseCancel {
28607    #[doc = "Optional client-generated ID used to identify this event."]
28608    #[builder(default)]
28609    pub event_id: Option<String>,
28610    #[doc = "A specific response ID to cancel - if not provided, will cancel an \nin-progress response in the default conversation.\n"]
28611    #[builder(default)]
28612    pub response_id: Option<String>,
28613}
28614impl<'de> serde::Deserialize<'de> for RealtimeClientEventResponseCancel {
28615    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
28616    where
28617        D: serde::Deserializer<'de>,
28618    {
28619        #[serde_with::serde_as]
28620        #[derive(serde :: Deserialize)]
28621        struct RealtimeClientEventResponseCancel {
28622            #[serde(rename = "event_id")]
28623            event_id: Option<String>,
28624            #[serde(rename = "type")]
28625            #[allow(dead_code)]
28626            r#type: crate::__types::realtime_client_event_response_cancel::Type,
28627            #[serde(rename = "response_id")]
28628            response_id: Option<String>,
28629        }
28630        let RealtimeClientEventResponseCancel {
28631            event_id,
28632            response_id,
28633            ..
28634        } = RealtimeClientEventResponseCancel::deserialize(deserializer)?;
28635        Ok(Self {
28636            event_id,
28637            response_id,
28638        })
28639    }
28640}
28641impl serde::Serialize for RealtimeClientEventResponseCancel {
28642    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
28643    where
28644        S: serde::Serializer,
28645    {
28646        #[serde_with::serde_as]
28647        #[derive(serde :: Serialize)]
28648        struct RealtimeClientEventResponseCancel<'a> {
28649            #[serde(rename = "event_id")]
28650            #[serde(skip_serializing_if = "Option::is_none")]
28651            event_id: &'a Option<String>,
28652            #[serde(rename = "type")]
28653            r#type: &'a crate::__types::realtime_client_event_response_cancel::Type,
28654            #[serde(rename = "response_id")]
28655            #[serde(skip_serializing_if = "Option::is_none")]
28656            response_id: &'a Option<String>,
28657        }
28658        let Self {
28659            event_id,
28660            response_id,
28661        } = self;
28662        RealtimeClientEventResponseCancel {
28663            event_id,
28664            r#type: &Default::default(),
28665            response_id,
28666        }
28667        .serialize(serializer)
28668    }
28669}
28670#[allow(clippy::module_inception)]
28671pub(crate) mod realtime_client_event_response_create {
28672    #[doc = "The event type, must be `response.create`."]
28673    #[derive(Clone, Copy, Debug, Default, PartialEq)]
28674    pub(crate) struct Type;
28675    impl_serde!(Type, "response.create");
28676}
28677#[doc = "This event instructs the server to create a Response, which means triggering \nmodel inference. When in Server VAD mode, the server will create Responses \nautomatically.\n\nA Response will include at least one Item, and may have two, in which case \nthe second will be a function call. These Items will be appended to the \nconversation history.\n\nThe server will respond with a `response.created` event, events for Items \nand content created, and finally a `response.done` event to indicate the \nResponse is complete.\n\nThe `response.create` event includes inference configuration like \n`instructions`, and `temperature`. These fields will override the Session's \nconfiguration for this Response only.\n"]
28678#[derive(Clone, Debug, Default, PartialEq, typed_builder :: TypedBuilder)]
28679pub struct RealtimeClientEventResponseCreate {
28680    #[doc = "Optional client-generated ID used to identify this event."]
28681    #[builder(default)]
28682    pub event_id: Option<String>,
28683    #[builder(default)]
28684    pub response: Option<crate::__types::RealtimeResponseCreateParams>,
28685}
28686impl<'de> serde::Deserialize<'de> for RealtimeClientEventResponseCreate {
28687    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
28688    where
28689        D: serde::Deserializer<'de>,
28690    {
28691        #[serde_with::serde_as]
28692        #[derive(serde :: Deserialize)]
28693        struct RealtimeClientEventResponseCreate {
28694            #[serde(rename = "event_id")]
28695            event_id: Option<String>,
28696            #[serde(rename = "type")]
28697            #[allow(dead_code)]
28698            r#type: crate::__types::realtime_client_event_response_create::Type,
28699            #[serde(rename = "response")]
28700            response: Option<crate::__types::RealtimeResponseCreateParams>,
28701        }
28702        let RealtimeClientEventResponseCreate {
28703            event_id, response, ..
28704        } = RealtimeClientEventResponseCreate::deserialize(deserializer)?;
28705        Ok(Self { event_id, response })
28706    }
28707}
28708impl serde::Serialize for RealtimeClientEventResponseCreate {
28709    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
28710    where
28711        S: serde::Serializer,
28712    {
28713        #[serde_with::serde_as]
28714        #[derive(serde :: Serialize)]
28715        struct RealtimeClientEventResponseCreate<'a> {
28716            #[serde(rename = "event_id")]
28717            #[serde(skip_serializing_if = "Option::is_none")]
28718            event_id: &'a Option<String>,
28719            #[serde(rename = "type")]
28720            r#type: &'a crate::__types::realtime_client_event_response_create::Type,
28721            #[serde(rename = "response")]
28722            #[serde(skip_serializing_if = "Option::is_none")]
28723            response: &'a Option<crate::__types::RealtimeResponseCreateParams>,
28724        }
28725        let Self { event_id, response } = self;
28726        RealtimeClientEventResponseCreate {
28727            event_id,
28728            r#type: &Default::default(),
28729            response,
28730        }
28731        .serialize(serializer)
28732    }
28733}
28734#[allow(clippy::module_inception)]
28735pub(crate) mod realtime_client_event_session_update {
28736    #[doc = "The event type, must be `session.update`."]
28737    #[derive(Clone, Copy, Debug, Default, PartialEq)]
28738    pub(crate) struct Type;
28739    impl_serde!(Type, "session.update");
28740}
28741#[doc = "Send this event to update the session’s default configuration.\nThe client may send this event at any time to update any field,\nexcept for `voice`. However, note that once a session has been\ninitialized with a particular `model`, it can’t be changed to\nanother model using `session.update`.\n\nWhen the server receives a `session.update`, it will respond\nwith a `session.updated` event showing the full, effective configuration.\nOnly the fields that are present are updated. To clear a field like\n`instructions`, pass an empty string.\n"]
28742#[derive(Clone, Debug, Default, PartialEq, typed_builder :: TypedBuilder)]
28743pub struct RealtimeClientEventSessionUpdate {
28744    #[doc = "Optional client-generated ID used to identify this event."]
28745    #[builder(default)]
28746    pub event_id: Option<String>,
28747    #[builder(default)]
28748    pub session: crate::__types::RealtimeSessionCreateRequest,
28749}
28750impl<'de> serde::Deserialize<'de> for RealtimeClientEventSessionUpdate {
28751    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
28752    where
28753        D: serde::Deserializer<'de>,
28754    {
28755        #[serde_with::serde_as]
28756        #[derive(serde :: Deserialize)]
28757        struct RealtimeClientEventSessionUpdate {
28758            #[serde(rename = "event_id")]
28759            event_id: Option<String>,
28760            #[serde(rename = "type")]
28761            #[allow(dead_code)]
28762            r#type: crate::__types::realtime_client_event_session_update::Type,
28763            #[serde(rename = "session")]
28764            session: crate::__types::RealtimeSessionCreateRequest,
28765        }
28766        let RealtimeClientEventSessionUpdate {
28767            event_id, session, ..
28768        } = RealtimeClientEventSessionUpdate::deserialize(deserializer)?;
28769        Ok(Self { event_id, session })
28770    }
28771}
28772impl serde::Serialize for RealtimeClientEventSessionUpdate {
28773    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
28774    where
28775        S: serde::Serializer,
28776    {
28777        #[serde_with::serde_as]
28778        #[derive(serde :: Serialize)]
28779        struct RealtimeClientEventSessionUpdate<'a> {
28780            #[serde(rename = "event_id")]
28781            #[serde(skip_serializing_if = "Option::is_none")]
28782            event_id: &'a Option<String>,
28783            #[serde(rename = "type")]
28784            r#type: &'a crate::__types::realtime_client_event_session_update::Type,
28785            #[serde(rename = "session")]
28786            session: &'a crate::__types::RealtimeSessionCreateRequest,
28787        }
28788        let Self { event_id, session } = self;
28789        RealtimeClientEventSessionUpdate {
28790            event_id,
28791            r#type: &Default::default(),
28792            session,
28793        }
28794        .serialize(serializer)
28795    }
28796}
28797#[allow(clippy::module_inception)]
28798pub(crate) mod realtime_client_event_transcription_session_update {
28799    #[doc = "The event type, must be `transcription_session.update`."]
28800    #[derive(Clone, Copy, Debug, Default, PartialEq)]
28801    pub(crate) struct Type;
28802    impl_serde!(Type, "transcription_session.update");
28803}
28804#[doc = "Send this event to update a transcription session.\n"]
28805#[derive(Clone, Debug, Default, PartialEq, typed_builder :: TypedBuilder)]
28806pub struct RealtimeClientEventTranscriptionSessionUpdate {
28807    #[doc = "Optional client-generated ID used to identify this event."]
28808    #[builder(default)]
28809    pub event_id: Option<String>,
28810    #[builder(default)]
28811    pub session: crate::__types::RealtimeTranscriptionSessionCreateRequest,
28812}
28813impl<'de> serde::Deserialize<'de> for RealtimeClientEventTranscriptionSessionUpdate {
28814    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
28815    where
28816        D: serde::Deserializer<'de>,
28817    {
28818        #[serde_with::serde_as]
28819        #[derive(serde :: Deserialize)]
28820        struct RealtimeClientEventTranscriptionSessionUpdate {
28821            #[serde(rename = "event_id")]
28822            event_id: Option<String>,
28823            #[serde(rename = "type")]
28824            #[allow(dead_code)]
28825            r#type: crate::__types::realtime_client_event_transcription_session_update::Type,
28826            #[serde(rename = "session")]
28827            session: crate::__types::RealtimeTranscriptionSessionCreateRequest,
28828        }
28829        let RealtimeClientEventTranscriptionSessionUpdate {
28830            event_id, session, ..
28831        } = RealtimeClientEventTranscriptionSessionUpdate::deserialize(deserializer)?;
28832        Ok(Self { event_id, session })
28833    }
28834}
28835impl serde::Serialize for RealtimeClientEventTranscriptionSessionUpdate {
28836    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
28837    where
28838        S: serde::Serializer,
28839    {
28840        #[serde_with::serde_as]
28841        #[derive(serde :: Serialize)]
28842        struct RealtimeClientEventTranscriptionSessionUpdate<'a> {
28843            #[serde(rename = "event_id")]
28844            #[serde(skip_serializing_if = "Option::is_none")]
28845            event_id: &'a Option<String>,
28846            #[serde(rename = "type")]
28847            r#type: &'a crate::__types::realtime_client_event_transcription_session_update::Type,
28848            #[serde(rename = "session")]
28849            session: &'a crate::__types::RealtimeTranscriptionSessionCreateRequest,
28850        }
28851        let Self { event_id, session } = self;
28852        RealtimeClientEventTranscriptionSessionUpdate {
28853            event_id,
28854            r#type: &Default::default(),
28855            session,
28856        }
28857        .serialize(serializer)
28858    }
28859}
28860#[allow(clippy::module_inception)]
28861pub mod realtime_conversation_item {
28862    #[doc = "The type of the item (`message`, `function_call`, `function_call_output`).\n"]
28863    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
28864    pub enum Type {
28865        #[doc = "`message`"]
28866        #[serde(rename = "message")]
28867        Message,
28868        #[doc = "`function_call`"]
28869        #[serde(rename = "function_call")]
28870        FunctionCall,
28871        #[doc = "`function_call_output`"]
28872        #[serde(rename = "function_call_output")]
28873        FunctionCallOutput,
28874    }
28875    #[doc = "Identifier for the API object being returned - always `realtime.item`.\n"]
28876    #[derive(Clone, Copy, Debug, Default, PartialEq)]
28877    pub struct Object;
28878    impl_serde!(Object, "realtime.item");
28879    #[doc = "The status of the item (`completed`, `incomplete`, `in_progress`). These have no effect \non the conversation, but are accepted for consistency with the \n`conversation.item.created` event.\n"]
28880    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
28881    pub enum Status {
28882        #[doc = "`completed`"]
28883        #[serde(rename = "completed")]
28884        Completed,
28885        #[doc = "`incomplete`"]
28886        #[serde(rename = "incomplete")]
28887        Incomplete,
28888        #[doc = "`in_progress`"]
28889        #[serde(rename = "in_progress")]
28890        InProgress,
28891    }
28892    #[doc = "The role of the message sender (`user`, `assistant`, `system`), only \napplicable for `message` items.\n"]
28893    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
28894    pub enum Role {
28895        #[doc = "`user`"]
28896        #[serde(rename = "user")]
28897        User,
28898        #[doc = "`assistant`"]
28899        #[serde(rename = "assistant")]
28900        Assistant,
28901        #[doc = "`system`"]
28902        #[serde(rename = "system")]
28903        System,
28904    }
28905}
28906#[doc = "The item to add to the conversation."]
28907#[derive(Clone, Debug, Default, PartialEq)]
28908#[serde_with::serde_as]
28909#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
28910pub struct RealtimeConversationItem {
28911    #[doc = "The unique ID of the item, this can be generated by the client to help \nmanage server-side context, but is not required because the server will \ngenerate one if not provided.\n"]
28912    #[serde(rename = "id")]
28913    #[serde(skip_serializing_if = "Option::is_none")]
28914    #[builder(default)]
28915    pub id: Option<String>,
28916    #[doc = "The type of the item (`message`, `function_call`, `function_call_output`).\n"]
28917    #[serde(rename = "type")]
28918    #[serde(skip_serializing_if = "Option::is_none")]
28919    #[builder(default)]
28920    pub r#type: Option<crate::__types::realtime_conversation_item::Type>,
28921    #[doc = "Identifier for the API object being returned - always `realtime.item`.\n"]
28922    #[serde(rename = "object")]
28923    #[serde(skip_serializing_if = "Option::is_none")]
28924    #[builder(default)]
28925    pub object: Option<crate::__types::realtime_conversation_item::Object>,
28926    #[doc = "The status of the item (`completed`, `incomplete`, `in_progress`). These have no effect \non the conversation, but are accepted for consistency with the \n`conversation.item.created` event.\n"]
28927    #[serde(rename = "status")]
28928    #[serde(skip_serializing_if = "Option::is_none")]
28929    #[builder(default)]
28930    pub status: Option<crate::__types::realtime_conversation_item::Status>,
28931    #[doc = "The role of the message sender (`user`, `assistant`, `system`), only \napplicable for `message` items.\n"]
28932    #[serde(rename = "role")]
28933    #[serde(skip_serializing_if = "Option::is_none")]
28934    #[builder(default)]
28935    pub role: Option<crate::__types::realtime_conversation_item::Role>,
28936    #[doc = "The content of the message, applicable for `message` items. \n- Message items of role `system` support only `input_text` content\n- Message items of role `user` support `input_text` and `input_audio` \n  content\n- Message items of role `assistant` support `text` content.\n"]
28937    #[serde(rename = "content")]
28938    #[serde(skip_serializing_if = "Option::is_none")]
28939    #[builder(default)]
28940    pub content: Option<Vec<crate::__types::RealtimeConversationItemContent>>,
28941    #[doc = "The ID of the function call (for `function_call` and \n`function_call_output` items). If passed on a `function_call_output` \nitem, the server will check that a `function_call` item with the same \nID exists in the conversation history.\n"]
28942    #[serde(rename = "call_id")]
28943    #[serde(skip_serializing_if = "Option::is_none")]
28944    #[builder(default)]
28945    pub call_id: Option<String>,
28946    #[doc = "The name of the function being called (for `function_call` items).\n"]
28947    #[serde(rename = "name")]
28948    #[serde(skip_serializing_if = "Option::is_none")]
28949    #[builder(default)]
28950    pub name: Option<String>,
28951    #[doc = "The arguments of the function call (for `function_call` items).\n"]
28952    #[serde(rename = "arguments")]
28953    #[serde(skip_serializing_if = "Option::is_none")]
28954    #[builder(default)]
28955    pub arguments: Option<String>,
28956    #[doc = "The output of the function call (for `function_call_output` items).\n"]
28957    #[serde(rename = "output")]
28958    #[serde(skip_serializing_if = "Option::is_none")]
28959    #[builder(default)]
28960    pub output: Option<String>,
28961}
28962#[allow(clippy::module_inception)]
28963pub mod realtime_conversation_item_with_reference {
28964    #[doc = "The type of the item (`message`, `function_call`, `function_call_output`, `item_reference`).\n"]
28965    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
28966    pub enum Type {
28967        #[doc = "`message`"]
28968        #[serde(rename = "message")]
28969        Message,
28970        #[doc = "`function_call`"]
28971        #[serde(rename = "function_call")]
28972        FunctionCall,
28973        #[doc = "`function_call_output`"]
28974        #[serde(rename = "function_call_output")]
28975        FunctionCallOutput,
28976        #[doc = "`item_reference`"]
28977        #[serde(rename = "item_reference")]
28978        ItemReference,
28979    }
28980    #[doc = "Identifier for the API object being returned - always `realtime.item`.\n"]
28981    #[derive(Clone, Copy, Debug, Default, PartialEq)]
28982    pub struct Object;
28983    impl_serde!(Object, "realtime.item");
28984    #[doc = "The status of the item (`completed`, `incomplete`, `in_progress`). These have no effect \non the conversation, but are accepted for consistency with the \n`conversation.item.created` event.\n"]
28985    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
28986    pub enum Status {
28987        #[doc = "`completed`"]
28988        #[serde(rename = "completed")]
28989        Completed,
28990        #[doc = "`incomplete`"]
28991        #[serde(rename = "incomplete")]
28992        Incomplete,
28993        #[doc = "`in_progress`"]
28994        #[serde(rename = "in_progress")]
28995        InProgress,
28996    }
28997    #[doc = "The role of the message sender (`user`, `assistant`, `system`), only \napplicable for `message` items.\n"]
28998    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
28999    pub enum Role {
29000        #[doc = "`user`"]
29001        #[serde(rename = "user")]
29002        User,
29003        #[doc = "`assistant`"]
29004        #[serde(rename = "assistant")]
29005        Assistant,
29006        #[doc = "`system`"]
29007        #[serde(rename = "system")]
29008        System,
29009    }
29010    #[allow(clippy::module_inception)]
29011    pub mod content {
29012        #[allow(clippy::module_inception)]
29013        pub mod item {
29014            #[doc = "The content type (`input_text`, `input_audio`, `item_reference`, `text`).\n"]
29015            #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
29016            pub enum Type {
29017                #[doc = "`input_text`"]
29018                #[serde(rename = "input_text")]
29019                InputText,
29020                #[doc = "`input_audio`"]
29021                #[serde(rename = "input_audio")]
29022                InputAudio,
29023                #[doc = "`item_reference`"]
29024                #[serde(rename = "item_reference")]
29025                ItemReference,
29026                #[doc = "`text`"]
29027                #[serde(rename = "text")]
29028                Text,
29029            }
29030        }
29031        #[derive(Clone, Debug, Default, PartialEq)]
29032        #[serde_with::serde_as]
29033        #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
29034        pub struct Item {
29035            #[doc = "The content type (`input_text`, `input_audio`, `item_reference`, `text`).\n"]
29036            #[serde(rename = "type")]
29037            #[serde(skip_serializing_if = "Option::is_none")]
29038            #[builder(default)]
29039            pub r#type: Option<
29040                crate::__types::realtime_conversation_item_with_reference::content::item::Type,
29041            >,
29042            #[doc = "The text content, used for `input_text` and `text` content types.\n"]
29043            #[serde(rename = "text")]
29044            #[serde(skip_serializing_if = "Option::is_none")]
29045            #[builder(default)]
29046            pub text: Option<String>,
29047            #[doc = "ID of a previous conversation item to reference (for `item_reference`\ncontent types in `response.create` events). These can reference both\nclient and server created items.\n"]
29048            #[serde(rename = "id")]
29049            #[serde(skip_serializing_if = "Option::is_none")]
29050            #[builder(default)]
29051            pub id: Option<String>,
29052            #[doc = "Base64-encoded audio bytes, used for `input_audio` content type.\n"]
29053            #[serde(rename = "audio")]
29054            #[serde(skip_serializing_if = "Option::is_none")]
29055            #[builder(default)]
29056            pub audio: Option<String>,
29057            #[doc = "The transcript of the audio, used for `input_audio` content type.\n"]
29058            #[serde(rename = "transcript")]
29059            #[serde(skip_serializing_if = "Option::is_none")]
29060            #[builder(default)]
29061            pub transcript: Option<String>,
29062        }
29063    }
29064}
29065#[doc = "The item to add to the conversation."]
29066#[derive(Clone, Debug, Default, PartialEq)]
29067#[serde_with::serde_as]
29068#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
29069pub struct RealtimeConversationItemWithReference {
29070    #[doc = "For an item of type (`message` | `function_call` | `function_call_output`)\nthis field allows the client to assign the unique ID of the item. It is\nnot required because the server will generate one if not provided.\n\nFor an item of type `item_reference`, this field is required and is a\nreference to any item that has previously existed in the conversation.\n"]
29071    #[serde(rename = "id")]
29072    #[serde(skip_serializing_if = "Option::is_none")]
29073    #[builder(default)]
29074    pub id: Option<String>,
29075    #[doc = "The type of the item (`message`, `function_call`, `function_call_output`, `item_reference`).\n"]
29076    #[serde(rename = "type")]
29077    #[serde(skip_serializing_if = "Option::is_none")]
29078    #[builder(default)]
29079    pub r#type: Option<crate::__types::realtime_conversation_item_with_reference::Type>,
29080    #[doc = "Identifier for the API object being returned - always `realtime.item`.\n"]
29081    #[serde(rename = "object")]
29082    #[serde(skip_serializing_if = "Option::is_none")]
29083    #[builder(default)]
29084    pub object: Option<crate::__types::realtime_conversation_item_with_reference::Object>,
29085    #[doc = "The status of the item (`completed`, `incomplete`, `in_progress`). These have no effect \non the conversation, but are accepted for consistency with the \n`conversation.item.created` event.\n"]
29086    #[serde(rename = "status")]
29087    #[serde(skip_serializing_if = "Option::is_none")]
29088    #[builder(default)]
29089    pub status: Option<crate::__types::realtime_conversation_item_with_reference::Status>,
29090    #[doc = "The role of the message sender (`user`, `assistant`, `system`), only \napplicable for `message` items.\n"]
29091    #[serde(rename = "role")]
29092    #[serde(skip_serializing_if = "Option::is_none")]
29093    #[builder(default)]
29094    pub role: Option<crate::__types::realtime_conversation_item_with_reference::Role>,
29095    #[doc = "The content of the message, applicable for `message` items. \n- Message items of role `system` support only `input_text` content\n- Message items of role `user` support `input_text` and `input_audio` \n  content\n- Message items of role `assistant` support `text` content.\n"]
29096    #[serde(rename = "content")]
29097    #[serde(skip_serializing_if = "Option::is_none")]
29098    #[builder(default)]
29099    pub content:
29100        Option<Vec<crate::__types::realtime_conversation_item_with_reference::content::Item>>,
29101    #[doc = "The ID of the function call (for `function_call` and \n`function_call_output` items). If passed on a `function_call_output` \nitem, the server will check that a `function_call` item with the same \nID exists in the conversation history.\n"]
29102    #[serde(rename = "call_id")]
29103    #[serde(skip_serializing_if = "Option::is_none")]
29104    #[builder(default)]
29105    pub call_id: Option<String>,
29106    #[doc = "The name of the function being called (for `function_call` items).\n"]
29107    #[serde(rename = "name")]
29108    #[serde(skip_serializing_if = "Option::is_none")]
29109    #[builder(default)]
29110    pub name: Option<String>,
29111    #[doc = "The arguments of the function call (for `function_call` items).\n"]
29112    #[serde(rename = "arguments")]
29113    #[serde(skip_serializing_if = "Option::is_none")]
29114    #[builder(default)]
29115    pub arguments: Option<String>,
29116    #[doc = "The output of the function call (for `function_call_output` items).\n"]
29117    #[serde(rename = "output")]
29118    #[serde(skip_serializing_if = "Option::is_none")]
29119    #[builder(default)]
29120    pub output: Option<String>,
29121}
29122#[allow(clippy::module_inception)]
29123pub mod realtime_response {
29124    #[doc = "The object type, must be `realtime.response`."]
29125    #[derive(Clone, Copy, Debug, Default, PartialEq)]
29126    pub struct Object;
29127    impl_serde!(Object, "realtime.response");
29128    #[doc = "The final status of the response (`completed`, `cancelled`, `failed`, or \n`incomplete`, `in_progress`).\n"]
29129    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
29130    pub enum Status {
29131        #[doc = "`completed`"]
29132        #[serde(rename = "completed")]
29133        Completed,
29134        #[doc = "`cancelled`"]
29135        #[serde(rename = "cancelled")]
29136        Cancelled,
29137        #[doc = "`failed`"]
29138        #[serde(rename = "failed")]
29139        Failed,
29140        #[doc = "`incomplete`"]
29141        #[serde(rename = "incomplete")]
29142        Incomplete,
29143        #[doc = "`in_progress`"]
29144        #[serde(rename = "in_progress")]
29145        InProgress,
29146    }
29147    #[allow(clippy::module_inception)]
29148    pub mod status_details {
29149        #[doc = "The type of error that caused the response to fail, corresponding \nwith the `status` field (`completed`, `cancelled`, `incomplete`, \n`failed`).\n"]
29150        #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
29151        pub enum Type {
29152            #[doc = "`completed`"]
29153            #[serde(rename = "completed")]
29154            Completed,
29155            #[doc = "`cancelled`"]
29156            #[serde(rename = "cancelled")]
29157            Cancelled,
29158            #[doc = "`incomplete`"]
29159            #[serde(rename = "incomplete")]
29160            Incomplete,
29161            #[doc = "`failed`"]
29162            #[serde(rename = "failed")]
29163            Failed,
29164        }
29165        #[doc = "The reason the Response did not complete. For a `cancelled` Response, \none of `turn_detected` (the server VAD detected a new start of speech) \nor `client_cancelled` (the client sent a cancel event). For an \n`incomplete` Response, one of `max_output_tokens` or `content_filter` \n(the server-side safety filter activated and cut off the response).\n"]
29166        #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
29167        pub enum Reason {
29168            #[doc = "`turn_detected`"]
29169            #[serde(rename = "turn_detected")]
29170            TurnDetected,
29171            #[doc = "`client_cancelled`"]
29172            #[serde(rename = "client_cancelled")]
29173            ClientCancelled,
29174            #[doc = "`max_output_tokens`"]
29175            #[serde(rename = "max_output_tokens")]
29176            MaxOutputTokens,
29177            #[doc = "`content_filter`"]
29178            #[serde(rename = "content_filter")]
29179            ContentFilter,
29180        }
29181        #[doc = "A description of the error that caused the response to fail, \npopulated when the `status` is `failed`.\n"]
29182        #[derive(Clone, Debug, Default, PartialEq)]
29183        #[serde_with::serde_as]
29184        #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
29185        pub struct Error {
29186            #[doc = "The type of error."]
29187            #[serde(rename = "type")]
29188            #[serde(skip_serializing_if = "Option::is_none")]
29189            #[builder(default)]
29190            pub r#type: Option<String>,
29191            #[doc = "Error code, if any."]
29192            #[serde(rename = "code")]
29193            #[serde(skip_serializing_if = "Option::is_none")]
29194            #[builder(default)]
29195            pub code: Option<String>,
29196        }
29197    }
29198    #[doc = "Additional details about the status."]
29199    #[derive(Clone, Debug, Default, PartialEq)]
29200    #[serde_with::serde_as]
29201    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
29202    pub struct StatusDetails {
29203        #[doc = "The type of error that caused the response to fail, corresponding \nwith the `status` field (`completed`, `cancelled`, `incomplete`, \n`failed`).\n"]
29204        #[serde(rename = "type")]
29205        #[serde(skip_serializing_if = "Option::is_none")]
29206        #[builder(default)]
29207        pub r#type: Option<crate::__types::realtime_response::status_details::Type>,
29208        #[doc = "The reason the Response did not complete. For a `cancelled` Response, \none of `turn_detected` (the server VAD detected a new start of speech) \nor `client_cancelled` (the client sent a cancel event). For an \n`incomplete` Response, one of `max_output_tokens` or `content_filter` \n(the server-side safety filter activated and cut off the response).\n"]
29209        #[serde(rename = "reason")]
29210        #[serde(skip_serializing_if = "Option::is_none")]
29211        #[builder(default)]
29212        pub reason: Option<crate::__types::realtime_response::status_details::Reason>,
29213        #[doc = "A description of the error that caused the response to fail, \npopulated when the `status` is `failed`.\n"]
29214        #[serde(rename = "error")]
29215        #[serde(skip_serializing_if = "Option::is_none")]
29216        #[builder(default)]
29217        pub error: Option<crate::__types::realtime_response::status_details::Error>,
29218    }
29219    #[allow(clippy::module_inception)]
29220    pub mod usage {
29221        #[doc = "Details about the input tokens used in the Response."]
29222        #[derive(Clone, Copy, Debug, Default, PartialEq)]
29223        #[serde_with::serde_as]
29224        #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
29225        pub struct InputTokenDetails {
29226            #[doc = "The number of cached tokens used in the Response."]
29227            #[serde(rename = "cached_tokens")]
29228            #[serde(skip_serializing_if = "Option::is_none")]
29229            #[builder(default)]
29230            pub cached_tokens: Option<i64>,
29231            #[doc = "The number of text tokens used in the Response."]
29232            #[serde(rename = "text_tokens")]
29233            #[serde(skip_serializing_if = "Option::is_none")]
29234            #[builder(default)]
29235            pub text_tokens: Option<i64>,
29236            #[doc = "The number of audio tokens used in the Response."]
29237            #[serde(rename = "audio_tokens")]
29238            #[serde(skip_serializing_if = "Option::is_none")]
29239            #[builder(default)]
29240            pub audio_tokens: Option<i64>,
29241        }
29242        #[doc = "Details about the output tokens used in the Response."]
29243        #[derive(Clone, Copy, Debug, Default, PartialEq)]
29244        #[serde_with::serde_as]
29245        #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
29246        pub struct OutputTokenDetails {
29247            #[doc = "The number of text tokens used in the Response."]
29248            #[serde(rename = "text_tokens")]
29249            #[serde(skip_serializing_if = "Option::is_none")]
29250            #[builder(default)]
29251            pub text_tokens: Option<i64>,
29252            #[doc = "The number of audio tokens used in the Response."]
29253            #[serde(rename = "audio_tokens")]
29254            #[serde(skip_serializing_if = "Option::is_none")]
29255            #[builder(default)]
29256            pub audio_tokens: Option<i64>,
29257        }
29258    }
29259    #[doc = "Usage statistics for the Response, this will correspond to billing. A \nRealtime API session will maintain a conversation context and append new \nItems to the Conversation, thus output from previous turns (text and \naudio tokens) will become the input for later turns.\n"]
29260    #[derive(Clone, Copy, Debug, Default, PartialEq)]
29261    #[serde_with::serde_as]
29262    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
29263    pub struct Usage {
29264        #[doc = "The total number of tokens in the Response including input and output \ntext and audio tokens.\n"]
29265        #[serde(rename = "total_tokens")]
29266        #[serde(skip_serializing_if = "Option::is_none")]
29267        #[builder(default)]
29268        pub total_tokens: Option<i64>,
29269        #[doc = "The number of input tokens used in the Response, including text and \naudio tokens.\n"]
29270        #[serde(rename = "input_tokens")]
29271        #[serde(skip_serializing_if = "Option::is_none")]
29272        #[builder(default)]
29273        pub input_tokens: Option<i64>,
29274        #[doc = "The number of output tokens sent in the Response, including text and \naudio tokens.\n"]
29275        #[serde(rename = "output_tokens")]
29276        #[serde(skip_serializing_if = "Option::is_none")]
29277        #[builder(default)]
29278        pub output_tokens: Option<i64>,
29279        #[doc = "Details about the input tokens used in the Response."]
29280        #[serde(rename = "input_token_details")]
29281        #[serde(skip_serializing_if = "Option::is_none")]
29282        #[builder(default)]
29283        pub input_token_details:
29284            Option<crate::__types::realtime_response::usage::InputTokenDetails>,
29285        #[doc = "Details about the output tokens used in the Response."]
29286        #[serde(rename = "output_token_details")]
29287        #[serde(skip_serializing_if = "Option::is_none")]
29288        #[builder(default)]
29289        pub output_token_details:
29290            Option<crate::__types::realtime_response::usage::OutputTokenDetails>,
29291    }
29292    #[allow(clippy::module_inception)]
29293    pub mod modalities {
29294        #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
29295        pub enum Item {
29296            #[doc = "`text`"]
29297            #[serde(rename = "text")]
29298            Text,
29299            #[doc = "`audio`"]
29300            #[serde(rename = "audio")]
29301            Audio,
29302        }
29303    }
29304    #[doc = "The format of output audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`.\n"]
29305    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
29306    pub enum OutputAudioFormat {
29307        #[doc = "`pcm16`"]
29308        #[serde(rename = "pcm16")]
29309        Pcm16,
29310        #[doc = "`g711_ulaw`"]
29311        #[serde(rename = "g711_ulaw")]
29312        G711Ulaw,
29313        #[doc = "`g711_alaw`"]
29314        #[serde(rename = "g711_alaw")]
29315        G711Alaw,
29316    }
29317    #[allow(clippy::module_inception)]
29318    pub(crate) mod max_output_tokens {
29319        #[doc = "inf"]
29320        #[derive(Clone, Copy, Debug, Default, PartialEq)]
29321        pub(crate) struct Inf;
29322        impl_serde!(Inf, "inf");
29323    }
29324    #[doc = "Maximum number of output tokens for a single assistant response,\ninclusive of tool calls, that was used in this response.\n"]
29325    #[derive(Clone, Copy, Debug, PartialEq)]
29326    #[allow(clippy::large_enum_variant)]
29327    pub enum MaxOutputTokens {
29328        Integer(i64),
29329        #[doc = "inf"]
29330        Inf,
29331    }
29332    impl<'de> serde::Deserialize<'de> for MaxOutputTokens {
29333        fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
29334        where
29335            D: serde::Deserializer<'de>,
29336        {
29337            #[serde_with::serde_as]
29338            #[derive(serde :: Deserialize)]
29339            #[serde(untagged)]
29340            #[allow(clippy::enum_variant_names, clippy::large_enum_variant)]
29341            enum MaxOutputTokens {
29342                Inf(crate::__types::realtime_response::max_output_tokens::Inf),
29343                Integer(i64),
29344            }
29345            Ok(match MaxOutputTokens::deserialize(deserializer)? {
29346                MaxOutputTokens::Integer(v) => Self::Integer(v),
29347                MaxOutputTokens::Inf(_) => Self::Inf,
29348            })
29349        }
29350    }
29351    impl serde::Serialize for MaxOutputTokens {
29352        fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
29353        where
29354            S: serde::Serializer,
29355        {
29356            #[serde_with::serde_as]
29357            #[derive(serde :: Serialize)]
29358            #[serde(untagged)]
29359            #[allow(clippy::enum_variant_names)]
29360            enum MaxOutputTokens<'a> {
29361                Integer(&'a i64),
29362                Inf(crate::__types::realtime_response::max_output_tokens::Inf),
29363            }
29364            match self {
29365                Self::Integer(v) => MaxOutputTokens::Integer(v),
29366                Self::Inf => MaxOutputTokens::Inf(Default::default()),
29367            }
29368            .serialize(serializer)
29369        }
29370    }
29371}
29372#[doc = "The response resource."]
29373#[derive(Clone, Debug, Default, PartialEq)]
29374#[serde_with::serde_as]
29375#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
29376pub struct RealtimeResponse {
29377    #[doc = "The unique ID of the response."]
29378    #[serde(rename = "id")]
29379    #[serde(skip_serializing_if = "Option::is_none")]
29380    #[builder(default)]
29381    pub id: Option<String>,
29382    #[doc = "The object type, must be `realtime.response`."]
29383    #[serde(rename = "object")]
29384    #[serde(skip_serializing_if = "Option::is_none")]
29385    #[builder(default)]
29386    pub object: Option<crate::__types::realtime_response::Object>,
29387    #[doc = "The final status of the response (`completed`, `cancelled`, `failed`, or \n`incomplete`, `in_progress`).\n"]
29388    #[serde(rename = "status")]
29389    #[serde(skip_serializing_if = "Option::is_none")]
29390    #[builder(default)]
29391    pub status: Option<crate::__types::realtime_response::Status>,
29392    #[doc = "Additional details about the status."]
29393    #[serde(rename = "status_details")]
29394    #[serde(skip_serializing_if = "Option::is_none")]
29395    #[builder(default)]
29396    pub status_details: Option<crate::__types::realtime_response::StatusDetails>,
29397    #[doc = "The list of output items generated by the response."]
29398    #[serde(rename = "output")]
29399    #[serde(skip_serializing_if = "Option::is_none")]
29400    #[builder(default)]
29401    pub output: Option<Vec<crate::__types::RealtimeConversationItem>>,
29402    #[serde(rename = "metadata")]
29403    #[serde(skip_serializing_if = "Option::is_none")]
29404    #[builder(default)]
29405    pub metadata: Option<crate::__types::Metadata>,
29406    #[doc = "Usage statistics for the Response, this will correspond to billing. A \nRealtime API session will maintain a conversation context and append new \nItems to the Conversation, thus output from previous turns (text and \naudio tokens) will become the input for later turns.\n"]
29407    #[serde(rename = "usage")]
29408    #[serde(skip_serializing_if = "Option::is_none")]
29409    #[builder(default)]
29410    pub usage: Option<crate::__types::realtime_response::Usage>,
29411    #[doc = "Which conversation the response is added to, determined by the `conversation`\nfield in the `response.create` event. If `auto`, the response will be added to\nthe default conversation and the value of `conversation_id` will be an id like\n`conv_1234`. If `none`, the response will not be added to any conversation and\nthe value of `conversation_id` will be `null`. If responses are being triggered\nby server VAD, the response will be added to the default conversation, thus\nthe `conversation_id` will be an id like `conv_1234`.\n"]
29412    #[serde(rename = "conversation_id")]
29413    #[serde(skip_serializing_if = "Option::is_none")]
29414    #[builder(default)]
29415    pub conversation_id: Option<String>,
29416    #[doc = "The voice the model used to respond.\nCurrent voice options are `alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`,\n`shimmer`, and `verse`.\n"]
29417    #[serde(rename = "voice")]
29418    #[serde(skip_serializing_if = "Option::is_none")]
29419    #[builder(default)]
29420    pub voice: Option<crate::__types::VoiceIdsShared>,
29421    #[doc = "The set of modalities the model used to respond. If there are multiple modalities,\nthe model will pick one, for example if `modalities` is `[\"text\", \"audio\"]`, the model\ncould be responding in either text or audio.\n"]
29422    #[serde(rename = "modalities")]
29423    #[serde(skip_serializing_if = "Option::is_none")]
29424    #[builder(default)]
29425    pub modalities: Option<Vec<crate::__types::realtime_response::modalities::Item>>,
29426    #[doc = "The format of output audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`.\n"]
29427    #[serde(rename = "output_audio_format")]
29428    #[serde(skip_serializing_if = "Option::is_none")]
29429    #[builder(default)]
29430    pub output_audio_format: Option<crate::__types::realtime_response::OutputAudioFormat>,
29431    #[doc = "Sampling temperature for the model, limited to [0.6, 1.2]. Defaults to 0.8.\n"]
29432    #[serde(rename = "temperature")]
29433    #[serde(skip_serializing_if = "Option::is_none")]
29434    #[builder(default)]
29435    pub temperature: Option<serde_json::Number>,
29436    #[doc = "Maximum number of output tokens for a single assistant response,\ninclusive of tool calls, that was used in this response.\n"]
29437    #[serde(rename = "max_output_tokens")]
29438    #[serde(skip_serializing_if = "Option::is_none")]
29439    #[builder(default)]
29440    pub max_output_tokens: Option<crate::__types::realtime_response::MaxOutputTokens>,
29441}
29442#[allow(clippy::module_inception)]
29443pub mod realtime_response_create_params {
29444    #[allow(clippy::module_inception)]
29445    pub mod modalities {
29446        #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
29447        pub enum Item {
29448            #[doc = "`text`"]
29449            #[serde(rename = "text")]
29450            Text,
29451            #[doc = "`audio`"]
29452            #[serde(rename = "audio")]
29453            Audio,
29454        }
29455    }
29456    #[doc = "The format of output audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`.\n"]
29457    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
29458    pub enum OutputAudioFormat {
29459        #[doc = "`pcm16`"]
29460        #[serde(rename = "pcm16")]
29461        Pcm16,
29462        #[doc = "`g711_ulaw`"]
29463        #[serde(rename = "g711_ulaw")]
29464        G711Ulaw,
29465        #[doc = "`g711_alaw`"]
29466        #[serde(rename = "g711_alaw")]
29467        G711Alaw,
29468    }
29469    #[allow(clippy::module_inception)]
29470    pub mod tools {
29471        #[allow(clippy::module_inception)]
29472        pub mod item {
29473            #[doc = "The type of the tool, i.e. `function`."]
29474            #[derive(Clone, Copy, Debug, Default, PartialEq)]
29475            pub struct Type;
29476            impl_serde!(Type, "function");
29477        }
29478        #[derive(Clone, Debug, Default, PartialEq)]
29479        #[serde_with::serde_as]
29480        #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
29481        pub struct Item {
29482            #[doc = "The type of the tool, i.e. `function`."]
29483            #[serde(rename = "type")]
29484            #[serde(skip_serializing_if = "Option::is_none")]
29485            #[builder(default)]
29486            pub r#type: Option<crate::__types::realtime_response_create_params::tools::item::Type>,
29487            #[doc = "The name of the function."]
29488            #[serde(rename = "name")]
29489            #[serde(skip_serializing_if = "Option::is_none")]
29490            #[builder(default)]
29491            pub name: Option<String>,
29492            #[doc = "The description of the function, including guidance on when and how \nto call it, and guidance about what to tell the user when calling \n(if anything).\n"]
29493            #[serde(rename = "description")]
29494            #[serde(skip_serializing_if = "Option::is_none")]
29495            #[builder(default)]
29496            pub description: Option<String>,
29497            #[doc = "Parameters of the function in JSON Schema."]
29498            #[serde(rename = "parameters")]
29499            #[serde(skip_serializing_if = "Option::is_none")]
29500            #[builder(default)]
29501            pub parameters: Option<indexmap::IndexMap<String, serde_json::Value>>,
29502        }
29503    }
29504    #[allow(clippy::module_inception)]
29505    pub(crate) mod max_response_output_tokens {
29506        #[doc = "inf"]
29507        #[derive(Clone, Copy, Debug, Default, PartialEq)]
29508        pub(crate) struct Inf;
29509        impl_serde!(Inf, "inf");
29510    }
29511    #[doc = "Maximum number of output tokens for a single assistant response,\ninclusive of tool calls. Provide an integer between 1 and 4096 to\nlimit output tokens, or `inf` for the maximum available tokens for a\ngiven model. Defaults to `inf`.\n"]
29512    #[derive(Clone, Copy, Debug, PartialEq)]
29513    #[allow(clippy::large_enum_variant)]
29514    pub enum MaxResponseOutputTokens {
29515        Integer(i64),
29516        #[doc = "inf"]
29517        Inf,
29518    }
29519    impl<'de> serde::Deserialize<'de> for MaxResponseOutputTokens {
29520        fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
29521        where
29522            D: serde::Deserializer<'de>,
29523        {
29524            #[serde_with::serde_as]
29525            #[derive(serde :: Deserialize)]
29526            #[serde(untagged)]
29527            #[allow(clippy::enum_variant_names, clippy::large_enum_variant)]
29528            enum MaxResponseOutputTokens {
29529                Inf (crate :: __types :: realtime_response_create_params :: max_response_output_tokens :: Inf) , Integer (i64) }
29530            Ok(match MaxResponseOutputTokens::deserialize(deserializer)? {
29531                MaxResponseOutputTokens::Integer(v) => Self::Integer(v),
29532                MaxResponseOutputTokens::Inf(_) => Self::Inf,
29533            })
29534        }
29535    }
29536    impl serde::Serialize for MaxResponseOutputTokens {
29537        fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
29538        where
29539            S: serde::Serializer,
29540        {
29541            #[serde_with::serde_as]
29542            #[derive(serde :: Serialize)]
29543            #[serde(untagged)]
29544            #[allow(clippy::enum_variant_names)]
29545            enum MaxResponseOutputTokens<'a> {
29546                Integer (& 'a i64) , Inf (crate :: __types :: realtime_response_create_params :: max_response_output_tokens :: Inf) }
29547            match self {
29548                Self::Integer(v) => MaxResponseOutputTokens::Integer(v),
29549                Self::Inf => MaxResponseOutputTokens::Inf(Default::default()),
29550            }
29551            .serialize(serializer)
29552        }
29553    }
29554    #[allow(clippy::module_inception)]
29555    pub(crate) mod conversation {
29556        #[doc = "auto"]
29557        #[derive(Clone, Copy, Debug, Default, PartialEq)]
29558        pub(crate) struct Auto;
29559        impl_serde!(Auto, "auto");
29560        #[doc = "none"]
29561        #[derive(Clone, Copy, Debug, Default, PartialEq)]
29562        pub(crate) struct None;
29563        impl_serde!(None, "none");
29564    }
29565    #[doc = "Controls which conversation the response is added to. Currently supports\n`auto` and `none`, with `auto` as the default value. The `auto` value\nmeans that the contents of the response will be added to the default\nconversation. Set this to `none` to create an out-of-band response which \nwill not add items to default conversation.\n"]
29566    #[derive(Clone, Debug, PartialEq)]
29567    #[allow(clippy::large_enum_variant)]
29568    pub enum Conversation {
29569        Other(String),
29570        #[doc = "auto"]
29571        Auto,
29572        #[doc = "none"]
29573        None,
29574    }
29575    impl<'de> serde::Deserialize<'de> for Conversation {
29576        fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
29577        where
29578            D: serde::Deserializer<'de>,
29579        {
29580            #[serde_with::serde_as]
29581            #[derive(serde :: Deserialize)]
29582            #[serde(untagged)]
29583            #[allow(clippy::enum_variant_names, clippy::large_enum_variant)]
29584            enum Conversation {
29585                Auto(crate::__types::realtime_response_create_params::conversation::Auto),
29586                None(crate::__types::realtime_response_create_params::conversation::None),
29587                Other(String),
29588            }
29589            Ok(match Conversation::deserialize(deserializer)? {
29590                Conversation::Other(v) => Self::Other(v),
29591                Conversation::Auto(_) => Self::Auto,
29592                Conversation::None(_) => Self::None,
29593            })
29594        }
29595    }
29596    impl serde::Serialize for Conversation {
29597        fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
29598        where
29599            S: serde::Serializer,
29600        {
29601            #[serde_with::serde_as]
29602            #[derive(serde :: Serialize)]
29603            #[serde(untagged)]
29604            #[allow(clippy::enum_variant_names)]
29605            enum Conversation<'a> {
29606                Other(&'a String),
29607                Auto(crate::__types::realtime_response_create_params::conversation::Auto),
29608                None(crate::__types::realtime_response_create_params::conversation::None),
29609            }
29610            match self {
29611                Self::Other(v) => Conversation::Other(v),
29612                Self::Auto => Conversation::Auto(Default::default()),
29613                Self::None => Conversation::None(Default::default()),
29614            }
29615            .serialize(serializer)
29616        }
29617    }
29618}
29619#[doc = "Create a new Realtime response with these parameters"]
29620#[derive(Clone, Debug, Default, PartialEq)]
29621#[serde_with::serde_as]
29622#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
29623pub struct RealtimeResponseCreateParams {
29624    #[doc = "The set of modalities the model can respond with. To disable audio,\nset this to [\"text\"].\n"]
29625    #[serde(rename = "modalities")]
29626    #[serde(skip_serializing_if = "Option::is_none")]
29627    #[builder(default)]
29628    pub modalities: Option<Vec<crate::__types::realtime_response_create_params::modalities::Item>>,
29629    #[doc = "The default system instructions (i.e. system message) prepended to model \ncalls. This field allows the client to guide the model on desired \nresponses. The model can be instructed on response content and format, \n(e.g. \"be extremely succinct\", \"act friendly\", \"here are examples of good \nresponses\") and on audio behavior (e.g. \"talk quickly\", \"inject emotion \ninto your voice\", \"laugh frequently\"). The instructions are not guaranteed \nto be followed by the model, but they provide guidance to the model on the \ndesired behavior.\n\nNote that the server sets default instructions which will be used if this \nfield is not set and are visible in the `session.created` event at the \nstart of the session.\n"]
29630    #[serde(rename = "instructions")]
29631    #[serde(skip_serializing_if = "Option::is_none")]
29632    #[builder(default)]
29633    pub instructions: Option<String>,
29634    #[doc = "The voice the model uses to respond. Voice cannot be changed during the \nsession once the model has responded with audio at least once. Current \nvoice options are `alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`,\n`shimmer`, and `verse`.\n"]
29635    #[serde(rename = "voice")]
29636    #[serde(skip_serializing_if = "Option::is_none")]
29637    #[builder(default)]
29638    pub voice: Option<crate::__types::VoiceIdsShared>,
29639    #[doc = "The format of output audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`.\n"]
29640    #[serde(rename = "output_audio_format")]
29641    #[serde(skip_serializing_if = "Option::is_none")]
29642    #[builder(default)]
29643    pub output_audio_format:
29644        Option<crate::__types::realtime_response_create_params::OutputAudioFormat>,
29645    #[doc = "Tools (functions) available to the model."]
29646    #[serde(rename = "tools")]
29647    #[serde(skip_serializing_if = "Option::is_none")]
29648    #[builder(default)]
29649    pub tools: Option<Vec<crate::__types::realtime_response_create_params::tools::Item>>,
29650    #[doc = "How the model chooses tools. Options are `auto`, `none`, `required`, or \nspecify a function, like `{\"type\": \"function\", \"function\": {\"name\": \"my_function\"}}`.\n"]
29651    #[serde(rename = "tool_choice")]
29652    #[serde(skip_serializing_if = "Option::is_none")]
29653    #[builder(default)]
29654    pub tool_choice: Option<String>,
29655    #[doc = "Sampling temperature for the model, limited to [0.6, 1.2]. Defaults to 0.8.\n"]
29656    #[serde(rename = "temperature")]
29657    #[serde(skip_serializing_if = "Option::is_none")]
29658    #[builder(default)]
29659    pub temperature: Option<serde_json::Number>,
29660    #[doc = "Maximum number of output tokens for a single assistant response,\ninclusive of tool calls. Provide an integer between 1 and 4096 to\nlimit output tokens, or `inf` for the maximum available tokens for a\ngiven model. Defaults to `inf`.\n"]
29661    #[serde(rename = "max_response_output_tokens")]
29662    #[serde(skip_serializing_if = "Option::is_none")]
29663    #[builder(default)]
29664    pub max_response_output_tokens:
29665        Option<crate::__types::realtime_response_create_params::MaxResponseOutputTokens>,
29666    #[doc = "Controls which conversation the response is added to. Currently supports\n`auto` and `none`, with `auto` as the default value. The `auto` value\nmeans that the contents of the response will be added to the default\nconversation. Set this to `none` to create an out-of-band response which \nwill not add items to default conversation.\n"]
29667    #[serde(rename = "conversation")]
29668    #[serde(skip_serializing_if = "Option::is_none")]
29669    #[builder(default)]
29670    pub conversation: Option<crate::__types::realtime_response_create_params::Conversation>,
29671    #[serde(rename = "metadata")]
29672    #[serde(skip_serializing_if = "Option::is_none")]
29673    #[builder(default)]
29674    pub metadata: Option<crate::__types::Metadata>,
29675    #[doc = "Input items to include in the prompt for the model. Using this field\ncreates a new context for this Response instead of using the default\nconversation. An empty array `[]` will clear the context for this Response.\nNote that this can include references to items from the default conversation.\n"]
29676    #[serde(rename = "input")]
29677    #[serde(skip_serializing_if = "Option::is_none")]
29678    #[builder(default)]
29679    pub input: Option<Vec<crate::__types::RealtimeConversationItemWithReference>>,
29680}
29681#[doc = "A realtime server event.\n"]
29682#[derive(Clone, Debug, PartialEq)]
29683#[serde_with::serde_as]
29684#[derive(serde :: Deserialize, serde :: Serialize)]
29685#[serde(untagged)]
29686#[allow(clippy::large_enum_variant)]
29687pub enum RealtimeServerEvent {
29688    ConversationCreated(crate::__types::RealtimeServerEventConversationCreated),
29689    ConversationItemCreated(crate::__types::RealtimeServerEventConversationItemCreated),
29690    ConversationItemDeleted(crate::__types::RealtimeServerEventConversationItemDeleted),
29691    ConversationItemInputAudioTranscriptionCompleted(
29692        crate::__types::RealtimeServerEventConversationItemInputAudioTranscriptionCompleted,
29693    ),
29694    ConversationItemInputAudioTranscriptionDelta(
29695        crate::__types::RealtimeServerEventConversationItemInputAudioTranscriptionDelta,
29696    ),
29697    ConversationItemInputAudioTranscriptionFailed(
29698        crate::__types::RealtimeServerEventConversationItemInputAudioTranscriptionFailed,
29699    ),
29700    ConversationItemRetrieved(crate::__types::RealtimeServerEventConversationItemRetrieved),
29701    ConversationItemTruncated(crate::__types::RealtimeServerEventConversationItemTruncated),
29702    Error(crate::__types::RealtimeServerEventError),
29703    InputAudioBufferCleared(crate::__types::RealtimeServerEventInputAudioBufferCleared),
29704    InputAudioBufferCommitted(crate::__types::RealtimeServerEventInputAudioBufferCommitted),
29705    InputAudioBufferSpeechStarted(crate::__types::RealtimeServerEventInputAudioBufferSpeechStarted),
29706    InputAudioBufferSpeechStopped(crate::__types::RealtimeServerEventInputAudioBufferSpeechStopped),
29707    RateLimitsUpdated(crate::__types::RealtimeServerEventRateLimitsUpdated),
29708    ResponseAudioDelta(crate::__types::RealtimeServerEventResponseAudioDelta),
29709    ResponseAudioDone(crate::__types::RealtimeServerEventResponseAudioDone),
29710    ResponseAudioTranscriptDelta(crate::__types::RealtimeServerEventResponseAudioTranscriptDelta),
29711    ResponseAudioTranscriptDone(crate::__types::RealtimeServerEventResponseAudioTranscriptDone),
29712    ResponseContentPartAdded(crate::__types::RealtimeServerEventResponseContentPartAdded),
29713    ResponseContentPartDone(crate::__types::RealtimeServerEventResponseContentPartDone),
29714    ResponseCreated(crate::__types::RealtimeServerEventResponseCreated),
29715    ResponseDone(crate::__types::RealtimeServerEventResponseDone),
29716    ResponseFunctionCallArgumentsDelta(
29717        crate::__types::RealtimeServerEventResponseFunctionCallArgumentsDelta,
29718    ),
29719    ResponseFunctionCallArgumentsDone(
29720        crate::__types::RealtimeServerEventResponseFunctionCallArgumentsDone,
29721    ),
29722    ResponseOutputItemAdded(crate::__types::RealtimeServerEventResponseOutputItemAdded),
29723    ResponseOutputItemDone(crate::__types::RealtimeServerEventResponseOutputItemDone),
29724    ResponseTextDelta(crate::__types::RealtimeServerEventResponseTextDelta),
29725    ResponseTextDone(crate::__types::RealtimeServerEventResponseTextDone),
29726    SessionCreated(crate::__types::RealtimeServerEventSessionCreated),
29727    SessionUpdated(crate::__types::RealtimeServerEventSessionUpdated),
29728    TranscriptionSessionUpdated(crate::__types::RealtimeServerEventTranscriptionSessionUpdated),
29729    OutputAudioBufferStarted(crate::__types::RealtimeServerEventOutputAudioBufferStarted),
29730    OutputAudioBufferStopped(crate::__types::RealtimeServerEventOutputAudioBufferStopped),
29731    OutputAudioBufferCleared(crate::__types::RealtimeServerEventOutputAudioBufferCleared),
29732}
29733#[allow(clippy::module_inception)]
29734pub mod realtime_server_event_conversation_created {
29735    #[doc = "The event type, must be `conversation.created`."]
29736    #[derive(Clone, Copy, Debug, Default, PartialEq)]
29737    pub(crate) struct Type;
29738    impl_serde!(Type, "conversation.created");
29739    #[allow(clippy::module_inception)]
29740    pub mod conversation {
29741        #[doc = "The object type, must be `realtime.conversation`."]
29742        #[derive(Clone, Copy, Debug, Default, PartialEq)]
29743        pub struct Object;
29744        impl_serde!(Object, "realtime.conversation");
29745    }
29746    #[doc = "The conversation resource."]
29747    #[derive(Clone, Debug, Default, PartialEq)]
29748    #[serde_with::serde_as]
29749    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
29750    pub struct Conversation {
29751        #[doc = "The unique ID of the conversation."]
29752        #[serde(rename = "id")]
29753        #[serde(skip_serializing_if = "Option::is_none")]
29754        #[builder(default)]
29755        pub id: Option<String>,
29756        #[doc = "The object type, must be `realtime.conversation`."]
29757        #[serde(rename = "object")]
29758        #[serde(skip_serializing_if = "Option::is_none")]
29759        #[builder(default)]
29760        pub object: Option<
29761            crate::__types::realtime_server_event_conversation_created::conversation::Object,
29762        >,
29763    }
29764}
29765#[doc = "Returned when a conversation is created. Emitted right after session creation.\n"]
29766#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
29767pub struct RealtimeServerEventConversationCreated {
29768    #[doc = "The unique ID of the server event."]
29769    pub event_id: String,
29770    #[doc = "The conversation resource."]
29771    #[builder(default)]
29772    pub conversation: crate::__types::realtime_server_event_conversation_created::Conversation,
29773}
29774impl<'de> serde::Deserialize<'de> for RealtimeServerEventConversationCreated {
29775    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
29776    where
29777        D: serde::Deserializer<'de>,
29778    {
29779        #[serde_with::serde_as]
29780        #[derive(serde :: Deserialize)]
29781        struct RealtimeServerEventConversationCreated {
29782            #[serde(rename = "event_id")]
29783            event_id: String,
29784            #[serde(rename = "type")]
29785            #[allow(dead_code)]
29786            r#type: crate::__types::realtime_server_event_conversation_created::Type,
29787            #[serde(rename = "conversation")]
29788            conversation: crate::__types::realtime_server_event_conversation_created::Conversation,
29789        }
29790        let RealtimeServerEventConversationCreated {
29791            event_id,
29792            conversation,
29793            ..
29794        } = RealtimeServerEventConversationCreated::deserialize(deserializer)?;
29795        Ok(Self {
29796            event_id,
29797            conversation,
29798        })
29799    }
29800}
29801impl serde::Serialize for RealtimeServerEventConversationCreated {
29802    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
29803    where
29804        S: serde::Serializer,
29805    {
29806        #[serde_with::serde_as]
29807        #[derive(serde :: Serialize)]
29808        struct RealtimeServerEventConversationCreated<'a> {
29809            #[serde(rename = "event_id")]
29810            event_id: &'a String,
29811            #[serde(rename = "type")]
29812            r#type: &'a crate::__types::realtime_server_event_conversation_created::Type,
29813            #[serde(rename = "conversation")]
29814            conversation:
29815                &'a crate::__types::realtime_server_event_conversation_created::Conversation,
29816        }
29817        let Self {
29818            event_id,
29819            conversation,
29820        } = self;
29821        RealtimeServerEventConversationCreated {
29822            event_id,
29823            r#type: &Default::default(),
29824            conversation,
29825        }
29826        .serialize(serializer)
29827    }
29828}
29829#[allow(clippy::module_inception)]
29830pub(crate) mod realtime_server_event_conversation_item_created {
29831    #[doc = "The event type, must be `conversation.item.created`."]
29832    #[derive(Clone, Copy, Debug, Default, PartialEq)]
29833    pub(crate) struct Type;
29834    impl_serde!(Type, "conversation.item.created");
29835}
29836#[doc = "Returned when a conversation item is created. There are several scenarios that produce this event:\n  - The server is generating a Response, which if successful will produce \n    either one or two Items, which will be of type `message` \n    (role `assistant`) or type `function_call`.\n  - The input audio buffer has been committed, either by the client or the \n    server (in `server_vad` mode). The server will take the content of the \n    input audio buffer and add it to a new user message Item.\n  - The client has sent a `conversation.item.create` event to add a new Item \n    to the Conversation.\n"]
29837#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
29838pub struct RealtimeServerEventConversationItemCreated {
29839    #[doc = "The unique ID of the server event."]
29840    pub event_id: String,
29841    #[doc = "The ID of the preceding item in the Conversation context, allows the \nclient to understand the order of the conversation. Can be `null` if the \nitem has no predecessor.\n"]
29842    #[builder(default)]
29843    pub previous_item_id: Option<String>,
29844    #[builder(default)]
29845    pub item: crate::__types::RealtimeConversationItem,
29846}
29847impl<'de> serde::Deserialize<'de> for RealtimeServerEventConversationItemCreated {
29848    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
29849    where
29850        D: serde::Deserializer<'de>,
29851    {
29852        #[serde_with::serde_as]
29853        #[derive(serde :: Deserialize)]
29854        struct RealtimeServerEventConversationItemCreated {
29855            #[serde(rename = "event_id")]
29856            event_id: String,
29857            #[serde(rename = "type")]
29858            #[allow(dead_code)]
29859            r#type: crate::__types::realtime_server_event_conversation_item_created::Type,
29860            #[serde(rename = "previous_item_id")]
29861            previous_item_id: Option<String>,
29862            #[serde(rename = "item")]
29863            item: crate::__types::RealtimeConversationItem,
29864        }
29865        let RealtimeServerEventConversationItemCreated {
29866            event_id,
29867            previous_item_id,
29868            item,
29869            ..
29870        } = RealtimeServerEventConversationItemCreated::deserialize(deserializer)?;
29871        Ok(Self {
29872            event_id,
29873            previous_item_id,
29874            item,
29875        })
29876    }
29877}
29878impl serde::Serialize for RealtimeServerEventConversationItemCreated {
29879    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
29880    where
29881        S: serde::Serializer,
29882    {
29883        #[serde_with::serde_as]
29884        #[derive(serde :: Serialize)]
29885        struct RealtimeServerEventConversationItemCreated<'a> {
29886            #[serde(rename = "event_id")]
29887            event_id: &'a String,
29888            #[serde(rename = "type")]
29889            r#type: &'a crate::__types::realtime_server_event_conversation_item_created::Type,
29890            #[serde(rename = "previous_item_id")]
29891            #[serde(skip_serializing_if = "Option::is_none")]
29892            previous_item_id: &'a Option<String>,
29893            #[serde(rename = "item")]
29894            item: &'a crate::__types::RealtimeConversationItem,
29895        }
29896        let Self {
29897            event_id,
29898            previous_item_id,
29899            item,
29900        } = self;
29901        RealtimeServerEventConversationItemCreated {
29902            event_id,
29903            r#type: &Default::default(),
29904            previous_item_id,
29905            item,
29906        }
29907        .serialize(serializer)
29908    }
29909}
29910#[allow(clippy::module_inception)]
29911pub(crate) mod realtime_server_event_conversation_item_deleted {
29912    #[doc = "The event type, must be `conversation.item.deleted`."]
29913    #[derive(Clone, Copy, Debug, Default, PartialEq)]
29914    pub(crate) struct Type;
29915    impl_serde!(Type, "conversation.item.deleted");
29916}
29917#[doc = "Returned when an item in the conversation is deleted by the client with a \n`conversation.item.delete` event. This event is used to synchronize the \nserver's understanding of the conversation history with the client's view.\n"]
29918#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
29919pub struct RealtimeServerEventConversationItemDeleted {
29920    #[doc = "The unique ID of the server event."]
29921    pub event_id: String,
29922    #[doc = "The ID of the item that was deleted."]
29923    pub item_id: String,
29924}
29925impl<'de> serde::Deserialize<'de> for RealtimeServerEventConversationItemDeleted {
29926    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
29927    where
29928        D: serde::Deserializer<'de>,
29929    {
29930        #[serde_with::serde_as]
29931        #[derive(serde :: Deserialize)]
29932        struct RealtimeServerEventConversationItemDeleted {
29933            #[serde(rename = "event_id")]
29934            event_id: String,
29935            #[serde(rename = "type")]
29936            #[allow(dead_code)]
29937            r#type: crate::__types::realtime_server_event_conversation_item_deleted::Type,
29938            #[serde(rename = "item_id")]
29939            item_id: String,
29940        }
29941        let RealtimeServerEventConversationItemDeleted {
29942            event_id, item_id, ..
29943        } = RealtimeServerEventConversationItemDeleted::deserialize(deserializer)?;
29944        Ok(Self { event_id, item_id })
29945    }
29946}
29947impl serde::Serialize for RealtimeServerEventConversationItemDeleted {
29948    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
29949    where
29950        S: serde::Serializer,
29951    {
29952        #[serde_with::serde_as]
29953        #[derive(serde :: Serialize)]
29954        struct RealtimeServerEventConversationItemDeleted<'a> {
29955            #[serde(rename = "event_id")]
29956            event_id: &'a String,
29957            #[serde(rename = "type")]
29958            r#type: &'a crate::__types::realtime_server_event_conversation_item_deleted::Type,
29959            #[serde(rename = "item_id")]
29960            item_id: &'a String,
29961        }
29962        let Self { event_id, item_id } = self;
29963        RealtimeServerEventConversationItemDeleted {
29964            event_id,
29965            r#type: &Default::default(),
29966            item_id,
29967        }
29968        .serialize(serializer)
29969    }
29970}
29971#[allow(clippy::module_inception)]
29972pub mod realtime_server_event_conversation_item_input_audio_transcription_completed {
29973    #[doc = "The event type, must be\n`conversation.item.input_audio_transcription.completed`.\n"]
29974    #[derive(Clone, Copy, Debug, Default, PartialEq)]
29975    pub(crate) struct Type;
29976    impl_serde!(
29977        Type,
29978        "conversation.item.input_audio_transcription.completed"
29979    );
29980    #[doc = "Usage statistics for the transcription."]
29981    #[derive(Clone, Debug, PartialEq)]
29982    #[serde_with::serde_as]
29983    #[derive(serde :: Deserialize, serde :: Serialize)]
29984    #[serde(untagged)]
29985    #[allow(clippy::large_enum_variant)]
29986    pub enum Usage {
29987        Tokens(crate::__types::TranscriptTextUsageTokens),
29988        Duration(crate::__types::TranscriptTextUsageDuration),
29989    }
29990}
29991#[doc = "This event is the output of audio transcription for user audio written to the\nuser audio buffer. Transcription begins when the input audio buffer is\ncommitted by the client or server (in `server_vad` mode). Transcription runs\nasynchronously with Response creation, so this event may come before or after\nthe Response events.\n\nRealtime API models accept audio natively, and thus input transcription is a\nseparate process run on a separate ASR (Automatic Speech Recognition) model.\nThe transcript may diverge somewhat from the model's interpretation, and\nshould be treated as a rough guide.\n"]
29992#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
29993pub struct RealtimeServerEventConversationItemInputAudioTranscriptionCompleted { # [doc = "The unique ID of the server event."] pub event_id : String , # [doc = "The ID of the user message item containing the audio."] pub item_id : String , # [doc = "The index of the content part containing the audio."] pub content_index : i64 , # [doc = "The transcribed text."] pub transcript : String , # [doc = "The log probabilities of the transcription."] # [builder (default)] pub logprobs : Option < Vec < crate :: __types :: LogProbProperties > > , # [doc = "Usage statistics for the transcription."] pub usage : crate :: __types :: realtime_server_event_conversation_item_input_audio_transcription_completed :: Usage }
29994impl<'de> serde::Deserialize<'de>
29995    for RealtimeServerEventConversationItemInputAudioTranscriptionCompleted
29996{
29997    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
29998    where
29999        D: serde::Deserializer<'de>,
30000    {
30001        #[serde_with::serde_as]
30002        #[derive(serde :: Deserialize)]
30003        struct RealtimeServerEventConversationItemInputAudioTranscriptionCompleted { # [serde (rename = "event_id")] event_id : String , # [serde (rename = "type")] # [allow (dead_code)] r#type : crate :: __types :: realtime_server_event_conversation_item_input_audio_transcription_completed :: Type , # [serde (rename = "item_id")] item_id : String , # [serde (rename = "content_index")] content_index : i64 , # [serde (rename = "transcript")] transcript : String , # [serde (rename = "logprobs")] logprobs : Option < Vec < crate :: __types :: LogProbProperties > > , # [serde (rename = "usage")] usage : crate :: __types :: realtime_server_event_conversation_item_input_audio_transcription_completed :: Usage }
30004        let RealtimeServerEventConversationItemInputAudioTranscriptionCompleted {
30005            event_id,
30006            item_id,
30007            content_index,
30008            transcript,
30009            logprobs,
30010            usage,
30011            ..
30012        } = RealtimeServerEventConversationItemInputAudioTranscriptionCompleted::deserialize(
30013            deserializer,
30014        )?;
30015        Ok(Self {
30016            event_id,
30017            item_id,
30018            content_index,
30019            transcript,
30020            logprobs,
30021            usage,
30022        })
30023    }
30024}
30025impl serde::Serialize for RealtimeServerEventConversationItemInputAudioTranscriptionCompleted {
30026    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
30027    where
30028        S: serde::Serializer,
30029    {
30030        #[serde_with::serde_as]
30031        #[derive(serde :: Serialize)]
30032        struct RealtimeServerEventConversationItemInputAudioTranscriptionCompleted < 'a > { # [serde (rename = "event_id")] event_id : & 'a String , # [serde (rename = "type")] r#type : & 'a crate :: __types :: realtime_server_event_conversation_item_input_audio_transcription_completed :: Type , # [serde (rename = "item_id")] item_id : & 'a String , # [serde (rename = "content_index")] content_index : & 'a i64 , # [serde (rename = "transcript")] transcript : & 'a String , # [serde (rename = "logprobs")] # [serde (skip_serializing_if = "Option::is_none")] logprobs : & 'a Option < Vec < crate :: __types :: LogProbProperties > > , # [serde (rename = "usage")] usage : & 'a crate :: __types :: realtime_server_event_conversation_item_input_audio_transcription_completed :: Usage }
30033        let Self {
30034            event_id,
30035            item_id,
30036            content_index,
30037            transcript,
30038            logprobs,
30039            usage,
30040        } = self;
30041        RealtimeServerEventConversationItemInputAudioTranscriptionCompleted {
30042            event_id,
30043            r#type: &Default::default(),
30044            item_id,
30045            content_index,
30046            transcript,
30047            logprobs,
30048            usage,
30049        }
30050        .serialize(serializer)
30051    }
30052}
30053#[allow(clippy::module_inception)]
30054pub(crate) mod realtime_server_event_conversation_item_input_audio_transcription_delta {
30055    #[doc = "The event type, must be `conversation.item.input_audio_transcription.delta`."]
30056    #[derive(Clone, Copy, Debug, Default, PartialEq)]
30057    pub(crate) struct Type;
30058    impl_serde!(Type, "conversation.item.input_audio_transcription.delta");
30059}
30060#[doc = "Returned when the text value of an input audio transcription content part is updated.\n"]
30061#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
30062pub struct RealtimeServerEventConversationItemInputAudioTranscriptionDelta {
30063    #[doc = "The unique ID of the server event."]
30064    pub event_id: String,
30065    #[doc = "The ID of the item."]
30066    pub item_id: String,
30067    #[doc = "The index of the content part in the item's content array."]
30068    #[builder(default)]
30069    pub content_index: Option<i64>,
30070    #[doc = "The text delta."]
30071    #[builder(default)]
30072    pub delta: Option<String>,
30073    #[doc = "The log probabilities of the transcription."]
30074    #[builder(default)]
30075    pub logprobs: Option<Vec<crate::__types::LogProbProperties>>,
30076}
30077impl<'de> serde::Deserialize<'de>
30078    for RealtimeServerEventConversationItemInputAudioTranscriptionDelta
30079{
30080    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
30081    where
30082        D: serde::Deserializer<'de>,
30083    {
30084        #[serde_with::serde_as]
30085        #[derive(serde :: Deserialize)]
30086        struct RealtimeServerEventConversationItemInputAudioTranscriptionDelta { # [serde (rename = "event_id")] event_id : String , # [serde (rename = "type")] # [allow (dead_code)] r#type : crate :: __types :: realtime_server_event_conversation_item_input_audio_transcription_delta :: Type , # [serde (rename = "item_id")] item_id : String , # [serde (rename = "content_index")] content_index : Option < i64 > , # [serde (rename = "delta")] delta : Option < String > , # [serde (rename = "logprobs")] logprobs : Option < Vec < crate :: __types :: LogProbProperties > > }
30087        let RealtimeServerEventConversationItemInputAudioTranscriptionDelta {
30088            event_id,
30089            item_id,
30090            content_index,
30091            delta,
30092            logprobs,
30093            ..
30094        } = RealtimeServerEventConversationItemInputAudioTranscriptionDelta::deserialize(
30095            deserializer,
30096        )?;
30097        Ok(Self {
30098            event_id,
30099            item_id,
30100            content_index,
30101            delta,
30102            logprobs,
30103        })
30104    }
30105}
30106impl serde::Serialize for RealtimeServerEventConversationItemInputAudioTranscriptionDelta {
30107    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
30108    where
30109        S: serde::Serializer,
30110    {
30111        #[serde_with::serde_as]
30112        #[derive(serde :: Serialize)]
30113        struct RealtimeServerEventConversationItemInputAudioTranscriptionDelta < 'a > { # [serde (rename = "event_id")] event_id : & 'a String , # [serde (rename = "type")] r#type : & 'a crate :: __types :: realtime_server_event_conversation_item_input_audio_transcription_delta :: Type , # [serde (rename = "item_id")] item_id : & 'a String , # [serde (rename = "content_index")] # [serde (skip_serializing_if = "Option::is_none")] content_index : & 'a Option < i64 > , # [serde (rename = "delta")] # [serde (skip_serializing_if = "Option::is_none")] delta : & 'a Option < String > , # [serde (rename = "logprobs")] # [serde (skip_serializing_if = "Option::is_none")] logprobs : & 'a Option < Vec < crate :: __types :: LogProbProperties > > }
30114        let Self {
30115            event_id,
30116            item_id,
30117            content_index,
30118            delta,
30119            logprobs,
30120        } = self;
30121        RealtimeServerEventConversationItemInputAudioTranscriptionDelta {
30122            event_id,
30123            r#type: &Default::default(),
30124            item_id,
30125            content_index,
30126            delta,
30127            logprobs,
30128        }
30129        .serialize(serializer)
30130    }
30131}
30132#[allow(clippy::module_inception)]
30133pub mod realtime_server_event_conversation_item_input_audio_transcription_failed {
30134    #[doc = "The event type, must be\n`conversation.item.input_audio_transcription.failed`.\n"]
30135    #[derive(Clone, Copy, Debug, Default, PartialEq)]
30136    pub(crate) struct Type;
30137    impl_serde!(Type, "conversation.item.input_audio_transcription.failed");
30138    #[doc = "Details of the transcription error."]
30139    #[derive(Clone, Debug, Default, PartialEq)]
30140    #[serde_with::serde_as]
30141    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
30142    pub struct Error {
30143        #[doc = "The type of error."]
30144        #[serde(rename = "type")]
30145        #[serde(skip_serializing_if = "Option::is_none")]
30146        #[builder(default)]
30147        pub r#type: Option<String>,
30148        #[doc = "Error code, if any."]
30149        #[serde(rename = "code")]
30150        #[serde(skip_serializing_if = "Option::is_none")]
30151        #[builder(default)]
30152        pub code: Option<String>,
30153        #[doc = "A human-readable error message."]
30154        #[serde(rename = "message")]
30155        #[serde(skip_serializing_if = "Option::is_none")]
30156        #[builder(default)]
30157        pub message: Option<String>,
30158        #[doc = "Parameter related to the error, if any."]
30159        #[serde(rename = "param")]
30160        #[serde(skip_serializing_if = "Option::is_none")]
30161        #[builder(default)]
30162        pub param: Option<String>,
30163    }
30164}
30165#[doc = "Returned when input audio transcription is configured, and a transcription \nrequest for a user message failed. These events are separate from other \n`error` events so that the client can identify the related Item.\n"]
30166#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
30167pub struct RealtimeServerEventConversationItemInputAudioTranscriptionFailed { # [doc = "The unique ID of the server event."] pub event_id : String , # [doc = "The ID of the user message item."] pub item_id : String , # [doc = "The index of the content part containing the audio."] pub content_index : i64 , # [doc = "Details of the transcription error."] # [builder (default)] pub error : crate :: __types :: realtime_server_event_conversation_item_input_audio_transcription_failed :: Error }
30168impl<'de> serde::Deserialize<'de>
30169    for RealtimeServerEventConversationItemInputAudioTranscriptionFailed
30170{
30171    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
30172    where
30173        D: serde::Deserializer<'de>,
30174    {
30175        #[serde_with::serde_as]
30176        #[derive(serde :: Deserialize)]
30177        struct RealtimeServerEventConversationItemInputAudioTranscriptionFailed { # [serde (rename = "event_id")] event_id : String , # [serde (rename = "type")] # [allow (dead_code)] r#type : crate :: __types :: realtime_server_event_conversation_item_input_audio_transcription_failed :: Type , # [serde (rename = "item_id")] item_id : String , # [serde (rename = "content_index")] content_index : i64 , # [serde (rename = "error")] error : crate :: __types :: realtime_server_event_conversation_item_input_audio_transcription_failed :: Error }
30178        let RealtimeServerEventConversationItemInputAudioTranscriptionFailed {
30179            event_id,
30180            item_id,
30181            content_index,
30182            error,
30183            ..
30184        } = RealtimeServerEventConversationItemInputAudioTranscriptionFailed::deserialize(
30185            deserializer,
30186        )?;
30187        Ok(Self {
30188            event_id,
30189            item_id,
30190            content_index,
30191            error,
30192        })
30193    }
30194}
30195impl serde::Serialize for RealtimeServerEventConversationItemInputAudioTranscriptionFailed {
30196    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
30197    where
30198        S: serde::Serializer,
30199    {
30200        #[serde_with::serde_as]
30201        #[derive(serde :: Serialize)]
30202        struct RealtimeServerEventConversationItemInputAudioTranscriptionFailed < 'a > { # [serde (rename = "event_id")] event_id : & 'a String , # [serde (rename = "type")] r#type : & 'a crate :: __types :: realtime_server_event_conversation_item_input_audio_transcription_failed :: Type , # [serde (rename = "item_id")] item_id : & 'a String , # [serde (rename = "content_index")] content_index : & 'a i64 , # [serde (rename = "error")] error : & 'a crate :: __types :: realtime_server_event_conversation_item_input_audio_transcription_failed :: Error }
30203        let Self {
30204            event_id,
30205            item_id,
30206            content_index,
30207            error,
30208        } = self;
30209        RealtimeServerEventConversationItemInputAudioTranscriptionFailed {
30210            event_id,
30211            r#type: &Default::default(),
30212            item_id,
30213            content_index,
30214            error,
30215        }
30216        .serialize(serializer)
30217    }
30218}
30219#[allow(clippy::module_inception)]
30220pub(crate) mod realtime_server_event_conversation_item_retrieved {
30221    #[doc = "The event type, must be `conversation.item.retrieved`."]
30222    #[derive(Clone, Copy, Debug, Default, PartialEq)]
30223    pub(crate) struct Type;
30224    impl_serde!(Type, "conversation.item.retrieved");
30225}
30226#[doc = "Returned when a conversation item is retrieved with `conversation.item.retrieve`.\n"]
30227#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
30228pub struct RealtimeServerEventConversationItemRetrieved {
30229    #[doc = "The unique ID of the server event."]
30230    pub event_id: String,
30231    #[builder(default)]
30232    pub item: crate::__types::RealtimeConversationItem,
30233}
30234impl<'de> serde::Deserialize<'de> for RealtimeServerEventConversationItemRetrieved {
30235    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
30236    where
30237        D: serde::Deserializer<'de>,
30238    {
30239        #[serde_with::serde_as]
30240        #[derive(serde :: Deserialize)]
30241        struct RealtimeServerEventConversationItemRetrieved {
30242            #[serde(rename = "event_id")]
30243            event_id: String,
30244            #[serde(rename = "type")]
30245            #[allow(dead_code)]
30246            r#type: crate::__types::realtime_server_event_conversation_item_retrieved::Type,
30247            #[serde(rename = "item")]
30248            item: crate::__types::RealtimeConversationItem,
30249        }
30250        let RealtimeServerEventConversationItemRetrieved { event_id, item, .. } =
30251            RealtimeServerEventConversationItemRetrieved::deserialize(deserializer)?;
30252        Ok(Self { event_id, item })
30253    }
30254}
30255impl serde::Serialize for RealtimeServerEventConversationItemRetrieved {
30256    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
30257    where
30258        S: serde::Serializer,
30259    {
30260        #[serde_with::serde_as]
30261        #[derive(serde :: Serialize)]
30262        struct RealtimeServerEventConversationItemRetrieved<'a> {
30263            #[serde(rename = "event_id")]
30264            event_id: &'a String,
30265            #[serde(rename = "type")]
30266            r#type: &'a crate::__types::realtime_server_event_conversation_item_retrieved::Type,
30267            #[serde(rename = "item")]
30268            item: &'a crate::__types::RealtimeConversationItem,
30269        }
30270        let Self { event_id, item } = self;
30271        RealtimeServerEventConversationItemRetrieved {
30272            event_id,
30273            r#type: &Default::default(),
30274            item,
30275        }
30276        .serialize(serializer)
30277    }
30278}
30279#[allow(clippy::module_inception)]
30280pub(crate) mod realtime_server_event_conversation_item_truncated {
30281    #[doc = "The event type, must be `conversation.item.truncated`."]
30282    #[derive(Clone, Copy, Debug, Default, PartialEq)]
30283    pub(crate) struct Type;
30284    impl_serde!(Type, "conversation.item.truncated");
30285}
30286#[doc = "Returned when an earlier assistant audio message item is truncated by the \nclient with a `conversation.item.truncate` event. This event is used to \nsynchronize the server's understanding of the audio with the client's playback.\n\nThis action will truncate the audio and remove the server-side text transcript \nto ensure there is no text in the context that hasn't been heard by the user.\n"]
30287#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
30288pub struct RealtimeServerEventConversationItemTruncated {
30289    #[doc = "The unique ID of the server event."]
30290    pub event_id: String,
30291    #[doc = "The ID of the assistant message item that was truncated."]
30292    pub item_id: String,
30293    #[doc = "The index of the content part that was truncated."]
30294    pub content_index: i64,
30295    #[doc = "The duration up to which the audio was truncated, in milliseconds.\n"]
30296    pub audio_end_ms: i64,
30297}
30298impl<'de> serde::Deserialize<'de> for RealtimeServerEventConversationItemTruncated {
30299    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
30300    where
30301        D: serde::Deserializer<'de>,
30302    {
30303        #[serde_with::serde_as]
30304        #[derive(serde :: Deserialize)]
30305        struct RealtimeServerEventConversationItemTruncated {
30306            #[serde(rename = "event_id")]
30307            event_id: String,
30308            #[serde(rename = "type")]
30309            #[allow(dead_code)]
30310            r#type: crate::__types::realtime_server_event_conversation_item_truncated::Type,
30311            #[serde(rename = "item_id")]
30312            item_id: String,
30313            #[serde(rename = "content_index")]
30314            content_index: i64,
30315            #[serde(rename = "audio_end_ms")]
30316            audio_end_ms: i64,
30317        }
30318        let RealtimeServerEventConversationItemTruncated {
30319            event_id,
30320            item_id,
30321            content_index,
30322            audio_end_ms,
30323            ..
30324        } = RealtimeServerEventConversationItemTruncated::deserialize(deserializer)?;
30325        Ok(Self {
30326            event_id,
30327            item_id,
30328            content_index,
30329            audio_end_ms,
30330        })
30331    }
30332}
30333impl serde::Serialize for RealtimeServerEventConversationItemTruncated {
30334    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
30335    where
30336        S: serde::Serializer,
30337    {
30338        #[serde_with::serde_as]
30339        #[derive(serde :: Serialize)]
30340        struct RealtimeServerEventConversationItemTruncated<'a> {
30341            #[serde(rename = "event_id")]
30342            event_id: &'a String,
30343            #[serde(rename = "type")]
30344            r#type: &'a crate::__types::realtime_server_event_conversation_item_truncated::Type,
30345            #[serde(rename = "item_id")]
30346            item_id: &'a String,
30347            #[serde(rename = "content_index")]
30348            content_index: &'a i64,
30349            #[serde(rename = "audio_end_ms")]
30350            audio_end_ms: &'a i64,
30351        }
30352        let Self {
30353            event_id,
30354            item_id,
30355            content_index,
30356            audio_end_ms,
30357        } = self;
30358        RealtimeServerEventConversationItemTruncated {
30359            event_id,
30360            r#type: &Default::default(),
30361            item_id,
30362            content_index,
30363            audio_end_ms,
30364        }
30365        .serialize(serializer)
30366    }
30367}
30368#[allow(clippy::module_inception)]
30369pub mod realtime_server_event_error {
30370    #[doc = "The event type, must be `error`."]
30371    #[derive(Clone, Copy, Debug, Default, PartialEq)]
30372    pub(crate) struct Type;
30373    impl_serde!(Type, "error");
30374    #[doc = "Details of the error."]
30375    #[derive(Clone, Debug, PartialEq)]
30376    #[serde_with::serde_as]
30377    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
30378    pub struct Error {
30379        #[doc = "The type of error (e.g., \"invalid_request_error\", \"server_error\").\n"]
30380        #[serde(rename = "type")]
30381        pub r#type: String,
30382        #[doc = "Error code, if any."]
30383        #[serde(rename = "code")]
30384        #[serde(skip_serializing_if = "Option::is_none")]
30385        #[builder(default)]
30386        pub code: Option<String>,
30387        #[doc = "A human-readable error message."]
30388        #[serde(rename = "message")]
30389        pub message: String,
30390        #[doc = "Parameter related to the error, if any."]
30391        #[serde(rename = "param")]
30392        #[serde(skip_serializing_if = "Option::is_none")]
30393        #[builder(default)]
30394        pub param: Option<String>,
30395        #[doc = "The event_id of the client event that caused the error, if applicable.\n"]
30396        #[serde(rename = "event_id")]
30397        #[serde(skip_serializing_if = "Option::is_none")]
30398        #[builder(default)]
30399        pub event_id: Option<String>,
30400    }
30401}
30402#[doc = "Returned when an error occurs, which could be a client problem or a server \nproblem. Most errors are recoverable and the session will stay open, we \nrecommend to implementors to monitor and log error messages by default.\n"]
30403#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
30404pub struct RealtimeServerEventError {
30405    #[doc = "The unique ID of the server event."]
30406    pub event_id: String,
30407    #[doc = "Details of the error."]
30408    pub error: crate::__types::realtime_server_event_error::Error,
30409}
30410impl<'de> serde::Deserialize<'de> for RealtimeServerEventError {
30411    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
30412    where
30413        D: serde::Deserializer<'de>,
30414    {
30415        #[serde_with::serde_as]
30416        #[derive(serde :: Deserialize)]
30417        struct RealtimeServerEventError {
30418            #[serde(rename = "event_id")]
30419            event_id: String,
30420            #[serde(rename = "type")]
30421            #[allow(dead_code)]
30422            r#type: crate::__types::realtime_server_event_error::Type,
30423            #[serde(rename = "error")]
30424            error: crate::__types::realtime_server_event_error::Error,
30425        }
30426        let RealtimeServerEventError {
30427            event_id, error, ..
30428        } = RealtimeServerEventError::deserialize(deserializer)?;
30429        Ok(Self { event_id, error })
30430    }
30431}
30432impl serde::Serialize for RealtimeServerEventError {
30433    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
30434    where
30435        S: serde::Serializer,
30436    {
30437        #[serde_with::serde_as]
30438        #[derive(serde :: Serialize)]
30439        struct RealtimeServerEventError<'a> {
30440            #[serde(rename = "event_id")]
30441            event_id: &'a String,
30442            #[serde(rename = "type")]
30443            r#type: &'a crate::__types::realtime_server_event_error::Type,
30444            #[serde(rename = "error")]
30445            error: &'a crate::__types::realtime_server_event_error::Error,
30446        }
30447        let Self { event_id, error } = self;
30448        RealtimeServerEventError {
30449            event_id,
30450            r#type: &Default::default(),
30451            error,
30452        }
30453        .serialize(serializer)
30454    }
30455}
30456#[allow(clippy::module_inception)]
30457pub(crate) mod realtime_server_event_input_audio_buffer_cleared {
30458    #[doc = "The event type, must be `input_audio_buffer.cleared`."]
30459    #[derive(Clone, Copy, Debug, Default, PartialEq)]
30460    pub(crate) struct Type;
30461    impl_serde!(Type, "input_audio_buffer.cleared");
30462}
30463#[doc = "Returned when the input audio buffer is cleared by the client with a \n`input_audio_buffer.clear` event.\n"]
30464#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
30465pub struct RealtimeServerEventInputAudioBufferCleared {
30466    #[doc = "The unique ID of the server event."]
30467    pub event_id: String,
30468}
30469impl<'de> serde::Deserialize<'de> for RealtimeServerEventInputAudioBufferCleared {
30470    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
30471    where
30472        D: serde::Deserializer<'de>,
30473    {
30474        #[serde_with::serde_as]
30475        #[derive(serde :: Deserialize)]
30476        struct RealtimeServerEventInputAudioBufferCleared {
30477            #[serde(rename = "event_id")]
30478            event_id: String,
30479            #[serde(rename = "type")]
30480            #[allow(dead_code)]
30481            r#type: crate::__types::realtime_server_event_input_audio_buffer_cleared::Type,
30482        }
30483        let RealtimeServerEventInputAudioBufferCleared { event_id, .. } =
30484            RealtimeServerEventInputAudioBufferCleared::deserialize(deserializer)?;
30485        Ok(Self { event_id })
30486    }
30487}
30488impl serde::Serialize for RealtimeServerEventInputAudioBufferCleared {
30489    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
30490    where
30491        S: serde::Serializer,
30492    {
30493        #[serde_with::serde_as]
30494        #[derive(serde :: Serialize)]
30495        struct RealtimeServerEventInputAudioBufferCleared<'a> {
30496            #[serde(rename = "event_id")]
30497            event_id: &'a String,
30498            #[serde(rename = "type")]
30499            r#type: &'a crate::__types::realtime_server_event_input_audio_buffer_cleared::Type,
30500        }
30501        let Self { event_id } = self;
30502        RealtimeServerEventInputAudioBufferCleared {
30503            event_id,
30504            r#type: &Default::default(),
30505        }
30506        .serialize(serializer)
30507    }
30508}
30509#[allow(clippy::module_inception)]
30510pub(crate) mod realtime_server_event_input_audio_buffer_committed {
30511    #[doc = "The event type, must be `input_audio_buffer.committed`."]
30512    #[derive(Clone, Copy, Debug, Default, PartialEq)]
30513    pub(crate) struct Type;
30514    impl_serde!(Type, "input_audio_buffer.committed");
30515}
30516#[doc = "Returned when an input audio buffer is committed, either by the client or \nautomatically in server VAD mode. The `item_id` property is the ID of the user\nmessage item that will be created, thus a `conversation.item.created` event \nwill also be sent to the client.\n"]
30517#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
30518pub struct RealtimeServerEventInputAudioBufferCommitted {
30519    #[doc = "The unique ID of the server event."]
30520    pub event_id: String,
30521    #[doc = "The ID of the preceding item after which the new item will be inserted.\nCan be `null` if the item has no predecessor.\n"]
30522    #[builder(default)]
30523    pub previous_item_id: Option<String>,
30524    #[doc = "The ID of the user message item that will be created."]
30525    pub item_id: String,
30526}
30527impl<'de> serde::Deserialize<'de> for RealtimeServerEventInputAudioBufferCommitted {
30528    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
30529    where
30530        D: serde::Deserializer<'de>,
30531    {
30532        #[serde_with::serde_as]
30533        #[derive(serde :: Deserialize)]
30534        struct RealtimeServerEventInputAudioBufferCommitted {
30535            #[serde(rename = "event_id")]
30536            event_id: String,
30537            #[serde(rename = "type")]
30538            #[allow(dead_code)]
30539            r#type: crate::__types::realtime_server_event_input_audio_buffer_committed::Type,
30540            #[serde(rename = "previous_item_id")]
30541            previous_item_id: Option<String>,
30542            #[serde(rename = "item_id")]
30543            item_id: String,
30544        }
30545        let RealtimeServerEventInputAudioBufferCommitted {
30546            event_id,
30547            previous_item_id,
30548            item_id,
30549            ..
30550        } = RealtimeServerEventInputAudioBufferCommitted::deserialize(deserializer)?;
30551        Ok(Self {
30552            event_id,
30553            previous_item_id,
30554            item_id,
30555        })
30556    }
30557}
30558impl serde::Serialize for RealtimeServerEventInputAudioBufferCommitted {
30559    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
30560    where
30561        S: serde::Serializer,
30562    {
30563        #[serde_with::serde_as]
30564        #[derive(serde :: Serialize)]
30565        struct RealtimeServerEventInputAudioBufferCommitted<'a> {
30566            #[serde(rename = "event_id")]
30567            event_id: &'a String,
30568            #[serde(rename = "type")]
30569            r#type: &'a crate::__types::realtime_server_event_input_audio_buffer_committed::Type,
30570            #[serde(rename = "previous_item_id")]
30571            #[serde(skip_serializing_if = "Option::is_none")]
30572            previous_item_id: &'a Option<String>,
30573            #[serde(rename = "item_id")]
30574            item_id: &'a String,
30575        }
30576        let Self {
30577            event_id,
30578            previous_item_id,
30579            item_id,
30580        } = self;
30581        RealtimeServerEventInputAudioBufferCommitted {
30582            event_id,
30583            r#type: &Default::default(),
30584            previous_item_id,
30585            item_id,
30586        }
30587        .serialize(serializer)
30588    }
30589}
30590#[allow(clippy::module_inception)]
30591pub(crate) mod realtime_server_event_input_audio_buffer_speech_started {
30592    #[doc = "The event type, must be `input_audio_buffer.speech_started`."]
30593    #[derive(Clone, Copy, Debug, Default, PartialEq)]
30594    pub(crate) struct Type;
30595    impl_serde!(Type, "input_audio_buffer.speech_started");
30596}
30597#[doc = "Sent by the server when in `server_vad` mode to indicate that speech has been \ndetected in the audio buffer. This can happen any time audio is added to the \nbuffer (unless speech is already detected). The client may want to use this \nevent to interrupt audio playback or provide visual feedback to the user. \n\nThe client should expect to receive a `input_audio_buffer.speech_stopped` event \nwhen speech stops. The `item_id` property is the ID of the user message item \nthat will be created when speech stops and will also be included in the \n`input_audio_buffer.speech_stopped` event (unless the client manually commits \nthe audio buffer during VAD activation).\n"]
30598#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
30599pub struct RealtimeServerEventInputAudioBufferSpeechStarted {
30600    #[doc = "The unique ID of the server event."]
30601    pub event_id: String,
30602    #[doc = "Milliseconds from the start of all audio written to the buffer during the \nsession when speech was first detected. This will correspond to the \nbeginning of audio sent to the model, and thus includes the \n`prefix_padding_ms` configured in the Session.\n"]
30603    pub audio_start_ms: i64,
30604    #[doc = "The ID of the user message item that will be created when speech stops.\n"]
30605    pub item_id: String,
30606}
30607impl<'de> serde::Deserialize<'de> for RealtimeServerEventInputAudioBufferSpeechStarted {
30608    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
30609    where
30610        D: serde::Deserializer<'de>,
30611    {
30612        #[serde_with::serde_as]
30613        #[derive(serde :: Deserialize)]
30614        struct RealtimeServerEventInputAudioBufferSpeechStarted {
30615            #[serde(rename = "event_id")]
30616            event_id: String,
30617            #[serde(rename = "type")]
30618            #[allow(dead_code)]
30619            r#type: crate::__types::realtime_server_event_input_audio_buffer_speech_started::Type,
30620            #[serde(rename = "audio_start_ms")]
30621            audio_start_ms: i64,
30622            #[serde(rename = "item_id")]
30623            item_id: String,
30624        }
30625        let RealtimeServerEventInputAudioBufferSpeechStarted {
30626            event_id,
30627            audio_start_ms,
30628            item_id,
30629            ..
30630        } = RealtimeServerEventInputAudioBufferSpeechStarted::deserialize(deserializer)?;
30631        Ok(Self {
30632            event_id,
30633            audio_start_ms,
30634            item_id,
30635        })
30636    }
30637}
30638impl serde::Serialize for RealtimeServerEventInputAudioBufferSpeechStarted {
30639    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
30640    where
30641        S: serde::Serializer,
30642    {
30643        #[serde_with::serde_as]
30644        #[derive(serde :: Serialize)]
30645        struct RealtimeServerEventInputAudioBufferSpeechStarted<'a> {
30646            #[serde(rename = "event_id")]
30647            event_id: &'a String,
30648            #[serde(rename = "type")]
30649            r#type:
30650                &'a crate::__types::realtime_server_event_input_audio_buffer_speech_started::Type,
30651            #[serde(rename = "audio_start_ms")]
30652            audio_start_ms: &'a i64,
30653            #[serde(rename = "item_id")]
30654            item_id: &'a String,
30655        }
30656        let Self {
30657            event_id,
30658            audio_start_ms,
30659            item_id,
30660        } = self;
30661        RealtimeServerEventInputAudioBufferSpeechStarted {
30662            event_id,
30663            r#type: &Default::default(),
30664            audio_start_ms,
30665            item_id,
30666        }
30667        .serialize(serializer)
30668    }
30669}
30670#[allow(clippy::module_inception)]
30671pub(crate) mod realtime_server_event_input_audio_buffer_speech_stopped {
30672    #[doc = "The event type, must be `input_audio_buffer.speech_stopped`."]
30673    #[derive(Clone, Copy, Debug, Default, PartialEq)]
30674    pub(crate) struct Type;
30675    impl_serde!(Type, "input_audio_buffer.speech_stopped");
30676}
30677#[doc = "Returned in `server_vad` mode when the server detects the end of speech in \nthe audio buffer. The server will also send an `conversation.item.created` \nevent with the user message item that is created from the audio buffer.\n"]
30678#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
30679pub struct RealtimeServerEventInputAudioBufferSpeechStopped {
30680    #[doc = "The unique ID of the server event."]
30681    pub event_id: String,
30682    #[doc = "Milliseconds since the session started when speech stopped. This will \ncorrespond to the end of audio sent to the model, and thus includes the \n`min_silence_duration_ms` configured in the Session.\n"]
30683    pub audio_end_ms: i64,
30684    #[doc = "The ID of the user message item that will be created."]
30685    pub item_id: String,
30686}
30687impl<'de> serde::Deserialize<'de> for RealtimeServerEventInputAudioBufferSpeechStopped {
30688    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
30689    where
30690        D: serde::Deserializer<'de>,
30691    {
30692        #[serde_with::serde_as]
30693        #[derive(serde :: Deserialize)]
30694        struct RealtimeServerEventInputAudioBufferSpeechStopped {
30695            #[serde(rename = "event_id")]
30696            event_id: String,
30697            #[serde(rename = "type")]
30698            #[allow(dead_code)]
30699            r#type: crate::__types::realtime_server_event_input_audio_buffer_speech_stopped::Type,
30700            #[serde(rename = "audio_end_ms")]
30701            audio_end_ms: i64,
30702            #[serde(rename = "item_id")]
30703            item_id: String,
30704        }
30705        let RealtimeServerEventInputAudioBufferSpeechStopped {
30706            event_id,
30707            audio_end_ms,
30708            item_id,
30709            ..
30710        } = RealtimeServerEventInputAudioBufferSpeechStopped::deserialize(deserializer)?;
30711        Ok(Self {
30712            event_id,
30713            audio_end_ms,
30714            item_id,
30715        })
30716    }
30717}
30718impl serde::Serialize for RealtimeServerEventInputAudioBufferSpeechStopped {
30719    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
30720    where
30721        S: serde::Serializer,
30722    {
30723        #[serde_with::serde_as]
30724        #[derive(serde :: Serialize)]
30725        struct RealtimeServerEventInputAudioBufferSpeechStopped<'a> {
30726            #[serde(rename = "event_id")]
30727            event_id: &'a String,
30728            #[serde(rename = "type")]
30729            r#type:
30730                &'a crate::__types::realtime_server_event_input_audio_buffer_speech_stopped::Type,
30731            #[serde(rename = "audio_end_ms")]
30732            audio_end_ms: &'a i64,
30733            #[serde(rename = "item_id")]
30734            item_id: &'a String,
30735        }
30736        let Self {
30737            event_id,
30738            audio_end_ms,
30739            item_id,
30740        } = self;
30741        RealtimeServerEventInputAudioBufferSpeechStopped {
30742            event_id,
30743            r#type: &Default::default(),
30744            audio_end_ms,
30745            item_id,
30746        }
30747        .serialize(serializer)
30748    }
30749}
30750#[allow(clippy::module_inception)]
30751pub(crate) mod realtime_server_event_output_audio_buffer_cleared {
30752    #[doc = "The event type, must be `output_audio_buffer.cleared`."]
30753    #[derive(Clone, Copy, Debug, Default, PartialEq)]
30754    pub(crate) struct Type;
30755    impl_serde!(Type, "output_audio_buffer.cleared");
30756}
30757#[doc = "**WebRTC Only:** Emitted when the output audio buffer is cleared. This happens either in VAD\nmode when the user has interrupted (`input_audio_buffer.speech_started`),\nor when the client has emitted the `output_audio_buffer.clear` event to manually\ncut off the current audio response.\n[Learn more](https://platform.openai.com/docs/guides/realtime-conversations#client-and-server-events-for-audio-in-webrtc).\n"]
30758#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
30759pub struct RealtimeServerEventOutputAudioBufferCleared {
30760    #[doc = "The unique ID of the server event."]
30761    pub event_id: String,
30762    #[doc = "The unique ID of the response that produced the audio."]
30763    pub response_id: String,
30764}
30765impl<'de> serde::Deserialize<'de> for RealtimeServerEventOutputAudioBufferCleared {
30766    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
30767    where
30768        D: serde::Deserializer<'de>,
30769    {
30770        #[serde_with::serde_as]
30771        #[derive(serde :: Deserialize)]
30772        struct RealtimeServerEventOutputAudioBufferCleared {
30773            #[serde(rename = "event_id")]
30774            event_id: String,
30775            #[serde(rename = "type")]
30776            #[allow(dead_code)]
30777            r#type: crate::__types::realtime_server_event_output_audio_buffer_cleared::Type,
30778            #[serde(rename = "response_id")]
30779            response_id: String,
30780        }
30781        let RealtimeServerEventOutputAudioBufferCleared {
30782            event_id,
30783            response_id,
30784            ..
30785        } = RealtimeServerEventOutputAudioBufferCleared::deserialize(deserializer)?;
30786        Ok(Self {
30787            event_id,
30788            response_id,
30789        })
30790    }
30791}
30792impl serde::Serialize for RealtimeServerEventOutputAudioBufferCleared {
30793    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
30794    where
30795        S: serde::Serializer,
30796    {
30797        #[serde_with::serde_as]
30798        #[derive(serde :: Serialize)]
30799        struct RealtimeServerEventOutputAudioBufferCleared<'a> {
30800            #[serde(rename = "event_id")]
30801            event_id: &'a String,
30802            #[serde(rename = "type")]
30803            r#type: &'a crate::__types::realtime_server_event_output_audio_buffer_cleared::Type,
30804            #[serde(rename = "response_id")]
30805            response_id: &'a String,
30806        }
30807        let Self {
30808            event_id,
30809            response_id,
30810        } = self;
30811        RealtimeServerEventOutputAudioBufferCleared {
30812            event_id,
30813            r#type: &Default::default(),
30814            response_id,
30815        }
30816        .serialize(serializer)
30817    }
30818}
30819#[allow(clippy::module_inception)]
30820pub(crate) mod realtime_server_event_output_audio_buffer_started {
30821    #[doc = "The event type, must be `output_audio_buffer.started`."]
30822    #[derive(Clone, Copy, Debug, Default, PartialEq)]
30823    pub(crate) struct Type;
30824    impl_serde!(Type, "output_audio_buffer.started");
30825}
30826#[doc = "**WebRTC Only:** Emitted when the server begins streaming audio to the client. This event is\nemitted after an audio content part has been added (`response.content_part.added`)\nto the response.\n[Learn more](https://platform.openai.com/docs/guides/realtime-conversations#client-and-server-events-for-audio-in-webrtc).\n"]
30827#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
30828pub struct RealtimeServerEventOutputAudioBufferStarted {
30829    #[doc = "The unique ID of the server event."]
30830    pub event_id: String,
30831    #[doc = "The unique ID of the response that produced the audio."]
30832    pub response_id: String,
30833}
30834impl<'de> serde::Deserialize<'de> for RealtimeServerEventOutputAudioBufferStarted {
30835    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
30836    where
30837        D: serde::Deserializer<'de>,
30838    {
30839        #[serde_with::serde_as]
30840        #[derive(serde :: Deserialize)]
30841        struct RealtimeServerEventOutputAudioBufferStarted {
30842            #[serde(rename = "event_id")]
30843            event_id: String,
30844            #[serde(rename = "type")]
30845            #[allow(dead_code)]
30846            r#type: crate::__types::realtime_server_event_output_audio_buffer_started::Type,
30847            #[serde(rename = "response_id")]
30848            response_id: String,
30849        }
30850        let RealtimeServerEventOutputAudioBufferStarted {
30851            event_id,
30852            response_id,
30853            ..
30854        } = RealtimeServerEventOutputAudioBufferStarted::deserialize(deserializer)?;
30855        Ok(Self {
30856            event_id,
30857            response_id,
30858        })
30859    }
30860}
30861impl serde::Serialize for RealtimeServerEventOutputAudioBufferStarted {
30862    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
30863    where
30864        S: serde::Serializer,
30865    {
30866        #[serde_with::serde_as]
30867        #[derive(serde :: Serialize)]
30868        struct RealtimeServerEventOutputAudioBufferStarted<'a> {
30869            #[serde(rename = "event_id")]
30870            event_id: &'a String,
30871            #[serde(rename = "type")]
30872            r#type: &'a crate::__types::realtime_server_event_output_audio_buffer_started::Type,
30873            #[serde(rename = "response_id")]
30874            response_id: &'a String,
30875        }
30876        let Self {
30877            event_id,
30878            response_id,
30879        } = self;
30880        RealtimeServerEventOutputAudioBufferStarted {
30881            event_id,
30882            r#type: &Default::default(),
30883            response_id,
30884        }
30885        .serialize(serializer)
30886    }
30887}
30888#[allow(clippy::module_inception)]
30889pub(crate) mod realtime_server_event_output_audio_buffer_stopped {
30890    #[doc = "The event type, must be `output_audio_buffer.stopped`."]
30891    #[derive(Clone, Copy, Debug, Default, PartialEq)]
30892    pub(crate) struct Type;
30893    impl_serde!(Type, "output_audio_buffer.stopped");
30894}
30895#[doc = "**WebRTC Only:** Emitted when the output audio buffer has been completely drained on the server,\nand no more audio is forthcoming. This event is emitted after the full response\ndata has been sent to the client (`response.done`).\n[Learn more](https://platform.openai.com/docs/guides/realtime-conversations#client-and-server-events-for-audio-in-webrtc).\n"]
30896#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
30897pub struct RealtimeServerEventOutputAudioBufferStopped {
30898    #[doc = "The unique ID of the server event."]
30899    pub event_id: String,
30900    #[doc = "The unique ID of the response that produced the audio."]
30901    pub response_id: String,
30902}
30903impl<'de> serde::Deserialize<'de> for RealtimeServerEventOutputAudioBufferStopped {
30904    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
30905    where
30906        D: serde::Deserializer<'de>,
30907    {
30908        #[serde_with::serde_as]
30909        #[derive(serde :: Deserialize)]
30910        struct RealtimeServerEventOutputAudioBufferStopped {
30911            #[serde(rename = "event_id")]
30912            event_id: String,
30913            #[serde(rename = "type")]
30914            #[allow(dead_code)]
30915            r#type: crate::__types::realtime_server_event_output_audio_buffer_stopped::Type,
30916            #[serde(rename = "response_id")]
30917            response_id: String,
30918        }
30919        let RealtimeServerEventOutputAudioBufferStopped {
30920            event_id,
30921            response_id,
30922            ..
30923        } = RealtimeServerEventOutputAudioBufferStopped::deserialize(deserializer)?;
30924        Ok(Self {
30925            event_id,
30926            response_id,
30927        })
30928    }
30929}
30930impl serde::Serialize for RealtimeServerEventOutputAudioBufferStopped {
30931    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
30932    where
30933        S: serde::Serializer,
30934    {
30935        #[serde_with::serde_as]
30936        #[derive(serde :: Serialize)]
30937        struct RealtimeServerEventOutputAudioBufferStopped<'a> {
30938            #[serde(rename = "event_id")]
30939            event_id: &'a String,
30940            #[serde(rename = "type")]
30941            r#type: &'a crate::__types::realtime_server_event_output_audio_buffer_stopped::Type,
30942            #[serde(rename = "response_id")]
30943            response_id: &'a String,
30944        }
30945        let Self {
30946            event_id,
30947            response_id,
30948        } = self;
30949        RealtimeServerEventOutputAudioBufferStopped {
30950            event_id,
30951            r#type: &Default::default(),
30952            response_id,
30953        }
30954        .serialize(serializer)
30955    }
30956}
30957#[allow(clippy::module_inception)]
30958pub mod realtime_server_event_rate_limits_updated {
30959    #[doc = "The event type, must be `rate_limits.updated`."]
30960    #[derive(Clone, Copy, Debug, Default, PartialEq)]
30961    pub(crate) struct Type;
30962    impl_serde!(Type, "rate_limits.updated");
30963    #[allow(clippy::module_inception)]
30964    pub mod rate_limits {
30965        #[allow(clippy::module_inception)]
30966        pub mod item {
30967            #[doc = "The name of the rate limit (`requests`, `tokens`).\n"]
30968            #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
30969            pub enum Name {
30970                #[doc = "`requests`"]
30971                #[serde(rename = "requests")]
30972                Requests,
30973                #[doc = "`tokens`"]
30974                #[serde(rename = "tokens")]
30975                Tokens,
30976            }
30977        }
30978        #[derive(Clone, Debug, Default, PartialEq)]
30979        #[serde_with::serde_as]
30980        #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
30981        pub struct Item {
30982            #[doc = "The name of the rate limit (`requests`, `tokens`).\n"]
30983            #[serde(rename = "name")]
30984            #[serde(skip_serializing_if = "Option::is_none")]
30985            #[builder(default)]
30986            pub name: Option<
30987                crate::__types::realtime_server_event_rate_limits_updated::rate_limits::item::Name,
30988            >,
30989            #[doc = "The maximum allowed value for the rate limit."]
30990            #[serde(rename = "limit")]
30991            #[serde(skip_serializing_if = "Option::is_none")]
30992            #[builder(default)]
30993            pub limit: Option<i64>,
30994            #[doc = "The remaining value before the limit is reached."]
30995            #[serde(rename = "remaining")]
30996            #[serde(skip_serializing_if = "Option::is_none")]
30997            #[builder(default)]
30998            pub remaining: Option<i64>,
30999            #[doc = "Seconds until the rate limit resets."]
31000            #[serde(rename = "reset_seconds")]
31001            #[serde(skip_serializing_if = "Option::is_none")]
31002            #[builder(default)]
31003            pub reset_seconds: Option<serde_json::Number>,
31004        }
31005    }
31006}
31007#[doc = "Emitted at the beginning of a Response to indicate the updated rate limits. \nWhen a Response is created some tokens will be \"reserved\" for the output \ntokens, the rate limits shown here reflect that reservation, which is then \nadjusted accordingly once the Response is completed.\n"]
31008#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
31009pub struct RealtimeServerEventRateLimitsUpdated {
31010    #[doc = "The unique ID of the server event."]
31011    pub event_id: String,
31012    #[doc = "List of rate limit information."]
31013    pub rate_limits:
31014        Vec<crate::__types::realtime_server_event_rate_limits_updated::rate_limits::Item>,
31015}
31016impl<'de> serde::Deserialize<'de> for RealtimeServerEventRateLimitsUpdated {
31017    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
31018    where
31019        D: serde::Deserializer<'de>,
31020    {
31021        #[serde_with::serde_as]
31022        #[derive(serde :: Deserialize)]
31023        struct RealtimeServerEventRateLimitsUpdated {
31024            #[serde(rename = "event_id")]
31025            event_id: String,
31026            #[serde(rename = "type")]
31027            #[allow(dead_code)]
31028            r#type: crate::__types::realtime_server_event_rate_limits_updated::Type,
31029            #[serde(rename = "rate_limits")]
31030            rate_limits:
31031                Vec<crate::__types::realtime_server_event_rate_limits_updated::rate_limits::Item>,
31032        }
31033        let RealtimeServerEventRateLimitsUpdated {
31034            event_id,
31035            rate_limits,
31036            ..
31037        } = RealtimeServerEventRateLimitsUpdated::deserialize(deserializer)?;
31038        Ok(Self {
31039            event_id,
31040            rate_limits,
31041        })
31042    }
31043}
31044impl serde::Serialize for RealtimeServerEventRateLimitsUpdated {
31045    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
31046    where
31047        S: serde::Serializer,
31048    {
31049        #[serde_with::serde_as]
31050        #[derive(serde :: Serialize)]
31051        struct RealtimeServerEventRateLimitsUpdated<'a> {
31052            #[serde(rename = "event_id")]
31053            event_id: &'a String,
31054            #[serde(rename = "type")]
31055            r#type: &'a crate::__types::realtime_server_event_rate_limits_updated::Type,
31056            #[serde(rename = "rate_limits")]
31057            rate_limits: &'a Vec<
31058                crate::__types::realtime_server_event_rate_limits_updated::rate_limits::Item,
31059            >,
31060        }
31061        let Self {
31062            event_id,
31063            rate_limits,
31064        } = self;
31065        RealtimeServerEventRateLimitsUpdated {
31066            event_id,
31067            r#type: &Default::default(),
31068            rate_limits,
31069        }
31070        .serialize(serializer)
31071    }
31072}
31073#[allow(clippy::module_inception)]
31074pub(crate) mod realtime_server_event_response_audio_delta {
31075    #[doc = "The event type, must be `response.audio.delta`."]
31076    #[derive(Clone, Copy, Debug, Default, PartialEq)]
31077    pub(crate) struct Type;
31078    impl_serde!(Type, "response.audio.delta");
31079}
31080#[doc = "Returned when the model-generated audio is updated."]
31081#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
31082pub struct RealtimeServerEventResponseAudioDelta {
31083    #[doc = "The unique ID of the server event."]
31084    pub event_id: String,
31085    #[doc = "The ID of the response."]
31086    pub response_id: String,
31087    #[doc = "The ID of the item."]
31088    pub item_id: String,
31089    #[doc = "The index of the output item in the response."]
31090    pub output_index: i64,
31091    #[doc = "The index of the content part in the item's content array."]
31092    pub content_index: i64,
31093    #[doc = "Base64-encoded audio data delta."]
31094    pub delta: String,
31095}
31096impl<'de> serde::Deserialize<'de> for RealtimeServerEventResponseAudioDelta {
31097    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
31098    where
31099        D: serde::Deserializer<'de>,
31100    {
31101        #[serde_with::serde_as]
31102        #[derive(serde :: Deserialize)]
31103        struct RealtimeServerEventResponseAudioDelta {
31104            #[serde(rename = "event_id")]
31105            event_id: String,
31106            #[serde(rename = "type")]
31107            #[allow(dead_code)]
31108            r#type: crate::__types::realtime_server_event_response_audio_delta::Type,
31109            #[serde(rename = "response_id")]
31110            response_id: String,
31111            #[serde(rename = "item_id")]
31112            item_id: String,
31113            #[serde(rename = "output_index")]
31114            output_index: i64,
31115            #[serde(rename = "content_index")]
31116            content_index: i64,
31117            #[serde(rename = "delta")]
31118            delta: String,
31119        }
31120        let RealtimeServerEventResponseAudioDelta {
31121            event_id,
31122            response_id,
31123            item_id,
31124            output_index,
31125            content_index,
31126            delta,
31127            ..
31128        } = RealtimeServerEventResponseAudioDelta::deserialize(deserializer)?;
31129        Ok(Self {
31130            event_id,
31131            response_id,
31132            item_id,
31133            output_index,
31134            content_index,
31135            delta,
31136        })
31137    }
31138}
31139impl serde::Serialize for RealtimeServerEventResponseAudioDelta {
31140    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
31141    where
31142        S: serde::Serializer,
31143    {
31144        #[serde_with::serde_as]
31145        #[derive(serde :: Serialize)]
31146        struct RealtimeServerEventResponseAudioDelta<'a> {
31147            #[serde(rename = "event_id")]
31148            event_id: &'a String,
31149            #[serde(rename = "type")]
31150            r#type: &'a crate::__types::realtime_server_event_response_audio_delta::Type,
31151            #[serde(rename = "response_id")]
31152            response_id: &'a String,
31153            #[serde(rename = "item_id")]
31154            item_id: &'a String,
31155            #[serde(rename = "output_index")]
31156            output_index: &'a i64,
31157            #[serde(rename = "content_index")]
31158            content_index: &'a i64,
31159            #[serde(rename = "delta")]
31160            delta: &'a String,
31161        }
31162        let Self {
31163            event_id,
31164            response_id,
31165            item_id,
31166            output_index,
31167            content_index,
31168            delta,
31169        } = self;
31170        RealtimeServerEventResponseAudioDelta {
31171            event_id,
31172            r#type: &Default::default(),
31173            response_id,
31174            item_id,
31175            output_index,
31176            content_index,
31177            delta,
31178        }
31179        .serialize(serializer)
31180    }
31181}
31182#[allow(clippy::module_inception)]
31183pub(crate) mod realtime_server_event_response_audio_done {
31184    #[doc = "The event type, must be `response.audio.done`."]
31185    #[derive(Clone, Copy, Debug, Default, PartialEq)]
31186    pub(crate) struct Type;
31187    impl_serde!(Type, "response.audio.done");
31188}
31189#[doc = "Returned when the model-generated audio is done. Also emitted when a Response\nis interrupted, incomplete, or cancelled.\n"]
31190#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
31191pub struct RealtimeServerEventResponseAudioDone {
31192    #[doc = "The unique ID of the server event."]
31193    pub event_id: String,
31194    #[doc = "The ID of the response."]
31195    pub response_id: String,
31196    #[doc = "The ID of the item."]
31197    pub item_id: String,
31198    #[doc = "The index of the output item in the response."]
31199    pub output_index: i64,
31200    #[doc = "The index of the content part in the item's content array."]
31201    pub content_index: i64,
31202}
31203impl<'de> serde::Deserialize<'de> for RealtimeServerEventResponseAudioDone {
31204    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
31205    where
31206        D: serde::Deserializer<'de>,
31207    {
31208        #[serde_with::serde_as]
31209        #[derive(serde :: Deserialize)]
31210        struct RealtimeServerEventResponseAudioDone {
31211            #[serde(rename = "event_id")]
31212            event_id: String,
31213            #[serde(rename = "type")]
31214            #[allow(dead_code)]
31215            r#type: crate::__types::realtime_server_event_response_audio_done::Type,
31216            #[serde(rename = "response_id")]
31217            response_id: String,
31218            #[serde(rename = "item_id")]
31219            item_id: String,
31220            #[serde(rename = "output_index")]
31221            output_index: i64,
31222            #[serde(rename = "content_index")]
31223            content_index: i64,
31224        }
31225        let RealtimeServerEventResponseAudioDone {
31226            event_id,
31227            response_id,
31228            item_id,
31229            output_index,
31230            content_index,
31231            ..
31232        } = RealtimeServerEventResponseAudioDone::deserialize(deserializer)?;
31233        Ok(Self {
31234            event_id,
31235            response_id,
31236            item_id,
31237            output_index,
31238            content_index,
31239        })
31240    }
31241}
31242impl serde::Serialize for RealtimeServerEventResponseAudioDone {
31243    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
31244    where
31245        S: serde::Serializer,
31246    {
31247        #[serde_with::serde_as]
31248        #[derive(serde :: Serialize)]
31249        struct RealtimeServerEventResponseAudioDone<'a> {
31250            #[serde(rename = "event_id")]
31251            event_id: &'a String,
31252            #[serde(rename = "type")]
31253            r#type: &'a crate::__types::realtime_server_event_response_audio_done::Type,
31254            #[serde(rename = "response_id")]
31255            response_id: &'a String,
31256            #[serde(rename = "item_id")]
31257            item_id: &'a String,
31258            #[serde(rename = "output_index")]
31259            output_index: &'a i64,
31260            #[serde(rename = "content_index")]
31261            content_index: &'a i64,
31262        }
31263        let Self {
31264            event_id,
31265            response_id,
31266            item_id,
31267            output_index,
31268            content_index,
31269        } = self;
31270        RealtimeServerEventResponseAudioDone {
31271            event_id,
31272            r#type: &Default::default(),
31273            response_id,
31274            item_id,
31275            output_index,
31276            content_index,
31277        }
31278        .serialize(serializer)
31279    }
31280}
31281#[allow(clippy::module_inception)]
31282pub(crate) mod realtime_server_event_response_audio_transcript_delta {
31283    #[doc = "The event type, must be `response.audio_transcript.delta`."]
31284    #[derive(Clone, Copy, Debug, Default, PartialEq)]
31285    pub(crate) struct Type;
31286    impl_serde!(Type, "response.audio_transcript.delta");
31287}
31288#[doc = "Returned when the model-generated transcription of audio output is updated.\n"]
31289#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
31290pub struct RealtimeServerEventResponseAudioTranscriptDelta {
31291    #[doc = "The unique ID of the server event."]
31292    pub event_id: String,
31293    #[doc = "The ID of the response."]
31294    pub response_id: String,
31295    #[doc = "The ID of the item."]
31296    pub item_id: String,
31297    #[doc = "The index of the output item in the response."]
31298    pub output_index: i64,
31299    #[doc = "The index of the content part in the item's content array."]
31300    pub content_index: i64,
31301    #[doc = "The transcript delta."]
31302    pub delta: String,
31303}
31304impl<'de> serde::Deserialize<'de> for RealtimeServerEventResponseAudioTranscriptDelta {
31305    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
31306    where
31307        D: serde::Deserializer<'de>,
31308    {
31309        #[serde_with::serde_as]
31310        #[derive(serde :: Deserialize)]
31311        struct RealtimeServerEventResponseAudioTranscriptDelta {
31312            #[serde(rename = "event_id")]
31313            event_id: String,
31314            #[serde(rename = "type")]
31315            #[allow(dead_code)]
31316            r#type: crate::__types::realtime_server_event_response_audio_transcript_delta::Type,
31317            #[serde(rename = "response_id")]
31318            response_id: String,
31319            #[serde(rename = "item_id")]
31320            item_id: String,
31321            #[serde(rename = "output_index")]
31322            output_index: i64,
31323            #[serde(rename = "content_index")]
31324            content_index: i64,
31325            #[serde(rename = "delta")]
31326            delta: String,
31327        }
31328        let RealtimeServerEventResponseAudioTranscriptDelta {
31329            event_id,
31330            response_id,
31331            item_id,
31332            output_index,
31333            content_index,
31334            delta,
31335            ..
31336        } = RealtimeServerEventResponseAudioTranscriptDelta::deserialize(deserializer)?;
31337        Ok(Self {
31338            event_id,
31339            response_id,
31340            item_id,
31341            output_index,
31342            content_index,
31343            delta,
31344        })
31345    }
31346}
31347impl serde::Serialize for RealtimeServerEventResponseAudioTranscriptDelta {
31348    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
31349    where
31350        S: serde::Serializer,
31351    {
31352        #[serde_with::serde_as]
31353        #[derive(serde :: Serialize)]
31354        struct RealtimeServerEventResponseAudioTranscriptDelta<'a> {
31355            #[serde(rename = "event_id")]
31356            event_id: &'a String,
31357            #[serde(rename = "type")]
31358            r#type: &'a crate::__types::realtime_server_event_response_audio_transcript_delta::Type,
31359            #[serde(rename = "response_id")]
31360            response_id: &'a String,
31361            #[serde(rename = "item_id")]
31362            item_id: &'a String,
31363            #[serde(rename = "output_index")]
31364            output_index: &'a i64,
31365            #[serde(rename = "content_index")]
31366            content_index: &'a i64,
31367            #[serde(rename = "delta")]
31368            delta: &'a String,
31369        }
31370        let Self {
31371            event_id,
31372            response_id,
31373            item_id,
31374            output_index,
31375            content_index,
31376            delta,
31377        } = self;
31378        RealtimeServerEventResponseAudioTranscriptDelta {
31379            event_id,
31380            r#type: &Default::default(),
31381            response_id,
31382            item_id,
31383            output_index,
31384            content_index,
31385            delta,
31386        }
31387        .serialize(serializer)
31388    }
31389}
31390#[allow(clippy::module_inception)]
31391pub(crate) mod realtime_server_event_response_audio_transcript_done {
31392    #[doc = "The event type, must be `response.audio_transcript.done`."]
31393    #[derive(Clone, Copy, Debug, Default, PartialEq)]
31394    pub(crate) struct Type;
31395    impl_serde!(Type, "response.audio_transcript.done");
31396}
31397#[doc = "Returned when the model-generated transcription of audio output is done\nstreaming. Also emitted when a Response is interrupted, incomplete, or\ncancelled.\n"]
31398#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
31399pub struct RealtimeServerEventResponseAudioTranscriptDone {
31400    #[doc = "The unique ID of the server event."]
31401    pub event_id: String,
31402    #[doc = "The ID of the response."]
31403    pub response_id: String,
31404    #[doc = "The ID of the item."]
31405    pub item_id: String,
31406    #[doc = "The index of the output item in the response."]
31407    pub output_index: i64,
31408    #[doc = "The index of the content part in the item's content array."]
31409    pub content_index: i64,
31410    #[doc = "The final transcript of the audio."]
31411    pub transcript: String,
31412}
31413impl<'de> serde::Deserialize<'de> for RealtimeServerEventResponseAudioTranscriptDone {
31414    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
31415    where
31416        D: serde::Deserializer<'de>,
31417    {
31418        #[serde_with::serde_as]
31419        #[derive(serde :: Deserialize)]
31420        struct RealtimeServerEventResponseAudioTranscriptDone {
31421            #[serde(rename = "event_id")]
31422            event_id: String,
31423            #[serde(rename = "type")]
31424            #[allow(dead_code)]
31425            r#type: crate::__types::realtime_server_event_response_audio_transcript_done::Type,
31426            #[serde(rename = "response_id")]
31427            response_id: String,
31428            #[serde(rename = "item_id")]
31429            item_id: String,
31430            #[serde(rename = "output_index")]
31431            output_index: i64,
31432            #[serde(rename = "content_index")]
31433            content_index: i64,
31434            #[serde(rename = "transcript")]
31435            transcript: String,
31436        }
31437        let RealtimeServerEventResponseAudioTranscriptDone {
31438            event_id,
31439            response_id,
31440            item_id,
31441            output_index,
31442            content_index,
31443            transcript,
31444            ..
31445        } = RealtimeServerEventResponseAudioTranscriptDone::deserialize(deserializer)?;
31446        Ok(Self {
31447            event_id,
31448            response_id,
31449            item_id,
31450            output_index,
31451            content_index,
31452            transcript,
31453        })
31454    }
31455}
31456impl serde::Serialize for RealtimeServerEventResponseAudioTranscriptDone {
31457    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
31458    where
31459        S: serde::Serializer,
31460    {
31461        #[serde_with::serde_as]
31462        #[derive(serde :: Serialize)]
31463        struct RealtimeServerEventResponseAudioTranscriptDone<'a> {
31464            #[serde(rename = "event_id")]
31465            event_id: &'a String,
31466            #[serde(rename = "type")]
31467            r#type: &'a crate::__types::realtime_server_event_response_audio_transcript_done::Type,
31468            #[serde(rename = "response_id")]
31469            response_id: &'a String,
31470            #[serde(rename = "item_id")]
31471            item_id: &'a String,
31472            #[serde(rename = "output_index")]
31473            output_index: &'a i64,
31474            #[serde(rename = "content_index")]
31475            content_index: &'a i64,
31476            #[serde(rename = "transcript")]
31477            transcript: &'a String,
31478        }
31479        let Self {
31480            event_id,
31481            response_id,
31482            item_id,
31483            output_index,
31484            content_index,
31485            transcript,
31486        } = self;
31487        RealtimeServerEventResponseAudioTranscriptDone {
31488            event_id,
31489            r#type: &Default::default(),
31490            response_id,
31491            item_id,
31492            output_index,
31493            content_index,
31494            transcript,
31495        }
31496        .serialize(serializer)
31497    }
31498}
31499#[allow(clippy::module_inception)]
31500pub mod realtime_server_event_response_content_part_added {
31501    #[doc = "The event type, must be `response.content_part.added`."]
31502    #[derive(Clone, Copy, Debug, Default, PartialEq)]
31503    pub(crate) struct Type;
31504    impl_serde!(Type, "response.content_part.added");
31505    #[allow(clippy::module_inception)]
31506    pub mod part {
31507        #[doc = "The content type (\"text\", \"audio\")."]
31508        #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
31509        pub enum Type {
31510            #[doc = "`text`"]
31511            #[serde(rename = "text")]
31512            Text,
31513            #[doc = "`audio`"]
31514            #[serde(rename = "audio")]
31515            Audio,
31516        }
31517    }
31518    #[doc = "The content part that was added."]
31519    #[derive(Clone, Debug, Default, PartialEq)]
31520    #[serde_with::serde_as]
31521    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
31522    pub struct Part {
31523        #[doc = "The content type (\"text\", \"audio\")."]
31524        #[serde(rename = "type")]
31525        #[serde(skip_serializing_if = "Option::is_none")]
31526        #[builder(default)]
31527        pub r#type:
31528            Option<crate::__types::realtime_server_event_response_content_part_added::part::Type>,
31529        #[doc = "The text content (if type is \"text\")."]
31530        #[serde(rename = "text")]
31531        #[serde(skip_serializing_if = "Option::is_none")]
31532        #[builder(default)]
31533        pub text: Option<String>,
31534        #[doc = "Base64-encoded audio data (if type is \"audio\")."]
31535        #[serde(rename = "audio")]
31536        #[serde(skip_serializing_if = "Option::is_none")]
31537        #[builder(default)]
31538        pub audio: Option<String>,
31539        #[doc = "The transcript of the audio (if type is \"audio\")."]
31540        #[serde(rename = "transcript")]
31541        #[serde(skip_serializing_if = "Option::is_none")]
31542        #[builder(default)]
31543        pub transcript: Option<String>,
31544    }
31545}
31546#[doc = "Returned when a new content part is added to an assistant message item during\nresponse generation.\n"]
31547#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
31548pub struct RealtimeServerEventResponseContentPartAdded {
31549    #[doc = "The unique ID of the server event."]
31550    pub event_id: String,
31551    #[doc = "The ID of the response."]
31552    pub response_id: String,
31553    #[doc = "The ID of the item to which the content part was added."]
31554    pub item_id: String,
31555    #[doc = "The index of the output item in the response."]
31556    pub output_index: i64,
31557    #[doc = "The index of the content part in the item's content array."]
31558    pub content_index: i64,
31559    #[doc = "The content part that was added."]
31560    #[builder(default)]
31561    pub part: crate::__types::realtime_server_event_response_content_part_added::Part,
31562}
31563impl<'de> serde::Deserialize<'de> for RealtimeServerEventResponseContentPartAdded {
31564    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
31565    where
31566        D: serde::Deserializer<'de>,
31567    {
31568        #[serde_with::serde_as]
31569        #[derive(serde :: Deserialize)]
31570        struct RealtimeServerEventResponseContentPartAdded {
31571            #[serde(rename = "event_id")]
31572            event_id: String,
31573            #[serde(rename = "type")]
31574            #[allow(dead_code)]
31575            r#type: crate::__types::realtime_server_event_response_content_part_added::Type,
31576            #[serde(rename = "response_id")]
31577            response_id: String,
31578            #[serde(rename = "item_id")]
31579            item_id: String,
31580            #[serde(rename = "output_index")]
31581            output_index: i64,
31582            #[serde(rename = "content_index")]
31583            content_index: i64,
31584            #[serde(rename = "part")]
31585            part: crate::__types::realtime_server_event_response_content_part_added::Part,
31586        }
31587        let RealtimeServerEventResponseContentPartAdded {
31588            event_id,
31589            response_id,
31590            item_id,
31591            output_index,
31592            content_index,
31593            part,
31594            ..
31595        } = RealtimeServerEventResponseContentPartAdded::deserialize(deserializer)?;
31596        Ok(Self {
31597            event_id,
31598            response_id,
31599            item_id,
31600            output_index,
31601            content_index,
31602            part,
31603        })
31604    }
31605}
31606impl serde::Serialize for RealtimeServerEventResponseContentPartAdded {
31607    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
31608    where
31609        S: serde::Serializer,
31610    {
31611        #[serde_with::serde_as]
31612        #[derive(serde :: Serialize)]
31613        struct RealtimeServerEventResponseContentPartAdded<'a> {
31614            #[serde(rename = "event_id")]
31615            event_id: &'a String,
31616            #[serde(rename = "type")]
31617            r#type: &'a crate::__types::realtime_server_event_response_content_part_added::Type,
31618            #[serde(rename = "response_id")]
31619            response_id: &'a String,
31620            #[serde(rename = "item_id")]
31621            item_id: &'a String,
31622            #[serde(rename = "output_index")]
31623            output_index: &'a i64,
31624            #[serde(rename = "content_index")]
31625            content_index: &'a i64,
31626            #[serde(rename = "part")]
31627            part: &'a crate::__types::realtime_server_event_response_content_part_added::Part,
31628        }
31629        let Self {
31630            event_id,
31631            response_id,
31632            item_id,
31633            output_index,
31634            content_index,
31635            part,
31636        } = self;
31637        RealtimeServerEventResponseContentPartAdded {
31638            event_id,
31639            r#type: &Default::default(),
31640            response_id,
31641            item_id,
31642            output_index,
31643            content_index,
31644            part,
31645        }
31646        .serialize(serializer)
31647    }
31648}
31649#[allow(clippy::module_inception)]
31650pub mod realtime_server_event_response_content_part_done {
31651    #[doc = "The event type, must be `response.content_part.done`."]
31652    #[derive(Clone, Copy, Debug, Default, PartialEq)]
31653    pub(crate) struct Type;
31654    impl_serde!(Type, "response.content_part.done");
31655    #[allow(clippy::module_inception)]
31656    pub mod part {
31657        #[doc = "The content type (\"text\", \"audio\")."]
31658        #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
31659        pub enum Type {
31660            #[doc = "`text`"]
31661            #[serde(rename = "text")]
31662            Text,
31663            #[doc = "`audio`"]
31664            #[serde(rename = "audio")]
31665            Audio,
31666        }
31667    }
31668    #[doc = "The content part that is done."]
31669    #[derive(Clone, Debug, Default, PartialEq)]
31670    #[serde_with::serde_as]
31671    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
31672    pub struct Part {
31673        #[doc = "The content type (\"text\", \"audio\")."]
31674        #[serde(rename = "type")]
31675        #[serde(skip_serializing_if = "Option::is_none")]
31676        #[builder(default)]
31677        pub r#type:
31678            Option<crate::__types::realtime_server_event_response_content_part_done::part::Type>,
31679        #[doc = "The text content (if type is \"text\")."]
31680        #[serde(rename = "text")]
31681        #[serde(skip_serializing_if = "Option::is_none")]
31682        #[builder(default)]
31683        pub text: Option<String>,
31684        #[doc = "Base64-encoded audio data (if type is \"audio\")."]
31685        #[serde(rename = "audio")]
31686        #[serde(skip_serializing_if = "Option::is_none")]
31687        #[builder(default)]
31688        pub audio: Option<String>,
31689        #[doc = "The transcript of the audio (if type is \"audio\")."]
31690        #[serde(rename = "transcript")]
31691        #[serde(skip_serializing_if = "Option::is_none")]
31692        #[builder(default)]
31693        pub transcript: Option<String>,
31694    }
31695}
31696#[doc = "Returned when a content part is done streaming in an assistant message item.\nAlso emitted when a Response is interrupted, incomplete, or cancelled.\n"]
31697#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
31698pub struct RealtimeServerEventResponseContentPartDone {
31699    #[doc = "The unique ID of the server event."]
31700    pub event_id: String,
31701    #[doc = "The ID of the response."]
31702    pub response_id: String,
31703    #[doc = "The ID of the item."]
31704    pub item_id: String,
31705    #[doc = "The index of the output item in the response."]
31706    pub output_index: i64,
31707    #[doc = "The index of the content part in the item's content array."]
31708    pub content_index: i64,
31709    #[doc = "The content part that is done."]
31710    #[builder(default)]
31711    pub part: crate::__types::realtime_server_event_response_content_part_done::Part,
31712}
31713impl<'de> serde::Deserialize<'de> for RealtimeServerEventResponseContentPartDone {
31714    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
31715    where
31716        D: serde::Deserializer<'de>,
31717    {
31718        #[serde_with::serde_as]
31719        #[derive(serde :: Deserialize)]
31720        struct RealtimeServerEventResponseContentPartDone {
31721            #[serde(rename = "event_id")]
31722            event_id: String,
31723            #[serde(rename = "type")]
31724            #[allow(dead_code)]
31725            r#type: crate::__types::realtime_server_event_response_content_part_done::Type,
31726            #[serde(rename = "response_id")]
31727            response_id: String,
31728            #[serde(rename = "item_id")]
31729            item_id: String,
31730            #[serde(rename = "output_index")]
31731            output_index: i64,
31732            #[serde(rename = "content_index")]
31733            content_index: i64,
31734            #[serde(rename = "part")]
31735            part: crate::__types::realtime_server_event_response_content_part_done::Part,
31736        }
31737        let RealtimeServerEventResponseContentPartDone {
31738            event_id,
31739            response_id,
31740            item_id,
31741            output_index,
31742            content_index,
31743            part,
31744            ..
31745        } = RealtimeServerEventResponseContentPartDone::deserialize(deserializer)?;
31746        Ok(Self {
31747            event_id,
31748            response_id,
31749            item_id,
31750            output_index,
31751            content_index,
31752            part,
31753        })
31754    }
31755}
31756impl serde::Serialize for RealtimeServerEventResponseContentPartDone {
31757    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
31758    where
31759        S: serde::Serializer,
31760    {
31761        #[serde_with::serde_as]
31762        #[derive(serde :: Serialize)]
31763        struct RealtimeServerEventResponseContentPartDone<'a> {
31764            #[serde(rename = "event_id")]
31765            event_id: &'a String,
31766            #[serde(rename = "type")]
31767            r#type: &'a crate::__types::realtime_server_event_response_content_part_done::Type,
31768            #[serde(rename = "response_id")]
31769            response_id: &'a String,
31770            #[serde(rename = "item_id")]
31771            item_id: &'a String,
31772            #[serde(rename = "output_index")]
31773            output_index: &'a i64,
31774            #[serde(rename = "content_index")]
31775            content_index: &'a i64,
31776            #[serde(rename = "part")]
31777            part: &'a crate::__types::realtime_server_event_response_content_part_done::Part,
31778        }
31779        let Self {
31780            event_id,
31781            response_id,
31782            item_id,
31783            output_index,
31784            content_index,
31785            part,
31786        } = self;
31787        RealtimeServerEventResponseContentPartDone {
31788            event_id,
31789            r#type: &Default::default(),
31790            response_id,
31791            item_id,
31792            output_index,
31793            content_index,
31794            part,
31795        }
31796        .serialize(serializer)
31797    }
31798}
31799#[allow(clippy::module_inception)]
31800pub(crate) mod realtime_server_event_response_created {
31801    #[doc = "The event type, must be `response.created`."]
31802    #[derive(Clone, Copy, Debug, Default, PartialEq)]
31803    pub(crate) struct Type;
31804    impl_serde!(Type, "response.created");
31805}
31806#[doc = "Returned when a new Response is created. The first event of response creation,\nwhere the response is in an initial state of `in_progress`.\n"]
31807#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
31808pub struct RealtimeServerEventResponseCreated {
31809    #[doc = "The unique ID of the server event."]
31810    pub event_id: String,
31811    #[builder(default)]
31812    pub response: crate::__types::RealtimeResponse,
31813}
31814impl<'de> serde::Deserialize<'de> for RealtimeServerEventResponseCreated {
31815    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
31816    where
31817        D: serde::Deserializer<'de>,
31818    {
31819        #[serde_with::serde_as]
31820        #[derive(serde :: Deserialize)]
31821        struct RealtimeServerEventResponseCreated {
31822            #[serde(rename = "event_id")]
31823            event_id: String,
31824            #[serde(rename = "type")]
31825            #[allow(dead_code)]
31826            r#type: crate::__types::realtime_server_event_response_created::Type,
31827            #[serde(rename = "response")]
31828            response: crate::__types::RealtimeResponse,
31829        }
31830        let RealtimeServerEventResponseCreated {
31831            event_id, response, ..
31832        } = RealtimeServerEventResponseCreated::deserialize(deserializer)?;
31833        Ok(Self { event_id, response })
31834    }
31835}
31836impl serde::Serialize for RealtimeServerEventResponseCreated {
31837    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
31838    where
31839        S: serde::Serializer,
31840    {
31841        #[serde_with::serde_as]
31842        #[derive(serde :: Serialize)]
31843        struct RealtimeServerEventResponseCreated<'a> {
31844            #[serde(rename = "event_id")]
31845            event_id: &'a String,
31846            #[serde(rename = "type")]
31847            r#type: &'a crate::__types::realtime_server_event_response_created::Type,
31848            #[serde(rename = "response")]
31849            response: &'a crate::__types::RealtimeResponse,
31850        }
31851        let Self { event_id, response } = self;
31852        RealtimeServerEventResponseCreated {
31853            event_id,
31854            r#type: &Default::default(),
31855            response,
31856        }
31857        .serialize(serializer)
31858    }
31859}
31860#[allow(clippy::module_inception)]
31861pub(crate) mod realtime_server_event_response_done {
31862    #[doc = "The event type, must be `response.done`."]
31863    #[derive(Clone, Copy, Debug, Default, PartialEq)]
31864    pub(crate) struct Type;
31865    impl_serde!(Type, "response.done");
31866}
31867#[doc = "Returned when a Response is done streaming. Always emitted, no matter the \nfinal state. The Response object included in the `response.done` event will \ninclude all output Items in the Response but will omit the raw audio data.\n"]
31868#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
31869pub struct RealtimeServerEventResponseDone {
31870    #[doc = "The unique ID of the server event."]
31871    pub event_id: String,
31872    #[builder(default)]
31873    pub response: crate::__types::RealtimeResponse,
31874}
31875impl<'de> serde::Deserialize<'de> for RealtimeServerEventResponseDone {
31876    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
31877    where
31878        D: serde::Deserializer<'de>,
31879    {
31880        #[serde_with::serde_as]
31881        #[derive(serde :: Deserialize)]
31882        struct RealtimeServerEventResponseDone {
31883            #[serde(rename = "event_id")]
31884            event_id: String,
31885            #[serde(rename = "type")]
31886            #[allow(dead_code)]
31887            r#type: crate::__types::realtime_server_event_response_done::Type,
31888            #[serde(rename = "response")]
31889            response: crate::__types::RealtimeResponse,
31890        }
31891        let RealtimeServerEventResponseDone {
31892            event_id, response, ..
31893        } = RealtimeServerEventResponseDone::deserialize(deserializer)?;
31894        Ok(Self { event_id, response })
31895    }
31896}
31897impl serde::Serialize for RealtimeServerEventResponseDone {
31898    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
31899    where
31900        S: serde::Serializer,
31901    {
31902        #[serde_with::serde_as]
31903        #[derive(serde :: Serialize)]
31904        struct RealtimeServerEventResponseDone<'a> {
31905            #[serde(rename = "event_id")]
31906            event_id: &'a String,
31907            #[serde(rename = "type")]
31908            r#type: &'a crate::__types::realtime_server_event_response_done::Type,
31909            #[serde(rename = "response")]
31910            response: &'a crate::__types::RealtimeResponse,
31911        }
31912        let Self { event_id, response } = self;
31913        RealtimeServerEventResponseDone {
31914            event_id,
31915            r#type: &Default::default(),
31916            response,
31917        }
31918        .serialize(serializer)
31919    }
31920}
31921#[allow(clippy::module_inception)]
31922pub(crate) mod realtime_server_event_response_function_call_arguments_delta {
31923    #[doc = "The event type, must be `response.function_call_arguments.delta`.\n"]
31924    #[derive(Clone, Copy, Debug, Default, PartialEq)]
31925    pub(crate) struct Type;
31926    impl_serde!(Type, "response.function_call_arguments.delta");
31927}
31928#[doc = "Returned when the model-generated function call arguments are updated.\n"]
31929#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
31930pub struct RealtimeServerEventResponseFunctionCallArgumentsDelta {
31931    #[doc = "The unique ID of the server event."]
31932    pub event_id: String,
31933    #[doc = "The ID of the response."]
31934    pub response_id: String,
31935    #[doc = "The ID of the function call item."]
31936    pub item_id: String,
31937    #[doc = "The index of the output item in the response."]
31938    pub output_index: i64,
31939    #[doc = "The ID of the function call."]
31940    pub call_id: String,
31941    #[doc = "The arguments delta as a JSON string."]
31942    pub delta: String,
31943}
31944impl<'de> serde::Deserialize<'de> for RealtimeServerEventResponseFunctionCallArgumentsDelta {
31945    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
31946    where
31947        D: serde::Deserializer<'de>,
31948    {
31949        #[serde_with::serde_as]
31950        #[derive(serde :: Deserialize)]
31951        struct RealtimeServerEventResponseFunctionCallArgumentsDelta {
31952            #[serde(rename = "event_id")]
31953            event_id: String,
31954            #[serde(rename = "type")]
31955            #[allow(dead_code)]
31956            r#type:
31957                crate::__types::realtime_server_event_response_function_call_arguments_delta::Type,
31958            #[serde(rename = "response_id")]
31959            response_id: String,
31960            #[serde(rename = "item_id")]
31961            item_id: String,
31962            #[serde(rename = "output_index")]
31963            output_index: i64,
31964            #[serde(rename = "call_id")]
31965            call_id: String,
31966            #[serde(rename = "delta")]
31967            delta: String,
31968        }
31969        let RealtimeServerEventResponseFunctionCallArgumentsDelta {
31970            event_id,
31971            response_id,
31972            item_id,
31973            output_index,
31974            call_id,
31975            delta,
31976            ..
31977        } = RealtimeServerEventResponseFunctionCallArgumentsDelta::deserialize(deserializer)?;
31978        Ok(Self {
31979            event_id,
31980            response_id,
31981            item_id,
31982            output_index,
31983            call_id,
31984            delta,
31985        })
31986    }
31987}
31988impl serde::Serialize for RealtimeServerEventResponseFunctionCallArgumentsDelta {
31989    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
31990    where
31991        S: serde::Serializer,
31992    {
31993        #[serde_with::serde_as]
31994        #[derive(serde :: Serialize)]
31995        struct RealtimeServerEventResponseFunctionCallArgumentsDelta < 'a > { # [serde (rename = "event_id")] event_id : & 'a String , # [serde (rename = "type")] r#type : & 'a crate :: __types :: realtime_server_event_response_function_call_arguments_delta :: Type , # [serde (rename = "response_id")] response_id : & 'a String , # [serde (rename = "item_id")] item_id : & 'a String , # [serde (rename = "output_index")] output_index : & 'a i64 , # [serde (rename = "call_id")] call_id : & 'a String , # [serde (rename = "delta")] delta : & 'a String }
31996        let Self {
31997            event_id,
31998            response_id,
31999            item_id,
32000            output_index,
32001            call_id,
32002            delta,
32003        } = self;
32004        RealtimeServerEventResponseFunctionCallArgumentsDelta {
32005            event_id,
32006            r#type: &Default::default(),
32007            response_id,
32008            item_id,
32009            output_index,
32010            call_id,
32011            delta,
32012        }
32013        .serialize(serializer)
32014    }
32015}
32016#[allow(clippy::module_inception)]
32017pub(crate) mod realtime_server_event_response_function_call_arguments_done {
32018    #[doc = "The event type, must be `response.function_call_arguments.done`.\n"]
32019    #[derive(Clone, Copy, Debug, Default, PartialEq)]
32020    pub(crate) struct Type;
32021    impl_serde!(Type, "response.function_call_arguments.done");
32022}
32023#[doc = "Returned when the model-generated function call arguments are done streaming.\nAlso emitted when a Response is interrupted, incomplete, or cancelled.\n"]
32024#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
32025pub struct RealtimeServerEventResponseFunctionCallArgumentsDone {
32026    #[doc = "The unique ID of the server event."]
32027    pub event_id: String,
32028    #[doc = "The ID of the response."]
32029    pub response_id: String,
32030    #[doc = "The ID of the function call item."]
32031    pub item_id: String,
32032    #[doc = "The index of the output item in the response."]
32033    pub output_index: i64,
32034    #[doc = "The ID of the function call."]
32035    pub call_id: String,
32036    #[doc = "The final arguments as a JSON string."]
32037    pub arguments: String,
32038}
32039impl<'de> serde::Deserialize<'de> for RealtimeServerEventResponseFunctionCallArgumentsDone {
32040    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
32041    where
32042        D: serde::Deserializer<'de>,
32043    {
32044        #[serde_with::serde_as]
32045        #[derive(serde :: Deserialize)]
32046        struct RealtimeServerEventResponseFunctionCallArgumentsDone {
32047            #[serde(rename = "event_id")]
32048            event_id: String,
32049            #[serde(rename = "type")]
32050            #[allow(dead_code)]
32051            r#type:
32052                crate::__types::realtime_server_event_response_function_call_arguments_done::Type,
32053            #[serde(rename = "response_id")]
32054            response_id: String,
32055            #[serde(rename = "item_id")]
32056            item_id: String,
32057            #[serde(rename = "output_index")]
32058            output_index: i64,
32059            #[serde(rename = "call_id")]
32060            call_id: String,
32061            #[serde(rename = "arguments")]
32062            arguments: String,
32063        }
32064        let RealtimeServerEventResponseFunctionCallArgumentsDone {
32065            event_id,
32066            response_id,
32067            item_id,
32068            output_index,
32069            call_id,
32070            arguments,
32071            ..
32072        } = RealtimeServerEventResponseFunctionCallArgumentsDone::deserialize(deserializer)?;
32073        Ok(Self {
32074            event_id,
32075            response_id,
32076            item_id,
32077            output_index,
32078            call_id,
32079            arguments,
32080        })
32081    }
32082}
32083impl serde::Serialize for RealtimeServerEventResponseFunctionCallArgumentsDone {
32084    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
32085    where
32086        S: serde::Serializer,
32087    {
32088        #[serde_with::serde_as]
32089        #[derive(serde :: Serialize)]
32090        struct RealtimeServerEventResponseFunctionCallArgumentsDone < 'a > { # [serde (rename = "event_id")] event_id : & 'a String , # [serde (rename = "type")] r#type : & 'a crate :: __types :: realtime_server_event_response_function_call_arguments_done :: Type , # [serde (rename = "response_id")] response_id : & 'a String , # [serde (rename = "item_id")] item_id : & 'a String , # [serde (rename = "output_index")] output_index : & 'a i64 , # [serde (rename = "call_id")] call_id : & 'a String , # [serde (rename = "arguments")] arguments : & 'a String }
32091        let Self {
32092            event_id,
32093            response_id,
32094            item_id,
32095            output_index,
32096            call_id,
32097            arguments,
32098        } = self;
32099        RealtimeServerEventResponseFunctionCallArgumentsDone {
32100            event_id,
32101            r#type: &Default::default(),
32102            response_id,
32103            item_id,
32104            output_index,
32105            call_id,
32106            arguments,
32107        }
32108        .serialize(serializer)
32109    }
32110}
32111#[allow(clippy::module_inception)]
32112pub(crate) mod realtime_server_event_response_output_item_added {
32113    #[doc = "The event type, must be `response.output_item.added`."]
32114    #[derive(Clone, Copy, Debug, Default, PartialEq)]
32115    pub(crate) struct Type;
32116    impl_serde!(Type, "response.output_item.added");
32117}
32118#[doc = "Returned when a new Item is created during Response generation."]
32119#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
32120pub struct RealtimeServerEventResponseOutputItemAdded {
32121    #[doc = "The unique ID of the server event."]
32122    pub event_id: String,
32123    #[doc = "The ID of the Response to which the item belongs."]
32124    pub response_id: String,
32125    #[doc = "The index of the output item in the Response."]
32126    pub output_index: i64,
32127    #[builder(default)]
32128    pub item: crate::__types::RealtimeConversationItem,
32129}
32130impl<'de> serde::Deserialize<'de> for RealtimeServerEventResponseOutputItemAdded {
32131    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
32132    where
32133        D: serde::Deserializer<'de>,
32134    {
32135        #[serde_with::serde_as]
32136        #[derive(serde :: Deserialize)]
32137        struct RealtimeServerEventResponseOutputItemAdded {
32138            #[serde(rename = "event_id")]
32139            event_id: String,
32140            #[serde(rename = "type")]
32141            #[allow(dead_code)]
32142            r#type: crate::__types::realtime_server_event_response_output_item_added::Type,
32143            #[serde(rename = "response_id")]
32144            response_id: String,
32145            #[serde(rename = "output_index")]
32146            output_index: i64,
32147            #[serde(rename = "item")]
32148            item: crate::__types::RealtimeConversationItem,
32149        }
32150        let RealtimeServerEventResponseOutputItemAdded {
32151            event_id,
32152            response_id,
32153            output_index,
32154            item,
32155            ..
32156        } = RealtimeServerEventResponseOutputItemAdded::deserialize(deserializer)?;
32157        Ok(Self {
32158            event_id,
32159            response_id,
32160            output_index,
32161            item,
32162        })
32163    }
32164}
32165impl serde::Serialize for RealtimeServerEventResponseOutputItemAdded {
32166    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
32167    where
32168        S: serde::Serializer,
32169    {
32170        #[serde_with::serde_as]
32171        #[derive(serde :: Serialize)]
32172        struct RealtimeServerEventResponseOutputItemAdded<'a> {
32173            #[serde(rename = "event_id")]
32174            event_id: &'a String,
32175            #[serde(rename = "type")]
32176            r#type: &'a crate::__types::realtime_server_event_response_output_item_added::Type,
32177            #[serde(rename = "response_id")]
32178            response_id: &'a String,
32179            #[serde(rename = "output_index")]
32180            output_index: &'a i64,
32181            #[serde(rename = "item")]
32182            item: &'a crate::__types::RealtimeConversationItem,
32183        }
32184        let Self {
32185            event_id,
32186            response_id,
32187            output_index,
32188            item,
32189        } = self;
32190        RealtimeServerEventResponseOutputItemAdded {
32191            event_id,
32192            r#type: &Default::default(),
32193            response_id,
32194            output_index,
32195            item,
32196        }
32197        .serialize(serializer)
32198    }
32199}
32200#[allow(clippy::module_inception)]
32201pub(crate) mod realtime_server_event_response_output_item_done {
32202    #[doc = "The event type, must be `response.output_item.done`."]
32203    #[derive(Clone, Copy, Debug, Default, PartialEq)]
32204    pub(crate) struct Type;
32205    impl_serde!(Type, "response.output_item.done");
32206}
32207#[doc = "Returned when an Item is done streaming. Also emitted when a Response is \ninterrupted, incomplete, or cancelled.\n"]
32208#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
32209pub struct RealtimeServerEventResponseOutputItemDone {
32210    #[doc = "The unique ID of the server event."]
32211    pub event_id: String,
32212    #[doc = "The ID of the Response to which the item belongs."]
32213    pub response_id: String,
32214    #[doc = "The index of the output item in the Response."]
32215    pub output_index: i64,
32216    #[builder(default)]
32217    pub item: crate::__types::RealtimeConversationItem,
32218}
32219impl<'de> serde::Deserialize<'de> for RealtimeServerEventResponseOutputItemDone {
32220    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
32221    where
32222        D: serde::Deserializer<'de>,
32223    {
32224        #[serde_with::serde_as]
32225        #[derive(serde :: Deserialize)]
32226        struct RealtimeServerEventResponseOutputItemDone {
32227            #[serde(rename = "event_id")]
32228            event_id: String,
32229            #[serde(rename = "type")]
32230            #[allow(dead_code)]
32231            r#type: crate::__types::realtime_server_event_response_output_item_done::Type,
32232            #[serde(rename = "response_id")]
32233            response_id: String,
32234            #[serde(rename = "output_index")]
32235            output_index: i64,
32236            #[serde(rename = "item")]
32237            item: crate::__types::RealtimeConversationItem,
32238        }
32239        let RealtimeServerEventResponseOutputItemDone {
32240            event_id,
32241            response_id,
32242            output_index,
32243            item,
32244            ..
32245        } = RealtimeServerEventResponseOutputItemDone::deserialize(deserializer)?;
32246        Ok(Self {
32247            event_id,
32248            response_id,
32249            output_index,
32250            item,
32251        })
32252    }
32253}
32254impl serde::Serialize for RealtimeServerEventResponseOutputItemDone {
32255    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
32256    where
32257        S: serde::Serializer,
32258    {
32259        #[serde_with::serde_as]
32260        #[derive(serde :: Serialize)]
32261        struct RealtimeServerEventResponseOutputItemDone<'a> {
32262            #[serde(rename = "event_id")]
32263            event_id: &'a String,
32264            #[serde(rename = "type")]
32265            r#type: &'a crate::__types::realtime_server_event_response_output_item_done::Type,
32266            #[serde(rename = "response_id")]
32267            response_id: &'a String,
32268            #[serde(rename = "output_index")]
32269            output_index: &'a i64,
32270            #[serde(rename = "item")]
32271            item: &'a crate::__types::RealtimeConversationItem,
32272        }
32273        let Self {
32274            event_id,
32275            response_id,
32276            output_index,
32277            item,
32278        } = self;
32279        RealtimeServerEventResponseOutputItemDone {
32280            event_id,
32281            r#type: &Default::default(),
32282            response_id,
32283            output_index,
32284            item,
32285        }
32286        .serialize(serializer)
32287    }
32288}
32289#[allow(clippy::module_inception)]
32290pub(crate) mod realtime_server_event_response_text_delta {
32291    #[doc = "The event type, must be `response.text.delta`."]
32292    #[derive(Clone, Copy, Debug, Default, PartialEq)]
32293    pub(crate) struct Type;
32294    impl_serde!(Type, "response.text.delta");
32295}
32296#[doc = "Returned when the text value of a \"text\" content part is updated."]
32297#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
32298pub struct RealtimeServerEventResponseTextDelta {
32299    #[doc = "The unique ID of the server event."]
32300    pub event_id: String,
32301    #[doc = "The ID of the response."]
32302    pub response_id: String,
32303    #[doc = "The ID of the item."]
32304    pub item_id: String,
32305    #[doc = "The index of the output item in the response."]
32306    pub output_index: i64,
32307    #[doc = "The index of the content part in the item's content array."]
32308    pub content_index: i64,
32309    #[doc = "The text delta."]
32310    pub delta: String,
32311}
32312impl<'de> serde::Deserialize<'de> for RealtimeServerEventResponseTextDelta {
32313    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
32314    where
32315        D: serde::Deserializer<'de>,
32316    {
32317        #[serde_with::serde_as]
32318        #[derive(serde :: Deserialize)]
32319        struct RealtimeServerEventResponseTextDelta {
32320            #[serde(rename = "event_id")]
32321            event_id: String,
32322            #[serde(rename = "type")]
32323            #[allow(dead_code)]
32324            r#type: crate::__types::realtime_server_event_response_text_delta::Type,
32325            #[serde(rename = "response_id")]
32326            response_id: String,
32327            #[serde(rename = "item_id")]
32328            item_id: String,
32329            #[serde(rename = "output_index")]
32330            output_index: i64,
32331            #[serde(rename = "content_index")]
32332            content_index: i64,
32333            #[serde(rename = "delta")]
32334            delta: String,
32335        }
32336        let RealtimeServerEventResponseTextDelta {
32337            event_id,
32338            response_id,
32339            item_id,
32340            output_index,
32341            content_index,
32342            delta,
32343            ..
32344        } = RealtimeServerEventResponseTextDelta::deserialize(deserializer)?;
32345        Ok(Self {
32346            event_id,
32347            response_id,
32348            item_id,
32349            output_index,
32350            content_index,
32351            delta,
32352        })
32353    }
32354}
32355impl serde::Serialize for RealtimeServerEventResponseTextDelta {
32356    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
32357    where
32358        S: serde::Serializer,
32359    {
32360        #[serde_with::serde_as]
32361        #[derive(serde :: Serialize)]
32362        struct RealtimeServerEventResponseTextDelta<'a> {
32363            #[serde(rename = "event_id")]
32364            event_id: &'a String,
32365            #[serde(rename = "type")]
32366            r#type: &'a crate::__types::realtime_server_event_response_text_delta::Type,
32367            #[serde(rename = "response_id")]
32368            response_id: &'a String,
32369            #[serde(rename = "item_id")]
32370            item_id: &'a String,
32371            #[serde(rename = "output_index")]
32372            output_index: &'a i64,
32373            #[serde(rename = "content_index")]
32374            content_index: &'a i64,
32375            #[serde(rename = "delta")]
32376            delta: &'a String,
32377        }
32378        let Self {
32379            event_id,
32380            response_id,
32381            item_id,
32382            output_index,
32383            content_index,
32384            delta,
32385        } = self;
32386        RealtimeServerEventResponseTextDelta {
32387            event_id,
32388            r#type: &Default::default(),
32389            response_id,
32390            item_id,
32391            output_index,
32392            content_index,
32393            delta,
32394        }
32395        .serialize(serializer)
32396    }
32397}
32398#[allow(clippy::module_inception)]
32399pub(crate) mod realtime_server_event_response_text_done {
32400    #[doc = "The event type, must be `response.text.done`."]
32401    #[derive(Clone, Copy, Debug, Default, PartialEq)]
32402    pub(crate) struct Type;
32403    impl_serde!(Type, "response.text.done");
32404}
32405#[doc = "Returned when the text value of a \"text\" content part is done streaming. Also\nemitted when a Response is interrupted, incomplete, or cancelled.\n"]
32406#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
32407pub struct RealtimeServerEventResponseTextDone {
32408    #[doc = "The unique ID of the server event."]
32409    pub event_id: String,
32410    #[doc = "The ID of the response."]
32411    pub response_id: String,
32412    #[doc = "The ID of the item."]
32413    pub item_id: String,
32414    #[doc = "The index of the output item in the response."]
32415    pub output_index: i64,
32416    #[doc = "The index of the content part in the item's content array."]
32417    pub content_index: i64,
32418    #[doc = "The final text content."]
32419    pub text: String,
32420}
32421impl<'de> serde::Deserialize<'de> for RealtimeServerEventResponseTextDone {
32422    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
32423    where
32424        D: serde::Deserializer<'de>,
32425    {
32426        #[serde_with::serde_as]
32427        #[derive(serde :: Deserialize)]
32428        struct RealtimeServerEventResponseTextDone {
32429            #[serde(rename = "event_id")]
32430            event_id: String,
32431            #[serde(rename = "type")]
32432            #[allow(dead_code)]
32433            r#type: crate::__types::realtime_server_event_response_text_done::Type,
32434            #[serde(rename = "response_id")]
32435            response_id: String,
32436            #[serde(rename = "item_id")]
32437            item_id: String,
32438            #[serde(rename = "output_index")]
32439            output_index: i64,
32440            #[serde(rename = "content_index")]
32441            content_index: i64,
32442            #[serde(rename = "text")]
32443            text: String,
32444        }
32445        let RealtimeServerEventResponseTextDone {
32446            event_id,
32447            response_id,
32448            item_id,
32449            output_index,
32450            content_index,
32451            text,
32452            ..
32453        } = RealtimeServerEventResponseTextDone::deserialize(deserializer)?;
32454        Ok(Self {
32455            event_id,
32456            response_id,
32457            item_id,
32458            output_index,
32459            content_index,
32460            text,
32461        })
32462    }
32463}
32464impl serde::Serialize for RealtimeServerEventResponseTextDone {
32465    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
32466    where
32467        S: serde::Serializer,
32468    {
32469        #[serde_with::serde_as]
32470        #[derive(serde :: Serialize)]
32471        struct RealtimeServerEventResponseTextDone<'a> {
32472            #[serde(rename = "event_id")]
32473            event_id: &'a String,
32474            #[serde(rename = "type")]
32475            r#type: &'a crate::__types::realtime_server_event_response_text_done::Type,
32476            #[serde(rename = "response_id")]
32477            response_id: &'a String,
32478            #[serde(rename = "item_id")]
32479            item_id: &'a String,
32480            #[serde(rename = "output_index")]
32481            output_index: &'a i64,
32482            #[serde(rename = "content_index")]
32483            content_index: &'a i64,
32484            #[serde(rename = "text")]
32485            text: &'a String,
32486        }
32487        let Self {
32488            event_id,
32489            response_id,
32490            item_id,
32491            output_index,
32492            content_index,
32493            text,
32494        } = self;
32495        RealtimeServerEventResponseTextDone {
32496            event_id,
32497            r#type: &Default::default(),
32498            response_id,
32499            item_id,
32500            output_index,
32501            content_index,
32502            text,
32503        }
32504        .serialize(serializer)
32505    }
32506}
32507#[allow(clippy::module_inception)]
32508pub(crate) mod realtime_server_event_session_created {
32509    #[doc = "The event type, must be `session.created`."]
32510    #[derive(Clone, Copy, Debug, Default, PartialEq)]
32511    pub(crate) struct Type;
32512    impl_serde!(Type, "session.created");
32513}
32514#[doc = "Returned when a Session is created. Emitted automatically when a new \nconnection is established as the first server event. This event will contain \nthe default Session configuration.\n"]
32515#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
32516pub struct RealtimeServerEventSessionCreated {
32517    #[doc = "The unique ID of the server event."]
32518    pub event_id: String,
32519    #[builder(default)]
32520    pub session: crate::__types::RealtimeSession,
32521}
32522impl<'de> serde::Deserialize<'de> for RealtimeServerEventSessionCreated {
32523    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
32524    where
32525        D: serde::Deserializer<'de>,
32526    {
32527        #[serde_with::serde_as]
32528        #[derive(serde :: Deserialize)]
32529        struct RealtimeServerEventSessionCreated {
32530            #[serde(rename = "event_id")]
32531            event_id: String,
32532            #[serde(rename = "type")]
32533            #[allow(dead_code)]
32534            r#type: crate::__types::realtime_server_event_session_created::Type,
32535            #[serde(rename = "session")]
32536            session: crate::__types::RealtimeSession,
32537        }
32538        let RealtimeServerEventSessionCreated {
32539            event_id, session, ..
32540        } = RealtimeServerEventSessionCreated::deserialize(deserializer)?;
32541        Ok(Self { event_id, session })
32542    }
32543}
32544impl serde::Serialize for RealtimeServerEventSessionCreated {
32545    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
32546    where
32547        S: serde::Serializer,
32548    {
32549        #[serde_with::serde_as]
32550        #[derive(serde :: Serialize)]
32551        struct RealtimeServerEventSessionCreated<'a> {
32552            #[serde(rename = "event_id")]
32553            event_id: &'a String,
32554            #[serde(rename = "type")]
32555            r#type: &'a crate::__types::realtime_server_event_session_created::Type,
32556            #[serde(rename = "session")]
32557            session: &'a crate::__types::RealtimeSession,
32558        }
32559        let Self { event_id, session } = self;
32560        RealtimeServerEventSessionCreated {
32561            event_id,
32562            r#type: &Default::default(),
32563            session,
32564        }
32565        .serialize(serializer)
32566    }
32567}
32568#[allow(clippy::module_inception)]
32569pub(crate) mod realtime_server_event_session_updated {
32570    #[doc = "The event type, must be `session.updated`."]
32571    #[derive(Clone, Copy, Debug, Default, PartialEq)]
32572    pub(crate) struct Type;
32573    impl_serde!(Type, "session.updated");
32574}
32575#[doc = "Returned when a session is updated with a `session.update` event, unless \nthere is an error.\n"]
32576#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
32577pub struct RealtimeServerEventSessionUpdated {
32578    #[doc = "The unique ID of the server event."]
32579    pub event_id: String,
32580    #[builder(default)]
32581    pub session: crate::__types::RealtimeSession,
32582}
32583impl<'de> serde::Deserialize<'de> for RealtimeServerEventSessionUpdated {
32584    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
32585    where
32586        D: serde::Deserializer<'de>,
32587    {
32588        #[serde_with::serde_as]
32589        #[derive(serde :: Deserialize)]
32590        struct RealtimeServerEventSessionUpdated {
32591            #[serde(rename = "event_id")]
32592            event_id: String,
32593            #[serde(rename = "type")]
32594            #[allow(dead_code)]
32595            r#type: crate::__types::realtime_server_event_session_updated::Type,
32596            #[serde(rename = "session")]
32597            session: crate::__types::RealtimeSession,
32598        }
32599        let RealtimeServerEventSessionUpdated {
32600            event_id, session, ..
32601        } = RealtimeServerEventSessionUpdated::deserialize(deserializer)?;
32602        Ok(Self { event_id, session })
32603    }
32604}
32605impl serde::Serialize for RealtimeServerEventSessionUpdated {
32606    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
32607    where
32608        S: serde::Serializer,
32609    {
32610        #[serde_with::serde_as]
32611        #[derive(serde :: Serialize)]
32612        struct RealtimeServerEventSessionUpdated<'a> {
32613            #[serde(rename = "event_id")]
32614            event_id: &'a String,
32615            #[serde(rename = "type")]
32616            r#type: &'a crate::__types::realtime_server_event_session_updated::Type,
32617            #[serde(rename = "session")]
32618            session: &'a crate::__types::RealtimeSession,
32619        }
32620        let Self { event_id, session } = self;
32621        RealtimeServerEventSessionUpdated {
32622            event_id,
32623            r#type: &Default::default(),
32624            session,
32625        }
32626        .serialize(serializer)
32627    }
32628}
32629#[allow(clippy::module_inception)]
32630pub(crate) mod realtime_server_event_transcription_session_updated {
32631    #[doc = "The event type, must be `transcription_session.updated`."]
32632    #[derive(Clone, Copy, Debug, Default, PartialEq)]
32633    pub(crate) struct Type;
32634    impl_serde!(Type, "transcription_session.updated");
32635}
32636#[doc = "Returned when a transcription session is updated with a `transcription_session.update` event, unless \nthere is an error.\n"]
32637#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
32638pub struct RealtimeServerEventTranscriptionSessionUpdated {
32639    #[doc = "The unique ID of the server event."]
32640    pub event_id: String,
32641    pub session: crate::__types::RealtimeTranscriptionSessionCreateResponse,
32642}
32643impl<'de> serde::Deserialize<'de> for RealtimeServerEventTranscriptionSessionUpdated {
32644    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
32645    where
32646        D: serde::Deserializer<'de>,
32647    {
32648        #[serde_with::serde_as]
32649        #[derive(serde :: Deserialize)]
32650        struct RealtimeServerEventTranscriptionSessionUpdated {
32651            #[serde(rename = "event_id")]
32652            event_id: String,
32653            #[serde(rename = "type")]
32654            #[allow(dead_code)]
32655            r#type: crate::__types::realtime_server_event_transcription_session_updated::Type,
32656            #[serde(rename = "session")]
32657            session: crate::__types::RealtimeTranscriptionSessionCreateResponse,
32658        }
32659        let RealtimeServerEventTranscriptionSessionUpdated {
32660            event_id, session, ..
32661        } = RealtimeServerEventTranscriptionSessionUpdated::deserialize(deserializer)?;
32662        Ok(Self { event_id, session })
32663    }
32664}
32665impl serde::Serialize for RealtimeServerEventTranscriptionSessionUpdated {
32666    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
32667    where
32668        S: serde::Serializer,
32669    {
32670        #[serde_with::serde_as]
32671        #[derive(serde :: Serialize)]
32672        struct RealtimeServerEventTranscriptionSessionUpdated<'a> {
32673            #[serde(rename = "event_id")]
32674            event_id: &'a String,
32675            #[serde(rename = "type")]
32676            r#type: &'a crate::__types::realtime_server_event_transcription_session_updated::Type,
32677            #[serde(rename = "session")]
32678            session: &'a crate::__types::RealtimeTranscriptionSessionCreateResponse,
32679        }
32680        let Self { event_id, session } = self;
32681        RealtimeServerEventTranscriptionSessionUpdated {
32682            event_id,
32683            r#type: &Default::default(),
32684            session,
32685        }
32686        .serialize(serializer)
32687    }
32688}
32689#[allow(clippy::module_inception)]
32690pub mod realtime_session {
32691    #[allow(clippy::module_inception)]
32692    pub mod modalities {
32693        #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
32694        pub enum Item {
32695            #[doc = "`text`"]
32696            #[serde(rename = "text")]
32697            Text,
32698            #[doc = "`audio`"]
32699            #[serde(rename = "audio")]
32700            Audio,
32701        }
32702    }
32703    #[doc = "The Realtime model used for this session.\n"]
32704    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
32705    pub enum Model {
32706        #[doc = "`gpt-4o-realtime-preview`"]
32707        #[serde(rename = "gpt-4o-realtime-preview")]
32708        Gpt4oRealtimePreview,
32709        #[doc = "`gpt-4o-realtime-preview-2024-10-01`"]
32710        #[serde(rename = "gpt-4o-realtime-preview-2024-10-01")]
32711        Gpt4oRealtimePreview2024_10_01,
32712        #[doc = "`gpt-4o-realtime-preview-2024-12-17`"]
32713        #[serde(rename = "gpt-4o-realtime-preview-2024-12-17")]
32714        Gpt4oRealtimePreview2024_12_17,
32715        #[doc = "`gpt-4o-realtime-preview-2025-06-03`"]
32716        #[serde(rename = "gpt-4o-realtime-preview-2025-06-03")]
32717        Gpt4oRealtimePreview2025_06_03,
32718        #[doc = "`gpt-4o-mini-realtime-preview`"]
32719        #[serde(rename = "gpt-4o-mini-realtime-preview")]
32720        Gpt4oMiniRealtimePreview,
32721        #[doc = "`gpt-4o-mini-realtime-preview-2024-12-17`"]
32722        #[serde(rename = "gpt-4o-mini-realtime-preview-2024-12-17")]
32723        Gpt4oMiniRealtimePreview2024_12_17,
32724    }
32725    #[doc = "The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`.\nFor `pcm16`, input audio must be 16-bit PCM at a 24kHz sample rate,\nsingle channel (mono), and little-endian byte order.\n"]
32726    #[derive(Clone, Copy, Debug, Default, PartialEq, serde :: Deserialize, serde :: Serialize)]
32727    pub enum InputAudioFormat {
32728        #[doc = "`pcm16`"]
32729        #[default]
32730        #[serde(rename = "pcm16")]
32731        Pcm16,
32732        #[doc = "`g711_ulaw`"]
32733        #[serde(rename = "g711_ulaw")]
32734        G711Ulaw,
32735        #[doc = "`g711_alaw`"]
32736        #[serde(rename = "g711_alaw")]
32737        G711Alaw,
32738    }
32739    #[doc = "The format of output audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`.\nFor `pcm16`, output audio is sampled at a rate of 24kHz.\n"]
32740    #[derive(Clone, Copy, Debug, Default, PartialEq, serde :: Deserialize, serde :: Serialize)]
32741    pub enum OutputAudioFormat {
32742        #[doc = "`pcm16`"]
32743        #[default]
32744        #[serde(rename = "pcm16")]
32745        Pcm16,
32746        #[doc = "`g711_ulaw`"]
32747        #[serde(rename = "g711_ulaw")]
32748        G711Ulaw,
32749        #[doc = "`g711_alaw`"]
32750        #[serde(rename = "g711_alaw")]
32751        G711Alaw,
32752    }
32753    #[doc = "Configuration for input audio transcription, defaults to off and can be set to `null` to turn off once on. Input audio transcription is not native to the model, since the model consumes audio directly. Transcription runs asynchronously through [the /audio/transcriptions endpoint](https://platform.openai.com/docs/api-reference/audio/createTranscription) and should be treated as guidance of input audio content rather than precisely what the model heard. The client can optionally set the language and prompt for transcription, these offer additional guidance to the transcription service.\n"]
32754    #[derive(Clone, Debug, Default, PartialEq)]
32755    #[serde_with::serde_as]
32756    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
32757    pub struct InputAudioTranscription {
32758        #[doc = "The model to use for transcription, current options are `gpt-4o-transcribe`, `gpt-4o-mini-transcribe`, and `whisper-1`.\n"]
32759        #[serde(rename = "model")]
32760        #[serde(skip_serializing_if = "Option::is_none")]
32761        #[builder(default)]
32762        pub model: Option<String>,
32763        #[doc = "The language of the input audio. Supplying the input language in\n[ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) (e.g. `en`) format\nwill improve accuracy and latency.\n"]
32764        #[serde(rename = "language")]
32765        #[serde(skip_serializing_if = "Option::is_none")]
32766        #[builder(default)]
32767        pub language: Option<String>,
32768        #[doc = "An optional text to guide the model's style or continue a previous audio\nsegment.\nFor `whisper-1`, the [prompt is a list of keywords](https://platform.openai.com/docs/guides/speech-to-text#prompting).\nFor `gpt-4o-transcribe` models, the prompt is a free text string, for example \"expect words related to technology\".\n"]
32769        #[serde(rename = "prompt")]
32770        #[serde(skip_serializing_if = "Option::is_none")]
32771        #[builder(default)]
32772        pub prompt: Option<String>,
32773    }
32774    #[allow(clippy::module_inception)]
32775    pub mod turn_detection {
32776        #[doc = "Type of turn detection.\n"]
32777        #[derive(
32778            Clone, Copy, Debug, Default, PartialEq, serde :: Deserialize, serde :: Serialize,
32779        )]
32780        pub enum Type {
32781            #[doc = "`server_vad`"]
32782            #[default]
32783            #[serde(rename = "server_vad")]
32784            ServerVad,
32785            #[doc = "`semantic_vad`"]
32786            #[serde(rename = "semantic_vad")]
32787            SemanticVad,
32788        }
32789        #[doc = "Used only for `semantic_vad` mode. The eagerness of the model to respond. `low` will wait longer for the user to continue speaking, `high` will respond more quickly. `auto` is the default and is equivalent to `medium`.\n"]
32790        #[derive(
32791            Clone, Copy, Debug, Default, PartialEq, serde :: Deserialize, serde :: Serialize,
32792        )]
32793        pub enum Eagerness {
32794            #[doc = "`low`"]
32795            #[serde(rename = "low")]
32796            Low,
32797            #[doc = "`medium`"]
32798            #[serde(rename = "medium")]
32799            Medium,
32800            #[doc = "`high`"]
32801            #[serde(rename = "high")]
32802            High,
32803            #[doc = "`auto`"]
32804            #[default]
32805            #[serde(rename = "auto")]
32806            Auto,
32807        }
32808    }
32809    #[doc = "Configuration for turn detection, ether Server VAD or Semantic VAD. This can be set to `null` to turn off, in which case the client must manually trigger model response.\nServer VAD means that the model will detect the start and end of speech based on audio volume and respond at the end of user speech.\nSemantic VAD is more advanced and uses a turn detection model (in conjunction with VAD) to semantically estimate whether the user has finished speaking, then dynamically sets a timeout based on this probability. For example, if user audio trails off with \"uhhm\", the model will score a low probability of turn end and wait longer for the user to continue speaking. This can be useful for more natural conversations, but may have a higher latency.\n"]
32810    #[derive(Clone, Debug, Default, PartialEq)]
32811    #[serde_with::serde_as]
32812    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
32813    pub struct TurnDetection {
32814        #[doc = "Type of turn detection.\n"]
32815        #[serde(rename = "type")]
32816        #[serde(skip_serializing_if = "Option::is_none")]
32817        #[builder(default)]
32818        pub r#type: Option<crate::__types::realtime_session::turn_detection::Type>,
32819        #[doc = "Used only for `semantic_vad` mode. The eagerness of the model to respond. `low` will wait longer for the user to continue speaking, `high` will respond more quickly. `auto` is the default and is equivalent to `medium`.\n"]
32820        #[serde(rename = "eagerness")]
32821        #[serde(skip_serializing_if = "Option::is_none")]
32822        #[builder(default)]
32823        pub eagerness: Option<crate::__types::realtime_session::turn_detection::Eagerness>,
32824        #[doc = "Used only for `server_vad` mode. Activation threshold for VAD (0.0 to 1.0), this defaults to 0.5. A\nhigher threshold will require louder audio to activate the model, and\nthus might perform better in noisy environments.\n"]
32825        #[serde(rename = "threshold")]
32826        #[serde(skip_serializing_if = "Option::is_none")]
32827        #[builder(default)]
32828        pub threshold: Option<serde_json::Number>,
32829        #[doc = "Used only for `server_vad` mode. Amount of audio to include before the VAD detected speech (in\nmilliseconds). Defaults to 300ms.\n"]
32830        #[serde(rename = "prefix_padding_ms")]
32831        #[serde(skip_serializing_if = "Option::is_none")]
32832        #[builder(default)]
32833        pub prefix_padding_ms: Option<i64>,
32834        #[doc = "Used only for `server_vad` mode. Duration of silence to detect speech stop (in milliseconds). Defaults\nto 500ms. With shorter values the model will respond more quickly,\nbut may jump in on short pauses from the user.\n"]
32835        #[serde(rename = "silence_duration_ms")]
32836        #[serde(skip_serializing_if = "Option::is_none")]
32837        #[builder(default)]
32838        pub silence_duration_ms: Option<i64>,
32839        #[doc = "Whether or not to automatically generate a response when a VAD stop event occurs.\n"]
32840        #[serde(rename = "create_response")]
32841        #[serde(skip_serializing_if = "Option::is_none")]
32842        #[builder(default)]
32843        pub create_response: Option<bool>,
32844        #[doc = "Whether or not to automatically interrupt any ongoing response with output to the default\nconversation (i.e. `conversation` of `auto`) when a VAD start event occurs.\n"]
32845        #[serde(rename = "interrupt_response")]
32846        #[serde(skip_serializing_if = "Option::is_none")]
32847        #[builder(default)]
32848        pub interrupt_response: Option<bool>,
32849    }
32850    #[allow(clippy::module_inception)]
32851    pub mod input_audio_noise_reduction {
32852        #[doc = "Type of noise reduction. `near_field` is for close-talking microphones such as headphones, `far_field` is for far-field microphones such as laptop or conference room microphones.\n"]
32853        #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
32854        pub enum Type {
32855            #[doc = "`near_field`"]
32856            #[serde(rename = "near_field")]
32857            NearField,
32858            #[doc = "`far_field`"]
32859            #[serde(rename = "far_field")]
32860            FarField,
32861        }
32862    }
32863    #[doc = "Configuration for input audio noise reduction. This can be set to `null` to turn off.\nNoise reduction filters audio added to the input audio buffer before it is sent to VAD and the model.\nFiltering the audio can improve VAD and turn detection accuracy (reducing false positives) and model performance by improving perception of the input audio.\n"]
32864    #[derive(Clone, Copy, Debug, Default, PartialEq)]
32865    #[serde_with::serde_as]
32866    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
32867    pub struct InputAudioNoiseReduction {
32868        #[doc = "Type of noise reduction. `near_field` is for close-talking microphones such as headphones, `far_field` is for far-field microphones such as laptop or conference room microphones.\n"]
32869        #[serde(rename = "type")]
32870        #[serde(skip_serializing_if = "Option::is_none")]
32871        #[builder(default)]
32872        pub r#type: Option<crate::__types::realtime_session::input_audio_noise_reduction::Type>,
32873    }
32874    #[allow(clippy::module_inception)]
32875    pub mod tracing {
32876        #[doc = "Default tracing mode for the session.\n"]
32877        #[derive(Clone, Copy, Debug, Default, PartialEq)]
32878        pub(crate) struct Auto;
32879        impl_serde!(Auto, "auto");
32880        #[doc = "Granular configuration for tracing.\n"]
32881        #[derive(Clone, Debug, Default, PartialEq)]
32882        #[serde_with::serde_as]
32883        #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
32884        pub struct Variant1 {
32885            #[doc = "The name of the workflow to attach to this trace. This is used to\nname the trace in the traces dashboard.\n"]
32886            #[serde(rename = "workflow_name")]
32887            #[serde(skip_serializing_if = "Option::is_none")]
32888            #[builder(default)]
32889            pub workflow_name: Option<String>,
32890            #[doc = "The group id to attach to this trace to enable filtering and\ngrouping in the traces dashboard.\n"]
32891            #[serde(rename = "group_id")]
32892            #[serde(skip_serializing_if = "Option::is_none")]
32893            #[builder(default)]
32894            pub group_id: Option<String>,
32895            #[doc = "The arbitrary metadata to attach to this trace to enable\nfiltering in the traces dashboard.\n"]
32896            #[serde(rename = "metadata")]
32897            #[serde(skip_serializing_if = "Option::is_none")]
32898            #[builder(default)]
32899            pub metadata: Option<indexmap::IndexMap<String, serde_json::Value>>,
32900        }
32901    }
32902    #[doc = "Configuration options for tracing. Set to null to disable tracing. Once\ntracing is enabled for a session, the configuration cannot be modified.\n\n`auto` will create a trace for the session with default values for the\nworkflow name, group id, and metadata.\n"]
32903    #[derive(Clone, Debug, PartialEq)]
32904    #[allow(clippy::large_enum_variant)]
32905    pub enum Tracing {
32906        #[doc = "auto"]
32907        Auto,
32908        #[doc = "Granular configuration for tracing.\n"]
32909        Variant1(crate::__types::realtime_session::tracing::Variant1),
32910    }
32911    impl<'de> serde::Deserialize<'de> for Tracing {
32912        fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
32913        where
32914            D: serde::Deserializer<'de>,
32915        {
32916            #[serde_with::serde_as]
32917            #[derive(serde :: Deserialize)]
32918            #[serde(untagged)]
32919            #[allow(clippy::enum_variant_names, clippy::large_enum_variant)]
32920            enum Tracing {
32921                Auto(crate::__types::realtime_session::tracing::Auto),
32922                Variant1(crate::__types::realtime_session::tracing::Variant1),
32923            }
32924            Ok(match Tracing::deserialize(deserializer)? {
32925                Tracing::Auto(_) => Self::Auto,
32926                Tracing::Variant1(v) => Self::Variant1(v),
32927            })
32928        }
32929    }
32930    impl serde::Serialize for Tracing {
32931        fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
32932        where
32933            S: serde::Serializer,
32934        {
32935            #[serde_with::serde_as]
32936            #[derive(serde :: Serialize)]
32937            #[serde(untagged)]
32938            #[allow(clippy::enum_variant_names)]
32939            enum Tracing<'a> {
32940                Auto(crate::__types::realtime_session::tracing::Auto),
32941                Variant1(&'a crate::__types::realtime_session::tracing::Variant1),
32942            }
32943            match self {
32944                Self::Auto => Tracing::Auto(Default::default()),
32945                Self::Variant1(v) => Tracing::Variant1(v),
32946            }
32947            .serialize(serializer)
32948        }
32949    }
32950    #[allow(clippy::module_inception)]
32951    pub mod tools {
32952        #[allow(clippy::module_inception)]
32953        pub mod item {
32954            #[doc = "The type of the tool, i.e. `function`."]
32955            #[derive(Clone, Copy, Debug, Default, PartialEq)]
32956            pub struct Type;
32957            impl_serde!(Type, "function");
32958        }
32959        #[derive(Clone, Debug, Default, PartialEq)]
32960        #[serde_with::serde_as]
32961        #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
32962        pub struct Item {
32963            #[doc = "The type of the tool, i.e. `function`."]
32964            #[serde(rename = "type")]
32965            #[serde(skip_serializing_if = "Option::is_none")]
32966            #[builder(default)]
32967            pub r#type: Option<crate::__types::realtime_session::tools::item::Type>,
32968            #[doc = "The name of the function."]
32969            #[serde(rename = "name")]
32970            #[serde(skip_serializing_if = "Option::is_none")]
32971            #[builder(default)]
32972            pub name: Option<String>,
32973            #[doc = "The description of the function, including guidance on when and how\nto call it, and guidance about what to tell the user when calling\n(if anything).\n"]
32974            #[serde(rename = "description")]
32975            #[serde(skip_serializing_if = "Option::is_none")]
32976            #[builder(default)]
32977            pub description: Option<String>,
32978            #[doc = "Parameters of the function in JSON Schema."]
32979            #[serde(rename = "parameters")]
32980            #[serde(skip_serializing_if = "Option::is_none")]
32981            #[builder(default)]
32982            pub parameters: Option<indexmap::IndexMap<String, serde_json::Value>>,
32983        }
32984    }
32985    #[allow(clippy::module_inception)]
32986    pub(crate) mod max_response_output_tokens {
32987        #[doc = "inf"]
32988        #[derive(Clone, Copy, Debug, Default, PartialEq)]
32989        pub(crate) struct Inf;
32990        impl_serde!(Inf, "inf");
32991    }
32992    #[doc = "Maximum number of output tokens for a single assistant response,\ninclusive of tool calls. Provide an integer between 1 and 4096 to\nlimit output tokens, or `inf` for the maximum available tokens for a\ngiven model. Defaults to `inf`.\n"]
32993    #[derive(Clone, Copy, Debug, PartialEq)]
32994    #[allow(clippy::large_enum_variant)]
32995    pub enum MaxResponseOutputTokens {
32996        Integer(i64),
32997        #[doc = "inf"]
32998        Inf,
32999    }
33000    impl<'de> serde::Deserialize<'de> for MaxResponseOutputTokens {
33001        fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
33002        where
33003            D: serde::Deserializer<'de>,
33004        {
33005            #[serde_with::serde_as]
33006            #[derive(serde :: Deserialize)]
33007            #[serde(untagged)]
33008            #[allow(clippy::enum_variant_names, clippy::large_enum_variant)]
33009            enum MaxResponseOutputTokens {
33010                Inf(crate::__types::realtime_session::max_response_output_tokens::Inf),
33011                Integer(i64),
33012            }
33013            Ok(match MaxResponseOutputTokens::deserialize(deserializer)? {
33014                MaxResponseOutputTokens::Integer(v) => Self::Integer(v),
33015                MaxResponseOutputTokens::Inf(_) => Self::Inf,
33016            })
33017        }
33018    }
33019    impl serde::Serialize for MaxResponseOutputTokens {
33020        fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
33021        where
33022            S: serde::Serializer,
33023        {
33024            #[serde_with::serde_as]
33025            #[derive(serde :: Serialize)]
33026            #[serde(untagged)]
33027            #[allow(clippy::enum_variant_names)]
33028            enum MaxResponseOutputTokens<'a> {
33029                Integer(&'a i64),
33030                Inf(crate::__types::realtime_session::max_response_output_tokens::Inf),
33031            }
33032            match self {
33033                Self::Integer(v) => MaxResponseOutputTokens::Integer(v),
33034                Self::Inf => MaxResponseOutputTokens::Inf(Default::default()),
33035            }
33036            .serialize(serializer)
33037        }
33038    }
33039}
33040#[doc = "Realtime session object configuration."]
33041#[derive(Clone, Debug, Default, PartialEq)]
33042#[serde_with::serde_as]
33043#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
33044pub struct RealtimeSession {
33045    #[doc = "Unique identifier for the session that looks like `sess_1234567890abcdef`.\n"]
33046    #[serde(rename = "id")]
33047    #[serde(skip_serializing_if = "Option::is_none")]
33048    #[builder(default)]
33049    pub id: Option<String>,
33050    #[doc = "The set of modalities the model can respond with. To disable audio,\nset this to [\"text\"].\n"]
33051    #[serde(rename = "modalities")]
33052    #[serde(skip_serializing_if = "Option::is_none")]
33053    #[builder(default)]
33054    pub modalities: Option<Vec<crate::__types::realtime_session::modalities::Item>>,
33055    #[doc = "The Realtime model used for this session.\n"]
33056    #[serde(rename = "model")]
33057    #[serde(skip_serializing_if = "Option::is_none")]
33058    #[builder(default)]
33059    pub model: Option<crate::__types::realtime_session::Model>,
33060    #[doc = "The default system instructions (i.e. system message) prepended to model\ncalls. This field allows the client to guide the model on desired\nresponses. The model can be instructed on response content and format,\n(e.g. \"be extremely succinct\", \"act friendly\", \"here are examples of good\nresponses\") and on audio behavior (e.g. \"talk quickly\", \"inject emotion\ninto your voice\", \"laugh frequently\"). The instructions are not\nguaranteed to be followed by the model, but they provide guidance to the\nmodel on the desired behavior.\n\n\nNote that the server sets default instructions which will be used if this\nfield is not set and are visible in the `session.created` event at the\nstart of the session.\n"]
33061    #[serde(rename = "instructions")]
33062    #[serde(skip_serializing_if = "Option::is_none")]
33063    #[builder(default)]
33064    pub instructions: Option<String>,
33065    #[doc = "The voice the model uses to respond. Voice cannot be changed during the\nsession once the model has responded with audio at least once. Current\nvoice options are `alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`,\n`shimmer`, and `verse`.\n"]
33066    #[serde(rename = "voice")]
33067    #[serde(skip_serializing_if = "Option::is_none")]
33068    #[builder(default)]
33069    pub voice: Option<crate::__types::VoiceIdsShared>,
33070    #[doc = "The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`.\nFor `pcm16`, input audio must be 16-bit PCM at a 24kHz sample rate,\nsingle channel (mono), and little-endian byte order.\n"]
33071    #[serde(rename = "input_audio_format")]
33072    #[serde(skip_serializing_if = "Option::is_none")]
33073    #[builder(default)]
33074    pub input_audio_format: Option<crate::__types::realtime_session::InputAudioFormat>,
33075    #[doc = "The format of output audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`.\nFor `pcm16`, output audio is sampled at a rate of 24kHz.\n"]
33076    #[serde(rename = "output_audio_format")]
33077    #[serde(skip_serializing_if = "Option::is_none")]
33078    #[builder(default)]
33079    pub output_audio_format: Option<crate::__types::realtime_session::OutputAudioFormat>,
33080    #[doc = "Configuration for input audio transcription, defaults to off and can be set to `null` to turn off once on. Input audio transcription is not native to the model, since the model consumes audio directly. Transcription runs asynchronously through [the /audio/transcriptions endpoint](https://platform.openai.com/docs/api-reference/audio/createTranscription) and should be treated as guidance of input audio content rather than precisely what the model heard. The client can optionally set the language and prompt for transcription, these offer additional guidance to the transcription service.\n"]
33081    #[serde(rename = "input_audio_transcription")]
33082    #[serde(skip_serializing_if = "Option::is_none")]
33083    #[builder(default)]
33084    pub input_audio_transcription:
33085        Option<crate::__types::realtime_session::InputAudioTranscription>,
33086    #[doc = "Configuration for turn detection, ether Server VAD or Semantic VAD. This can be set to `null` to turn off, in which case the client must manually trigger model response.\nServer VAD means that the model will detect the start and end of speech based on audio volume and respond at the end of user speech.\nSemantic VAD is more advanced and uses a turn detection model (in conjunction with VAD) to semantically estimate whether the user has finished speaking, then dynamically sets a timeout based on this probability. For example, if user audio trails off with \"uhhm\", the model will score a low probability of turn end and wait longer for the user to continue speaking. This can be useful for more natural conversations, but may have a higher latency.\n"]
33087    #[serde(rename = "turn_detection")]
33088    #[serde(skip_serializing_if = "Option::is_none")]
33089    #[builder(default)]
33090    pub turn_detection: Option<crate::__types::realtime_session::TurnDetection>,
33091    #[doc = "Configuration for input audio noise reduction. This can be set to `null` to turn off.\nNoise reduction filters audio added to the input audio buffer before it is sent to VAD and the model.\nFiltering the audio can improve VAD and turn detection accuracy (reducing false positives) and model performance by improving perception of the input audio.\n"]
33092    #[serde(rename = "input_audio_noise_reduction")]
33093    #[serde(skip_serializing_if = "Option::is_none")]
33094    #[builder(default)]
33095    pub input_audio_noise_reduction:
33096        Option<crate::__types::realtime_session::InputAudioNoiseReduction>,
33097    #[doc = "The speed of the model's spoken response. 1.0 is the default speed. 0.25 is\nthe minimum speed. 1.5 is the maximum speed. This value can only be changed\nin between model turns, not while a response is in progress.\n"]
33098    #[serde(rename = "speed")]
33099    #[serde(skip_serializing_if = "Option::is_none")]
33100    #[builder(default)]
33101    pub speed: Option<serde_json::Number>,
33102    #[doc = "Configuration options for tracing. Set to null to disable tracing. Once\ntracing is enabled for a session, the configuration cannot be modified.\n\n`auto` will create a trace for the session with default values for the\nworkflow name, group id, and metadata.\n"]
33103    #[serde(rename = "tracing")]
33104    #[serde(skip_serializing_if = "Option::is_none")]
33105    #[builder(default)]
33106    pub tracing: Option<crate::__types::realtime_session::Tracing>,
33107    #[doc = "Tools (functions) available to the model."]
33108    #[serde(rename = "tools")]
33109    #[serde(skip_serializing_if = "Option::is_none")]
33110    #[builder(default)]
33111    pub tools: Option<Vec<crate::__types::realtime_session::tools::Item>>,
33112    #[doc = "How the model chooses tools. Options are `auto`, `none`, `required`, or\nspecify a function.\n"]
33113    #[serde(rename = "tool_choice")]
33114    #[serde(skip_serializing_if = "Option::is_none")]
33115    #[builder(default)]
33116    pub tool_choice: Option<String>,
33117    #[doc = "Sampling temperature for the model, limited to [0.6, 1.2]. For audio models a temperature of 0.8 is highly recommended for best performance.\n"]
33118    #[serde(rename = "temperature")]
33119    #[serde(skip_serializing_if = "Option::is_none")]
33120    #[builder(default)]
33121    pub temperature: Option<serde_json::Number>,
33122    #[doc = "Maximum number of output tokens for a single assistant response,\ninclusive of tool calls. Provide an integer between 1 and 4096 to\nlimit output tokens, or `inf` for the maximum available tokens for a\ngiven model. Defaults to `inf`.\n"]
33123    #[serde(rename = "max_response_output_tokens")]
33124    #[serde(skip_serializing_if = "Option::is_none")]
33125    #[builder(default)]
33126    pub max_response_output_tokens:
33127        Option<crate::__types::realtime_session::MaxResponseOutputTokens>,
33128}
33129#[allow(clippy::module_inception)]
33130pub mod realtime_session_create_request {
33131    #[allow(clippy::module_inception)]
33132    pub mod modalities {
33133        #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
33134        pub enum Item {
33135            #[doc = "`text`"]
33136            #[serde(rename = "text")]
33137            Text,
33138            #[doc = "`audio`"]
33139            #[serde(rename = "audio")]
33140            Audio,
33141        }
33142    }
33143    #[doc = "The Realtime model used for this session.\n"]
33144    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
33145    pub enum Model {
33146        #[doc = "`gpt-4o-realtime-preview`"]
33147        #[serde(rename = "gpt-4o-realtime-preview")]
33148        Gpt4oRealtimePreview,
33149        #[doc = "`gpt-4o-realtime-preview-2024-10-01`"]
33150        #[serde(rename = "gpt-4o-realtime-preview-2024-10-01")]
33151        Gpt4oRealtimePreview2024_10_01,
33152        #[doc = "`gpt-4o-realtime-preview-2024-12-17`"]
33153        #[serde(rename = "gpt-4o-realtime-preview-2024-12-17")]
33154        Gpt4oRealtimePreview2024_12_17,
33155        #[doc = "`gpt-4o-realtime-preview-2025-06-03`"]
33156        #[serde(rename = "gpt-4o-realtime-preview-2025-06-03")]
33157        Gpt4oRealtimePreview2025_06_03,
33158        #[doc = "`gpt-4o-mini-realtime-preview`"]
33159        #[serde(rename = "gpt-4o-mini-realtime-preview")]
33160        Gpt4oMiniRealtimePreview,
33161        #[doc = "`gpt-4o-mini-realtime-preview-2024-12-17`"]
33162        #[serde(rename = "gpt-4o-mini-realtime-preview-2024-12-17")]
33163        Gpt4oMiniRealtimePreview2024_12_17,
33164    }
33165    #[doc = "The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`.\nFor `pcm16`, input audio must be 16-bit PCM at a 24kHz sample rate,\nsingle channel (mono), and little-endian byte order.\n"]
33166    #[derive(Clone, Copy, Debug, Default, PartialEq, serde :: Deserialize, serde :: Serialize)]
33167    pub enum InputAudioFormat {
33168        #[doc = "`pcm16`"]
33169        #[default]
33170        #[serde(rename = "pcm16")]
33171        Pcm16,
33172        #[doc = "`g711_ulaw`"]
33173        #[serde(rename = "g711_ulaw")]
33174        G711Ulaw,
33175        #[doc = "`g711_alaw`"]
33176        #[serde(rename = "g711_alaw")]
33177        G711Alaw,
33178    }
33179    #[doc = "The format of output audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`.\nFor `pcm16`, output audio is sampled at a rate of 24kHz.\n"]
33180    #[derive(Clone, Copy, Debug, Default, PartialEq, serde :: Deserialize, serde :: Serialize)]
33181    pub enum OutputAudioFormat {
33182        #[doc = "`pcm16`"]
33183        #[default]
33184        #[serde(rename = "pcm16")]
33185        Pcm16,
33186        #[doc = "`g711_ulaw`"]
33187        #[serde(rename = "g711_ulaw")]
33188        G711Ulaw,
33189        #[doc = "`g711_alaw`"]
33190        #[serde(rename = "g711_alaw")]
33191        G711Alaw,
33192    }
33193    #[doc = "Configuration for input audio transcription, defaults to off and can be set to `null` to turn off once on. Input audio transcription is not native to the model, since the model consumes audio directly. Transcription runs asynchronously through [the /audio/transcriptions endpoint](https://platform.openai.com/docs/api-reference/audio/createTranscription) and should be treated as guidance of input audio content rather than precisely what the model heard. The client can optionally set the language and prompt for transcription, these offer additional guidance to the transcription service.\n"]
33194    #[derive(Clone, Debug, Default, PartialEq)]
33195    #[serde_with::serde_as]
33196    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
33197    pub struct InputAudioTranscription {
33198        #[doc = "The model to use for transcription, current options are `gpt-4o-transcribe`, `gpt-4o-mini-transcribe`, and `whisper-1`.\n"]
33199        #[serde(rename = "model")]
33200        #[serde(skip_serializing_if = "Option::is_none")]
33201        #[builder(default)]
33202        pub model: Option<String>,
33203        #[doc = "The language of the input audio. Supplying the input language in\n[ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) (e.g. `en`) format\nwill improve accuracy and latency.\n"]
33204        #[serde(rename = "language")]
33205        #[serde(skip_serializing_if = "Option::is_none")]
33206        #[builder(default)]
33207        pub language: Option<String>,
33208        #[doc = "An optional text to guide the model's style or continue a previous audio\nsegment.\nFor `whisper-1`, the [prompt is a list of keywords](https://platform.openai.com/docs/guides/speech-to-text#prompting).\nFor `gpt-4o-transcribe` models, the prompt is a free text string, for example \"expect words related to technology\".\n"]
33209        #[serde(rename = "prompt")]
33210        #[serde(skip_serializing_if = "Option::is_none")]
33211        #[builder(default)]
33212        pub prompt: Option<String>,
33213    }
33214    #[allow(clippy::module_inception)]
33215    pub mod turn_detection {
33216        #[doc = "Type of turn detection.\n"]
33217        #[derive(
33218            Clone, Copy, Debug, Default, PartialEq, serde :: Deserialize, serde :: Serialize,
33219        )]
33220        pub enum Type {
33221            #[doc = "`server_vad`"]
33222            #[default]
33223            #[serde(rename = "server_vad")]
33224            ServerVad,
33225            #[doc = "`semantic_vad`"]
33226            #[serde(rename = "semantic_vad")]
33227            SemanticVad,
33228        }
33229        #[doc = "Used only for `semantic_vad` mode. The eagerness of the model to respond. `low` will wait longer for the user to continue speaking, `high` will respond more quickly. `auto` is the default and is equivalent to `medium`.\n"]
33230        #[derive(
33231            Clone, Copy, Debug, Default, PartialEq, serde :: Deserialize, serde :: Serialize,
33232        )]
33233        pub enum Eagerness {
33234            #[doc = "`low`"]
33235            #[serde(rename = "low")]
33236            Low,
33237            #[doc = "`medium`"]
33238            #[serde(rename = "medium")]
33239            Medium,
33240            #[doc = "`high`"]
33241            #[serde(rename = "high")]
33242            High,
33243            #[doc = "`auto`"]
33244            #[default]
33245            #[serde(rename = "auto")]
33246            Auto,
33247        }
33248    }
33249    #[doc = "Configuration for turn detection, ether Server VAD or Semantic VAD. This can be set to `null` to turn off, in which case the client must manually trigger model response.\nServer VAD means that the model will detect the start and end of speech based on audio volume and respond at the end of user speech.\nSemantic VAD is more advanced and uses a turn detection model (in conjunction with VAD) to semantically estimate whether the user has finished speaking, then dynamically sets a timeout based on this probability. For example, if user audio trails off with \"uhhm\", the model will score a low probability of turn end and wait longer for the user to continue speaking. This can be useful for more natural conversations, but may have a higher latency.\n"]
33250    #[derive(Clone, Debug, Default, PartialEq)]
33251    #[serde_with::serde_as]
33252    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
33253    pub struct TurnDetection {
33254        #[doc = "Type of turn detection.\n"]
33255        #[serde(rename = "type")]
33256        #[serde(skip_serializing_if = "Option::is_none")]
33257        #[builder(default)]
33258        pub r#type: Option<crate::__types::realtime_session_create_request::turn_detection::Type>,
33259        #[doc = "Used only for `semantic_vad` mode. The eagerness of the model to respond. `low` will wait longer for the user to continue speaking, `high` will respond more quickly. `auto` is the default and is equivalent to `medium`.\n"]
33260        #[serde(rename = "eagerness")]
33261        #[serde(skip_serializing_if = "Option::is_none")]
33262        #[builder(default)]
33263        pub eagerness:
33264            Option<crate::__types::realtime_session_create_request::turn_detection::Eagerness>,
33265        #[doc = "Used only for `server_vad` mode. Activation threshold for VAD (0.0 to 1.0), this defaults to 0.5. A\nhigher threshold will require louder audio to activate the model, and\nthus might perform better in noisy environments.\n"]
33266        #[serde(rename = "threshold")]
33267        #[serde(skip_serializing_if = "Option::is_none")]
33268        #[builder(default)]
33269        pub threshold: Option<serde_json::Number>,
33270        #[doc = "Used only for `server_vad` mode. Amount of audio to include before the VAD detected speech (in\nmilliseconds). Defaults to 300ms.\n"]
33271        #[serde(rename = "prefix_padding_ms")]
33272        #[serde(skip_serializing_if = "Option::is_none")]
33273        #[builder(default)]
33274        pub prefix_padding_ms: Option<i64>,
33275        #[doc = "Used only for `server_vad` mode. Duration of silence to detect speech stop (in milliseconds). Defaults\nto 500ms. With shorter values the model will respond more quickly,\nbut may jump in on short pauses from the user.\n"]
33276        #[serde(rename = "silence_duration_ms")]
33277        #[serde(skip_serializing_if = "Option::is_none")]
33278        #[builder(default)]
33279        pub silence_duration_ms: Option<i64>,
33280        #[doc = "Whether or not to automatically generate a response when a VAD stop event occurs.\n"]
33281        #[serde(rename = "create_response")]
33282        #[serde(skip_serializing_if = "Option::is_none")]
33283        #[builder(default)]
33284        pub create_response: Option<bool>,
33285        #[doc = "Whether or not to automatically interrupt any ongoing response with output to the default\nconversation (i.e. `conversation` of `auto`) when a VAD start event occurs.\n"]
33286        #[serde(rename = "interrupt_response")]
33287        #[serde(skip_serializing_if = "Option::is_none")]
33288        #[builder(default)]
33289        pub interrupt_response: Option<bool>,
33290    }
33291    #[allow(clippy::module_inception)]
33292    pub mod input_audio_noise_reduction {
33293        #[doc = "Type of noise reduction. `near_field` is for close-talking microphones such as headphones, `far_field` is for far-field microphones such as laptop or conference room microphones.\n"]
33294        #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
33295        pub enum Type {
33296            #[doc = "`near_field`"]
33297            #[serde(rename = "near_field")]
33298            NearField,
33299            #[doc = "`far_field`"]
33300            #[serde(rename = "far_field")]
33301            FarField,
33302        }
33303    }
33304    #[doc = "Configuration for input audio noise reduction. This can be set to `null` to turn off.\nNoise reduction filters audio added to the input audio buffer before it is sent to VAD and the model.\nFiltering the audio can improve VAD and turn detection accuracy (reducing false positives) and model performance by improving perception of the input audio.\n"]
33305    #[derive(Clone, Copy, Debug, Default, PartialEq)]
33306    #[serde_with::serde_as]
33307    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
33308    pub struct InputAudioNoiseReduction {
33309        #[doc = "Type of noise reduction. `near_field` is for close-talking microphones such as headphones, `far_field` is for far-field microphones such as laptop or conference room microphones.\n"]
33310        #[serde(rename = "type")]
33311        #[serde(skip_serializing_if = "Option::is_none")]
33312        #[builder(default)]
33313        pub r#type: Option<
33314            crate::__types::realtime_session_create_request::input_audio_noise_reduction::Type,
33315        >,
33316    }
33317    #[allow(clippy::module_inception)]
33318    pub mod tracing {
33319        #[doc = "Default tracing mode for the session.\n"]
33320        #[derive(Clone, Copy, Debug, Default, PartialEq)]
33321        pub(crate) struct Auto;
33322        impl_serde!(Auto, "auto");
33323        #[doc = "Granular configuration for tracing.\n"]
33324        #[derive(Clone, Debug, Default, PartialEq)]
33325        #[serde_with::serde_as]
33326        #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
33327        pub struct Variant1 {
33328            #[doc = "The name of the workflow to attach to this trace. This is used to\nname the trace in the traces dashboard.\n"]
33329            #[serde(rename = "workflow_name")]
33330            #[serde(skip_serializing_if = "Option::is_none")]
33331            #[builder(default)]
33332            pub workflow_name: Option<String>,
33333            #[doc = "The group id to attach to this trace to enable filtering and\ngrouping in the traces dashboard.\n"]
33334            #[serde(rename = "group_id")]
33335            #[serde(skip_serializing_if = "Option::is_none")]
33336            #[builder(default)]
33337            pub group_id: Option<String>,
33338            #[doc = "The arbitrary metadata to attach to this trace to enable\nfiltering in the traces dashboard.\n"]
33339            #[serde(rename = "metadata")]
33340            #[serde(skip_serializing_if = "Option::is_none")]
33341            #[builder(default)]
33342            pub metadata: Option<indexmap::IndexMap<String, serde_json::Value>>,
33343        }
33344    }
33345    #[doc = "Configuration options for tracing. Set to null to disable tracing. Once\ntracing is enabled for a session, the configuration cannot be modified.\n\n`auto` will create a trace for the session with default values for the\nworkflow name, group id, and metadata.\n"]
33346    #[derive(Clone, Debug, PartialEq)]
33347    #[allow(clippy::large_enum_variant)]
33348    pub enum Tracing {
33349        #[doc = "auto"]
33350        Auto,
33351        #[doc = "Granular configuration for tracing.\n"]
33352        Variant1(crate::__types::realtime_session_create_request::tracing::Variant1),
33353    }
33354    impl<'de> serde::Deserialize<'de> for Tracing {
33355        fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
33356        where
33357            D: serde::Deserializer<'de>,
33358        {
33359            #[serde_with::serde_as]
33360            #[derive(serde :: Deserialize)]
33361            #[serde(untagged)]
33362            #[allow(clippy::enum_variant_names, clippy::large_enum_variant)]
33363            enum Tracing {
33364                Auto(crate::__types::realtime_session_create_request::tracing::Auto),
33365                Variant1(crate::__types::realtime_session_create_request::tracing::Variant1),
33366            }
33367            Ok(match Tracing::deserialize(deserializer)? {
33368                Tracing::Auto(_) => Self::Auto,
33369                Tracing::Variant1(v) => Self::Variant1(v),
33370            })
33371        }
33372    }
33373    impl serde::Serialize for Tracing {
33374        fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
33375        where
33376            S: serde::Serializer,
33377        {
33378            #[serde_with::serde_as]
33379            #[derive(serde :: Serialize)]
33380            #[serde(untagged)]
33381            #[allow(clippy::enum_variant_names)]
33382            enum Tracing<'a> {
33383                Auto(crate::__types::realtime_session_create_request::tracing::Auto),
33384                Variant1(&'a crate::__types::realtime_session_create_request::tracing::Variant1),
33385            }
33386            match self {
33387                Self::Auto => Tracing::Auto(Default::default()),
33388                Self::Variant1(v) => Tracing::Variant1(v),
33389            }
33390            .serialize(serializer)
33391        }
33392    }
33393    #[allow(clippy::module_inception)]
33394    pub mod tools {
33395        #[allow(clippy::module_inception)]
33396        pub mod item {
33397            #[doc = "The type of the tool, i.e. `function`."]
33398            #[derive(Clone, Copy, Debug, Default, PartialEq)]
33399            pub struct Type;
33400            impl_serde!(Type, "function");
33401        }
33402        #[derive(Clone, Debug, Default, PartialEq)]
33403        #[serde_with::serde_as]
33404        #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
33405        pub struct Item {
33406            #[doc = "The type of the tool, i.e. `function`."]
33407            #[serde(rename = "type")]
33408            #[serde(skip_serializing_if = "Option::is_none")]
33409            #[builder(default)]
33410            pub r#type: Option<crate::__types::realtime_session_create_request::tools::item::Type>,
33411            #[doc = "The name of the function."]
33412            #[serde(rename = "name")]
33413            #[serde(skip_serializing_if = "Option::is_none")]
33414            #[builder(default)]
33415            pub name: Option<String>,
33416            #[doc = "The description of the function, including guidance on when and how\nto call it, and guidance about what to tell the user when calling\n(if anything).\n"]
33417            #[serde(rename = "description")]
33418            #[serde(skip_serializing_if = "Option::is_none")]
33419            #[builder(default)]
33420            pub description: Option<String>,
33421            #[doc = "Parameters of the function in JSON Schema."]
33422            #[serde(rename = "parameters")]
33423            #[serde(skip_serializing_if = "Option::is_none")]
33424            #[builder(default)]
33425            pub parameters: Option<indexmap::IndexMap<String, serde_json::Value>>,
33426        }
33427    }
33428    #[allow(clippy::module_inception)]
33429    pub(crate) mod max_response_output_tokens {
33430        #[doc = "inf"]
33431        #[derive(Clone, Copy, Debug, Default, PartialEq)]
33432        pub(crate) struct Inf;
33433        impl_serde!(Inf, "inf");
33434    }
33435    #[doc = "Maximum number of output tokens for a single assistant response,\ninclusive of tool calls. Provide an integer between 1 and 4096 to\nlimit output tokens, or `inf` for the maximum available tokens for a\ngiven model. Defaults to `inf`.\n"]
33436    #[derive(Clone, Copy, Debug, PartialEq)]
33437    #[allow(clippy::large_enum_variant)]
33438    pub enum MaxResponseOutputTokens {
33439        Integer(i64),
33440        #[doc = "inf"]
33441        Inf,
33442    }
33443    impl<'de> serde::Deserialize<'de> for MaxResponseOutputTokens {
33444        fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
33445        where
33446            D: serde::Deserializer<'de>,
33447        {
33448            #[serde_with::serde_as]
33449            #[derive(serde :: Deserialize)]
33450            #[serde(untagged)]
33451            #[allow(clippy::enum_variant_names, clippy::large_enum_variant)]
33452            enum MaxResponseOutputTokens {
33453                Inf (crate :: __types :: realtime_session_create_request :: max_response_output_tokens :: Inf) , Integer (i64) }
33454            Ok(match MaxResponseOutputTokens::deserialize(deserializer)? {
33455                MaxResponseOutputTokens::Integer(v) => Self::Integer(v),
33456                MaxResponseOutputTokens::Inf(_) => Self::Inf,
33457            })
33458        }
33459    }
33460    impl serde::Serialize for MaxResponseOutputTokens {
33461        fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
33462        where
33463            S: serde::Serializer,
33464        {
33465            #[serde_with::serde_as]
33466            #[derive(serde :: Serialize)]
33467            #[serde(untagged)]
33468            #[allow(clippy::enum_variant_names)]
33469            enum MaxResponseOutputTokens<'a> {
33470                Integer (& 'a i64) , Inf (crate :: __types :: realtime_session_create_request :: max_response_output_tokens :: Inf) }
33471            match self {
33472                Self::Integer(v) => MaxResponseOutputTokens::Integer(v),
33473                Self::Inf => MaxResponseOutputTokens::Inf(Default::default()),
33474            }
33475            .serialize(serializer)
33476        }
33477    }
33478    #[allow(clippy::module_inception)]
33479    pub mod client_secret {
33480        #[allow(clippy::module_inception)]
33481        pub mod expires_after {
33482            #[doc = "The anchor point for the ephemeral token expiration. Only `created_at` is currently supported.\n"]
33483            #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
33484            pub enum Anchor {
33485                #[doc = "`created_at`"]
33486                #[serde(rename = "created_at")]
33487                CreatedAt,
33488            }
33489        }
33490        #[doc = "Configuration for the ephemeral token expiration.\n"]
33491        #[derive(Clone, Copy, Debug, PartialEq)]
33492        #[serde_with::serde_as]
33493        #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
33494        pub struct ExpiresAfter { # [doc = "The anchor point for the ephemeral token expiration. Only `created_at` is currently supported.\n"] # [serde (rename = "anchor")] pub anchor : crate :: __types :: realtime_session_create_request :: client_secret :: expires_after :: Anchor , # [doc = "The number of seconds from the anchor point to the expiration. Select a value between `10` and `7200`.\n"] # [serde (rename = "seconds")] # [serde (skip_serializing_if = "Option::is_none")] # [builder (default)] pub seconds : Option < i64 > }
33495    }
33496    #[doc = "Configuration options for the generated client secret.\n"]
33497    #[derive(Clone, Copy, Debug, Default, PartialEq)]
33498    #[serde_with::serde_as]
33499    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
33500    pub struct ClientSecret {
33501        #[doc = "Configuration for the ephemeral token expiration.\n"]
33502        #[serde(rename = "expires_after")]
33503        #[serde(skip_serializing_if = "Option::is_none")]
33504        #[builder(default)]
33505        pub expires_after:
33506            Option<crate::__types::realtime_session_create_request::client_secret::ExpiresAfter>,
33507    }
33508}
33509#[doc = "Realtime session object configuration."]
33510#[derive(Clone, Debug, Default, PartialEq)]
33511#[serde_with::serde_as]
33512#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
33513pub struct RealtimeSessionCreateRequest {
33514    #[doc = "The set of modalities the model can respond with. To disable audio,\nset this to [\"text\"].\n"]
33515    #[serde(rename = "modalities")]
33516    #[serde(skip_serializing_if = "Option::is_none")]
33517    #[builder(default)]
33518    pub modalities: Option<Vec<crate::__types::realtime_session_create_request::modalities::Item>>,
33519    #[doc = "The Realtime model used for this session.\n"]
33520    #[serde(rename = "model")]
33521    #[serde(skip_serializing_if = "Option::is_none")]
33522    #[builder(default)]
33523    pub model: Option<crate::__types::realtime_session_create_request::Model>,
33524    #[doc = "The default system instructions (i.e. system message) prepended to model calls. This field allows the client to guide the model on desired responses. The model can be instructed on response content and format, (e.g. \"be extremely succinct\", \"act friendly\", \"here are examples of good responses\") and on audio behavior (e.g. \"talk quickly\", \"inject emotion into your voice\", \"laugh frequently\"). The instructions are not guaranteed to be followed by the model, but they provide guidance to the model on the desired behavior.\n\nNote that the server sets default instructions which will be used if this field is not set and are visible in the `session.created` event at the start of the session.\n"]
33525    #[serde(rename = "instructions")]
33526    #[serde(skip_serializing_if = "Option::is_none")]
33527    #[builder(default)]
33528    pub instructions: Option<String>,
33529    #[doc = "The voice the model uses to respond. Voice cannot be changed during the\nsession once the model has responded with audio at least once. Current\nvoice options are `alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`,\n`shimmer`, and `verse`.\n"]
33530    #[serde(rename = "voice")]
33531    #[serde(skip_serializing_if = "Option::is_none")]
33532    #[builder(default)]
33533    pub voice: Option<crate::__types::VoiceIdsShared>,
33534    #[doc = "The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`.\nFor `pcm16`, input audio must be 16-bit PCM at a 24kHz sample rate,\nsingle channel (mono), and little-endian byte order.\n"]
33535    #[serde(rename = "input_audio_format")]
33536    #[serde(skip_serializing_if = "Option::is_none")]
33537    #[builder(default)]
33538    pub input_audio_format:
33539        Option<crate::__types::realtime_session_create_request::InputAudioFormat>,
33540    #[doc = "The format of output audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`.\nFor `pcm16`, output audio is sampled at a rate of 24kHz.\n"]
33541    #[serde(rename = "output_audio_format")]
33542    #[serde(skip_serializing_if = "Option::is_none")]
33543    #[builder(default)]
33544    pub output_audio_format:
33545        Option<crate::__types::realtime_session_create_request::OutputAudioFormat>,
33546    #[doc = "Configuration for input audio transcription, defaults to off and can be set to `null` to turn off once on. Input audio transcription is not native to the model, since the model consumes audio directly. Transcription runs asynchronously through [the /audio/transcriptions endpoint](https://platform.openai.com/docs/api-reference/audio/createTranscription) and should be treated as guidance of input audio content rather than precisely what the model heard. The client can optionally set the language and prompt for transcription, these offer additional guidance to the transcription service.\n"]
33547    #[serde(rename = "input_audio_transcription")]
33548    #[serde(skip_serializing_if = "Option::is_none")]
33549    #[builder(default)]
33550    pub input_audio_transcription:
33551        Option<crate::__types::realtime_session_create_request::InputAudioTranscription>,
33552    #[doc = "Configuration for turn detection, ether Server VAD or Semantic VAD. This can be set to `null` to turn off, in which case the client must manually trigger model response.\nServer VAD means that the model will detect the start and end of speech based on audio volume and respond at the end of user speech.\nSemantic VAD is more advanced and uses a turn detection model (in conjunction with VAD) to semantically estimate whether the user has finished speaking, then dynamically sets a timeout based on this probability. For example, if user audio trails off with \"uhhm\", the model will score a low probability of turn end and wait longer for the user to continue speaking. This can be useful for more natural conversations, but may have a higher latency.\n"]
33553    #[serde(rename = "turn_detection")]
33554    #[serde(skip_serializing_if = "Option::is_none")]
33555    #[builder(default)]
33556    pub turn_detection: Option<crate::__types::realtime_session_create_request::TurnDetection>,
33557    #[doc = "Configuration for input audio noise reduction. This can be set to `null` to turn off.\nNoise reduction filters audio added to the input audio buffer before it is sent to VAD and the model.\nFiltering the audio can improve VAD and turn detection accuracy (reducing false positives) and model performance by improving perception of the input audio.\n"]
33558    #[serde(rename = "input_audio_noise_reduction")]
33559    #[serde(skip_serializing_if = "Option::is_none")]
33560    #[builder(default)]
33561    pub input_audio_noise_reduction:
33562        Option<crate::__types::realtime_session_create_request::InputAudioNoiseReduction>,
33563    #[doc = "The speed of the model's spoken response. 1.0 is the default speed. 0.25 is\nthe minimum speed. 1.5 is the maximum speed. This value can only be changed\nin between model turns, not while a response is in progress.\n"]
33564    #[serde(rename = "speed")]
33565    #[serde(skip_serializing_if = "Option::is_none")]
33566    #[builder(default)]
33567    pub speed: Option<serde_json::Number>,
33568    #[doc = "Configuration options for tracing. Set to null to disable tracing. Once\ntracing is enabled for a session, the configuration cannot be modified.\n\n`auto` will create a trace for the session with default values for the\nworkflow name, group id, and metadata.\n"]
33569    #[serde(rename = "tracing")]
33570    #[serde(skip_serializing_if = "Option::is_none")]
33571    #[builder(default)]
33572    pub tracing: Option<crate::__types::realtime_session_create_request::Tracing>,
33573    #[doc = "Tools (functions) available to the model."]
33574    #[serde(rename = "tools")]
33575    #[serde(skip_serializing_if = "Option::is_none")]
33576    #[builder(default)]
33577    pub tools: Option<Vec<crate::__types::realtime_session_create_request::tools::Item>>,
33578    #[doc = "How the model chooses tools. Options are `auto`, `none`, `required`, or\nspecify a function.\n"]
33579    #[serde(rename = "tool_choice")]
33580    #[serde(skip_serializing_if = "Option::is_none")]
33581    #[builder(default)]
33582    pub tool_choice: Option<String>,
33583    #[doc = "Sampling temperature for the model, limited to [0.6, 1.2]. For audio models a temperature of 0.8 is highly recommended for best performance.\n"]
33584    #[serde(rename = "temperature")]
33585    #[serde(skip_serializing_if = "Option::is_none")]
33586    #[builder(default)]
33587    pub temperature: Option<serde_json::Number>,
33588    #[doc = "Maximum number of output tokens for a single assistant response,\ninclusive of tool calls. Provide an integer between 1 and 4096 to\nlimit output tokens, or `inf` for the maximum available tokens for a\ngiven model. Defaults to `inf`.\n"]
33589    #[serde(rename = "max_response_output_tokens")]
33590    #[serde(skip_serializing_if = "Option::is_none")]
33591    #[builder(default)]
33592    pub max_response_output_tokens:
33593        Option<crate::__types::realtime_session_create_request::MaxResponseOutputTokens>,
33594    #[doc = "Configuration options for the generated client secret.\n"]
33595    #[serde(rename = "client_secret")]
33596    #[serde(skip_serializing_if = "Option::is_none")]
33597    #[builder(default)]
33598    pub client_secret: Option<crate::__types::realtime_session_create_request::ClientSecret>,
33599}
33600#[allow(clippy::module_inception)]
33601pub mod realtime_session_create_response {
33602    #[doc = "Ephemeral key returned by the API."]
33603    #[derive(Clone, Debug, PartialEq)]
33604    #[serde_with::serde_as]
33605    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
33606    pub struct ClientSecret {
33607        #[doc = "Ephemeral key usable in client environments to authenticate connections\nto the Realtime API. Use this in client-side environments rather than\na standard API token, which should only be used server-side.\n"]
33608        #[serde(rename = "value")]
33609        pub value: String,
33610        #[doc = "Timestamp for when the token expires. Currently, all tokens expire\nafter one minute.\n"]
33611        #[serde(rename = "expires_at")]
33612        pub expires_at: i64,
33613    }
33614    #[allow(clippy::module_inception)]
33615    pub mod modalities {
33616        #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
33617        pub enum Item {
33618            #[doc = "`text`"]
33619            #[serde(rename = "text")]
33620            Text,
33621            #[doc = "`audio`"]
33622            #[serde(rename = "audio")]
33623            Audio,
33624        }
33625    }
33626    #[doc = "Configuration for input audio transcription, defaults to off and can be\nset to `null` to turn off once on. Input audio transcription is not native\nto the model, since the model consumes audio directly. Transcription runs\nasynchronously and should be treated as rough guidance\nrather than the representation understood by the model.\n"]
33627    #[derive(Clone, Debug, Default, PartialEq)]
33628    #[serde_with::serde_as]
33629    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
33630    pub struct InputAudioTranscription {
33631        #[doc = "The model to use for transcription.\n"]
33632        #[serde(rename = "model")]
33633        #[serde(skip_serializing_if = "Option::is_none")]
33634        #[builder(default)]
33635        pub model: Option<String>,
33636    }
33637    #[allow(clippy::module_inception)]
33638    pub mod tracing {
33639        #[doc = "Default tracing mode for the session.\n"]
33640        #[derive(Clone, Copy, Debug, Default, PartialEq)]
33641        pub(crate) struct Auto;
33642        impl_serde!(Auto, "auto");
33643        #[doc = "Granular configuration for tracing.\n"]
33644        #[derive(Clone, Debug, Default, PartialEq)]
33645        #[serde_with::serde_as]
33646        #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
33647        pub struct Variant1 {
33648            #[doc = "The name of the workflow to attach to this trace. This is used to\nname the trace in the traces dashboard.\n"]
33649            #[serde(rename = "workflow_name")]
33650            #[serde(skip_serializing_if = "Option::is_none")]
33651            #[builder(default)]
33652            pub workflow_name: Option<String>,
33653            #[doc = "The group id to attach to this trace to enable filtering and\ngrouping in the traces dashboard.\n"]
33654            #[serde(rename = "group_id")]
33655            #[serde(skip_serializing_if = "Option::is_none")]
33656            #[builder(default)]
33657            pub group_id: Option<String>,
33658            #[doc = "The arbitrary metadata to attach to this trace to enable\nfiltering in the traces dashboard.\n"]
33659            #[serde(rename = "metadata")]
33660            #[serde(skip_serializing_if = "Option::is_none")]
33661            #[builder(default)]
33662            pub metadata: Option<indexmap::IndexMap<String, serde_json::Value>>,
33663        }
33664    }
33665    #[doc = "Configuration options for tracing. Set to null to disable tracing. Once\ntracing is enabled for a session, the configuration cannot be modified.\n\n`auto` will create a trace for the session with default values for the\nworkflow name, group id, and metadata.\n"]
33666    #[derive(Clone, Debug, PartialEq)]
33667    #[allow(clippy::large_enum_variant)]
33668    pub enum Tracing {
33669        #[doc = "auto"]
33670        Auto,
33671        #[doc = "Granular configuration for tracing.\n"]
33672        Variant1(crate::__types::realtime_session_create_response::tracing::Variant1),
33673    }
33674    impl<'de> serde::Deserialize<'de> for Tracing {
33675        fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
33676        where
33677            D: serde::Deserializer<'de>,
33678        {
33679            #[serde_with::serde_as]
33680            #[derive(serde :: Deserialize)]
33681            #[serde(untagged)]
33682            #[allow(clippy::enum_variant_names, clippy::large_enum_variant)]
33683            enum Tracing {
33684                Auto(crate::__types::realtime_session_create_response::tracing::Auto),
33685                Variant1(crate::__types::realtime_session_create_response::tracing::Variant1),
33686            }
33687            Ok(match Tracing::deserialize(deserializer)? {
33688                Tracing::Auto(_) => Self::Auto,
33689                Tracing::Variant1(v) => Self::Variant1(v),
33690            })
33691        }
33692    }
33693    impl serde::Serialize for Tracing {
33694        fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
33695        where
33696            S: serde::Serializer,
33697        {
33698            #[serde_with::serde_as]
33699            #[derive(serde :: Serialize)]
33700            #[serde(untagged)]
33701            #[allow(clippy::enum_variant_names)]
33702            enum Tracing<'a> {
33703                Auto(crate::__types::realtime_session_create_response::tracing::Auto),
33704                Variant1(&'a crate::__types::realtime_session_create_response::tracing::Variant1),
33705            }
33706            match self {
33707                Self::Auto => Tracing::Auto(Default::default()),
33708                Self::Variant1(v) => Tracing::Variant1(v),
33709            }
33710            .serialize(serializer)
33711        }
33712    }
33713    #[doc = "Configuration for turn detection. Can be set to `null` to turn off. Server\nVAD means that the model will detect the start and end of speech based on\naudio volume and respond at the end of user speech.\n"]
33714    #[derive(Clone, Debug, Default, PartialEq)]
33715    #[serde_with::serde_as]
33716    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
33717    pub struct TurnDetection {
33718        #[doc = "Type of turn detection, only `server_vad` is currently supported.\n"]
33719        #[serde(rename = "type")]
33720        #[serde(skip_serializing_if = "Option::is_none")]
33721        #[builder(default)]
33722        pub r#type: Option<String>,
33723        #[doc = "Activation threshold for VAD (0.0 to 1.0), this defaults to 0.5. A\nhigher threshold will require louder audio to activate the model, and\nthus might perform better in noisy environments.\n"]
33724        #[serde(rename = "threshold")]
33725        #[serde(skip_serializing_if = "Option::is_none")]
33726        #[builder(default)]
33727        pub threshold: Option<serde_json::Number>,
33728        #[doc = "Amount of audio to include before the VAD detected speech (in\nmilliseconds). Defaults to 300ms.\n"]
33729        #[serde(rename = "prefix_padding_ms")]
33730        #[serde(skip_serializing_if = "Option::is_none")]
33731        #[builder(default)]
33732        pub prefix_padding_ms: Option<i64>,
33733        #[doc = "Duration of silence to detect speech stop (in milliseconds). Defaults\nto 500ms. With shorter values the model will respond more quickly,\nbut may jump in on short pauses from the user.\n"]
33734        #[serde(rename = "silence_duration_ms")]
33735        #[serde(skip_serializing_if = "Option::is_none")]
33736        #[builder(default)]
33737        pub silence_duration_ms: Option<i64>,
33738    }
33739    #[allow(clippy::module_inception)]
33740    pub mod tools {
33741        #[allow(clippy::module_inception)]
33742        pub mod item {
33743            #[doc = "The type of the tool, i.e. `function`."]
33744            #[derive(Clone, Copy, Debug, Default, PartialEq)]
33745            pub struct Type;
33746            impl_serde!(Type, "function");
33747        }
33748        #[derive(Clone, Debug, Default, PartialEq)]
33749        #[serde_with::serde_as]
33750        #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
33751        pub struct Item {
33752            #[doc = "The type of the tool, i.e. `function`."]
33753            #[serde(rename = "type")]
33754            #[serde(skip_serializing_if = "Option::is_none")]
33755            #[builder(default)]
33756            pub r#type: Option<crate::__types::realtime_session_create_response::tools::item::Type>,
33757            #[doc = "The name of the function."]
33758            #[serde(rename = "name")]
33759            #[serde(skip_serializing_if = "Option::is_none")]
33760            #[builder(default)]
33761            pub name: Option<String>,
33762            #[doc = "The description of the function, including guidance on when and how\nto call it, and guidance about what to tell the user when calling\n(if anything).\n"]
33763            #[serde(rename = "description")]
33764            #[serde(skip_serializing_if = "Option::is_none")]
33765            #[builder(default)]
33766            pub description: Option<String>,
33767            #[doc = "Parameters of the function in JSON Schema."]
33768            #[serde(rename = "parameters")]
33769            #[serde(skip_serializing_if = "Option::is_none")]
33770            #[builder(default)]
33771            pub parameters: Option<indexmap::IndexMap<String, serde_json::Value>>,
33772        }
33773    }
33774    #[allow(clippy::module_inception)]
33775    pub(crate) mod max_response_output_tokens {
33776        #[doc = "inf"]
33777        #[derive(Clone, Copy, Debug, Default, PartialEq)]
33778        pub(crate) struct Inf;
33779        impl_serde!(Inf, "inf");
33780    }
33781    #[doc = "Maximum number of output tokens for a single assistant response,\ninclusive of tool calls. Provide an integer between 1 and 4096 to\nlimit output tokens, or `inf` for the maximum available tokens for a\ngiven model. Defaults to `inf`.\n"]
33782    #[derive(Clone, Copy, Debug, PartialEq)]
33783    #[allow(clippy::large_enum_variant)]
33784    pub enum MaxResponseOutputTokens {
33785        Integer(i64),
33786        #[doc = "inf"]
33787        Inf,
33788    }
33789    impl<'de> serde::Deserialize<'de> for MaxResponseOutputTokens {
33790        fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
33791        where
33792            D: serde::Deserializer<'de>,
33793        {
33794            #[serde_with::serde_as]
33795            #[derive(serde :: Deserialize)]
33796            #[serde(untagged)]
33797            #[allow(clippy::enum_variant_names, clippy::large_enum_variant)]
33798            enum MaxResponseOutputTokens {
33799                Inf (crate :: __types :: realtime_session_create_response :: max_response_output_tokens :: Inf) , Integer (i64) }
33800            Ok(match MaxResponseOutputTokens::deserialize(deserializer)? {
33801                MaxResponseOutputTokens::Integer(v) => Self::Integer(v),
33802                MaxResponseOutputTokens::Inf(_) => Self::Inf,
33803            })
33804        }
33805    }
33806    impl serde::Serialize for MaxResponseOutputTokens {
33807        fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
33808        where
33809            S: serde::Serializer,
33810        {
33811            #[serde_with::serde_as]
33812            #[derive(serde :: Serialize)]
33813            #[serde(untagged)]
33814            #[allow(clippy::enum_variant_names)]
33815            enum MaxResponseOutputTokens<'a> {
33816                Integer (& 'a i64) , Inf (crate :: __types :: realtime_session_create_response :: max_response_output_tokens :: Inf) }
33817            match self {
33818                Self::Integer(v) => MaxResponseOutputTokens::Integer(v),
33819                Self::Inf => MaxResponseOutputTokens::Inf(Default::default()),
33820            }
33821            .serialize(serializer)
33822        }
33823    }
33824}
33825#[doc = "A new Realtime session configuration, with an ephemeral key. Default TTL\nfor keys is one minute.\n"]
33826#[derive(Clone, Debug, PartialEq)]
33827#[serde_with::serde_as]
33828#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
33829pub struct RealtimeSessionCreateResponse {
33830    #[doc = "Ephemeral key returned by the API."]
33831    #[serde(rename = "client_secret")]
33832    pub client_secret: crate::__types::realtime_session_create_response::ClientSecret,
33833    #[doc = "The set of modalities the model can respond with. To disable audio,\nset this to [\"text\"].\n"]
33834    #[serde(rename = "modalities")]
33835    #[serde(skip_serializing_if = "Option::is_none")]
33836    #[builder(default)]
33837    pub modalities: Option<Vec<crate::__types::realtime_session_create_response::modalities::Item>>,
33838    #[doc = "The default system instructions (i.e. system message) prepended to model\ncalls. This field allows the client to guide the model on desired\nresponses. The model can be instructed on response content and format,\n(e.g. \"be extremely succinct\", \"act friendly\", \"here are examples of good\nresponses\") and on audio behavior (e.g. \"talk quickly\", \"inject emotion\ninto your voice\", \"laugh frequently\"). The instructions are not guaranteed\nto be followed by the model, but they provide guidance to the model on the\ndesired behavior.\n\nNote that the server sets default instructions which will be used if this\nfield is not set and are visible in the `session.created` event at the\nstart of the session.\n"]
33839    #[serde(rename = "instructions")]
33840    #[serde(skip_serializing_if = "Option::is_none")]
33841    #[builder(default)]
33842    pub instructions: Option<String>,
33843    #[doc = "The voice the model uses to respond. Voice cannot be changed during the\nsession once the model has responded with audio at least once. Current\nvoice options are `alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`,\n`shimmer`, and `verse`.\n"]
33844    #[serde(rename = "voice")]
33845    #[serde(skip_serializing_if = "Option::is_none")]
33846    #[builder(default)]
33847    pub voice: Option<crate::__types::VoiceIdsShared>,
33848    #[doc = "The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`.\n"]
33849    #[serde(rename = "input_audio_format")]
33850    #[serde(skip_serializing_if = "Option::is_none")]
33851    #[builder(default)]
33852    pub input_audio_format: Option<String>,
33853    #[doc = "The format of output audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`.\n"]
33854    #[serde(rename = "output_audio_format")]
33855    #[serde(skip_serializing_if = "Option::is_none")]
33856    #[builder(default)]
33857    pub output_audio_format: Option<String>,
33858    #[doc = "Configuration for input audio transcription, defaults to off and can be\nset to `null` to turn off once on. Input audio transcription is not native\nto the model, since the model consumes audio directly. Transcription runs\nasynchronously and should be treated as rough guidance\nrather than the representation understood by the model.\n"]
33859    #[serde(rename = "input_audio_transcription")]
33860    #[serde(skip_serializing_if = "Option::is_none")]
33861    #[builder(default)]
33862    pub input_audio_transcription:
33863        Option<crate::__types::realtime_session_create_response::InputAudioTranscription>,
33864    #[doc = "The speed of the model's spoken response. 1.0 is the default speed. 0.25 is\nthe minimum speed. 1.5 is the maximum speed. This value can only be changed\nin between model turns, not while a response is in progress.\n"]
33865    #[serde(rename = "speed")]
33866    #[serde(skip_serializing_if = "Option::is_none")]
33867    #[builder(default)]
33868    pub speed: Option<serde_json::Number>,
33869    #[doc = "Configuration options for tracing. Set to null to disable tracing. Once\ntracing is enabled for a session, the configuration cannot be modified.\n\n`auto` will create a trace for the session with default values for the\nworkflow name, group id, and metadata.\n"]
33870    #[serde(rename = "tracing")]
33871    #[serde(skip_serializing_if = "Option::is_none")]
33872    #[builder(default)]
33873    pub tracing: Option<crate::__types::realtime_session_create_response::Tracing>,
33874    #[doc = "Configuration for turn detection. Can be set to `null` to turn off. Server\nVAD means that the model will detect the start and end of speech based on\naudio volume and respond at the end of user speech.\n"]
33875    #[serde(rename = "turn_detection")]
33876    #[serde(skip_serializing_if = "Option::is_none")]
33877    #[builder(default)]
33878    pub turn_detection: Option<crate::__types::realtime_session_create_response::TurnDetection>,
33879    #[doc = "Tools (functions) available to the model."]
33880    #[serde(rename = "tools")]
33881    #[serde(skip_serializing_if = "Option::is_none")]
33882    #[builder(default)]
33883    pub tools: Option<Vec<crate::__types::realtime_session_create_response::tools::Item>>,
33884    #[doc = "How the model chooses tools. Options are `auto`, `none`, `required`, or\nspecify a function.\n"]
33885    #[serde(rename = "tool_choice")]
33886    #[serde(skip_serializing_if = "Option::is_none")]
33887    #[builder(default)]
33888    pub tool_choice: Option<String>,
33889    #[doc = "Sampling temperature for the model, limited to [0.6, 1.2]. Defaults to 0.8.\n"]
33890    #[serde(rename = "temperature")]
33891    #[serde(skip_serializing_if = "Option::is_none")]
33892    #[builder(default)]
33893    pub temperature: Option<serde_json::Number>,
33894    #[doc = "Maximum number of output tokens for a single assistant response,\ninclusive of tool calls. Provide an integer between 1 and 4096 to\nlimit output tokens, or `inf` for the maximum available tokens for a\ngiven model. Defaults to `inf`.\n"]
33895    #[serde(rename = "max_response_output_tokens")]
33896    #[serde(skip_serializing_if = "Option::is_none")]
33897    #[builder(default)]
33898    pub max_response_output_tokens:
33899        Option<crate::__types::realtime_session_create_response::MaxResponseOutputTokens>,
33900}
33901#[allow(clippy::module_inception)]
33902pub mod realtime_transcription_session_create_request {
33903    #[allow(clippy::module_inception)]
33904    pub mod modalities {
33905        #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
33906        pub enum Item {
33907            #[doc = "`text`"]
33908            #[serde(rename = "text")]
33909            Text,
33910            #[doc = "`audio`"]
33911            #[serde(rename = "audio")]
33912            Audio,
33913        }
33914    }
33915    #[doc = "The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`.\nFor `pcm16`, input audio must be 16-bit PCM at a 24kHz sample rate,\nsingle channel (mono), and little-endian byte order.\n"]
33916    #[derive(Clone, Copy, Debug, Default, PartialEq, serde :: Deserialize, serde :: Serialize)]
33917    pub enum InputAudioFormat {
33918        #[doc = "`pcm16`"]
33919        #[default]
33920        #[serde(rename = "pcm16")]
33921        Pcm16,
33922        #[doc = "`g711_ulaw`"]
33923        #[serde(rename = "g711_ulaw")]
33924        G711Ulaw,
33925        #[doc = "`g711_alaw`"]
33926        #[serde(rename = "g711_alaw")]
33927        G711Alaw,
33928    }
33929    #[allow(clippy::module_inception)]
33930    pub mod input_audio_transcription {
33931        #[doc = "The model to use for transcription, current options are `gpt-4o-transcribe`, `gpt-4o-mini-transcribe`, and `whisper-1`.\n"]
33932        #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
33933        pub enum Model {
33934            #[doc = "`gpt-4o-transcribe`"]
33935            #[serde(rename = "gpt-4o-transcribe")]
33936            Gpt4oTranscribe,
33937            #[doc = "`gpt-4o-mini-transcribe`"]
33938            #[serde(rename = "gpt-4o-mini-transcribe")]
33939            Gpt4oMiniTranscribe,
33940            #[doc = "`whisper-1`"]
33941            #[serde(rename = "whisper-1")]
33942            Whisper1,
33943        }
33944    }
33945    #[doc = "Configuration for input audio transcription. The client can optionally set the language and prompt for transcription, these offer additional guidance to the transcription service.\n"]
33946    #[derive(Clone, Debug, Default, PartialEq)]
33947    #[serde_with::serde_as]
33948    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
33949    pub struct InputAudioTranscription { # [doc = "The model to use for transcription, current options are `gpt-4o-transcribe`, `gpt-4o-mini-transcribe`, and `whisper-1`.\n"] # [serde (rename = "model")] # [serde (skip_serializing_if = "Option::is_none")] # [builder (default)] pub model : Option < crate :: __types :: realtime_transcription_session_create_request :: input_audio_transcription :: Model > , # [doc = "The language of the input audio. Supplying the input language in\n[ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) (e.g. `en`) format\nwill improve accuracy and latency.\n"] # [serde (rename = "language")] # [serde (skip_serializing_if = "Option::is_none")] # [builder (default)] pub language : Option < String > , # [doc = "An optional text to guide the model's style or continue a previous audio\nsegment.\nFor `whisper-1`, the [prompt is a list of keywords](https://platform.openai.com/docs/guides/speech-to-text#prompting).\nFor `gpt-4o-transcribe` models, the prompt is a free text string, for example \"expect words related to technology\".\n"] # [serde (rename = "prompt")] # [serde (skip_serializing_if = "Option::is_none")] # [builder (default)] pub prompt : Option < String > }
33950    #[allow(clippy::module_inception)]
33951    pub mod turn_detection {
33952        #[doc = "Type of turn detection.\n"]
33953        #[derive(
33954            Clone, Copy, Debug, Default, PartialEq, serde :: Deserialize, serde :: Serialize,
33955        )]
33956        pub enum Type {
33957            #[doc = "`server_vad`"]
33958            #[default]
33959            #[serde(rename = "server_vad")]
33960            ServerVad,
33961            #[doc = "`semantic_vad`"]
33962            #[serde(rename = "semantic_vad")]
33963            SemanticVad,
33964        }
33965        #[doc = "Used only for `semantic_vad` mode. The eagerness of the model to respond. `low` will wait longer for the user to continue speaking, `high` will respond more quickly. `auto` is the default and is equivalent to `medium`.\n"]
33966        #[derive(
33967            Clone, Copy, Debug, Default, PartialEq, serde :: Deserialize, serde :: Serialize,
33968        )]
33969        pub enum Eagerness {
33970            #[doc = "`low`"]
33971            #[serde(rename = "low")]
33972            Low,
33973            #[doc = "`medium`"]
33974            #[serde(rename = "medium")]
33975            Medium,
33976            #[doc = "`high`"]
33977            #[serde(rename = "high")]
33978            High,
33979            #[doc = "`auto`"]
33980            #[default]
33981            #[serde(rename = "auto")]
33982            Auto,
33983        }
33984    }
33985    #[doc = "Configuration for turn detection, ether Server VAD or Semantic VAD. This can be set to `null` to turn off, in which case the client must manually trigger model response.\nServer VAD means that the model will detect the start and end of speech based on audio volume and respond at the end of user speech.\nSemantic VAD is more advanced and uses a turn detection model (in conjunction with VAD) to semantically estimate whether the user has finished speaking, then dynamically sets a timeout based on this probability. For example, if user audio trails off with \"uhhm\", the model will score a low probability of turn end and wait longer for the user to continue speaking. This can be useful for more natural conversations, but may have a higher latency.\n"]
33986    #[derive(Clone, Debug, Default, PartialEq)]
33987    #[serde_with::serde_as]
33988    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
33989    pub struct TurnDetection { # [doc = "Type of turn detection.\n"] # [serde (rename = "type")] # [serde (skip_serializing_if = "Option::is_none")] # [builder (default)] pub r#type : Option < crate :: __types :: realtime_transcription_session_create_request :: turn_detection :: Type > , # [doc = "Used only for `semantic_vad` mode. The eagerness of the model to respond. `low` will wait longer for the user to continue speaking, `high` will respond more quickly. `auto` is the default and is equivalent to `medium`.\n"] # [serde (rename = "eagerness")] # [serde (skip_serializing_if = "Option::is_none")] # [builder (default)] pub eagerness : Option < crate :: __types :: realtime_transcription_session_create_request :: turn_detection :: Eagerness > , # [doc = "Used only for `server_vad` mode. Activation threshold for VAD (0.0 to 1.0), this defaults to 0.5. A\nhigher threshold will require louder audio to activate the model, and\nthus might perform better in noisy environments.\n"] # [serde (rename = "threshold")] # [serde (skip_serializing_if = "Option::is_none")] # [builder (default)] pub threshold : Option < serde_json :: Number > , # [doc = "Used only for `server_vad` mode. Amount of audio to include before the VAD detected speech (in\nmilliseconds). Defaults to 300ms.\n"] # [serde (rename = "prefix_padding_ms")] # [serde (skip_serializing_if = "Option::is_none")] # [builder (default)] pub prefix_padding_ms : Option < i64 > , # [doc = "Used only for `server_vad` mode. Duration of silence to detect speech stop (in milliseconds). Defaults\nto 500ms. With shorter values the model will respond more quickly,\nbut may jump in on short pauses from the user.\n"] # [serde (rename = "silence_duration_ms")] # [serde (skip_serializing_if = "Option::is_none")] # [builder (default)] pub silence_duration_ms : Option < i64 > , # [doc = "Whether or not to automatically generate a response when a VAD stop event occurs. Not available for transcription sessions.\n"] # [serde (rename = "create_response")] # [serde (skip_serializing_if = "Option::is_none")] # [builder (default)] pub create_response : Option < bool > , # [doc = "Whether or not to automatically interrupt any ongoing response with output to the default\nconversation (i.e. `conversation` of `auto`) when a VAD start event occurs. Not available for transcription sessions.\n"] # [serde (rename = "interrupt_response")] # [serde (skip_serializing_if = "Option::is_none")] # [builder (default)] pub interrupt_response : Option < bool > }
33990    #[allow(clippy::module_inception)]
33991    pub mod input_audio_noise_reduction {
33992        #[doc = "Type of noise reduction. `near_field` is for close-talking microphones such as headphones, `far_field` is for far-field microphones such as laptop or conference room microphones.\n"]
33993        #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
33994        pub enum Type {
33995            #[doc = "`near_field`"]
33996            #[serde(rename = "near_field")]
33997            NearField,
33998            #[doc = "`far_field`"]
33999            #[serde(rename = "far_field")]
34000            FarField,
34001        }
34002    }
34003    #[doc = "Configuration for input audio noise reduction. This can be set to `null` to turn off.\nNoise reduction filters audio added to the input audio buffer before it is sent to VAD and the model.\nFiltering the audio can improve VAD and turn detection accuracy (reducing false positives) and model performance by improving perception of the input audio.\n"]
34004    #[derive(Clone, Copy, Debug, Default, PartialEq)]
34005    #[serde_with::serde_as]
34006    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
34007    pub struct InputAudioNoiseReduction { # [doc = "Type of noise reduction. `near_field` is for close-talking microphones such as headphones, `far_field` is for far-field microphones such as laptop or conference room microphones.\n"] # [serde (rename = "type")] # [serde (skip_serializing_if = "Option::is_none")] # [builder (default)] pub r#type : Option < crate :: __types :: realtime_transcription_session_create_request :: input_audio_noise_reduction :: Type > }
34008    #[allow(clippy::module_inception)]
34009    pub mod client_secret {
34010        #[allow(clippy::module_inception)]
34011        pub mod expires_at {
34012            #[doc = "The anchor point for the ephemeral token expiration. Only `created_at` is currently supported.\n"]
34013            #[derive(
34014                Clone, Copy, Debug, Default, PartialEq, serde :: Deserialize, serde :: Serialize,
34015            )]
34016            pub enum Anchor {
34017                #[doc = "`created_at`"]
34018                #[default]
34019                #[serde(rename = "created_at")]
34020                CreatedAt,
34021            }
34022        }
34023        #[doc = "Configuration for the ephemeral token expiration.\n"]
34024        #[derive(Clone, Copy, Debug, Default, PartialEq)]
34025        #[serde_with::serde_as]
34026        #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
34027        pub struct ExpiresAt { # [doc = "The anchor point for the ephemeral token expiration. Only `created_at` is currently supported.\n"] # [serde (rename = "anchor")] # [serde (skip_serializing_if = "Option::is_none")] # [builder (default)] pub anchor : Option < crate :: __types :: realtime_transcription_session_create_request :: client_secret :: expires_at :: Anchor > , # [doc = "The number of seconds from the anchor point to the expiration. Select a value between `10` and `7200`.\n"] # [serde (rename = "seconds")] # [serde (skip_serializing_if = "Option::is_none")] # [builder (default)] pub seconds : Option < i64 > }
34028    }
34029    #[doc = "Configuration options for the generated client secret.\n"]
34030    #[derive(Clone, Copy, Debug, Default, PartialEq)]
34031    #[serde_with::serde_as]
34032    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
34033    pub struct ClientSecret {
34034        #[doc = "Configuration for the ephemeral token expiration.\n"]
34035        #[serde(rename = "expires_at")]
34036        #[serde(skip_serializing_if = "Option::is_none")]
34037        #[builder(default)]
34038        pub expires_at: Option<
34039            crate::__types::realtime_transcription_session_create_request::client_secret::ExpiresAt,
34040        >,
34041    }
34042}
34043#[doc = "Realtime transcription session object configuration."]
34044#[derive(Clone, Debug, Default, PartialEq)]
34045#[serde_with::serde_as]
34046#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
34047pub struct RealtimeTranscriptionSessionCreateRequest {
34048    #[doc = "The set of modalities the model can respond with. To disable audio,\nset this to [\"text\"].\n"]
34049    #[serde(rename = "modalities")]
34050    #[serde(skip_serializing_if = "Option::is_none")]
34051    #[builder(default)]
34052    pub modalities: Option<
34053        Vec<crate::__types::realtime_transcription_session_create_request::modalities::Item>,
34054    >,
34055    #[doc = "The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`.\nFor `pcm16`, input audio must be 16-bit PCM at a 24kHz sample rate,\nsingle channel (mono), and little-endian byte order.\n"]
34056    #[serde(rename = "input_audio_format")]
34057    #[serde(skip_serializing_if = "Option::is_none")]
34058    #[builder(default)]
34059    pub input_audio_format:
34060        Option<crate::__types::realtime_transcription_session_create_request::InputAudioFormat>,
34061    #[doc = "Configuration for input audio transcription. The client can optionally set the language and prompt for transcription, these offer additional guidance to the transcription service.\n"]
34062    #[serde(rename = "input_audio_transcription")]
34063    #[serde(skip_serializing_if = "Option::is_none")]
34064    #[builder(default)]
34065    pub input_audio_transcription: Option<
34066        crate::__types::realtime_transcription_session_create_request::InputAudioTranscription,
34067    >,
34068    #[doc = "Configuration for turn detection, ether Server VAD or Semantic VAD. This can be set to `null` to turn off, in which case the client must manually trigger model response.\nServer VAD means that the model will detect the start and end of speech based on audio volume and respond at the end of user speech.\nSemantic VAD is more advanced and uses a turn detection model (in conjunction with VAD) to semantically estimate whether the user has finished speaking, then dynamically sets a timeout based on this probability. For example, if user audio trails off with \"uhhm\", the model will score a low probability of turn end and wait longer for the user to continue speaking. This can be useful for more natural conversations, but may have a higher latency.\n"]
34069    #[serde(rename = "turn_detection")]
34070    #[serde(skip_serializing_if = "Option::is_none")]
34071    #[builder(default)]
34072    pub turn_detection:
34073        Option<crate::__types::realtime_transcription_session_create_request::TurnDetection>,
34074    #[doc = "Configuration for input audio noise reduction. This can be set to `null` to turn off.\nNoise reduction filters audio added to the input audio buffer before it is sent to VAD and the model.\nFiltering the audio can improve VAD and turn detection accuracy (reducing false positives) and model performance by improving perception of the input audio.\n"]
34075    #[serde(rename = "input_audio_noise_reduction")]
34076    #[serde(skip_serializing_if = "Option::is_none")]
34077    #[builder(default)]
34078    pub input_audio_noise_reduction: Option<
34079        crate::__types::realtime_transcription_session_create_request::InputAudioNoiseReduction,
34080    >,
34081    #[doc = "The set of items to include in the transcription. Current available items are:\n- `item.input_audio_transcription.logprobs`\n"]
34082    #[serde(rename = "include")]
34083    #[serde(skip_serializing_if = "Option::is_none")]
34084    #[builder(default)]
34085    pub include: Option<Vec<String>>,
34086    #[doc = "Configuration options for the generated client secret.\n"]
34087    #[serde(rename = "client_secret")]
34088    #[serde(skip_serializing_if = "Option::is_none")]
34089    #[builder(default)]
34090    pub client_secret:
34091        Option<crate::__types::realtime_transcription_session_create_request::ClientSecret>,
34092}
34093#[allow(clippy::module_inception)]
34094pub mod realtime_transcription_session_create_response {
34095    #[doc = "Ephemeral key returned by the API. Only present when the session is\ncreated on the server via REST API.\n"]
34096    #[derive(Clone, Debug, PartialEq)]
34097    #[serde_with::serde_as]
34098    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
34099    pub struct ClientSecret {
34100        #[doc = "Ephemeral key usable in client environments to authenticate connections\nto the Realtime API. Use this in client-side environments rather than\na standard API token, which should only be used server-side.\n"]
34101        #[serde(rename = "value")]
34102        pub value: String,
34103        #[doc = "Timestamp for when the token expires. Currently, all tokens expire\nafter one minute.\n"]
34104        #[serde(rename = "expires_at")]
34105        pub expires_at: i64,
34106    }
34107    #[allow(clippy::module_inception)]
34108    pub mod modalities {
34109        #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
34110        pub enum Item {
34111            #[doc = "`text`"]
34112            #[serde(rename = "text")]
34113            Text,
34114            #[doc = "`audio`"]
34115            #[serde(rename = "audio")]
34116            Audio,
34117        }
34118    }
34119    #[allow(clippy::module_inception)]
34120    pub mod input_audio_transcription {
34121        #[doc = "The model to use for transcription. Can be `gpt-4o-transcribe`, `gpt-4o-mini-transcribe`, or `whisper-1`.\n"]
34122        #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
34123        pub enum Model {
34124            #[doc = "`gpt-4o-transcribe`"]
34125            #[serde(rename = "gpt-4o-transcribe")]
34126            Gpt4oTranscribe,
34127            #[doc = "`gpt-4o-mini-transcribe`"]
34128            #[serde(rename = "gpt-4o-mini-transcribe")]
34129            Gpt4oMiniTranscribe,
34130            #[doc = "`whisper-1`"]
34131            #[serde(rename = "whisper-1")]
34132            Whisper1,
34133        }
34134    }
34135    #[doc = "Configuration of the transcription model.\n"]
34136    #[derive(Clone, Debug, Default, PartialEq)]
34137    #[serde_with::serde_as]
34138    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
34139    pub struct InputAudioTranscription { # [doc = "The model to use for transcription. Can be `gpt-4o-transcribe`, `gpt-4o-mini-transcribe`, or `whisper-1`.\n"] # [serde (rename = "model")] # [serde (skip_serializing_if = "Option::is_none")] # [builder (default)] pub model : Option < crate :: __types :: realtime_transcription_session_create_response :: input_audio_transcription :: Model > , # [doc = "The language of the input audio. Supplying the input language in\n[ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) (e.g. `en`) format\nwill improve accuracy and latency.\n"] # [serde (rename = "language")] # [serde (skip_serializing_if = "Option::is_none")] # [builder (default)] pub language : Option < String > , # [doc = "An optional text to guide the model's style or continue a previous audio\nsegment. The [prompt](https://platform.openai.com/docs/guides/speech-to-text#prompting) should match\nthe audio language.\n"] # [serde (rename = "prompt")] # [serde (skip_serializing_if = "Option::is_none")] # [builder (default)] pub prompt : Option < String > }
34140    #[doc = "Configuration for turn detection. Can be set to `null` to turn off. Server \nVAD means that the model will detect the start and end of speech based on \naudio volume and respond at the end of user speech.\n"]
34141    #[derive(Clone, Debug, Default, PartialEq)]
34142    #[serde_with::serde_as]
34143    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
34144    pub struct TurnDetection {
34145        #[doc = "Type of turn detection, only `server_vad` is currently supported.\n"]
34146        #[serde(rename = "type")]
34147        #[serde(skip_serializing_if = "Option::is_none")]
34148        #[builder(default)]
34149        pub r#type: Option<String>,
34150        #[doc = "Activation threshold for VAD (0.0 to 1.0), this defaults to 0.5. A \nhigher threshold will require louder audio to activate the model, and \nthus might perform better in noisy environments.\n"]
34151        #[serde(rename = "threshold")]
34152        #[serde(skip_serializing_if = "Option::is_none")]
34153        #[builder(default)]
34154        pub threshold: Option<serde_json::Number>,
34155        #[doc = "Amount of audio to include before the VAD detected speech (in \nmilliseconds). Defaults to 300ms.\n"]
34156        #[serde(rename = "prefix_padding_ms")]
34157        #[serde(skip_serializing_if = "Option::is_none")]
34158        #[builder(default)]
34159        pub prefix_padding_ms: Option<i64>,
34160        #[doc = "Duration of silence to detect speech stop (in milliseconds). Defaults \nto 500ms. With shorter values the model will respond more quickly, \nbut may jump in on short pauses from the user.\n"]
34161        #[serde(rename = "silence_duration_ms")]
34162        #[serde(skip_serializing_if = "Option::is_none")]
34163        #[builder(default)]
34164        pub silence_duration_ms: Option<i64>,
34165    }
34166}
34167#[doc = "A new Realtime transcription session configuration.\n\nWhen a session is created on the server via REST API, the session object\nalso contains an ephemeral key. Default TTL for keys is 10 minutes. This \nproperty is not present when a session is updated via the WebSocket API.\n"]
34168#[derive(Clone, Debug, PartialEq)]
34169#[serde_with::serde_as]
34170#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
34171pub struct RealtimeTranscriptionSessionCreateResponse {
34172    #[doc = "Ephemeral key returned by the API. Only present when the session is\ncreated on the server via REST API.\n"]
34173    #[serde(rename = "client_secret")]
34174    pub client_secret: crate::__types::realtime_transcription_session_create_response::ClientSecret,
34175    #[doc = "The set of modalities the model can respond with. To disable audio,\nset this to [\"text\"].\n"]
34176    #[serde(rename = "modalities")]
34177    #[serde(skip_serializing_if = "Option::is_none")]
34178    #[builder(default)]
34179    pub modalities: Option<
34180        Vec<crate::__types::realtime_transcription_session_create_response::modalities::Item>,
34181    >,
34182    #[doc = "The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`.\n"]
34183    #[serde(rename = "input_audio_format")]
34184    #[serde(skip_serializing_if = "Option::is_none")]
34185    #[builder(default)]
34186    pub input_audio_format: Option<String>,
34187    #[doc = "Configuration of the transcription model.\n"]
34188    #[serde(rename = "input_audio_transcription")]
34189    #[serde(skip_serializing_if = "Option::is_none")]
34190    #[builder(default)]
34191    pub input_audio_transcription: Option<
34192        crate::__types::realtime_transcription_session_create_response::InputAudioTranscription,
34193    >,
34194    #[doc = "Configuration for turn detection. Can be set to `null` to turn off. Server \nVAD means that the model will detect the start and end of speech based on \naudio volume and respond at the end of user speech.\n"]
34195    #[serde(rename = "turn_detection")]
34196    #[serde(skip_serializing_if = "Option::is_none")]
34197    #[builder(default)]
34198    pub turn_detection:
34199        Option<crate::__types::realtime_transcription_session_create_response::TurnDetection>,
34200}
34201#[allow(clippy::module_inception)]
34202pub mod reasoning {
34203    #[doc = "A summary of the reasoning performed by the model. This can be\nuseful for debugging and understanding the model's reasoning process.\nOne of `auto`, `concise`, or `detailed`.\n"]
34204    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
34205    pub enum Summary {
34206        #[doc = "`auto`"]
34207        #[serde(rename = "auto")]
34208        Auto,
34209        #[doc = "`concise`"]
34210        #[serde(rename = "concise")]
34211        Concise,
34212        #[doc = "`detailed`"]
34213        #[serde(rename = "detailed")]
34214        Detailed,
34215    }
34216    #[doc = "**Deprecated:** use `summary` instead.\n\nA summary of the reasoning performed by the model. This can be\nuseful for debugging and understanding the model's reasoning process.\nOne of `auto`, `concise`, or `detailed`.\n"]
34217    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
34218    pub enum GenerateSummary {
34219        #[doc = "`auto`"]
34220        #[serde(rename = "auto")]
34221        Auto,
34222        #[doc = "`concise`"]
34223        #[serde(rename = "concise")]
34224        Concise,
34225        #[doc = "`detailed`"]
34226        #[serde(rename = "detailed")]
34227        Detailed,
34228    }
34229}
34230#[doc = "**gpt-5 and o-series models only**\n\nConfiguration options for\n[reasoning models](https://platform.openai.com/docs/guides/reasoning).\n"]
34231#[derive(Clone, Copy, Debug, Default, PartialEq)]
34232#[serde_with::serde_as]
34233#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
34234pub struct Reasoning {
34235    #[serde(rename = "effort")]
34236    #[serde(skip_serializing_if = "Option::is_none")]
34237    #[builder(default)]
34238    pub effort: Option<crate::__types::ReasoningEffort>,
34239    #[doc = "A summary of the reasoning performed by the model. This can be\nuseful for debugging and understanding the model's reasoning process.\nOne of `auto`, `concise`, or `detailed`.\n"]
34240    #[serde(rename = "summary")]
34241    #[serde(skip_serializing_if = "Option::is_none")]
34242    #[builder(default)]
34243    pub summary: Option<crate::__types::reasoning::Summary>,
34244    #[doc = "**Deprecated:** use `summary` instead.\n\nA summary of the reasoning performed by the model. This can be\nuseful for debugging and understanding the model's reasoning process.\nOne of `auto`, `concise`, or `detailed`.\n"]
34245    #[serde(rename = "generate_summary")]
34246    #[serde(skip_serializing_if = "Option::is_none")]
34247    #[builder(default)]
34248    pub generate_summary: Option<crate::__types::reasoning::GenerateSummary>,
34249}
34250#[doc = "Constrains effort on reasoning for \n[reasoning models](https://platform.openai.com/docs/guides/reasoning).\nCurrently supported values are `minimal`, `low`, `medium`, and `high`. Reducing\nreasoning effort can result in faster responses and fewer tokens used\non reasoning in a response.\n"]
34251#[derive(Clone, Copy, Debug, Default, PartialEq, serde :: Deserialize, serde :: Serialize)]
34252pub enum ReasoningEffort {
34253    #[doc = "`minimal`"]
34254    #[serde(rename = "minimal")]
34255    Minimal,
34256    #[doc = "`low`"]
34257    #[serde(rename = "low")]
34258    Low,
34259    #[doc = "`medium`"]
34260    #[default]
34261    #[serde(rename = "medium")]
34262    Medium,
34263    #[doc = "`high`"]
34264    #[serde(rename = "high")]
34265    High,
34266}
34267#[allow(clippy::module_inception)]
34268pub mod reasoning_item {
34269    #[doc = "The type of the object. Always `reasoning`.\n"]
34270    #[derive(Clone, Copy, Debug, Default, PartialEq)]
34271    pub(crate) struct Type;
34272    impl_serde!(Type, "reasoning");
34273    #[allow(clippy::module_inception)]
34274    pub mod summary {
34275        #[allow(clippy::module_inception)]
34276        pub(crate) mod item {
34277            #[doc = "The type of the object. Always `summary_text`.\n"]
34278            #[derive(Clone, Copy, Debug, Default, PartialEq)]
34279            pub(crate) struct Type;
34280            impl_serde!(Type, "summary_text");
34281        }
34282        #[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
34283        pub struct Item {
34284            #[doc = "A summary of the reasoning output from the model so far.\n"]
34285            pub text: String,
34286        }
34287        impl<'de> serde::Deserialize<'de> for Item {
34288            fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
34289            where
34290                D: serde::Deserializer<'de>,
34291            {
34292                #[serde_with::serde_as]
34293                #[derive(serde :: Deserialize)]
34294                struct Item {
34295                    #[serde(rename = "type")]
34296                    #[allow(dead_code)]
34297                    r#type: crate::__types::reasoning_item::summary::item::Type,
34298                    #[serde(rename = "text")]
34299                    text: String,
34300                }
34301                let Item { text, .. } = Item::deserialize(deserializer)?;
34302                Ok(Self { text })
34303            }
34304        }
34305        impl serde::Serialize for Item {
34306            fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
34307            where
34308                S: serde::Serializer,
34309            {
34310                #[serde_with::serde_as]
34311                #[derive(serde :: Serialize)]
34312                struct Item<'a> {
34313                    #[serde(rename = "type")]
34314                    r#type: &'a crate::__types::reasoning_item::summary::item::Type,
34315                    #[serde(rename = "text")]
34316                    text: &'a String,
34317                }
34318                let Self { text } = self;
34319                Item {
34320                    r#type: &Default::default(),
34321                    text,
34322                }
34323                .serialize(serializer)
34324            }
34325        }
34326    }
34327    #[allow(clippy::module_inception)]
34328    pub mod content {
34329        #[allow(clippy::module_inception)]
34330        pub(crate) mod item {
34331            #[doc = "The type of the object. Always `reasoning_text`.\n"]
34332            #[derive(Clone, Copy, Debug, Default, PartialEq)]
34333            pub(crate) struct Type;
34334            impl_serde!(Type, "reasoning_text");
34335        }
34336        #[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
34337        pub struct Item {
34338            #[doc = "Reasoning text output from the model.\n"]
34339            pub text: String,
34340        }
34341        impl<'de> serde::Deserialize<'de> for Item {
34342            fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
34343            where
34344                D: serde::Deserializer<'de>,
34345            {
34346                #[serde_with::serde_as]
34347                #[derive(serde :: Deserialize)]
34348                struct Item {
34349                    #[serde(rename = "type")]
34350                    #[allow(dead_code)]
34351                    r#type: crate::__types::reasoning_item::content::item::Type,
34352                    #[serde(rename = "text")]
34353                    text: String,
34354                }
34355                let Item { text, .. } = Item::deserialize(deserializer)?;
34356                Ok(Self { text })
34357            }
34358        }
34359        impl serde::Serialize for Item {
34360            fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
34361            where
34362                S: serde::Serializer,
34363            {
34364                #[serde_with::serde_as]
34365                #[derive(serde :: Serialize)]
34366                struct Item<'a> {
34367                    #[serde(rename = "type")]
34368                    r#type: &'a crate::__types::reasoning_item::content::item::Type,
34369                    #[serde(rename = "text")]
34370                    text: &'a String,
34371                }
34372                let Self { text } = self;
34373                Item {
34374                    r#type: &Default::default(),
34375                    text,
34376                }
34377                .serialize(serializer)
34378            }
34379        }
34380    }
34381    #[doc = "The status of the item. One of `in_progress`, `completed`, or\n`incomplete`. Populated when items are returned via API.\n"]
34382    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
34383    pub enum Status {
34384        #[doc = "`in_progress`"]
34385        #[serde(rename = "in_progress")]
34386        InProgress,
34387        #[doc = "`completed`"]
34388        #[serde(rename = "completed")]
34389        Completed,
34390        #[doc = "`incomplete`"]
34391        #[serde(rename = "incomplete")]
34392        Incomplete,
34393    }
34394}
34395#[doc = "A description of the chain of thought used by a reasoning model while generating\na response. Be sure to include these items in your `input` to the Responses API\nfor subsequent turns of a conversation if you are manually \n[managing context](https://platform.openai.com/docs/guides/conversation-state).\n"]
34396#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
34397pub struct ReasoningItem {
34398    #[doc = "The unique identifier of the reasoning content.\n"]
34399    pub id: String,
34400    #[doc = "The encrypted content of the reasoning item - populated when a response is\ngenerated with `reasoning.encrypted_content` in the `include` parameter.\n"]
34401    #[builder(default)]
34402    pub encrypted_content: Option<String>,
34403    #[doc = "Reasoning summary content.\n"]
34404    pub summary: Vec<crate::__types::reasoning_item::summary::Item>,
34405    #[doc = "Reasoning text content.\n"]
34406    #[builder(default)]
34407    pub content: Option<Vec<crate::__types::reasoning_item::content::Item>>,
34408    #[doc = "The status of the item. One of `in_progress`, `completed`, or\n`incomplete`. Populated when items are returned via API.\n"]
34409    #[builder(default)]
34410    pub status: Option<crate::__types::reasoning_item::Status>,
34411}
34412impl<'de> serde::Deserialize<'de> for ReasoningItem {
34413    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
34414    where
34415        D: serde::Deserializer<'de>,
34416    {
34417        #[serde_with::serde_as]
34418        #[derive(serde :: Deserialize)]
34419        struct ReasoningItem {
34420            #[serde(rename = "type")]
34421            #[allow(dead_code)]
34422            r#type: crate::__types::reasoning_item::Type,
34423            #[serde(rename = "id")]
34424            id: String,
34425            #[serde(rename = "encrypted_content")]
34426            encrypted_content: Option<String>,
34427            #[serde(rename = "summary")]
34428            summary: Vec<crate::__types::reasoning_item::summary::Item>,
34429            #[serde(rename = "content")]
34430            content: Option<Vec<crate::__types::reasoning_item::content::Item>>,
34431            #[serde(rename = "status")]
34432            status: Option<crate::__types::reasoning_item::Status>,
34433        }
34434        let ReasoningItem {
34435            id,
34436            encrypted_content,
34437            summary,
34438            content,
34439            status,
34440            ..
34441        } = ReasoningItem::deserialize(deserializer)?;
34442        Ok(Self {
34443            id,
34444            encrypted_content,
34445            summary,
34446            content,
34447            status,
34448        })
34449    }
34450}
34451impl serde::Serialize for ReasoningItem {
34452    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
34453    where
34454        S: serde::Serializer,
34455    {
34456        #[serde_with::serde_as]
34457        #[derive(serde :: Serialize)]
34458        struct ReasoningItem<'a> {
34459            #[serde(rename = "type")]
34460            r#type: &'a crate::__types::reasoning_item::Type,
34461            #[serde(rename = "id")]
34462            id: &'a String,
34463            #[serde(rename = "encrypted_content")]
34464            #[serde(skip_serializing_if = "Option::is_none")]
34465            encrypted_content: &'a Option<String>,
34466            #[serde(rename = "summary")]
34467            summary: &'a Vec<crate::__types::reasoning_item::summary::Item>,
34468            #[serde(rename = "content")]
34469            #[serde(skip_serializing_if = "Option::is_none")]
34470            content: &'a Option<Vec<crate::__types::reasoning_item::content::Item>>,
34471            #[serde(rename = "status")]
34472            #[serde(skip_serializing_if = "Option::is_none")]
34473            status: &'a Option<crate::__types::reasoning_item::Status>,
34474        }
34475        let Self {
34476            id,
34477            encrypted_content,
34478            summary,
34479            content,
34480            status,
34481        } = self;
34482        ReasoningItem {
34483            r#type: &Default::default(),
34484            id,
34485            encrypted_content,
34486            summary,
34487            content,
34488            status,
34489        }
34490        .serialize(serializer)
34491    }
34492}
34493#[allow(clippy::module_inception)]
34494pub mod response {
34495    #[doc = "Configuration options for a text response from the model. Can be plain\ntext or structured JSON data. Learn more:\n- [Text inputs and outputs](https://platform.openai.com/docs/guides/text)\n- [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs)\n"]
34496    #[derive(Clone, Debug, Default, PartialEq)]
34497    #[serde_with::serde_as]
34498    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
34499    pub struct Text {
34500        #[serde(rename = "format")]
34501        #[serde(skip_serializing_if = "Option::is_none")]
34502        #[builder(default)]
34503        pub format: Option<crate::__types::TextResponseFormatConfiguration>,
34504        #[serde(rename = "verbosity")]
34505        #[serde(skip_serializing_if = "Option::is_none")]
34506        #[builder(default)]
34507        pub verbosity: Option<crate::__types::Verbosity>,
34508    }
34509    #[doc = "How the model should select which tool (or tools) to use when generating\na response. See the `tools` parameter to see how to specify which tools\nthe model can call.\n"]
34510    #[derive(Clone, Debug, PartialEq)]
34511    #[allow(clippy::large_enum_variant)]
34512    pub enum ToolChoice {
34513        ToolChoiceOptions(crate::__types::ToolChoiceOptions),
34514        ToolChoiceAllowed(crate::__types::ToolChoiceAllowed),
34515        ToolChoiceTypes(crate::__types::ToolChoiceTypes),
34516        ToolChoiceFunction(crate::__types::ToolChoiceFunction),
34517        ToolChoiceMcp(crate::__types::ToolChoiceMcp),
34518        ToolChoiceCustom(crate::__types::ToolChoiceCustom),
34519    }
34520    impl<'de> serde::Deserialize<'de> for ToolChoice {
34521        fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
34522        where
34523            D: serde::Deserializer<'de>,
34524        {
34525            #[serde_with::serde_as]
34526            #[derive(serde :: Deserialize)]
34527            #[serde(untagged)]
34528            #[allow(clippy::enum_variant_names, clippy::large_enum_variant)]
34529            enum ToolChoice {
34530                ToolChoiceOptions(crate::__types::ToolChoiceOptions),
34531                ToolChoiceAllowed(crate::__types::ToolChoiceAllowed),
34532                ToolChoiceTypes(crate::__types::ToolChoiceTypes),
34533                ToolChoiceFunction(crate::__types::ToolChoiceFunction),
34534                ToolChoiceMcp(crate::__types::ToolChoiceMcp),
34535                ToolChoiceCustom(crate::__types::ToolChoiceCustom),
34536            }
34537            Ok(match ToolChoice::deserialize(deserializer)? {
34538                ToolChoice::ToolChoiceOptions(v) => Self::ToolChoiceOptions(v),
34539                ToolChoice::ToolChoiceAllowed(v) => Self::ToolChoiceAllowed(v),
34540                ToolChoice::ToolChoiceTypes(v) => Self::ToolChoiceTypes(v),
34541                ToolChoice::ToolChoiceFunction(v) => Self::ToolChoiceFunction(v),
34542                ToolChoice::ToolChoiceMcp(v) => Self::ToolChoiceMcp(v),
34543                ToolChoice::ToolChoiceCustom(v) => Self::ToolChoiceCustom(v),
34544            })
34545        }
34546    }
34547    impl serde::Serialize for ToolChoice {
34548        fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
34549        where
34550            S: serde::Serializer,
34551        {
34552            #[serde_with::serde_as]
34553            #[derive(serde :: Serialize)]
34554            #[serde(untagged)]
34555            #[allow(clippy::enum_variant_names)]
34556            enum ToolChoice<'a> {
34557                ToolChoiceOptions(&'a crate::__types::ToolChoiceOptions),
34558                ToolChoiceAllowed(&'a crate::__types::ToolChoiceAllowed),
34559                ToolChoiceTypes(&'a crate::__types::ToolChoiceTypes),
34560                ToolChoiceFunction(&'a crate::__types::ToolChoiceFunction),
34561                ToolChoiceMcp(&'a crate::__types::ToolChoiceMcp),
34562                ToolChoiceCustom(&'a crate::__types::ToolChoiceCustom),
34563            }
34564            match self {
34565                Self::ToolChoiceOptions(v) => ToolChoice::ToolChoiceOptions(v),
34566                Self::ToolChoiceAllowed(v) => ToolChoice::ToolChoiceAllowed(v),
34567                Self::ToolChoiceTypes(v) => ToolChoice::ToolChoiceTypes(v),
34568                Self::ToolChoiceFunction(v) => ToolChoice::ToolChoiceFunction(v),
34569                Self::ToolChoiceMcp(v) => ToolChoice::ToolChoiceMcp(v),
34570                Self::ToolChoiceCustom(v) => ToolChoice::ToolChoiceCustom(v),
34571            }
34572            .serialize(serializer)
34573        }
34574    }
34575    #[doc = "The truncation strategy to use for the model response.\n- `auto`: If the context of this response and previous ones exceeds\n  the model's context window size, the model will truncate the\n  response to fit the context window by dropping input items in the\n  middle of the conversation.\n- `disabled` (default): If a model response will exceed the context window\n  size for a model, the request will fail with a 400 error.\n"]
34576    #[derive(Clone, Copy, Debug, Default, PartialEq, serde :: Deserialize, serde :: Serialize)]
34577    pub enum Truncation {
34578        #[doc = "`auto`"]
34579        #[serde(rename = "auto")]
34580        Auto,
34581        #[doc = "`disabled`"]
34582        #[default]
34583        #[serde(rename = "disabled")]
34584        Disabled,
34585    }
34586    #[doc = "The object type of this resource - always set to `response`.\n"]
34587    #[derive(Clone, Copy, Debug, Default, PartialEq)]
34588    pub(crate) struct Object;
34589    impl_serde!(Object, "response");
34590    #[doc = "The status of the response generation. One of `completed`, `failed`,\n`in_progress`, `cancelled`, `queued`, or `incomplete`.\n"]
34591    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
34592    pub enum Status {
34593        #[doc = "`completed`"]
34594        #[serde(rename = "completed")]
34595        Completed,
34596        #[doc = "`failed`"]
34597        #[serde(rename = "failed")]
34598        Failed,
34599        #[doc = "`in_progress`"]
34600        #[serde(rename = "in_progress")]
34601        InProgress,
34602        #[doc = "`cancelled`"]
34603        #[serde(rename = "cancelled")]
34604        Cancelled,
34605        #[doc = "`queued`"]
34606        #[serde(rename = "queued")]
34607        Queued,
34608        #[doc = "`incomplete`"]
34609        #[serde(rename = "incomplete")]
34610        Incomplete,
34611    }
34612    #[allow(clippy::module_inception)]
34613    pub mod incomplete_details {
34614        #[doc = "The reason why the response is incomplete."]
34615        #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
34616        pub enum Reason {
34617            #[doc = "`max_output_tokens`"]
34618            #[serde(rename = "max_output_tokens")]
34619            MaxOutputTokens,
34620            #[doc = "`content_filter`"]
34621            #[serde(rename = "content_filter")]
34622            ContentFilter,
34623        }
34624    }
34625    #[doc = "Details about why the response is incomplete.\n"]
34626    #[derive(Clone, Copy, Debug, Default, PartialEq)]
34627    #[serde_with::serde_as]
34628    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
34629    pub struct IncompleteDetails {
34630        #[doc = "The reason why the response is incomplete."]
34631        #[serde(rename = "reason")]
34632        #[serde(skip_serializing_if = "Option::is_none")]
34633        #[builder(default)]
34634        pub reason: Option<crate::__types::response::incomplete_details::Reason>,
34635    }
34636    #[doc = "A system (or developer) message inserted into the model's context.\n\nWhen using along with `previous_response_id`, the instructions from a previous\nresponse will not be carried over to the next response. This makes it simple\nto swap out system (or developer) messages in new responses.\n"]
34637    #[derive(Clone, Debug, PartialEq)]
34638    #[serde_with::serde_as]
34639    #[derive(serde :: Deserialize, serde :: Serialize)]
34640    #[serde(untagged)]
34641    #[allow(clippy::large_enum_variant)]
34642    pub enum Instructions {
34643        #[doc = "A text input to the model, equivalent to a text input with the\n`developer` role.\n"]
34644        String(String),
34645        #[doc = "A list of one or many input items to the model, containing\ndifferent content types.\n"]
34646        Array(Vec<crate::__types::InputItem>),
34647    }
34648}
34649#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
34650pub struct Response {
34651    #[builder(default)]
34652    pub metadata: Option<crate::__types::Metadata>,
34653    #[doc = "An integer between 0 and 20 specifying the number of most likely tokens to\nreturn at each token position, each with an associated log probability.\n"]
34654    #[builder(default)]
34655    pub top_logprobs: Option<i64>,
34656    #[doc = "What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.\nWe generally recommend altering this or `top_p` but not both.\n"]
34657    pub temperature: serde_json::Number,
34658    #[doc = "An alternative to sampling with temperature, called nucleus sampling,\nwhere the model considers the results of the tokens with top_p probability\nmass. So 0.1 means only the tokens comprising the top 10% probability mass\nare considered.\n\nWe generally recommend altering this or `temperature` but not both.\n"]
34659    pub top_p: serde_json::Number,
34660    #[doc = "This field is being replaced by `safety_identifier` and `prompt_cache_key`. Use `prompt_cache_key` instead to maintain caching optimizations.\nA stable identifier for your end-users. \nUsed to boost cache hit rates by better bucketing similar requests and  to help OpenAI detect and prevent abuse. [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#safety-identifiers).\n"]
34661    #[builder(default)]
34662    pub user: Option<String>,
34663    #[doc = "A stable identifier used to help detect users of your application that may be violating OpenAI's usage policies. \nThe IDs should be a string that uniquely identifies each user. We recommend hashing their username or email address, in order to avoid sending us any identifying information. [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#safety-identifiers).\n"]
34664    #[builder(default)]
34665    pub safety_identifier: Option<String>,
34666    #[doc = "Used by OpenAI to cache responses for similar requests to optimize your cache hit rates. Replaces the `user` field. [Learn more](https://platform.openai.com/docs/guides/prompt-caching).\n"]
34667    #[builder(default)]
34668    pub prompt_cache_key: Option<String>,
34669    #[builder(default)]
34670    pub service_tier: Option<crate::__types::ServiceTier>,
34671    #[doc = "The unique ID of the previous response to the model. Use this to\ncreate multi-turn conversations. Learn more about\n[conversation state](https://platform.openai.com/docs/guides/conversation-state). Cannot be used in conjunction with `conversation`.\n"]
34672    #[builder(default)]
34673    pub previous_response_id: Option<String>,
34674    #[doc = "Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI\noffers a wide range of models with different capabilities, performance\ncharacteristics, and price points. Refer to the [model guide](https://platform.openai.com/docs/models)\nto browse and compare available models.\n"]
34675    pub model: crate::__types::ModelIdsResponses,
34676    #[builder(default)]
34677    pub reasoning: Option<crate::__types::Reasoning>,
34678    #[doc = "Whether to run the model response in the background.\n[Learn more](https://platform.openai.com/docs/guides/background).\n"]
34679    #[builder(default)]
34680    pub background: Option<bool>,
34681    #[doc = "An upper bound for the number of tokens that can be generated for a response, including visible output tokens and [reasoning tokens](https://platform.openai.com/docs/guides/reasoning).\n"]
34682    #[builder(default)]
34683    pub max_output_tokens: Option<i64>,
34684    #[doc = "The maximum number of total calls to built-in tools that can be processed in a response. This maximum number applies across all built-in tool calls, not per individual tool. Any further attempts to call a tool by the model will be ignored.\n"]
34685    #[builder(default)]
34686    pub max_tool_calls: Option<i64>,
34687    #[doc = "Configuration options for a text response from the model. Can be plain\ntext or structured JSON data. Learn more:\n- [Text inputs and outputs](https://platform.openai.com/docs/guides/text)\n- [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs)\n"]
34688    #[builder(default)]
34689    pub text: Option<crate::__types::response::Text>,
34690    #[doc = "An array of tools the model may call while generating a response. You\ncan specify which tool to use by setting the `tool_choice` parameter.\n\nThe two categories of tools you can provide the model are:\n\n- **Built-in tools**: Tools that are provided by OpenAI that extend the\n  model's capabilities, like [web search](https://platform.openai.com/docs/guides/tools-web-search)\n  or [file search](https://platform.openai.com/docs/guides/tools-file-search). Learn more about\n  [built-in tools](https://platform.openai.com/docs/guides/tools).\n- **Function calls (custom tools)**: Functions that are defined by you,\n  enabling the model to call your own code with strongly typed arguments\n  and outputs. Learn more about\n  [function calling](https://platform.openai.com/docs/guides/function-calling). You can also use\n  custom tools to call your own code.\n"]
34691    pub tools: Vec<crate::__types::Tool>,
34692    #[doc = "How the model should select which tool (or tools) to use when generating\na response. See the `tools` parameter to see how to specify which tools\nthe model can call.\n"]
34693    pub tool_choice: crate::__types::response::ToolChoice,
34694    #[builder(default)]
34695    pub prompt: Option<crate::__types::Prompt>,
34696    #[doc = "The truncation strategy to use for the model response.\n- `auto`: If the context of this response and previous ones exceeds\n  the model's context window size, the model will truncate the\n  response to fit the context window by dropping input items in the\n  middle of the conversation.\n- `disabled` (default): If a model response will exceed the context window\n  size for a model, the request will fail with a 400 error.\n"]
34697    #[builder(default)]
34698    pub truncation: Option<crate::__types::response::Truncation>,
34699    #[doc = "Unique identifier for this Response.\n"]
34700    pub id: String,
34701    #[doc = "The status of the response generation. One of `completed`, `failed`,\n`in_progress`, `cancelled`, `queued`, or `incomplete`.\n"]
34702    #[builder(default)]
34703    pub status: Option<crate::__types::response::Status>,
34704    #[doc = "Unix timestamp (in seconds) of when this Response was created.\n"]
34705    pub created_at: serde_json::Number,
34706    #[builder(default)]
34707    pub error: Option<crate::__types::ResponseError>,
34708    #[doc = "Details about why the response is incomplete.\n"]
34709    #[builder(default)]
34710    pub incomplete_details: Option<crate::__types::response::IncompleteDetails>,
34711    #[doc = "An array of content items generated by the model.\n\n- The length and order of items in the `output` array is dependent\n  on the model's response.\n- Rather than accessing the first item in the `output` array and\n  assuming it's an `assistant` message with the content generated by\n  the model, you might consider using the `output_text` property where\n  supported in SDKs.\n"]
34712    pub output: Vec<crate::__types::OutputItem>,
34713    #[doc = "A system (or developer) message inserted into the model's context.\n\nWhen using along with `previous_response_id`, the instructions from a previous\nresponse will not be carried over to the next response. This makes it simple\nto swap out system (or developer) messages in new responses.\n"]
34714    #[builder(default)]
34715    pub instructions: Option<crate::__types::response::Instructions>,
34716    #[doc = "SDK-only convenience property that contains the aggregated text output\nfrom all `output_text` items in the `output` array, if any are present.\nSupported in the Python and JavaScript SDKs.\n"]
34717    #[builder(default)]
34718    pub output_text: Option<String>,
34719    #[builder(default)]
34720    pub usage: Option<crate::__types::ResponseUsage>,
34721    #[doc = "Whether to allow the model to run tool calls in parallel.\n"]
34722    pub parallel_tool_calls: bool,
34723    #[builder(default)]
34724    pub conversation: Option<crate::__types::Conversation2>,
34725}
34726impl<'de> serde::Deserialize<'de> for Response {
34727    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
34728    where
34729        D: serde::Deserializer<'de>,
34730    {
34731        #[serde_with::serde_as]
34732        #[derive(serde :: Deserialize)]
34733        struct Response {
34734            #[serde(rename = "metadata")]
34735            metadata: Option<crate::__types::Metadata>,
34736            #[serde(rename = "top_logprobs")]
34737            top_logprobs: Option<i64>,
34738            #[serde(rename = "temperature")]
34739            temperature: serde_json::Number,
34740            #[serde(rename = "top_p")]
34741            top_p: serde_json::Number,
34742            #[serde(rename = "user")]
34743            user: Option<String>,
34744            #[serde(rename = "safety_identifier")]
34745            safety_identifier: Option<String>,
34746            #[serde(rename = "prompt_cache_key")]
34747            prompt_cache_key: Option<String>,
34748            #[serde(rename = "service_tier")]
34749            service_tier: Option<crate::__types::ServiceTier>,
34750            #[serde(rename = "previous_response_id")]
34751            previous_response_id: Option<String>,
34752            #[serde(rename = "model")]
34753            model: crate::__types::ModelIdsResponses,
34754            #[serde(rename = "reasoning")]
34755            reasoning: Option<crate::__types::Reasoning>,
34756            #[serde(rename = "background")]
34757            background: Option<bool>,
34758            #[serde(rename = "max_output_tokens")]
34759            max_output_tokens: Option<i64>,
34760            #[serde(rename = "max_tool_calls")]
34761            max_tool_calls: Option<i64>,
34762            #[serde(rename = "text")]
34763            text: Option<crate::__types::response::Text>,
34764            #[serde(rename = "tools")]
34765            tools: Vec<crate::__types::Tool>,
34766            #[serde(rename = "tool_choice")]
34767            tool_choice: crate::__types::response::ToolChoice,
34768            #[serde(rename = "prompt")]
34769            prompt: Option<crate::__types::Prompt>,
34770            #[serde(rename = "truncation")]
34771            truncation: Option<crate::__types::response::Truncation>,
34772            #[serde(rename = "id")]
34773            id: String,
34774            #[serde(rename = "object")]
34775            #[allow(dead_code)]
34776            object: crate::__types::response::Object,
34777            #[serde(rename = "status")]
34778            status: Option<crate::__types::response::Status>,
34779            #[serde(rename = "created_at")]
34780            created_at: serde_json::Number,
34781            #[serde(rename = "error")]
34782            error: Option<crate::__types::ResponseError>,
34783            #[serde(rename = "incomplete_details")]
34784            incomplete_details: Option<crate::__types::response::IncompleteDetails>,
34785            #[serde(rename = "output")]
34786            output: Vec<crate::__types::OutputItem>,
34787            #[serde(rename = "instructions")]
34788            instructions: Option<crate::__types::response::Instructions>,
34789            #[serde(rename = "output_text")]
34790            output_text: Option<String>,
34791            #[serde(rename = "usage")]
34792            usage: Option<crate::__types::ResponseUsage>,
34793            #[serde(rename = "parallel_tool_calls")]
34794            parallel_tool_calls: bool,
34795            #[serde(rename = "conversation")]
34796            conversation: Option<crate::__types::Conversation2>,
34797        }
34798        let Response {
34799            metadata,
34800            top_logprobs,
34801            temperature,
34802            top_p,
34803            user,
34804            safety_identifier,
34805            prompt_cache_key,
34806            service_tier,
34807            previous_response_id,
34808            model,
34809            reasoning,
34810            background,
34811            max_output_tokens,
34812            max_tool_calls,
34813            text,
34814            tools,
34815            tool_choice,
34816            prompt,
34817            truncation,
34818            id,
34819            status,
34820            created_at,
34821            error,
34822            incomplete_details,
34823            output,
34824            instructions,
34825            output_text,
34826            usage,
34827            parallel_tool_calls,
34828            conversation,
34829            ..
34830        } = Response::deserialize(deserializer)?;
34831        Ok(Self {
34832            metadata,
34833            top_logprobs,
34834            temperature,
34835            top_p,
34836            user,
34837            safety_identifier,
34838            prompt_cache_key,
34839            service_tier,
34840            previous_response_id,
34841            model,
34842            reasoning,
34843            background,
34844            max_output_tokens,
34845            max_tool_calls,
34846            text,
34847            tools,
34848            tool_choice,
34849            prompt,
34850            truncation,
34851            id,
34852            status,
34853            created_at,
34854            error,
34855            incomplete_details,
34856            output,
34857            instructions,
34858            output_text,
34859            usage,
34860            parallel_tool_calls,
34861            conversation,
34862        })
34863    }
34864}
34865impl serde::Serialize for Response {
34866    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
34867    where
34868        S: serde::Serializer,
34869    {
34870        #[serde_with::serde_as]
34871        #[derive(serde :: Serialize)]
34872        struct Response<'a> {
34873            #[serde(rename = "metadata")]
34874            #[serde(skip_serializing_if = "Option::is_none")]
34875            metadata: &'a Option<crate::__types::Metadata>,
34876            #[serde(rename = "top_logprobs")]
34877            #[serde(skip_serializing_if = "Option::is_none")]
34878            top_logprobs: &'a Option<i64>,
34879            #[serde(rename = "temperature")]
34880            temperature: &'a serde_json::Number,
34881            #[serde(rename = "top_p")]
34882            top_p: &'a serde_json::Number,
34883            #[serde(rename = "user")]
34884            #[serde(skip_serializing_if = "Option::is_none")]
34885            user: &'a Option<String>,
34886            #[serde(rename = "safety_identifier")]
34887            #[serde(skip_serializing_if = "Option::is_none")]
34888            safety_identifier: &'a Option<String>,
34889            #[serde(rename = "prompt_cache_key")]
34890            #[serde(skip_serializing_if = "Option::is_none")]
34891            prompt_cache_key: &'a Option<String>,
34892            #[serde(rename = "service_tier")]
34893            #[serde(skip_serializing_if = "Option::is_none")]
34894            service_tier: &'a Option<crate::__types::ServiceTier>,
34895            #[serde(rename = "previous_response_id")]
34896            #[serde(skip_serializing_if = "Option::is_none")]
34897            previous_response_id: &'a Option<String>,
34898            #[serde(rename = "model")]
34899            model: &'a crate::__types::ModelIdsResponses,
34900            #[serde(rename = "reasoning")]
34901            #[serde(skip_serializing_if = "Option::is_none")]
34902            reasoning: &'a Option<crate::__types::Reasoning>,
34903            #[serde(rename = "background")]
34904            #[serde(skip_serializing_if = "Option::is_none")]
34905            background: &'a Option<bool>,
34906            #[serde(rename = "max_output_tokens")]
34907            #[serde(skip_serializing_if = "Option::is_none")]
34908            max_output_tokens: &'a Option<i64>,
34909            #[serde(rename = "max_tool_calls")]
34910            #[serde(skip_serializing_if = "Option::is_none")]
34911            max_tool_calls: &'a Option<i64>,
34912            #[serde(rename = "text")]
34913            #[serde(skip_serializing_if = "Option::is_none")]
34914            text: &'a Option<crate::__types::response::Text>,
34915            #[serde(rename = "tools")]
34916            tools: &'a Vec<crate::__types::Tool>,
34917            #[serde(rename = "tool_choice")]
34918            tool_choice: &'a crate::__types::response::ToolChoice,
34919            #[serde(rename = "prompt")]
34920            #[serde(skip_serializing_if = "Option::is_none")]
34921            prompt: &'a Option<crate::__types::Prompt>,
34922            #[serde(rename = "truncation")]
34923            #[serde(skip_serializing_if = "Option::is_none")]
34924            truncation: &'a Option<crate::__types::response::Truncation>,
34925            #[serde(rename = "id")]
34926            id: &'a String,
34927            #[serde(rename = "object")]
34928            object: &'a crate::__types::response::Object,
34929            #[serde(rename = "status")]
34930            #[serde(skip_serializing_if = "Option::is_none")]
34931            status: &'a Option<crate::__types::response::Status>,
34932            #[serde(rename = "created_at")]
34933            created_at: &'a serde_json::Number,
34934            #[serde(rename = "error")]
34935            #[serde(skip_serializing_if = "Option::is_none")]
34936            error: &'a Option<crate::__types::ResponseError>,
34937            #[serde(rename = "incomplete_details")]
34938            #[serde(skip_serializing_if = "Option::is_none")]
34939            incomplete_details: &'a Option<crate::__types::response::IncompleteDetails>,
34940            #[serde(rename = "output")]
34941            output: &'a Vec<crate::__types::OutputItem>,
34942            #[serde(rename = "instructions")]
34943            #[serde(skip_serializing_if = "Option::is_none")]
34944            instructions: &'a Option<crate::__types::response::Instructions>,
34945            #[serde(rename = "output_text")]
34946            #[serde(skip_serializing_if = "Option::is_none")]
34947            output_text: &'a Option<String>,
34948            #[serde(rename = "usage")]
34949            #[serde(skip_serializing_if = "Option::is_none")]
34950            usage: &'a Option<crate::__types::ResponseUsage>,
34951            #[serde(rename = "parallel_tool_calls")]
34952            parallel_tool_calls: &'a bool,
34953            #[serde(rename = "conversation")]
34954            #[serde(skip_serializing_if = "Option::is_none")]
34955            conversation: &'a Option<crate::__types::Conversation2>,
34956        }
34957        let Self {
34958            metadata,
34959            top_logprobs,
34960            temperature,
34961            top_p,
34962            user,
34963            safety_identifier,
34964            prompt_cache_key,
34965            service_tier,
34966            previous_response_id,
34967            model,
34968            reasoning,
34969            background,
34970            max_output_tokens,
34971            max_tool_calls,
34972            text,
34973            tools,
34974            tool_choice,
34975            prompt,
34976            truncation,
34977            id,
34978            status,
34979            created_at,
34980            error,
34981            incomplete_details,
34982            output,
34983            instructions,
34984            output_text,
34985            usage,
34986            parallel_tool_calls,
34987            conversation,
34988        } = self;
34989        Response {
34990            metadata,
34991            top_logprobs,
34992            temperature,
34993            top_p,
34994            user,
34995            safety_identifier,
34996            prompt_cache_key,
34997            service_tier,
34998            previous_response_id,
34999            model,
35000            reasoning,
35001            background,
35002            max_output_tokens,
35003            max_tool_calls,
35004            text,
35005            tools,
35006            tool_choice,
35007            prompt,
35008            truncation,
35009            id,
35010            object: &Default::default(),
35011            status,
35012            created_at,
35013            error,
35014            incomplete_details,
35015            output,
35016            instructions,
35017            output_text,
35018            usage,
35019            parallel_tool_calls,
35020            conversation,
35021        }
35022        .serialize(serializer)
35023    }
35024}
35025#[allow(clippy::module_inception)]
35026pub(crate) mod response_audio_delta_event {
35027    #[doc = "The type of the event. Always `response.audio.delta`.\n"]
35028    #[derive(Clone, Copy, Debug, Default, PartialEq)]
35029    pub(crate) struct Type;
35030    impl_serde!(Type, "response.audio.delta");
35031}
35032#[doc = "Emitted when there is a partial audio response."]
35033#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
35034pub struct ResponseAudioDeltaEvent {
35035    #[doc = "A sequence number for this chunk of the stream response.\n"]
35036    pub sequence_number: i64,
35037    #[doc = "A chunk of Base64 encoded response audio bytes.\n"]
35038    pub delta: String,
35039}
35040impl<'de> serde::Deserialize<'de> for ResponseAudioDeltaEvent {
35041    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
35042    where
35043        D: serde::Deserializer<'de>,
35044    {
35045        #[serde_with::serde_as]
35046        #[derive(serde :: Deserialize)]
35047        struct ResponseAudioDeltaEvent {
35048            #[serde(rename = "type")]
35049            #[allow(dead_code)]
35050            r#type: crate::__types::response_audio_delta_event::Type,
35051            #[serde(rename = "sequence_number")]
35052            sequence_number: i64,
35053            #[serde(rename = "delta")]
35054            delta: String,
35055        }
35056        let ResponseAudioDeltaEvent {
35057            sequence_number,
35058            delta,
35059            ..
35060        } = ResponseAudioDeltaEvent::deserialize(deserializer)?;
35061        Ok(Self {
35062            sequence_number,
35063            delta,
35064        })
35065    }
35066}
35067impl serde::Serialize for ResponseAudioDeltaEvent {
35068    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
35069    where
35070        S: serde::Serializer,
35071    {
35072        #[serde_with::serde_as]
35073        #[derive(serde :: Serialize)]
35074        struct ResponseAudioDeltaEvent<'a> {
35075            #[serde(rename = "type")]
35076            r#type: &'a crate::__types::response_audio_delta_event::Type,
35077            #[serde(rename = "sequence_number")]
35078            sequence_number: &'a i64,
35079            #[serde(rename = "delta")]
35080            delta: &'a String,
35081        }
35082        let Self {
35083            sequence_number,
35084            delta,
35085        } = self;
35086        ResponseAudioDeltaEvent {
35087            r#type: &Default::default(),
35088            sequence_number,
35089            delta,
35090        }
35091        .serialize(serializer)
35092    }
35093}
35094#[allow(clippy::module_inception)]
35095pub(crate) mod response_audio_done_event {
35096    #[doc = "The type of the event. Always `response.audio.done`.\n"]
35097    #[derive(Clone, Copy, Debug, Default, PartialEq)]
35098    pub(crate) struct Type;
35099    impl_serde!(Type, "response.audio.done");
35100}
35101#[doc = "Emitted when the audio response is complete."]
35102#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
35103pub struct ResponseAudioDoneEvent {
35104    #[doc = "The sequence number of the delta.\n"]
35105    pub sequence_number: i64,
35106    pub response_id: serde_json::Value,
35107}
35108impl<'de> serde::Deserialize<'de> for ResponseAudioDoneEvent {
35109    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
35110    where
35111        D: serde::Deserializer<'de>,
35112    {
35113        #[serde_with::serde_as]
35114        #[derive(serde :: Deserialize)]
35115        struct ResponseAudioDoneEvent {
35116            #[serde(rename = "type")]
35117            #[allow(dead_code)]
35118            r#type: crate::__types::response_audio_done_event::Type,
35119            #[serde(rename = "sequence_number")]
35120            sequence_number: i64,
35121            #[serde(rename = "response_id")]
35122            response_id: serde_json::Value,
35123        }
35124        let ResponseAudioDoneEvent {
35125            sequence_number,
35126            response_id,
35127            ..
35128        } = ResponseAudioDoneEvent::deserialize(deserializer)?;
35129        Ok(Self {
35130            sequence_number,
35131            response_id,
35132        })
35133    }
35134}
35135impl serde::Serialize for ResponseAudioDoneEvent {
35136    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
35137    where
35138        S: serde::Serializer,
35139    {
35140        #[serde_with::serde_as]
35141        #[derive(serde :: Serialize)]
35142        struct ResponseAudioDoneEvent<'a> {
35143            #[serde(rename = "type")]
35144            r#type: &'a crate::__types::response_audio_done_event::Type,
35145            #[serde(rename = "sequence_number")]
35146            sequence_number: &'a i64,
35147            #[serde(rename = "response_id")]
35148            response_id: &'a serde_json::Value,
35149        }
35150        let Self {
35151            sequence_number,
35152            response_id,
35153        } = self;
35154        ResponseAudioDoneEvent {
35155            r#type: &Default::default(),
35156            sequence_number,
35157            response_id,
35158        }
35159        .serialize(serializer)
35160    }
35161}
35162#[allow(clippy::module_inception)]
35163pub(crate) mod response_audio_transcript_delta_event {
35164    #[doc = "The type of the event. Always `response.audio.transcript.delta`.\n"]
35165    #[derive(Clone, Copy, Debug, Default, PartialEq)]
35166    pub(crate) struct Type;
35167    impl_serde!(Type, "response.audio.transcript.delta");
35168}
35169#[doc = "Emitted when there is a partial transcript of audio."]
35170#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
35171pub struct ResponseAudioTranscriptDeltaEvent {
35172    #[doc = "The partial transcript of the audio response.\n"]
35173    pub delta: String,
35174    #[doc = "The sequence number of this event."]
35175    pub sequence_number: i64,
35176    pub response_id: serde_json::Value,
35177}
35178impl<'de> serde::Deserialize<'de> for ResponseAudioTranscriptDeltaEvent {
35179    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
35180    where
35181        D: serde::Deserializer<'de>,
35182    {
35183        #[serde_with::serde_as]
35184        #[derive(serde :: Deserialize)]
35185        struct ResponseAudioTranscriptDeltaEvent {
35186            #[serde(rename = "type")]
35187            #[allow(dead_code)]
35188            r#type: crate::__types::response_audio_transcript_delta_event::Type,
35189            #[serde(rename = "delta")]
35190            delta: String,
35191            #[serde(rename = "sequence_number")]
35192            sequence_number: i64,
35193            #[serde(rename = "response_id")]
35194            response_id: serde_json::Value,
35195        }
35196        let ResponseAudioTranscriptDeltaEvent {
35197            delta,
35198            sequence_number,
35199            response_id,
35200            ..
35201        } = ResponseAudioTranscriptDeltaEvent::deserialize(deserializer)?;
35202        Ok(Self {
35203            delta,
35204            sequence_number,
35205            response_id,
35206        })
35207    }
35208}
35209impl serde::Serialize for ResponseAudioTranscriptDeltaEvent {
35210    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
35211    where
35212        S: serde::Serializer,
35213    {
35214        #[serde_with::serde_as]
35215        #[derive(serde :: Serialize)]
35216        struct ResponseAudioTranscriptDeltaEvent<'a> {
35217            #[serde(rename = "type")]
35218            r#type: &'a crate::__types::response_audio_transcript_delta_event::Type,
35219            #[serde(rename = "delta")]
35220            delta: &'a String,
35221            #[serde(rename = "sequence_number")]
35222            sequence_number: &'a i64,
35223            #[serde(rename = "response_id")]
35224            response_id: &'a serde_json::Value,
35225        }
35226        let Self {
35227            delta,
35228            sequence_number,
35229            response_id,
35230        } = self;
35231        ResponseAudioTranscriptDeltaEvent {
35232            r#type: &Default::default(),
35233            delta,
35234            sequence_number,
35235            response_id,
35236        }
35237        .serialize(serializer)
35238    }
35239}
35240#[allow(clippy::module_inception)]
35241pub(crate) mod response_audio_transcript_done_event {
35242    #[doc = "The type of the event. Always `response.audio.transcript.done`.\n"]
35243    #[derive(Clone, Copy, Debug, Default, PartialEq)]
35244    pub(crate) struct Type;
35245    impl_serde!(Type, "response.audio.transcript.done");
35246}
35247#[doc = "Emitted when the full audio transcript is completed."]
35248#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
35249pub struct ResponseAudioTranscriptDoneEvent {
35250    #[doc = "The sequence number of this event."]
35251    pub sequence_number: i64,
35252    pub response_id: serde_json::Value,
35253}
35254impl<'de> serde::Deserialize<'de> for ResponseAudioTranscriptDoneEvent {
35255    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
35256    where
35257        D: serde::Deserializer<'de>,
35258    {
35259        #[serde_with::serde_as]
35260        #[derive(serde :: Deserialize)]
35261        struct ResponseAudioTranscriptDoneEvent {
35262            #[serde(rename = "type")]
35263            #[allow(dead_code)]
35264            r#type: crate::__types::response_audio_transcript_done_event::Type,
35265            #[serde(rename = "sequence_number")]
35266            sequence_number: i64,
35267            #[serde(rename = "response_id")]
35268            response_id: serde_json::Value,
35269        }
35270        let ResponseAudioTranscriptDoneEvent {
35271            sequence_number,
35272            response_id,
35273            ..
35274        } = ResponseAudioTranscriptDoneEvent::deserialize(deserializer)?;
35275        Ok(Self {
35276            sequence_number,
35277            response_id,
35278        })
35279    }
35280}
35281impl serde::Serialize for ResponseAudioTranscriptDoneEvent {
35282    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
35283    where
35284        S: serde::Serializer,
35285    {
35286        #[serde_with::serde_as]
35287        #[derive(serde :: Serialize)]
35288        struct ResponseAudioTranscriptDoneEvent<'a> {
35289            #[serde(rename = "type")]
35290            r#type: &'a crate::__types::response_audio_transcript_done_event::Type,
35291            #[serde(rename = "sequence_number")]
35292            sequence_number: &'a i64,
35293            #[serde(rename = "response_id")]
35294            response_id: &'a serde_json::Value,
35295        }
35296        let Self {
35297            sequence_number,
35298            response_id,
35299        } = self;
35300        ResponseAudioTranscriptDoneEvent {
35301            r#type: &Default::default(),
35302            sequence_number,
35303            response_id,
35304        }
35305        .serialize(serializer)
35306    }
35307}
35308#[allow(clippy::module_inception)]
35309pub(crate) mod response_code_interpreter_call_code_delta_event {
35310    #[doc = "The type of the event. Always `response.code_interpreter_call_code.delta`."]
35311    #[derive(Clone, Copy, Debug, Default, PartialEq)]
35312    pub(crate) struct Type;
35313    impl_serde!(Type, "response.code_interpreter_call_code.delta");
35314}
35315#[doc = "Emitted when a partial code snippet is streamed by the code interpreter."]
35316#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
35317pub struct ResponseCodeInterpreterCallCodeDeltaEvent {
35318    #[doc = "The index of the output item in the response for which the code is being streamed."]
35319    pub output_index: i64,
35320    #[doc = "The unique identifier of the code interpreter tool call item."]
35321    pub item_id: String,
35322    #[doc = "The partial code snippet being streamed by the code interpreter."]
35323    pub delta: String,
35324    #[doc = "The sequence number of this event, used to order streaming events."]
35325    pub sequence_number: i64,
35326}
35327impl<'de> serde::Deserialize<'de> for ResponseCodeInterpreterCallCodeDeltaEvent {
35328    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
35329    where
35330        D: serde::Deserializer<'de>,
35331    {
35332        #[serde_with::serde_as]
35333        #[derive(serde :: Deserialize)]
35334        struct ResponseCodeInterpreterCallCodeDeltaEvent {
35335            #[serde(rename = "type")]
35336            #[allow(dead_code)]
35337            r#type: crate::__types::response_code_interpreter_call_code_delta_event::Type,
35338            #[serde(rename = "output_index")]
35339            output_index: i64,
35340            #[serde(rename = "item_id")]
35341            item_id: String,
35342            #[serde(rename = "delta")]
35343            delta: String,
35344            #[serde(rename = "sequence_number")]
35345            sequence_number: i64,
35346        }
35347        let ResponseCodeInterpreterCallCodeDeltaEvent {
35348            output_index,
35349            item_id,
35350            delta,
35351            sequence_number,
35352            ..
35353        } = ResponseCodeInterpreterCallCodeDeltaEvent::deserialize(deserializer)?;
35354        Ok(Self {
35355            output_index,
35356            item_id,
35357            delta,
35358            sequence_number,
35359        })
35360    }
35361}
35362impl serde::Serialize for ResponseCodeInterpreterCallCodeDeltaEvent {
35363    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
35364    where
35365        S: serde::Serializer,
35366    {
35367        #[serde_with::serde_as]
35368        #[derive(serde :: Serialize)]
35369        struct ResponseCodeInterpreterCallCodeDeltaEvent<'a> {
35370            #[serde(rename = "type")]
35371            r#type: &'a crate::__types::response_code_interpreter_call_code_delta_event::Type,
35372            #[serde(rename = "output_index")]
35373            output_index: &'a i64,
35374            #[serde(rename = "item_id")]
35375            item_id: &'a String,
35376            #[serde(rename = "delta")]
35377            delta: &'a String,
35378            #[serde(rename = "sequence_number")]
35379            sequence_number: &'a i64,
35380        }
35381        let Self {
35382            output_index,
35383            item_id,
35384            delta,
35385            sequence_number,
35386        } = self;
35387        ResponseCodeInterpreterCallCodeDeltaEvent {
35388            r#type: &Default::default(),
35389            output_index,
35390            item_id,
35391            delta,
35392            sequence_number,
35393        }
35394        .serialize(serializer)
35395    }
35396}
35397#[allow(clippy::module_inception)]
35398pub(crate) mod response_code_interpreter_call_code_done_event {
35399    #[doc = "The type of the event. Always `response.code_interpreter_call_code.done`."]
35400    #[derive(Clone, Copy, Debug, Default, PartialEq)]
35401    pub(crate) struct Type;
35402    impl_serde!(Type, "response.code_interpreter_call_code.done");
35403}
35404#[doc = "Emitted when the code snippet is finalized by the code interpreter."]
35405#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
35406pub struct ResponseCodeInterpreterCallCodeDoneEvent {
35407    #[doc = "The index of the output item in the response for which the code is finalized."]
35408    pub output_index: i64,
35409    #[doc = "The unique identifier of the code interpreter tool call item."]
35410    pub item_id: String,
35411    #[doc = "The final code snippet output by the code interpreter."]
35412    pub code: String,
35413    #[doc = "The sequence number of this event, used to order streaming events."]
35414    pub sequence_number: i64,
35415}
35416impl<'de> serde::Deserialize<'de> for ResponseCodeInterpreterCallCodeDoneEvent {
35417    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
35418    where
35419        D: serde::Deserializer<'de>,
35420    {
35421        #[serde_with::serde_as]
35422        #[derive(serde :: Deserialize)]
35423        struct ResponseCodeInterpreterCallCodeDoneEvent {
35424            #[serde(rename = "type")]
35425            #[allow(dead_code)]
35426            r#type: crate::__types::response_code_interpreter_call_code_done_event::Type,
35427            #[serde(rename = "output_index")]
35428            output_index: i64,
35429            #[serde(rename = "item_id")]
35430            item_id: String,
35431            #[serde(rename = "code")]
35432            code: String,
35433            #[serde(rename = "sequence_number")]
35434            sequence_number: i64,
35435        }
35436        let ResponseCodeInterpreterCallCodeDoneEvent {
35437            output_index,
35438            item_id,
35439            code,
35440            sequence_number,
35441            ..
35442        } = ResponseCodeInterpreterCallCodeDoneEvent::deserialize(deserializer)?;
35443        Ok(Self {
35444            output_index,
35445            item_id,
35446            code,
35447            sequence_number,
35448        })
35449    }
35450}
35451impl serde::Serialize for ResponseCodeInterpreterCallCodeDoneEvent {
35452    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
35453    where
35454        S: serde::Serializer,
35455    {
35456        #[serde_with::serde_as]
35457        #[derive(serde :: Serialize)]
35458        struct ResponseCodeInterpreterCallCodeDoneEvent<'a> {
35459            #[serde(rename = "type")]
35460            r#type: &'a crate::__types::response_code_interpreter_call_code_done_event::Type,
35461            #[serde(rename = "output_index")]
35462            output_index: &'a i64,
35463            #[serde(rename = "item_id")]
35464            item_id: &'a String,
35465            #[serde(rename = "code")]
35466            code: &'a String,
35467            #[serde(rename = "sequence_number")]
35468            sequence_number: &'a i64,
35469        }
35470        let Self {
35471            output_index,
35472            item_id,
35473            code,
35474            sequence_number,
35475        } = self;
35476        ResponseCodeInterpreterCallCodeDoneEvent {
35477            r#type: &Default::default(),
35478            output_index,
35479            item_id,
35480            code,
35481            sequence_number,
35482        }
35483        .serialize(serializer)
35484    }
35485}
35486#[allow(clippy::module_inception)]
35487pub(crate) mod response_code_interpreter_call_completed_event {
35488    #[doc = "The type of the event. Always `response.code_interpreter_call.completed`."]
35489    #[derive(Clone, Copy, Debug, Default, PartialEq)]
35490    pub(crate) struct Type;
35491    impl_serde!(Type, "response.code_interpreter_call.completed");
35492}
35493#[doc = "Emitted when the code interpreter call is completed."]
35494#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
35495pub struct ResponseCodeInterpreterCallCompletedEvent {
35496    #[doc = "The index of the output item in the response for which the code interpreter call is completed."]
35497    pub output_index: i64,
35498    #[doc = "The unique identifier of the code interpreter tool call item."]
35499    pub item_id: String,
35500    #[doc = "The sequence number of this event, used to order streaming events."]
35501    pub sequence_number: i64,
35502}
35503impl<'de> serde::Deserialize<'de> for ResponseCodeInterpreterCallCompletedEvent {
35504    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
35505    where
35506        D: serde::Deserializer<'de>,
35507    {
35508        #[serde_with::serde_as]
35509        #[derive(serde :: Deserialize)]
35510        struct ResponseCodeInterpreterCallCompletedEvent {
35511            #[serde(rename = "type")]
35512            #[allow(dead_code)]
35513            r#type: crate::__types::response_code_interpreter_call_completed_event::Type,
35514            #[serde(rename = "output_index")]
35515            output_index: i64,
35516            #[serde(rename = "item_id")]
35517            item_id: String,
35518            #[serde(rename = "sequence_number")]
35519            sequence_number: i64,
35520        }
35521        let ResponseCodeInterpreterCallCompletedEvent {
35522            output_index,
35523            item_id,
35524            sequence_number,
35525            ..
35526        } = ResponseCodeInterpreterCallCompletedEvent::deserialize(deserializer)?;
35527        Ok(Self {
35528            output_index,
35529            item_id,
35530            sequence_number,
35531        })
35532    }
35533}
35534impl serde::Serialize for ResponseCodeInterpreterCallCompletedEvent {
35535    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
35536    where
35537        S: serde::Serializer,
35538    {
35539        #[serde_with::serde_as]
35540        #[derive(serde :: Serialize)]
35541        struct ResponseCodeInterpreterCallCompletedEvent<'a> {
35542            #[serde(rename = "type")]
35543            r#type: &'a crate::__types::response_code_interpreter_call_completed_event::Type,
35544            #[serde(rename = "output_index")]
35545            output_index: &'a i64,
35546            #[serde(rename = "item_id")]
35547            item_id: &'a String,
35548            #[serde(rename = "sequence_number")]
35549            sequence_number: &'a i64,
35550        }
35551        let Self {
35552            output_index,
35553            item_id,
35554            sequence_number,
35555        } = self;
35556        ResponseCodeInterpreterCallCompletedEvent {
35557            r#type: &Default::default(),
35558            output_index,
35559            item_id,
35560            sequence_number,
35561        }
35562        .serialize(serializer)
35563    }
35564}
35565#[allow(clippy::module_inception)]
35566pub(crate) mod response_code_interpreter_call_in_progress_event {
35567    #[doc = "The type of the event. Always `response.code_interpreter_call.in_progress`."]
35568    #[derive(Clone, Copy, Debug, Default, PartialEq)]
35569    pub(crate) struct Type;
35570    impl_serde!(Type, "response.code_interpreter_call.in_progress");
35571}
35572#[doc = "Emitted when a code interpreter call is in progress."]
35573#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
35574pub struct ResponseCodeInterpreterCallInProgressEvent {
35575    #[doc = "The index of the output item in the response for which the code interpreter call is in progress."]
35576    pub output_index: i64,
35577    #[doc = "The unique identifier of the code interpreter tool call item."]
35578    pub item_id: String,
35579    #[doc = "The sequence number of this event, used to order streaming events."]
35580    pub sequence_number: i64,
35581}
35582impl<'de> serde::Deserialize<'de> for ResponseCodeInterpreterCallInProgressEvent {
35583    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
35584    where
35585        D: serde::Deserializer<'de>,
35586    {
35587        #[serde_with::serde_as]
35588        #[derive(serde :: Deserialize)]
35589        struct ResponseCodeInterpreterCallInProgressEvent {
35590            #[serde(rename = "type")]
35591            #[allow(dead_code)]
35592            r#type: crate::__types::response_code_interpreter_call_in_progress_event::Type,
35593            #[serde(rename = "output_index")]
35594            output_index: i64,
35595            #[serde(rename = "item_id")]
35596            item_id: String,
35597            #[serde(rename = "sequence_number")]
35598            sequence_number: i64,
35599        }
35600        let ResponseCodeInterpreterCallInProgressEvent {
35601            output_index,
35602            item_id,
35603            sequence_number,
35604            ..
35605        } = ResponseCodeInterpreterCallInProgressEvent::deserialize(deserializer)?;
35606        Ok(Self {
35607            output_index,
35608            item_id,
35609            sequence_number,
35610        })
35611    }
35612}
35613impl serde::Serialize for ResponseCodeInterpreterCallInProgressEvent {
35614    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
35615    where
35616        S: serde::Serializer,
35617    {
35618        #[serde_with::serde_as]
35619        #[derive(serde :: Serialize)]
35620        struct ResponseCodeInterpreterCallInProgressEvent<'a> {
35621            #[serde(rename = "type")]
35622            r#type: &'a crate::__types::response_code_interpreter_call_in_progress_event::Type,
35623            #[serde(rename = "output_index")]
35624            output_index: &'a i64,
35625            #[serde(rename = "item_id")]
35626            item_id: &'a String,
35627            #[serde(rename = "sequence_number")]
35628            sequence_number: &'a i64,
35629        }
35630        let Self {
35631            output_index,
35632            item_id,
35633            sequence_number,
35634        } = self;
35635        ResponseCodeInterpreterCallInProgressEvent {
35636            r#type: &Default::default(),
35637            output_index,
35638            item_id,
35639            sequence_number,
35640        }
35641        .serialize(serializer)
35642    }
35643}
35644#[allow(clippy::module_inception)]
35645pub(crate) mod response_code_interpreter_call_interpreting_event {
35646    #[doc = "The type of the event. Always `response.code_interpreter_call.interpreting`."]
35647    #[derive(Clone, Copy, Debug, Default, PartialEq)]
35648    pub(crate) struct Type;
35649    impl_serde!(Type, "response.code_interpreter_call.interpreting");
35650}
35651#[doc = "Emitted when the code interpreter is actively interpreting the code snippet."]
35652#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
35653pub struct ResponseCodeInterpreterCallInterpretingEvent {
35654    #[doc = "The index of the output item in the response for which the code interpreter is interpreting code."]
35655    pub output_index: i64,
35656    #[doc = "The unique identifier of the code interpreter tool call item."]
35657    pub item_id: String,
35658    #[doc = "The sequence number of this event, used to order streaming events."]
35659    pub sequence_number: i64,
35660}
35661impl<'de> serde::Deserialize<'de> for ResponseCodeInterpreterCallInterpretingEvent {
35662    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
35663    where
35664        D: serde::Deserializer<'de>,
35665    {
35666        #[serde_with::serde_as]
35667        #[derive(serde :: Deserialize)]
35668        struct ResponseCodeInterpreterCallInterpretingEvent {
35669            #[serde(rename = "type")]
35670            #[allow(dead_code)]
35671            r#type: crate::__types::response_code_interpreter_call_interpreting_event::Type,
35672            #[serde(rename = "output_index")]
35673            output_index: i64,
35674            #[serde(rename = "item_id")]
35675            item_id: String,
35676            #[serde(rename = "sequence_number")]
35677            sequence_number: i64,
35678        }
35679        let ResponseCodeInterpreterCallInterpretingEvent {
35680            output_index,
35681            item_id,
35682            sequence_number,
35683            ..
35684        } = ResponseCodeInterpreterCallInterpretingEvent::deserialize(deserializer)?;
35685        Ok(Self {
35686            output_index,
35687            item_id,
35688            sequence_number,
35689        })
35690    }
35691}
35692impl serde::Serialize for ResponseCodeInterpreterCallInterpretingEvent {
35693    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
35694    where
35695        S: serde::Serializer,
35696    {
35697        #[serde_with::serde_as]
35698        #[derive(serde :: Serialize)]
35699        struct ResponseCodeInterpreterCallInterpretingEvent<'a> {
35700            #[serde(rename = "type")]
35701            r#type: &'a crate::__types::response_code_interpreter_call_interpreting_event::Type,
35702            #[serde(rename = "output_index")]
35703            output_index: &'a i64,
35704            #[serde(rename = "item_id")]
35705            item_id: &'a String,
35706            #[serde(rename = "sequence_number")]
35707            sequence_number: &'a i64,
35708        }
35709        let Self {
35710            output_index,
35711            item_id,
35712            sequence_number,
35713        } = self;
35714        ResponseCodeInterpreterCallInterpretingEvent {
35715            r#type: &Default::default(),
35716            output_index,
35717            item_id,
35718            sequence_number,
35719        }
35720        .serialize(serializer)
35721    }
35722}
35723#[allow(clippy::module_inception)]
35724pub(crate) mod response_completed_event {
35725    #[doc = "The type of the event. Always `response.completed`.\n"]
35726    #[derive(Clone, Copy, Debug, Default, PartialEq)]
35727    pub(crate) struct Type;
35728    impl_serde!(Type, "response.completed");
35729}
35730#[doc = "Emitted when the model response is complete."]
35731#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
35732pub struct ResponseCompletedEvent {
35733    #[doc = "Properties of the completed response.\n"]
35734    pub response: crate::__types::Response,
35735    #[doc = "The sequence number for this event."]
35736    pub sequence_number: i64,
35737}
35738impl<'de> serde::Deserialize<'de> for ResponseCompletedEvent {
35739    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
35740    where
35741        D: serde::Deserializer<'de>,
35742    {
35743        #[serde_with::serde_as]
35744        #[derive(serde :: Deserialize)]
35745        struct ResponseCompletedEvent {
35746            #[serde(rename = "type")]
35747            #[allow(dead_code)]
35748            r#type: crate::__types::response_completed_event::Type,
35749            #[serde(rename = "response")]
35750            response: crate::__types::Response,
35751            #[serde(rename = "sequence_number")]
35752            sequence_number: i64,
35753        }
35754        let ResponseCompletedEvent {
35755            response,
35756            sequence_number,
35757            ..
35758        } = ResponseCompletedEvent::deserialize(deserializer)?;
35759        Ok(Self {
35760            response,
35761            sequence_number,
35762        })
35763    }
35764}
35765impl serde::Serialize for ResponseCompletedEvent {
35766    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
35767    where
35768        S: serde::Serializer,
35769    {
35770        #[serde_with::serde_as]
35771        #[derive(serde :: Serialize)]
35772        struct ResponseCompletedEvent<'a> {
35773            #[serde(rename = "type")]
35774            r#type: &'a crate::__types::response_completed_event::Type,
35775            #[serde(rename = "response")]
35776            response: &'a crate::__types::Response,
35777            #[serde(rename = "sequence_number")]
35778            sequence_number: &'a i64,
35779        }
35780        let Self {
35781            response,
35782            sequence_number,
35783        } = self;
35784        ResponseCompletedEvent {
35785            r#type: &Default::default(),
35786            response,
35787            sequence_number,
35788        }
35789        .serialize(serializer)
35790    }
35791}
35792#[allow(clippy::module_inception)]
35793pub(crate) mod response_content_part_added_event {
35794    #[doc = "The type of the event. Always `response.content_part.added`.\n"]
35795    #[derive(Clone, Copy, Debug, Default, PartialEq)]
35796    pub(crate) struct Type;
35797    impl_serde!(Type, "response.content_part.added");
35798}
35799#[doc = "Emitted when a new content part is added."]
35800#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
35801pub struct ResponseContentPartAddedEvent {
35802    #[doc = "The ID of the output item that the content part was added to.\n"]
35803    pub item_id: String,
35804    #[doc = "The index of the output item that the content part was added to.\n"]
35805    pub output_index: i64,
35806    #[doc = "The index of the content part that was added.\n"]
35807    pub content_index: i64,
35808    #[doc = "The content part that was added.\n"]
35809    pub part: crate::__types::OutputContent,
35810    #[doc = "The sequence number of this event."]
35811    pub sequence_number: i64,
35812}
35813impl<'de> serde::Deserialize<'de> for ResponseContentPartAddedEvent {
35814    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
35815    where
35816        D: serde::Deserializer<'de>,
35817    {
35818        #[serde_with::serde_as]
35819        #[derive(serde :: Deserialize)]
35820        struct ResponseContentPartAddedEvent {
35821            #[serde(rename = "type")]
35822            #[allow(dead_code)]
35823            r#type: crate::__types::response_content_part_added_event::Type,
35824            #[serde(rename = "item_id")]
35825            item_id: String,
35826            #[serde(rename = "output_index")]
35827            output_index: i64,
35828            #[serde(rename = "content_index")]
35829            content_index: i64,
35830            #[serde(rename = "part")]
35831            part: crate::__types::OutputContent,
35832            #[serde(rename = "sequence_number")]
35833            sequence_number: i64,
35834        }
35835        let ResponseContentPartAddedEvent {
35836            item_id,
35837            output_index,
35838            content_index,
35839            part,
35840            sequence_number,
35841            ..
35842        } = ResponseContentPartAddedEvent::deserialize(deserializer)?;
35843        Ok(Self {
35844            item_id,
35845            output_index,
35846            content_index,
35847            part,
35848            sequence_number,
35849        })
35850    }
35851}
35852impl serde::Serialize for ResponseContentPartAddedEvent {
35853    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
35854    where
35855        S: serde::Serializer,
35856    {
35857        #[serde_with::serde_as]
35858        #[derive(serde :: Serialize)]
35859        struct ResponseContentPartAddedEvent<'a> {
35860            #[serde(rename = "type")]
35861            r#type: &'a crate::__types::response_content_part_added_event::Type,
35862            #[serde(rename = "item_id")]
35863            item_id: &'a String,
35864            #[serde(rename = "output_index")]
35865            output_index: &'a i64,
35866            #[serde(rename = "content_index")]
35867            content_index: &'a i64,
35868            #[serde(rename = "part")]
35869            part: &'a crate::__types::OutputContent,
35870            #[serde(rename = "sequence_number")]
35871            sequence_number: &'a i64,
35872        }
35873        let Self {
35874            item_id,
35875            output_index,
35876            content_index,
35877            part,
35878            sequence_number,
35879        } = self;
35880        ResponseContentPartAddedEvent {
35881            r#type: &Default::default(),
35882            item_id,
35883            output_index,
35884            content_index,
35885            part,
35886            sequence_number,
35887        }
35888        .serialize(serializer)
35889    }
35890}
35891#[allow(clippy::module_inception)]
35892pub(crate) mod response_content_part_done_event {
35893    #[doc = "The type of the event. Always `response.content_part.done`.\n"]
35894    #[derive(Clone, Copy, Debug, Default, PartialEq)]
35895    pub(crate) struct Type;
35896    impl_serde!(Type, "response.content_part.done");
35897}
35898#[doc = "Emitted when a content part is done."]
35899#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
35900pub struct ResponseContentPartDoneEvent {
35901    #[doc = "The ID of the output item that the content part was added to.\n"]
35902    pub item_id: String,
35903    #[doc = "The index of the output item that the content part was added to.\n"]
35904    pub output_index: i64,
35905    #[doc = "The index of the content part that is done.\n"]
35906    pub content_index: i64,
35907    #[doc = "The sequence number of this event."]
35908    pub sequence_number: i64,
35909    #[doc = "The content part that is done.\n"]
35910    pub part: crate::__types::OutputContent,
35911}
35912impl<'de> serde::Deserialize<'de> for ResponseContentPartDoneEvent {
35913    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
35914    where
35915        D: serde::Deserializer<'de>,
35916    {
35917        #[serde_with::serde_as]
35918        #[derive(serde :: Deserialize)]
35919        struct ResponseContentPartDoneEvent {
35920            #[serde(rename = "type")]
35921            #[allow(dead_code)]
35922            r#type: crate::__types::response_content_part_done_event::Type,
35923            #[serde(rename = "item_id")]
35924            item_id: String,
35925            #[serde(rename = "output_index")]
35926            output_index: i64,
35927            #[serde(rename = "content_index")]
35928            content_index: i64,
35929            #[serde(rename = "sequence_number")]
35930            sequence_number: i64,
35931            #[serde(rename = "part")]
35932            part: crate::__types::OutputContent,
35933        }
35934        let ResponseContentPartDoneEvent {
35935            item_id,
35936            output_index,
35937            content_index,
35938            sequence_number,
35939            part,
35940            ..
35941        } = ResponseContentPartDoneEvent::deserialize(deserializer)?;
35942        Ok(Self {
35943            item_id,
35944            output_index,
35945            content_index,
35946            sequence_number,
35947            part,
35948        })
35949    }
35950}
35951impl serde::Serialize for ResponseContentPartDoneEvent {
35952    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
35953    where
35954        S: serde::Serializer,
35955    {
35956        #[serde_with::serde_as]
35957        #[derive(serde :: Serialize)]
35958        struct ResponseContentPartDoneEvent<'a> {
35959            #[serde(rename = "type")]
35960            r#type: &'a crate::__types::response_content_part_done_event::Type,
35961            #[serde(rename = "item_id")]
35962            item_id: &'a String,
35963            #[serde(rename = "output_index")]
35964            output_index: &'a i64,
35965            #[serde(rename = "content_index")]
35966            content_index: &'a i64,
35967            #[serde(rename = "sequence_number")]
35968            sequence_number: &'a i64,
35969            #[serde(rename = "part")]
35970            part: &'a crate::__types::OutputContent,
35971        }
35972        let Self {
35973            item_id,
35974            output_index,
35975            content_index,
35976            sequence_number,
35977            part,
35978        } = self;
35979        ResponseContentPartDoneEvent {
35980            r#type: &Default::default(),
35981            item_id,
35982            output_index,
35983            content_index,
35984            sequence_number,
35985            part,
35986        }
35987        .serialize(serializer)
35988    }
35989}
35990#[allow(clippy::module_inception)]
35991pub(crate) mod response_created_event {
35992    #[doc = "The type of the event. Always `response.created`.\n"]
35993    #[derive(Clone, Copy, Debug, Default, PartialEq)]
35994    pub(crate) struct Type;
35995    impl_serde!(Type, "response.created");
35996}
35997#[doc = "An event that is emitted when a response is created.\n"]
35998#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
35999pub struct ResponseCreatedEvent {
36000    #[doc = "The response that was created.\n"]
36001    pub response: crate::__types::Response,
36002    #[doc = "The sequence number for this event."]
36003    pub sequence_number: i64,
36004}
36005impl<'de> serde::Deserialize<'de> for ResponseCreatedEvent {
36006    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
36007    where
36008        D: serde::Deserializer<'de>,
36009    {
36010        #[serde_with::serde_as]
36011        #[derive(serde :: Deserialize)]
36012        struct ResponseCreatedEvent {
36013            #[serde(rename = "type")]
36014            #[allow(dead_code)]
36015            r#type: crate::__types::response_created_event::Type,
36016            #[serde(rename = "response")]
36017            response: crate::__types::Response,
36018            #[serde(rename = "sequence_number")]
36019            sequence_number: i64,
36020        }
36021        let ResponseCreatedEvent {
36022            response,
36023            sequence_number,
36024            ..
36025        } = ResponseCreatedEvent::deserialize(deserializer)?;
36026        Ok(Self {
36027            response,
36028            sequence_number,
36029        })
36030    }
36031}
36032impl serde::Serialize for ResponseCreatedEvent {
36033    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
36034    where
36035        S: serde::Serializer,
36036    {
36037        #[serde_with::serde_as]
36038        #[derive(serde :: Serialize)]
36039        struct ResponseCreatedEvent<'a> {
36040            #[serde(rename = "type")]
36041            r#type: &'a crate::__types::response_created_event::Type,
36042            #[serde(rename = "response")]
36043            response: &'a crate::__types::Response,
36044            #[serde(rename = "sequence_number")]
36045            sequence_number: &'a i64,
36046        }
36047        let Self {
36048            response,
36049            sequence_number,
36050        } = self;
36051        ResponseCreatedEvent {
36052            r#type: &Default::default(),
36053            response,
36054            sequence_number,
36055        }
36056        .serialize(serializer)
36057    }
36058}
36059#[allow(clippy::module_inception)]
36060pub(crate) mod response_custom_tool_call_input_delta_event {
36061    #[doc = "The event type identifier."]
36062    #[derive(Clone, Copy, Debug, Default, PartialEq)]
36063    pub(crate) struct Type;
36064    impl_serde!(Type, "response.custom_tool_call_input.delta");
36065}
36066#[doc = "Event representing a delta (partial update) to the input of a custom tool call.\n"]
36067#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
36068pub struct ResponseCustomToolCallInputDeltaEvent {
36069    #[doc = "The sequence number of this event."]
36070    pub sequence_number: i64,
36071    #[doc = "The index of the output this delta applies to."]
36072    pub output_index: i64,
36073    #[doc = "Unique identifier for the API item associated with this event."]
36074    pub item_id: String,
36075    #[doc = "The incremental input data (delta) for the custom tool call."]
36076    pub delta: String,
36077}
36078impl<'de> serde::Deserialize<'de> for ResponseCustomToolCallInputDeltaEvent {
36079    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
36080    where
36081        D: serde::Deserializer<'de>,
36082    {
36083        #[serde_with::serde_as]
36084        #[derive(serde :: Deserialize)]
36085        struct ResponseCustomToolCallInputDeltaEvent {
36086            #[serde(rename = "type")]
36087            #[allow(dead_code)]
36088            r#type: crate::__types::response_custom_tool_call_input_delta_event::Type,
36089            #[serde(rename = "sequence_number")]
36090            sequence_number: i64,
36091            #[serde(rename = "output_index")]
36092            output_index: i64,
36093            #[serde(rename = "item_id")]
36094            item_id: String,
36095            #[serde(rename = "delta")]
36096            delta: String,
36097        }
36098        let ResponseCustomToolCallInputDeltaEvent {
36099            sequence_number,
36100            output_index,
36101            item_id,
36102            delta,
36103            ..
36104        } = ResponseCustomToolCallInputDeltaEvent::deserialize(deserializer)?;
36105        Ok(Self {
36106            sequence_number,
36107            output_index,
36108            item_id,
36109            delta,
36110        })
36111    }
36112}
36113impl serde::Serialize for ResponseCustomToolCallInputDeltaEvent {
36114    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
36115    where
36116        S: serde::Serializer,
36117    {
36118        #[serde_with::serde_as]
36119        #[derive(serde :: Serialize)]
36120        struct ResponseCustomToolCallInputDeltaEvent<'a> {
36121            #[serde(rename = "type")]
36122            r#type: &'a crate::__types::response_custom_tool_call_input_delta_event::Type,
36123            #[serde(rename = "sequence_number")]
36124            sequence_number: &'a i64,
36125            #[serde(rename = "output_index")]
36126            output_index: &'a i64,
36127            #[serde(rename = "item_id")]
36128            item_id: &'a String,
36129            #[serde(rename = "delta")]
36130            delta: &'a String,
36131        }
36132        let Self {
36133            sequence_number,
36134            output_index,
36135            item_id,
36136            delta,
36137        } = self;
36138        ResponseCustomToolCallInputDeltaEvent {
36139            r#type: &Default::default(),
36140            sequence_number,
36141            output_index,
36142            item_id,
36143            delta,
36144        }
36145        .serialize(serializer)
36146    }
36147}
36148#[allow(clippy::module_inception)]
36149pub(crate) mod response_custom_tool_call_input_done_event {
36150    #[doc = "The event type identifier."]
36151    #[derive(Clone, Copy, Debug, Default, PartialEq)]
36152    pub(crate) struct Type;
36153    impl_serde!(Type, "response.custom_tool_call_input.done");
36154}
36155#[doc = "Event indicating that input for a custom tool call is complete.\n"]
36156#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
36157pub struct ResponseCustomToolCallInputDoneEvent {
36158    #[doc = "The sequence number of this event."]
36159    pub sequence_number: i64,
36160    #[doc = "The index of the output this event applies to."]
36161    pub output_index: i64,
36162    #[doc = "Unique identifier for the API item associated with this event."]
36163    pub item_id: String,
36164    #[doc = "The complete input data for the custom tool call."]
36165    pub input: String,
36166}
36167impl<'de> serde::Deserialize<'de> for ResponseCustomToolCallInputDoneEvent {
36168    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
36169    where
36170        D: serde::Deserializer<'de>,
36171    {
36172        #[serde_with::serde_as]
36173        #[derive(serde :: Deserialize)]
36174        struct ResponseCustomToolCallInputDoneEvent {
36175            #[serde(rename = "type")]
36176            #[allow(dead_code)]
36177            r#type: crate::__types::response_custom_tool_call_input_done_event::Type,
36178            #[serde(rename = "sequence_number")]
36179            sequence_number: i64,
36180            #[serde(rename = "output_index")]
36181            output_index: i64,
36182            #[serde(rename = "item_id")]
36183            item_id: String,
36184            #[serde(rename = "input")]
36185            input: String,
36186        }
36187        let ResponseCustomToolCallInputDoneEvent {
36188            sequence_number,
36189            output_index,
36190            item_id,
36191            input,
36192            ..
36193        } = ResponseCustomToolCallInputDoneEvent::deserialize(deserializer)?;
36194        Ok(Self {
36195            sequence_number,
36196            output_index,
36197            item_id,
36198            input,
36199        })
36200    }
36201}
36202impl serde::Serialize for ResponseCustomToolCallInputDoneEvent {
36203    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
36204    where
36205        S: serde::Serializer,
36206    {
36207        #[serde_with::serde_as]
36208        #[derive(serde :: Serialize)]
36209        struct ResponseCustomToolCallInputDoneEvent<'a> {
36210            #[serde(rename = "type")]
36211            r#type: &'a crate::__types::response_custom_tool_call_input_done_event::Type,
36212            #[serde(rename = "sequence_number")]
36213            sequence_number: &'a i64,
36214            #[serde(rename = "output_index")]
36215            output_index: &'a i64,
36216            #[serde(rename = "item_id")]
36217            item_id: &'a String,
36218            #[serde(rename = "input")]
36219            input: &'a String,
36220        }
36221        let Self {
36222            sequence_number,
36223            output_index,
36224            item_id,
36225            input,
36226        } = self;
36227        ResponseCustomToolCallInputDoneEvent {
36228            r#type: &Default::default(),
36229            sequence_number,
36230            output_index,
36231            item_id,
36232            input,
36233        }
36234        .serialize(serializer)
36235    }
36236}
36237#[doc = "An error object returned when the model fails to generate a Response.\n"]
36238#[derive(Clone, Debug, PartialEq)]
36239#[serde_with::serde_as]
36240#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
36241pub struct ResponseError {
36242    #[serde(rename = "code")]
36243    pub code: crate::__types::ResponseErrorCode,
36244    #[doc = "A human-readable description of the error.\n"]
36245    #[serde(rename = "message")]
36246    pub message: String,
36247}
36248#[doc = "The error code for the response.\n"]
36249#[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
36250pub enum ResponseErrorCode {
36251    #[doc = "`server_error`"]
36252    #[serde(rename = "server_error")]
36253    ServerError,
36254    #[doc = "`rate_limit_exceeded`"]
36255    #[serde(rename = "rate_limit_exceeded")]
36256    RateLimitExceeded,
36257    #[doc = "`invalid_prompt`"]
36258    #[serde(rename = "invalid_prompt")]
36259    InvalidPrompt,
36260    #[doc = "`vector_store_timeout`"]
36261    #[serde(rename = "vector_store_timeout")]
36262    VectorStoreTimeout,
36263    #[doc = "`invalid_image`"]
36264    #[serde(rename = "invalid_image")]
36265    InvalidImage,
36266    #[doc = "`invalid_image_format`"]
36267    #[serde(rename = "invalid_image_format")]
36268    InvalidImageFormat,
36269    #[doc = "`invalid_base64_image`"]
36270    #[serde(rename = "invalid_base64_image")]
36271    InvalidBase64Image,
36272    #[doc = "`invalid_image_url`"]
36273    #[serde(rename = "invalid_image_url")]
36274    InvalidImageUrl,
36275    #[doc = "`image_too_large`"]
36276    #[serde(rename = "image_too_large")]
36277    ImageTooLarge,
36278    #[doc = "`image_too_small`"]
36279    #[serde(rename = "image_too_small")]
36280    ImageTooSmall,
36281    #[doc = "`image_parse_error`"]
36282    #[serde(rename = "image_parse_error")]
36283    ImageParseError,
36284    #[doc = "`image_content_policy_violation`"]
36285    #[serde(rename = "image_content_policy_violation")]
36286    ImageContentPolicyViolation,
36287    #[doc = "`invalid_image_mode`"]
36288    #[serde(rename = "invalid_image_mode")]
36289    InvalidImageMode,
36290    #[doc = "`image_file_too_large`"]
36291    #[serde(rename = "image_file_too_large")]
36292    ImageFileTooLarge,
36293    #[doc = "`unsupported_image_media_type`"]
36294    #[serde(rename = "unsupported_image_media_type")]
36295    UnsupportedImageMediaType,
36296    #[doc = "`empty_image_file`"]
36297    #[serde(rename = "empty_image_file")]
36298    EmptyImageFile,
36299    #[doc = "`failed_to_download_image`"]
36300    #[serde(rename = "failed_to_download_image")]
36301    FailedToDownloadImage,
36302    #[doc = "`image_file_not_found`"]
36303    #[serde(rename = "image_file_not_found")]
36304    ImageFileNotFound,
36305}
36306#[allow(clippy::module_inception)]
36307pub(crate) mod response_error_event {
36308    #[doc = "The type of the event. Always `error`.\n"]
36309    #[derive(Clone, Copy, Debug, Default, PartialEq)]
36310    pub(crate) struct Type;
36311    impl_serde!(Type, "error");
36312}
36313#[doc = "Emitted when an error occurs."]
36314#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
36315pub struct ResponseErrorEvent {
36316    #[doc = "The error code.\n"]
36317    #[builder(default)]
36318    pub code: Option<String>,
36319    #[doc = "The error message.\n"]
36320    pub message: String,
36321    #[doc = "The error parameter.\n"]
36322    #[builder(default)]
36323    pub param: Option<String>,
36324    #[doc = "The sequence number of this event."]
36325    pub sequence_number: i64,
36326}
36327impl<'de> serde::Deserialize<'de> for ResponseErrorEvent {
36328    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
36329    where
36330        D: serde::Deserializer<'de>,
36331    {
36332        #[serde_with::serde_as]
36333        #[derive(serde :: Deserialize)]
36334        struct ResponseErrorEvent {
36335            #[serde(rename = "type")]
36336            #[allow(dead_code)]
36337            r#type: crate::__types::response_error_event::Type,
36338            #[serde(rename = "code")]
36339            code: Option<String>,
36340            #[serde(rename = "message")]
36341            message: String,
36342            #[serde(rename = "param")]
36343            param: Option<String>,
36344            #[serde(rename = "sequence_number")]
36345            sequence_number: i64,
36346        }
36347        let ResponseErrorEvent {
36348            code,
36349            message,
36350            param,
36351            sequence_number,
36352            ..
36353        } = ResponseErrorEvent::deserialize(deserializer)?;
36354        Ok(Self {
36355            code,
36356            message,
36357            param,
36358            sequence_number,
36359        })
36360    }
36361}
36362impl serde::Serialize for ResponseErrorEvent {
36363    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
36364    where
36365        S: serde::Serializer,
36366    {
36367        #[serde_with::serde_as]
36368        #[derive(serde :: Serialize)]
36369        struct ResponseErrorEvent<'a> {
36370            #[serde(rename = "type")]
36371            r#type: &'a crate::__types::response_error_event::Type,
36372            #[serde(rename = "code")]
36373            #[serde(skip_serializing_if = "Option::is_none")]
36374            code: &'a Option<String>,
36375            #[serde(rename = "message")]
36376            message: &'a String,
36377            #[serde(rename = "param")]
36378            #[serde(skip_serializing_if = "Option::is_none")]
36379            param: &'a Option<String>,
36380            #[serde(rename = "sequence_number")]
36381            sequence_number: &'a i64,
36382        }
36383        let Self {
36384            code,
36385            message,
36386            param,
36387            sequence_number,
36388        } = self;
36389        ResponseErrorEvent {
36390            r#type: &Default::default(),
36391            code,
36392            message,
36393            param,
36394            sequence_number,
36395        }
36396        .serialize(serializer)
36397    }
36398}
36399#[allow(clippy::module_inception)]
36400pub(crate) mod response_failed_event {
36401    #[doc = "The type of the event. Always `response.failed`.\n"]
36402    #[derive(Clone, Copy, Debug, Default, PartialEq)]
36403    pub(crate) struct Type;
36404    impl_serde!(Type, "response.failed");
36405}
36406#[doc = "An event that is emitted when a response fails.\n"]
36407#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
36408pub struct ResponseFailedEvent {
36409    #[doc = "The sequence number of this event."]
36410    pub sequence_number: i64,
36411    #[doc = "The response that failed.\n"]
36412    pub response: crate::__types::Response,
36413}
36414impl<'de> serde::Deserialize<'de> for ResponseFailedEvent {
36415    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
36416    where
36417        D: serde::Deserializer<'de>,
36418    {
36419        #[serde_with::serde_as]
36420        #[derive(serde :: Deserialize)]
36421        struct ResponseFailedEvent {
36422            #[serde(rename = "type")]
36423            #[allow(dead_code)]
36424            r#type: crate::__types::response_failed_event::Type,
36425            #[serde(rename = "sequence_number")]
36426            sequence_number: i64,
36427            #[serde(rename = "response")]
36428            response: crate::__types::Response,
36429        }
36430        let ResponseFailedEvent {
36431            sequence_number,
36432            response,
36433            ..
36434        } = ResponseFailedEvent::deserialize(deserializer)?;
36435        Ok(Self {
36436            sequence_number,
36437            response,
36438        })
36439    }
36440}
36441impl serde::Serialize for ResponseFailedEvent {
36442    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
36443    where
36444        S: serde::Serializer,
36445    {
36446        #[serde_with::serde_as]
36447        #[derive(serde :: Serialize)]
36448        struct ResponseFailedEvent<'a> {
36449            #[serde(rename = "type")]
36450            r#type: &'a crate::__types::response_failed_event::Type,
36451            #[serde(rename = "sequence_number")]
36452            sequence_number: &'a i64,
36453            #[serde(rename = "response")]
36454            response: &'a crate::__types::Response,
36455        }
36456        let Self {
36457            sequence_number,
36458            response,
36459        } = self;
36460        ResponseFailedEvent {
36461            r#type: &Default::default(),
36462            sequence_number,
36463            response,
36464        }
36465        .serialize(serializer)
36466    }
36467}
36468#[allow(clippy::module_inception)]
36469pub(crate) mod response_file_search_call_completed_event {
36470    #[doc = "The type of the event. Always `response.file_search_call.completed`.\n"]
36471    #[derive(Clone, Copy, Debug, Default, PartialEq)]
36472    pub(crate) struct Type;
36473    impl_serde!(Type, "response.file_search_call.completed");
36474}
36475#[doc = "Emitted when a file search call is completed (results found)."]
36476#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
36477pub struct ResponseFileSearchCallCompletedEvent {
36478    #[doc = "The index of the output item that the file search call is initiated.\n"]
36479    pub output_index: i64,
36480    #[doc = "The ID of the output item that the file search call is initiated.\n"]
36481    pub item_id: String,
36482    #[doc = "The sequence number of this event."]
36483    pub sequence_number: i64,
36484}
36485impl<'de> serde::Deserialize<'de> for ResponseFileSearchCallCompletedEvent {
36486    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
36487    where
36488        D: serde::Deserializer<'de>,
36489    {
36490        #[serde_with::serde_as]
36491        #[derive(serde :: Deserialize)]
36492        struct ResponseFileSearchCallCompletedEvent {
36493            #[serde(rename = "type")]
36494            #[allow(dead_code)]
36495            r#type: crate::__types::response_file_search_call_completed_event::Type,
36496            #[serde(rename = "output_index")]
36497            output_index: i64,
36498            #[serde(rename = "item_id")]
36499            item_id: String,
36500            #[serde(rename = "sequence_number")]
36501            sequence_number: i64,
36502        }
36503        let ResponseFileSearchCallCompletedEvent {
36504            output_index,
36505            item_id,
36506            sequence_number,
36507            ..
36508        } = ResponseFileSearchCallCompletedEvent::deserialize(deserializer)?;
36509        Ok(Self {
36510            output_index,
36511            item_id,
36512            sequence_number,
36513        })
36514    }
36515}
36516impl serde::Serialize for ResponseFileSearchCallCompletedEvent {
36517    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
36518    where
36519        S: serde::Serializer,
36520    {
36521        #[serde_with::serde_as]
36522        #[derive(serde :: Serialize)]
36523        struct ResponseFileSearchCallCompletedEvent<'a> {
36524            #[serde(rename = "type")]
36525            r#type: &'a crate::__types::response_file_search_call_completed_event::Type,
36526            #[serde(rename = "output_index")]
36527            output_index: &'a i64,
36528            #[serde(rename = "item_id")]
36529            item_id: &'a String,
36530            #[serde(rename = "sequence_number")]
36531            sequence_number: &'a i64,
36532        }
36533        let Self {
36534            output_index,
36535            item_id,
36536            sequence_number,
36537        } = self;
36538        ResponseFileSearchCallCompletedEvent {
36539            r#type: &Default::default(),
36540            output_index,
36541            item_id,
36542            sequence_number,
36543        }
36544        .serialize(serializer)
36545    }
36546}
36547#[allow(clippy::module_inception)]
36548pub(crate) mod response_file_search_call_in_progress_event {
36549    #[doc = "The type of the event. Always `response.file_search_call.in_progress`.\n"]
36550    #[derive(Clone, Copy, Debug, Default, PartialEq)]
36551    pub(crate) struct Type;
36552    impl_serde!(Type, "response.file_search_call.in_progress");
36553}
36554#[doc = "Emitted when a file search call is initiated."]
36555#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
36556pub struct ResponseFileSearchCallInProgressEvent {
36557    #[doc = "The index of the output item that the file search call is initiated.\n"]
36558    pub output_index: i64,
36559    #[doc = "The ID of the output item that the file search call is initiated.\n"]
36560    pub item_id: String,
36561    #[doc = "The sequence number of this event."]
36562    pub sequence_number: i64,
36563}
36564impl<'de> serde::Deserialize<'de> for ResponseFileSearchCallInProgressEvent {
36565    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
36566    where
36567        D: serde::Deserializer<'de>,
36568    {
36569        #[serde_with::serde_as]
36570        #[derive(serde :: Deserialize)]
36571        struct ResponseFileSearchCallInProgressEvent {
36572            #[serde(rename = "type")]
36573            #[allow(dead_code)]
36574            r#type: crate::__types::response_file_search_call_in_progress_event::Type,
36575            #[serde(rename = "output_index")]
36576            output_index: i64,
36577            #[serde(rename = "item_id")]
36578            item_id: String,
36579            #[serde(rename = "sequence_number")]
36580            sequence_number: i64,
36581        }
36582        let ResponseFileSearchCallInProgressEvent {
36583            output_index,
36584            item_id,
36585            sequence_number,
36586            ..
36587        } = ResponseFileSearchCallInProgressEvent::deserialize(deserializer)?;
36588        Ok(Self {
36589            output_index,
36590            item_id,
36591            sequence_number,
36592        })
36593    }
36594}
36595impl serde::Serialize for ResponseFileSearchCallInProgressEvent {
36596    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
36597    where
36598        S: serde::Serializer,
36599    {
36600        #[serde_with::serde_as]
36601        #[derive(serde :: Serialize)]
36602        struct ResponseFileSearchCallInProgressEvent<'a> {
36603            #[serde(rename = "type")]
36604            r#type: &'a crate::__types::response_file_search_call_in_progress_event::Type,
36605            #[serde(rename = "output_index")]
36606            output_index: &'a i64,
36607            #[serde(rename = "item_id")]
36608            item_id: &'a String,
36609            #[serde(rename = "sequence_number")]
36610            sequence_number: &'a i64,
36611        }
36612        let Self {
36613            output_index,
36614            item_id,
36615            sequence_number,
36616        } = self;
36617        ResponseFileSearchCallInProgressEvent {
36618            r#type: &Default::default(),
36619            output_index,
36620            item_id,
36621            sequence_number,
36622        }
36623        .serialize(serializer)
36624    }
36625}
36626#[allow(clippy::module_inception)]
36627pub(crate) mod response_file_search_call_searching_event {
36628    #[doc = "The type of the event. Always `response.file_search_call.searching`.\n"]
36629    #[derive(Clone, Copy, Debug, Default, PartialEq)]
36630    pub(crate) struct Type;
36631    impl_serde!(Type, "response.file_search_call.searching");
36632}
36633#[doc = "Emitted when a file search is currently searching."]
36634#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
36635pub struct ResponseFileSearchCallSearchingEvent {
36636    #[doc = "The index of the output item that the file search call is searching.\n"]
36637    pub output_index: i64,
36638    #[doc = "The ID of the output item that the file search call is initiated.\n"]
36639    pub item_id: String,
36640    #[doc = "The sequence number of this event."]
36641    pub sequence_number: i64,
36642}
36643impl<'de> serde::Deserialize<'de> for ResponseFileSearchCallSearchingEvent {
36644    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
36645    where
36646        D: serde::Deserializer<'de>,
36647    {
36648        #[serde_with::serde_as]
36649        #[derive(serde :: Deserialize)]
36650        struct ResponseFileSearchCallSearchingEvent {
36651            #[serde(rename = "type")]
36652            #[allow(dead_code)]
36653            r#type: crate::__types::response_file_search_call_searching_event::Type,
36654            #[serde(rename = "output_index")]
36655            output_index: i64,
36656            #[serde(rename = "item_id")]
36657            item_id: String,
36658            #[serde(rename = "sequence_number")]
36659            sequence_number: i64,
36660        }
36661        let ResponseFileSearchCallSearchingEvent {
36662            output_index,
36663            item_id,
36664            sequence_number,
36665            ..
36666        } = ResponseFileSearchCallSearchingEvent::deserialize(deserializer)?;
36667        Ok(Self {
36668            output_index,
36669            item_id,
36670            sequence_number,
36671        })
36672    }
36673}
36674impl serde::Serialize for ResponseFileSearchCallSearchingEvent {
36675    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
36676    where
36677        S: serde::Serializer,
36678    {
36679        #[serde_with::serde_as]
36680        #[derive(serde :: Serialize)]
36681        struct ResponseFileSearchCallSearchingEvent<'a> {
36682            #[serde(rename = "type")]
36683            r#type: &'a crate::__types::response_file_search_call_searching_event::Type,
36684            #[serde(rename = "output_index")]
36685            output_index: &'a i64,
36686            #[serde(rename = "item_id")]
36687            item_id: &'a String,
36688            #[serde(rename = "sequence_number")]
36689            sequence_number: &'a i64,
36690        }
36691        let Self {
36692            output_index,
36693            item_id,
36694            sequence_number,
36695        } = self;
36696        ResponseFileSearchCallSearchingEvent {
36697            r#type: &Default::default(),
36698            output_index,
36699            item_id,
36700            sequence_number,
36701        }
36702        .serialize(serializer)
36703    }
36704}
36705#[allow(clippy::module_inception)]
36706pub(crate) mod response_format_json_object {
36707    #[doc = "The type of response format being defined. Always `json_object`."]
36708    #[derive(Clone, Copy, Debug, Default, PartialEq)]
36709    pub(crate) struct Type;
36710    impl_serde!(Type, "json_object");
36711}
36712#[doc = "JSON object response format. An older method of generating JSON responses.\nUsing `json_schema` is recommended for models that support it. Note that the\nmodel will not generate JSON without a system or user message instructing it\nto do so.\n"]
36713#[derive(Clone, Copy, Debug, Default, PartialEq, typed_builder :: TypedBuilder)]
36714pub struct ResponseFormatJsonObject {}
36715impl<'de> serde::Deserialize<'de> for ResponseFormatJsonObject {
36716    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
36717    where
36718        D: serde::Deserializer<'de>,
36719    {
36720        #[serde_with::serde_as]
36721        #[derive(serde :: Deserialize)]
36722        struct ResponseFormatJsonObject {
36723            #[serde(rename = "type")]
36724            #[allow(dead_code)]
36725            r#type: crate::__types::response_format_json_object::Type,
36726        }
36727        let ResponseFormatJsonObject { .. } = ResponseFormatJsonObject::deserialize(deserializer)?;
36728        Ok(Self {})
36729    }
36730}
36731impl serde::Serialize for ResponseFormatJsonObject {
36732    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
36733    where
36734        S: serde::Serializer,
36735    {
36736        #[serde_with::serde_as]
36737        #[derive(serde :: Serialize)]
36738        struct ResponseFormatJsonObject<'a> {
36739            #[serde(rename = "type")]
36740            r#type: &'a crate::__types::response_format_json_object::Type,
36741        }
36742        let Self {} = self;
36743        ResponseFormatJsonObject {
36744            r#type: &Default::default(),
36745        }
36746        .serialize(serializer)
36747    }
36748}
36749#[allow(clippy::module_inception)]
36750pub mod response_format_json_schema {
36751    #[doc = "The type of response format being defined. Always `json_schema`."]
36752    #[derive(Clone, Copy, Debug, Default, PartialEq)]
36753    pub(crate) struct Type;
36754    impl_serde!(Type, "json_schema");
36755    #[doc = "Structured Outputs configuration options, including a JSON Schema.\n"]
36756    #[derive(Clone, Debug, PartialEq)]
36757    #[serde_with::serde_as]
36758    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
36759    pub struct JsonSchema {
36760        #[doc = "A description of what the response format is for, used by the model to\ndetermine how to respond in the format.\n"]
36761        #[serde(rename = "description")]
36762        #[serde(skip_serializing_if = "Option::is_none")]
36763        #[builder(default)]
36764        pub description: Option<String>,
36765        #[doc = "The name of the response format. Must be a-z, A-Z, 0-9, or contain\nunderscores and dashes, with a maximum length of 64.\n"]
36766        #[serde(rename = "name")]
36767        pub name: String,
36768        #[serde(rename = "schema")]
36769        #[serde(skip_serializing_if = "Option::is_none")]
36770        #[builder(default)]
36771        pub schema: Option<crate::__types::ResponseFormatJsonSchemaSchema>,
36772        #[doc = "Whether to enable strict schema adherence when generating the output.\nIf set to true, the model will always follow the exact schema defined\nin the `schema` field. Only a subset of JSON Schema is supported when\n`strict` is `true`. To learn more, read the [Structured Outputs\nguide](https://platform.openai.com/docs/guides/structured-outputs).\n"]
36773        #[serde(rename = "strict")]
36774        #[serde(skip_serializing_if = "Option::is_none")]
36775        #[builder(default)]
36776        pub strict: Option<bool>,
36777    }
36778}
36779#[doc = "JSON Schema response format. Used to generate structured JSON responses.\nLearn more about [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs).\n"]
36780#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
36781pub struct ResponseFormatJsonSchema {
36782    #[doc = "Structured Outputs configuration options, including a JSON Schema.\n"]
36783    pub json_schema: crate::__types::response_format_json_schema::JsonSchema,
36784}
36785impl<'de> serde::Deserialize<'de> for ResponseFormatJsonSchema {
36786    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
36787    where
36788        D: serde::Deserializer<'de>,
36789    {
36790        #[serde_with::serde_as]
36791        #[derive(serde :: Deserialize)]
36792        struct ResponseFormatJsonSchema {
36793            #[serde(rename = "type")]
36794            #[allow(dead_code)]
36795            r#type: crate::__types::response_format_json_schema::Type,
36796            #[serde(rename = "json_schema")]
36797            json_schema: crate::__types::response_format_json_schema::JsonSchema,
36798        }
36799        let ResponseFormatJsonSchema { json_schema, .. } =
36800            ResponseFormatJsonSchema::deserialize(deserializer)?;
36801        Ok(Self { json_schema })
36802    }
36803}
36804impl serde::Serialize for ResponseFormatJsonSchema {
36805    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
36806    where
36807        S: serde::Serializer,
36808    {
36809        #[serde_with::serde_as]
36810        #[derive(serde :: Serialize)]
36811        struct ResponseFormatJsonSchema<'a> {
36812            #[serde(rename = "type")]
36813            r#type: &'a crate::__types::response_format_json_schema::Type,
36814            #[serde(rename = "json_schema")]
36815            json_schema: &'a crate::__types::response_format_json_schema::JsonSchema,
36816        }
36817        let Self { json_schema } = self;
36818        ResponseFormatJsonSchema {
36819            r#type: &Default::default(),
36820            json_schema,
36821        }
36822        .serialize(serializer)
36823    }
36824}
36825#[doc = "The schema for the response format, described as a JSON Schema object.\nLearn how to build JSON schemas [here](https://json-schema.org/).\n"]
36826pub type ResponseFormatJsonSchemaSchema = indexmap::IndexMap<String, serde_json::Value>;
36827#[allow(clippy::module_inception)]
36828pub(crate) mod response_format_text {
36829    #[doc = "The type of response format being defined. Always `text`."]
36830    #[derive(Clone, Copy, Debug, Default, PartialEq)]
36831    pub(crate) struct Type;
36832    impl_serde!(Type, "text");
36833}
36834#[doc = "Default response format. Used to generate text responses.\n"]
36835#[derive(Clone, Copy, Debug, Default, PartialEq, typed_builder :: TypedBuilder)]
36836pub struct ResponseFormatText {}
36837impl<'de> serde::Deserialize<'de> for ResponseFormatText {
36838    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
36839    where
36840        D: serde::Deserializer<'de>,
36841    {
36842        #[serde_with::serde_as]
36843        #[derive(serde :: Deserialize)]
36844        struct ResponseFormatText {
36845            #[serde(rename = "type")]
36846            #[allow(dead_code)]
36847            r#type: crate::__types::response_format_text::Type,
36848        }
36849        let ResponseFormatText { .. } = ResponseFormatText::deserialize(deserializer)?;
36850        Ok(Self {})
36851    }
36852}
36853impl serde::Serialize for ResponseFormatText {
36854    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
36855    where
36856        S: serde::Serializer,
36857    {
36858        #[serde_with::serde_as]
36859        #[derive(serde :: Serialize)]
36860        struct ResponseFormatText<'a> {
36861            #[serde(rename = "type")]
36862            r#type: &'a crate::__types::response_format_text::Type,
36863        }
36864        let Self {} = self;
36865        ResponseFormatText {
36866            r#type: &Default::default(),
36867        }
36868        .serialize(serializer)
36869    }
36870}
36871#[allow(clippy::module_inception)]
36872pub(crate) mod response_format_text_grammar {
36873    #[doc = "The type of response format being defined. Always `grammar`."]
36874    #[derive(Clone, Copy, Debug, Default, PartialEq)]
36875    pub(crate) struct Type;
36876    impl_serde!(Type, "grammar");
36877}
36878#[doc = "A custom grammar for the model to follow when generating text.\nLearn more in the [custom grammars guide](https://platform.openai.com/docs/guides/custom-grammars).\n"]
36879#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
36880pub struct ResponseFormatTextGrammar {
36881    #[doc = "The custom grammar for the model to follow."]
36882    pub grammar: String,
36883}
36884impl<'de> serde::Deserialize<'de> for ResponseFormatTextGrammar {
36885    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
36886    where
36887        D: serde::Deserializer<'de>,
36888    {
36889        #[serde_with::serde_as]
36890        #[derive(serde :: Deserialize)]
36891        struct ResponseFormatTextGrammar {
36892            #[serde(rename = "type")]
36893            #[allow(dead_code)]
36894            r#type: crate::__types::response_format_text_grammar::Type,
36895            #[serde(rename = "grammar")]
36896            grammar: String,
36897        }
36898        let ResponseFormatTextGrammar { grammar, .. } =
36899            ResponseFormatTextGrammar::deserialize(deserializer)?;
36900        Ok(Self { grammar })
36901    }
36902}
36903impl serde::Serialize for ResponseFormatTextGrammar {
36904    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
36905    where
36906        S: serde::Serializer,
36907    {
36908        #[serde_with::serde_as]
36909        #[derive(serde :: Serialize)]
36910        struct ResponseFormatTextGrammar<'a> {
36911            #[serde(rename = "type")]
36912            r#type: &'a crate::__types::response_format_text_grammar::Type,
36913            #[serde(rename = "grammar")]
36914            grammar: &'a String,
36915        }
36916        let Self { grammar } = self;
36917        ResponseFormatTextGrammar {
36918            r#type: &Default::default(),
36919            grammar,
36920        }
36921        .serialize(serializer)
36922    }
36923}
36924#[allow(clippy::module_inception)]
36925pub(crate) mod response_format_text_python {
36926    #[doc = "The type of response format being defined. Always `python`."]
36927    #[derive(Clone, Copy, Debug, Default, PartialEq)]
36928    pub(crate) struct Type;
36929    impl_serde!(Type, "python");
36930}
36931#[doc = "Configure the model to generate valid Python code. See the\n[custom grammars guide](https://platform.openai.com/docs/guides/custom-grammars) for more details.\n"]
36932#[derive(Clone, Copy, Debug, Default, PartialEq, typed_builder :: TypedBuilder)]
36933pub struct ResponseFormatTextPython {}
36934impl<'de> serde::Deserialize<'de> for ResponseFormatTextPython {
36935    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
36936    where
36937        D: serde::Deserializer<'de>,
36938    {
36939        #[serde_with::serde_as]
36940        #[derive(serde :: Deserialize)]
36941        struct ResponseFormatTextPython {
36942            #[serde(rename = "type")]
36943            #[allow(dead_code)]
36944            r#type: crate::__types::response_format_text_python::Type,
36945        }
36946        let ResponseFormatTextPython { .. } = ResponseFormatTextPython::deserialize(deserializer)?;
36947        Ok(Self {})
36948    }
36949}
36950impl serde::Serialize for ResponseFormatTextPython {
36951    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
36952    where
36953        S: serde::Serializer,
36954    {
36955        #[serde_with::serde_as]
36956        #[derive(serde :: Serialize)]
36957        struct ResponseFormatTextPython<'a> {
36958            #[serde(rename = "type")]
36959            r#type: &'a crate::__types::response_format_text_python::Type,
36960        }
36961        let Self {} = self;
36962        ResponseFormatTextPython {
36963            r#type: &Default::default(),
36964        }
36965        .serialize(serializer)
36966    }
36967}
36968#[allow(clippy::module_inception)]
36969pub(crate) mod response_function_call_arguments_delta_event {
36970    #[doc = "The type of the event. Always `response.function_call_arguments.delta`.\n"]
36971    #[derive(Clone, Copy, Debug, Default, PartialEq)]
36972    pub(crate) struct Type;
36973    impl_serde!(Type, "response.function_call_arguments.delta");
36974}
36975#[doc = "Emitted when there is a partial function-call arguments delta."]
36976#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
36977pub struct ResponseFunctionCallArgumentsDeltaEvent {
36978    #[doc = "The ID of the output item that the function-call arguments delta is added to.\n"]
36979    pub item_id: String,
36980    #[doc = "The index of the output item that the function-call arguments delta is added to.\n"]
36981    pub output_index: i64,
36982    #[doc = "The sequence number of this event."]
36983    pub sequence_number: i64,
36984    #[doc = "The function-call arguments delta that is added.\n"]
36985    pub delta: String,
36986}
36987impl<'de> serde::Deserialize<'de> for ResponseFunctionCallArgumentsDeltaEvent {
36988    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
36989    where
36990        D: serde::Deserializer<'de>,
36991    {
36992        #[serde_with::serde_as]
36993        #[derive(serde :: Deserialize)]
36994        struct ResponseFunctionCallArgumentsDeltaEvent {
36995            #[serde(rename = "type")]
36996            #[allow(dead_code)]
36997            r#type: crate::__types::response_function_call_arguments_delta_event::Type,
36998            #[serde(rename = "item_id")]
36999            item_id: String,
37000            #[serde(rename = "output_index")]
37001            output_index: i64,
37002            #[serde(rename = "sequence_number")]
37003            sequence_number: i64,
37004            #[serde(rename = "delta")]
37005            delta: String,
37006        }
37007        let ResponseFunctionCallArgumentsDeltaEvent {
37008            item_id,
37009            output_index,
37010            sequence_number,
37011            delta,
37012            ..
37013        } = ResponseFunctionCallArgumentsDeltaEvent::deserialize(deserializer)?;
37014        Ok(Self {
37015            item_id,
37016            output_index,
37017            sequence_number,
37018            delta,
37019        })
37020    }
37021}
37022impl serde::Serialize for ResponseFunctionCallArgumentsDeltaEvent {
37023    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
37024    where
37025        S: serde::Serializer,
37026    {
37027        #[serde_with::serde_as]
37028        #[derive(serde :: Serialize)]
37029        struct ResponseFunctionCallArgumentsDeltaEvent<'a> {
37030            #[serde(rename = "type")]
37031            r#type: &'a crate::__types::response_function_call_arguments_delta_event::Type,
37032            #[serde(rename = "item_id")]
37033            item_id: &'a String,
37034            #[serde(rename = "output_index")]
37035            output_index: &'a i64,
37036            #[serde(rename = "sequence_number")]
37037            sequence_number: &'a i64,
37038            #[serde(rename = "delta")]
37039            delta: &'a String,
37040        }
37041        let Self {
37042            item_id,
37043            output_index,
37044            sequence_number,
37045            delta,
37046        } = self;
37047        ResponseFunctionCallArgumentsDeltaEvent {
37048            r#type: &Default::default(),
37049            item_id,
37050            output_index,
37051            sequence_number,
37052            delta,
37053        }
37054        .serialize(serializer)
37055    }
37056}
37057#[allow(clippy::module_inception)]
37058pub(crate) mod response_function_call_arguments_done_event {
37059    #[doc = "response.function_call_arguments.done"]
37060    #[derive(Clone, Copy, Debug, Default, PartialEq)]
37061    pub(crate) struct Type;
37062    impl_serde!(Type, "response.function_call_arguments.done");
37063}
37064#[doc = "Emitted when function-call arguments are finalized."]
37065#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
37066pub struct ResponseFunctionCallArgumentsDoneEvent {
37067    #[doc = "The ID of the item."]
37068    pub item_id: String,
37069    #[doc = "The index of the output item."]
37070    pub output_index: i64,
37071    #[doc = "The sequence number of this event."]
37072    pub sequence_number: i64,
37073    #[doc = "The function-call arguments."]
37074    pub arguments: String,
37075}
37076impl<'de> serde::Deserialize<'de> for ResponseFunctionCallArgumentsDoneEvent {
37077    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
37078    where
37079        D: serde::Deserializer<'de>,
37080    {
37081        #[serde_with::serde_as]
37082        #[derive(serde :: Deserialize)]
37083        struct ResponseFunctionCallArgumentsDoneEvent {
37084            #[serde(rename = "type")]
37085            #[allow(dead_code)]
37086            r#type: crate::__types::response_function_call_arguments_done_event::Type,
37087            #[serde(rename = "item_id")]
37088            item_id: String,
37089            #[serde(rename = "output_index")]
37090            output_index: i64,
37091            #[serde(rename = "sequence_number")]
37092            sequence_number: i64,
37093            #[serde(rename = "arguments")]
37094            arguments: String,
37095        }
37096        let ResponseFunctionCallArgumentsDoneEvent {
37097            item_id,
37098            output_index,
37099            sequence_number,
37100            arguments,
37101            ..
37102        } = ResponseFunctionCallArgumentsDoneEvent::deserialize(deserializer)?;
37103        Ok(Self {
37104            item_id,
37105            output_index,
37106            sequence_number,
37107            arguments,
37108        })
37109    }
37110}
37111impl serde::Serialize for ResponseFunctionCallArgumentsDoneEvent {
37112    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
37113    where
37114        S: serde::Serializer,
37115    {
37116        #[serde_with::serde_as]
37117        #[derive(serde :: Serialize)]
37118        struct ResponseFunctionCallArgumentsDoneEvent<'a> {
37119            #[serde(rename = "type")]
37120            r#type: &'a crate::__types::response_function_call_arguments_done_event::Type,
37121            #[serde(rename = "item_id")]
37122            item_id: &'a String,
37123            #[serde(rename = "output_index")]
37124            output_index: &'a i64,
37125            #[serde(rename = "sequence_number")]
37126            sequence_number: &'a i64,
37127            #[serde(rename = "arguments")]
37128            arguments: &'a String,
37129        }
37130        let Self {
37131            item_id,
37132            output_index,
37133            sequence_number,
37134            arguments,
37135        } = self;
37136        ResponseFunctionCallArgumentsDoneEvent {
37137            r#type: &Default::default(),
37138            item_id,
37139            output_index,
37140            sequence_number,
37141            arguments,
37142        }
37143        .serialize(serializer)
37144    }
37145}
37146#[allow(clippy::module_inception)]
37147pub(crate) mod response_image_gen_call_completed_event {
37148    #[doc = "The type of the event. Always 'response.image_generation_call.completed'."]
37149    #[derive(Clone, Copy, Debug, Default, PartialEq)]
37150    pub(crate) struct Type;
37151    impl_serde!(Type, "response.image_generation_call.completed");
37152}
37153#[doc = "Emitted when an image generation tool call has completed and the final image is available.\n"]
37154#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
37155pub struct ResponseImageGenCallCompletedEvent {
37156    #[doc = "The index of the output item in the response's output array."]
37157    pub output_index: i64,
37158    #[doc = "The sequence number of this event."]
37159    pub sequence_number: i64,
37160    #[doc = "The unique identifier of the image generation item being processed."]
37161    pub item_id: String,
37162}
37163impl<'de> serde::Deserialize<'de> for ResponseImageGenCallCompletedEvent {
37164    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
37165    where
37166        D: serde::Deserializer<'de>,
37167    {
37168        #[serde_with::serde_as]
37169        #[derive(serde :: Deserialize)]
37170        struct ResponseImageGenCallCompletedEvent {
37171            #[serde(rename = "type")]
37172            #[allow(dead_code)]
37173            r#type: crate::__types::response_image_gen_call_completed_event::Type,
37174            #[serde(rename = "output_index")]
37175            output_index: i64,
37176            #[serde(rename = "sequence_number")]
37177            sequence_number: i64,
37178            #[serde(rename = "item_id")]
37179            item_id: String,
37180        }
37181        let ResponseImageGenCallCompletedEvent {
37182            output_index,
37183            sequence_number,
37184            item_id,
37185            ..
37186        } = ResponseImageGenCallCompletedEvent::deserialize(deserializer)?;
37187        Ok(Self {
37188            output_index,
37189            sequence_number,
37190            item_id,
37191        })
37192    }
37193}
37194impl serde::Serialize for ResponseImageGenCallCompletedEvent {
37195    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
37196    where
37197        S: serde::Serializer,
37198    {
37199        #[serde_with::serde_as]
37200        #[derive(serde :: Serialize)]
37201        struct ResponseImageGenCallCompletedEvent<'a> {
37202            #[serde(rename = "type")]
37203            r#type: &'a crate::__types::response_image_gen_call_completed_event::Type,
37204            #[serde(rename = "output_index")]
37205            output_index: &'a i64,
37206            #[serde(rename = "sequence_number")]
37207            sequence_number: &'a i64,
37208            #[serde(rename = "item_id")]
37209            item_id: &'a String,
37210        }
37211        let Self {
37212            output_index,
37213            sequence_number,
37214            item_id,
37215        } = self;
37216        ResponseImageGenCallCompletedEvent {
37217            r#type: &Default::default(),
37218            output_index,
37219            sequence_number,
37220            item_id,
37221        }
37222        .serialize(serializer)
37223    }
37224}
37225#[allow(clippy::module_inception)]
37226pub(crate) mod response_image_gen_call_generating_event {
37227    #[doc = "The type of the event. Always 'response.image_generation_call.generating'."]
37228    #[derive(Clone, Copy, Debug, Default, PartialEq)]
37229    pub(crate) struct Type;
37230    impl_serde!(Type, "response.image_generation_call.generating");
37231}
37232#[doc = "Emitted when an image generation tool call is actively generating an image (intermediate state).\n"]
37233#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
37234pub struct ResponseImageGenCallGeneratingEvent {
37235    #[doc = "The index of the output item in the response's output array."]
37236    pub output_index: i64,
37237    #[doc = "The unique identifier of the image generation item being processed."]
37238    pub item_id: String,
37239    #[doc = "The sequence number of the image generation item being processed."]
37240    pub sequence_number: i64,
37241}
37242impl<'de> serde::Deserialize<'de> for ResponseImageGenCallGeneratingEvent {
37243    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
37244    where
37245        D: serde::Deserializer<'de>,
37246    {
37247        #[serde_with::serde_as]
37248        #[derive(serde :: Deserialize)]
37249        struct ResponseImageGenCallGeneratingEvent {
37250            #[serde(rename = "type")]
37251            #[allow(dead_code)]
37252            r#type: crate::__types::response_image_gen_call_generating_event::Type,
37253            #[serde(rename = "output_index")]
37254            output_index: i64,
37255            #[serde(rename = "item_id")]
37256            item_id: String,
37257            #[serde(rename = "sequence_number")]
37258            sequence_number: i64,
37259        }
37260        let ResponseImageGenCallGeneratingEvent {
37261            output_index,
37262            item_id,
37263            sequence_number,
37264            ..
37265        } = ResponseImageGenCallGeneratingEvent::deserialize(deserializer)?;
37266        Ok(Self {
37267            output_index,
37268            item_id,
37269            sequence_number,
37270        })
37271    }
37272}
37273impl serde::Serialize for ResponseImageGenCallGeneratingEvent {
37274    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
37275    where
37276        S: serde::Serializer,
37277    {
37278        #[serde_with::serde_as]
37279        #[derive(serde :: Serialize)]
37280        struct ResponseImageGenCallGeneratingEvent<'a> {
37281            #[serde(rename = "type")]
37282            r#type: &'a crate::__types::response_image_gen_call_generating_event::Type,
37283            #[serde(rename = "output_index")]
37284            output_index: &'a i64,
37285            #[serde(rename = "item_id")]
37286            item_id: &'a String,
37287            #[serde(rename = "sequence_number")]
37288            sequence_number: &'a i64,
37289        }
37290        let Self {
37291            output_index,
37292            item_id,
37293            sequence_number,
37294        } = self;
37295        ResponseImageGenCallGeneratingEvent {
37296            r#type: &Default::default(),
37297            output_index,
37298            item_id,
37299            sequence_number,
37300        }
37301        .serialize(serializer)
37302    }
37303}
37304#[allow(clippy::module_inception)]
37305pub(crate) mod response_image_gen_call_in_progress_event {
37306    #[doc = "The type of the event. Always 'response.image_generation_call.in_progress'."]
37307    #[derive(Clone, Copy, Debug, Default, PartialEq)]
37308    pub(crate) struct Type;
37309    impl_serde!(Type, "response.image_generation_call.in_progress");
37310}
37311#[doc = "Emitted when an image generation tool call is in progress.\n"]
37312#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
37313pub struct ResponseImageGenCallInProgressEvent {
37314    #[doc = "The index of the output item in the response's output array."]
37315    pub output_index: i64,
37316    #[doc = "The unique identifier of the image generation item being processed."]
37317    pub item_id: String,
37318    #[doc = "The sequence number of the image generation item being processed."]
37319    pub sequence_number: i64,
37320}
37321impl<'de> serde::Deserialize<'de> for ResponseImageGenCallInProgressEvent {
37322    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
37323    where
37324        D: serde::Deserializer<'de>,
37325    {
37326        #[serde_with::serde_as]
37327        #[derive(serde :: Deserialize)]
37328        struct ResponseImageGenCallInProgressEvent {
37329            #[serde(rename = "type")]
37330            #[allow(dead_code)]
37331            r#type: crate::__types::response_image_gen_call_in_progress_event::Type,
37332            #[serde(rename = "output_index")]
37333            output_index: i64,
37334            #[serde(rename = "item_id")]
37335            item_id: String,
37336            #[serde(rename = "sequence_number")]
37337            sequence_number: i64,
37338        }
37339        let ResponseImageGenCallInProgressEvent {
37340            output_index,
37341            item_id,
37342            sequence_number,
37343            ..
37344        } = ResponseImageGenCallInProgressEvent::deserialize(deserializer)?;
37345        Ok(Self {
37346            output_index,
37347            item_id,
37348            sequence_number,
37349        })
37350    }
37351}
37352impl serde::Serialize for ResponseImageGenCallInProgressEvent {
37353    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
37354    where
37355        S: serde::Serializer,
37356    {
37357        #[serde_with::serde_as]
37358        #[derive(serde :: Serialize)]
37359        struct ResponseImageGenCallInProgressEvent<'a> {
37360            #[serde(rename = "type")]
37361            r#type: &'a crate::__types::response_image_gen_call_in_progress_event::Type,
37362            #[serde(rename = "output_index")]
37363            output_index: &'a i64,
37364            #[serde(rename = "item_id")]
37365            item_id: &'a String,
37366            #[serde(rename = "sequence_number")]
37367            sequence_number: &'a i64,
37368        }
37369        let Self {
37370            output_index,
37371            item_id,
37372            sequence_number,
37373        } = self;
37374        ResponseImageGenCallInProgressEvent {
37375            r#type: &Default::default(),
37376            output_index,
37377            item_id,
37378            sequence_number,
37379        }
37380        .serialize(serializer)
37381    }
37382}
37383#[allow(clippy::module_inception)]
37384pub(crate) mod response_image_gen_call_partial_image_event {
37385    #[doc = "The type of the event. Always 'response.image_generation_call.partial_image'."]
37386    #[derive(Clone, Copy, Debug, Default, PartialEq)]
37387    pub(crate) struct Type;
37388    impl_serde!(Type, "response.image_generation_call.partial_image");
37389}
37390#[doc = "Emitted when a partial image is available during image generation streaming.\n"]
37391#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
37392pub struct ResponseImageGenCallPartialImageEvent {
37393    #[doc = "The index of the output item in the response's output array."]
37394    pub output_index: i64,
37395    #[doc = "The unique identifier of the image generation item being processed."]
37396    pub item_id: String,
37397    #[doc = "The sequence number of the image generation item being processed."]
37398    pub sequence_number: i64,
37399    #[doc = "0-based index for the partial image (backend is 1-based, but this is 0-based for the user)."]
37400    pub partial_image_index: i64,
37401    #[doc = "Base64-encoded partial image data, suitable for rendering as an image."]
37402    pub partial_image_b64: String,
37403}
37404impl<'de> serde::Deserialize<'de> for ResponseImageGenCallPartialImageEvent {
37405    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
37406    where
37407        D: serde::Deserializer<'de>,
37408    {
37409        #[serde_with::serde_as]
37410        #[derive(serde :: Deserialize)]
37411        struct ResponseImageGenCallPartialImageEvent {
37412            #[serde(rename = "type")]
37413            #[allow(dead_code)]
37414            r#type: crate::__types::response_image_gen_call_partial_image_event::Type,
37415            #[serde(rename = "output_index")]
37416            output_index: i64,
37417            #[serde(rename = "item_id")]
37418            item_id: String,
37419            #[serde(rename = "sequence_number")]
37420            sequence_number: i64,
37421            #[serde(rename = "partial_image_index")]
37422            partial_image_index: i64,
37423            #[serde(rename = "partial_image_b64")]
37424            partial_image_b64: String,
37425        }
37426        let ResponseImageGenCallPartialImageEvent {
37427            output_index,
37428            item_id,
37429            sequence_number,
37430            partial_image_index,
37431            partial_image_b64,
37432            ..
37433        } = ResponseImageGenCallPartialImageEvent::deserialize(deserializer)?;
37434        Ok(Self {
37435            output_index,
37436            item_id,
37437            sequence_number,
37438            partial_image_index,
37439            partial_image_b64,
37440        })
37441    }
37442}
37443impl serde::Serialize for ResponseImageGenCallPartialImageEvent {
37444    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
37445    where
37446        S: serde::Serializer,
37447    {
37448        #[serde_with::serde_as]
37449        #[derive(serde :: Serialize)]
37450        struct ResponseImageGenCallPartialImageEvent<'a> {
37451            #[serde(rename = "type")]
37452            r#type: &'a crate::__types::response_image_gen_call_partial_image_event::Type,
37453            #[serde(rename = "output_index")]
37454            output_index: &'a i64,
37455            #[serde(rename = "item_id")]
37456            item_id: &'a String,
37457            #[serde(rename = "sequence_number")]
37458            sequence_number: &'a i64,
37459            #[serde(rename = "partial_image_index")]
37460            partial_image_index: &'a i64,
37461            #[serde(rename = "partial_image_b64")]
37462            partial_image_b64: &'a String,
37463        }
37464        let Self {
37465            output_index,
37466            item_id,
37467            sequence_number,
37468            partial_image_index,
37469            partial_image_b64,
37470        } = self;
37471        ResponseImageGenCallPartialImageEvent {
37472            r#type: &Default::default(),
37473            output_index,
37474            item_id,
37475            sequence_number,
37476            partial_image_index,
37477            partial_image_b64,
37478        }
37479        .serialize(serializer)
37480    }
37481}
37482#[allow(clippy::module_inception)]
37483pub(crate) mod response_in_progress_event {
37484    #[doc = "The type of the event. Always `response.in_progress`.\n"]
37485    #[derive(Clone, Copy, Debug, Default, PartialEq)]
37486    pub(crate) struct Type;
37487    impl_serde!(Type, "response.in_progress");
37488}
37489#[doc = "Emitted when the response is in progress."]
37490#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
37491pub struct ResponseInProgressEvent {
37492    #[doc = "The response that is in progress.\n"]
37493    pub response: crate::__types::Response,
37494    #[doc = "The sequence number of this event."]
37495    pub sequence_number: i64,
37496}
37497impl<'de> serde::Deserialize<'de> for ResponseInProgressEvent {
37498    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
37499    where
37500        D: serde::Deserializer<'de>,
37501    {
37502        #[serde_with::serde_as]
37503        #[derive(serde :: Deserialize)]
37504        struct ResponseInProgressEvent {
37505            #[serde(rename = "type")]
37506            #[allow(dead_code)]
37507            r#type: crate::__types::response_in_progress_event::Type,
37508            #[serde(rename = "response")]
37509            response: crate::__types::Response,
37510            #[serde(rename = "sequence_number")]
37511            sequence_number: i64,
37512        }
37513        let ResponseInProgressEvent {
37514            response,
37515            sequence_number,
37516            ..
37517        } = ResponseInProgressEvent::deserialize(deserializer)?;
37518        Ok(Self {
37519            response,
37520            sequence_number,
37521        })
37522    }
37523}
37524impl serde::Serialize for ResponseInProgressEvent {
37525    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
37526    where
37527        S: serde::Serializer,
37528    {
37529        #[serde_with::serde_as]
37530        #[derive(serde :: Serialize)]
37531        struct ResponseInProgressEvent<'a> {
37532            #[serde(rename = "type")]
37533            r#type: &'a crate::__types::response_in_progress_event::Type,
37534            #[serde(rename = "response")]
37535            response: &'a crate::__types::Response,
37536            #[serde(rename = "sequence_number")]
37537            sequence_number: &'a i64,
37538        }
37539        let Self {
37540            response,
37541            sequence_number,
37542        } = self;
37543        ResponseInProgressEvent {
37544            r#type: &Default::default(),
37545            response,
37546            sequence_number,
37547        }
37548        .serialize(serializer)
37549    }
37550}
37551#[allow(clippy::module_inception)]
37552pub(crate) mod response_incomplete_event {
37553    #[doc = "The type of the event. Always `response.incomplete`.\n"]
37554    #[derive(Clone, Copy, Debug, Default, PartialEq)]
37555    pub(crate) struct Type;
37556    impl_serde!(Type, "response.incomplete");
37557}
37558#[doc = "An event that is emitted when a response finishes as incomplete.\n"]
37559#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
37560pub struct ResponseIncompleteEvent {
37561    #[doc = "The response that was incomplete.\n"]
37562    pub response: crate::__types::Response,
37563    #[doc = "The sequence number of this event."]
37564    pub sequence_number: i64,
37565}
37566impl<'de> serde::Deserialize<'de> for ResponseIncompleteEvent {
37567    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
37568    where
37569        D: serde::Deserializer<'de>,
37570    {
37571        #[serde_with::serde_as]
37572        #[derive(serde :: Deserialize)]
37573        struct ResponseIncompleteEvent {
37574            #[serde(rename = "type")]
37575            #[allow(dead_code)]
37576            r#type: crate::__types::response_incomplete_event::Type,
37577            #[serde(rename = "response")]
37578            response: crate::__types::Response,
37579            #[serde(rename = "sequence_number")]
37580            sequence_number: i64,
37581        }
37582        let ResponseIncompleteEvent {
37583            response,
37584            sequence_number,
37585            ..
37586        } = ResponseIncompleteEvent::deserialize(deserializer)?;
37587        Ok(Self {
37588            response,
37589            sequence_number,
37590        })
37591    }
37592}
37593impl serde::Serialize for ResponseIncompleteEvent {
37594    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
37595    where
37596        S: serde::Serializer,
37597    {
37598        #[serde_with::serde_as]
37599        #[derive(serde :: Serialize)]
37600        struct ResponseIncompleteEvent<'a> {
37601            #[serde(rename = "type")]
37602            r#type: &'a crate::__types::response_incomplete_event::Type,
37603            #[serde(rename = "response")]
37604            response: &'a crate::__types::Response,
37605            #[serde(rename = "sequence_number")]
37606            sequence_number: &'a i64,
37607        }
37608        let Self {
37609            response,
37610            sequence_number,
37611        } = self;
37612        ResponseIncompleteEvent {
37613            r#type: &Default::default(),
37614            response,
37615            sequence_number,
37616        }
37617        .serialize(serializer)
37618    }
37619}
37620#[allow(clippy::module_inception)]
37621pub(crate) mod response_item_list {
37622    #[doc = "The type of object returned, must be `list`."]
37623    #[derive(Clone, Copy, Debug, Default, PartialEq)]
37624    pub(crate) struct Object;
37625    impl_serde!(Object, "list");
37626}
37627#[doc = "A list of Response items."]
37628#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
37629pub struct ResponseItemList {
37630    #[doc = "A list of items used to generate this response."]
37631    pub data: Vec<crate::__types::ItemResource>,
37632    #[doc = "Whether there are more items available."]
37633    pub has_more: bool,
37634    #[doc = "The ID of the first item in the list."]
37635    pub first_id: String,
37636    #[doc = "The ID of the last item in the list."]
37637    pub last_id: String,
37638}
37639impl<'de> serde::Deserialize<'de> for ResponseItemList {
37640    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
37641    where
37642        D: serde::Deserializer<'de>,
37643    {
37644        #[serde_with::serde_as]
37645        #[derive(serde :: Deserialize)]
37646        struct ResponseItemList {
37647            #[serde(rename = "object")]
37648            #[allow(dead_code)]
37649            object: crate::__types::response_item_list::Object,
37650            #[serde(rename = "data")]
37651            data: Vec<crate::__types::ItemResource>,
37652            #[serde(rename = "has_more")]
37653            has_more: bool,
37654            #[serde(rename = "first_id")]
37655            first_id: String,
37656            #[serde(rename = "last_id")]
37657            last_id: String,
37658        }
37659        let ResponseItemList {
37660            data,
37661            has_more,
37662            first_id,
37663            last_id,
37664            ..
37665        } = ResponseItemList::deserialize(deserializer)?;
37666        Ok(Self {
37667            data,
37668            has_more,
37669            first_id,
37670            last_id,
37671        })
37672    }
37673}
37674impl serde::Serialize for ResponseItemList {
37675    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
37676    where
37677        S: serde::Serializer,
37678    {
37679        #[serde_with::serde_as]
37680        #[derive(serde :: Serialize)]
37681        struct ResponseItemList<'a> {
37682            #[serde(rename = "object")]
37683            object: &'a crate::__types::response_item_list::Object,
37684            #[serde(rename = "data")]
37685            data: &'a Vec<crate::__types::ItemResource>,
37686            #[serde(rename = "has_more")]
37687            has_more: &'a bool,
37688            #[serde(rename = "first_id")]
37689            first_id: &'a String,
37690            #[serde(rename = "last_id")]
37691            last_id: &'a String,
37692        }
37693        let Self {
37694            data,
37695            has_more,
37696            first_id,
37697            last_id,
37698        } = self;
37699        ResponseItemList {
37700            object: &Default::default(),
37701            data,
37702            has_more,
37703            first_id,
37704            last_id,
37705        }
37706        .serialize(serializer)
37707    }
37708}
37709#[allow(clippy::module_inception)]
37710pub mod response_log_prob {
37711    #[allow(clippy::module_inception)]
37712    pub mod top_logprobs {
37713        #[derive(Clone, Debug, Default, PartialEq)]
37714        #[serde_with::serde_as]
37715        #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
37716        pub struct Item {
37717            #[doc = "A possible text token."]
37718            #[serde(rename = "token")]
37719            #[serde(skip_serializing_if = "Option::is_none")]
37720            #[builder(default)]
37721            pub token: Option<String>,
37722            #[doc = "The log probability of this token."]
37723            #[serde(rename = "logprob")]
37724            #[serde(skip_serializing_if = "Option::is_none")]
37725            #[builder(default)]
37726            pub logprob: Option<serde_json::Number>,
37727        }
37728    }
37729}
37730#[doc = "A logprob is the logarithmic probability that the model assigns to producing \na particular token at a given position in the sequence. Less-negative (higher) \nlogprob values indicate greater model confidence in that token choice.\n"]
37731#[derive(Clone, Debug, PartialEq)]
37732#[serde_with::serde_as]
37733#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
37734pub struct ResponseLogProb {
37735    #[doc = "A possible text token."]
37736    #[serde(rename = "token")]
37737    pub token: String,
37738    #[doc = "The log probability of this token.\n"]
37739    #[serde(rename = "logprob")]
37740    pub logprob: serde_json::Number,
37741    #[doc = "The log probability of the top 20 most likely tokens.\n"]
37742    #[serde(rename = "top_logprobs")]
37743    #[serde(skip_serializing_if = "Option::is_none")]
37744    #[builder(default)]
37745    pub top_logprobs: Option<Vec<crate::__types::response_log_prob::top_logprobs::Item>>,
37746}
37747#[allow(clippy::module_inception)]
37748pub(crate) mod response_mcp_call_arguments_delta_event {
37749    #[doc = "The type of the event. Always 'response.mcp_call_arguments.delta'."]
37750    #[derive(Clone, Copy, Debug, Default, PartialEq)]
37751    pub(crate) struct Type;
37752    impl_serde!(Type, "response.mcp_call_arguments.delta");
37753}
37754#[doc = "Emitted when there is a delta (partial update) to the arguments of an MCP tool call.\n"]
37755#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
37756pub struct ResponseMcpCallArgumentsDeltaEvent {
37757    #[doc = "The index of the output item in the response's output array."]
37758    pub output_index: i64,
37759    #[doc = "The unique identifier of the MCP tool call item being processed."]
37760    pub item_id: String,
37761    #[doc = "A JSON string containing the partial update to the arguments for the MCP tool call.\n"]
37762    pub delta: String,
37763    #[doc = "The sequence number of this event."]
37764    pub sequence_number: i64,
37765}
37766impl<'de> serde::Deserialize<'de> for ResponseMcpCallArgumentsDeltaEvent {
37767    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
37768    where
37769        D: serde::Deserializer<'de>,
37770    {
37771        #[serde_with::serde_as]
37772        #[derive(serde :: Deserialize)]
37773        struct ResponseMcpCallArgumentsDeltaEvent {
37774            #[serde(rename = "type")]
37775            #[allow(dead_code)]
37776            r#type: crate::__types::response_mcp_call_arguments_delta_event::Type,
37777            #[serde(rename = "output_index")]
37778            output_index: i64,
37779            #[serde(rename = "item_id")]
37780            item_id: String,
37781            #[serde(rename = "delta")]
37782            delta: String,
37783            #[serde(rename = "sequence_number")]
37784            sequence_number: i64,
37785        }
37786        let ResponseMcpCallArgumentsDeltaEvent {
37787            output_index,
37788            item_id,
37789            delta,
37790            sequence_number,
37791            ..
37792        } = ResponseMcpCallArgumentsDeltaEvent::deserialize(deserializer)?;
37793        Ok(Self {
37794            output_index,
37795            item_id,
37796            delta,
37797            sequence_number,
37798        })
37799    }
37800}
37801impl serde::Serialize for ResponseMcpCallArgumentsDeltaEvent {
37802    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
37803    where
37804        S: serde::Serializer,
37805    {
37806        #[serde_with::serde_as]
37807        #[derive(serde :: Serialize)]
37808        struct ResponseMcpCallArgumentsDeltaEvent<'a> {
37809            #[serde(rename = "type")]
37810            r#type: &'a crate::__types::response_mcp_call_arguments_delta_event::Type,
37811            #[serde(rename = "output_index")]
37812            output_index: &'a i64,
37813            #[serde(rename = "item_id")]
37814            item_id: &'a String,
37815            #[serde(rename = "delta")]
37816            delta: &'a String,
37817            #[serde(rename = "sequence_number")]
37818            sequence_number: &'a i64,
37819        }
37820        let Self {
37821            output_index,
37822            item_id,
37823            delta,
37824            sequence_number,
37825        } = self;
37826        ResponseMcpCallArgumentsDeltaEvent {
37827            r#type: &Default::default(),
37828            output_index,
37829            item_id,
37830            delta,
37831            sequence_number,
37832        }
37833        .serialize(serializer)
37834    }
37835}
37836#[allow(clippy::module_inception)]
37837pub(crate) mod response_mcp_call_arguments_done_event {
37838    #[doc = "The type of the event. Always 'response.mcp_call_arguments.done'."]
37839    #[derive(Clone, Copy, Debug, Default, PartialEq)]
37840    pub(crate) struct Type;
37841    impl_serde!(Type, "response.mcp_call_arguments.done");
37842}
37843#[doc = "Emitted when the arguments for an MCP tool call are finalized.\n"]
37844#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
37845pub struct ResponseMcpCallArgumentsDoneEvent {
37846    #[doc = "The index of the output item in the response's output array."]
37847    pub output_index: i64,
37848    #[doc = "The unique identifier of the MCP tool call item being processed."]
37849    pub item_id: String,
37850    #[doc = "A JSON string containing the finalized arguments for the MCP tool call.\n"]
37851    pub arguments: String,
37852    #[doc = "The sequence number of this event."]
37853    pub sequence_number: i64,
37854}
37855impl<'de> serde::Deserialize<'de> for ResponseMcpCallArgumentsDoneEvent {
37856    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
37857    where
37858        D: serde::Deserializer<'de>,
37859    {
37860        #[serde_with::serde_as]
37861        #[derive(serde :: Deserialize)]
37862        struct ResponseMcpCallArgumentsDoneEvent {
37863            #[serde(rename = "type")]
37864            #[allow(dead_code)]
37865            r#type: crate::__types::response_mcp_call_arguments_done_event::Type,
37866            #[serde(rename = "output_index")]
37867            output_index: i64,
37868            #[serde(rename = "item_id")]
37869            item_id: String,
37870            #[serde(rename = "arguments")]
37871            arguments: String,
37872            #[serde(rename = "sequence_number")]
37873            sequence_number: i64,
37874        }
37875        let ResponseMcpCallArgumentsDoneEvent {
37876            output_index,
37877            item_id,
37878            arguments,
37879            sequence_number,
37880            ..
37881        } = ResponseMcpCallArgumentsDoneEvent::deserialize(deserializer)?;
37882        Ok(Self {
37883            output_index,
37884            item_id,
37885            arguments,
37886            sequence_number,
37887        })
37888    }
37889}
37890impl serde::Serialize for ResponseMcpCallArgumentsDoneEvent {
37891    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
37892    where
37893        S: serde::Serializer,
37894    {
37895        #[serde_with::serde_as]
37896        #[derive(serde :: Serialize)]
37897        struct ResponseMcpCallArgumentsDoneEvent<'a> {
37898            #[serde(rename = "type")]
37899            r#type: &'a crate::__types::response_mcp_call_arguments_done_event::Type,
37900            #[serde(rename = "output_index")]
37901            output_index: &'a i64,
37902            #[serde(rename = "item_id")]
37903            item_id: &'a String,
37904            #[serde(rename = "arguments")]
37905            arguments: &'a String,
37906            #[serde(rename = "sequence_number")]
37907            sequence_number: &'a i64,
37908        }
37909        let Self {
37910            output_index,
37911            item_id,
37912            arguments,
37913            sequence_number,
37914        } = self;
37915        ResponseMcpCallArgumentsDoneEvent {
37916            r#type: &Default::default(),
37917            output_index,
37918            item_id,
37919            arguments,
37920            sequence_number,
37921        }
37922        .serialize(serializer)
37923    }
37924}
37925#[allow(clippy::module_inception)]
37926pub(crate) mod response_mcp_call_completed_event {
37927    #[doc = "The type of the event. Always 'response.mcp_call.completed'."]
37928    #[derive(Clone, Copy, Debug, Default, PartialEq)]
37929    pub(crate) struct Type;
37930    impl_serde!(Type, "response.mcp_call.completed");
37931}
37932#[doc = "Emitted when an MCP  tool call has completed successfully.\n"]
37933#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
37934pub struct ResponseMcpCallCompletedEvent {
37935    #[doc = "The ID of the MCP tool call item that completed."]
37936    pub item_id: String,
37937    #[doc = "The index of the output item that completed."]
37938    pub output_index: i64,
37939    #[doc = "The sequence number of this event."]
37940    pub sequence_number: i64,
37941}
37942impl<'de> serde::Deserialize<'de> for ResponseMcpCallCompletedEvent {
37943    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
37944    where
37945        D: serde::Deserializer<'de>,
37946    {
37947        #[serde_with::serde_as]
37948        #[derive(serde :: Deserialize)]
37949        struct ResponseMcpCallCompletedEvent {
37950            #[serde(rename = "type")]
37951            #[allow(dead_code)]
37952            r#type: crate::__types::response_mcp_call_completed_event::Type,
37953            #[serde(rename = "item_id")]
37954            item_id: String,
37955            #[serde(rename = "output_index")]
37956            output_index: i64,
37957            #[serde(rename = "sequence_number")]
37958            sequence_number: i64,
37959        }
37960        let ResponseMcpCallCompletedEvent {
37961            item_id,
37962            output_index,
37963            sequence_number,
37964            ..
37965        } = ResponseMcpCallCompletedEvent::deserialize(deserializer)?;
37966        Ok(Self {
37967            item_id,
37968            output_index,
37969            sequence_number,
37970        })
37971    }
37972}
37973impl serde::Serialize for ResponseMcpCallCompletedEvent {
37974    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
37975    where
37976        S: serde::Serializer,
37977    {
37978        #[serde_with::serde_as]
37979        #[derive(serde :: Serialize)]
37980        struct ResponseMcpCallCompletedEvent<'a> {
37981            #[serde(rename = "type")]
37982            r#type: &'a crate::__types::response_mcp_call_completed_event::Type,
37983            #[serde(rename = "item_id")]
37984            item_id: &'a String,
37985            #[serde(rename = "output_index")]
37986            output_index: &'a i64,
37987            #[serde(rename = "sequence_number")]
37988            sequence_number: &'a i64,
37989        }
37990        let Self {
37991            item_id,
37992            output_index,
37993            sequence_number,
37994        } = self;
37995        ResponseMcpCallCompletedEvent {
37996            r#type: &Default::default(),
37997            item_id,
37998            output_index,
37999            sequence_number,
38000        }
38001        .serialize(serializer)
38002    }
38003}
38004#[allow(clippy::module_inception)]
38005pub(crate) mod response_mcp_call_failed_event {
38006    #[doc = "The type of the event. Always 'response.mcp_call.failed'."]
38007    #[derive(Clone, Copy, Debug, Default, PartialEq)]
38008    pub(crate) struct Type;
38009    impl_serde!(Type, "response.mcp_call.failed");
38010}
38011#[doc = "Emitted when an MCP  tool call has failed.\n"]
38012#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
38013pub struct ResponseMcpCallFailedEvent {
38014    #[doc = "The ID of the MCP tool call item that failed."]
38015    pub item_id: String,
38016    #[doc = "The index of the output item that failed."]
38017    pub output_index: i64,
38018    #[doc = "The sequence number of this event."]
38019    pub sequence_number: i64,
38020}
38021impl<'de> serde::Deserialize<'de> for ResponseMcpCallFailedEvent {
38022    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
38023    where
38024        D: serde::Deserializer<'de>,
38025    {
38026        #[serde_with::serde_as]
38027        #[derive(serde :: Deserialize)]
38028        struct ResponseMcpCallFailedEvent {
38029            #[serde(rename = "type")]
38030            #[allow(dead_code)]
38031            r#type: crate::__types::response_mcp_call_failed_event::Type,
38032            #[serde(rename = "item_id")]
38033            item_id: String,
38034            #[serde(rename = "output_index")]
38035            output_index: i64,
38036            #[serde(rename = "sequence_number")]
38037            sequence_number: i64,
38038        }
38039        let ResponseMcpCallFailedEvent {
38040            item_id,
38041            output_index,
38042            sequence_number,
38043            ..
38044        } = ResponseMcpCallFailedEvent::deserialize(deserializer)?;
38045        Ok(Self {
38046            item_id,
38047            output_index,
38048            sequence_number,
38049        })
38050    }
38051}
38052impl serde::Serialize for ResponseMcpCallFailedEvent {
38053    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
38054    where
38055        S: serde::Serializer,
38056    {
38057        #[serde_with::serde_as]
38058        #[derive(serde :: Serialize)]
38059        struct ResponseMcpCallFailedEvent<'a> {
38060            #[serde(rename = "type")]
38061            r#type: &'a crate::__types::response_mcp_call_failed_event::Type,
38062            #[serde(rename = "item_id")]
38063            item_id: &'a String,
38064            #[serde(rename = "output_index")]
38065            output_index: &'a i64,
38066            #[serde(rename = "sequence_number")]
38067            sequence_number: &'a i64,
38068        }
38069        let Self {
38070            item_id,
38071            output_index,
38072            sequence_number,
38073        } = self;
38074        ResponseMcpCallFailedEvent {
38075            r#type: &Default::default(),
38076            item_id,
38077            output_index,
38078            sequence_number,
38079        }
38080        .serialize(serializer)
38081    }
38082}
38083#[allow(clippy::module_inception)]
38084pub(crate) mod response_mcp_call_in_progress_event {
38085    #[doc = "The type of the event. Always 'response.mcp_call.in_progress'."]
38086    #[derive(Clone, Copy, Debug, Default, PartialEq)]
38087    pub(crate) struct Type;
38088    impl_serde!(Type, "response.mcp_call.in_progress");
38089}
38090#[doc = "Emitted when an MCP  tool call is in progress.\n"]
38091#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
38092pub struct ResponseMcpCallInProgressEvent {
38093    #[doc = "The sequence number of this event."]
38094    pub sequence_number: i64,
38095    #[doc = "The index of the output item in the response's output array."]
38096    pub output_index: i64,
38097    #[doc = "The unique identifier of the MCP tool call item being processed."]
38098    pub item_id: String,
38099}
38100impl<'de> serde::Deserialize<'de> for ResponseMcpCallInProgressEvent {
38101    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
38102    where
38103        D: serde::Deserializer<'de>,
38104    {
38105        #[serde_with::serde_as]
38106        #[derive(serde :: Deserialize)]
38107        struct ResponseMcpCallInProgressEvent {
38108            #[serde(rename = "type")]
38109            #[allow(dead_code)]
38110            r#type: crate::__types::response_mcp_call_in_progress_event::Type,
38111            #[serde(rename = "sequence_number")]
38112            sequence_number: i64,
38113            #[serde(rename = "output_index")]
38114            output_index: i64,
38115            #[serde(rename = "item_id")]
38116            item_id: String,
38117        }
38118        let ResponseMcpCallInProgressEvent {
38119            sequence_number,
38120            output_index,
38121            item_id,
38122            ..
38123        } = ResponseMcpCallInProgressEvent::deserialize(deserializer)?;
38124        Ok(Self {
38125            sequence_number,
38126            output_index,
38127            item_id,
38128        })
38129    }
38130}
38131impl serde::Serialize for ResponseMcpCallInProgressEvent {
38132    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
38133    where
38134        S: serde::Serializer,
38135    {
38136        #[serde_with::serde_as]
38137        #[derive(serde :: Serialize)]
38138        struct ResponseMcpCallInProgressEvent<'a> {
38139            #[serde(rename = "type")]
38140            r#type: &'a crate::__types::response_mcp_call_in_progress_event::Type,
38141            #[serde(rename = "sequence_number")]
38142            sequence_number: &'a i64,
38143            #[serde(rename = "output_index")]
38144            output_index: &'a i64,
38145            #[serde(rename = "item_id")]
38146            item_id: &'a String,
38147        }
38148        let Self {
38149            sequence_number,
38150            output_index,
38151            item_id,
38152        } = self;
38153        ResponseMcpCallInProgressEvent {
38154            r#type: &Default::default(),
38155            sequence_number,
38156            output_index,
38157            item_id,
38158        }
38159        .serialize(serializer)
38160    }
38161}
38162#[allow(clippy::module_inception)]
38163pub(crate) mod response_mcp_list_tools_completed_event {
38164    #[doc = "The type of the event. Always 'response.mcp_list_tools.completed'."]
38165    #[derive(Clone, Copy, Debug, Default, PartialEq)]
38166    pub(crate) struct Type;
38167    impl_serde!(Type, "response.mcp_list_tools.completed");
38168}
38169#[doc = "Emitted when the list of available MCP tools has been successfully retrieved.\n"]
38170#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
38171pub struct ResponseMcpListToolsCompletedEvent {
38172    #[doc = "The ID of the MCP tool call item that produced this output."]
38173    pub item_id: String,
38174    #[doc = "The index of the output item that was processed."]
38175    pub output_index: i64,
38176    #[doc = "The sequence number of this event."]
38177    pub sequence_number: i64,
38178}
38179impl<'de> serde::Deserialize<'de> for ResponseMcpListToolsCompletedEvent {
38180    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
38181    where
38182        D: serde::Deserializer<'de>,
38183    {
38184        #[serde_with::serde_as]
38185        #[derive(serde :: Deserialize)]
38186        struct ResponseMcpListToolsCompletedEvent {
38187            #[serde(rename = "type")]
38188            #[allow(dead_code)]
38189            r#type: crate::__types::response_mcp_list_tools_completed_event::Type,
38190            #[serde(rename = "item_id")]
38191            item_id: String,
38192            #[serde(rename = "output_index")]
38193            output_index: i64,
38194            #[serde(rename = "sequence_number")]
38195            sequence_number: i64,
38196        }
38197        let ResponseMcpListToolsCompletedEvent {
38198            item_id,
38199            output_index,
38200            sequence_number,
38201            ..
38202        } = ResponseMcpListToolsCompletedEvent::deserialize(deserializer)?;
38203        Ok(Self {
38204            item_id,
38205            output_index,
38206            sequence_number,
38207        })
38208    }
38209}
38210impl serde::Serialize for ResponseMcpListToolsCompletedEvent {
38211    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
38212    where
38213        S: serde::Serializer,
38214    {
38215        #[serde_with::serde_as]
38216        #[derive(serde :: Serialize)]
38217        struct ResponseMcpListToolsCompletedEvent<'a> {
38218            #[serde(rename = "type")]
38219            r#type: &'a crate::__types::response_mcp_list_tools_completed_event::Type,
38220            #[serde(rename = "item_id")]
38221            item_id: &'a String,
38222            #[serde(rename = "output_index")]
38223            output_index: &'a i64,
38224            #[serde(rename = "sequence_number")]
38225            sequence_number: &'a i64,
38226        }
38227        let Self {
38228            item_id,
38229            output_index,
38230            sequence_number,
38231        } = self;
38232        ResponseMcpListToolsCompletedEvent {
38233            r#type: &Default::default(),
38234            item_id,
38235            output_index,
38236            sequence_number,
38237        }
38238        .serialize(serializer)
38239    }
38240}
38241#[allow(clippy::module_inception)]
38242pub(crate) mod response_mcp_list_tools_failed_event {
38243    #[doc = "The type of the event. Always 'response.mcp_list_tools.failed'."]
38244    #[derive(Clone, Copy, Debug, Default, PartialEq)]
38245    pub(crate) struct Type;
38246    impl_serde!(Type, "response.mcp_list_tools.failed");
38247}
38248#[doc = "Emitted when the attempt to list available MCP tools has failed.\n"]
38249#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
38250pub struct ResponseMcpListToolsFailedEvent {
38251    #[doc = "The ID of the MCP tool call item that failed."]
38252    pub item_id: String,
38253    #[doc = "The index of the output item that failed."]
38254    pub output_index: i64,
38255    #[doc = "The sequence number of this event."]
38256    pub sequence_number: i64,
38257}
38258impl<'de> serde::Deserialize<'de> for ResponseMcpListToolsFailedEvent {
38259    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
38260    where
38261        D: serde::Deserializer<'de>,
38262    {
38263        #[serde_with::serde_as]
38264        #[derive(serde :: Deserialize)]
38265        struct ResponseMcpListToolsFailedEvent {
38266            #[serde(rename = "type")]
38267            #[allow(dead_code)]
38268            r#type: crate::__types::response_mcp_list_tools_failed_event::Type,
38269            #[serde(rename = "item_id")]
38270            item_id: String,
38271            #[serde(rename = "output_index")]
38272            output_index: i64,
38273            #[serde(rename = "sequence_number")]
38274            sequence_number: i64,
38275        }
38276        let ResponseMcpListToolsFailedEvent {
38277            item_id,
38278            output_index,
38279            sequence_number,
38280            ..
38281        } = ResponseMcpListToolsFailedEvent::deserialize(deserializer)?;
38282        Ok(Self {
38283            item_id,
38284            output_index,
38285            sequence_number,
38286        })
38287    }
38288}
38289impl serde::Serialize for ResponseMcpListToolsFailedEvent {
38290    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
38291    where
38292        S: serde::Serializer,
38293    {
38294        #[serde_with::serde_as]
38295        #[derive(serde :: Serialize)]
38296        struct ResponseMcpListToolsFailedEvent<'a> {
38297            #[serde(rename = "type")]
38298            r#type: &'a crate::__types::response_mcp_list_tools_failed_event::Type,
38299            #[serde(rename = "item_id")]
38300            item_id: &'a String,
38301            #[serde(rename = "output_index")]
38302            output_index: &'a i64,
38303            #[serde(rename = "sequence_number")]
38304            sequence_number: &'a i64,
38305        }
38306        let Self {
38307            item_id,
38308            output_index,
38309            sequence_number,
38310        } = self;
38311        ResponseMcpListToolsFailedEvent {
38312            r#type: &Default::default(),
38313            item_id,
38314            output_index,
38315            sequence_number,
38316        }
38317        .serialize(serializer)
38318    }
38319}
38320#[allow(clippy::module_inception)]
38321pub(crate) mod response_mcp_list_tools_in_progress_event {
38322    #[doc = "The type of the event. Always 'response.mcp_list_tools.in_progress'."]
38323    #[derive(Clone, Copy, Debug, Default, PartialEq)]
38324    pub(crate) struct Type;
38325    impl_serde!(Type, "response.mcp_list_tools.in_progress");
38326}
38327#[doc = "Emitted when the system is in the process of retrieving the list of available MCP tools.\n"]
38328#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
38329pub struct ResponseMcpListToolsInProgressEvent {
38330    #[doc = "The ID of the MCP tool call item that is being processed."]
38331    pub item_id: String,
38332    #[doc = "The index of the output item that is being processed."]
38333    pub output_index: i64,
38334    #[doc = "The sequence number of this event."]
38335    pub sequence_number: i64,
38336}
38337impl<'de> serde::Deserialize<'de> for ResponseMcpListToolsInProgressEvent {
38338    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
38339    where
38340        D: serde::Deserializer<'de>,
38341    {
38342        #[serde_with::serde_as]
38343        #[derive(serde :: Deserialize)]
38344        struct ResponseMcpListToolsInProgressEvent {
38345            #[serde(rename = "type")]
38346            #[allow(dead_code)]
38347            r#type: crate::__types::response_mcp_list_tools_in_progress_event::Type,
38348            #[serde(rename = "item_id")]
38349            item_id: String,
38350            #[serde(rename = "output_index")]
38351            output_index: i64,
38352            #[serde(rename = "sequence_number")]
38353            sequence_number: i64,
38354        }
38355        let ResponseMcpListToolsInProgressEvent {
38356            item_id,
38357            output_index,
38358            sequence_number,
38359            ..
38360        } = ResponseMcpListToolsInProgressEvent::deserialize(deserializer)?;
38361        Ok(Self {
38362            item_id,
38363            output_index,
38364            sequence_number,
38365        })
38366    }
38367}
38368impl serde::Serialize for ResponseMcpListToolsInProgressEvent {
38369    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
38370    where
38371        S: serde::Serializer,
38372    {
38373        #[serde_with::serde_as]
38374        #[derive(serde :: Serialize)]
38375        struct ResponseMcpListToolsInProgressEvent<'a> {
38376            #[serde(rename = "type")]
38377            r#type: &'a crate::__types::response_mcp_list_tools_in_progress_event::Type,
38378            #[serde(rename = "item_id")]
38379            item_id: &'a String,
38380            #[serde(rename = "output_index")]
38381            output_index: &'a i64,
38382            #[serde(rename = "sequence_number")]
38383            sequence_number: &'a i64,
38384        }
38385        let Self {
38386            item_id,
38387            output_index,
38388            sequence_number,
38389        } = self;
38390        ResponseMcpListToolsInProgressEvent {
38391            r#type: &Default::default(),
38392            item_id,
38393            output_index,
38394            sequence_number,
38395        }
38396        .serialize(serializer)
38397    }
38398}
38399#[allow(clippy::module_inception)]
38400pub mod response_modalities {
38401    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
38402    pub enum Item {
38403        #[doc = "`text`"]
38404        #[serde(rename = "text")]
38405        Text,
38406        #[doc = "`audio`"]
38407        #[serde(rename = "audio")]
38408        Audio,
38409    }
38410}
38411#[doc = "Output types that you would like the model to generate.\nMost models are capable of generating text, which is the default:\n\n`[\"text\"]`\n\nThe `gpt-4o-audio-preview` model can also be used to \n[generate audio](https://platform.openai.com/docs/guides/audio). To request that this model generate \nboth text and audio responses, you can use:\n\n`[\"text\", \"audio\"]`\n"]
38412pub type ResponseModalities = Vec<crate::__types::response_modalities::Item>;
38413#[allow(clippy::module_inception)]
38414pub(crate) mod response_output_item_added_event {
38415    #[doc = "The type of the event. Always `response.output_item.added`.\n"]
38416    #[derive(Clone, Copy, Debug, Default, PartialEq)]
38417    pub(crate) struct Type;
38418    impl_serde!(Type, "response.output_item.added");
38419}
38420#[doc = "Emitted when a new output item is added."]
38421#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
38422pub struct ResponseOutputItemAddedEvent {
38423    #[doc = "The index of the output item that was added.\n"]
38424    pub output_index: i64,
38425    #[doc = "The sequence number of this event.\n"]
38426    pub sequence_number: i64,
38427    #[doc = "The output item that was added.\n"]
38428    pub item: crate::__types::OutputItem,
38429}
38430impl<'de> serde::Deserialize<'de> for ResponseOutputItemAddedEvent {
38431    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
38432    where
38433        D: serde::Deserializer<'de>,
38434    {
38435        #[serde_with::serde_as]
38436        #[derive(serde :: Deserialize)]
38437        struct ResponseOutputItemAddedEvent {
38438            #[serde(rename = "type")]
38439            #[allow(dead_code)]
38440            r#type: crate::__types::response_output_item_added_event::Type,
38441            #[serde(rename = "output_index")]
38442            output_index: i64,
38443            #[serde(rename = "sequence_number")]
38444            sequence_number: i64,
38445            #[serde(rename = "item")]
38446            item: crate::__types::OutputItem,
38447        }
38448        let ResponseOutputItemAddedEvent {
38449            output_index,
38450            sequence_number,
38451            item,
38452            ..
38453        } = ResponseOutputItemAddedEvent::deserialize(deserializer)?;
38454        Ok(Self {
38455            output_index,
38456            sequence_number,
38457            item,
38458        })
38459    }
38460}
38461impl serde::Serialize for ResponseOutputItemAddedEvent {
38462    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
38463    where
38464        S: serde::Serializer,
38465    {
38466        #[serde_with::serde_as]
38467        #[derive(serde :: Serialize)]
38468        struct ResponseOutputItemAddedEvent<'a> {
38469            #[serde(rename = "type")]
38470            r#type: &'a crate::__types::response_output_item_added_event::Type,
38471            #[serde(rename = "output_index")]
38472            output_index: &'a i64,
38473            #[serde(rename = "sequence_number")]
38474            sequence_number: &'a i64,
38475            #[serde(rename = "item")]
38476            item: &'a crate::__types::OutputItem,
38477        }
38478        let Self {
38479            output_index,
38480            sequence_number,
38481            item,
38482        } = self;
38483        ResponseOutputItemAddedEvent {
38484            r#type: &Default::default(),
38485            output_index,
38486            sequence_number,
38487            item,
38488        }
38489        .serialize(serializer)
38490    }
38491}
38492#[allow(clippy::module_inception)]
38493pub(crate) mod response_output_item_done_event {
38494    #[doc = "The type of the event. Always `response.output_item.done`.\n"]
38495    #[derive(Clone, Copy, Debug, Default, PartialEq)]
38496    pub(crate) struct Type;
38497    impl_serde!(Type, "response.output_item.done");
38498}
38499#[doc = "Emitted when an output item is marked done."]
38500#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
38501pub struct ResponseOutputItemDoneEvent {
38502    #[doc = "The index of the output item that was marked done.\n"]
38503    pub output_index: i64,
38504    #[doc = "The sequence number of this event.\n"]
38505    pub sequence_number: i64,
38506    #[doc = "The output item that was marked done.\n"]
38507    pub item: crate::__types::OutputItem,
38508}
38509impl<'de> serde::Deserialize<'de> for ResponseOutputItemDoneEvent {
38510    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
38511    where
38512        D: serde::Deserializer<'de>,
38513    {
38514        #[serde_with::serde_as]
38515        #[derive(serde :: Deserialize)]
38516        struct ResponseOutputItemDoneEvent {
38517            #[serde(rename = "type")]
38518            #[allow(dead_code)]
38519            r#type: crate::__types::response_output_item_done_event::Type,
38520            #[serde(rename = "output_index")]
38521            output_index: i64,
38522            #[serde(rename = "sequence_number")]
38523            sequence_number: i64,
38524            #[serde(rename = "item")]
38525            item: crate::__types::OutputItem,
38526        }
38527        let ResponseOutputItemDoneEvent {
38528            output_index,
38529            sequence_number,
38530            item,
38531            ..
38532        } = ResponseOutputItemDoneEvent::deserialize(deserializer)?;
38533        Ok(Self {
38534            output_index,
38535            sequence_number,
38536            item,
38537        })
38538    }
38539}
38540impl serde::Serialize for ResponseOutputItemDoneEvent {
38541    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
38542    where
38543        S: serde::Serializer,
38544    {
38545        #[serde_with::serde_as]
38546        #[derive(serde :: Serialize)]
38547        struct ResponseOutputItemDoneEvent<'a> {
38548            #[serde(rename = "type")]
38549            r#type: &'a crate::__types::response_output_item_done_event::Type,
38550            #[serde(rename = "output_index")]
38551            output_index: &'a i64,
38552            #[serde(rename = "sequence_number")]
38553            sequence_number: &'a i64,
38554            #[serde(rename = "item")]
38555            item: &'a crate::__types::OutputItem,
38556        }
38557        let Self {
38558            output_index,
38559            sequence_number,
38560            item,
38561        } = self;
38562        ResponseOutputItemDoneEvent {
38563            r#type: &Default::default(),
38564            output_index,
38565            sequence_number,
38566            item,
38567        }
38568        .serialize(serializer)
38569    }
38570}
38571#[allow(clippy::module_inception)]
38572pub(crate) mod response_output_text_annotation_added_event {
38573    #[doc = "The type of the event. Always 'response.output_text.annotation.added'."]
38574    #[derive(Clone, Copy, Debug, Default, PartialEq)]
38575    pub(crate) struct Type;
38576    impl_serde!(Type, "response.output_text.annotation.added");
38577}
38578#[doc = "Emitted when an annotation is added to output text content.\n"]
38579#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
38580pub struct ResponseOutputTextAnnotationAddedEvent {
38581    #[doc = "The unique identifier of the item to which the annotation is being added."]
38582    pub item_id: String,
38583    #[doc = "The index of the output item in the response's output array."]
38584    pub output_index: i64,
38585    #[doc = "The index of the content part within the output item."]
38586    pub content_index: i64,
38587    #[doc = "The index of the annotation within the content part."]
38588    pub annotation_index: i64,
38589    #[doc = "The sequence number of this event."]
38590    pub sequence_number: i64,
38591    #[doc = "The annotation object being added. (See annotation schema for details.)"]
38592    pub annotation: indexmap::IndexMap<String, serde_json::Value>,
38593}
38594impl<'de> serde::Deserialize<'de> for ResponseOutputTextAnnotationAddedEvent {
38595    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
38596    where
38597        D: serde::Deserializer<'de>,
38598    {
38599        #[serde_with::serde_as]
38600        #[derive(serde :: Deserialize)]
38601        struct ResponseOutputTextAnnotationAddedEvent {
38602            #[serde(rename = "type")]
38603            #[allow(dead_code)]
38604            r#type: crate::__types::response_output_text_annotation_added_event::Type,
38605            #[serde(rename = "item_id")]
38606            item_id: String,
38607            #[serde(rename = "output_index")]
38608            output_index: i64,
38609            #[serde(rename = "content_index")]
38610            content_index: i64,
38611            #[serde(rename = "annotation_index")]
38612            annotation_index: i64,
38613            #[serde(rename = "sequence_number")]
38614            sequence_number: i64,
38615            #[serde(rename = "annotation")]
38616            annotation: indexmap::IndexMap<String, serde_json::Value>,
38617        }
38618        let ResponseOutputTextAnnotationAddedEvent {
38619            item_id,
38620            output_index,
38621            content_index,
38622            annotation_index,
38623            sequence_number,
38624            annotation,
38625            ..
38626        } = ResponseOutputTextAnnotationAddedEvent::deserialize(deserializer)?;
38627        Ok(Self {
38628            item_id,
38629            output_index,
38630            content_index,
38631            annotation_index,
38632            sequence_number,
38633            annotation,
38634        })
38635    }
38636}
38637impl serde::Serialize for ResponseOutputTextAnnotationAddedEvent {
38638    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
38639    where
38640        S: serde::Serializer,
38641    {
38642        #[serde_with::serde_as]
38643        #[derive(serde :: Serialize)]
38644        struct ResponseOutputTextAnnotationAddedEvent<'a> {
38645            #[serde(rename = "type")]
38646            r#type: &'a crate::__types::response_output_text_annotation_added_event::Type,
38647            #[serde(rename = "item_id")]
38648            item_id: &'a String,
38649            #[serde(rename = "output_index")]
38650            output_index: &'a i64,
38651            #[serde(rename = "content_index")]
38652            content_index: &'a i64,
38653            #[serde(rename = "annotation_index")]
38654            annotation_index: &'a i64,
38655            #[serde(rename = "sequence_number")]
38656            sequence_number: &'a i64,
38657            #[serde(rename = "annotation")]
38658            annotation: &'a indexmap::IndexMap<String, serde_json::Value>,
38659        }
38660        let Self {
38661            item_id,
38662            output_index,
38663            content_index,
38664            annotation_index,
38665            sequence_number,
38666            annotation,
38667        } = self;
38668        ResponseOutputTextAnnotationAddedEvent {
38669            r#type: &Default::default(),
38670            item_id,
38671            output_index,
38672            content_index,
38673            annotation_index,
38674            sequence_number,
38675            annotation,
38676        }
38677        .serialize(serializer)
38678    }
38679}
38680#[allow(clippy::module_inception)]
38681pub mod response_prompt_variables {
38682    #[derive(Clone, Debug, PartialEq)]
38683    #[serde_with::serde_as]
38684    #[derive(serde :: Deserialize, serde :: Serialize)]
38685    #[serde(untagged)]
38686    #[allow(clippy::large_enum_variant)]
38687    pub enum Item {
38688        Other(String),
38689        InputText(crate::__types::InputTextContent),
38690        InputImage(crate::__types::InputImageContent),
38691        InputFile(crate::__types::InputFileContent),
38692    }
38693}
38694#[doc = "Optional map of values to substitute in for variables in your\nprompt. The substitution values can either be strings, or other\nResponse input types like images or files.\n"]
38695pub type ResponsePromptVariables =
38696    indexmap::IndexMap<String, crate::__types::response_prompt_variables::Item>;
38697#[allow(clippy::module_inception)]
38698pub mod response_properties {
38699    #[doc = "Configuration options for a text response from the model. Can be plain\ntext or structured JSON data. Learn more:\n- [Text inputs and outputs](https://platform.openai.com/docs/guides/text)\n- [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs)\n"]
38700    #[derive(Clone, Debug, Default, PartialEq)]
38701    #[serde_with::serde_as]
38702    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
38703    pub struct Text {
38704        #[serde(rename = "format")]
38705        #[serde(skip_serializing_if = "Option::is_none")]
38706        #[builder(default)]
38707        pub format: Option<crate::__types::TextResponseFormatConfiguration>,
38708        #[serde(rename = "verbosity")]
38709        #[serde(skip_serializing_if = "Option::is_none")]
38710        #[builder(default)]
38711        pub verbosity: Option<crate::__types::Verbosity>,
38712    }
38713    #[doc = "How the model should select which tool (or tools) to use when generating\na response. See the `tools` parameter to see how to specify which tools\nthe model can call.\n"]
38714    #[derive(Clone, Debug, PartialEq)]
38715    #[allow(clippy::large_enum_variant)]
38716    pub enum ToolChoice {
38717        ToolChoiceOptions(crate::__types::ToolChoiceOptions),
38718        ToolChoiceAllowed(crate::__types::ToolChoiceAllowed),
38719        ToolChoiceTypes(crate::__types::ToolChoiceTypes),
38720        ToolChoiceFunction(crate::__types::ToolChoiceFunction),
38721        ToolChoiceMcp(crate::__types::ToolChoiceMcp),
38722        ToolChoiceCustom(crate::__types::ToolChoiceCustom),
38723    }
38724    impl<'de> serde::Deserialize<'de> for ToolChoice {
38725        fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
38726        where
38727            D: serde::Deserializer<'de>,
38728        {
38729            #[serde_with::serde_as]
38730            #[derive(serde :: Deserialize)]
38731            #[serde(untagged)]
38732            #[allow(clippy::enum_variant_names, clippy::large_enum_variant)]
38733            enum ToolChoice {
38734                ToolChoiceOptions(crate::__types::ToolChoiceOptions),
38735                ToolChoiceAllowed(crate::__types::ToolChoiceAllowed),
38736                ToolChoiceTypes(crate::__types::ToolChoiceTypes),
38737                ToolChoiceFunction(crate::__types::ToolChoiceFunction),
38738                ToolChoiceMcp(crate::__types::ToolChoiceMcp),
38739                ToolChoiceCustom(crate::__types::ToolChoiceCustom),
38740            }
38741            Ok(match ToolChoice::deserialize(deserializer)? {
38742                ToolChoice::ToolChoiceOptions(v) => Self::ToolChoiceOptions(v),
38743                ToolChoice::ToolChoiceAllowed(v) => Self::ToolChoiceAllowed(v),
38744                ToolChoice::ToolChoiceTypes(v) => Self::ToolChoiceTypes(v),
38745                ToolChoice::ToolChoiceFunction(v) => Self::ToolChoiceFunction(v),
38746                ToolChoice::ToolChoiceMcp(v) => Self::ToolChoiceMcp(v),
38747                ToolChoice::ToolChoiceCustom(v) => Self::ToolChoiceCustom(v),
38748            })
38749        }
38750    }
38751    impl serde::Serialize for ToolChoice {
38752        fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
38753        where
38754            S: serde::Serializer,
38755        {
38756            #[serde_with::serde_as]
38757            #[derive(serde :: Serialize)]
38758            #[serde(untagged)]
38759            #[allow(clippy::enum_variant_names)]
38760            enum ToolChoice<'a> {
38761                ToolChoiceOptions(&'a crate::__types::ToolChoiceOptions),
38762                ToolChoiceAllowed(&'a crate::__types::ToolChoiceAllowed),
38763                ToolChoiceTypes(&'a crate::__types::ToolChoiceTypes),
38764                ToolChoiceFunction(&'a crate::__types::ToolChoiceFunction),
38765                ToolChoiceMcp(&'a crate::__types::ToolChoiceMcp),
38766                ToolChoiceCustom(&'a crate::__types::ToolChoiceCustom),
38767            }
38768            match self {
38769                Self::ToolChoiceOptions(v) => ToolChoice::ToolChoiceOptions(v),
38770                Self::ToolChoiceAllowed(v) => ToolChoice::ToolChoiceAllowed(v),
38771                Self::ToolChoiceTypes(v) => ToolChoice::ToolChoiceTypes(v),
38772                Self::ToolChoiceFunction(v) => ToolChoice::ToolChoiceFunction(v),
38773                Self::ToolChoiceMcp(v) => ToolChoice::ToolChoiceMcp(v),
38774                Self::ToolChoiceCustom(v) => ToolChoice::ToolChoiceCustom(v),
38775            }
38776            .serialize(serializer)
38777        }
38778    }
38779    #[doc = "The truncation strategy to use for the model response.\n- `auto`: If the context of this response and previous ones exceeds\n  the model's context window size, the model will truncate the\n  response to fit the context window by dropping input items in the\n  middle of the conversation.\n- `disabled` (default): If a model response will exceed the context window\n  size for a model, the request will fail with a 400 error.\n"]
38780    #[derive(Clone, Copy, Debug, Default, PartialEq, serde :: Deserialize, serde :: Serialize)]
38781    pub enum Truncation {
38782        #[doc = "`auto`"]
38783        #[serde(rename = "auto")]
38784        Auto,
38785        #[doc = "`disabled`"]
38786        #[default]
38787        #[serde(rename = "disabled")]
38788        Disabled,
38789    }
38790}
38791#[derive(Clone, Debug, Default, PartialEq)]
38792#[serde_with::serde_as]
38793#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
38794pub struct ResponseProperties {
38795    #[doc = "The unique ID of the previous response to the model. Use this to\ncreate multi-turn conversations. Learn more about\n[conversation state](https://platform.openai.com/docs/guides/conversation-state). Cannot be used in conjunction with `conversation`.\n"]
38796    #[serde(rename = "previous_response_id")]
38797    #[serde(skip_serializing_if = "Option::is_none")]
38798    #[builder(default)]
38799    pub previous_response_id: Option<String>,
38800    #[doc = "Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI\noffers a wide range of models with different capabilities, performance\ncharacteristics, and price points. Refer to the [model guide](https://platform.openai.com/docs/models)\nto browse and compare available models.\n"]
38801    #[serde(rename = "model")]
38802    #[serde(skip_serializing_if = "Option::is_none")]
38803    #[builder(default)]
38804    pub model: Option<crate::__types::ModelIdsResponses>,
38805    #[serde(rename = "reasoning")]
38806    #[serde(skip_serializing_if = "Option::is_none")]
38807    #[builder(default)]
38808    pub reasoning: Option<crate::__types::Reasoning>,
38809    #[doc = "Whether to run the model response in the background.\n[Learn more](https://platform.openai.com/docs/guides/background).\n"]
38810    #[serde(rename = "background")]
38811    #[serde(skip_serializing_if = "Option::is_none")]
38812    #[builder(default)]
38813    pub background: Option<bool>,
38814    #[doc = "An upper bound for the number of tokens that can be generated for a response, including visible output tokens and [reasoning tokens](https://platform.openai.com/docs/guides/reasoning).\n"]
38815    #[serde(rename = "max_output_tokens")]
38816    #[serde(skip_serializing_if = "Option::is_none")]
38817    #[builder(default)]
38818    pub max_output_tokens: Option<i64>,
38819    #[doc = "The maximum number of total calls to built-in tools that can be processed in a response. This maximum number applies across all built-in tool calls, not per individual tool. Any further attempts to call a tool by the model will be ignored.\n"]
38820    #[serde(rename = "max_tool_calls")]
38821    #[serde(skip_serializing_if = "Option::is_none")]
38822    #[builder(default)]
38823    pub max_tool_calls: Option<i64>,
38824    #[doc = "Configuration options for a text response from the model. Can be plain\ntext or structured JSON data. Learn more:\n- [Text inputs and outputs](https://platform.openai.com/docs/guides/text)\n- [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs)\n"]
38825    #[serde(rename = "text")]
38826    #[serde(skip_serializing_if = "Option::is_none")]
38827    #[builder(default)]
38828    pub text: Option<crate::__types::response_properties::Text>,
38829    #[doc = "An array of tools the model may call while generating a response. You\ncan specify which tool to use by setting the `tool_choice` parameter.\n\nThe two categories of tools you can provide the model are:\n\n- **Built-in tools**: Tools that are provided by OpenAI that extend the\n  model's capabilities, like [web search](https://platform.openai.com/docs/guides/tools-web-search)\n  or [file search](https://platform.openai.com/docs/guides/tools-file-search). Learn more about\n  [built-in tools](https://platform.openai.com/docs/guides/tools).\n- **Function calls (custom tools)**: Functions that are defined by you,\n  enabling the model to call your own code with strongly typed arguments\n  and outputs. Learn more about\n  [function calling](https://platform.openai.com/docs/guides/function-calling). You can also use\n  custom tools to call your own code.\n"]
38830    #[serde(rename = "tools")]
38831    #[serde(skip_serializing_if = "Option::is_none")]
38832    #[builder(default)]
38833    pub tools: Option<Vec<crate::__types::Tool>>,
38834    #[doc = "How the model should select which tool (or tools) to use when generating\na response. See the `tools` parameter to see how to specify which tools\nthe model can call.\n"]
38835    #[serde(rename = "tool_choice")]
38836    #[serde(skip_serializing_if = "Option::is_none")]
38837    #[builder(default)]
38838    pub tool_choice: Option<crate::__types::response_properties::ToolChoice>,
38839    #[serde(rename = "prompt")]
38840    #[serde(skip_serializing_if = "Option::is_none")]
38841    #[builder(default)]
38842    pub prompt: Option<crate::__types::Prompt>,
38843    #[doc = "The truncation strategy to use for the model response.\n- `auto`: If the context of this response and previous ones exceeds\n  the model's context window size, the model will truncate the\n  response to fit the context window by dropping input items in the\n  middle of the conversation.\n- `disabled` (default): If a model response will exceed the context window\n  size for a model, the request will fail with a 400 error.\n"]
38844    #[serde(rename = "truncation")]
38845    #[serde(skip_serializing_if = "Option::is_none")]
38846    #[builder(default)]
38847    pub truncation: Option<crate::__types::response_properties::Truncation>,
38848}
38849#[allow(clippy::module_inception)]
38850pub(crate) mod response_queued_event {
38851    #[doc = "The type of the event. Always 'response.queued'."]
38852    #[derive(Clone, Copy, Debug, Default, PartialEq)]
38853    pub(crate) struct Type;
38854    impl_serde!(Type, "response.queued");
38855}
38856#[doc = "Emitted when a response is queued and waiting to be processed.\n"]
38857#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
38858pub struct ResponseQueuedEvent {
38859    #[doc = "The full response object that is queued."]
38860    pub response: crate::__types::Response,
38861    #[doc = "The sequence number for this event."]
38862    pub sequence_number: i64,
38863}
38864impl<'de> serde::Deserialize<'de> for ResponseQueuedEvent {
38865    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
38866    where
38867        D: serde::Deserializer<'de>,
38868    {
38869        #[serde_with::serde_as]
38870        #[derive(serde :: Deserialize)]
38871        struct ResponseQueuedEvent {
38872            #[serde(rename = "type")]
38873            #[allow(dead_code)]
38874            r#type: crate::__types::response_queued_event::Type,
38875            #[serde(rename = "response")]
38876            response: crate::__types::Response,
38877            #[serde(rename = "sequence_number")]
38878            sequence_number: i64,
38879        }
38880        let ResponseQueuedEvent {
38881            response,
38882            sequence_number,
38883            ..
38884        } = ResponseQueuedEvent::deserialize(deserializer)?;
38885        Ok(Self {
38886            response,
38887            sequence_number,
38888        })
38889    }
38890}
38891impl serde::Serialize for ResponseQueuedEvent {
38892    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
38893    where
38894        S: serde::Serializer,
38895    {
38896        #[serde_with::serde_as]
38897        #[derive(serde :: Serialize)]
38898        struct ResponseQueuedEvent<'a> {
38899            #[serde(rename = "type")]
38900            r#type: &'a crate::__types::response_queued_event::Type,
38901            #[serde(rename = "response")]
38902            response: &'a crate::__types::Response,
38903            #[serde(rename = "sequence_number")]
38904            sequence_number: &'a i64,
38905        }
38906        let Self {
38907            response,
38908            sequence_number,
38909        } = self;
38910        ResponseQueuedEvent {
38911            r#type: &Default::default(),
38912            response,
38913            sequence_number,
38914        }
38915        .serialize(serializer)
38916    }
38917}
38918#[allow(clippy::module_inception)]
38919pub mod response_reasoning_summary_part_added_event {
38920    #[doc = "The type of the event. Always `response.reasoning_summary_part.added`.\n"]
38921    #[derive(Clone, Copy, Debug, Default, PartialEq)]
38922    pub(crate) struct Type;
38923    impl_serde!(Type, "response.reasoning_summary_part.added");
38924    #[allow(clippy::module_inception)]
38925    pub(crate) mod part {
38926        #[doc = "The type of the summary part. Always `summary_text`."]
38927        #[derive(Clone, Copy, Debug, Default, PartialEq)]
38928        pub(crate) struct Type;
38929        impl_serde!(Type, "summary_text");
38930    }
38931    #[doc = "The summary part that was added.\n"]
38932    #[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
38933    pub struct Part {
38934        #[doc = "The text of the summary part."]
38935        pub text: String,
38936    }
38937    impl<'de> serde::Deserialize<'de> for Part {
38938        fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
38939        where
38940            D: serde::Deserializer<'de>,
38941        {
38942            #[serde_with::serde_as]
38943            #[derive(serde :: Deserialize)]
38944            struct Part {
38945                #[serde(rename = "type")]
38946                #[allow(dead_code)]
38947                r#type: crate::__types::response_reasoning_summary_part_added_event::part::Type,
38948                #[serde(rename = "text")]
38949                text: String,
38950            }
38951            let Part { text, .. } = Part::deserialize(deserializer)?;
38952            Ok(Self { text })
38953        }
38954    }
38955    impl serde::Serialize for Part {
38956        fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
38957        where
38958            S: serde::Serializer,
38959        {
38960            #[serde_with::serde_as]
38961            #[derive(serde :: Serialize)]
38962            struct Part<'a> {
38963                #[serde(rename = "type")]
38964                r#type: &'a crate::__types::response_reasoning_summary_part_added_event::part::Type,
38965                #[serde(rename = "text")]
38966                text: &'a String,
38967            }
38968            let Self { text } = self;
38969            Part {
38970                r#type: &Default::default(),
38971                text,
38972            }
38973            .serialize(serializer)
38974        }
38975    }
38976}
38977#[doc = "Emitted when a new reasoning summary part is added."]
38978#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
38979pub struct ResponseReasoningSummaryPartAddedEvent {
38980    #[doc = "The ID of the item this summary part is associated with.\n"]
38981    pub item_id: String,
38982    #[doc = "The index of the output item this summary part is associated with.\n"]
38983    pub output_index: i64,
38984    #[doc = "The index of the summary part within the reasoning summary.\n"]
38985    pub summary_index: i64,
38986    #[doc = "The sequence number of this event.\n"]
38987    pub sequence_number: i64,
38988    #[doc = "The summary part that was added.\n"]
38989    pub part: crate::__types::response_reasoning_summary_part_added_event::Part,
38990}
38991impl<'de> serde::Deserialize<'de> for ResponseReasoningSummaryPartAddedEvent {
38992    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
38993    where
38994        D: serde::Deserializer<'de>,
38995    {
38996        #[serde_with::serde_as]
38997        #[derive(serde :: Deserialize)]
38998        struct ResponseReasoningSummaryPartAddedEvent {
38999            #[serde(rename = "type")]
39000            #[allow(dead_code)]
39001            r#type: crate::__types::response_reasoning_summary_part_added_event::Type,
39002            #[serde(rename = "item_id")]
39003            item_id: String,
39004            #[serde(rename = "output_index")]
39005            output_index: i64,
39006            #[serde(rename = "summary_index")]
39007            summary_index: i64,
39008            #[serde(rename = "sequence_number")]
39009            sequence_number: i64,
39010            #[serde(rename = "part")]
39011            part: crate::__types::response_reasoning_summary_part_added_event::Part,
39012        }
39013        let ResponseReasoningSummaryPartAddedEvent {
39014            item_id,
39015            output_index,
39016            summary_index,
39017            sequence_number,
39018            part,
39019            ..
39020        } = ResponseReasoningSummaryPartAddedEvent::deserialize(deserializer)?;
39021        Ok(Self {
39022            item_id,
39023            output_index,
39024            summary_index,
39025            sequence_number,
39026            part,
39027        })
39028    }
39029}
39030impl serde::Serialize for ResponseReasoningSummaryPartAddedEvent {
39031    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
39032    where
39033        S: serde::Serializer,
39034    {
39035        #[serde_with::serde_as]
39036        #[derive(serde :: Serialize)]
39037        struct ResponseReasoningSummaryPartAddedEvent<'a> {
39038            #[serde(rename = "type")]
39039            r#type: &'a crate::__types::response_reasoning_summary_part_added_event::Type,
39040            #[serde(rename = "item_id")]
39041            item_id: &'a String,
39042            #[serde(rename = "output_index")]
39043            output_index: &'a i64,
39044            #[serde(rename = "summary_index")]
39045            summary_index: &'a i64,
39046            #[serde(rename = "sequence_number")]
39047            sequence_number: &'a i64,
39048            #[serde(rename = "part")]
39049            part: &'a crate::__types::response_reasoning_summary_part_added_event::Part,
39050        }
39051        let Self {
39052            item_id,
39053            output_index,
39054            summary_index,
39055            sequence_number,
39056            part,
39057        } = self;
39058        ResponseReasoningSummaryPartAddedEvent {
39059            r#type: &Default::default(),
39060            item_id,
39061            output_index,
39062            summary_index,
39063            sequence_number,
39064            part,
39065        }
39066        .serialize(serializer)
39067    }
39068}
39069#[allow(clippy::module_inception)]
39070pub mod response_reasoning_summary_part_done_event {
39071    #[doc = "The type of the event. Always `response.reasoning_summary_part.done`.\n"]
39072    #[derive(Clone, Copy, Debug, Default, PartialEq)]
39073    pub(crate) struct Type;
39074    impl_serde!(Type, "response.reasoning_summary_part.done");
39075    #[allow(clippy::module_inception)]
39076    pub(crate) mod part {
39077        #[doc = "The type of the summary part. Always `summary_text`."]
39078        #[derive(Clone, Copy, Debug, Default, PartialEq)]
39079        pub(crate) struct Type;
39080        impl_serde!(Type, "summary_text");
39081    }
39082    #[doc = "The completed summary part.\n"]
39083    #[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
39084    pub struct Part {
39085        #[doc = "The text of the summary part."]
39086        pub text: String,
39087    }
39088    impl<'de> serde::Deserialize<'de> for Part {
39089        fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
39090        where
39091            D: serde::Deserializer<'de>,
39092        {
39093            #[serde_with::serde_as]
39094            #[derive(serde :: Deserialize)]
39095            struct Part {
39096                #[serde(rename = "type")]
39097                #[allow(dead_code)]
39098                r#type: crate::__types::response_reasoning_summary_part_done_event::part::Type,
39099                #[serde(rename = "text")]
39100                text: String,
39101            }
39102            let Part { text, .. } = Part::deserialize(deserializer)?;
39103            Ok(Self { text })
39104        }
39105    }
39106    impl serde::Serialize for Part {
39107        fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
39108        where
39109            S: serde::Serializer,
39110        {
39111            #[serde_with::serde_as]
39112            #[derive(serde :: Serialize)]
39113            struct Part<'a> {
39114                #[serde(rename = "type")]
39115                r#type: &'a crate::__types::response_reasoning_summary_part_done_event::part::Type,
39116                #[serde(rename = "text")]
39117                text: &'a String,
39118            }
39119            let Self { text } = self;
39120            Part {
39121                r#type: &Default::default(),
39122                text,
39123            }
39124            .serialize(serializer)
39125        }
39126    }
39127}
39128#[doc = "Emitted when a reasoning summary part is completed."]
39129#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
39130pub struct ResponseReasoningSummaryPartDoneEvent {
39131    #[doc = "The ID of the item this summary part is associated with.\n"]
39132    pub item_id: String,
39133    #[doc = "The index of the output item this summary part is associated with.\n"]
39134    pub output_index: i64,
39135    #[doc = "The index of the summary part within the reasoning summary.\n"]
39136    pub summary_index: i64,
39137    #[doc = "The sequence number of this event.\n"]
39138    pub sequence_number: i64,
39139    #[doc = "The completed summary part.\n"]
39140    pub part: crate::__types::response_reasoning_summary_part_done_event::Part,
39141}
39142impl<'de> serde::Deserialize<'de> for ResponseReasoningSummaryPartDoneEvent {
39143    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
39144    where
39145        D: serde::Deserializer<'de>,
39146    {
39147        #[serde_with::serde_as]
39148        #[derive(serde :: Deserialize)]
39149        struct ResponseReasoningSummaryPartDoneEvent {
39150            #[serde(rename = "type")]
39151            #[allow(dead_code)]
39152            r#type: crate::__types::response_reasoning_summary_part_done_event::Type,
39153            #[serde(rename = "item_id")]
39154            item_id: String,
39155            #[serde(rename = "output_index")]
39156            output_index: i64,
39157            #[serde(rename = "summary_index")]
39158            summary_index: i64,
39159            #[serde(rename = "sequence_number")]
39160            sequence_number: i64,
39161            #[serde(rename = "part")]
39162            part: crate::__types::response_reasoning_summary_part_done_event::Part,
39163        }
39164        let ResponseReasoningSummaryPartDoneEvent {
39165            item_id,
39166            output_index,
39167            summary_index,
39168            sequence_number,
39169            part,
39170            ..
39171        } = ResponseReasoningSummaryPartDoneEvent::deserialize(deserializer)?;
39172        Ok(Self {
39173            item_id,
39174            output_index,
39175            summary_index,
39176            sequence_number,
39177            part,
39178        })
39179    }
39180}
39181impl serde::Serialize for ResponseReasoningSummaryPartDoneEvent {
39182    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
39183    where
39184        S: serde::Serializer,
39185    {
39186        #[serde_with::serde_as]
39187        #[derive(serde :: Serialize)]
39188        struct ResponseReasoningSummaryPartDoneEvent<'a> {
39189            #[serde(rename = "type")]
39190            r#type: &'a crate::__types::response_reasoning_summary_part_done_event::Type,
39191            #[serde(rename = "item_id")]
39192            item_id: &'a String,
39193            #[serde(rename = "output_index")]
39194            output_index: &'a i64,
39195            #[serde(rename = "summary_index")]
39196            summary_index: &'a i64,
39197            #[serde(rename = "sequence_number")]
39198            sequence_number: &'a i64,
39199            #[serde(rename = "part")]
39200            part: &'a crate::__types::response_reasoning_summary_part_done_event::Part,
39201        }
39202        let Self {
39203            item_id,
39204            output_index,
39205            summary_index,
39206            sequence_number,
39207            part,
39208        } = self;
39209        ResponseReasoningSummaryPartDoneEvent {
39210            r#type: &Default::default(),
39211            item_id,
39212            output_index,
39213            summary_index,
39214            sequence_number,
39215            part,
39216        }
39217        .serialize(serializer)
39218    }
39219}
39220#[allow(clippy::module_inception)]
39221pub(crate) mod response_reasoning_summary_text_delta_event {
39222    #[doc = "The type of the event. Always `response.reasoning_summary_text.delta`.\n"]
39223    #[derive(Clone, Copy, Debug, Default, PartialEq)]
39224    pub(crate) struct Type;
39225    impl_serde!(Type, "response.reasoning_summary_text.delta");
39226}
39227#[doc = "Emitted when a delta is added to a reasoning summary text."]
39228#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
39229pub struct ResponseReasoningSummaryTextDeltaEvent {
39230    #[doc = "The ID of the item this summary text delta is associated with.\n"]
39231    pub item_id: String,
39232    #[doc = "The index of the output item this summary text delta is associated with.\n"]
39233    pub output_index: i64,
39234    #[doc = "The index of the summary part within the reasoning summary.\n"]
39235    pub summary_index: i64,
39236    #[doc = "The text delta that was added to the summary.\n"]
39237    pub delta: String,
39238    #[doc = "The sequence number of this event.\n"]
39239    pub sequence_number: i64,
39240}
39241impl<'de> serde::Deserialize<'de> for ResponseReasoningSummaryTextDeltaEvent {
39242    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
39243    where
39244        D: serde::Deserializer<'de>,
39245    {
39246        #[serde_with::serde_as]
39247        #[derive(serde :: Deserialize)]
39248        struct ResponseReasoningSummaryTextDeltaEvent {
39249            #[serde(rename = "type")]
39250            #[allow(dead_code)]
39251            r#type: crate::__types::response_reasoning_summary_text_delta_event::Type,
39252            #[serde(rename = "item_id")]
39253            item_id: String,
39254            #[serde(rename = "output_index")]
39255            output_index: i64,
39256            #[serde(rename = "summary_index")]
39257            summary_index: i64,
39258            #[serde(rename = "delta")]
39259            delta: String,
39260            #[serde(rename = "sequence_number")]
39261            sequence_number: i64,
39262        }
39263        let ResponseReasoningSummaryTextDeltaEvent {
39264            item_id,
39265            output_index,
39266            summary_index,
39267            delta,
39268            sequence_number,
39269            ..
39270        } = ResponseReasoningSummaryTextDeltaEvent::deserialize(deserializer)?;
39271        Ok(Self {
39272            item_id,
39273            output_index,
39274            summary_index,
39275            delta,
39276            sequence_number,
39277        })
39278    }
39279}
39280impl serde::Serialize for ResponseReasoningSummaryTextDeltaEvent {
39281    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
39282    where
39283        S: serde::Serializer,
39284    {
39285        #[serde_with::serde_as]
39286        #[derive(serde :: Serialize)]
39287        struct ResponseReasoningSummaryTextDeltaEvent<'a> {
39288            #[serde(rename = "type")]
39289            r#type: &'a crate::__types::response_reasoning_summary_text_delta_event::Type,
39290            #[serde(rename = "item_id")]
39291            item_id: &'a String,
39292            #[serde(rename = "output_index")]
39293            output_index: &'a i64,
39294            #[serde(rename = "summary_index")]
39295            summary_index: &'a i64,
39296            #[serde(rename = "delta")]
39297            delta: &'a String,
39298            #[serde(rename = "sequence_number")]
39299            sequence_number: &'a i64,
39300        }
39301        let Self {
39302            item_id,
39303            output_index,
39304            summary_index,
39305            delta,
39306            sequence_number,
39307        } = self;
39308        ResponseReasoningSummaryTextDeltaEvent {
39309            r#type: &Default::default(),
39310            item_id,
39311            output_index,
39312            summary_index,
39313            delta,
39314            sequence_number,
39315        }
39316        .serialize(serializer)
39317    }
39318}
39319#[allow(clippy::module_inception)]
39320pub(crate) mod response_reasoning_summary_text_done_event {
39321    #[doc = "The type of the event. Always `response.reasoning_summary_text.done`.\n"]
39322    #[derive(Clone, Copy, Debug, Default, PartialEq)]
39323    pub(crate) struct Type;
39324    impl_serde!(Type, "response.reasoning_summary_text.done");
39325}
39326#[doc = "Emitted when a reasoning summary text is completed."]
39327#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
39328pub struct ResponseReasoningSummaryTextDoneEvent {
39329    #[doc = "The ID of the item this summary text is associated with.\n"]
39330    pub item_id: String,
39331    #[doc = "The index of the output item this summary text is associated with.\n"]
39332    pub output_index: i64,
39333    #[doc = "The index of the summary part within the reasoning summary.\n"]
39334    pub summary_index: i64,
39335    #[doc = "The full text of the completed reasoning summary.\n"]
39336    pub text: String,
39337    #[doc = "The sequence number of this event.\n"]
39338    pub sequence_number: i64,
39339}
39340impl<'de> serde::Deserialize<'de> for ResponseReasoningSummaryTextDoneEvent {
39341    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
39342    where
39343        D: serde::Deserializer<'de>,
39344    {
39345        #[serde_with::serde_as]
39346        #[derive(serde :: Deserialize)]
39347        struct ResponseReasoningSummaryTextDoneEvent {
39348            #[serde(rename = "type")]
39349            #[allow(dead_code)]
39350            r#type: crate::__types::response_reasoning_summary_text_done_event::Type,
39351            #[serde(rename = "item_id")]
39352            item_id: String,
39353            #[serde(rename = "output_index")]
39354            output_index: i64,
39355            #[serde(rename = "summary_index")]
39356            summary_index: i64,
39357            #[serde(rename = "text")]
39358            text: String,
39359            #[serde(rename = "sequence_number")]
39360            sequence_number: i64,
39361        }
39362        let ResponseReasoningSummaryTextDoneEvent {
39363            item_id,
39364            output_index,
39365            summary_index,
39366            text,
39367            sequence_number,
39368            ..
39369        } = ResponseReasoningSummaryTextDoneEvent::deserialize(deserializer)?;
39370        Ok(Self {
39371            item_id,
39372            output_index,
39373            summary_index,
39374            text,
39375            sequence_number,
39376        })
39377    }
39378}
39379impl serde::Serialize for ResponseReasoningSummaryTextDoneEvent {
39380    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
39381    where
39382        S: serde::Serializer,
39383    {
39384        #[serde_with::serde_as]
39385        #[derive(serde :: Serialize)]
39386        struct ResponseReasoningSummaryTextDoneEvent<'a> {
39387            #[serde(rename = "type")]
39388            r#type: &'a crate::__types::response_reasoning_summary_text_done_event::Type,
39389            #[serde(rename = "item_id")]
39390            item_id: &'a String,
39391            #[serde(rename = "output_index")]
39392            output_index: &'a i64,
39393            #[serde(rename = "summary_index")]
39394            summary_index: &'a i64,
39395            #[serde(rename = "text")]
39396            text: &'a String,
39397            #[serde(rename = "sequence_number")]
39398            sequence_number: &'a i64,
39399        }
39400        let Self {
39401            item_id,
39402            output_index,
39403            summary_index,
39404            text,
39405            sequence_number,
39406        } = self;
39407        ResponseReasoningSummaryTextDoneEvent {
39408            r#type: &Default::default(),
39409            item_id,
39410            output_index,
39411            summary_index,
39412            text,
39413            sequence_number,
39414        }
39415        .serialize(serializer)
39416    }
39417}
39418#[allow(clippy::module_inception)]
39419pub(crate) mod response_reasoning_text_delta_event {
39420    #[doc = "The type of the event. Always `response.reasoning_text.delta`.\n"]
39421    #[derive(Clone, Copy, Debug, Default, PartialEq)]
39422    pub(crate) struct Type;
39423    impl_serde!(Type, "response.reasoning_text.delta");
39424}
39425#[doc = "Emitted when a delta is added to a reasoning text."]
39426#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
39427pub struct ResponseReasoningTextDeltaEvent {
39428    #[doc = "The ID of the item this reasoning text delta is associated with.\n"]
39429    pub item_id: String,
39430    #[doc = "The index of the output item this reasoning text delta is associated with.\n"]
39431    pub output_index: i64,
39432    #[doc = "The index of the reasoning content part this delta is associated with.\n"]
39433    pub content_index: i64,
39434    #[doc = "The text delta that was added to the reasoning content.\n"]
39435    pub delta: String,
39436    #[doc = "The sequence number of this event.\n"]
39437    pub sequence_number: i64,
39438}
39439impl<'de> serde::Deserialize<'de> for ResponseReasoningTextDeltaEvent {
39440    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
39441    where
39442        D: serde::Deserializer<'de>,
39443    {
39444        #[serde_with::serde_as]
39445        #[derive(serde :: Deserialize)]
39446        struct ResponseReasoningTextDeltaEvent {
39447            #[serde(rename = "type")]
39448            #[allow(dead_code)]
39449            r#type: crate::__types::response_reasoning_text_delta_event::Type,
39450            #[serde(rename = "item_id")]
39451            item_id: String,
39452            #[serde(rename = "output_index")]
39453            output_index: i64,
39454            #[serde(rename = "content_index")]
39455            content_index: i64,
39456            #[serde(rename = "delta")]
39457            delta: String,
39458            #[serde(rename = "sequence_number")]
39459            sequence_number: i64,
39460        }
39461        let ResponseReasoningTextDeltaEvent {
39462            item_id,
39463            output_index,
39464            content_index,
39465            delta,
39466            sequence_number,
39467            ..
39468        } = ResponseReasoningTextDeltaEvent::deserialize(deserializer)?;
39469        Ok(Self {
39470            item_id,
39471            output_index,
39472            content_index,
39473            delta,
39474            sequence_number,
39475        })
39476    }
39477}
39478impl serde::Serialize for ResponseReasoningTextDeltaEvent {
39479    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
39480    where
39481        S: serde::Serializer,
39482    {
39483        #[serde_with::serde_as]
39484        #[derive(serde :: Serialize)]
39485        struct ResponseReasoningTextDeltaEvent<'a> {
39486            #[serde(rename = "type")]
39487            r#type: &'a crate::__types::response_reasoning_text_delta_event::Type,
39488            #[serde(rename = "item_id")]
39489            item_id: &'a String,
39490            #[serde(rename = "output_index")]
39491            output_index: &'a i64,
39492            #[serde(rename = "content_index")]
39493            content_index: &'a i64,
39494            #[serde(rename = "delta")]
39495            delta: &'a String,
39496            #[serde(rename = "sequence_number")]
39497            sequence_number: &'a i64,
39498        }
39499        let Self {
39500            item_id,
39501            output_index,
39502            content_index,
39503            delta,
39504            sequence_number,
39505        } = self;
39506        ResponseReasoningTextDeltaEvent {
39507            r#type: &Default::default(),
39508            item_id,
39509            output_index,
39510            content_index,
39511            delta,
39512            sequence_number,
39513        }
39514        .serialize(serializer)
39515    }
39516}
39517#[allow(clippy::module_inception)]
39518pub(crate) mod response_reasoning_text_done_event {
39519    #[doc = "The type of the event. Always `response.reasoning_text.done`.\n"]
39520    #[derive(Clone, Copy, Debug, Default, PartialEq)]
39521    pub(crate) struct Type;
39522    impl_serde!(Type, "response.reasoning_text.done");
39523}
39524#[doc = "Emitted when a reasoning text is completed."]
39525#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
39526pub struct ResponseReasoningTextDoneEvent {
39527    #[doc = "The ID of the item this reasoning text is associated with.\n"]
39528    pub item_id: String,
39529    #[doc = "The index of the output item this reasoning text is associated with.\n"]
39530    pub output_index: i64,
39531    #[doc = "The index of the reasoning content part.\n"]
39532    pub content_index: i64,
39533    #[doc = "The full text of the completed reasoning content.\n"]
39534    pub text: String,
39535    #[doc = "The sequence number of this event.\n"]
39536    pub sequence_number: i64,
39537}
39538impl<'de> serde::Deserialize<'de> for ResponseReasoningTextDoneEvent {
39539    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
39540    where
39541        D: serde::Deserializer<'de>,
39542    {
39543        #[serde_with::serde_as]
39544        #[derive(serde :: Deserialize)]
39545        struct ResponseReasoningTextDoneEvent {
39546            #[serde(rename = "type")]
39547            #[allow(dead_code)]
39548            r#type: crate::__types::response_reasoning_text_done_event::Type,
39549            #[serde(rename = "item_id")]
39550            item_id: String,
39551            #[serde(rename = "output_index")]
39552            output_index: i64,
39553            #[serde(rename = "content_index")]
39554            content_index: i64,
39555            #[serde(rename = "text")]
39556            text: String,
39557            #[serde(rename = "sequence_number")]
39558            sequence_number: i64,
39559        }
39560        let ResponseReasoningTextDoneEvent {
39561            item_id,
39562            output_index,
39563            content_index,
39564            text,
39565            sequence_number,
39566            ..
39567        } = ResponseReasoningTextDoneEvent::deserialize(deserializer)?;
39568        Ok(Self {
39569            item_id,
39570            output_index,
39571            content_index,
39572            text,
39573            sequence_number,
39574        })
39575    }
39576}
39577impl serde::Serialize for ResponseReasoningTextDoneEvent {
39578    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
39579    where
39580        S: serde::Serializer,
39581    {
39582        #[serde_with::serde_as]
39583        #[derive(serde :: Serialize)]
39584        struct ResponseReasoningTextDoneEvent<'a> {
39585            #[serde(rename = "type")]
39586            r#type: &'a crate::__types::response_reasoning_text_done_event::Type,
39587            #[serde(rename = "item_id")]
39588            item_id: &'a String,
39589            #[serde(rename = "output_index")]
39590            output_index: &'a i64,
39591            #[serde(rename = "content_index")]
39592            content_index: &'a i64,
39593            #[serde(rename = "text")]
39594            text: &'a String,
39595            #[serde(rename = "sequence_number")]
39596            sequence_number: &'a i64,
39597        }
39598        let Self {
39599            item_id,
39600            output_index,
39601            content_index,
39602            text,
39603            sequence_number,
39604        } = self;
39605        ResponseReasoningTextDoneEvent {
39606            r#type: &Default::default(),
39607            item_id,
39608            output_index,
39609            content_index,
39610            text,
39611            sequence_number,
39612        }
39613        .serialize(serializer)
39614    }
39615}
39616#[allow(clippy::module_inception)]
39617pub(crate) mod response_refusal_delta_event {
39618    #[doc = "The type of the event. Always `response.refusal.delta`.\n"]
39619    #[derive(Clone, Copy, Debug, Default, PartialEq)]
39620    pub(crate) struct Type;
39621    impl_serde!(Type, "response.refusal.delta");
39622}
39623#[doc = "Emitted when there is a partial refusal text."]
39624#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
39625pub struct ResponseRefusalDeltaEvent {
39626    #[doc = "The ID of the output item that the refusal text is added to.\n"]
39627    pub item_id: String,
39628    #[doc = "The index of the output item that the refusal text is added to.\n"]
39629    pub output_index: i64,
39630    #[doc = "The index of the content part that the refusal text is added to.\n"]
39631    pub content_index: i64,
39632    #[doc = "The refusal text that is added.\n"]
39633    pub delta: String,
39634    #[doc = "The sequence number of this event.\n"]
39635    pub sequence_number: i64,
39636}
39637impl<'de> serde::Deserialize<'de> for ResponseRefusalDeltaEvent {
39638    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
39639    where
39640        D: serde::Deserializer<'de>,
39641    {
39642        #[serde_with::serde_as]
39643        #[derive(serde :: Deserialize)]
39644        struct ResponseRefusalDeltaEvent {
39645            #[serde(rename = "type")]
39646            #[allow(dead_code)]
39647            r#type: crate::__types::response_refusal_delta_event::Type,
39648            #[serde(rename = "item_id")]
39649            item_id: String,
39650            #[serde(rename = "output_index")]
39651            output_index: i64,
39652            #[serde(rename = "content_index")]
39653            content_index: i64,
39654            #[serde(rename = "delta")]
39655            delta: String,
39656            #[serde(rename = "sequence_number")]
39657            sequence_number: i64,
39658        }
39659        let ResponseRefusalDeltaEvent {
39660            item_id,
39661            output_index,
39662            content_index,
39663            delta,
39664            sequence_number,
39665            ..
39666        } = ResponseRefusalDeltaEvent::deserialize(deserializer)?;
39667        Ok(Self {
39668            item_id,
39669            output_index,
39670            content_index,
39671            delta,
39672            sequence_number,
39673        })
39674    }
39675}
39676impl serde::Serialize for ResponseRefusalDeltaEvent {
39677    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
39678    where
39679        S: serde::Serializer,
39680    {
39681        #[serde_with::serde_as]
39682        #[derive(serde :: Serialize)]
39683        struct ResponseRefusalDeltaEvent<'a> {
39684            #[serde(rename = "type")]
39685            r#type: &'a crate::__types::response_refusal_delta_event::Type,
39686            #[serde(rename = "item_id")]
39687            item_id: &'a String,
39688            #[serde(rename = "output_index")]
39689            output_index: &'a i64,
39690            #[serde(rename = "content_index")]
39691            content_index: &'a i64,
39692            #[serde(rename = "delta")]
39693            delta: &'a String,
39694            #[serde(rename = "sequence_number")]
39695            sequence_number: &'a i64,
39696        }
39697        let Self {
39698            item_id,
39699            output_index,
39700            content_index,
39701            delta,
39702            sequence_number,
39703        } = self;
39704        ResponseRefusalDeltaEvent {
39705            r#type: &Default::default(),
39706            item_id,
39707            output_index,
39708            content_index,
39709            delta,
39710            sequence_number,
39711        }
39712        .serialize(serializer)
39713    }
39714}
39715#[allow(clippy::module_inception)]
39716pub(crate) mod response_refusal_done_event {
39717    #[doc = "The type of the event. Always `response.refusal.done`.\n"]
39718    #[derive(Clone, Copy, Debug, Default, PartialEq)]
39719    pub(crate) struct Type;
39720    impl_serde!(Type, "response.refusal.done");
39721}
39722#[doc = "Emitted when refusal text is finalized."]
39723#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
39724pub struct ResponseRefusalDoneEvent {
39725    #[doc = "The ID of the output item that the refusal text is finalized.\n"]
39726    pub item_id: String,
39727    #[doc = "The index of the output item that the refusal text is finalized.\n"]
39728    pub output_index: i64,
39729    #[doc = "The index of the content part that the refusal text is finalized.\n"]
39730    pub content_index: i64,
39731    #[doc = "The refusal text that is finalized.\n"]
39732    pub refusal: String,
39733    #[doc = "The sequence number of this event.\n"]
39734    pub sequence_number: i64,
39735}
39736impl<'de> serde::Deserialize<'de> for ResponseRefusalDoneEvent {
39737    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
39738    where
39739        D: serde::Deserializer<'de>,
39740    {
39741        #[serde_with::serde_as]
39742        #[derive(serde :: Deserialize)]
39743        struct ResponseRefusalDoneEvent {
39744            #[serde(rename = "type")]
39745            #[allow(dead_code)]
39746            r#type: crate::__types::response_refusal_done_event::Type,
39747            #[serde(rename = "item_id")]
39748            item_id: String,
39749            #[serde(rename = "output_index")]
39750            output_index: i64,
39751            #[serde(rename = "content_index")]
39752            content_index: i64,
39753            #[serde(rename = "refusal")]
39754            refusal: String,
39755            #[serde(rename = "sequence_number")]
39756            sequence_number: i64,
39757        }
39758        let ResponseRefusalDoneEvent {
39759            item_id,
39760            output_index,
39761            content_index,
39762            refusal,
39763            sequence_number,
39764            ..
39765        } = ResponseRefusalDoneEvent::deserialize(deserializer)?;
39766        Ok(Self {
39767            item_id,
39768            output_index,
39769            content_index,
39770            refusal,
39771            sequence_number,
39772        })
39773    }
39774}
39775impl serde::Serialize for ResponseRefusalDoneEvent {
39776    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
39777    where
39778        S: serde::Serializer,
39779    {
39780        #[serde_with::serde_as]
39781        #[derive(serde :: Serialize)]
39782        struct ResponseRefusalDoneEvent<'a> {
39783            #[serde(rename = "type")]
39784            r#type: &'a crate::__types::response_refusal_done_event::Type,
39785            #[serde(rename = "item_id")]
39786            item_id: &'a String,
39787            #[serde(rename = "output_index")]
39788            output_index: &'a i64,
39789            #[serde(rename = "content_index")]
39790            content_index: &'a i64,
39791            #[serde(rename = "refusal")]
39792            refusal: &'a String,
39793            #[serde(rename = "sequence_number")]
39794            sequence_number: &'a i64,
39795        }
39796        let Self {
39797            item_id,
39798            output_index,
39799            content_index,
39800            refusal,
39801            sequence_number,
39802        } = self;
39803        ResponseRefusalDoneEvent {
39804            r#type: &Default::default(),
39805            item_id,
39806            output_index,
39807            content_index,
39808            refusal,
39809            sequence_number,
39810        }
39811        .serialize(serializer)
39812    }
39813}
39814#[derive(Clone, Debug, PartialEq)]
39815#[serde_with::serde_as]
39816#[derive(serde :: Deserialize, serde :: Serialize)]
39817#[serde(untagged)]
39818#[allow(clippy::large_enum_variant)]
39819pub enum ResponseStreamEvent {
39820    ResponseAudioDelta(crate::__types::ResponseAudioDeltaEvent),
39821    ResponseAudioDone(crate::__types::ResponseAudioDoneEvent),
39822    ResponseAudioTranscriptDelta(crate::__types::ResponseAudioTranscriptDeltaEvent),
39823    ResponseAudioTranscriptDone(crate::__types::ResponseAudioTranscriptDoneEvent),
39824    ResponseCodeInterpreterCallCodeDelta(crate::__types::ResponseCodeInterpreterCallCodeDeltaEvent),
39825    ResponseCodeInterpreterCallCodeDone(crate::__types::ResponseCodeInterpreterCallCodeDoneEvent),
39826    ResponseCodeInterpreterCallCompleted(crate::__types::ResponseCodeInterpreterCallCompletedEvent),
39827    ResponseCodeInterpreterCallInProgress(
39828        crate::__types::ResponseCodeInterpreterCallInProgressEvent,
39829    ),
39830    ResponseCodeInterpreterCallInterpreting(
39831        crate::__types::ResponseCodeInterpreterCallInterpretingEvent,
39832    ),
39833    ResponseCompleted(crate::__types::ResponseCompletedEvent),
39834    ResponseContentPartAdded(crate::__types::ResponseContentPartAddedEvent),
39835    ResponseContentPartDone(crate::__types::ResponseContentPartDoneEvent),
39836    ResponseCreated(crate::__types::ResponseCreatedEvent),
39837    Error(crate::__types::ResponseErrorEvent),
39838    ResponseFileSearchCallCompleted(crate::__types::ResponseFileSearchCallCompletedEvent),
39839    ResponseFileSearchCallInProgress(crate::__types::ResponseFileSearchCallInProgressEvent),
39840    ResponseFileSearchCallSearching(crate::__types::ResponseFileSearchCallSearchingEvent),
39841    ResponseFunctionCallArgumentsDelta(crate::__types::ResponseFunctionCallArgumentsDeltaEvent),
39842    ResponseFunctionCallArgumentsDone(crate::__types::ResponseFunctionCallArgumentsDoneEvent),
39843    ResponseInProgress(crate::__types::ResponseInProgressEvent),
39844    ResponseFailed(crate::__types::ResponseFailedEvent),
39845    ResponseIncomplete(crate::__types::ResponseIncompleteEvent),
39846    ResponseOutputItemAdded(crate::__types::ResponseOutputItemAddedEvent),
39847    ResponseOutputItemDone(crate::__types::ResponseOutputItemDoneEvent),
39848    ResponseReasoningSummaryPartAdded(crate::__types::ResponseReasoningSummaryPartAddedEvent),
39849    ResponseReasoningSummaryPartDone(crate::__types::ResponseReasoningSummaryPartDoneEvent),
39850    ResponseReasoningSummaryTextDelta(crate::__types::ResponseReasoningSummaryTextDeltaEvent),
39851    ResponseReasoningSummaryTextDone(crate::__types::ResponseReasoningSummaryTextDoneEvent),
39852    ResponseReasoningTextDelta(crate::__types::ResponseReasoningTextDeltaEvent),
39853    ResponseReasoningTextDone(crate::__types::ResponseReasoningTextDoneEvent),
39854    ResponseRefusalDelta(crate::__types::ResponseRefusalDeltaEvent),
39855    ResponseRefusalDone(crate::__types::ResponseRefusalDoneEvent),
39856    ResponseOutputTextDelta(crate::__types::ResponseTextDeltaEvent),
39857    ResponseOutputTextDone(crate::__types::ResponseTextDoneEvent),
39858    ResponseWebSearchCallCompleted(crate::__types::ResponseWebSearchCallCompletedEvent),
39859    ResponseWebSearchCallInProgress(crate::__types::ResponseWebSearchCallInProgressEvent),
39860    ResponseWebSearchCallSearching(crate::__types::ResponseWebSearchCallSearchingEvent),
39861    ResponseImageGenerationCallCompleted(crate::__types::ResponseImageGenCallCompletedEvent),
39862    ResponseImageGenerationCallGenerating(crate::__types::ResponseImageGenCallGeneratingEvent),
39863    ResponseImageGenerationCallInProgress(crate::__types::ResponseImageGenCallInProgressEvent),
39864    ResponseImageGenerationCallPartialImage(crate::__types::ResponseImageGenCallPartialImageEvent),
39865    ResponseMcpCallArgumentsDelta(crate::__types::ResponseMcpCallArgumentsDeltaEvent),
39866    ResponseMcpCallArgumentsDone(crate::__types::ResponseMcpCallArgumentsDoneEvent),
39867    ResponseMcpCallCompleted(crate::__types::ResponseMcpCallCompletedEvent),
39868    ResponseMcpCallFailed(crate::__types::ResponseMcpCallFailedEvent),
39869    ResponseMcpCallInProgress(crate::__types::ResponseMcpCallInProgressEvent),
39870    ResponseMcpListToolsCompleted(crate::__types::ResponseMcpListToolsCompletedEvent),
39871    ResponseMcpListToolsFailed(crate::__types::ResponseMcpListToolsFailedEvent),
39872    ResponseMcpListToolsInProgress(crate::__types::ResponseMcpListToolsInProgressEvent),
39873    ResponseOutputTextAnnotationAdded(crate::__types::ResponseOutputTextAnnotationAddedEvent),
39874    ResponseQueued(crate::__types::ResponseQueuedEvent),
39875    ResponseCustomToolCallInputDelta(crate::__types::ResponseCustomToolCallInputDeltaEvent),
39876    ResponseCustomToolCallInputDone(crate::__types::ResponseCustomToolCallInputDoneEvent),
39877}
39878#[doc = "Options for streaming responses. Only set this when you set `stream: true`.\n"]
39879#[derive(Clone, Copy, Debug, Default, PartialEq)]
39880#[serde_with::serde_as]
39881#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
39882pub struct ResponseStreamOptions {
39883    #[doc = "When true, stream obfuscation will be enabled. Stream obfuscation adds\nrandom characters to an `obfuscation` field on streaming delta events to\nnormalize payload sizes as a mitigation to certain side-channel attacks.\nThese obfuscation fields are included by default, but add a small amount\nof overhead to the data stream. You can set `include_obfuscation` to\nfalse to optimize for bandwidth if you trust the network links between\nyour application and the OpenAI API.\n"]
39884    #[serde(rename = "include_obfuscation")]
39885    #[serde(skip_serializing_if = "Option::is_none")]
39886    #[builder(default)]
39887    pub include_obfuscation: Option<bool>,
39888}
39889#[allow(clippy::module_inception)]
39890pub(crate) mod response_text_delta_event {
39891    #[doc = "The type of the event. Always `response.output_text.delta`.\n"]
39892    #[derive(Clone, Copy, Debug, Default, PartialEq)]
39893    pub(crate) struct Type;
39894    impl_serde!(Type, "response.output_text.delta");
39895}
39896#[doc = "Emitted when there is an additional text delta."]
39897#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
39898pub struct ResponseTextDeltaEvent {
39899    #[doc = "The ID of the output item that the text delta was added to.\n"]
39900    pub item_id: String,
39901    #[doc = "The index of the output item that the text delta was added to.\n"]
39902    pub output_index: i64,
39903    #[doc = "The index of the content part that the text delta was added to.\n"]
39904    pub content_index: i64,
39905    #[doc = "The text delta that was added.\n"]
39906    pub delta: String,
39907    #[doc = "The sequence number for this event."]
39908    pub sequence_number: i64,
39909    #[doc = "The log probabilities of the tokens in the delta.\n"]
39910    pub logprobs: Vec<crate::__types::ResponseLogProb>,
39911}
39912impl<'de> serde::Deserialize<'de> for ResponseTextDeltaEvent {
39913    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
39914    where
39915        D: serde::Deserializer<'de>,
39916    {
39917        #[serde_with::serde_as]
39918        #[derive(serde :: Deserialize)]
39919        struct ResponseTextDeltaEvent {
39920            #[serde(rename = "type")]
39921            #[allow(dead_code)]
39922            r#type: crate::__types::response_text_delta_event::Type,
39923            #[serde(rename = "item_id")]
39924            item_id: String,
39925            #[serde(rename = "output_index")]
39926            output_index: i64,
39927            #[serde(rename = "content_index")]
39928            content_index: i64,
39929            #[serde(rename = "delta")]
39930            delta: String,
39931            #[serde(rename = "sequence_number")]
39932            sequence_number: i64,
39933            #[serde(rename = "logprobs")]
39934            logprobs: Vec<crate::__types::ResponseLogProb>,
39935        }
39936        let ResponseTextDeltaEvent {
39937            item_id,
39938            output_index,
39939            content_index,
39940            delta,
39941            sequence_number,
39942            logprobs,
39943            ..
39944        } = ResponseTextDeltaEvent::deserialize(deserializer)?;
39945        Ok(Self {
39946            item_id,
39947            output_index,
39948            content_index,
39949            delta,
39950            sequence_number,
39951            logprobs,
39952        })
39953    }
39954}
39955impl serde::Serialize for ResponseTextDeltaEvent {
39956    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
39957    where
39958        S: serde::Serializer,
39959    {
39960        #[serde_with::serde_as]
39961        #[derive(serde :: Serialize)]
39962        struct ResponseTextDeltaEvent<'a> {
39963            #[serde(rename = "type")]
39964            r#type: &'a crate::__types::response_text_delta_event::Type,
39965            #[serde(rename = "item_id")]
39966            item_id: &'a String,
39967            #[serde(rename = "output_index")]
39968            output_index: &'a i64,
39969            #[serde(rename = "content_index")]
39970            content_index: &'a i64,
39971            #[serde(rename = "delta")]
39972            delta: &'a String,
39973            #[serde(rename = "sequence_number")]
39974            sequence_number: &'a i64,
39975            #[serde(rename = "logprobs")]
39976            logprobs: &'a Vec<crate::__types::ResponseLogProb>,
39977        }
39978        let Self {
39979            item_id,
39980            output_index,
39981            content_index,
39982            delta,
39983            sequence_number,
39984            logprobs,
39985        } = self;
39986        ResponseTextDeltaEvent {
39987            r#type: &Default::default(),
39988            item_id,
39989            output_index,
39990            content_index,
39991            delta,
39992            sequence_number,
39993            logprobs,
39994        }
39995        .serialize(serializer)
39996    }
39997}
39998#[allow(clippy::module_inception)]
39999pub(crate) mod response_text_done_event {
40000    #[doc = "The type of the event. Always `response.output_text.done`.\n"]
40001    #[derive(Clone, Copy, Debug, Default, PartialEq)]
40002    pub(crate) struct Type;
40003    impl_serde!(Type, "response.output_text.done");
40004}
40005#[doc = "Emitted when text content is finalized."]
40006#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
40007pub struct ResponseTextDoneEvent {
40008    #[doc = "The ID of the output item that the text content is finalized.\n"]
40009    pub item_id: String,
40010    #[doc = "The index of the output item that the text content is finalized.\n"]
40011    pub output_index: i64,
40012    #[doc = "The index of the content part that the text content is finalized.\n"]
40013    pub content_index: i64,
40014    #[doc = "The text content that is finalized.\n"]
40015    pub text: String,
40016    #[doc = "The sequence number for this event."]
40017    pub sequence_number: i64,
40018    #[doc = "The log probabilities of the tokens in the delta.\n"]
40019    pub logprobs: Vec<crate::__types::ResponseLogProb>,
40020}
40021impl<'de> serde::Deserialize<'de> for ResponseTextDoneEvent {
40022    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
40023    where
40024        D: serde::Deserializer<'de>,
40025    {
40026        #[serde_with::serde_as]
40027        #[derive(serde :: Deserialize)]
40028        struct ResponseTextDoneEvent {
40029            #[serde(rename = "type")]
40030            #[allow(dead_code)]
40031            r#type: crate::__types::response_text_done_event::Type,
40032            #[serde(rename = "item_id")]
40033            item_id: String,
40034            #[serde(rename = "output_index")]
40035            output_index: i64,
40036            #[serde(rename = "content_index")]
40037            content_index: i64,
40038            #[serde(rename = "text")]
40039            text: String,
40040            #[serde(rename = "sequence_number")]
40041            sequence_number: i64,
40042            #[serde(rename = "logprobs")]
40043            logprobs: Vec<crate::__types::ResponseLogProb>,
40044        }
40045        let ResponseTextDoneEvent {
40046            item_id,
40047            output_index,
40048            content_index,
40049            text,
40050            sequence_number,
40051            logprobs,
40052            ..
40053        } = ResponseTextDoneEvent::deserialize(deserializer)?;
40054        Ok(Self {
40055            item_id,
40056            output_index,
40057            content_index,
40058            text,
40059            sequence_number,
40060            logprobs,
40061        })
40062    }
40063}
40064impl serde::Serialize for ResponseTextDoneEvent {
40065    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
40066    where
40067        S: serde::Serializer,
40068    {
40069        #[serde_with::serde_as]
40070        #[derive(serde :: Serialize)]
40071        struct ResponseTextDoneEvent<'a> {
40072            #[serde(rename = "type")]
40073            r#type: &'a crate::__types::response_text_done_event::Type,
40074            #[serde(rename = "item_id")]
40075            item_id: &'a String,
40076            #[serde(rename = "output_index")]
40077            output_index: &'a i64,
40078            #[serde(rename = "content_index")]
40079            content_index: &'a i64,
40080            #[serde(rename = "text")]
40081            text: &'a String,
40082            #[serde(rename = "sequence_number")]
40083            sequence_number: &'a i64,
40084            #[serde(rename = "logprobs")]
40085            logprobs: &'a Vec<crate::__types::ResponseLogProb>,
40086        }
40087        let Self {
40088            item_id,
40089            output_index,
40090            content_index,
40091            text,
40092            sequence_number,
40093            logprobs,
40094        } = self;
40095        ResponseTextDoneEvent {
40096            r#type: &Default::default(),
40097            item_id,
40098            output_index,
40099            content_index,
40100            text,
40101            sequence_number,
40102            logprobs,
40103        }
40104        .serialize(serializer)
40105    }
40106}
40107#[allow(clippy::module_inception)]
40108pub mod response_usage {
40109    #[doc = "A detailed breakdown of the input tokens."]
40110    #[derive(Clone, Copy, Debug, PartialEq)]
40111    #[serde_with::serde_as]
40112    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
40113    pub struct InputTokensDetails {
40114        #[doc = "The number of tokens that were retrieved from the cache. \n[More on prompt caching](https://platform.openai.com/docs/guides/prompt-caching).\n"]
40115        #[serde(rename = "cached_tokens")]
40116        pub cached_tokens: i64,
40117    }
40118    #[doc = "A detailed breakdown of the output tokens."]
40119    #[derive(Clone, Copy, Debug, PartialEq)]
40120    #[serde_with::serde_as]
40121    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
40122    pub struct OutputTokensDetails {
40123        #[doc = "The number of reasoning tokens."]
40124        #[serde(rename = "reasoning_tokens")]
40125        pub reasoning_tokens: i64,
40126    }
40127}
40128#[doc = "Represents token usage details including input tokens, output tokens,\na breakdown of output tokens, and the total tokens used.\n"]
40129#[derive(Clone, Copy, Debug, PartialEq)]
40130#[serde_with::serde_as]
40131#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
40132pub struct ResponseUsage {
40133    #[doc = "The number of input tokens."]
40134    #[serde(rename = "input_tokens")]
40135    pub input_tokens: i64,
40136    #[doc = "A detailed breakdown of the input tokens."]
40137    #[serde(rename = "input_tokens_details")]
40138    pub input_tokens_details: crate::__types::response_usage::InputTokensDetails,
40139    #[doc = "The number of output tokens."]
40140    #[serde(rename = "output_tokens")]
40141    pub output_tokens: i64,
40142    #[doc = "A detailed breakdown of the output tokens."]
40143    #[serde(rename = "output_tokens_details")]
40144    pub output_tokens_details: crate::__types::response_usage::OutputTokensDetails,
40145    #[doc = "The total number of tokens used."]
40146    #[serde(rename = "total_tokens")]
40147    pub total_tokens: i64,
40148}
40149#[allow(clippy::module_inception)]
40150pub(crate) mod response_web_search_call_completed_event {
40151    #[doc = "The type of the event. Always `response.web_search_call.completed`.\n"]
40152    #[derive(Clone, Copy, Debug, Default, PartialEq)]
40153    pub(crate) struct Type;
40154    impl_serde!(Type, "response.web_search_call.completed");
40155}
40156#[doc = "Emitted when a web search call is completed."]
40157#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
40158pub struct ResponseWebSearchCallCompletedEvent {
40159    #[doc = "The index of the output item that the web search call is associated with.\n"]
40160    pub output_index: i64,
40161    #[doc = "Unique ID for the output item associated with the web search call.\n"]
40162    pub item_id: String,
40163    #[doc = "The sequence number of the web search call being processed."]
40164    pub sequence_number: i64,
40165}
40166impl<'de> serde::Deserialize<'de> for ResponseWebSearchCallCompletedEvent {
40167    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
40168    where
40169        D: serde::Deserializer<'de>,
40170    {
40171        #[serde_with::serde_as]
40172        #[derive(serde :: Deserialize)]
40173        struct ResponseWebSearchCallCompletedEvent {
40174            #[serde(rename = "type")]
40175            #[allow(dead_code)]
40176            r#type: crate::__types::response_web_search_call_completed_event::Type,
40177            #[serde(rename = "output_index")]
40178            output_index: i64,
40179            #[serde(rename = "item_id")]
40180            item_id: String,
40181            #[serde(rename = "sequence_number")]
40182            sequence_number: i64,
40183        }
40184        let ResponseWebSearchCallCompletedEvent {
40185            output_index,
40186            item_id,
40187            sequence_number,
40188            ..
40189        } = ResponseWebSearchCallCompletedEvent::deserialize(deserializer)?;
40190        Ok(Self {
40191            output_index,
40192            item_id,
40193            sequence_number,
40194        })
40195    }
40196}
40197impl serde::Serialize for ResponseWebSearchCallCompletedEvent {
40198    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
40199    where
40200        S: serde::Serializer,
40201    {
40202        #[serde_with::serde_as]
40203        #[derive(serde :: Serialize)]
40204        struct ResponseWebSearchCallCompletedEvent<'a> {
40205            #[serde(rename = "type")]
40206            r#type: &'a crate::__types::response_web_search_call_completed_event::Type,
40207            #[serde(rename = "output_index")]
40208            output_index: &'a i64,
40209            #[serde(rename = "item_id")]
40210            item_id: &'a String,
40211            #[serde(rename = "sequence_number")]
40212            sequence_number: &'a i64,
40213        }
40214        let Self {
40215            output_index,
40216            item_id,
40217            sequence_number,
40218        } = self;
40219        ResponseWebSearchCallCompletedEvent {
40220            r#type: &Default::default(),
40221            output_index,
40222            item_id,
40223            sequence_number,
40224        }
40225        .serialize(serializer)
40226    }
40227}
40228#[allow(clippy::module_inception)]
40229pub(crate) mod response_web_search_call_in_progress_event {
40230    #[doc = "The type of the event. Always `response.web_search_call.in_progress`.\n"]
40231    #[derive(Clone, Copy, Debug, Default, PartialEq)]
40232    pub(crate) struct Type;
40233    impl_serde!(Type, "response.web_search_call.in_progress");
40234}
40235#[doc = "Emitted when a web search call is initiated."]
40236#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
40237pub struct ResponseWebSearchCallInProgressEvent {
40238    #[doc = "The index of the output item that the web search call is associated with.\n"]
40239    pub output_index: i64,
40240    #[doc = "Unique ID for the output item associated with the web search call.\n"]
40241    pub item_id: String,
40242    #[doc = "The sequence number of the web search call being processed."]
40243    pub sequence_number: i64,
40244}
40245impl<'de> serde::Deserialize<'de> for ResponseWebSearchCallInProgressEvent {
40246    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
40247    where
40248        D: serde::Deserializer<'de>,
40249    {
40250        #[serde_with::serde_as]
40251        #[derive(serde :: Deserialize)]
40252        struct ResponseWebSearchCallInProgressEvent {
40253            #[serde(rename = "type")]
40254            #[allow(dead_code)]
40255            r#type: crate::__types::response_web_search_call_in_progress_event::Type,
40256            #[serde(rename = "output_index")]
40257            output_index: i64,
40258            #[serde(rename = "item_id")]
40259            item_id: String,
40260            #[serde(rename = "sequence_number")]
40261            sequence_number: i64,
40262        }
40263        let ResponseWebSearchCallInProgressEvent {
40264            output_index,
40265            item_id,
40266            sequence_number,
40267            ..
40268        } = ResponseWebSearchCallInProgressEvent::deserialize(deserializer)?;
40269        Ok(Self {
40270            output_index,
40271            item_id,
40272            sequence_number,
40273        })
40274    }
40275}
40276impl serde::Serialize for ResponseWebSearchCallInProgressEvent {
40277    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
40278    where
40279        S: serde::Serializer,
40280    {
40281        #[serde_with::serde_as]
40282        #[derive(serde :: Serialize)]
40283        struct ResponseWebSearchCallInProgressEvent<'a> {
40284            #[serde(rename = "type")]
40285            r#type: &'a crate::__types::response_web_search_call_in_progress_event::Type,
40286            #[serde(rename = "output_index")]
40287            output_index: &'a i64,
40288            #[serde(rename = "item_id")]
40289            item_id: &'a String,
40290            #[serde(rename = "sequence_number")]
40291            sequence_number: &'a i64,
40292        }
40293        let Self {
40294            output_index,
40295            item_id,
40296            sequence_number,
40297        } = self;
40298        ResponseWebSearchCallInProgressEvent {
40299            r#type: &Default::default(),
40300            output_index,
40301            item_id,
40302            sequence_number,
40303        }
40304        .serialize(serializer)
40305    }
40306}
40307#[allow(clippy::module_inception)]
40308pub(crate) mod response_web_search_call_searching_event {
40309    #[doc = "The type of the event. Always `response.web_search_call.searching`.\n"]
40310    #[derive(Clone, Copy, Debug, Default, PartialEq)]
40311    pub(crate) struct Type;
40312    impl_serde!(Type, "response.web_search_call.searching");
40313}
40314#[doc = "Emitted when a web search call is executing."]
40315#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
40316pub struct ResponseWebSearchCallSearchingEvent {
40317    #[doc = "The index of the output item that the web search call is associated with.\n"]
40318    pub output_index: i64,
40319    #[doc = "Unique ID for the output item associated with the web search call.\n"]
40320    pub item_id: String,
40321    #[doc = "The sequence number of the web search call being processed."]
40322    pub sequence_number: i64,
40323}
40324impl<'de> serde::Deserialize<'de> for ResponseWebSearchCallSearchingEvent {
40325    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
40326    where
40327        D: serde::Deserializer<'de>,
40328    {
40329        #[serde_with::serde_as]
40330        #[derive(serde :: Deserialize)]
40331        struct ResponseWebSearchCallSearchingEvent {
40332            #[serde(rename = "type")]
40333            #[allow(dead_code)]
40334            r#type: crate::__types::response_web_search_call_searching_event::Type,
40335            #[serde(rename = "output_index")]
40336            output_index: i64,
40337            #[serde(rename = "item_id")]
40338            item_id: String,
40339            #[serde(rename = "sequence_number")]
40340            sequence_number: i64,
40341        }
40342        let ResponseWebSearchCallSearchingEvent {
40343            output_index,
40344            item_id,
40345            sequence_number,
40346            ..
40347        } = ResponseWebSearchCallSearchingEvent::deserialize(deserializer)?;
40348        Ok(Self {
40349            output_index,
40350            item_id,
40351            sequence_number,
40352        })
40353    }
40354}
40355impl serde::Serialize for ResponseWebSearchCallSearchingEvent {
40356    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
40357    where
40358        S: serde::Serializer,
40359    {
40360        #[serde_with::serde_as]
40361        #[derive(serde :: Serialize)]
40362        struct ResponseWebSearchCallSearchingEvent<'a> {
40363            #[serde(rename = "type")]
40364            r#type: &'a crate::__types::response_web_search_call_searching_event::Type,
40365            #[serde(rename = "output_index")]
40366            output_index: &'a i64,
40367            #[serde(rename = "item_id")]
40368            item_id: &'a String,
40369            #[serde(rename = "sequence_number")]
40370            sequence_number: &'a i64,
40371        }
40372        let Self {
40373            output_index,
40374            item_id,
40375            sequence_number,
40376        } = self;
40377        ResponseWebSearchCallSearchingEvent {
40378            r#type: &Default::default(),
40379            output_index,
40380            item_id,
40381            sequence_number,
40382        }
40383        .serialize(serializer)
40384    }
40385}
40386#[doc = "Usage statistics related to the run. This value will be `null` if the run is not in a terminal state (i.e. `in_progress`, `queued`, etc.)."]
40387#[derive(Clone, Copy, Debug, PartialEq)]
40388#[serde_with::serde_as]
40389#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
40390pub struct RunCompletionUsage {
40391    #[doc = "Number of completion tokens used over the course of the run."]
40392    #[serde(rename = "completion_tokens")]
40393    pub completion_tokens: i64,
40394    #[doc = "Number of prompt tokens used over the course of the run."]
40395    #[serde(rename = "prompt_tokens")]
40396    pub prompt_tokens: i64,
40397    #[doc = "Total number of tokens used (prompt + completion)."]
40398    #[serde(rename = "total_tokens")]
40399    pub total_tokens: i64,
40400}
40401#[allow(clippy::module_inception)]
40402pub mod run_grader_request {
40403    #[doc = "The grader used for the fine-tuning job."]
40404    #[derive(Clone, Debug, PartialEq)]
40405    #[serde_with::serde_as]
40406    #[derive(serde :: Deserialize, serde :: Serialize)]
40407    #[serde(untagged)]
40408    #[allow(clippy::large_enum_variant)]
40409    pub enum Grader {
40410        StringCheck(crate::__types::GraderStringCheck),
40411        TextSimilarity(crate::__types::GraderTextSimilarity),
40412        Python(crate::__types::GraderPython),
40413        ScoreModel(crate::__types::GraderScoreModel),
40414        Multi(crate::__types::GraderMulti),
40415    }
40416}
40417#[derive(Clone, Debug, PartialEq)]
40418#[serde_with::serde_as]
40419#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
40420pub struct RunGraderRequest {
40421    #[doc = "The grader used for the fine-tuning job."]
40422    #[serde(rename = "grader")]
40423    pub grader: crate::__types::run_grader_request::Grader,
40424    #[doc = "The dataset item provided to the grader. This will be used to populate \nthe `item` namespace. See [the guide](https://platform.openai.com/docs/guides/graders) for more details. \n"]
40425    #[serde(rename = "item")]
40426    #[serde(skip_serializing_if = "Option::is_none")]
40427    #[builder(default)]
40428    pub item: Option<indexmap::IndexMap<String, serde_json::Value>>,
40429    #[doc = "The model sample to be evaluated. This value will be used to populate \nthe `sample` namespace. See [the guide](https://platform.openai.com/docs/guides/graders) for more details.\nThe `output_json` variable will be populated if the model sample is a \nvalid JSON string.\n \n"]
40430    #[serde(rename = "model_sample")]
40431    pub model_sample: String,
40432}
40433#[allow(clippy::module_inception)]
40434pub mod run_grader_response {
40435    #[allow(clippy::module_inception)]
40436    pub mod metadata {
40437        #[derive(Clone, Debug, PartialEq)]
40438        #[serde_with::serde_as]
40439        #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
40440        pub struct Errors {
40441            #[serde(rename = "formula_parse_error")]
40442            pub formula_parse_error: bool,
40443            #[serde(rename = "sample_parse_error")]
40444            pub sample_parse_error: bool,
40445            #[serde(rename = "truncated_observation_error")]
40446            pub truncated_observation_error: bool,
40447            #[serde(rename = "unresponsive_reward_error")]
40448            pub unresponsive_reward_error: bool,
40449            #[serde(rename = "invalid_variable_error")]
40450            pub invalid_variable_error: bool,
40451            #[serde(rename = "other_error")]
40452            pub other_error: bool,
40453            #[serde(rename = "python_grader_server_error")]
40454            pub python_grader_server_error: bool,
40455            #[serde(rename = "python_grader_server_error_type")]
40456            #[serde(skip_serializing_if = "Option::is_none")]
40457            #[builder(default)]
40458            pub python_grader_server_error_type: Option<String>,
40459            #[serde(rename = "python_grader_runtime_error")]
40460            pub python_grader_runtime_error: bool,
40461            #[serde(rename = "python_grader_runtime_error_details")]
40462            #[serde(skip_serializing_if = "Option::is_none")]
40463            #[builder(default)]
40464            pub python_grader_runtime_error_details: Option<String>,
40465            #[serde(rename = "model_grader_server_error")]
40466            pub model_grader_server_error: bool,
40467            #[serde(rename = "model_grader_refusal_error")]
40468            pub model_grader_refusal_error: bool,
40469            #[serde(rename = "model_grader_parse_error")]
40470            pub model_grader_parse_error: bool,
40471            #[serde(rename = "model_grader_server_error_details")]
40472            #[serde(skip_serializing_if = "Option::is_none")]
40473            #[builder(default)]
40474            pub model_grader_server_error_details: Option<String>,
40475        }
40476    }
40477    #[derive(Clone, Debug, PartialEq)]
40478    #[serde_with::serde_as]
40479    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
40480    pub struct Metadata {
40481        #[serde(rename = "name")]
40482        pub name: String,
40483        #[serde(rename = "type")]
40484        pub r#type: String,
40485        #[serde(rename = "errors")]
40486        pub errors: crate::__types::run_grader_response::metadata::Errors,
40487        #[serde(rename = "execution_time")]
40488        pub execution_time: serde_json::Number,
40489        #[serde(rename = "scores")]
40490        pub scores: indexmap::IndexMap<String, serde_json::Value>,
40491        #[serde(rename = "token_usage")]
40492        #[serde(skip_serializing_if = "Option::is_none")]
40493        #[builder(default)]
40494        pub token_usage: Option<i64>,
40495        #[serde(rename = "sampled_model_name")]
40496        #[serde(skip_serializing_if = "Option::is_none")]
40497        #[builder(default)]
40498        pub sampled_model_name: Option<String>,
40499    }
40500}
40501#[derive(Clone, Debug, PartialEq)]
40502#[serde_with::serde_as]
40503#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
40504pub struct RunGraderResponse {
40505    #[serde(rename = "reward")]
40506    pub reward: serde_json::Number,
40507    #[serde(rename = "metadata")]
40508    pub metadata: crate::__types::run_grader_response::Metadata,
40509    #[serde(rename = "sub_rewards")]
40510    pub sub_rewards: indexmap::IndexMap<String, serde_json::Value>,
40511    #[serde(rename = "model_grader_token_usage_per_model")]
40512    pub model_grader_token_usage_per_model: indexmap::IndexMap<String, serde_json::Value>,
40513}
40514#[allow(clippy::module_inception)]
40515pub mod run_object {
40516    #[doc = "The object type, which is always `thread.run`."]
40517    #[derive(Clone, Copy, Debug, Default, PartialEq)]
40518    pub(crate) struct Object;
40519    impl_serde!(Object, "thread.run");
40520    #[allow(clippy::module_inception)]
40521    pub mod required_action {
40522        #[doc = "For now, this is always `submit_tool_outputs`."]
40523        #[derive(Clone, Copy, Debug, Default, PartialEq)]
40524        pub(crate) struct Type;
40525        impl_serde!(Type, "submit_tool_outputs");
40526        #[doc = "Details on the tool outputs needed for this run to continue."]
40527        #[derive(Clone, Debug, PartialEq)]
40528        #[serde_with::serde_as]
40529        #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
40530        pub struct SubmitToolOutputs {
40531            #[doc = "A list of the relevant tool calls."]
40532            #[serde(rename = "tool_calls")]
40533            pub tool_calls: Vec<crate::__types::RunToolCallObject>,
40534        }
40535    }
40536    #[doc = "Details on the action required to continue the run. Will be `null` if no action is required."]
40537    #[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
40538    pub struct RequiredAction {
40539        #[doc = "Details on the tool outputs needed for this run to continue."]
40540        pub submit_tool_outputs: crate::__types::run_object::required_action::SubmitToolOutputs,
40541    }
40542    impl<'de> serde::Deserialize<'de> for RequiredAction {
40543        fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
40544        where
40545            D: serde::Deserializer<'de>,
40546        {
40547            #[serde_with::serde_as]
40548            #[derive(serde :: Deserialize)]
40549            struct RequiredAction {
40550                #[serde(rename = "type")]
40551                #[allow(dead_code)]
40552                r#type: crate::__types::run_object::required_action::Type,
40553                #[serde(rename = "submit_tool_outputs")]
40554                submit_tool_outputs: crate::__types::run_object::required_action::SubmitToolOutputs,
40555            }
40556            let RequiredAction {
40557                submit_tool_outputs,
40558                ..
40559            } = RequiredAction::deserialize(deserializer)?;
40560            Ok(Self {
40561                submit_tool_outputs,
40562            })
40563        }
40564    }
40565    impl serde::Serialize for RequiredAction {
40566        fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
40567        where
40568            S: serde::Serializer,
40569        {
40570            #[serde_with::serde_as]
40571            #[derive(serde :: Serialize)]
40572            struct RequiredAction<'a> {
40573                #[serde(rename = "type")]
40574                r#type: &'a crate::__types::run_object::required_action::Type,
40575                #[serde(rename = "submit_tool_outputs")]
40576                submit_tool_outputs:
40577                    &'a crate::__types::run_object::required_action::SubmitToolOutputs,
40578            }
40579            let Self {
40580                submit_tool_outputs,
40581            } = self;
40582            RequiredAction {
40583                r#type: &Default::default(),
40584                submit_tool_outputs,
40585            }
40586            .serialize(serializer)
40587        }
40588    }
40589    #[allow(clippy::module_inception)]
40590    pub mod last_error {
40591        #[doc = "One of `server_error`, `rate_limit_exceeded`, or `invalid_prompt`."]
40592        #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
40593        pub enum Code {
40594            #[doc = "`server_error`"]
40595            #[serde(rename = "server_error")]
40596            ServerError,
40597            #[doc = "`rate_limit_exceeded`"]
40598            #[serde(rename = "rate_limit_exceeded")]
40599            RateLimitExceeded,
40600            #[doc = "`invalid_prompt`"]
40601            #[serde(rename = "invalid_prompt")]
40602            InvalidPrompt,
40603        }
40604    }
40605    #[doc = "The last error associated with this run. Will be `null` if there are no errors."]
40606    #[derive(Clone, Debug, PartialEq)]
40607    #[serde_with::serde_as]
40608    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
40609    pub struct LastError {
40610        #[doc = "One of `server_error`, `rate_limit_exceeded`, or `invalid_prompt`."]
40611        #[serde(rename = "code")]
40612        pub code: crate::__types::run_object::last_error::Code,
40613        #[doc = "A human-readable description of the error."]
40614        #[serde(rename = "message")]
40615        pub message: String,
40616    }
40617    #[allow(clippy::module_inception)]
40618    pub mod incomplete_details {
40619        #[doc = "The reason why the run is incomplete. This will point to which specific token limit was reached over the course of the run."]
40620        #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
40621        pub enum Reason {
40622            #[doc = "`max_completion_tokens`"]
40623            #[serde(rename = "max_completion_tokens")]
40624            MaxCompletionTokens,
40625            #[doc = "`max_prompt_tokens`"]
40626            #[serde(rename = "max_prompt_tokens")]
40627            MaxPromptTokens,
40628        }
40629    }
40630    #[doc = "Details on why the run is incomplete. Will be `null` if the run is not incomplete."]
40631    #[derive(Clone, Copy, Debug, Default, PartialEq)]
40632    #[serde_with::serde_as]
40633    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
40634    pub struct IncompleteDetails {
40635        #[doc = "The reason why the run is incomplete. This will point to which specific token limit was reached over the course of the run."]
40636        #[serde(rename = "reason")]
40637        #[serde(skip_serializing_if = "Option::is_none")]
40638        #[builder(default)]
40639        pub reason: Option<crate::__types::run_object::incomplete_details::Reason>,
40640    }
40641}
40642#[doc = "Represents an execution run on a [thread](https://platform.openai.com/docs/api-reference/threads)."]
40643#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
40644pub struct RunObject {
40645    #[doc = "The identifier, which can be referenced in API endpoints."]
40646    pub id: String,
40647    #[doc = "The Unix timestamp (in seconds) for when the run was created."]
40648    pub created_at: i64,
40649    #[doc = "The ID of the [thread](https://platform.openai.com/docs/api-reference/threads) that was executed on as a part of this run."]
40650    pub thread_id: String,
40651    #[doc = "The ID of the [assistant](https://platform.openai.com/docs/api-reference/assistants) used for execution of this run."]
40652    pub assistant_id: String,
40653    pub status: crate::__types::RunStatus,
40654    #[doc = "Details on the action required to continue the run. Will be `null` if no action is required."]
40655    #[builder(default)]
40656    pub required_action: Option<crate::__types::run_object::RequiredAction>,
40657    #[doc = "The last error associated with this run. Will be `null` if there are no errors."]
40658    #[builder(default)]
40659    pub last_error: Option<crate::__types::run_object::LastError>,
40660    #[doc = "The Unix timestamp (in seconds) for when the run will expire."]
40661    #[builder(default)]
40662    pub expires_at: Option<i64>,
40663    #[doc = "The Unix timestamp (in seconds) for when the run was started."]
40664    #[builder(default)]
40665    pub started_at: Option<i64>,
40666    #[doc = "The Unix timestamp (in seconds) for when the run was cancelled."]
40667    #[builder(default)]
40668    pub cancelled_at: Option<i64>,
40669    #[doc = "The Unix timestamp (in seconds) for when the run failed."]
40670    #[builder(default)]
40671    pub failed_at: Option<i64>,
40672    #[doc = "The Unix timestamp (in seconds) for when the run was completed."]
40673    #[builder(default)]
40674    pub completed_at: Option<i64>,
40675    #[doc = "Details on why the run is incomplete. Will be `null` if the run is not incomplete."]
40676    #[builder(default)]
40677    pub incomplete_details: Option<crate::__types::run_object::IncompleteDetails>,
40678    #[doc = "The model that the [assistant](https://platform.openai.com/docs/api-reference/assistants) used for this run."]
40679    pub model: String,
40680    #[doc = "The instructions that the [assistant](https://platform.openai.com/docs/api-reference/assistants) used for this run."]
40681    pub instructions: String,
40682    #[doc = "The list of tools that the [assistant](https://platform.openai.com/docs/api-reference/assistants) used for this run."]
40683    pub tools: Vec<crate::__types::AssistantTool>,
40684    #[builder(default)]
40685    pub metadata: Option<crate::__types::Metadata>,
40686    #[builder(default)]
40687    pub usage: Option<crate::__types::RunCompletionUsage>,
40688    #[doc = "The sampling temperature used for this run. If not set, defaults to 1."]
40689    #[builder(default)]
40690    pub temperature: Option<serde_json::Number>,
40691    #[doc = "The nucleus sampling value used for this run. If not set, defaults to 1."]
40692    #[builder(default)]
40693    pub top_p: Option<serde_json::Number>,
40694    #[doc = "The maximum number of prompt tokens specified to have been used over the course of the run.\n"]
40695    #[builder(default)]
40696    pub max_prompt_tokens: Option<i64>,
40697    #[doc = "The maximum number of completion tokens specified to have been used over the course of the run.\n"]
40698    #[builder(default)]
40699    pub max_completion_tokens: Option<i64>,
40700    #[builder(default)]
40701    pub truncation_strategy: Option<crate::__types::TruncationObject>,
40702    #[builder(default)]
40703    pub tool_choice: Option<crate::__types::AssistantsApiToolChoiceOption>,
40704    pub parallel_tool_calls: crate::__types::ParallelToolCalls,
40705    #[builder(default)]
40706    pub response_format: Option<crate::__types::AssistantsApiResponseFormatOption>,
40707}
40708impl<'de> serde::Deserialize<'de> for RunObject {
40709    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
40710    where
40711        D: serde::Deserializer<'de>,
40712    {
40713        #[serde_with::serde_as]
40714        #[derive(serde :: Deserialize)]
40715        struct RunObject {
40716            #[serde(rename = "id")]
40717            id: String,
40718            #[serde(rename = "object")]
40719            #[allow(dead_code)]
40720            object: crate::__types::run_object::Object,
40721            #[serde(rename = "created_at")]
40722            created_at: i64,
40723            #[serde(rename = "thread_id")]
40724            thread_id: String,
40725            #[serde(rename = "assistant_id")]
40726            assistant_id: String,
40727            #[serde(rename = "status")]
40728            status: crate::__types::RunStatus,
40729            #[serde(rename = "required_action")]
40730            required_action: Option<crate::__types::run_object::RequiredAction>,
40731            #[serde(rename = "last_error")]
40732            last_error: Option<crate::__types::run_object::LastError>,
40733            #[serde(rename = "expires_at")]
40734            expires_at: Option<i64>,
40735            #[serde(rename = "started_at")]
40736            started_at: Option<i64>,
40737            #[serde(rename = "cancelled_at")]
40738            cancelled_at: Option<i64>,
40739            #[serde(rename = "failed_at")]
40740            failed_at: Option<i64>,
40741            #[serde(rename = "completed_at")]
40742            completed_at: Option<i64>,
40743            #[serde(rename = "incomplete_details")]
40744            incomplete_details: Option<crate::__types::run_object::IncompleteDetails>,
40745            #[serde(rename = "model")]
40746            model: String,
40747            #[serde(rename = "instructions")]
40748            instructions: String,
40749            #[serde(rename = "tools")]
40750            tools: Vec<crate::__types::AssistantTool>,
40751            #[serde(rename = "metadata")]
40752            metadata: Option<crate::__types::Metadata>,
40753            #[serde(rename = "usage")]
40754            usage: Option<crate::__types::RunCompletionUsage>,
40755            #[serde(rename = "temperature")]
40756            temperature: Option<serde_json::Number>,
40757            #[serde(rename = "top_p")]
40758            top_p: Option<serde_json::Number>,
40759            #[serde(rename = "max_prompt_tokens")]
40760            max_prompt_tokens: Option<i64>,
40761            #[serde(rename = "max_completion_tokens")]
40762            max_completion_tokens: Option<i64>,
40763            #[serde(rename = "truncation_strategy")]
40764            truncation_strategy: Option<crate::__types::TruncationObject>,
40765            #[serde(rename = "tool_choice")]
40766            tool_choice: Option<crate::__types::AssistantsApiToolChoiceOption>,
40767            #[serde(rename = "parallel_tool_calls")]
40768            parallel_tool_calls: crate::__types::ParallelToolCalls,
40769            #[serde(rename = "response_format")]
40770            response_format: Option<crate::__types::AssistantsApiResponseFormatOption>,
40771        }
40772        let RunObject {
40773            id,
40774            created_at,
40775            thread_id,
40776            assistant_id,
40777            status,
40778            required_action,
40779            last_error,
40780            expires_at,
40781            started_at,
40782            cancelled_at,
40783            failed_at,
40784            completed_at,
40785            incomplete_details,
40786            model,
40787            instructions,
40788            tools,
40789            metadata,
40790            usage,
40791            temperature,
40792            top_p,
40793            max_prompt_tokens,
40794            max_completion_tokens,
40795            truncation_strategy,
40796            tool_choice,
40797            parallel_tool_calls,
40798            response_format,
40799            ..
40800        } = RunObject::deserialize(deserializer)?;
40801        Ok(Self {
40802            id,
40803            created_at,
40804            thread_id,
40805            assistant_id,
40806            status,
40807            required_action,
40808            last_error,
40809            expires_at,
40810            started_at,
40811            cancelled_at,
40812            failed_at,
40813            completed_at,
40814            incomplete_details,
40815            model,
40816            instructions,
40817            tools,
40818            metadata,
40819            usage,
40820            temperature,
40821            top_p,
40822            max_prompt_tokens,
40823            max_completion_tokens,
40824            truncation_strategy,
40825            tool_choice,
40826            parallel_tool_calls,
40827            response_format,
40828        })
40829    }
40830}
40831impl serde::Serialize for RunObject {
40832    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
40833    where
40834        S: serde::Serializer,
40835    {
40836        #[serde_with::serde_as]
40837        #[derive(serde :: Serialize)]
40838        struct RunObject<'a> {
40839            #[serde(rename = "id")]
40840            id: &'a String,
40841            #[serde(rename = "object")]
40842            object: &'a crate::__types::run_object::Object,
40843            #[serde(rename = "created_at")]
40844            created_at: &'a i64,
40845            #[serde(rename = "thread_id")]
40846            thread_id: &'a String,
40847            #[serde(rename = "assistant_id")]
40848            assistant_id: &'a String,
40849            #[serde(rename = "status")]
40850            status: &'a crate::__types::RunStatus,
40851            #[serde(rename = "required_action")]
40852            #[serde(skip_serializing_if = "Option::is_none")]
40853            required_action: &'a Option<crate::__types::run_object::RequiredAction>,
40854            #[serde(rename = "last_error")]
40855            #[serde(skip_serializing_if = "Option::is_none")]
40856            last_error: &'a Option<crate::__types::run_object::LastError>,
40857            #[serde(rename = "expires_at")]
40858            #[serde(skip_serializing_if = "Option::is_none")]
40859            expires_at: &'a Option<i64>,
40860            #[serde(rename = "started_at")]
40861            #[serde(skip_serializing_if = "Option::is_none")]
40862            started_at: &'a Option<i64>,
40863            #[serde(rename = "cancelled_at")]
40864            #[serde(skip_serializing_if = "Option::is_none")]
40865            cancelled_at: &'a Option<i64>,
40866            #[serde(rename = "failed_at")]
40867            #[serde(skip_serializing_if = "Option::is_none")]
40868            failed_at: &'a Option<i64>,
40869            #[serde(rename = "completed_at")]
40870            #[serde(skip_serializing_if = "Option::is_none")]
40871            completed_at: &'a Option<i64>,
40872            #[serde(rename = "incomplete_details")]
40873            #[serde(skip_serializing_if = "Option::is_none")]
40874            incomplete_details: &'a Option<crate::__types::run_object::IncompleteDetails>,
40875            #[serde(rename = "model")]
40876            model: &'a String,
40877            #[serde(rename = "instructions")]
40878            instructions: &'a String,
40879            #[serde(rename = "tools")]
40880            tools: &'a Vec<crate::__types::AssistantTool>,
40881            #[serde(rename = "metadata")]
40882            #[serde(skip_serializing_if = "Option::is_none")]
40883            metadata: &'a Option<crate::__types::Metadata>,
40884            #[serde(rename = "usage")]
40885            #[serde(skip_serializing_if = "Option::is_none")]
40886            usage: &'a Option<crate::__types::RunCompletionUsage>,
40887            #[serde(rename = "temperature")]
40888            #[serde(skip_serializing_if = "Option::is_none")]
40889            temperature: &'a Option<serde_json::Number>,
40890            #[serde(rename = "top_p")]
40891            #[serde(skip_serializing_if = "Option::is_none")]
40892            top_p: &'a Option<serde_json::Number>,
40893            #[serde(rename = "max_prompt_tokens")]
40894            #[serde(skip_serializing_if = "Option::is_none")]
40895            max_prompt_tokens: &'a Option<i64>,
40896            #[serde(rename = "max_completion_tokens")]
40897            #[serde(skip_serializing_if = "Option::is_none")]
40898            max_completion_tokens: &'a Option<i64>,
40899            #[serde(rename = "truncation_strategy")]
40900            #[serde(skip_serializing_if = "Option::is_none")]
40901            truncation_strategy: &'a Option<crate::__types::TruncationObject>,
40902            #[serde(rename = "tool_choice")]
40903            #[serde(skip_serializing_if = "Option::is_none")]
40904            tool_choice: &'a Option<crate::__types::AssistantsApiToolChoiceOption>,
40905            #[serde(rename = "parallel_tool_calls")]
40906            parallel_tool_calls: &'a crate::__types::ParallelToolCalls,
40907            #[serde(rename = "response_format")]
40908            #[serde(skip_serializing_if = "Option::is_none")]
40909            response_format: &'a Option<crate::__types::AssistantsApiResponseFormatOption>,
40910        }
40911        let Self {
40912            id,
40913            created_at,
40914            thread_id,
40915            assistant_id,
40916            status,
40917            required_action,
40918            last_error,
40919            expires_at,
40920            started_at,
40921            cancelled_at,
40922            failed_at,
40923            completed_at,
40924            incomplete_details,
40925            model,
40926            instructions,
40927            tools,
40928            metadata,
40929            usage,
40930            temperature,
40931            top_p,
40932            max_prompt_tokens,
40933            max_completion_tokens,
40934            truncation_strategy,
40935            tool_choice,
40936            parallel_tool_calls,
40937            response_format,
40938        } = self;
40939        RunObject {
40940            id,
40941            object: &Default::default(),
40942            created_at,
40943            thread_id,
40944            assistant_id,
40945            status,
40946            required_action,
40947            last_error,
40948            expires_at,
40949            started_at,
40950            cancelled_at,
40951            failed_at,
40952            completed_at,
40953            incomplete_details,
40954            model,
40955            instructions,
40956            tools,
40957            metadata,
40958            usage,
40959            temperature,
40960            top_p,
40961            max_prompt_tokens,
40962            max_completion_tokens,
40963            truncation_strategy,
40964            tool_choice,
40965            parallel_tool_calls,
40966            response_format,
40967        }
40968        .serialize(serializer)
40969    }
40970}
40971#[doc = "Usage statistics related to the run step. This value will be `null` while the run step's status is `in_progress`."]
40972#[derive(Clone, Copy, Debug, PartialEq)]
40973#[serde_with::serde_as]
40974#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
40975pub struct RunStepCompletionUsage {
40976    #[doc = "Number of completion tokens used over the course of the run step."]
40977    #[serde(rename = "completion_tokens")]
40978    pub completion_tokens: i64,
40979    #[doc = "Number of prompt tokens used over the course of the run step."]
40980    #[serde(rename = "prompt_tokens")]
40981    pub prompt_tokens: i64,
40982    #[doc = "Total number of tokens used (prompt + completion)."]
40983    #[serde(rename = "total_tokens")]
40984    pub total_tokens: i64,
40985}
40986#[allow(clippy::module_inception)]
40987pub(crate) mod run_step_delta_object {
40988    #[doc = "The object type, which is always `thread.run.step.delta`."]
40989    #[derive(Clone, Copy, Debug, Default, PartialEq)]
40990    pub(crate) struct Object;
40991    impl_serde!(Object, "thread.run.step.delta");
40992}
40993#[doc = "Represents a run step delta i.e. any changed fields on a run step during streaming.\n"]
40994#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
40995pub struct RunStepDeltaObject {
40996    #[doc = "The identifier of the run step, which can be referenced in API endpoints."]
40997    pub id: String,
40998    #[builder(default)]
40999    pub delta: crate::__types::RunStepDeltaObjectDelta,
41000}
41001impl<'de> serde::Deserialize<'de> for RunStepDeltaObject {
41002    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
41003    where
41004        D: serde::Deserializer<'de>,
41005    {
41006        #[serde_with::serde_as]
41007        #[derive(serde :: Deserialize)]
41008        struct RunStepDeltaObject {
41009            #[serde(rename = "id")]
41010            id: String,
41011            #[serde(rename = "object")]
41012            #[allow(dead_code)]
41013            object: crate::__types::run_step_delta_object::Object,
41014            #[serde(rename = "delta")]
41015            delta: crate::__types::RunStepDeltaObjectDelta,
41016        }
41017        let RunStepDeltaObject { id, delta, .. } = RunStepDeltaObject::deserialize(deserializer)?;
41018        Ok(Self { id, delta })
41019    }
41020}
41021impl serde::Serialize for RunStepDeltaObject {
41022    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
41023    where
41024        S: serde::Serializer,
41025    {
41026        #[serde_with::serde_as]
41027        #[derive(serde :: Serialize)]
41028        struct RunStepDeltaObject<'a> {
41029            #[serde(rename = "id")]
41030            id: &'a String,
41031            #[serde(rename = "object")]
41032            object: &'a crate::__types::run_step_delta_object::Object,
41033            #[serde(rename = "delta")]
41034            delta: &'a crate::__types::RunStepDeltaObjectDelta,
41035        }
41036        let Self { id, delta } = self;
41037        RunStepDeltaObject {
41038            id,
41039            object: &Default::default(),
41040            delta,
41041        }
41042        .serialize(serializer)
41043    }
41044}
41045#[allow(clippy::module_inception)]
41046pub mod run_step_delta_step_details_message_creation_object {
41047    #[doc = "Always `message_creation`."]
41048    #[derive(Clone, Copy, Debug, Default, PartialEq)]
41049    pub(crate) struct Type;
41050    impl_serde!(Type, "message_creation");
41051    #[derive(Clone, Debug, Default, PartialEq)]
41052    #[serde_with::serde_as]
41053    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
41054    pub struct MessageCreation {
41055        #[doc = "The ID of the message that was created by this run step."]
41056        #[serde(rename = "message_id")]
41057        #[serde(skip_serializing_if = "Option::is_none")]
41058        #[builder(default)]
41059        pub message_id: Option<String>,
41060    }
41061}
41062#[doc = "Details of the message creation by the run step."]
41063#[derive(Clone, Debug, Default, PartialEq, typed_builder :: TypedBuilder)]
41064pub struct RunStepDeltaStepDetailsMessageCreationObject {
41065    #[builder(default)]
41066    pub message_creation: Option<
41067        crate::__types::run_step_delta_step_details_message_creation_object::MessageCreation,
41068    >,
41069}
41070impl<'de> serde::Deserialize<'de> for RunStepDeltaStepDetailsMessageCreationObject {
41071    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
41072    where
41073        D: serde::Deserializer<'de>,
41074    {
41075        #[serde_with::serde_as]
41076        #[derive(serde :: Deserialize)]
41077        struct RunStepDeltaStepDetailsMessageCreationObject { # [serde (rename = "type")] # [allow (dead_code)] r#type : crate :: __types :: run_step_delta_step_details_message_creation_object :: Type , # [serde (rename = "message_creation")] message_creation : Option < crate :: __types :: run_step_delta_step_details_message_creation_object :: MessageCreation > }
41078        let RunStepDeltaStepDetailsMessageCreationObject {
41079            message_creation, ..
41080        } = RunStepDeltaStepDetailsMessageCreationObject::deserialize(deserializer)?;
41081        Ok(Self { message_creation })
41082    }
41083}
41084impl serde::Serialize for RunStepDeltaStepDetailsMessageCreationObject {
41085    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
41086    where
41087        S: serde::Serializer,
41088    {
41089        #[serde_with::serde_as]
41090        #[derive(serde :: Serialize)]
41091        struct RunStepDeltaStepDetailsMessageCreationObject < 'a > { # [serde (rename = "type")] r#type : & 'a crate :: __types :: run_step_delta_step_details_message_creation_object :: Type , # [serde (rename = "message_creation")] # [serde (skip_serializing_if = "Option::is_none")] message_creation : & 'a Option < crate :: __types :: run_step_delta_step_details_message_creation_object :: MessageCreation > }
41092        let Self { message_creation } = self;
41093        RunStepDeltaStepDetailsMessageCreationObject {
41094            r#type: &Default::default(),
41095            message_creation,
41096        }
41097        .serialize(serializer)
41098    }
41099}
41100#[allow(clippy::module_inception)]
41101pub mod run_step_delta_step_details_tool_calls_code_object {
41102    #[doc = "The type of tool call. This is always going to be `code_interpreter` for this type of tool call."]
41103    #[derive(Clone, Copy, Debug, Default, PartialEq)]
41104    pub(crate) struct Type;
41105    impl_serde!(Type, "code_interpreter");
41106    #[allow(clippy::module_inception)]
41107    pub mod code_interpreter {
41108        #[allow(clippy::module_inception)]
41109        pub mod outputs {
41110            #[derive(Clone, Debug, PartialEq)]
41111            #[serde_with::serde_as]
41112            #[derive(serde :: Deserialize, serde :: Serialize)]
41113            #[serde(untagged)]
41114            #[allow(clippy::large_enum_variant)]
41115            pub enum Item {
41116                Logs(crate::__types::RunStepDeltaStepDetailsToolCallsCodeOutputLogsObject),
41117                Image(crate::__types::RunStepDeltaStepDetailsToolCallsCodeOutputImageObject),
41118            }
41119        }
41120    }
41121    #[doc = "The Code Interpreter tool call definition."]
41122    #[derive(Clone, Debug, Default, PartialEq)]
41123    #[serde_with::serde_as]
41124    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
41125    pub struct CodeInterpreter { # [doc = "The input to the Code Interpreter tool call."] # [serde (rename = "input")] # [serde (skip_serializing_if = "Option::is_none")] # [builder (default)] pub input : Option < String > , # [doc = "The outputs from the Code Interpreter tool call. Code Interpreter can output one or more items, including text (`logs`) or images (`image`). Each of these are represented by a different object type."] # [serde (rename = "outputs")] # [serde (skip_serializing_if = "Option::is_none")] # [builder (default)] pub outputs : Option < Vec < crate :: __types :: run_step_delta_step_details_tool_calls_code_object :: code_interpreter :: outputs :: Item > > }
41126}
41127#[doc = "Details of the Code Interpreter tool call the run step was involved in."]
41128#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
41129pub struct RunStepDeltaStepDetailsToolCallsCodeObject {
41130    #[doc = "The index of the tool call in the tool calls array."]
41131    pub index: i64,
41132    #[doc = "The ID of the tool call."]
41133    #[builder(default)]
41134    pub id: Option<String>,
41135    #[doc = "The Code Interpreter tool call definition."]
41136    #[builder(default)]
41137    pub code_interpreter:
41138        Option<crate::__types::run_step_delta_step_details_tool_calls_code_object::CodeInterpreter>,
41139}
41140impl<'de> serde::Deserialize<'de> for RunStepDeltaStepDetailsToolCallsCodeObject {
41141    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
41142    where
41143        D: serde::Deserializer<'de>,
41144    {
41145        #[serde_with::serde_as]
41146        #[derive(serde :: Deserialize)]
41147        struct RunStepDeltaStepDetailsToolCallsCodeObject {
41148            #[serde(rename = "index")]
41149            index: i64,
41150            #[serde(rename = "id")]
41151            id: Option<String>,
41152            #[serde(rename = "type")]
41153            #[allow(dead_code)]
41154            r#type: crate::__types::run_step_delta_step_details_tool_calls_code_object::Type,
41155            #[serde(rename = "code_interpreter")]
41156            code_interpreter: Option<
41157                crate::__types::run_step_delta_step_details_tool_calls_code_object::CodeInterpreter,
41158            >,
41159        }
41160        let RunStepDeltaStepDetailsToolCallsCodeObject {
41161            index,
41162            id,
41163            code_interpreter,
41164            ..
41165        } = RunStepDeltaStepDetailsToolCallsCodeObject::deserialize(deserializer)?;
41166        Ok(Self {
41167            index,
41168            id,
41169            code_interpreter,
41170        })
41171    }
41172}
41173impl serde::Serialize for RunStepDeltaStepDetailsToolCallsCodeObject {
41174    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
41175    where
41176        S: serde::Serializer,
41177    {
41178        #[serde_with::serde_as]
41179        #[derive(serde :: Serialize)]
41180        struct RunStepDeltaStepDetailsToolCallsCodeObject<'a> {
41181            #[serde(rename = "index")]
41182            index: &'a i64,
41183            #[serde(rename = "id")]
41184            #[serde(skip_serializing_if = "Option::is_none")]
41185            id: &'a Option<String>,
41186            #[serde(rename = "type")]
41187            r#type: &'a crate::__types::run_step_delta_step_details_tool_calls_code_object::Type,
41188            #[serde(rename = "code_interpreter")]
41189            #[serde(skip_serializing_if = "Option::is_none")]
41190            code_interpreter: &'a Option<
41191                crate::__types::run_step_delta_step_details_tool_calls_code_object::CodeInterpreter,
41192            >,
41193        }
41194        let Self {
41195            index,
41196            id,
41197            code_interpreter,
41198        } = self;
41199        RunStepDeltaStepDetailsToolCallsCodeObject {
41200            index,
41201            id,
41202            r#type: &Default::default(),
41203            code_interpreter,
41204        }
41205        .serialize(serializer)
41206    }
41207}
41208#[allow(clippy::module_inception)]
41209pub mod run_step_delta_step_details_tool_calls_code_output_image_object {
41210    #[doc = "Always `image`."]
41211    #[derive(Clone, Copy, Debug, Default, PartialEq)]
41212    pub(crate) struct Type;
41213    impl_serde!(Type, "image");
41214    #[derive(Clone, Debug, Default, PartialEq)]
41215    #[serde_with::serde_as]
41216    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
41217    pub struct Image {
41218        #[doc = "The [file](https://platform.openai.com/docs/api-reference/files) ID of the image."]
41219        #[serde(rename = "file_id")]
41220        #[serde(skip_serializing_if = "Option::is_none")]
41221        #[builder(default)]
41222        pub file_id: Option<String>,
41223    }
41224}
41225#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
41226pub struct RunStepDeltaStepDetailsToolCallsCodeOutputImageObject {
41227    #[doc = "The index of the output in the outputs array."]
41228    pub index: i64,
41229    #[builder(default)]
41230    pub image: Option<
41231        crate::__types::run_step_delta_step_details_tool_calls_code_output_image_object::Image,
41232    >,
41233}
41234impl<'de> serde::Deserialize<'de> for RunStepDeltaStepDetailsToolCallsCodeOutputImageObject {
41235    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
41236    where
41237        D: serde::Deserializer<'de>,
41238    {
41239        #[serde_with::serde_as]
41240        #[derive(serde :: Deserialize)]
41241        struct RunStepDeltaStepDetailsToolCallsCodeOutputImageObject { # [serde (rename = "index")] index : i64 , # [serde (rename = "type")] # [allow (dead_code)] r#type : crate :: __types :: run_step_delta_step_details_tool_calls_code_output_image_object :: Type , # [serde (rename = "image")] image : Option < crate :: __types :: run_step_delta_step_details_tool_calls_code_output_image_object :: Image > }
41242        let RunStepDeltaStepDetailsToolCallsCodeOutputImageObject { index, image, .. } =
41243            RunStepDeltaStepDetailsToolCallsCodeOutputImageObject::deserialize(deserializer)?;
41244        Ok(Self { index, image })
41245    }
41246}
41247impl serde::Serialize for RunStepDeltaStepDetailsToolCallsCodeOutputImageObject {
41248    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
41249    where
41250        S: serde::Serializer,
41251    {
41252        #[serde_with::serde_as]
41253        #[derive(serde :: Serialize)]
41254        struct RunStepDeltaStepDetailsToolCallsCodeOutputImageObject < 'a > { # [serde (rename = "index")] index : & 'a i64 , # [serde (rename = "type")] r#type : & 'a crate :: __types :: run_step_delta_step_details_tool_calls_code_output_image_object :: Type , # [serde (rename = "image")] # [serde (skip_serializing_if = "Option::is_none")] image : & 'a Option < crate :: __types :: run_step_delta_step_details_tool_calls_code_output_image_object :: Image > }
41255        let Self { index, image } = self;
41256        RunStepDeltaStepDetailsToolCallsCodeOutputImageObject {
41257            index,
41258            r#type: &Default::default(),
41259            image,
41260        }
41261        .serialize(serializer)
41262    }
41263}
41264#[allow(clippy::module_inception)]
41265pub(crate) mod run_step_delta_step_details_tool_calls_code_output_logs_object {
41266    #[doc = "Always `logs`."]
41267    #[derive(Clone, Copy, Debug, Default, PartialEq)]
41268    pub(crate) struct Type;
41269    impl_serde!(Type, "logs");
41270}
41271#[doc = "Text output from the Code Interpreter tool call as part of a run step."]
41272#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
41273pub struct RunStepDeltaStepDetailsToolCallsCodeOutputLogsObject {
41274    #[doc = "The index of the output in the outputs array."]
41275    pub index: i64,
41276    #[doc = "The text output from the Code Interpreter tool call."]
41277    #[builder(default)]
41278    pub logs: Option<String>,
41279}
41280impl<'de> serde::Deserialize<'de> for RunStepDeltaStepDetailsToolCallsCodeOutputLogsObject {
41281    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
41282    where
41283        D: serde::Deserializer<'de>,
41284    {
41285        #[serde_with::serde_as]
41286        #[derive(serde :: Deserialize)]
41287        struct RunStepDeltaStepDetailsToolCallsCodeOutputLogsObject { # [serde (rename = "index")] index : i64 , # [serde (rename = "type")] # [allow (dead_code)] r#type : crate :: __types :: run_step_delta_step_details_tool_calls_code_output_logs_object :: Type , # [serde (rename = "logs")] logs : Option < String > }
41288        let RunStepDeltaStepDetailsToolCallsCodeOutputLogsObject { index, logs, .. } =
41289            RunStepDeltaStepDetailsToolCallsCodeOutputLogsObject::deserialize(deserializer)?;
41290        Ok(Self { index, logs })
41291    }
41292}
41293impl serde::Serialize for RunStepDeltaStepDetailsToolCallsCodeOutputLogsObject {
41294    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
41295    where
41296        S: serde::Serializer,
41297    {
41298        #[serde_with::serde_as]
41299        #[derive(serde :: Serialize)]
41300        struct RunStepDeltaStepDetailsToolCallsCodeOutputLogsObject < 'a > { # [serde (rename = "index")] index : & 'a i64 , # [serde (rename = "type")] r#type : & 'a crate :: __types :: run_step_delta_step_details_tool_calls_code_output_logs_object :: Type , # [serde (rename = "logs")] # [serde (skip_serializing_if = "Option::is_none")] logs : & 'a Option < String > }
41301        let Self { index, logs } = self;
41302        RunStepDeltaStepDetailsToolCallsCodeOutputLogsObject {
41303            index,
41304            r#type: &Default::default(),
41305            logs,
41306        }
41307        .serialize(serializer)
41308    }
41309}
41310#[allow(clippy::module_inception)]
41311pub(crate) mod run_step_delta_step_details_tool_calls_file_search_object {
41312    #[doc = "The type of tool call. This is always going to be `file_search` for this type of tool call."]
41313    #[derive(Clone, Copy, Debug, Default, PartialEq)]
41314    pub(crate) struct Type;
41315    impl_serde!(Type, "file_search");
41316}
41317#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
41318pub struct RunStepDeltaStepDetailsToolCallsFileSearchObject {
41319    #[doc = "The index of the tool call in the tool calls array."]
41320    pub index: i64,
41321    #[doc = "The ID of the tool call object."]
41322    #[builder(default)]
41323    pub id: Option<String>,
41324    #[doc = "For now, this is always going to be an empty object."]
41325    pub file_search: indexmap::IndexMap<String, serde_json::Value>,
41326}
41327impl<'de> serde::Deserialize<'de> for RunStepDeltaStepDetailsToolCallsFileSearchObject {
41328    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
41329    where
41330        D: serde::Deserializer<'de>,
41331    {
41332        #[serde_with::serde_as]
41333        #[derive(serde :: Deserialize)]
41334        struct RunStepDeltaStepDetailsToolCallsFileSearchObject {
41335            #[serde(rename = "index")]
41336            index: i64,
41337            #[serde(rename = "id")]
41338            id: Option<String>,
41339            #[serde(rename = "type")]
41340            #[allow(dead_code)]
41341            r#type: crate::__types::run_step_delta_step_details_tool_calls_file_search_object::Type,
41342            #[serde(rename = "file_search")]
41343            file_search: indexmap::IndexMap<String, serde_json::Value>,
41344        }
41345        let RunStepDeltaStepDetailsToolCallsFileSearchObject {
41346            index,
41347            id,
41348            file_search,
41349            ..
41350        } = RunStepDeltaStepDetailsToolCallsFileSearchObject::deserialize(deserializer)?;
41351        Ok(Self {
41352            index,
41353            id,
41354            file_search,
41355        })
41356    }
41357}
41358impl serde::Serialize for RunStepDeltaStepDetailsToolCallsFileSearchObject {
41359    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
41360    where
41361        S: serde::Serializer,
41362    {
41363        #[serde_with::serde_as]
41364        #[derive(serde :: Serialize)]
41365        struct RunStepDeltaStepDetailsToolCallsFileSearchObject<'a> {
41366            #[serde(rename = "index")]
41367            index: &'a i64,
41368            #[serde(rename = "id")]
41369            #[serde(skip_serializing_if = "Option::is_none")]
41370            id: &'a Option<String>,
41371            #[serde(rename = "type")]
41372            r#type:
41373                &'a crate::__types::run_step_delta_step_details_tool_calls_file_search_object::Type,
41374            #[serde(rename = "file_search")]
41375            file_search: &'a indexmap::IndexMap<String, serde_json::Value>,
41376        }
41377        let Self {
41378            index,
41379            id,
41380            file_search,
41381        } = self;
41382        RunStepDeltaStepDetailsToolCallsFileSearchObject {
41383            index,
41384            id,
41385            r#type: &Default::default(),
41386            file_search,
41387        }
41388        .serialize(serializer)
41389    }
41390}
41391#[allow(clippy::module_inception)]
41392pub mod run_step_delta_step_details_tool_calls_function_object {
41393    #[doc = "The type of tool call. This is always going to be `function` for this type of tool call."]
41394    #[derive(Clone, Copy, Debug, Default, PartialEq)]
41395    pub(crate) struct Type;
41396    impl_serde!(Type, "function");
41397    #[doc = "The definition of the function that was called."]
41398    #[derive(Clone, Debug, Default, PartialEq)]
41399    #[serde_with::serde_as]
41400    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
41401    pub struct Function {
41402        #[doc = "The name of the function."]
41403        #[serde(rename = "name")]
41404        #[serde(skip_serializing_if = "Option::is_none")]
41405        #[builder(default)]
41406        pub name: Option<String>,
41407        #[doc = "The arguments passed to the function."]
41408        #[serde(rename = "arguments")]
41409        #[serde(skip_serializing_if = "Option::is_none")]
41410        #[builder(default)]
41411        pub arguments: Option<String>,
41412        #[doc = "The output of the function. This will be `null` if the outputs have not been [submitted](https://platform.openai.com/docs/api-reference/runs/submitToolOutputs) yet."]
41413        #[serde(rename = "output")]
41414        #[serde(skip_serializing_if = "Option::is_none")]
41415        #[builder(default)]
41416        pub output: Option<String>,
41417    }
41418}
41419#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
41420pub struct RunStepDeltaStepDetailsToolCallsFunctionObject {
41421    #[doc = "The index of the tool call in the tool calls array."]
41422    pub index: i64,
41423    #[doc = "The ID of the tool call object."]
41424    #[builder(default)]
41425    pub id: Option<String>,
41426    #[doc = "The definition of the function that was called."]
41427    #[builder(default)]
41428    pub function:
41429        Option<crate::__types::run_step_delta_step_details_tool_calls_function_object::Function>,
41430}
41431impl<'de> serde::Deserialize<'de> for RunStepDeltaStepDetailsToolCallsFunctionObject {
41432    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
41433    where
41434        D: serde::Deserializer<'de>,
41435    {
41436        #[serde_with::serde_as]
41437        #[derive(serde :: Deserialize)]
41438        struct RunStepDeltaStepDetailsToolCallsFunctionObject {
41439            #[serde(rename = "index")]
41440            index: i64,
41441            #[serde(rename = "id")]
41442            id: Option<String>,
41443            #[serde(rename = "type")]
41444            #[allow(dead_code)]
41445            r#type: crate::__types::run_step_delta_step_details_tool_calls_function_object::Type,
41446            #[serde(rename = "function")]
41447            function: Option<
41448                crate::__types::run_step_delta_step_details_tool_calls_function_object::Function,
41449            >,
41450        }
41451        let RunStepDeltaStepDetailsToolCallsFunctionObject {
41452            index,
41453            id,
41454            function,
41455            ..
41456        } = RunStepDeltaStepDetailsToolCallsFunctionObject::deserialize(deserializer)?;
41457        Ok(Self {
41458            index,
41459            id,
41460            function,
41461        })
41462    }
41463}
41464impl serde::Serialize for RunStepDeltaStepDetailsToolCallsFunctionObject {
41465    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
41466    where
41467        S: serde::Serializer,
41468    {
41469        #[serde_with::serde_as]
41470        #[derive(serde :: Serialize)]
41471        struct RunStepDeltaStepDetailsToolCallsFunctionObject<'a> {
41472            #[serde(rename = "index")]
41473            index: &'a i64,
41474            #[serde(rename = "id")]
41475            #[serde(skip_serializing_if = "Option::is_none")]
41476            id: &'a Option<String>,
41477            #[serde(rename = "type")]
41478            r#type:
41479                &'a crate::__types::run_step_delta_step_details_tool_calls_function_object::Type,
41480            #[serde(rename = "function")]
41481            #[serde(skip_serializing_if = "Option::is_none")]
41482            function: &'a Option<
41483                crate::__types::run_step_delta_step_details_tool_calls_function_object::Function,
41484            >,
41485        }
41486        let Self {
41487            index,
41488            id,
41489            function,
41490        } = self;
41491        RunStepDeltaStepDetailsToolCallsFunctionObject {
41492            index,
41493            id,
41494            r#type: &Default::default(),
41495            function,
41496        }
41497        .serialize(serializer)
41498    }
41499}
41500#[allow(clippy::module_inception)]
41501pub(crate) mod run_step_delta_step_details_tool_calls_object {
41502    #[doc = "Always `tool_calls`."]
41503    #[derive(Clone, Copy, Debug, Default, PartialEq)]
41504    pub(crate) struct Type;
41505    impl_serde!(Type, "tool_calls");
41506}
41507#[doc = "Details of the tool call."]
41508#[derive(Clone, Debug, Default, PartialEq, typed_builder :: TypedBuilder)]
41509pub struct RunStepDeltaStepDetailsToolCallsObject {
41510    #[doc = "An array of tool calls the run step was involved in. These can be associated with one of three types of tools: `code_interpreter`, `file_search`, or `function`.\n"]
41511    #[builder(default)]
41512    pub tool_calls: Option<Vec<crate::__types::RunStepDeltaStepDetailsToolCall>>,
41513}
41514impl<'de> serde::Deserialize<'de> for RunStepDeltaStepDetailsToolCallsObject {
41515    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
41516    where
41517        D: serde::Deserializer<'de>,
41518    {
41519        #[serde_with::serde_as]
41520        #[derive(serde :: Deserialize)]
41521        struct RunStepDeltaStepDetailsToolCallsObject {
41522            #[serde(rename = "type")]
41523            #[allow(dead_code)]
41524            r#type: crate::__types::run_step_delta_step_details_tool_calls_object::Type,
41525            #[serde(rename = "tool_calls")]
41526            tool_calls: Option<Vec<crate::__types::RunStepDeltaStepDetailsToolCall>>,
41527        }
41528        let RunStepDeltaStepDetailsToolCallsObject { tool_calls, .. } =
41529            RunStepDeltaStepDetailsToolCallsObject::deserialize(deserializer)?;
41530        Ok(Self { tool_calls })
41531    }
41532}
41533impl serde::Serialize for RunStepDeltaStepDetailsToolCallsObject {
41534    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
41535    where
41536        S: serde::Serializer,
41537    {
41538        #[serde_with::serde_as]
41539        #[derive(serde :: Serialize)]
41540        struct RunStepDeltaStepDetailsToolCallsObject<'a> {
41541            #[serde(rename = "type")]
41542            r#type: &'a crate::__types::run_step_delta_step_details_tool_calls_object::Type,
41543            #[serde(rename = "tool_calls")]
41544            #[serde(skip_serializing_if = "Option::is_none")]
41545            tool_calls: &'a Option<Vec<crate::__types::RunStepDeltaStepDetailsToolCall>>,
41546        }
41547        let Self { tool_calls } = self;
41548        RunStepDeltaStepDetailsToolCallsObject {
41549            r#type: &Default::default(),
41550            tool_calls,
41551        }
41552        .serialize(serializer)
41553    }
41554}
41555#[allow(clippy::module_inception)]
41556pub mod run_step_details_message_creation_object {
41557    #[doc = "Always `message_creation`."]
41558    #[derive(Clone, Copy, Debug, Default, PartialEq)]
41559    pub(crate) struct Type;
41560    impl_serde!(Type, "message_creation");
41561    #[derive(Clone, Debug, PartialEq)]
41562    #[serde_with::serde_as]
41563    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
41564    pub struct MessageCreation {
41565        #[doc = "The ID of the message that was created by this run step."]
41566        #[serde(rename = "message_id")]
41567        pub message_id: String,
41568    }
41569}
41570#[doc = "Details of the message creation by the run step."]
41571#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
41572pub struct RunStepDetailsMessageCreationObject {
41573    pub message_creation: crate::__types::run_step_details_message_creation_object::MessageCreation,
41574}
41575impl<'de> serde::Deserialize<'de> for RunStepDetailsMessageCreationObject {
41576    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
41577    where
41578        D: serde::Deserializer<'de>,
41579    {
41580        #[serde_with::serde_as]
41581        #[derive(serde :: Deserialize)]
41582        struct RunStepDetailsMessageCreationObject {
41583            #[serde(rename = "type")]
41584            #[allow(dead_code)]
41585            r#type: crate::__types::run_step_details_message_creation_object::Type,
41586            #[serde(rename = "message_creation")]
41587            message_creation:
41588                crate::__types::run_step_details_message_creation_object::MessageCreation,
41589        }
41590        let RunStepDetailsMessageCreationObject {
41591            message_creation, ..
41592        } = RunStepDetailsMessageCreationObject::deserialize(deserializer)?;
41593        Ok(Self { message_creation })
41594    }
41595}
41596impl serde::Serialize for RunStepDetailsMessageCreationObject {
41597    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
41598    where
41599        S: serde::Serializer,
41600    {
41601        #[serde_with::serde_as]
41602        #[derive(serde :: Serialize)]
41603        struct RunStepDetailsMessageCreationObject<'a> {
41604            #[serde(rename = "type")]
41605            r#type: &'a crate::__types::run_step_details_message_creation_object::Type,
41606            #[serde(rename = "message_creation")]
41607            message_creation:
41608                &'a crate::__types::run_step_details_message_creation_object::MessageCreation,
41609        }
41610        let Self { message_creation } = self;
41611        RunStepDetailsMessageCreationObject {
41612            r#type: &Default::default(),
41613            message_creation,
41614        }
41615        .serialize(serializer)
41616    }
41617}
41618#[allow(clippy::module_inception)]
41619pub mod run_step_details_tool_calls_code_object {
41620    #[doc = "The type of tool call. This is always going to be `code_interpreter` for this type of tool call."]
41621    #[derive(Clone, Copy, Debug, Default, PartialEq)]
41622    pub(crate) struct Type;
41623    impl_serde!(Type, "code_interpreter");
41624    #[allow(clippy::module_inception)]
41625    pub mod code_interpreter {
41626        #[allow(clippy::module_inception)]
41627        pub mod outputs {
41628            #[derive(Clone, Debug, PartialEq)]
41629            #[serde_with::serde_as]
41630            #[derive(serde :: Deserialize, serde :: Serialize)]
41631            #[serde(untagged)]
41632            #[allow(clippy::large_enum_variant)]
41633            pub enum Item {
41634                Logs(crate::__types::RunStepDetailsToolCallsCodeOutputLogsObject),
41635                Image(crate::__types::RunStepDetailsToolCallsCodeOutputImageObject),
41636            }
41637        }
41638    }
41639    #[doc = "The Code Interpreter tool call definition."]
41640    #[derive(Clone, Debug, PartialEq)]
41641    #[serde_with::serde_as]
41642    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
41643    pub struct CodeInterpreter { # [doc = "The input to the Code Interpreter tool call."] # [serde (rename = "input")] pub input : String , # [doc = "The outputs from the Code Interpreter tool call. Code Interpreter can output one or more items, including text (`logs`) or images (`image`). Each of these are represented by a different object type."] # [serde (rename = "outputs")] pub outputs : Vec < crate :: __types :: run_step_details_tool_calls_code_object :: code_interpreter :: outputs :: Item > }
41644}
41645#[doc = "Details of the Code Interpreter tool call the run step was involved in."]
41646#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
41647pub struct RunStepDetailsToolCallsCodeObject {
41648    #[doc = "The ID of the tool call."]
41649    pub id: String,
41650    #[doc = "The Code Interpreter tool call definition."]
41651    pub code_interpreter: crate::__types::run_step_details_tool_calls_code_object::CodeInterpreter,
41652}
41653impl<'de> serde::Deserialize<'de> for RunStepDetailsToolCallsCodeObject {
41654    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
41655    where
41656        D: serde::Deserializer<'de>,
41657    {
41658        #[serde_with::serde_as]
41659        #[derive(serde :: Deserialize)]
41660        struct RunStepDetailsToolCallsCodeObject {
41661            #[serde(rename = "id")]
41662            id: String,
41663            #[serde(rename = "type")]
41664            #[allow(dead_code)]
41665            r#type: crate::__types::run_step_details_tool_calls_code_object::Type,
41666            #[serde(rename = "code_interpreter")]
41667            code_interpreter:
41668                crate::__types::run_step_details_tool_calls_code_object::CodeInterpreter,
41669        }
41670        let RunStepDetailsToolCallsCodeObject {
41671            id,
41672            code_interpreter,
41673            ..
41674        } = RunStepDetailsToolCallsCodeObject::deserialize(deserializer)?;
41675        Ok(Self {
41676            id,
41677            code_interpreter,
41678        })
41679    }
41680}
41681impl serde::Serialize for RunStepDetailsToolCallsCodeObject {
41682    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
41683    where
41684        S: serde::Serializer,
41685    {
41686        #[serde_with::serde_as]
41687        #[derive(serde :: Serialize)]
41688        struct RunStepDetailsToolCallsCodeObject<'a> {
41689            #[serde(rename = "id")]
41690            id: &'a String,
41691            #[serde(rename = "type")]
41692            r#type: &'a crate::__types::run_step_details_tool_calls_code_object::Type,
41693            #[serde(rename = "code_interpreter")]
41694            code_interpreter:
41695                &'a crate::__types::run_step_details_tool_calls_code_object::CodeInterpreter,
41696        }
41697        let Self {
41698            id,
41699            code_interpreter,
41700        } = self;
41701        RunStepDetailsToolCallsCodeObject {
41702            id,
41703            r#type: &Default::default(),
41704            code_interpreter,
41705        }
41706        .serialize(serializer)
41707    }
41708}
41709#[allow(clippy::module_inception)]
41710pub mod run_step_details_tool_calls_code_output_image_object {
41711    #[doc = "Always `image`."]
41712    #[derive(Clone, Copy, Debug, Default, PartialEq)]
41713    pub(crate) struct Type;
41714    impl_serde!(Type, "image");
41715    #[derive(Clone, Debug, PartialEq)]
41716    #[serde_with::serde_as]
41717    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
41718    pub struct Image {
41719        #[doc = "The [file](https://platform.openai.com/docs/api-reference/files) ID of the image."]
41720        #[serde(rename = "file_id")]
41721        pub file_id: String,
41722    }
41723}
41724#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
41725pub struct RunStepDetailsToolCallsCodeOutputImageObject {
41726    pub image: crate::__types::run_step_details_tool_calls_code_output_image_object::Image,
41727}
41728impl<'de> serde::Deserialize<'de> for RunStepDetailsToolCallsCodeOutputImageObject {
41729    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
41730    where
41731        D: serde::Deserializer<'de>,
41732    {
41733        #[serde_with::serde_as]
41734        #[derive(serde :: Deserialize)]
41735        struct RunStepDetailsToolCallsCodeOutputImageObject {
41736            #[serde(rename = "type")]
41737            #[allow(dead_code)]
41738            r#type: crate::__types::run_step_details_tool_calls_code_output_image_object::Type,
41739            #[serde(rename = "image")]
41740            image: crate::__types::run_step_details_tool_calls_code_output_image_object::Image,
41741        }
41742        let RunStepDetailsToolCallsCodeOutputImageObject { image, .. } =
41743            RunStepDetailsToolCallsCodeOutputImageObject::deserialize(deserializer)?;
41744        Ok(Self { image })
41745    }
41746}
41747impl serde::Serialize for RunStepDetailsToolCallsCodeOutputImageObject {
41748    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
41749    where
41750        S: serde::Serializer,
41751    {
41752        #[serde_with::serde_as]
41753        #[derive(serde :: Serialize)]
41754        struct RunStepDetailsToolCallsCodeOutputImageObject<'a> {
41755            #[serde(rename = "type")]
41756            r#type: &'a crate::__types::run_step_details_tool_calls_code_output_image_object::Type,
41757            #[serde(rename = "image")]
41758            image: &'a crate::__types::run_step_details_tool_calls_code_output_image_object::Image,
41759        }
41760        let Self { image } = self;
41761        RunStepDetailsToolCallsCodeOutputImageObject {
41762            r#type: &Default::default(),
41763            image,
41764        }
41765        .serialize(serializer)
41766    }
41767}
41768#[allow(clippy::module_inception)]
41769pub(crate) mod run_step_details_tool_calls_code_output_logs_object {
41770    #[doc = "Always `logs`."]
41771    #[derive(Clone, Copy, Debug, Default, PartialEq)]
41772    pub(crate) struct Type;
41773    impl_serde!(Type, "logs");
41774}
41775#[doc = "Text output from the Code Interpreter tool call as part of a run step."]
41776#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
41777pub struct RunStepDetailsToolCallsCodeOutputLogsObject {
41778    #[doc = "The text output from the Code Interpreter tool call."]
41779    pub logs: String,
41780}
41781impl<'de> serde::Deserialize<'de> for RunStepDetailsToolCallsCodeOutputLogsObject {
41782    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
41783    where
41784        D: serde::Deserializer<'de>,
41785    {
41786        #[serde_with::serde_as]
41787        #[derive(serde :: Deserialize)]
41788        struct RunStepDetailsToolCallsCodeOutputLogsObject {
41789            #[serde(rename = "type")]
41790            #[allow(dead_code)]
41791            r#type: crate::__types::run_step_details_tool_calls_code_output_logs_object::Type,
41792            #[serde(rename = "logs")]
41793            logs: String,
41794        }
41795        let RunStepDetailsToolCallsCodeOutputLogsObject { logs, .. } =
41796            RunStepDetailsToolCallsCodeOutputLogsObject::deserialize(deserializer)?;
41797        Ok(Self { logs })
41798    }
41799}
41800impl serde::Serialize for RunStepDetailsToolCallsCodeOutputLogsObject {
41801    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
41802    where
41803        S: serde::Serializer,
41804    {
41805        #[serde_with::serde_as]
41806        #[derive(serde :: Serialize)]
41807        struct RunStepDetailsToolCallsCodeOutputLogsObject<'a> {
41808            #[serde(rename = "type")]
41809            r#type: &'a crate::__types::run_step_details_tool_calls_code_output_logs_object::Type,
41810            #[serde(rename = "logs")]
41811            logs: &'a String,
41812        }
41813        let Self { logs } = self;
41814        RunStepDetailsToolCallsCodeOutputLogsObject {
41815            r#type: &Default::default(),
41816            logs,
41817        }
41818        .serialize(serializer)
41819    }
41820}
41821#[allow(clippy::module_inception)]
41822pub mod run_step_details_tool_calls_file_search_object {
41823    #[doc = "The type of tool call. This is always going to be `file_search` for this type of tool call."]
41824    #[derive(Clone, Copy, Debug, Default, PartialEq)]
41825    pub(crate) struct Type;
41826    impl_serde!(Type, "file_search");
41827    #[doc = "For now, this is always going to be an empty object."]
41828    #[derive(Clone, Debug, Default, PartialEq)]
41829    #[serde_with::serde_as]
41830    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
41831    pub struct FileSearch {
41832        #[serde(rename = "ranking_options")]
41833        #[serde(skip_serializing_if = "Option::is_none")]
41834        #[builder(default)]
41835        pub ranking_options:
41836            Option<crate::__types::RunStepDetailsToolCallsFileSearchRankingOptionsObject>,
41837        #[doc = "The results of the file search."]
41838        #[serde(rename = "results")]
41839        #[serde(skip_serializing_if = "Option::is_none")]
41840        #[builder(default)]
41841        pub results: Option<Vec<crate::__types::RunStepDetailsToolCallsFileSearchResultObject>>,
41842    }
41843}
41844#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
41845pub struct RunStepDetailsToolCallsFileSearchObject {
41846    #[doc = "The ID of the tool call object."]
41847    pub id: String,
41848    #[doc = "For now, this is always going to be an empty object."]
41849    #[builder(default)]
41850    pub file_search: crate::__types::run_step_details_tool_calls_file_search_object::FileSearch,
41851}
41852impl<'de> serde::Deserialize<'de> for RunStepDetailsToolCallsFileSearchObject {
41853    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
41854    where
41855        D: serde::Deserializer<'de>,
41856    {
41857        #[serde_with::serde_as]
41858        #[derive(serde :: Deserialize)]
41859        struct RunStepDetailsToolCallsFileSearchObject {
41860            #[serde(rename = "id")]
41861            id: String,
41862            #[serde(rename = "type")]
41863            #[allow(dead_code)]
41864            r#type: crate::__types::run_step_details_tool_calls_file_search_object::Type,
41865            #[serde(rename = "file_search")]
41866            file_search: crate::__types::run_step_details_tool_calls_file_search_object::FileSearch,
41867        }
41868        let RunStepDetailsToolCallsFileSearchObject {
41869            id, file_search, ..
41870        } = RunStepDetailsToolCallsFileSearchObject::deserialize(deserializer)?;
41871        Ok(Self { id, file_search })
41872    }
41873}
41874impl serde::Serialize for RunStepDetailsToolCallsFileSearchObject {
41875    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
41876    where
41877        S: serde::Serializer,
41878    {
41879        #[serde_with::serde_as]
41880        #[derive(serde :: Serialize)]
41881        struct RunStepDetailsToolCallsFileSearchObject<'a> {
41882            #[serde(rename = "id")]
41883            id: &'a String,
41884            #[serde(rename = "type")]
41885            r#type: &'a crate::__types::run_step_details_tool_calls_file_search_object::Type,
41886            #[serde(rename = "file_search")]
41887            file_search:
41888                &'a crate::__types::run_step_details_tool_calls_file_search_object::FileSearch,
41889        }
41890        let Self { id, file_search } = self;
41891        RunStepDetailsToolCallsFileSearchObject {
41892            id,
41893            r#type: &Default::default(),
41894            file_search,
41895        }
41896        .serialize(serializer)
41897    }
41898}
41899#[doc = "The ranking options for the file search."]
41900#[derive(Clone, Debug, PartialEq)]
41901#[serde_with::serde_as]
41902#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
41903pub struct RunStepDetailsToolCallsFileSearchRankingOptionsObject {
41904    #[serde(rename = "ranker")]
41905    pub ranker: crate::__types::FileSearchRanker,
41906    #[doc = "The score threshold for the file search. All values must be a floating point number between 0 and 1."]
41907    #[serde(rename = "score_threshold")]
41908    pub score_threshold: serde_json::Number,
41909}
41910#[allow(clippy::module_inception)]
41911pub mod run_step_details_tool_calls_file_search_result_object {
41912    #[allow(clippy::module_inception)]
41913    pub mod content {
41914        #[allow(clippy::module_inception)]
41915        pub mod item {
41916            #[doc = "The type of the content."]
41917            #[derive(Clone, Copy, Debug, Default, PartialEq)]
41918            pub struct Type;
41919            impl_serde!(Type, "text");
41920        }
41921        #[derive(Clone, Debug, Default, PartialEq)]
41922        #[serde_with::serde_as]
41923        #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
41924        pub struct Item { # [doc = "The type of the content."] # [serde (rename = "type")] # [serde (skip_serializing_if = "Option::is_none")] # [builder (default)] pub r#type : Option < crate :: __types :: run_step_details_tool_calls_file_search_result_object :: content :: item :: Type > , # [doc = "The text content of the file."] # [serde (rename = "text")] # [serde (skip_serializing_if = "Option::is_none")] # [builder (default)] pub text : Option < String > }
41925    }
41926}
41927#[doc = "A result instance of the file search."]
41928#[derive(Clone, Debug, PartialEq)]
41929#[serde_with::serde_as]
41930#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
41931pub struct RunStepDetailsToolCallsFileSearchResultObject {
41932    #[doc = "The ID of the file that result was found in."]
41933    #[serde(rename = "file_id")]
41934    pub file_id: String,
41935    #[doc = "The name of the file that result was found in."]
41936    #[serde(rename = "file_name")]
41937    pub file_name: String,
41938    #[doc = "The score of the result. All values must be a floating point number between 0 and 1."]
41939    #[serde(rename = "score")]
41940    pub score: serde_json::Number,
41941    #[doc = "The content of the result that was found. The content is only included if requested via the include query parameter."]
41942    #[serde(rename = "content")]
41943    #[serde(skip_serializing_if = "Option::is_none")]
41944    #[builder(default)]
41945    pub content: Option<
41946        Vec<crate::__types::run_step_details_tool_calls_file_search_result_object::content::Item>,
41947    >,
41948}
41949#[allow(clippy::module_inception)]
41950pub mod run_step_details_tool_calls_function_object {
41951    #[doc = "The type of tool call. This is always going to be `function` for this type of tool call."]
41952    #[derive(Clone, Copy, Debug, Default, PartialEq)]
41953    pub(crate) struct Type;
41954    impl_serde!(Type, "function");
41955    #[doc = "The definition of the function that was called."]
41956    #[derive(Clone, Debug, PartialEq)]
41957    #[serde_with::serde_as]
41958    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
41959    pub struct Function {
41960        #[doc = "The name of the function."]
41961        #[serde(rename = "name")]
41962        pub name: String,
41963        #[doc = "The arguments passed to the function."]
41964        #[serde(rename = "arguments")]
41965        pub arguments: String,
41966        #[doc = "The output of the function. This will be `null` if the outputs have not been [submitted](https://platform.openai.com/docs/api-reference/runs/submitToolOutputs) yet."]
41967        #[serde(rename = "output")]
41968        #[serde(skip_serializing_if = "Option::is_none")]
41969        #[builder(default)]
41970        pub output: Option<String>,
41971    }
41972}
41973#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
41974pub struct RunStepDetailsToolCallsFunctionObject {
41975    #[doc = "The ID of the tool call object."]
41976    pub id: String,
41977    #[doc = "The definition of the function that was called."]
41978    pub function: crate::__types::run_step_details_tool_calls_function_object::Function,
41979}
41980impl<'de> serde::Deserialize<'de> for RunStepDetailsToolCallsFunctionObject {
41981    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
41982    where
41983        D: serde::Deserializer<'de>,
41984    {
41985        #[serde_with::serde_as]
41986        #[derive(serde :: Deserialize)]
41987        struct RunStepDetailsToolCallsFunctionObject {
41988            #[serde(rename = "id")]
41989            id: String,
41990            #[serde(rename = "type")]
41991            #[allow(dead_code)]
41992            r#type: crate::__types::run_step_details_tool_calls_function_object::Type,
41993            #[serde(rename = "function")]
41994            function: crate::__types::run_step_details_tool_calls_function_object::Function,
41995        }
41996        let RunStepDetailsToolCallsFunctionObject { id, function, .. } =
41997            RunStepDetailsToolCallsFunctionObject::deserialize(deserializer)?;
41998        Ok(Self { id, function })
41999    }
42000}
42001impl serde::Serialize for RunStepDetailsToolCallsFunctionObject {
42002    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
42003    where
42004        S: serde::Serializer,
42005    {
42006        #[serde_with::serde_as]
42007        #[derive(serde :: Serialize)]
42008        struct RunStepDetailsToolCallsFunctionObject<'a> {
42009            #[serde(rename = "id")]
42010            id: &'a String,
42011            #[serde(rename = "type")]
42012            r#type: &'a crate::__types::run_step_details_tool_calls_function_object::Type,
42013            #[serde(rename = "function")]
42014            function: &'a crate::__types::run_step_details_tool_calls_function_object::Function,
42015        }
42016        let Self { id, function } = self;
42017        RunStepDetailsToolCallsFunctionObject {
42018            id,
42019            r#type: &Default::default(),
42020            function,
42021        }
42022        .serialize(serializer)
42023    }
42024}
42025#[allow(clippy::module_inception)]
42026pub(crate) mod run_step_details_tool_calls_object {
42027    #[doc = "Always `tool_calls`."]
42028    #[derive(Clone, Copy, Debug, Default, PartialEq)]
42029    pub(crate) struct Type;
42030    impl_serde!(Type, "tool_calls");
42031}
42032#[doc = "Details of the tool call."]
42033#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
42034pub struct RunStepDetailsToolCallsObject {
42035    #[doc = "An array of tool calls the run step was involved in. These can be associated with one of three types of tools: `code_interpreter`, `file_search`, or `function`.\n"]
42036    pub tool_calls: Vec<crate::__types::RunStepDetailsToolCall>,
42037}
42038impl<'de> serde::Deserialize<'de> for RunStepDetailsToolCallsObject {
42039    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
42040    where
42041        D: serde::Deserializer<'de>,
42042    {
42043        #[serde_with::serde_as]
42044        #[derive(serde :: Deserialize)]
42045        struct RunStepDetailsToolCallsObject {
42046            #[serde(rename = "type")]
42047            #[allow(dead_code)]
42048            r#type: crate::__types::run_step_details_tool_calls_object::Type,
42049            #[serde(rename = "tool_calls")]
42050            tool_calls: Vec<crate::__types::RunStepDetailsToolCall>,
42051        }
42052        let RunStepDetailsToolCallsObject { tool_calls, .. } =
42053            RunStepDetailsToolCallsObject::deserialize(deserializer)?;
42054        Ok(Self { tool_calls })
42055    }
42056}
42057impl serde::Serialize for RunStepDetailsToolCallsObject {
42058    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
42059    where
42060        S: serde::Serializer,
42061    {
42062        #[serde_with::serde_as]
42063        #[derive(serde :: Serialize)]
42064        struct RunStepDetailsToolCallsObject<'a> {
42065            #[serde(rename = "type")]
42066            r#type: &'a crate::__types::run_step_details_tool_calls_object::Type,
42067            #[serde(rename = "tool_calls")]
42068            tool_calls: &'a Vec<crate::__types::RunStepDetailsToolCall>,
42069        }
42070        let Self { tool_calls } = self;
42071        RunStepDetailsToolCallsObject {
42072            r#type: &Default::default(),
42073            tool_calls,
42074        }
42075        .serialize(serializer)
42076    }
42077}
42078#[allow(clippy::module_inception)]
42079pub mod run_step_object {
42080    #[doc = "The object type, which is always `thread.run.step`."]
42081    #[derive(Clone, Copy, Debug, Default, PartialEq)]
42082    pub(crate) struct Object;
42083    impl_serde!(Object, "thread.run.step");
42084    #[doc = "The type of run step, which can be either `message_creation` or `tool_calls`."]
42085    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
42086    pub enum Type {
42087        #[doc = "`message_creation`"]
42088        #[serde(rename = "message_creation")]
42089        MessageCreation,
42090        #[doc = "`tool_calls`"]
42091        #[serde(rename = "tool_calls")]
42092        ToolCalls,
42093    }
42094    #[doc = "The status of the run step, which can be either `in_progress`, `cancelled`, `failed`, `completed`, or `expired`."]
42095    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
42096    pub enum Status {
42097        #[doc = "`in_progress`"]
42098        #[serde(rename = "in_progress")]
42099        InProgress,
42100        #[doc = "`cancelled`"]
42101        #[serde(rename = "cancelled")]
42102        Cancelled,
42103        #[doc = "`failed`"]
42104        #[serde(rename = "failed")]
42105        Failed,
42106        #[doc = "`completed`"]
42107        #[serde(rename = "completed")]
42108        Completed,
42109        #[doc = "`expired`"]
42110        #[serde(rename = "expired")]
42111        Expired,
42112    }
42113    #[doc = "The details of the run step."]
42114    #[derive(Clone, Debug, PartialEq)]
42115    #[serde_with::serde_as]
42116    #[derive(serde :: Deserialize, serde :: Serialize)]
42117    #[serde(untagged)]
42118    #[allow(clippy::large_enum_variant)]
42119    pub enum StepDetails {
42120        MessageCreation(crate::__types::RunStepDetailsMessageCreationObject),
42121        ToolCalls(crate::__types::RunStepDetailsToolCallsObject),
42122    }
42123    #[allow(clippy::module_inception)]
42124    pub mod last_error {
42125        #[doc = "One of `server_error` or `rate_limit_exceeded`."]
42126        #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
42127        pub enum Code {
42128            #[doc = "`server_error`"]
42129            #[serde(rename = "server_error")]
42130            ServerError,
42131            #[doc = "`rate_limit_exceeded`"]
42132            #[serde(rename = "rate_limit_exceeded")]
42133            RateLimitExceeded,
42134        }
42135    }
42136    #[doc = "The last error associated with this run step. Will be `null` if there are no errors."]
42137    #[derive(Clone, Debug, PartialEq)]
42138    #[serde_with::serde_as]
42139    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
42140    pub struct LastError {
42141        #[doc = "One of `server_error` or `rate_limit_exceeded`."]
42142        #[serde(rename = "code")]
42143        pub code: crate::__types::run_step_object::last_error::Code,
42144        #[doc = "A human-readable description of the error."]
42145        #[serde(rename = "message")]
42146        pub message: String,
42147    }
42148}
42149#[doc = "Represents a step in execution of a run.\n"]
42150#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
42151pub struct RunStepObject {
42152    #[doc = "The identifier of the run step, which can be referenced in API endpoints."]
42153    pub id: String,
42154    #[doc = "The Unix timestamp (in seconds) for when the run step was created."]
42155    pub created_at: i64,
42156    #[doc = "The ID of the [assistant](https://platform.openai.com/docs/api-reference/assistants) associated with the run step."]
42157    pub assistant_id: String,
42158    #[doc = "The ID of the [thread](https://platform.openai.com/docs/api-reference/threads) that was run."]
42159    pub thread_id: String,
42160    #[doc = "The ID of the [run](https://platform.openai.com/docs/api-reference/runs) that this run step is a part of."]
42161    pub run_id: String,
42162    #[doc = "The type of run step, which can be either `message_creation` or `tool_calls`."]
42163    pub r#type: crate::__types::run_step_object::Type,
42164    #[doc = "The status of the run step, which can be either `in_progress`, `cancelled`, `failed`, `completed`, or `expired`."]
42165    pub status: crate::__types::run_step_object::Status,
42166    #[doc = "The details of the run step."]
42167    pub step_details: crate::__types::run_step_object::StepDetails,
42168    #[doc = "The last error associated with this run step. Will be `null` if there are no errors."]
42169    #[builder(default)]
42170    pub last_error: Option<crate::__types::run_step_object::LastError>,
42171    #[doc = "The Unix timestamp (in seconds) for when the run step expired. A step is considered expired if the parent run is expired."]
42172    #[builder(default)]
42173    pub expired_at: Option<i64>,
42174    #[doc = "The Unix timestamp (in seconds) for when the run step was cancelled."]
42175    #[builder(default)]
42176    pub cancelled_at: Option<i64>,
42177    #[doc = "The Unix timestamp (in seconds) for when the run step failed."]
42178    #[builder(default)]
42179    pub failed_at: Option<i64>,
42180    #[doc = "The Unix timestamp (in seconds) for when the run step completed."]
42181    #[builder(default)]
42182    pub completed_at: Option<i64>,
42183    #[builder(default)]
42184    pub metadata: Option<crate::__types::Metadata>,
42185    #[builder(default)]
42186    pub usage: Option<crate::__types::RunStepCompletionUsage>,
42187}
42188impl<'de> serde::Deserialize<'de> for RunStepObject {
42189    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
42190    where
42191        D: serde::Deserializer<'de>,
42192    {
42193        #[serde_with::serde_as]
42194        #[derive(serde :: Deserialize)]
42195        struct RunStepObject {
42196            #[serde(rename = "id")]
42197            id: String,
42198            #[serde(rename = "object")]
42199            #[allow(dead_code)]
42200            object: crate::__types::run_step_object::Object,
42201            #[serde(rename = "created_at")]
42202            created_at: i64,
42203            #[serde(rename = "assistant_id")]
42204            assistant_id: String,
42205            #[serde(rename = "thread_id")]
42206            thread_id: String,
42207            #[serde(rename = "run_id")]
42208            run_id: String,
42209            #[serde(rename = "type")]
42210            r#type: crate::__types::run_step_object::Type,
42211            #[serde(rename = "status")]
42212            status: crate::__types::run_step_object::Status,
42213            #[serde(rename = "step_details")]
42214            step_details: crate::__types::run_step_object::StepDetails,
42215            #[serde(rename = "last_error")]
42216            last_error: Option<crate::__types::run_step_object::LastError>,
42217            #[serde(rename = "expired_at")]
42218            expired_at: Option<i64>,
42219            #[serde(rename = "cancelled_at")]
42220            cancelled_at: Option<i64>,
42221            #[serde(rename = "failed_at")]
42222            failed_at: Option<i64>,
42223            #[serde(rename = "completed_at")]
42224            completed_at: Option<i64>,
42225            #[serde(rename = "metadata")]
42226            metadata: Option<crate::__types::Metadata>,
42227            #[serde(rename = "usage")]
42228            usage: Option<crate::__types::RunStepCompletionUsage>,
42229        }
42230        let RunStepObject {
42231            id,
42232            created_at,
42233            assistant_id,
42234            thread_id,
42235            run_id,
42236            r#type,
42237            status,
42238            step_details,
42239            last_error,
42240            expired_at,
42241            cancelled_at,
42242            failed_at,
42243            completed_at,
42244            metadata,
42245            usage,
42246            ..
42247        } = RunStepObject::deserialize(deserializer)?;
42248        Ok(Self {
42249            id,
42250            created_at,
42251            assistant_id,
42252            thread_id,
42253            run_id,
42254            r#type,
42255            status,
42256            step_details,
42257            last_error,
42258            expired_at,
42259            cancelled_at,
42260            failed_at,
42261            completed_at,
42262            metadata,
42263            usage,
42264        })
42265    }
42266}
42267impl serde::Serialize for RunStepObject {
42268    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
42269    where
42270        S: serde::Serializer,
42271    {
42272        #[serde_with::serde_as]
42273        #[derive(serde :: Serialize)]
42274        struct RunStepObject<'a> {
42275            #[serde(rename = "id")]
42276            id: &'a String,
42277            #[serde(rename = "object")]
42278            object: &'a crate::__types::run_step_object::Object,
42279            #[serde(rename = "created_at")]
42280            created_at: &'a i64,
42281            #[serde(rename = "assistant_id")]
42282            assistant_id: &'a String,
42283            #[serde(rename = "thread_id")]
42284            thread_id: &'a String,
42285            #[serde(rename = "run_id")]
42286            run_id: &'a String,
42287            #[serde(rename = "type")]
42288            r#type: &'a crate::__types::run_step_object::Type,
42289            #[serde(rename = "status")]
42290            status: &'a crate::__types::run_step_object::Status,
42291            #[serde(rename = "step_details")]
42292            step_details: &'a crate::__types::run_step_object::StepDetails,
42293            #[serde(rename = "last_error")]
42294            #[serde(skip_serializing_if = "Option::is_none")]
42295            last_error: &'a Option<crate::__types::run_step_object::LastError>,
42296            #[serde(rename = "expired_at")]
42297            #[serde(skip_serializing_if = "Option::is_none")]
42298            expired_at: &'a Option<i64>,
42299            #[serde(rename = "cancelled_at")]
42300            #[serde(skip_serializing_if = "Option::is_none")]
42301            cancelled_at: &'a Option<i64>,
42302            #[serde(rename = "failed_at")]
42303            #[serde(skip_serializing_if = "Option::is_none")]
42304            failed_at: &'a Option<i64>,
42305            #[serde(rename = "completed_at")]
42306            #[serde(skip_serializing_if = "Option::is_none")]
42307            completed_at: &'a Option<i64>,
42308            #[serde(rename = "metadata")]
42309            #[serde(skip_serializing_if = "Option::is_none")]
42310            metadata: &'a Option<crate::__types::Metadata>,
42311            #[serde(rename = "usage")]
42312            #[serde(skip_serializing_if = "Option::is_none")]
42313            usage: &'a Option<crate::__types::RunStepCompletionUsage>,
42314        }
42315        let Self {
42316            id,
42317            created_at,
42318            assistant_id,
42319            thread_id,
42320            run_id,
42321            r#type,
42322            status,
42323            step_details,
42324            last_error,
42325            expired_at,
42326            cancelled_at,
42327            failed_at,
42328            completed_at,
42329            metadata,
42330            usage,
42331        } = self;
42332        RunStepObject {
42333            id,
42334            object: &Default::default(),
42335            created_at,
42336            assistant_id,
42337            thread_id,
42338            run_id,
42339            r#type,
42340            status,
42341            step_details,
42342            last_error,
42343            expired_at,
42344            cancelled_at,
42345            failed_at,
42346            completed_at,
42347            metadata,
42348            usage,
42349        }
42350        .serialize(serializer)
42351    }
42352}
42353#[allow(clippy::module_inception)]
42354pub mod run_step_stream_event {
42355    #[allow(clippy::module_inception)]
42356    pub(crate) mod thread_run_step_created {
42357        #[doc = "thread.run.step.created"]
42358        #[derive(Clone, Copy, Debug, Default, PartialEq)]
42359        pub(crate) struct Event;
42360        impl_serde!(Event, "thread.run.step.created");
42361    }
42362    #[doc = "Occurs when a [run step](https://platform.openai.com/docs/api-reference/run-steps/step-object) is created."]
42363    #[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
42364    pub struct ThreadRunStepCreated {
42365        pub data: crate::__types::RunStepObject,
42366    }
42367    impl<'de> serde::Deserialize<'de> for ThreadRunStepCreated {
42368        fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
42369        where
42370            D: serde::Deserializer<'de>,
42371        {
42372            #[serde_with::serde_as]
42373            #[derive(serde :: Deserialize)]
42374            struct ThreadRunStepCreated {
42375                #[serde(rename = "event")]
42376                #[allow(dead_code)]
42377                event: crate::__types::run_step_stream_event::thread_run_step_created::Event,
42378                #[serde(rename = "data")]
42379                data: crate::__types::RunStepObject,
42380            }
42381            let ThreadRunStepCreated { data, .. } =
42382                ThreadRunStepCreated::deserialize(deserializer)?;
42383            Ok(Self { data })
42384        }
42385    }
42386    impl serde::Serialize for ThreadRunStepCreated {
42387        fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
42388        where
42389            S: serde::Serializer,
42390        {
42391            #[serde_with::serde_as]
42392            #[derive(serde :: Serialize)]
42393            struct ThreadRunStepCreated<'a> {
42394                #[serde(rename = "event")]
42395                event: &'a crate::__types::run_step_stream_event::thread_run_step_created::Event,
42396                #[serde(rename = "data")]
42397                data: &'a crate::__types::RunStepObject,
42398            }
42399            let Self { data } = self;
42400            ThreadRunStepCreated {
42401                event: &Default::default(),
42402                data,
42403            }
42404            .serialize(serializer)
42405        }
42406    }
42407    #[allow(clippy::module_inception)]
42408    pub(crate) mod thread_run_step_in_progress {
42409        #[doc = "thread.run.step.in_progress"]
42410        #[derive(Clone, Copy, Debug, Default, PartialEq)]
42411        pub(crate) struct Event;
42412        impl_serde!(Event, "thread.run.step.in_progress");
42413    }
42414    #[doc = "Occurs when a [run step](https://platform.openai.com/docs/api-reference/run-steps/step-object) moves to an `in_progress` state."]
42415    #[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
42416    pub struct ThreadRunStepInProgress {
42417        pub data: crate::__types::RunStepObject,
42418    }
42419    impl<'de> serde::Deserialize<'de> for ThreadRunStepInProgress {
42420        fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
42421        where
42422            D: serde::Deserializer<'de>,
42423        {
42424            #[serde_with::serde_as]
42425            #[derive(serde :: Deserialize)]
42426            struct ThreadRunStepInProgress {
42427                #[serde(rename = "event")]
42428                #[allow(dead_code)]
42429                event: crate::__types::run_step_stream_event::thread_run_step_in_progress::Event,
42430                #[serde(rename = "data")]
42431                data: crate::__types::RunStepObject,
42432            }
42433            let ThreadRunStepInProgress { data, .. } =
42434                ThreadRunStepInProgress::deserialize(deserializer)?;
42435            Ok(Self { data })
42436        }
42437    }
42438    impl serde::Serialize for ThreadRunStepInProgress {
42439        fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
42440        where
42441            S: serde::Serializer,
42442        {
42443            #[serde_with::serde_as]
42444            #[derive(serde :: Serialize)]
42445            struct ThreadRunStepInProgress<'a> {
42446                #[serde(rename = "event")]
42447                event:
42448                    &'a crate::__types::run_step_stream_event::thread_run_step_in_progress::Event,
42449                #[serde(rename = "data")]
42450                data: &'a crate::__types::RunStepObject,
42451            }
42452            let Self { data } = self;
42453            ThreadRunStepInProgress {
42454                event: &Default::default(),
42455                data,
42456            }
42457            .serialize(serializer)
42458        }
42459    }
42460    #[allow(clippy::module_inception)]
42461    pub(crate) mod thread_run_step_delta {
42462        #[doc = "thread.run.step.delta"]
42463        #[derive(Clone, Copy, Debug, Default, PartialEq)]
42464        pub(crate) struct Event;
42465        impl_serde!(Event, "thread.run.step.delta");
42466    }
42467    #[doc = "Occurs when parts of a [run step](https://platform.openai.com/docs/api-reference/run-steps/step-object) are being streamed."]
42468    #[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
42469    pub struct ThreadRunStepDelta {
42470        pub data: crate::__types::RunStepDeltaObject,
42471    }
42472    impl<'de> serde::Deserialize<'de> for ThreadRunStepDelta {
42473        fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
42474        where
42475            D: serde::Deserializer<'de>,
42476        {
42477            #[serde_with::serde_as]
42478            #[derive(serde :: Deserialize)]
42479            struct ThreadRunStepDelta {
42480                #[serde(rename = "event")]
42481                #[allow(dead_code)]
42482                event: crate::__types::run_step_stream_event::thread_run_step_delta::Event,
42483                #[serde(rename = "data")]
42484                data: crate::__types::RunStepDeltaObject,
42485            }
42486            let ThreadRunStepDelta { data, .. } = ThreadRunStepDelta::deserialize(deserializer)?;
42487            Ok(Self { data })
42488        }
42489    }
42490    impl serde::Serialize for ThreadRunStepDelta {
42491        fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
42492        where
42493            S: serde::Serializer,
42494        {
42495            #[serde_with::serde_as]
42496            #[derive(serde :: Serialize)]
42497            struct ThreadRunStepDelta<'a> {
42498                #[serde(rename = "event")]
42499                event: &'a crate::__types::run_step_stream_event::thread_run_step_delta::Event,
42500                #[serde(rename = "data")]
42501                data: &'a crate::__types::RunStepDeltaObject,
42502            }
42503            let Self { data } = self;
42504            ThreadRunStepDelta {
42505                event: &Default::default(),
42506                data,
42507            }
42508            .serialize(serializer)
42509        }
42510    }
42511    #[allow(clippy::module_inception)]
42512    pub(crate) mod thread_run_step_completed {
42513        #[doc = "thread.run.step.completed"]
42514        #[derive(Clone, Copy, Debug, Default, PartialEq)]
42515        pub(crate) struct Event;
42516        impl_serde!(Event, "thread.run.step.completed");
42517    }
42518    #[doc = "Occurs when a [run step](https://platform.openai.com/docs/api-reference/run-steps/step-object) is completed."]
42519    #[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
42520    pub struct ThreadRunStepCompleted {
42521        pub data: crate::__types::RunStepObject,
42522    }
42523    impl<'de> serde::Deserialize<'de> for ThreadRunStepCompleted {
42524        fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
42525        where
42526            D: serde::Deserializer<'de>,
42527        {
42528            #[serde_with::serde_as]
42529            #[derive(serde :: Deserialize)]
42530            struct ThreadRunStepCompleted {
42531                #[serde(rename = "event")]
42532                #[allow(dead_code)]
42533                event: crate::__types::run_step_stream_event::thread_run_step_completed::Event,
42534                #[serde(rename = "data")]
42535                data: crate::__types::RunStepObject,
42536            }
42537            let ThreadRunStepCompleted { data, .. } =
42538                ThreadRunStepCompleted::deserialize(deserializer)?;
42539            Ok(Self { data })
42540        }
42541    }
42542    impl serde::Serialize for ThreadRunStepCompleted {
42543        fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
42544        where
42545            S: serde::Serializer,
42546        {
42547            #[serde_with::serde_as]
42548            #[derive(serde :: Serialize)]
42549            struct ThreadRunStepCompleted<'a> {
42550                #[serde(rename = "event")]
42551                event: &'a crate::__types::run_step_stream_event::thread_run_step_completed::Event,
42552                #[serde(rename = "data")]
42553                data: &'a crate::__types::RunStepObject,
42554            }
42555            let Self { data } = self;
42556            ThreadRunStepCompleted {
42557                event: &Default::default(),
42558                data,
42559            }
42560            .serialize(serializer)
42561        }
42562    }
42563    #[allow(clippy::module_inception)]
42564    pub(crate) mod thread_run_step_failed {
42565        #[doc = "thread.run.step.failed"]
42566        #[derive(Clone, Copy, Debug, Default, PartialEq)]
42567        pub(crate) struct Event;
42568        impl_serde!(Event, "thread.run.step.failed");
42569    }
42570    #[doc = "Occurs when a [run step](https://platform.openai.com/docs/api-reference/run-steps/step-object) fails."]
42571    #[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
42572    pub struct ThreadRunStepFailed {
42573        pub data: crate::__types::RunStepObject,
42574    }
42575    impl<'de> serde::Deserialize<'de> for ThreadRunStepFailed {
42576        fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
42577        where
42578            D: serde::Deserializer<'de>,
42579        {
42580            #[serde_with::serde_as]
42581            #[derive(serde :: Deserialize)]
42582            struct ThreadRunStepFailed {
42583                #[serde(rename = "event")]
42584                #[allow(dead_code)]
42585                event: crate::__types::run_step_stream_event::thread_run_step_failed::Event,
42586                #[serde(rename = "data")]
42587                data: crate::__types::RunStepObject,
42588            }
42589            let ThreadRunStepFailed { data, .. } = ThreadRunStepFailed::deserialize(deserializer)?;
42590            Ok(Self { data })
42591        }
42592    }
42593    impl serde::Serialize for ThreadRunStepFailed {
42594        fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
42595        where
42596            S: serde::Serializer,
42597        {
42598            #[serde_with::serde_as]
42599            #[derive(serde :: Serialize)]
42600            struct ThreadRunStepFailed<'a> {
42601                #[serde(rename = "event")]
42602                event: &'a crate::__types::run_step_stream_event::thread_run_step_failed::Event,
42603                #[serde(rename = "data")]
42604                data: &'a crate::__types::RunStepObject,
42605            }
42606            let Self { data } = self;
42607            ThreadRunStepFailed {
42608                event: &Default::default(),
42609                data,
42610            }
42611            .serialize(serializer)
42612        }
42613    }
42614    #[allow(clippy::module_inception)]
42615    pub(crate) mod thread_run_step_cancelled {
42616        #[doc = "thread.run.step.cancelled"]
42617        #[derive(Clone, Copy, Debug, Default, PartialEq)]
42618        pub(crate) struct Event;
42619        impl_serde!(Event, "thread.run.step.cancelled");
42620    }
42621    #[doc = "Occurs when a [run step](https://platform.openai.com/docs/api-reference/run-steps/step-object) is cancelled."]
42622    #[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
42623    pub struct ThreadRunStepCancelled {
42624        pub data: crate::__types::RunStepObject,
42625    }
42626    impl<'de> serde::Deserialize<'de> for ThreadRunStepCancelled {
42627        fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
42628        where
42629            D: serde::Deserializer<'de>,
42630        {
42631            #[serde_with::serde_as]
42632            #[derive(serde :: Deserialize)]
42633            struct ThreadRunStepCancelled {
42634                #[serde(rename = "event")]
42635                #[allow(dead_code)]
42636                event: crate::__types::run_step_stream_event::thread_run_step_cancelled::Event,
42637                #[serde(rename = "data")]
42638                data: crate::__types::RunStepObject,
42639            }
42640            let ThreadRunStepCancelled { data, .. } =
42641                ThreadRunStepCancelled::deserialize(deserializer)?;
42642            Ok(Self { data })
42643        }
42644    }
42645    impl serde::Serialize for ThreadRunStepCancelled {
42646        fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
42647        where
42648            S: serde::Serializer,
42649        {
42650            #[serde_with::serde_as]
42651            #[derive(serde :: Serialize)]
42652            struct ThreadRunStepCancelled<'a> {
42653                #[serde(rename = "event")]
42654                event: &'a crate::__types::run_step_stream_event::thread_run_step_cancelled::Event,
42655                #[serde(rename = "data")]
42656                data: &'a crate::__types::RunStepObject,
42657            }
42658            let Self { data } = self;
42659            ThreadRunStepCancelled {
42660                event: &Default::default(),
42661                data,
42662            }
42663            .serialize(serializer)
42664        }
42665    }
42666    #[allow(clippy::module_inception)]
42667    pub(crate) mod thread_run_step_expired {
42668        #[doc = "thread.run.step.expired"]
42669        #[derive(Clone, Copy, Debug, Default, PartialEq)]
42670        pub(crate) struct Event;
42671        impl_serde!(Event, "thread.run.step.expired");
42672    }
42673    #[doc = "Occurs when a [run step](https://platform.openai.com/docs/api-reference/run-steps/step-object) expires."]
42674    #[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
42675    pub struct ThreadRunStepExpired {
42676        pub data: crate::__types::RunStepObject,
42677    }
42678    impl<'de> serde::Deserialize<'de> for ThreadRunStepExpired {
42679        fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
42680        where
42681            D: serde::Deserializer<'de>,
42682        {
42683            #[serde_with::serde_as]
42684            #[derive(serde :: Deserialize)]
42685            struct ThreadRunStepExpired {
42686                #[serde(rename = "event")]
42687                #[allow(dead_code)]
42688                event: crate::__types::run_step_stream_event::thread_run_step_expired::Event,
42689                #[serde(rename = "data")]
42690                data: crate::__types::RunStepObject,
42691            }
42692            let ThreadRunStepExpired { data, .. } =
42693                ThreadRunStepExpired::deserialize(deserializer)?;
42694            Ok(Self { data })
42695        }
42696    }
42697    impl serde::Serialize for ThreadRunStepExpired {
42698        fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
42699        where
42700            S: serde::Serializer,
42701        {
42702            #[serde_with::serde_as]
42703            #[derive(serde :: Serialize)]
42704            struct ThreadRunStepExpired<'a> {
42705                #[serde(rename = "event")]
42706                event: &'a crate::__types::run_step_stream_event::thread_run_step_expired::Event,
42707                #[serde(rename = "data")]
42708                data: &'a crate::__types::RunStepObject,
42709            }
42710            let Self { data } = self;
42711            ThreadRunStepExpired {
42712                event: &Default::default(),
42713                data,
42714            }
42715            .serialize(serializer)
42716        }
42717    }
42718}
42719#[derive(Clone, Debug, PartialEq)]
42720#[serde_with::serde_as]
42721#[derive(serde :: Deserialize, serde :: Serialize)]
42722#[serde(untagged)]
42723#[allow(clippy::large_enum_variant)]
42724pub enum RunStepStreamEvent {
42725    #[doc = "Occurs when a [run step](https://platform.openai.com/docs/api-reference/run-steps/step-object) is created."]
42726    ThreadRunStepCreated(crate::__types::run_step_stream_event::ThreadRunStepCreated),
42727    #[doc = "Occurs when a [run step](https://platform.openai.com/docs/api-reference/run-steps/step-object) moves to an `in_progress` state."]
42728    ThreadRunStepInProgress(crate::__types::run_step_stream_event::ThreadRunStepInProgress),
42729    #[doc = "Occurs when parts of a [run step](https://platform.openai.com/docs/api-reference/run-steps/step-object) are being streamed."]
42730    ThreadRunStepDelta(crate::__types::run_step_stream_event::ThreadRunStepDelta),
42731    #[doc = "Occurs when a [run step](https://platform.openai.com/docs/api-reference/run-steps/step-object) is completed."]
42732    ThreadRunStepCompleted(crate::__types::run_step_stream_event::ThreadRunStepCompleted),
42733    #[doc = "Occurs when a [run step](https://platform.openai.com/docs/api-reference/run-steps/step-object) fails."]
42734    ThreadRunStepFailed(crate::__types::run_step_stream_event::ThreadRunStepFailed),
42735    #[doc = "Occurs when a [run step](https://platform.openai.com/docs/api-reference/run-steps/step-object) is cancelled."]
42736    ThreadRunStepCancelled(crate::__types::run_step_stream_event::ThreadRunStepCancelled),
42737    #[doc = "Occurs when a [run step](https://platform.openai.com/docs/api-reference/run-steps/step-object) expires."]
42738    ThreadRunStepExpired(crate::__types::run_step_stream_event::ThreadRunStepExpired),
42739}
42740#[allow(clippy::module_inception)]
42741pub mod run_stream_event {
42742    #[allow(clippy::module_inception)]
42743    pub(crate) mod thread_run_created {
42744        #[doc = "thread.run.created"]
42745        #[derive(Clone, Copy, Debug, Default, PartialEq)]
42746        pub(crate) struct Event;
42747        impl_serde!(Event, "thread.run.created");
42748    }
42749    #[doc = "Occurs when a new [run](https://platform.openai.com/docs/api-reference/runs/object) is created."]
42750    #[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
42751    pub struct ThreadRunCreated {
42752        pub data: crate::__types::RunObject,
42753    }
42754    impl<'de> serde::Deserialize<'de> for ThreadRunCreated {
42755        fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
42756        where
42757            D: serde::Deserializer<'de>,
42758        {
42759            #[serde_with::serde_as]
42760            #[derive(serde :: Deserialize)]
42761            struct ThreadRunCreated {
42762                #[serde(rename = "event")]
42763                #[allow(dead_code)]
42764                event: crate::__types::run_stream_event::thread_run_created::Event,
42765                #[serde(rename = "data")]
42766                data: crate::__types::RunObject,
42767            }
42768            let ThreadRunCreated { data, .. } = ThreadRunCreated::deserialize(deserializer)?;
42769            Ok(Self { data })
42770        }
42771    }
42772    impl serde::Serialize for ThreadRunCreated {
42773        fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
42774        where
42775            S: serde::Serializer,
42776        {
42777            #[serde_with::serde_as]
42778            #[derive(serde :: Serialize)]
42779            struct ThreadRunCreated<'a> {
42780                #[serde(rename = "event")]
42781                event: &'a crate::__types::run_stream_event::thread_run_created::Event,
42782                #[serde(rename = "data")]
42783                data: &'a crate::__types::RunObject,
42784            }
42785            let Self { data } = self;
42786            ThreadRunCreated {
42787                event: &Default::default(),
42788                data,
42789            }
42790            .serialize(serializer)
42791        }
42792    }
42793    #[allow(clippy::module_inception)]
42794    pub(crate) mod thread_run_queued {
42795        #[doc = "thread.run.queued"]
42796        #[derive(Clone, Copy, Debug, Default, PartialEq)]
42797        pub(crate) struct Event;
42798        impl_serde!(Event, "thread.run.queued");
42799    }
42800    #[doc = "Occurs when a [run](https://platform.openai.com/docs/api-reference/runs/object) moves to a `queued` status."]
42801    #[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
42802    pub struct ThreadRunQueued {
42803        pub data: crate::__types::RunObject,
42804    }
42805    impl<'de> serde::Deserialize<'de> for ThreadRunQueued {
42806        fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
42807        where
42808            D: serde::Deserializer<'de>,
42809        {
42810            #[serde_with::serde_as]
42811            #[derive(serde :: Deserialize)]
42812            struct ThreadRunQueued {
42813                #[serde(rename = "event")]
42814                #[allow(dead_code)]
42815                event: crate::__types::run_stream_event::thread_run_queued::Event,
42816                #[serde(rename = "data")]
42817                data: crate::__types::RunObject,
42818            }
42819            let ThreadRunQueued { data, .. } = ThreadRunQueued::deserialize(deserializer)?;
42820            Ok(Self { data })
42821        }
42822    }
42823    impl serde::Serialize for ThreadRunQueued {
42824        fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
42825        where
42826            S: serde::Serializer,
42827        {
42828            #[serde_with::serde_as]
42829            #[derive(serde :: Serialize)]
42830            struct ThreadRunQueued<'a> {
42831                #[serde(rename = "event")]
42832                event: &'a crate::__types::run_stream_event::thread_run_queued::Event,
42833                #[serde(rename = "data")]
42834                data: &'a crate::__types::RunObject,
42835            }
42836            let Self { data } = self;
42837            ThreadRunQueued {
42838                event: &Default::default(),
42839                data,
42840            }
42841            .serialize(serializer)
42842        }
42843    }
42844    #[allow(clippy::module_inception)]
42845    pub(crate) mod thread_run_in_progress {
42846        #[doc = "thread.run.in_progress"]
42847        #[derive(Clone, Copy, Debug, Default, PartialEq)]
42848        pub(crate) struct Event;
42849        impl_serde!(Event, "thread.run.in_progress");
42850    }
42851    #[doc = "Occurs when a [run](https://platform.openai.com/docs/api-reference/runs/object) moves to an `in_progress` status."]
42852    #[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
42853    pub struct ThreadRunInProgress {
42854        pub data: crate::__types::RunObject,
42855    }
42856    impl<'de> serde::Deserialize<'de> for ThreadRunInProgress {
42857        fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
42858        where
42859            D: serde::Deserializer<'de>,
42860        {
42861            #[serde_with::serde_as]
42862            #[derive(serde :: Deserialize)]
42863            struct ThreadRunInProgress {
42864                #[serde(rename = "event")]
42865                #[allow(dead_code)]
42866                event: crate::__types::run_stream_event::thread_run_in_progress::Event,
42867                #[serde(rename = "data")]
42868                data: crate::__types::RunObject,
42869            }
42870            let ThreadRunInProgress { data, .. } = ThreadRunInProgress::deserialize(deserializer)?;
42871            Ok(Self { data })
42872        }
42873    }
42874    impl serde::Serialize for ThreadRunInProgress {
42875        fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
42876        where
42877            S: serde::Serializer,
42878        {
42879            #[serde_with::serde_as]
42880            #[derive(serde :: Serialize)]
42881            struct ThreadRunInProgress<'a> {
42882                #[serde(rename = "event")]
42883                event: &'a crate::__types::run_stream_event::thread_run_in_progress::Event,
42884                #[serde(rename = "data")]
42885                data: &'a crate::__types::RunObject,
42886            }
42887            let Self { data } = self;
42888            ThreadRunInProgress {
42889                event: &Default::default(),
42890                data,
42891            }
42892            .serialize(serializer)
42893        }
42894    }
42895    #[allow(clippy::module_inception)]
42896    pub(crate) mod thread_run_requires_action {
42897        #[doc = "thread.run.requires_action"]
42898        #[derive(Clone, Copy, Debug, Default, PartialEq)]
42899        pub(crate) struct Event;
42900        impl_serde!(Event, "thread.run.requires_action");
42901    }
42902    #[doc = "Occurs when a [run](https://platform.openai.com/docs/api-reference/runs/object) moves to a `requires_action` status."]
42903    #[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
42904    pub struct ThreadRunRequiresAction {
42905        pub data: crate::__types::RunObject,
42906    }
42907    impl<'de> serde::Deserialize<'de> for ThreadRunRequiresAction {
42908        fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
42909        where
42910            D: serde::Deserializer<'de>,
42911        {
42912            #[serde_with::serde_as]
42913            #[derive(serde :: Deserialize)]
42914            struct ThreadRunRequiresAction {
42915                #[serde(rename = "event")]
42916                #[allow(dead_code)]
42917                event: crate::__types::run_stream_event::thread_run_requires_action::Event,
42918                #[serde(rename = "data")]
42919                data: crate::__types::RunObject,
42920            }
42921            let ThreadRunRequiresAction { data, .. } =
42922                ThreadRunRequiresAction::deserialize(deserializer)?;
42923            Ok(Self { data })
42924        }
42925    }
42926    impl serde::Serialize for ThreadRunRequiresAction {
42927        fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
42928        where
42929            S: serde::Serializer,
42930        {
42931            #[serde_with::serde_as]
42932            #[derive(serde :: Serialize)]
42933            struct ThreadRunRequiresAction<'a> {
42934                #[serde(rename = "event")]
42935                event: &'a crate::__types::run_stream_event::thread_run_requires_action::Event,
42936                #[serde(rename = "data")]
42937                data: &'a crate::__types::RunObject,
42938            }
42939            let Self { data } = self;
42940            ThreadRunRequiresAction {
42941                event: &Default::default(),
42942                data,
42943            }
42944            .serialize(serializer)
42945        }
42946    }
42947    #[allow(clippy::module_inception)]
42948    pub(crate) mod thread_run_completed {
42949        #[doc = "thread.run.completed"]
42950        #[derive(Clone, Copy, Debug, Default, PartialEq)]
42951        pub(crate) struct Event;
42952        impl_serde!(Event, "thread.run.completed");
42953    }
42954    #[doc = "Occurs when a [run](https://platform.openai.com/docs/api-reference/runs/object) is completed."]
42955    #[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
42956    pub struct ThreadRunCompleted {
42957        pub data: crate::__types::RunObject,
42958    }
42959    impl<'de> serde::Deserialize<'de> for ThreadRunCompleted {
42960        fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
42961        where
42962            D: serde::Deserializer<'de>,
42963        {
42964            #[serde_with::serde_as]
42965            #[derive(serde :: Deserialize)]
42966            struct ThreadRunCompleted {
42967                #[serde(rename = "event")]
42968                #[allow(dead_code)]
42969                event: crate::__types::run_stream_event::thread_run_completed::Event,
42970                #[serde(rename = "data")]
42971                data: crate::__types::RunObject,
42972            }
42973            let ThreadRunCompleted { data, .. } = ThreadRunCompleted::deserialize(deserializer)?;
42974            Ok(Self { data })
42975        }
42976    }
42977    impl serde::Serialize for ThreadRunCompleted {
42978        fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
42979        where
42980            S: serde::Serializer,
42981        {
42982            #[serde_with::serde_as]
42983            #[derive(serde :: Serialize)]
42984            struct ThreadRunCompleted<'a> {
42985                #[serde(rename = "event")]
42986                event: &'a crate::__types::run_stream_event::thread_run_completed::Event,
42987                #[serde(rename = "data")]
42988                data: &'a crate::__types::RunObject,
42989            }
42990            let Self { data } = self;
42991            ThreadRunCompleted {
42992                event: &Default::default(),
42993                data,
42994            }
42995            .serialize(serializer)
42996        }
42997    }
42998    #[allow(clippy::module_inception)]
42999    pub(crate) mod thread_run_incomplete {
43000        #[doc = "thread.run.incomplete"]
43001        #[derive(Clone, Copy, Debug, Default, PartialEq)]
43002        pub(crate) struct Event;
43003        impl_serde!(Event, "thread.run.incomplete");
43004    }
43005    #[doc = "Occurs when a [run](https://platform.openai.com/docs/api-reference/runs/object) ends with status `incomplete`."]
43006    #[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
43007    pub struct ThreadRunIncomplete {
43008        pub data: crate::__types::RunObject,
43009    }
43010    impl<'de> serde::Deserialize<'de> for ThreadRunIncomplete {
43011        fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
43012        where
43013            D: serde::Deserializer<'de>,
43014        {
43015            #[serde_with::serde_as]
43016            #[derive(serde :: Deserialize)]
43017            struct ThreadRunIncomplete {
43018                #[serde(rename = "event")]
43019                #[allow(dead_code)]
43020                event: crate::__types::run_stream_event::thread_run_incomplete::Event,
43021                #[serde(rename = "data")]
43022                data: crate::__types::RunObject,
43023            }
43024            let ThreadRunIncomplete { data, .. } = ThreadRunIncomplete::deserialize(deserializer)?;
43025            Ok(Self { data })
43026        }
43027    }
43028    impl serde::Serialize for ThreadRunIncomplete {
43029        fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
43030        where
43031            S: serde::Serializer,
43032        {
43033            #[serde_with::serde_as]
43034            #[derive(serde :: Serialize)]
43035            struct ThreadRunIncomplete<'a> {
43036                #[serde(rename = "event")]
43037                event: &'a crate::__types::run_stream_event::thread_run_incomplete::Event,
43038                #[serde(rename = "data")]
43039                data: &'a crate::__types::RunObject,
43040            }
43041            let Self { data } = self;
43042            ThreadRunIncomplete {
43043                event: &Default::default(),
43044                data,
43045            }
43046            .serialize(serializer)
43047        }
43048    }
43049    #[allow(clippy::module_inception)]
43050    pub(crate) mod thread_run_failed {
43051        #[doc = "thread.run.failed"]
43052        #[derive(Clone, Copy, Debug, Default, PartialEq)]
43053        pub(crate) struct Event;
43054        impl_serde!(Event, "thread.run.failed");
43055    }
43056    #[doc = "Occurs when a [run](https://platform.openai.com/docs/api-reference/runs/object) fails."]
43057    #[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
43058    pub struct ThreadRunFailed {
43059        pub data: crate::__types::RunObject,
43060    }
43061    impl<'de> serde::Deserialize<'de> for ThreadRunFailed {
43062        fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
43063        where
43064            D: serde::Deserializer<'de>,
43065        {
43066            #[serde_with::serde_as]
43067            #[derive(serde :: Deserialize)]
43068            struct ThreadRunFailed {
43069                #[serde(rename = "event")]
43070                #[allow(dead_code)]
43071                event: crate::__types::run_stream_event::thread_run_failed::Event,
43072                #[serde(rename = "data")]
43073                data: crate::__types::RunObject,
43074            }
43075            let ThreadRunFailed { data, .. } = ThreadRunFailed::deserialize(deserializer)?;
43076            Ok(Self { data })
43077        }
43078    }
43079    impl serde::Serialize for ThreadRunFailed {
43080        fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
43081        where
43082            S: serde::Serializer,
43083        {
43084            #[serde_with::serde_as]
43085            #[derive(serde :: Serialize)]
43086            struct ThreadRunFailed<'a> {
43087                #[serde(rename = "event")]
43088                event: &'a crate::__types::run_stream_event::thread_run_failed::Event,
43089                #[serde(rename = "data")]
43090                data: &'a crate::__types::RunObject,
43091            }
43092            let Self { data } = self;
43093            ThreadRunFailed {
43094                event: &Default::default(),
43095                data,
43096            }
43097            .serialize(serializer)
43098        }
43099    }
43100    #[allow(clippy::module_inception)]
43101    pub(crate) mod thread_run_cancelling {
43102        #[doc = "thread.run.cancelling"]
43103        #[derive(Clone, Copy, Debug, Default, PartialEq)]
43104        pub(crate) struct Event;
43105        impl_serde!(Event, "thread.run.cancelling");
43106    }
43107    #[doc = "Occurs when a [run](https://platform.openai.com/docs/api-reference/runs/object) moves to a `cancelling` status."]
43108    #[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
43109    pub struct ThreadRunCancelling {
43110        pub data: crate::__types::RunObject,
43111    }
43112    impl<'de> serde::Deserialize<'de> for ThreadRunCancelling {
43113        fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
43114        where
43115            D: serde::Deserializer<'de>,
43116        {
43117            #[serde_with::serde_as]
43118            #[derive(serde :: Deserialize)]
43119            struct ThreadRunCancelling {
43120                #[serde(rename = "event")]
43121                #[allow(dead_code)]
43122                event: crate::__types::run_stream_event::thread_run_cancelling::Event,
43123                #[serde(rename = "data")]
43124                data: crate::__types::RunObject,
43125            }
43126            let ThreadRunCancelling { data, .. } = ThreadRunCancelling::deserialize(deserializer)?;
43127            Ok(Self { data })
43128        }
43129    }
43130    impl serde::Serialize for ThreadRunCancelling {
43131        fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
43132        where
43133            S: serde::Serializer,
43134        {
43135            #[serde_with::serde_as]
43136            #[derive(serde :: Serialize)]
43137            struct ThreadRunCancelling<'a> {
43138                #[serde(rename = "event")]
43139                event: &'a crate::__types::run_stream_event::thread_run_cancelling::Event,
43140                #[serde(rename = "data")]
43141                data: &'a crate::__types::RunObject,
43142            }
43143            let Self { data } = self;
43144            ThreadRunCancelling {
43145                event: &Default::default(),
43146                data,
43147            }
43148            .serialize(serializer)
43149        }
43150    }
43151    #[allow(clippy::module_inception)]
43152    pub(crate) mod thread_run_cancelled {
43153        #[doc = "thread.run.cancelled"]
43154        #[derive(Clone, Copy, Debug, Default, PartialEq)]
43155        pub(crate) struct Event;
43156        impl_serde!(Event, "thread.run.cancelled");
43157    }
43158    #[doc = "Occurs when a [run](https://platform.openai.com/docs/api-reference/runs/object) is cancelled."]
43159    #[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
43160    pub struct ThreadRunCancelled {
43161        pub data: crate::__types::RunObject,
43162    }
43163    impl<'de> serde::Deserialize<'de> for ThreadRunCancelled {
43164        fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
43165        where
43166            D: serde::Deserializer<'de>,
43167        {
43168            #[serde_with::serde_as]
43169            #[derive(serde :: Deserialize)]
43170            struct ThreadRunCancelled {
43171                #[serde(rename = "event")]
43172                #[allow(dead_code)]
43173                event: crate::__types::run_stream_event::thread_run_cancelled::Event,
43174                #[serde(rename = "data")]
43175                data: crate::__types::RunObject,
43176            }
43177            let ThreadRunCancelled { data, .. } = ThreadRunCancelled::deserialize(deserializer)?;
43178            Ok(Self { data })
43179        }
43180    }
43181    impl serde::Serialize for ThreadRunCancelled {
43182        fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
43183        where
43184            S: serde::Serializer,
43185        {
43186            #[serde_with::serde_as]
43187            #[derive(serde :: Serialize)]
43188            struct ThreadRunCancelled<'a> {
43189                #[serde(rename = "event")]
43190                event: &'a crate::__types::run_stream_event::thread_run_cancelled::Event,
43191                #[serde(rename = "data")]
43192                data: &'a crate::__types::RunObject,
43193            }
43194            let Self { data } = self;
43195            ThreadRunCancelled {
43196                event: &Default::default(),
43197                data,
43198            }
43199            .serialize(serializer)
43200        }
43201    }
43202    #[allow(clippy::module_inception)]
43203    pub(crate) mod thread_run_expired {
43204        #[doc = "thread.run.expired"]
43205        #[derive(Clone, Copy, Debug, Default, PartialEq)]
43206        pub(crate) struct Event;
43207        impl_serde!(Event, "thread.run.expired");
43208    }
43209    #[doc = "Occurs when a [run](https://platform.openai.com/docs/api-reference/runs/object) expires."]
43210    #[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
43211    pub struct ThreadRunExpired {
43212        pub data: crate::__types::RunObject,
43213    }
43214    impl<'de> serde::Deserialize<'de> for ThreadRunExpired {
43215        fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
43216        where
43217            D: serde::Deserializer<'de>,
43218        {
43219            #[serde_with::serde_as]
43220            #[derive(serde :: Deserialize)]
43221            struct ThreadRunExpired {
43222                #[serde(rename = "event")]
43223                #[allow(dead_code)]
43224                event: crate::__types::run_stream_event::thread_run_expired::Event,
43225                #[serde(rename = "data")]
43226                data: crate::__types::RunObject,
43227            }
43228            let ThreadRunExpired { data, .. } = ThreadRunExpired::deserialize(deserializer)?;
43229            Ok(Self { data })
43230        }
43231    }
43232    impl serde::Serialize for ThreadRunExpired {
43233        fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
43234        where
43235            S: serde::Serializer,
43236        {
43237            #[serde_with::serde_as]
43238            #[derive(serde :: Serialize)]
43239            struct ThreadRunExpired<'a> {
43240                #[serde(rename = "event")]
43241                event: &'a crate::__types::run_stream_event::thread_run_expired::Event,
43242                #[serde(rename = "data")]
43243                data: &'a crate::__types::RunObject,
43244            }
43245            let Self { data } = self;
43246            ThreadRunExpired {
43247                event: &Default::default(),
43248                data,
43249            }
43250            .serialize(serializer)
43251        }
43252    }
43253}
43254#[derive(Clone, Debug, PartialEq)]
43255#[serde_with::serde_as]
43256#[derive(serde :: Deserialize, serde :: Serialize)]
43257#[serde(untagged)]
43258#[allow(clippy::large_enum_variant)]
43259pub enum RunStreamEvent {
43260    #[doc = "Occurs when a new [run](https://platform.openai.com/docs/api-reference/runs/object) is created."]
43261    ThreadRunCreated(crate::__types::run_stream_event::ThreadRunCreated),
43262    #[doc = "Occurs when a [run](https://platform.openai.com/docs/api-reference/runs/object) moves to a `queued` status."]
43263    ThreadRunQueued(crate::__types::run_stream_event::ThreadRunQueued),
43264    #[doc = "Occurs when a [run](https://platform.openai.com/docs/api-reference/runs/object) moves to an `in_progress` status."]
43265    ThreadRunInProgress(crate::__types::run_stream_event::ThreadRunInProgress),
43266    #[doc = "Occurs when a [run](https://platform.openai.com/docs/api-reference/runs/object) moves to a `requires_action` status."]
43267    ThreadRunRequiresAction(crate::__types::run_stream_event::ThreadRunRequiresAction),
43268    #[doc = "Occurs when a [run](https://platform.openai.com/docs/api-reference/runs/object) is completed."]
43269    ThreadRunCompleted(crate::__types::run_stream_event::ThreadRunCompleted),
43270    #[doc = "Occurs when a [run](https://platform.openai.com/docs/api-reference/runs/object) ends with status `incomplete`."]
43271    ThreadRunIncomplete(crate::__types::run_stream_event::ThreadRunIncomplete),
43272    #[doc = "Occurs when a [run](https://platform.openai.com/docs/api-reference/runs/object) fails."]
43273    ThreadRunFailed(crate::__types::run_stream_event::ThreadRunFailed),
43274    #[doc = "Occurs when a [run](https://platform.openai.com/docs/api-reference/runs/object) moves to a `cancelling` status."]
43275    ThreadRunCancelling(crate::__types::run_stream_event::ThreadRunCancelling),
43276    #[doc = "Occurs when a [run](https://platform.openai.com/docs/api-reference/runs/object) is cancelled."]
43277    ThreadRunCancelled(crate::__types::run_stream_event::ThreadRunCancelled),
43278    #[doc = "Occurs when a [run](https://platform.openai.com/docs/api-reference/runs/object) expires."]
43279    ThreadRunExpired(crate::__types::run_stream_event::ThreadRunExpired),
43280}
43281#[allow(clippy::module_inception)]
43282pub mod run_tool_call_object {
43283    #[doc = "The type of tool call the output is required for. For now, this is always `function`."]
43284    #[derive(Clone, Copy, Debug, Default, PartialEq)]
43285    pub(crate) struct Type;
43286    impl_serde!(Type, "function");
43287    #[doc = "The function definition."]
43288    #[derive(Clone, Debug, PartialEq)]
43289    #[serde_with::serde_as]
43290    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
43291    pub struct Function {
43292        #[doc = "The name of the function."]
43293        #[serde(rename = "name")]
43294        pub name: String,
43295        #[doc = "The arguments that the model expects you to pass to the function."]
43296        #[serde(rename = "arguments")]
43297        pub arguments: String,
43298    }
43299}
43300#[doc = "Tool call objects"]
43301#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
43302pub struct RunToolCallObject {
43303    #[doc = "The ID of the tool call. This ID must be referenced when you submit the tool outputs in using the [Submit tool outputs to run](https://platform.openai.com/docs/api-reference/runs/submitToolOutputs) endpoint."]
43304    pub id: String,
43305    #[doc = "The function definition."]
43306    pub function: crate::__types::run_tool_call_object::Function,
43307}
43308impl<'de> serde::Deserialize<'de> for RunToolCallObject {
43309    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
43310    where
43311        D: serde::Deserializer<'de>,
43312    {
43313        #[serde_with::serde_as]
43314        #[derive(serde :: Deserialize)]
43315        struct RunToolCallObject {
43316            #[serde(rename = "id")]
43317            id: String,
43318            #[serde(rename = "type")]
43319            #[allow(dead_code)]
43320            r#type: crate::__types::run_tool_call_object::Type,
43321            #[serde(rename = "function")]
43322            function: crate::__types::run_tool_call_object::Function,
43323        }
43324        let RunToolCallObject { id, function, .. } = RunToolCallObject::deserialize(deserializer)?;
43325        Ok(Self { id, function })
43326    }
43327}
43328impl serde::Serialize for RunToolCallObject {
43329    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
43330    where
43331        S: serde::Serializer,
43332    {
43333        #[serde_with::serde_as]
43334        #[derive(serde :: Serialize)]
43335        struct RunToolCallObject<'a> {
43336            #[serde(rename = "id")]
43337            id: &'a String,
43338            #[serde(rename = "type")]
43339            r#type: &'a crate::__types::run_tool_call_object::Type,
43340            #[serde(rename = "function")]
43341            function: &'a crate::__types::run_tool_call_object::Function,
43342        }
43343        let Self { id, function } = self;
43344        RunToolCallObject {
43345            id,
43346            r#type: &Default::default(),
43347            function,
43348        }
43349        .serialize(serializer)
43350    }
43351}
43352#[allow(clippy::module_inception)]
43353pub(crate) mod screenshot {
43354    #[doc = "Specifies the event type. For a screenshot action, this property is \nalways set to `screenshot`.\n"]
43355    #[derive(Clone, Copy, Debug, Default, PartialEq)]
43356    pub(crate) struct Type;
43357    impl_serde!(Type, "screenshot");
43358}
43359#[doc = "A screenshot action.\n"]
43360#[derive(Clone, Copy, Debug, Default, PartialEq, typed_builder :: TypedBuilder)]
43361pub struct Screenshot {}
43362impl<'de> serde::Deserialize<'de> for Screenshot {
43363    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
43364    where
43365        D: serde::Deserializer<'de>,
43366    {
43367        #[serde_with::serde_as]
43368        #[derive(serde :: Deserialize)]
43369        struct Screenshot {
43370            #[serde(rename = "type")]
43371            #[allow(dead_code)]
43372            r#type: crate::__types::screenshot::Type,
43373        }
43374        let Screenshot { .. } = Screenshot::deserialize(deserializer)?;
43375        Ok(Self {})
43376    }
43377}
43378impl serde::Serialize for Screenshot {
43379    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
43380    where
43381        S: serde::Serializer,
43382    {
43383        #[serde_with::serde_as]
43384        #[derive(serde :: Serialize)]
43385        struct Screenshot<'a> {
43386            #[serde(rename = "type")]
43387            r#type: &'a crate::__types::screenshot::Type,
43388        }
43389        let Self {} = self;
43390        Screenshot {
43391            r#type: &Default::default(),
43392        }
43393        .serialize(serializer)
43394    }
43395}
43396#[allow(clippy::module_inception)]
43397pub(crate) mod scroll {
43398    #[doc = "Specifies the event type. For a scroll action, this property is \nalways set to `scroll`.\n"]
43399    #[derive(Clone, Copy, Debug, Default, PartialEq)]
43400    pub(crate) struct Type;
43401    impl_serde!(Type, "scroll");
43402}
43403#[doc = "A scroll action.\n"]
43404#[derive(Clone, Copy, Debug, PartialEq, typed_builder :: TypedBuilder)]
43405pub struct Scroll {
43406    #[doc = "The x-coordinate where the scroll occurred.\n"]
43407    pub x: i64,
43408    #[doc = "The y-coordinate where the scroll occurred.\n"]
43409    pub y: i64,
43410    #[doc = "The horizontal scroll distance.\n"]
43411    pub scroll_x: i64,
43412    #[doc = "The vertical scroll distance.\n"]
43413    pub scroll_y: i64,
43414}
43415impl<'de> serde::Deserialize<'de> for Scroll {
43416    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
43417    where
43418        D: serde::Deserializer<'de>,
43419    {
43420        #[serde_with::serde_as]
43421        #[derive(serde :: Deserialize)]
43422        struct Scroll {
43423            #[serde(rename = "type")]
43424            #[allow(dead_code)]
43425            r#type: crate::__types::scroll::Type,
43426            #[serde(rename = "x")]
43427            x: i64,
43428            #[serde(rename = "y")]
43429            y: i64,
43430            #[serde(rename = "scroll_x")]
43431            scroll_x: i64,
43432            #[serde(rename = "scroll_y")]
43433            scroll_y: i64,
43434        }
43435        let Scroll {
43436            x,
43437            y,
43438            scroll_x,
43439            scroll_y,
43440            ..
43441        } = Scroll::deserialize(deserializer)?;
43442        Ok(Self {
43443            x,
43444            y,
43445            scroll_x,
43446            scroll_y,
43447        })
43448    }
43449}
43450impl serde::Serialize for Scroll {
43451    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
43452    where
43453        S: serde::Serializer,
43454    {
43455        #[serde_with::serde_as]
43456        #[derive(serde :: Serialize)]
43457        struct Scroll<'a> {
43458            #[serde(rename = "type")]
43459            r#type: &'a crate::__types::scroll::Type,
43460            #[serde(rename = "x")]
43461            x: &'a i64,
43462            #[serde(rename = "y")]
43463            y: &'a i64,
43464            #[serde(rename = "scroll_x")]
43465            scroll_x: &'a i64,
43466            #[serde(rename = "scroll_y")]
43467            scroll_y: &'a i64,
43468        }
43469        let Self {
43470            x,
43471            y,
43472            scroll_x,
43473            scroll_y,
43474        } = self;
43475        Scroll {
43476            r#type: &Default::default(),
43477            x,
43478            y,
43479            scroll_x,
43480            scroll_y,
43481        }
43482        .serialize(serializer)
43483    }
43484}
43485#[doc = "Specifies the processing type used for serving the request.\n  - 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'.\n  - If set to 'default', then the request will be processed with the standard pricing and performance for the selected model.\n  - If set to '[flex](https://platform.openai.com/docs/guides/flex-processing)' or '[priority](https://openai.com/api-priority-processing/)', then the request will be processed with the corresponding service tier.\n  - When not set, the default behavior is 'auto'.\n\n  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.\n"]
43486#[derive(Clone, Copy, Debug, Default, PartialEq, serde :: Deserialize, serde :: Serialize)]
43487pub enum ServiceTier {
43488    #[doc = "`auto`"]
43489    #[default]
43490    #[serde(rename = "auto")]
43491    Auto,
43492    #[doc = "`default`"]
43493    #[serde(rename = "default")]
43494    Default,
43495    #[doc = "`flex`"]
43496    #[serde(rename = "flex")]
43497    Flex,
43498    #[doc = "`scale`"]
43499    #[serde(rename = "scale")]
43500    Scale,
43501    #[doc = "`priority`"]
43502    #[serde(rename = "priority")]
43503    Priority,
43504}
43505#[allow(clippy::module_inception)]
43506pub(crate) mod speech_audio_delta_event {
43507    #[doc = "The type of the event. Always `speech.audio.delta`.\n"]
43508    #[derive(Clone, Copy, Debug, Default, PartialEq)]
43509    pub(crate) struct Type;
43510    impl_serde!(Type, "speech.audio.delta");
43511}
43512#[doc = "Emitted for each chunk of audio data generated during speech synthesis."]
43513#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
43514pub struct SpeechAudioDeltaEvent {
43515    #[doc = "A chunk of Base64-encoded audio data.\n"]
43516    pub audio: String,
43517}
43518impl<'de> serde::Deserialize<'de> for SpeechAudioDeltaEvent {
43519    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
43520    where
43521        D: serde::Deserializer<'de>,
43522    {
43523        #[serde_with::serde_as]
43524        #[derive(serde :: Deserialize)]
43525        struct SpeechAudioDeltaEvent {
43526            #[serde(rename = "type")]
43527            #[allow(dead_code)]
43528            r#type: crate::__types::speech_audio_delta_event::Type,
43529            #[serde(rename = "audio")]
43530            audio: String,
43531        }
43532        let SpeechAudioDeltaEvent { audio, .. } = SpeechAudioDeltaEvent::deserialize(deserializer)?;
43533        Ok(Self { audio })
43534    }
43535}
43536impl serde::Serialize for SpeechAudioDeltaEvent {
43537    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
43538    where
43539        S: serde::Serializer,
43540    {
43541        #[serde_with::serde_as]
43542        #[derive(serde :: Serialize)]
43543        struct SpeechAudioDeltaEvent<'a> {
43544            #[serde(rename = "type")]
43545            r#type: &'a crate::__types::speech_audio_delta_event::Type,
43546            #[serde(rename = "audio")]
43547            audio: &'a String,
43548        }
43549        let Self { audio } = self;
43550        SpeechAudioDeltaEvent {
43551            r#type: &Default::default(),
43552            audio,
43553        }
43554        .serialize(serializer)
43555    }
43556}
43557#[allow(clippy::module_inception)]
43558pub mod speech_audio_done_event {
43559    #[doc = "The type of the event. Always `speech.audio.done`.\n"]
43560    #[derive(Clone, Copy, Debug, Default, PartialEq)]
43561    pub(crate) struct Type;
43562    impl_serde!(Type, "speech.audio.done");
43563    #[doc = "Token usage statistics for the request.\n"]
43564    #[derive(Clone, Copy, Debug, PartialEq)]
43565    #[serde_with::serde_as]
43566    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
43567    pub struct Usage {
43568        #[doc = "Number of input tokens in the prompt."]
43569        #[serde(rename = "input_tokens")]
43570        pub input_tokens: i64,
43571        #[doc = "Number of output tokens generated."]
43572        #[serde(rename = "output_tokens")]
43573        pub output_tokens: i64,
43574        #[doc = "Total number of tokens used (input + output)."]
43575        #[serde(rename = "total_tokens")]
43576        pub total_tokens: i64,
43577    }
43578}
43579#[doc = "Emitted when the speech synthesis is complete and all audio has been streamed."]
43580#[derive(Clone, Copy, Debug, PartialEq, typed_builder :: TypedBuilder)]
43581pub struct SpeechAudioDoneEvent {
43582    #[doc = "Token usage statistics for the request.\n"]
43583    pub usage: crate::__types::speech_audio_done_event::Usage,
43584}
43585impl<'de> serde::Deserialize<'de> for SpeechAudioDoneEvent {
43586    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
43587    where
43588        D: serde::Deserializer<'de>,
43589    {
43590        #[serde_with::serde_as]
43591        #[derive(serde :: Deserialize)]
43592        struct SpeechAudioDoneEvent {
43593            #[serde(rename = "type")]
43594            #[allow(dead_code)]
43595            r#type: crate::__types::speech_audio_done_event::Type,
43596            #[serde(rename = "usage")]
43597            usage: crate::__types::speech_audio_done_event::Usage,
43598        }
43599        let SpeechAudioDoneEvent { usage, .. } = SpeechAudioDoneEvent::deserialize(deserializer)?;
43600        Ok(Self { usage })
43601    }
43602}
43603impl serde::Serialize for SpeechAudioDoneEvent {
43604    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
43605    where
43606        S: serde::Serializer,
43607    {
43608        #[serde_with::serde_as]
43609        #[derive(serde :: Serialize)]
43610        struct SpeechAudioDoneEvent<'a> {
43611            #[serde(rename = "type")]
43612            r#type: &'a crate::__types::speech_audio_done_event::Type,
43613            #[serde(rename = "usage")]
43614            usage: &'a crate::__types::speech_audio_done_event::Usage,
43615        }
43616        let Self { usage } = self;
43617        SpeechAudioDoneEvent {
43618            r#type: &Default::default(),
43619            usage,
43620        }
43621        .serialize(serializer)
43622    }
43623}
43624#[derive(Clone, Copy, Debug, PartialEq)]
43625#[serde_with::serde_as]
43626#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
43627pub struct StaticChunkingStrategy {
43628    #[doc = "The maximum number of tokens in each chunk. The default value is `800`. The minimum value is `100` and the maximum value is `4096`."]
43629    #[serde(rename = "max_chunk_size_tokens")]
43630    pub max_chunk_size_tokens: i64,
43631    #[doc = "The number of tokens that overlap between chunks. The default value is `400`.\n\nNote that the overlap must not exceed half of `max_chunk_size_tokens`.\n"]
43632    #[serde(rename = "chunk_overlap_tokens")]
43633    pub chunk_overlap_tokens: i64,
43634}
43635#[allow(clippy::module_inception)]
43636pub(crate) mod static_chunking_strategy_request_param {
43637    #[doc = "Always `static`."]
43638    #[derive(Clone, Copy, Debug, Default, PartialEq)]
43639    pub(crate) struct Type;
43640    impl_serde!(Type, "static");
43641}
43642#[doc = "Customize your own chunking strategy by setting chunk size and chunk overlap."]
43643#[derive(Clone, Copy, Debug, PartialEq, typed_builder :: TypedBuilder)]
43644pub struct StaticChunkingStrategyRequestParam {
43645    pub r#static: crate::__types::StaticChunkingStrategy,
43646}
43647impl<'de> serde::Deserialize<'de> for StaticChunkingStrategyRequestParam {
43648    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
43649    where
43650        D: serde::Deserializer<'de>,
43651    {
43652        #[serde_with::serde_as]
43653        #[derive(serde :: Deserialize)]
43654        struct StaticChunkingStrategyRequestParam {
43655            #[serde(rename = "type")]
43656            #[allow(dead_code)]
43657            r#type: crate::__types::static_chunking_strategy_request_param::Type,
43658            #[serde(rename = "static")]
43659            r#static: crate::__types::StaticChunkingStrategy,
43660        }
43661        let StaticChunkingStrategyRequestParam { r#static, .. } =
43662            StaticChunkingStrategyRequestParam::deserialize(deserializer)?;
43663        Ok(Self { r#static })
43664    }
43665}
43666impl serde::Serialize for StaticChunkingStrategyRequestParam {
43667    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
43668    where
43669        S: serde::Serializer,
43670    {
43671        #[serde_with::serde_as]
43672        #[derive(serde :: Serialize)]
43673        struct StaticChunkingStrategyRequestParam<'a> {
43674            #[serde(rename = "type")]
43675            r#type: &'a crate::__types::static_chunking_strategy_request_param::Type,
43676            #[serde(rename = "static")]
43677            r#static: &'a crate::__types::StaticChunkingStrategy,
43678        }
43679        let Self { r#static } = self;
43680        StaticChunkingStrategyRequestParam {
43681            r#type: &Default::default(),
43682            r#static,
43683        }
43684        .serialize(serializer)
43685    }
43686}
43687#[allow(clippy::module_inception)]
43688pub(crate) mod static_chunking_strategy_response_param {
43689    #[doc = "Always `static`."]
43690    #[derive(Clone, Copy, Debug, Default, PartialEq)]
43691    pub(crate) struct Type;
43692    impl_serde!(Type, "static");
43693}
43694#[derive(Clone, Copy, Debug, PartialEq, typed_builder :: TypedBuilder)]
43695pub struct StaticChunkingStrategyResponseParam {
43696    pub r#static: crate::__types::StaticChunkingStrategy,
43697}
43698impl<'de> serde::Deserialize<'de> for StaticChunkingStrategyResponseParam {
43699    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
43700    where
43701        D: serde::Deserializer<'de>,
43702    {
43703        #[serde_with::serde_as]
43704        #[derive(serde :: Deserialize)]
43705        struct StaticChunkingStrategyResponseParam {
43706            #[serde(rename = "type")]
43707            #[allow(dead_code)]
43708            r#type: crate::__types::static_chunking_strategy_response_param::Type,
43709            #[serde(rename = "static")]
43710            r#static: crate::__types::StaticChunkingStrategy,
43711        }
43712        let StaticChunkingStrategyResponseParam { r#static, .. } =
43713            StaticChunkingStrategyResponseParam::deserialize(deserializer)?;
43714        Ok(Self { r#static })
43715    }
43716}
43717impl serde::Serialize for StaticChunkingStrategyResponseParam {
43718    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
43719    where
43720        S: serde::Serializer,
43721    {
43722        #[serde_with::serde_as]
43723        #[derive(serde :: Serialize)]
43724        struct StaticChunkingStrategyResponseParam<'a> {
43725            #[serde(rename = "type")]
43726            r#type: &'a crate::__types::static_chunking_strategy_response_param::Type,
43727            #[serde(rename = "static")]
43728            r#static: &'a crate::__types::StaticChunkingStrategy,
43729        }
43730        let Self { r#static } = self;
43731        StaticChunkingStrategyResponseParam {
43732            r#type: &Default::default(),
43733            r#static,
43734        }
43735        .serialize(serializer)
43736    }
43737}
43738#[doc = "Not supported with latest reasoning models `o3` and `o4-mini`.\n\nUp to 4 sequences where the API will stop generating further tokens. The\nreturned text will not contain the stop sequence.\n"]
43739#[derive(Clone, Debug, PartialEq)]
43740#[serde_with::serde_as]
43741#[derive(serde :: Deserialize, serde :: Serialize)]
43742#[serde(untagged)]
43743#[allow(clippy::large_enum_variant)]
43744pub enum StopConfiguration {
43745    String(String),
43746    Array(Vec<String>),
43747}
43748#[allow(clippy::module_inception)]
43749pub mod submit_tool_outputs_run_request {
43750    #[allow(clippy::module_inception)]
43751    pub mod tool_outputs {
43752        #[derive(Clone, Debug, Default, PartialEq)]
43753        #[serde_with::serde_as]
43754        #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
43755        pub struct Item {
43756            #[doc = "The ID of the tool call in the `required_action` object within the run object the output is being submitted for."]
43757            #[serde(rename = "tool_call_id")]
43758            #[serde(skip_serializing_if = "Option::is_none")]
43759            #[builder(default)]
43760            pub tool_call_id: Option<String>,
43761            #[doc = "The output of the tool call to be submitted to continue the run."]
43762            #[serde(rename = "output")]
43763            #[serde(skip_serializing_if = "Option::is_none")]
43764            #[builder(default)]
43765            pub output: Option<String>,
43766        }
43767    }
43768}
43769#[derive(Clone, Debug, PartialEq)]
43770#[serde_with::serde_as]
43771#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
43772pub struct SubmitToolOutputsRunRequest {
43773    #[doc = "A list of tools for which the outputs are being submitted."]
43774    #[serde(rename = "tool_outputs")]
43775    pub tool_outputs: Vec<crate::__types::submit_tool_outputs_run_request::tool_outputs::Item>,
43776    #[doc = "If `true`, returns a stream of events that happen during the Run as server-sent events, terminating when the Run enters a terminal state with a `data: [DONE]` message.\n"]
43777    #[serde(rename = "stream")]
43778    #[serde(skip_serializing_if = "Option::is_none")]
43779    #[builder(default)]
43780    pub stream: Option<bool>,
43781}
43782#[doc = "An object specifying the format that the model must output.\n\nConfiguring `{ \"type\": \"json_schema\" }` enables Structured Outputs, \nwhich ensures the model will match your supplied JSON schema. Learn more in the \n[Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs).\n\nThe default format is `{ \"type\": \"text\" }` with no additional options.\n\n**Not recommended for gpt-4o and newer models:**\n\nSetting to `{ \"type\": \"json_object\" }` enables the older JSON mode, which\nensures the message the model generates is valid JSON. Using `json_schema`\nis preferred for models that support it.\n"]
43783#[derive(Clone, Debug, PartialEq)]
43784#[serde_with::serde_as]
43785#[derive(serde :: Deserialize, serde :: Serialize)]
43786#[serde(untagged)]
43787#[allow(clippy::large_enum_variant)]
43788pub enum TextResponseFormatConfiguration {
43789    Text(crate::__types::ResponseFormatText),
43790    JsonSchema(crate::__types::TextResponseFormatJsonSchema),
43791    JsonObject(crate::__types::ResponseFormatJsonObject),
43792}
43793#[allow(clippy::module_inception)]
43794pub(crate) mod text_response_format_json_schema {
43795    #[doc = "The type of response format being defined. Always `json_schema`."]
43796    #[derive(Clone, Copy, Debug, Default, PartialEq)]
43797    pub(crate) struct Type;
43798    impl_serde!(Type, "json_schema");
43799}
43800#[doc = "JSON Schema response format. Used to generate structured JSON responses.\nLearn more about [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs).\n"]
43801#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
43802pub struct TextResponseFormatJsonSchema {
43803    #[doc = "A description of what the response format is for, used by the model to\ndetermine how to respond in the format.\n"]
43804    #[builder(default)]
43805    pub description: Option<String>,
43806    #[doc = "The name of the response format. Must be a-z, A-Z, 0-9, or contain\nunderscores and dashes, with a maximum length of 64.\n"]
43807    pub name: String,
43808    pub schema: crate::__types::ResponseFormatJsonSchemaSchema,
43809    #[doc = "Whether to enable strict schema adherence when generating the output.\nIf set to true, the model will always follow the exact schema defined\nin the `schema` field. Only a subset of JSON Schema is supported when\n`strict` is `true`. To learn more, read the [Structured Outputs\nguide](https://platform.openai.com/docs/guides/structured-outputs).\n"]
43810    #[builder(default)]
43811    pub strict: Option<bool>,
43812}
43813impl<'de> serde::Deserialize<'de> for TextResponseFormatJsonSchema {
43814    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
43815    where
43816        D: serde::Deserializer<'de>,
43817    {
43818        #[serde_with::serde_as]
43819        #[derive(serde :: Deserialize)]
43820        struct TextResponseFormatJsonSchema {
43821            #[serde(rename = "type")]
43822            #[allow(dead_code)]
43823            r#type: crate::__types::text_response_format_json_schema::Type,
43824            #[serde(rename = "description")]
43825            description: Option<String>,
43826            #[serde(rename = "name")]
43827            name: String,
43828            #[serde(rename = "schema")]
43829            schema: crate::__types::ResponseFormatJsonSchemaSchema,
43830            #[serde(rename = "strict")]
43831            strict: Option<bool>,
43832        }
43833        let TextResponseFormatJsonSchema {
43834            description,
43835            name,
43836            schema,
43837            strict,
43838            ..
43839        } = TextResponseFormatJsonSchema::deserialize(deserializer)?;
43840        Ok(Self {
43841            description,
43842            name,
43843            schema,
43844            strict,
43845        })
43846    }
43847}
43848impl serde::Serialize for TextResponseFormatJsonSchema {
43849    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
43850    where
43851        S: serde::Serializer,
43852    {
43853        #[serde_with::serde_as]
43854        #[derive(serde :: Serialize)]
43855        struct TextResponseFormatJsonSchema<'a> {
43856            #[serde(rename = "type")]
43857            r#type: &'a crate::__types::text_response_format_json_schema::Type,
43858            #[serde(rename = "description")]
43859            #[serde(skip_serializing_if = "Option::is_none")]
43860            description: &'a Option<String>,
43861            #[serde(rename = "name")]
43862            name: &'a String,
43863            #[serde(rename = "schema")]
43864            schema: &'a crate::__types::ResponseFormatJsonSchemaSchema,
43865            #[serde(rename = "strict")]
43866            #[serde(skip_serializing_if = "Option::is_none")]
43867            strict: &'a Option<bool>,
43868        }
43869        let Self {
43870            description,
43871            name,
43872            schema,
43873            strict,
43874        } = self;
43875        TextResponseFormatJsonSchema {
43876            r#type: &Default::default(),
43877            description,
43878            name,
43879            schema,
43880            strict,
43881        }
43882        .serialize(serializer)
43883    }
43884}
43885#[allow(clippy::module_inception)]
43886pub mod thread_object {
43887    #[doc = "The object type, which is always `thread`."]
43888    #[derive(Clone, Copy, Debug, Default, PartialEq)]
43889    pub(crate) struct Object;
43890    impl_serde!(Object, "thread");
43891    #[allow(clippy::module_inception)]
43892    pub mod tool_resources {
43893        #[derive(Clone, Debug, Default, PartialEq)]
43894        #[serde_with::serde_as]
43895        #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
43896        pub struct CodeInterpreter {
43897            #[doc = "A list of [file](https://platform.openai.com/docs/api-reference/files) IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool.\n"]
43898            #[serde(rename = "file_ids")]
43899            #[serde(skip_serializing_if = "Option::is_none")]
43900            #[builder(default)]
43901            pub file_ids: Option<Vec<String>>,
43902        }
43903        #[derive(Clone, Debug, Default, PartialEq)]
43904        #[serde_with::serde_as]
43905        #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
43906        pub struct FileSearch {
43907            #[doc = "The [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object) attached to this thread. There can be a maximum of 1 vector store attached to the thread.\n"]
43908            #[serde(rename = "vector_store_ids")]
43909            #[serde(skip_serializing_if = "Option::is_none")]
43910            #[builder(default)]
43911            pub vector_store_ids: Option<Vec<String>>,
43912        }
43913    }
43914    #[doc = "A set of resources that are made available to the assistant's tools in this thread. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.\n"]
43915    #[derive(Clone, Debug, Default, PartialEq)]
43916    #[serde_with::serde_as]
43917    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
43918    pub struct ToolResources {
43919        #[serde(rename = "code_interpreter")]
43920        #[serde(skip_serializing_if = "Option::is_none")]
43921        #[builder(default)]
43922        pub code_interpreter:
43923            Option<crate::__types::thread_object::tool_resources::CodeInterpreter>,
43924        #[serde(rename = "file_search")]
43925        #[serde(skip_serializing_if = "Option::is_none")]
43926        #[builder(default)]
43927        pub file_search: Option<crate::__types::thread_object::tool_resources::FileSearch>,
43928    }
43929}
43930#[doc = "Represents a thread that contains [messages](https://platform.openai.com/docs/api-reference/messages)."]
43931#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
43932pub struct ThreadObject {
43933    #[doc = "The identifier, which can be referenced in API endpoints."]
43934    pub id: String,
43935    #[doc = "The Unix timestamp (in seconds) for when the thread was created."]
43936    pub created_at: i64,
43937    #[doc = "A set of resources that are made available to the assistant's tools in this thread. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.\n"]
43938    #[builder(default)]
43939    pub tool_resources: Option<crate::__types::thread_object::ToolResources>,
43940    #[builder(default)]
43941    pub metadata: Option<crate::__types::Metadata>,
43942}
43943impl<'de> serde::Deserialize<'de> for ThreadObject {
43944    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
43945    where
43946        D: serde::Deserializer<'de>,
43947    {
43948        #[serde_with::serde_as]
43949        #[derive(serde :: Deserialize)]
43950        struct ThreadObject {
43951            #[serde(rename = "id")]
43952            id: String,
43953            #[serde(rename = "object")]
43954            #[allow(dead_code)]
43955            object: crate::__types::thread_object::Object,
43956            #[serde(rename = "created_at")]
43957            created_at: i64,
43958            #[serde(rename = "tool_resources")]
43959            tool_resources: Option<crate::__types::thread_object::ToolResources>,
43960            #[serde(rename = "metadata")]
43961            metadata: Option<crate::__types::Metadata>,
43962        }
43963        let ThreadObject {
43964            id,
43965            created_at,
43966            tool_resources,
43967            metadata,
43968            ..
43969        } = ThreadObject::deserialize(deserializer)?;
43970        Ok(Self {
43971            id,
43972            created_at,
43973            tool_resources,
43974            metadata,
43975        })
43976    }
43977}
43978impl serde::Serialize for ThreadObject {
43979    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
43980    where
43981        S: serde::Serializer,
43982    {
43983        #[serde_with::serde_as]
43984        #[derive(serde :: Serialize)]
43985        struct ThreadObject<'a> {
43986            #[serde(rename = "id")]
43987            id: &'a String,
43988            #[serde(rename = "object")]
43989            object: &'a crate::__types::thread_object::Object,
43990            #[serde(rename = "created_at")]
43991            created_at: &'a i64,
43992            #[serde(rename = "tool_resources")]
43993            #[serde(skip_serializing_if = "Option::is_none")]
43994            tool_resources: &'a Option<crate::__types::thread_object::ToolResources>,
43995            #[serde(rename = "metadata")]
43996            #[serde(skip_serializing_if = "Option::is_none")]
43997            metadata: &'a Option<crate::__types::Metadata>,
43998        }
43999        let Self {
44000            id,
44001            created_at,
44002            tool_resources,
44003            metadata,
44004        } = self;
44005        ThreadObject {
44006            id,
44007            object: &Default::default(),
44008            created_at,
44009            tool_resources,
44010            metadata,
44011        }
44012        .serialize(serializer)
44013    }
44014}
44015#[allow(clippy::module_inception)]
44016pub mod thread_stream_event {
44017    #[allow(clippy::module_inception)]
44018    pub(crate) mod thread_created {
44019        #[doc = "thread.created"]
44020        #[derive(Clone, Copy, Debug, Default, PartialEq)]
44021        pub(crate) struct Event;
44022        impl_serde!(Event, "thread.created");
44023    }
44024    #[doc = "Occurs when a new [thread](https://platform.openai.com/docs/api-reference/threads/object) is created."]
44025    #[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
44026    pub struct ThreadCreated {
44027        #[doc = "Whether to enable input audio transcription."]
44028        #[builder(default)]
44029        pub enabled: Option<bool>,
44030        pub data: crate::__types::ThreadObject,
44031    }
44032    impl<'de> serde::Deserialize<'de> for ThreadCreated {
44033        fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
44034        where
44035            D: serde::Deserializer<'de>,
44036        {
44037            #[serde_with::serde_as]
44038            #[derive(serde :: Deserialize)]
44039            struct ThreadCreated {
44040                #[serde(rename = "enabled")]
44041                enabled: Option<bool>,
44042                #[serde(rename = "event")]
44043                #[allow(dead_code)]
44044                event: crate::__types::thread_stream_event::thread_created::Event,
44045                #[serde(rename = "data")]
44046                data: crate::__types::ThreadObject,
44047            }
44048            let ThreadCreated { enabled, data, .. } = ThreadCreated::deserialize(deserializer)?;
44049            Ok(Self { enabled, data })
44050        }
44051    }
44052    impl serde::Serialize for ThreadCreated {
44053        fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
44054        where
44055            S: serde::Serializer,
44056        {
44057            #[serde_with::serde_as]
44058            #[derive(serde :: Serialize)]
44059            struct ThreadCreated<'a> {
44060                #[serde(rename = "enabled")]
44061                #[serde(skip_serializing_if = "Option::is_none")]
44062                enabled: &'a Option<bool>,
44063                #[serde(rename = "event")]
44064                event: &'a crate::__types::thread_stream_event::thread_created::Event,
44065                #[serde(rename = "data")]
44066                data: &'a crate::__types::ThreadObject,
44067            }
44068            let Self { enabled, data } = self;
44069            ThreadCreated {
44070                enabled,
44071                event: &Default::default(),
44072                data,
44073            }
44074            .serialize(serializer)
44075        }
44076    }
44077}
44078#[derive(Clone, Debug, PartialEq)]
44079#[serde_with::serde_as]
44080#[derive(serde :: Deserialize, serde :: Serialize)]
44081#[serde(untagged)]
44082#[allow(clippy::large_enum_variant)]
44083pub enum ThreadStreamEvent {
44084    #[doc = "Occurs when a new [thread](https://platform.openai.com/docs/api-reference/threads/object) is created."]
44085    ThreadCreated(crate::__types::thread_stream_event::ThreadCreated),
44086}
44087#[derive(Clone, Debug, PartialEq)]
44088#[serde_with::serde_as]
44089#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
44090pub struct ToggleCertificatesRequest {
44091    #[serde(rename = "certificate_ids")]
44092    pub certificate_ids: Vec<String>,
44093}
44094#[doc = "A tool that can be used to generate a response.\n"]
44095#[derive(Clone, Debug, PartialEq)]
44096#[serde_with::serde_as]
44097#[derive(serde :: Deserialize, serde :: Serialize)]
44098#[serde(untagged)]
44099#[allow(clippy::large_enum_variant)]
44100pub enum Tool {
44101    FunctionTool(crate::__types::FunctionTool),
44102    FileSearchTool(crate::__types::FileSearchTool),
44103    WebSearchPreviewTool(crate::__types::WebSearchPreviewTool),
44104    ComputerUsePreviewTool(crate::__types::ComputerUsePreviewTool),
44105    McpTool(crate::__types::McpTool),
44106    CodeInterpreterTool(crate::__types::CodeInterpreterTool),
44107    ImageGenTool(crate::__types::ImageGenTool),
44108    LocalShellTool(crate::__types::LocalShellTool),
44109    CustomTool(crate::__types::CustomTool),
44110}
44111#[allow(clippy::module_inception)]
44112pub mod tool_choice_allowed {
44113    #[doc = "Allowed tool configuration type. Always `allowed_tools`."]
44114    #[derive(Clone, Copy, Debug, Default, PartialEq)]
44115    pub(crate) struct Type;
44116    impl_serde!(Type, "allowed_tools");
44117    #[doc = "Constrains the tools available to the model to a pre-defined set.\n\n`auto` allows the model to pick from among the allowed tools and generate a\nmessage.\n\n`required` requires the model to call one or more of the allowed tools.\n"]
44118    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
44119    pub enum Mode {
44120        #[doc = "`auto`"]
44121        #[serde(rename = "auto")]
44122        Auto,
44123        #[doc = "`required`"]
44124        #[serde(rename = "required")]
44125        Required,
44126    }
44127}
44128#[doc = "Constrains the tools available to the model to a pre-defined set.\n"]
44129#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
44130pub struct ToolChoiceAllowed {
44131    #[doc = "Constrains the tools available to the model to a pre-defined set.\n\n`auto` allows the model to pick from among the allowed tools and generate a\nmessage.\n\n`required` requires the model to call one or more of the allowed tools.\n"]
44132    pub mode: crate::__types::tool_choice_allowed::Mode,
44133    #[doc = "A list of tool definitions that the model should be allowed to call.\n\nFor the Responses API, the list of tool definitions might look like:\n```json\n[\n  { \"type\": \"function\", \"name\": \"get_weather\" },\n  { \"type\": \"mcp\", \"server_label\": \"deepwiki\" },\n  { \"type\": \"image_generation\" }\n]\n```text\n"]
44134    pub tools: Vec<indexmap::IndexMap<String, serde_json::Value>>,
44135}
44136impl<'de> serde::Deserialize<'de> for ToolChoiceAllowed {
44137    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
44138    where
44139        D: serde::Deserializer<'de>,
44140    {
44141        #[serde_with::serde_as]
44142        #[derive(serde :: Deserialize)]
44143        struct ToolChoiceAllowed {
44144            #[serde(rename = "type")]
44145            #[allow(dead_code)]
44146            r#type: crate::__types::tool_choice_allowed::Type,
44147            #[serde(rename = "mode")]
44148            mode: crate::__types::tool_choice_allowed::Mode,
44149            #[serde(rename = "tools")]
44150            tools: Vec<indexmap::IndexMap<String, serde_json::Value>>,
44151        }
44152        let ToolChoiceAllowed { mode, tools, .. } = ToolChoiceAllowed::deserialize(deserializer)?;
44153        Ok(Self { mode, tools })
44154    }
44155}
44156impl serde::Serialize for ToolChoiceAllowed {
44157    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
44158    where
44159        S: serde::Serializer,
44160    {
44161        #[serde_with::serde_as]
44162        #[derive(serde :: Serialize)]
44163        struct ToolChoiceAllowed<'a> {
44164            #[serde(rename = "type")]
44165            r#type: &'a crate::__types::tool_choice_allowed::Type,
44166            #[serde(rename = "mode")]
44167            mode: &'a crate::__types::tool_choice_allowed::Mode,
44168            #[serde(rename = "tools")]
44169            tools: &'a Vec<indexmap::IndexMap<String, serde_json::Value>>,
44170        }
44171        let Self { mode, tools } = self;
44172        ToolChoiceAllowed {
44173            r#type: &Default::default(),
44174            mode,
44175            tools,
44176        }
44177        .serialize(serializer)
44178    }
44179}
44180#[allow(clippy::module_inception)]
44181pub(crate) mod tool_choice_custom {
44182    #[doc = "For custom tool calling, the type is always `custom`."]
44183    #[derive(Clone, Copy, Debug, Default, PartialEq)]
44184    pub(crate) struct Type;
44185    impl_serde!(Type, "custom");
44186}
44187#[doc = "Use this option to force the model to call a specific custom tool.\n"]
44188#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
44189pub struct ToolChoiceCustom {
44190    #[doc = "The name of the custom tool to call."]
44191    pub name: String,
44192}
44193impl<'de> serde::Deserialize<'de> for ToolChoiceCustom {
44194    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
44195    where
44196        D: serde::Deserializer<'de>,
44197    {
44198        #[serde_with::serde_as]
44199        #[derive(serde :: Deserialize)]
44200        struct ToolChoiceCustom {
44201            #[serde(rename = "type")]
44202            #[allow(dead_code)]
44203            r#type: crate::__types::tool_choice_custom::Type,
44204            #[serde(rename = "name")]
44205            name: String,
44206        }
44207        let ToolChoiceCustom { name, .. } = ToolChoiceCustom::deserialize(deserializer)?;
44208        Ok(Self { name })
44209    }
44210}
44211impl serde::Serialize for ToolChoiceCustom {
44212    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
44213    where
44214        S: serde::Serializer,
44215    {
44216        #[serde_with::serde_as]
44217        #[derive(serde :: Serialize)]
44218        struct ToolChoiceCustom<'a> {
44219            #[serde(rename = "type")]
44220            r#type: &'a crate::__types::tool_choice_custom::Type,
44221            #[serde(rename = "name")]
44222            name: &'a String,
44223        }
44224        let Self { name } = self;
44225        ToolChoiceCustom {
44226            r#type: &Default::default(),
44227            name,
44228        }
44229        .serialize(serializer)
44230    }
44231}
44232#[allow(clippy::module_inception)]
44233pub(crate) mod tool_choice_function {
44234    #[doc = "For function calling, the type is always `function`."]
44235    #[derive(Clone, Copy, Debug, Default, PartialEq)]
44236    pub(crate) struct Type;
44237    impl_serde!(Type, "function");
44238}
44239#[doc = "Use this option to force the model to call a specific function.\n"]
44240#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
44241pub struct ToolChoiceFunction {
44242    #[doc = "The name of the function to call."]
44243    pub name: String,
44244}
44245impl<'de> serde::Deserialize<'de> for ToolChoiceFunction {
44246    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
44247    where
44248        D: serde::Deserializer<'de>,
44249    {
44250        #[serde_with::serde_as]
44251        #[derive(serde :: Deserialize)]
44252        struct ToolChoiceFunction {
44253            #[serde(rename = "type")]
44254            #[allow(dead_code)]
44255            r#type: crate::__types::tool_choice_function::Type,
44256            #[serde(rename = "name")]
44257            name: String,
44258        }
44259        let ToolChoiceFunction { name, .. } = ToolChoiceFunction::deserialize(deserializer)?;
44260        Ok(Self { name })
44261    }
44262}
44263impl serde::Serialize for ToolChoiceFunction {
44264    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
44265    where
44266        S: serde::Serializer,
44267    {
44268        #[serde_with::serde_as]
44269        #[derive(serde :: Serialize)]
44270        struct ToolChoiceFunction<'a> {
44271            #[serde(rename = "type")]
44272            r#type: &'a crate::__types::tool_choice_function::Type,
44273            #[serde(rename = "name")]
44274            name: &'a String,
44275        }
44276        let Self { name } = self;
44277        ToolChoiceFunction {
44278            r#type: &Default::default(),
44279            name,
44280        }
44281        .serialize(serializer)
44282    }
44283}
44284#[allow(clippy::module_inception)]
44285pub(crate) mod tool_choice_mcp {
44286    #[doc = "For MCP tools, the type is always `mcp`."]
44287    #[derive(Clone, Copy, Debug, Default, PartialEq)]
44288    pub(crate) struct Type;
44289    impl_serde!(Type, "mcp");
44290}
44291#[doc = "Use this option to force the model to call a specific tool on a remote MCP server.\n"]
44292#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
44293pub struct ToolChoiceMcp {
44294    #[doc = "The label of the MCP server to use.\n"]
44295    pub server_label: String,
44296    #[doc = "The name of the tool to call on the server.\n"]
44297    #[builder(default)]
44298    pub name: Option<String>,
44299}
44300impl<'de> serde::Deserialize<'de> for ToolChoiceMcp {
44301    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
44302    where
44303        D: serde::Deserializer<'de>,
44304    {
44305        #[serde_with::serde_as]
44306        #[derive(serde :: Deserialize)]
44307        struct ToolChoiceMcp {
44308            #[serde(rename = "type")]
44309            #[allow(dead_code)]
44310            r#type: crate::__types::tool_choice_mcp::Type,
44311            #[serde(rename = "server_label")]
44312            server_label: String,
44313            #[serde(rename = "name")]
44314            name: Option<String>,
44315        }
44316        let ToolChoiceMcp {
44317            server_label, name, ..
44318        } = ToolChoiceMcp::deserialize(deserializer)?;
44319        Ok(Self { server_label, name })
44320    }
44321}
44322impl serde::Serialize for ToolChoiceMcp {
44323    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
44324    where
44325        S: serde::Serializer,
44326    {
44327        #[serde_with::serde_as]
44328        #[derive(serde :: Serialize)]
44329        struct ToolChoiceMcp<'a> {
44330            #[serde(rename = "type")]
44331            r#type: &'a crate::__types::tool_choice_mcp::Type,
44332            #[serde(rename = "server_label")]
44333            server_label: &'a String,
44334            #[serde(rename = "name")]
44335            #[serde(skip_serializing_if = "Option::is_none")]
44336            name: &'a Option<String>,
44337        }
44338        let Self { server_label, name } = self;
44339        ToolChoiceMcp {
44340            r#type: &Default::default(),
44341            server_label,
44342            name,
44343        }
44344        .serialize(serializer)
44345    }
44346}
44347#[doc = "Controls which (if any) tool is called by the model.\n\n`none` means the model will not call any tool and instead generates a message.\n\n`auto` means the model can pick between generating a message or calling one or\nmore tools.\n\n`required` means the model must call one or more tools.\n"]
44348#[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
44349pub enum ToolChoiceOptions {
44350    #[doc = "`none`"]
44351    #[serde(rename = "none")]
44352    None,
44353    #[doc = "`auto`"]
44354    #[serde(rename = "auto")]
44355    Auto,
44356    #[doc = "`required`"]
44357    #[serde(rename = "required")]
44358    Required,
44359}
44360#[allow(clippy::module_inception)]
44361pub mod tool_choice_types {
44362    #[doc = "The type of hosted tool the model should to use. Learn more about\n[built-in tools](https://platform.openai.com/docs/guides/tools).\n\nAllowed values are:\n- `file_search`\n- `web_search_preview`\n- `computer_use_preview`\n- `code_interpreter`\n- `image_generation`\n"]
44363    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
44364    pub enum Type {
44365        #[doc = "`file_search`"]
44366        #[serde(rename = "file_search")]
44367        FileSearch,
44368        #[doc = "`web_search_preview`"]
44369        #[serde(rename = "web_search_preview")]
44370        WebSearchPreview,
44371        #[doc = "`computer_use_preview`"]
44372        #[serde(rename = "computer_use_preview")]
44373        ComputerUsePreview,
44374        #[doc = "`web_search_preview_2025_03_11`"]
44375        #[serde(rename = "web_search_preview_2025_03_11")]
44376        WebSearchPreview2025_03_11,
44377        #[doc = "`image_generation`"]
44378        #[serde(rename = "image_generation")]
44379        ImageGeneration,
44380        #[doc = "`code_interpreter`"]
44381        #[serde(rename = "code_interpreter")]
44382        CodeInterpreter,
44383    }
44384}
44385#[doc = "Indicates that the model should use a built-in tool to generate a response.\n[Learn more about built-in tools](https://platform.openai.com/docs/guides/tools).\n"]
44386#[derive(Clone, Copy, Debug, PartialEq)]
44387#[serde_with::serde_as]
44388#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
44389pub struct ToolChoiceTypes {
44390    #[doc = "The type of hosted tool the model should to use. Learn more about\n[built-in tools](https://platform.openai.com/docs/guides/tools).\n\nAllowed values are:\n- `file_search`\n- `web_search_preview`\n- `computer_use_preview`\n- `code_interpreter`\n- `image_generation`\n"]
44391    #[serde(rename = "type")]
44392    pub r#type: crate::__types::tool_choice_types::Type,
44393}
44394#[allow(clippy::module_inception)]
44395pub mod transcript_text_delta_event {
44396    #[doc = "The type of the event. Always `transcript.text.delta`.\n"]
44397    #[derive(Clone, Copy, Debug, Default, PartialEq)]
44398    pub(crate) struct Type;
44399    impl_serde!(Type, "transcript.text.delta");
44400    #[allow(clippy::module_inception)]
44401    pub mod logprobs {
44402        #[derive(Clone, Debug, Default, PartialEq)]
44403        #[serde_with::serde_as]
44404        #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
44405        pub struct Item {
44406            #[doc = "The token that was used to generate the log probability.\n"]
44407            #[serde(rename = "token")]
44408            #[serde(skip_serializing_if = "Option::is_none")]
44409            #[builder(default)]
44410            pub token: Option<String>,
44411            #[doc = "The log probability of the token.\n"]
44412            #[serde(rename = "logprob")]
44413            #[serde(skip_serializing_if = "Option::is_none")]
44414            #[builder(default)]
44415            pub logprob: Option<serde_json::Number>,
44416            #[doc = "The bytes that were used to generate the log probability.\n"]
44417            #[serde(rename = "bytes")]
44418            #[serde(skip_serializing_if = "Option::is_none")]
44419            #[builder(default)]
44420            pub bytes: Option<Vec<i64>>,
44421        }
44422    }
44423}
44424#[doc = "Emitted when there is an additional text delta. This is also the first event emitted when the transcription starts. Only emitted when you [create a transcription](https://platform.openai.com/docs/api-reference/audio/create-transcription) with the `Stream` parameter set to `true`."]
44425#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
44426pub struct TranscriptTextDeltaEvent {
44427    #[doc = "The text delta that was additionally transcribed.\n"]
44428    pub delta: String,
44429    #[doc = "The log probabilities of the delta. Only included if you [create a transcription](https://platform.openai.com/docs/api-reference/audio/create-transcription) with the `include[]` parameter set to `logprobs`.\n"]
44430    #[builder(default)]
44431    pub logprobs: Option<Vec<crate::__types::transcript_text_delta_event::logprobs::Item>>,
44432}
44433impl<'de> serde::Deserialize<'de> for TranscriptTextDeltaEvent {
44434    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
44435    where
44436        D: serde::Deserializer<'de>,
44437    {
44438        #[serde_with::serde_as]
44439        #[derive(serde :: Deserialize)]
44440        struct TranscriptTextDeltaEvent {
44441            #[serde(rename = "type")]
44442            #[allow(dead_code)]
44443            r#type: crate::__types::transcript_text_delta_event::Type,
44444            #[serde(rename = "delta")]
44445            delta: String,
44446            #[serde(rename = "logprobs")]
44447            logprobs: Option<Vec<crate::__types::transcript_text_delta_event::logprobs::Item>>,
44448        }
44449        let TranscriptTextDeltaEvent {
44450            delta, logprobs, ..
44451        } = TranscriptTextDeltaEvent::deserialize(deserializer)?;
44452        Ok(Self { delta, logprobs })
44453    }
44454}
44455impl serde::Serialize for TranscriptTextDeltaEvent {
44456    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
44457    where
44458        S: serde::Serializer,
44459    {
44460        #[serde_with::serde_as]
44461        #[derive(serde :: Serialize)]
44462        struct TranscriptTextDeltaEvent<'a> {
44463            #[serde(rename = "type")]
44464            r#type: &'a crate::__types::transcript_text_delta_event::Type,
44465            #[serde(rename = "delta")]
44466            delta: &'a String,
44467            #[serde(rename = "logprobs")]
44468            #[serde(skip_serializing_if = "Option::is_none")]
44469            logprobs: &'a Option<Vec<crate::__types::transcript_text_delta_event::logprobs::Item>>,
44470        }
44471        let Self { delta, logprobs } = self;
44472        TranscriptTextDeltaEvent {
44473            r#type: &Default::default(),
44474            delta,
44475            logprobs,
44476        }
44477        .serialize(serializer)
44478    }
44479}
44480#[allow(clippy::module_inception)]
44481pub mod transcript_text_done_event {
44482    #[doc = "The type of the event. Always `transcript.text.done`.\n"]
44483    #[derive(Clone, Copy, Debug, Default, PartialEq)]
44484    pub(crate) struct Type;
44485    impl_serde!(Type, "transcript.text.done");
44486    #[allow(clippy::module_inception)]
44487    pub mod logprobs {
44488        #[derive(Clone, Debug, Default, PartialEq)]
44489        #[serde_with::serde_as]
44490        #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
44491        pub struct Item {
44492            #[doc = "The token that was used to generate the log probability.\n"]
44493            #[serde(rename = "token")]
44494            #[serde(skip_serializing_if = "Option::is_none")]
44495            #[builder(default)]
44496            pub token: Option<String>,
44497            #[doc = "The log probability of the token.\n"]
44498            #[serde(rename = "logprob")]
44499            #[serde(skip_serializing_if = "Option::is_none")]
44500            #[builder(default)]
44501            pub logprob: Option<serde_json::Number>,
44502            #[doc = "The bytes that were used to generate the log probability.\n"]
44503            #[serde(rename = "bytes")]
44504            #[serde(skip_serializing_if = "Option::is_none")]
44505            #[builder(default)]
44506            pub bytes: Option<Vec<i64>>,
44507        }
44508    }
44509}
44510#[doc = "Emitted when the transcription is complete. Contains the complete transcription text. Only emitted when you [create a transcription](https://platform.openai.com/docs/api-reference/audio/create-transcription) with the `Stream` parameter set to `true`."]
44511#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
44512pub struct TranscriptTextDoneEvent {
44513    #[doc = "The text that was transcribed.\n"]
44514    pub text: String,
44515    #[doc = "The log probabilities of the individual tokens in the transcription. Only included if you [create a transcription](https://platform.openai.com/docs/api-reference/audio/create-transcription) with the `include[]` parameter set to `logprobs`.\n"]
44516    #[builder(default)]
44517    pub logprobs: Option<Vec<crate::__types::transcript_text_done_event::logprobs::Item>>,
44518    #[builder(default)]
44519    pub usage: Option<crate::__types::TranscriptTextUsageTokens>,
44520}
44521impl<'de> serde::Deserialize<'de> for TranscriptTextDoneEvent {
44522    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
44523    where
44524        D: serde::Deserializer<'de>,
44525    {
44526        #[serde_with::serde_as]
44527        #[derive(serde :: Deserialize)]
44528        struct TranscriptTextDoneEvent {
44529            #[serde(rename = "type")]
44530            #[allow(dead_code)]
44531            r#type: crate::__types::transcript_text_done_event::Type,
44532            #[serde(rename = "text")]
44533            text: String,
44534            #[serde(rename = "logprobs")]
44535            logprobs: Option<Vec<crate::__types::transcript_text_done_event::logprobs::Item>>,
44536            #[serde(rename = "usage")]
44537            usage: Option<crate::__types::TranscriptTextUsageTokens>,
44538        }
44539        let TranscriptTextDoneEvent {
44540            text,
44541            logprobs,
44542            usage,
44543            ..
44544        } = TranscriptTextDoneEvent::deserialize(deserializer)?;
44545        Ok(Self {
44546            text,
44547            logprobs,
44548            usage,
44549        })
44550    }
44551}
44552impl serde::Serialize for TranscriptTextDoneEvent {
44553    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
44554    where
44555        S: serde::Serializer,
44556    {
44557        #[serde_with::serde_as]
44558        #[derive(serde :: Serialize)]
44559        struct TranscriptTextDoneEvent<'a> {
44560            #[serde(rename = "type")]
44561            r#type: &'a crate::__types::transcript_text_done_event::Type,
44562            #[serde(rename = "text")]
44563            text: &'a String,
44564            #[serde(rename = "logprobs")]
44565            #[serde(skip_serializing_if = "Option::is_none")]
44566            logprobs: &'a Option<Vec<crate::__types::transcript_text_done_event::logprobs::Item>>,
44567            #[serde(rename = "usage")]
44568            #[serde(skip_serializing_if = "Option::is_none")]
44569            usage: &'a Option<crate::__types::TranscriptTextUsageTokens>,
44570        }
44571        let Self {
44572            text,
44573            logprobs,
44574            usage,
44575        } = self;
44576        TranscriptTextDoneEvent {
44577            r#type: &Default::default(),
44578            text,
44579            logprobs,
44580            usage,
44581        }
44582        .serialize(serializer)
44583    }
44584}
44585#[allow(clippy::module_inception)]
44586pub(crate) mod transcript_text_usage_duration {
44587    #[doc = "The type of the usage object. Always `duration` for this variant."]
44588    #[derive(Clone, Copy, Debug, Default, PartialEq)]
44589    pub(crate) struct Type;
44590    impl_serde!(Type, "duration");
44591}
44592#[doc = "Usage statistics for models billed by audio input duration."]
44593#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
44594pub struct TranscriptTextUsageDuration {
44595    #[doc = "Duration of the input audio in seconds."]
44596    pub seconds: serde_json::Number,
44597}
44598impl<'de> serde::Deserialize<'de> for TranscriptTextUsageDuration {
44599    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
44600    where
44601        D: serde::Deserializer<'de>,
44602    {
44603        #[serde_with::serde_as]
44604        #[derive(serde :: Deserialize)]
44605        struct TranscriptTextUsageDuration {
44606            #[serde(rename = "type")]
44607            #[allow(dead_code)]
44608            r#type: crate::__types::transcript_text_usage_duration::Type,
44609            #[serde(rename = "seconds")]
44610            seconds: serde_json::Number,
44611        }
44612        let TranscriptTextUsageDuration { seconds, .. } =
44613            TranscriptTextUsageDuration::deserialize(deserializer)?;
44614        Ok(Self { seconds })
44615    }
44616}
44617impl serde::Serialize for TranscriptTextUsageDuration {
44618    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
44619    where
44620        S: serde::Serializer,
44621    {
44622        #[serde_with::serde_as]
44623        #[derive(serde :: Serialize)]
44624        struct TranscriptTextUsageDuration<'a> {
44625            #[serde(rename = "type")]
44626            r#type: &'a crate::__types::transcript_text_usage_duration::Type,
44627            #[serde(rename = "seconds")]
44628            seconds: &'a serde_json::Number,
44629        }
44630        let Self { seconds } = self;
44631        TranscriptTextUsageDuration {
44632            r#type: &Default::default(),
44633            seconds,
44634        }
44635        .serialize(serializer)
44636    }
44637}
44638#[allow(clippy::module_inception)]
44639pub mod transcript_text_usage_tokens {
44640    #[doc = "The type of the usage object. Always `tokens` for this variant."]
44641    #[derive(Clone, Copy, Debug, Default, PartialEq)]
44642    pub(crate) struct Type;
44643    impl_serde!(Type, "tokens");
44644    #[doc = "Details about the input tokens billed for this request."]
44645    #[derive(Clone, Copy, Debug, Default, PartialEq)]
44646    #[serde_with::serde_as]
44647    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
44648    pub struct InputTokenDetails {
44649        #[doc = "Number of text tokens billed for this request."]
44650        #[serde(rename = "text_tokens")]
44651        #[serde(skip_serializing_if = "Option::is_none")]
44652        #[builder(default)]
44653        pub text_tokens: Option<i64>,
44654        #[doc = "Number of audio tokens billed for this request."]
44655        #[serde(rename = "audio_tokens")]
44656        #[serde(skip_serializing_if = "Option::is_none")]
44657        #[builder(default)]
44658        pub audio_tokens: Option<i64>,
44659    }
44660}
44661#[doc = "Usage statistics for models billed by token usage."]
44662#[derive(Clone, Copy, Debug, PartialEq, typed_builder :: TypedBuilder)]
44663pub struct TranscriptTextUsageTokens {
44664    #[doc = "Number of input tokens billed for this request."]
44665    pub input_tokens: i64,
44666    #[doc = "Details about the input tokens billed for this request."]
44667    #[builder(default)]
44668    pub input_token_details:
44669        Option<crate::__types::transcript_text_usage_tokens::InputTokenDetails>,
44670    #[doc = "Number of output tokens generated."]
44671    pub output_tokens: i64,
44672    #[doc = "Total number of tokens used (input + output)."]
44673    pub total_tokens: i64,
44674}
44675impl<'de> serde::Deserialize<'de> for TranscriptTextUsageTokens {
44676    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
44677    where
44678        D: serde::Deserializer<'de>,
44679    {
44680        #[serde_with::serde_as]
44681        #[derive(serde :: Deserialize)]
44682        struct TranscriptTextUsageTokens {
44683            #[serde(rename = "type")]
44684            #[allow(dead_code)]
44685            r#type: crate::__types::transcript_text_usage_tokens::Type,
44686            #[serde(rename = "input_tokens")]
44687            input_tokens: i64,
44688            #[serde(rename = "input_token_details")]
44689            input_token_details:
44690                Option<crate::__types::transcript_text_usage_tokens::InputTokenDetails>,
44691            #[serde(rename = "output_tokens")]
44692            output_tokens: i64,
44693            #[serde(rename = "total_tokens")]
44694            total_tokens: i64,
44695        }
44696        let TranscriptTextUsageTokens {
44697            input_tokens,
44698            input_token_details,
44699            output_tokens,
44700            total_tokens,
44701            ..
44702        } = TranscriptTextUsageTokens::deserialize(deserializer)?;
44703        Ok(Self {
44704            input_tokens,
44705            input_token_details,
44706            output_tokens,
44707            total_tokens,
44708        })
44709    }
44710}
44711impl serde::Serialize for TranscriptTextUsageTokens {
44712    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
44713    where
44714        S: serde::Serializer,
44715    {
44716        #[serde_with::serde_as]
44717        #[derive(serde :: Serialize)]
44718        struct TranscriptTextUsageTokens<'a> {
44719            #[serde(rename = "type")]
44720            r#type: &'a crate::__types::transcript_text_usage_tokens::Type,
44721            #[serde(rename = "input_tokens")]
44722            input_tokens: &'a i64,
44723            #[serde(rename = "input_token_details")]
44724            #[serde(skip_serializing_if = "Option::is_none")]
44725            input_token_details:
44726                &'a Option<crate::__types::transcript_text_usage_tokens::InputTokenDetails>,
44727            #[serde(rename = "output_tokens")]
44728            output_tokens: &'a i64,
44729            #[serde(rename = "total_tokens")]
44730            total_tokens: &'a i64,
44731        }
44732        let Self {
44733            input_tokens,
44734            input_token_details,
44735            output_tokens,
44736            total_tokens,
44737        } = self;
44738        TranscriptTextUsageTokens {
44739            r#type: &Default::default(),
44740            input_tokens,
44741            input_token_details,
44742            output_tokens,
44743            total_tokens,
44744        }
44745        .serialize(serializer)
44746    }
44747}
44748#[allow(clippy::module_inception)]
44749pub(crate) mod transcription_chunking_strategy {
44750    #[doc = "auto"]
44751    #[derive(Clone, Copy, Debug, Default, PartialEq)]
44752    pub(crate) struct Auto;
44753    impl_serde!(Auto, "auto");
44754}
44755#[doc = "Controls how the audio is cut into chunks. When set to `\"auto\"`, the server first normalizes loudness and then uses voice activity detection (VAD) to choose boundaries. `server_vad` object can be provided to tweak VAD detection parameters manually. If unset, the audio is transcribed as a single block. "]
44756#[derive(Clone, Debug, PartialEq)]
44757#[allow(clippy::large_enum_variant)]
44758pub enum TranscriptionChunkingStrategy {
44759    #[doc = "auto"]
44760    Auto,
44761    VadConfig(crate::__types::VadConfig),
44762}
44763impl<'de> serde::Deserialize<'de> for TranscriptionChunkingStrategy {
44764    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
44765    where
44766        D: serde::Deserializer<'de>,
44767    {
44768        #[serde_with::serde_as]
44769        #[derive(serde :: Deserialize)]
44770        #[serde(untagged)]
44771        #[allow(clippy::enum_variant_names, clippy::large_enum_variant)]
44772        enum TranscriptionChunkingStrategy {
44773            Auto(crate::__types::transcription_chunking_strategy::Auto),
44774            VadConfig(crate::__types::VadConfig),
44775        }
44776        Ok(
44777            match TranscriptionChunkingStrategy::deserialize(deserializer)? {
44778                TranscriptionChunkingStrategy::Auto(_) => Self::Auto,
44779                TranscriptionChunkingStrategy::VadConfig(v) => Self::VadConfig(v),
44780            },
44781        )
44782    }
44783}
44784impl serde::Serialize for TranscriptionChunkingStrategy {
44785    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
44786    where
44787        S: serde::Serializer,
44788    {
44789        #[serde_with::serde_as]
44790        #[derive(serde :: Serialize)]
44791        #[serde(untagged)]
44792        #[allow(clippy::enum_variant_names)]
44793        enum TranscriptionChunkingStrategy<'a> {
44794            Auto(crate::__types::transcription_chunking_strategy::Auto),
44795            VadConfig(&'a crate::__types::VadConfig),
44796        }
44797        match self {
44798            Self::Auto => TranscriptionChunkingStrategy::Auto(Default::default()),
44799            Self::VadConfig(v) => TranscriptionChunkingStrategy::VadConfig(v),
44800        }
44801        .serialize(serializer)
44802    }
44803}
44804#[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
44805pub enum TranscriptionInclude {
44806    #[doc = "`logprobs`"]
44807    #[serde(rename = "logprobs")]
44808    Logprobs,
44809}
44810#[derive(Clone, Debug, PartialEq)]
44811#[serde_with::serde_as]
44812#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
44813pub struct TranscriptionSegment {
44814    #[doc = "Unique identifier of the segment."]
44815    #[serde(rename = "id")]
44816    pub id: i64,
44817    #[doc = "Seek offset of the segment."]
44818    #[serde(rename = "seek")]
44819    pub seek: i64,
44820    #[doc = "Start time of the segment in seconds."]
44821    #[serde(rename = "start")]
44822    pub start: f64,
44823    #[doc = "End time of the segment in seconds."]
44824    #[serde(rename = "end")]
44825    pub end: f64,
44826    #[doc = "Text content of the segment."]
44827    #[serde(rename = "text")]
44828    pub text: String,
44829    #[doc = "Array of token IDs for the text content."]
44830    #[serde(rename = "tokens")]
44831    pub tokens: Vec<i64>,
44832    #[doc = "Temperature parameter used for generating the segment."]
44833    #[serde(rename = "temperature")]
44834    pub temperature: f64,
44835    #[doc = "Average logprob of the segment. If the value is lower than -1, consider the logprobs failed."]
44836    #[serde(rename = "avg_logprob")]
44837    pub avg_logprob: f64,
44838    #[doc = "Compression ratio of the segment. If the value is greater than 2.4, consider the compression failed."]
44839    #[serde(rename = "compression_ratio")]
44840    pub compression_ratio: f64,
44841    #[doc = "Probability of no speech in the segment. If the value is higher than 1.0 and the `avg_logprob` is below -1, consider this segment silent."]
44842    #[serde(rename = "no_speech_prob")]
44843    pub no_speech_prob: f64,
44844}
44845#[derive(Clone, Debug, PartialEq)]
44846#[serde_with::serde_as]
44847#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
44848pub struct TranscriptionWord {
44849    #[doc = "The text content of the word."]
44850    #[serde(rename = "word")]
44851    pub word: String,
44852    #[doc = "Start time of the word in seconds."]
44853    #[serde(rename = "start")]
44854    pub start: f64,
44855    #[doc = "End time of the word in seconds."]
44856    #[serde(rename = "end")]
44857    pub end: f64,
44858}
44859#[allow(clippy::module_inception)]
44860pub mod truncation_object {
44861    #[doc = "The truncation strategy to use for the thread. The default is `auto`. If set to `last_messages`, the thread will be truncated to the n most recent messages in the thread. When set to `auto`, messages in the middle of the thread will be dropped to fit the context length of the model, `max_prompt_tokens`."]
44862    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
44863    pub enum Type {
44864        #[doc = "`auto`"]
44865        #[serde(rename = "auto")]
44866        Auto,
44867        #[doc = "`last_messages`"]
44868        #[serde(rename = "last_messages")]
44869        LastMessages,
44870    }
44871}
44872#[doc = "Controls for how a thread will be truncated prior to the run. Use this to control the initial context window of the run."]
44873#[derive(Clone, Copy, Debug, PartialEq)]
44874#[serde_with::serde_as]
44875#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
44876pub struct TruncationObject {
44877    #[doc = "The truncation strategy to use for the thread. The default is `auto`. If set to `last_messages`, the thread will be truncated to the n most recent messages in the thread. When set to `auto`, messages in the middle of the thread will be dropped to fit the context length of the model, `max_prompt_tokens`."]
44878    #[serde(rename = "type")]
44879    pub r#type: crate::__types::truncation_object::Type,
44880    #[doc = "The number of most recent messages from the thread when constructing the context for the run."]
44881    #[serde(rename = "last_messages")]
44882    #[serde(skip_serializing_if = "Option::is_none")]
44883    #[builder(default)]
44884    pub last_messages: Option<i64>,
44885}
44886#[allow(clippy::module_inception)]
44887pub(crate) mod r#type {
44888    #[doc = "Specifies the event type. For a type action, this property is \nalways set to `type`.\n"]
44889    #[derive(Clone, Copy, Debug, Default, PartialEq)]
44890    pub(crate) struct Type;
44891    impl_serde!(Type, "type");
44892}
44893#[doc = "An action to type in text.\n"]
44894#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
44895pub struct Type {
44896    #[doc = "The text to type.\n"]
44897    pub text: String,
44898}
44899impl<'de> serde::Deserialize<'de> for Type {
44900    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
44901    where
44902        D: serde::Deserializer<'de>,
44903    {
44904        #[serde_with::serde_as]
44905        #[derive(serde :: Deserialize)]
44906        struct Type {
44907            #[serde(rename = "type")]
44908            #[allow(dead_code)]
44909            r#type: crate::__types::r#type::Type,
44910            #[serde(rename = "text")]
44911            text: String,
44912        }
44913        let Type { text, .. } = Type::deserialize(deserializer)?;
44914        Ok(Self { text })
44915    }
44916}
44917impl serde::Serialize for Type {
44918    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
44919    where
44920        S: serde::Serializer,
44921    {
44922        #[serde_with::serde_as]
44923        #[derive(serde :: Serialize)]
44924        struct Type<'a> {
44925            #[serde(rename = "type")]
44926            r#type: &'a crate::__types::r#type::Type,
44927            #[serde(rename = "text")]
44928            text: &'a String,
44929        }
44930        let Self { text } = self;
44931        Type {
44932            r#type: &Default::default(),
44933            text,
44934        }
44935        .serialize(serializer)
44936    }
44937}
44938#[derive(Clone, Debug, PartialEq)]
44939#[serde_with::serde_as]
44940#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
44941pub struct UpdateVectorStoreFileAttributesRequest {
44942    #[serde(rename = "attributes")]
44943    #[serde(skip_serializing_if = "Option::is_none")]
44944    #[builder(default)]
44945    pub attributes: Option<crate::__types::VectorStoreFileAttributes>,
44946}
44947#[derive(Clone, Debug, Default, PartialEq)]
44948#[serde_with::serde_as]
44949#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
44950pub struct UpdateVectorStoreRequest {
44951    #[doc = "The name of the vector store."]
44952    #[serde(rename = "name")]
44953    #[serde(skip_serializing_if = "Option::is_none")]
44954    #[builder(default)]
44955    pub name: Option<String>,
44956    #[serde(rename = "expires_after")]
44957    #[serde(skip_serializing_if = "Option::is_none")]
44958    #[builder(default)]
44959    pub expires_after: Option<crate::__types::VectorStoreExpirationAfter>,
44960    #[serde(rename = "metadata")]
44961    #[serde(skip_serializing_if = "Option::is_none")]
44962    #[builder(default)]
44963    pub metadata: Option<crate::__types::Metadata>,
44964}
44965#[allow(clippy::module_inception)]
44966pub mod upload {
44967    #[doc = "The status of the Upload."]
44968    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
44969    pub enum Status {
44970        #[doc = "`pending`"]
44971        #[serde(rename = "pending")]
44972        Pending,
44973        #[doc = "`completed`"]
44974        #[serde(rename = "completed")]
44975        Completed,
44976        #[doc = "`cancelled`"]
44977        #[serde(rename = "cancelled")]
44978        Cancelled,
44979        #[doc = "`expired`"]
44980        #[serde(rename = "expired")]
44981        Expired,
44982    }
44983    #[doc = "The object type, which is always \"upload\"."]
44984    #[derive(Clone, Copy, Debug, Default, PartialEq)]
44985    pub(crate) struct Object;
44986    impl_serde!(Object, "upload");
44987}
44988#[doc = "The Upload object can accept byte chunks in the form of Parts.\n"]
44989#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
44990pub struct Upload {
44991    #[doc = "The Upload unique identifier, which can be referenced in API endpoints."]
44992    pub id: String,
44993    #[doc = "The Unix timestamp (in seconds) for when the Upload was created."]
44994    pub created_at: i64,
44995    #[doc = "The name of the file to be uploaded."]
44996    pub filename: String,
44997    #[doc = "The intended number of bytes to be uploaded."]
44998    pub bytes: i64,
44999    #[doc = "The intended purpose of the file. [Please refer here](https://platform.openai.com/docs/api-reference/files/object#files/object-purpose) for acceptable values."]
45000    pub purpose: String,
45001    #[doc = "The status of the Upload."]
45002    pub status: crate::__types::upload::Status,
45003    #[doc = "The Unix timestamp (in seconds) for when the Upload will expire."]
45004    pub expires_at: i64,
45005    #[doc = "The ready File object after the Upload is completed."]
45006    #[builder(default)]
45007    pub file: Option<crate::__types::OpenAiFile>,
45008}
45009impl<'de> serde::Deserialize<'de> for Upload {
45010    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
45011    where
45012        D: serde::Deserializer<'de>,
45013    {
45014        #[serde_with::serde_as]
45015        #[derive(serde :: Deserialize)]
45016        struct Upload {
45017            #[serde(rename = "id")]
45018            id: String,
45019            #[serde(rename = "created_at")]
45020            created_at: i64,
45021            #[serde(rename = "filename")]
45022            filename: String,
45023            #[serde(rename = "bytes")]
45024            bytes: i64,
45025            #[serde(rename = "purpose")]
45026            purpose: String,
45027            #[serde(rename = "status")]
45028            status: crate::__types::upload::Status,
45029            #[serde(rename = "expires_at")]
45030            expires_at: i64,
45031            #[serde(rename = "object")]
45032            #[allow(dead_code)]
45033            object: crate::__types::upload::Object,
45034            #[serde(rename = "file")]
45035            file: Option<crate::__types::OpenAiFile>,
45036        }
45037        let Upload {
45038            id,
45039            created_at,
45040            filename,
45041            bytes,
45042            purpose,
45043            status,
45044            expires_at,
45045            file,
45046            ..
45047        } = Upload::deserialize(deserializer)?;
45048        Ok(Self {
45049            id,
45050            created_at,
45051            filename,
45052            bytes,
45053            purpose,
45054            status,
45055            expires_at,
45056            file,
45057        })
45058    }
45059}
45060impl serde::Serialize for Upload {
45061    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
45062    where
45063        S: serde::Serializer,
45064    {
45065        #[serde_with::serde_as]
45066        #[derive(serde :: Serialize)]
45067        struct Upload<'a> {
45068            #[serde(rename = "id")]
45069            id: &'a String,
45070            #[serde(rename = "created_at")]
45071            created_at: &'a i64,
45072            #[serde(rename = "filename")]
45073            filename: &'a String,
45074            #[serde(rename = "bytes")]
45075            bytes: &'a i64,
45076            #[serde(rename = "purpose")]
45077            purpose: &'a String,
45078            #[serde(rename = "status")]
45079            status: &'a crate::__types::upload::Status,
45080            #[serde(rename = "expires_at")]
45081            expires_at: &'a i64,
45082            #[serde(rename = "object")]
45083            object: &'a crate::__types::upload::Object,
45084            #[serde(rename = "file")]
45085            #[serde(skip_serializing_if = "Option::is_none")]
45086            file: &'a Option<crate::__types::OpenAiFile>,
45087        }
45088        let Self {
45089            id,
45090            created_at,
45091            filename,
45092            bytes,
45093            purpose,
45094            status,
45095            expires_at,
45096            file,
45097        } = self;
45098        Upload {
45099            id,
45100            created_at,
45101            filename,
45102            bytes,
45103            purpose,
45104            status,
45105            expires_at,
45106            object: &Default::default(),
45107            file,
45108        }
45109        .serialize(serializer)
45110    }
45111}
45112#[derive(Clone, Debug, PartialEq)]
45113#[serde_with::serde_as]
45114#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
45115pub struct UploadCertificateRequest {
45116    #[doc = "An optional name for the certificate"]
45117    #[serde(rename = "name")]
45118    #[serde(skip_serializing_if = "Option::is_none")]
45119    #[builder(default)]
45120    pub name: Option<String>,
45121    #[doc = "The certificate content in PEM format"]
45122    #[serde(rename = "content")]
45123    pub content: String,
45124}
45125#[allow(clippy::module_inception)]
45126pub(crate) mod upload_part {
45127    #[doc = "The object type, which is always `upload.part`."]
45128    #[derive(Clone, Copy, Debug, Default, PartialEq)]
45129    pub(crate) struct Object;
45130    impl_serde!(Object, "upload.part");
45131}
45132#[doc = "The upload Part represents a chunk of bytes we can add to an Upload object.\n"]
45133#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
45134pub struct UploadPart {
45135    #[doc = "The upload Part unique identifier, which can be referenced in API endpoints."]
45136    pub id: String,
45137    #[doc = "The Unix timestamp (in seconds) for when the Part was created."]
45138    pub created_at: i64,
45139    #[doc = "The ID of the Upload object that this Part was added to."]
45140    pub upload_id: String,
45141}
45142impl<'de> serde::Deserialize<'de> for UploadPart {
45143    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
45144    where
45145        D: serde::Deserializer<'de>,
45146    {
45147        #[serde_with::serde_as]
45148        #[derive(serde :: Deserialize)]
45149        struct UploadPart {
45150            #[serde(rename = "id")]
45151            id: String,
45152            #[serde(rename = "created_at")]
45153            created_at: i64,
45154            #[serde(rename = "upload_id")]
45155            upload_id: String,
45156            #[serde(rename = "object")]
45157            #[allow(dead_code)]
45158            object: crate::__types::upload_part::Object,
45159        }
45160        let UploadPart {
45161            id,
45162            created_at,
45163            upload_id,
45164            ..
45165        } = UploadPart::deserialize(deserializer)?;
45166        Ok(Self {
45167            id,
45168            created_at,
45169            upload_id,
45170        })
45171    }
45172}
45173impl serde::Serialize for UploadPart {
45174    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
45175    where
45176        S: serde::Serializer,
45177    {
45178        #[serde_with::serde_as]
45179        #[derive(serde :: Serialize)]
45180        struct UploadPart<'a> {
45181            #[serde(rename = "id")]
45182            id: &'a String,
45183            #[serde(rename = "created_at")]
45184            created_at: &'a i64,
45185            #[serde(rename = "upload_id")]
45186            upload_id: &'a String,
45187            #[serde(rename = "object")]
45188            object: &'a crate::__types::upload_part::Object,
45189        }
45190        let Self {
45191            id,
45192            created_at,
45193            upload_id,
45194        } = self;
45195        UploadPart {
45196            id,
45197            created_at,
45198            upload_id,
45199            object: &Default::default(),
45200        }
45201        .serialize(serializer)
45202    }
45203}
45204#[allow(clippy::module_inception)]
45205pub(crate) mod usage_audio_speeches_result {
45206    #[doc = "organization.usage.audio_speeches.result"]
45207    #[derive(Clone, Copy, Debug, Default, PartialEq)]
45208    pub(crate) struct Object;
45209    impl_serde!(Object, "organization.usage.audio_speeches.result");
45210}
45211#[doc = "The aggregated audio speeches usage details of the specific time bucket."]
45212#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
45213pub struct UsageAudioSpeechesResult {
45214    #[doc = "The number of characters processed."]
45215    pub characters: i64,
45216    #[doc = "The count of requests made to the model."]
45217    pub num_model_requests: i64,
45218    #[doc = "When `group_by=project_id`, this field provides the project ID of the grouped usage result."]
45219    #[builder(default)]
45220    pub project_id: Option<String>,
45221    #[doc = "When `group_by=user_id`, this field provides the user ID of the grouped usage result."]
45222    #[builder(default)]
45223    pub user_id: Option<String>,
45224    #[doc = "When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result."]
45225    #[builder(default)]
45226    pub api_key_id: Option<String>,
45227    #[doc = "When `group_by=model`, this field provides the model name of the grouped usage result."]
45228    #[builder(default)]
45229    pub model: Option<String>,
45230}
45231impl<'de> serde::Deserialize<'de> for UsageAudioSpeechesResult {
45232    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
45233    where
45234        D: serde::Deserializer<'de>,
45235    {
45236        #[serde_with::serde_as]
45237        #[derive(serde :: Deserialize)]
45238        struct UsageAudioSpeechesResult {
45239            #[serde(rename = "object")]
45240            #[allow(dead_code)]
45241            object: crate::__types::usage_audio_speeches_result::Object,
45242            #[serde(rename = "characters")]
45243            characters: i64,
45244            #[serde(rename = "num_model_requests")]
45245            num_model_requests: i64,
45246            #[serde(rename = "project_id")]
45247            project_id: Option<String>,
45248            #[serde(rename = "user_id")]
45249            user_id: Option<String>,
45250            #[serde(rename = "api_key_id")]
45251            api_key_id: Option<String>,
45252            #[serde(rename = "model")]
45253            model: Option<String>,
45254        }
45255        let UsageAudioSpeechesResult {
45256            characters,
45257            num_model_requests,
45258            project_id,
45259            user_id,
45260            api_key_id,
45261            model,
45262            ..
45263        } = UsageAudioSpeechesResult::deserialize(deserializer)?;
45264        Ok(Self {
45265            characters,
45266            num_model_requests,
45267            project_id,
45268            user_id,
45269            api_key_id,
45270            model,
45271        })
45272    }
45273}
45274impl serde::Serialize for UsageAudioSpeechesResult {
45275    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
45276    where
45277        S: serde::Serializer,
45278    {
45279        #[serde_with::serde_as]
45280        #[derive(serde :: Serialize)]
45281        struct UsageAudioSpeechesResult<'a> {
45282            #[serde(rename = "object")]
45283            object: &'a crate::__types::usage_audio_speeches_result::Object,
45284            #[serde(rename = "characters")]
45285            characters: &'a i64,
45286            #[serde(rename = "num_model_requests")]
45287            num_model_requests: &'a i64,
45288            #[serde(rename = "project_id")]
45289            #[serde(skip_serializing_if = "Option::is_none")]
45290            project_id: &'a Option<String>,
45291            #[serde(rename = "user_id")]
45292            #[serde(skip_serializing_if = "Option::is_none")]
45293            user_id: &'a Option<String>,
45294            #[serde(rename = "api_key_id")]
45295            #[serde(skip_serializing_if = "Option::is_none")]
45296            api_key_id: &'a Option<String>,
45297            #[serde(rename = "model")]
45298            #[serde(skip_serializing_if = "Option::is_none")]
45299            model: &'a Option<String>,
45300        }
45301        let Self {
45302            characters,
45303            num_model_requests,
45304            project_id,
45305            user_id,
45306            api_key_id,
45307            model,
45308        } = self;
45309        UsageAudioSpeechesResult {
45310            object: &Default::default(),
45311            characters,
45312            num_model_requests,
45313            project_id,
45314            user_id,
45315            api_key_id,
45316            model,
45317        }
45318        .serialize(serializer)
45319    }
45320}
45321#[allow(clippy::module_inception)]
45322pub(crate) mod usage_audio_transcriptions_result {
45323    #[doc = "organization.usage.audio_transcriptions.result"]
45324    #[derive(Clone, Copy, Debug, Default, PartialEq)]
45325    pub(crate) struct Object;
45326    impl_serde!(Object, "organization.usage.audio_transcriptions.result");
45327}
45328#[doc = "The aggregated audio transcriptions usage details of the specific time bucket."]
45329#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
45330pub struct UsageAudioTranscriptionsResult {
45331    #[doc = "The number of seconds processed."]
45332    pub seconds: i64,
45333    #[doc = "The count of requests made to the model."]
45334    pub num_model_requests: i64,
45335    #[doc = "When `group_by=project_id`, this field provides the project ID of the grouped usage result."]
45336    #[builder(default)]
45337    pub project_id: Option<String>,
45338    #[doc = "When `group_by=user_id`, this field provides the user ID of the grouped usage result."]
45339    #[builder(default)]
45340    pub user_id: Option<String>,
45341    #[doc = "When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result."]
45342    #[builder(default)]
45343    pub api_key_id: Option<String>,
45344    #[doc = "When `group_by=model`, this field provides the model name of the grouped usage result."]
45345    #[builder(default)]
45346    pub model: Option<String>,
45347}
45348impl<'de> serde::Deserialize<'de> for UsageAudioTranscriptionsResult {
45349    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
45350    where
45351        D: serde::Deserializer<'de>,
45352    {
45353        #[serde_with::serde_as]
45354        #[derive(serde :: Deserialize)]
45355        struct UsageAudioTranscriptionsResult {
45356            #[serde(rename = "object")]
45357            #[allow(dead_code)]
45358            object: crate::__types::usage_audio_transcriptions_result::Object,
45359            #[serde(rename = "seconds")]
45360            seconds: i64,
45361            #[serde(rename = "num_model_requests")]
45362            num_model_requests: i64,
45363            #[serde(rename = "project_id")]
45364            project_id: Option<String>,
45365            #[serde(rename = "user_id")]
45366            user_id: Option<String>,
45367            #[serde(rename = "api_key_id")]
45368            api_key_id: Option<String>,
45369            #[serde(rename = "model")]
45370            model: Option<String>,
45371        }
45372        let UsageAudioTranscriptionsResult {
45373            seconds,
45374            num_model_requests,
45375            project_id,
45376            user_id,
45377            api_key_id,
45378            model,
45379            ..
45380        } = UsageAudioTranscriptionsResult::deserialize(deserializer)?;
45381        Ok(Self {
45382            seconds,
45383            num_model_requests,
45384            project_id,
45385            user_id,
45386            api_key_id,
45387            model,
45388        })
45389    }
45390}
45391impl serde::Serialize for UsageAudioTranscriptionsResult {
45392    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
45393    where
45394        S: serde::Serializer,
45395    {
45396        #[serde_with::serde_as]
45397        #[derive(serde :: Serialize)]
45398        struct UsageAudioTranscriptionsResult<'a> {
45399            #[serde(rename = "object")]
45400            object: &'a crate::__types::usage_audio_transcriptions_result::Object,
45401            #[serde(rename = "seconds")]
45402            seconds: &'a i64,
45403            #[serde(rename = "num_model_requests")]
45404            num_model_requests: &'a i64,
45405            #[serde(rename = "project_id")]
45406            #[serde(skip_serializing_if = "Option::is_none")]
45407            project_id: &'a Option<String>,
45408            #[serde(rename = "user_id")]
45409            #[serde(skip_serializing_if = "Option::is_none")]
45410            user_id: &'a Option<String>,
45411            #[serde(rename = "api_key_id")]
45412            #[serde(skip_serializing_if = "Option::is_none")]
45413            api_key_id: &'a Option<String>,
45414            #[serde(rename = "model")]
45415            #[serde(skip_serializing_if = "Option::is_none")]
45416            model: &'a Option<String>,
45417        }
45418        let Self {
45419            seconds,
45420            num_model_requests,
45421            project_id,
45422            user_id,
45423            api_key_id,
45424            model,
45425        } = self;
45426        UsageAudioTranscriptionsResult {
45427            object: &Default::default(),
45428            seconds,
45429            num_model_requests,
45430            project_id,
45431            user_id,
45432            api_key_id,
45433            model,
45434        }
45435        .serialize(serializer)
45436    }
45437}
45438#[allow(clippy::module_inception)]
45439pub(crate) mod usage_code_interpreter_sessions_result {
45440    #[doc = "organization.usage.code_interpreter_sessions.result"]
45441    #[derive(Clone, Copy, Debug, Default, PartialEq)]
45442    pub(crate) struct Object;
45443    impl_serde!(
45444        Object,
45445        "organization.usage.code_interpreter_sessions.result"
45446    );
45447}
45448#[doc = "The aggregated code interpreter sessions usage details of the specific time bucket."]
45449#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
45450pub struct UsageCodeInterpreterSessionsResult {
45451    #[doc = "The number of code interpreter sessions."]
45452    #[builder(default)]
45453    pub num_sessions: Option<i64>,
45454    #[doc = "When `group_by=project_id`, this field provides the project ID of the grouped usage result."]
45455    #[builder(default)]
45456    pub project_id: Option<String>,
45457    pub sessions: serde_json::Value,
45458}
45459impl<'de> serde::Deserialize<'de> for UsageCodeInterpreterSessionsResult {
45460    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
45461    where
45462        D: serde::Deserializer<'de>,
45463    {
45464        #[serde_with::serde_as]
45465        #[derive(serde :: Deserialize)]
45466        struct UsageCodeInterpreterSessionsResult {
45467            #[serde(rename = "object")]
45468            #[allow(dead_code)]
45469            object: crate::__types::usage_code_interpreter_sessions_result::Object,
45470            #[serde(rename = "num_sessions")]
45471            num_sessions: Option<i64>,
45472            #[serde(rename = "project_id")]
45473            project_id: Option<String>,
45474            #[serde(rename = "sessions")]
45475            sessions: serde_json::Value,
45476        }
45477        let UsageCodeInterpreterSessionsResult {
45478            num_sessions,
45479            project_id,
45480            sessions,
45481            ..
45482        } = UsageCodeInterpreterSessionsResult::deserialize(deserializer)?;
45483        Ok(Self {
45484            num_sessions,
45485            project_id,
45486            sessions,
45487        })
45488    }
45489}
45490impl serde::Serialize for UsageCodeInterpreterSessionsResult {
45491    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
45492    where
45493        S: serde::Serializer,
45494    {
45495        #[serde_with::serde_as]
45496        #[derive(serde :: Serialize)]
45497        struct UsageCodeInterpreterSessionsResult<'a> {
45498            #[serde(rename = "object")]
45499            object: &'a crate::__types::usage_code_interpreter_sessions_result::Object,
45500            #[serde(rename = "num_sessions")]
45501            #[serde(skip_serializing_if = "Option::is_none")]
45502            num_sessions: &'a Option<i64>,
45503            #[serde(rename = "project_id")]
45504            #[serde(skip_serializing_if = "Option::is_none")]
45505            project_id: &'a Option<String>,
45506            #[serde(rename = "sessions")]
45507            sessions: &'a serde_json::Value,
45508        }
45509        let Self {
45510            num_sessions,
45511            project_id,
45512            sessions,
45513        } = self;
45514        UsageCodeInterpreterSessionsResult {
45515            object: &Default::default(),
45516            num_sessions,
45517            project_id,
45518            sessions,
45519        }
45520        .serialize(serializer)
45521    }
45522}
45523#[allow(clippy::module_inception)]
45524pub(crate) mod usage_completions_result {
45525    #[doc = "organization.usage.completions.result"]
45526    #[derive(Clone, Copy, Debug, Default, PartialEq)]
45527    pub(crate) struct Object;
45528    impl_serde!(Object, "organization.usage.completions.result");
45529}
45530#[doc = "The aggregated completions usage details of the specific time bucket."]
45531#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
45532pub struct UsageCompletionsResult {
45533    #[doc = "The aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens."]
45534    pub input_tokens: i64,
45535    #[doc = "The aggregated number of text input tokens that has been cached from previous requests. For customers subscribe to scale tier, this includes scale tier tokens."]
45536    #[builder(default)]
45537    pub input_cached_tokens: Option<i64>,
45538    #[doc = "The aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens."]
45539    pub output_tokens: i64,
45540    #[doc = "The aggregated number of audio input tokens used, including cached tokens."]
45541    #[builder(default)]
45542    pub input_audio_tokens: Option<i64>,
45543    #[doc = "The aggregated number of audio output tokens used."]
45544    #[builder(default)]
45545    pub output_audio_tokens: Option<i64>,
45546    #[doc = "The count of requests made to the model."]
45547    pub num_model_requests: i64,
45548    #[doc = "When `group_by=project_id`, this field provides the project ID of the grouped usage result."]
45549    #[builder(default)]
45550    pub project_id: Option<String>,
45551    #[doc = "When `group_by=user_id`, this field provides the user ID of the grouped usage result."]
45552    #[builder(default)]
45553    pub user_id: Option<String>,
45554    #[doc = "When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result."]
45555    #[builder(default)]
45556    pub api_key_id: Option<String>,
45557    #[doc = "When `group_by=model`, this field provides the model name of the grouped usage result."]
45558    #[builder(default)]
45559    pub model: Option<String>,
45560    #[doc = "When `group_by=batch`, this field tells whether the grouped usage result is batch or not."]
45561    #[builder(default)]
45562    pub batch: Option<bool>,
45563}
45564impl<'de> serde::Deserialize<'de> for UsageCompletionsResult {
45565    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
45566    where
45567        D: serde::Deserializer<'de>,
45568    {
45569        #[serde_with::serde_as]
45570        #[derive(serde :: Deserialize)]
45571        struct UsageCompletionsResult {
45572            #[serde(rename = "object")]
45573            #[allow(dead_code)]
45574            object: crate::__types::usage_completions_result::Object,
45575            #[serde(rename = "input_tokens")]
45576            input_tokens: i64,
45577            #[serde(rename = "input_cached_tokens")]
45578            input_cached_tokens: Option<i64>,
45579            #[serde(rename = "output_tokens")]
45580            output_tokens: i64,
45581            #[serde(rename = "input_audio_tokens")]
45582            input_audio_tokens: Option<i64>,
45583            #[serde(rename = "output_audio_tokens")]
45584            output_audio_tokens: Option<i64>,
45585            #[serde(rename = "num_model_requests")]
45586            num_model_requests: i64,
45587            #[serde(rename = "project_id")]
45588            project_id: Option<String>,
45589            #[serde(rename = "user_id")]
45590            user_id: Option<String>,
45591            #[serde(rename = "api_key_id")]
45592            api_key_id: Option<String>,
45593            #[serde(rename = "model")]
45594            model: Option<String>,
45595            #[serde(rename = "batch")]
45596            batch: Option<bool>,
45597        }
45598        let UsageCompletionsResult {
45599            input_tokens,
45600            input_cached_tokens,
45601            output_tokens,
45602            input_audio_tokens,
45603            output_audio_tokens,
45604            num_model_requests,
45605            project_id,
45606            user_id,
45607            api_key_id,
45608            model,
45609            batch,
45610            ..
45611        } = UsageCompletionsResult::deserialize(deserializer)?;
45612        Ok(Self {
45613            input_tokens,
45614            input_cached_tokens,
45615            output_tokens,
45616            input_audio_tokens,
45617            output_audio_tokens,
45618            num_model_requests,
45619            project_id,
45620            user_id,
45621            api_key_id,
45622            model,
45623            batch,
45624        })
45625    }
45626}
45627impl serde::Serialize for UsageCompletionsResult {
45628    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
45629    where
45630        S: serde::Serializer,
45631    {
45632        #[serde_with::serde_as]
45633        #[derive(serde :: Serialize)]
45634        struct UsageCompletionsResult<'a> {
45635            #[serde(rename = "object")]
45636            object: &'a crate::__types::usage_completions_result::Object,
45637            #[serde(rename = "input_tokens")]
45638            input_tokens: &'a i64,
45639            #[serde(rename = "input_cached_tokens")]
45640            #[serde(skip_serializing_if = "Option::is_none")]
45641            input_cached_tokens: &'a Option<i64>,
45642            #[serde(rename = "output_tokens")]
45643            output_tokens: &'a i64,
45644            #[serde(rename = "input_audio_tokens")]
45645            #[serde(skip_serializing_if = "Option::is_none")]
45646            input_audio_tokens: &'a Option<i64>,
45647            #[serde(rename = "output_audio_tokens")]
45648            #[serde(skip_serializing_if = "Option::is_none")]
45649            output_audio_tokens: &'a Option<i64>,
45650            #[serde(rename = "num_model_requests")]
45651            num_model_requests: &'a i64,
45652            #[serde(rename = "project_id")]
45653            #[serde(skip_serializing_if = "Option::is_none")]
45654            project_id: &'a Option<String>,
45655            #[serde(rename = "user_id")]
45656            #[serde(skip_serializing_if = "Option::is_none")]
45657            user_id: &'a Option<String>,
45658            #[serde(rename = "api_key_id")]
45659            #[serde(skip_serializing_if = "Option::is_none")]
45660            api_key_id: &'a Option<String>,
45661            #[serde(rename = "model")]
45662            #[serde(skip_serializing_if = "Option::is_none")]
45663            model: &'a Option<String>,
45664            #[serde(rename = "batch")]
45665            #[serde(skip_serializing_if = "Option::is_none")]
45666            batch: &'a Option<bool>,
45667        }
45668        let Self {
45669            input_tokens,
45670            input_cached_tokens,
45671            output_tokens,
45672            input_audio_tokens,
45673            output_audio_tokens,
45674            num_model_requests,
45675            project_id,
45676            user_id,
45677            api_key_id,
45678            model,
45679            batch,
45680        } = self;
45681        UsageCompletionsResult {
45682            object: &Default::default(),
45683            input_tokens,
45684            input_cached_tokens,
45685            output_tokens,
45686            input_audio_tokens,
45687            output_audio_tokens,
45688            num_model_requests,
45689            project_id,
45690            user_id,
45691            api_key_id,
45692            model,
45693            batch,
45694        }
45695        .serialize(serializer)
45696    }
45697}
45698#[allow(clippy::module_inception)]
45699pub(crate) mod usage_embeddings_result {
45700    #[doc = "organization.usage.embeddings.result"]
45701    #[derive(Clone, Copy, Debug, Default, PartialEq)]
45702    pub(crate) struct Object;
45703    impl_serde!(Object, "organization.usage.embeddings.result");
45704}
45705#[doc = "The aggregated embeddings usage details of the specific time bucket."]
45706#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
45707pub struct UsageEmbeddingsResult {
45708    #[doc = "The aggregated number of input tokens used."]
45709    pub input_tokens: i64,
45710    #[doc = "The count of requests made to the model."]
45711    pub num_model_requests: i64,
45712    #[doc = "When `group_by=project_id`, this field provides the project ID of the grouped usage result."]
45713    #[builder(default)]
45714    pub project_id: Option<String>,
45715    #[doc = "When `group_by=user_id`, this field provides the user ID of the grouped usage result."]
45716    #[builder(default)]
45717    pub user_id: Option<String>,
45718    #[doc = "When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result."]
45719    #[builder(default)]
45720    pub api_key_id: Option<String>,
45721    #[doc = "When `group_by=model`, this field provides the model name of the grouped usage result."]
45722    #[builder(default)]
45723    pub model: Option<String>,
45724}
45725impl<'de> serde::Deserialize<'de> for UsageEmbeddingsResult {
45726    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
45727    where
45728        D: serde::Deserializer<'de>,
45729    {
45730        #[serde_with::serde_as]
45731        #[derive(serde :: Deserialize)]
45732        struct UsageEmbeddingsResult {
45733            #[serde(rename = "object")]
45734            #[allow(dead_code)]
45735            object: crate::__types::usage_embeddings_result::Object,
45736            #[serde(rename = "input_tokens")]
45737            input_tokens: i64,
45738            #[serde(rename = "num_model_requests")]
45739            num_model_requests: i64,
45740            #[serde(rename = "project_id")]
45741            project_id: Option<String>,
45742            #[serde(rename = "user_id")]
45743            user_id: Option<String>,
45744            #[serde(rename = "api_key_id")]
45745            api_key_id: Option<String>,
45746            #[serde(rename = "model")]
45747            model: Option<String>,
45748        }
45749        let UsageEmbeddingsResult {
45750            input_tokens,
45751            num_model_requests,
45752            project_id,
45753            user_id,
45754            api_key_id,
45755            model,
45756            ..
45757        } = UsageEmbeddingsResult::deserialize(deserializer)?;
45758        Ok(Self {
45759            input_tokens,
45760            num_model_requests,
45761            project_id,
45762            user_id,
45763            api_key_id,
45764            model,
45765        })
45766    }
45767}
45768impl serde::Serialize for UsageEmbeddingsResult {
45769    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
45770    where
45771        S: serde::Serializer,
45772    {
45773        #[serde_with::serde_as]
45774        #[derive(serde :: Serialize)]
45775        struct UsageEmbeddingsResult<'a> {
45776            #[serde(rename = "object")]
45777            object: &'a crate::__types::usage_embeddings_result::Object,
45778            #[serde(rename = "input_tokens")]
45779            input_tokens: &'a i64,
45780            #[serde(rename = "num_model_requests")]
45781            num_model_requests: &'a i64,
45782            #[serde(rename = "project_id")]
45783            #[serde(skip_serializing_if = "Option::is_none")]
45784            project_id: &'a Option<String>,
45785            #[serde(rename = "user_id")]
45786            #[serde(skip_serializing_if = "Option::is_none")]
45787            user_id: &'a Option<String>,
45788            #[serde(rename = "api_key_id")]
45789            #[serde(skip_serializing_if = "Option::is_none")]
45790            api_key_id: &'a Option<String>,
45791            #[serde(rename = "model")]
45792            #[serde(skip_serializing_if = "Option::is_none")]
45793            model: &'a Option<String>,
45794        }
45795        let Self {
45796            input_tokens,
45797            num_model_requests,
45798            project_id,
45799            user_id,
45800            api_key_id,
45801            model,
45802        } = self;
45803        UsageEmbeddingsResult {
45804            object: &Default::default(),
45805            input_tokens,
45806            num_model_requests,
45807            project_id,
45808            user_id,
45809            api_key_id,
45810            model,
45811        }
45812        .serialize(serializer)
45813    }
45814}
45815#[allow(clippy::module_inception)]
45816pub(crate) mod usage_images_result {
45817    #[doc = "organization.usage.images.result"]
45818    #[derive(Clone, Copy, Debug, Default, PartialEq)]
45819    pub(crate) struct Object;
45820    impl_serde!(Object, "organization.usage.images.result");
45821}
45822#[doc = "The aggregated images usage details of the specific time bucket."]
45823#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
45824pub struct UsageImagesResult {
45825    #[doc = "The number of images processed."]
45826    pub images: i64,
45827    #[doc = "The count of requests made to the model."]
45828    pub num_model_requests: i64,
45829    #[doc = "When `group_by=source`, this field provides the source of the grouped usage result, possible values are `image.generation`, `image.edit`, `image.variation`."]
45830    #[builder(default)]
45831    pub source: Option<String>,
45832    #[doc = "When `group_by=size`, this field provides the image size of the grouped usage result."]
45833    #[builder(default)]
45834    pub size: Option<String>,
45835    #[doc = "When `group_by=project_id`, this field provides the project ID of the grouped usage result."]
45836    #[builder(default)]
45837    pub project_id: Option<String>,
45838    #[doc = "When `group_by=user_id`, this field provides the user ID of the grouped usage result."]
45839    #[builder(default)]
45840    pub user_id: Option<String>,
45841    #[doc = "When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result."]
45842    #[builder(default)]
45843    pub api_key_id: Option<String>,
45844    #[doc = "When `group_by=model`, this field provides the model name of the grouped usage result."]
45845    #[builder(default)]
45846    pub model: Option<String>,
45847}
45848impl<'de> serde::Deserialize<'de> for UsageImagesResult {
45849    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
45850    where
45851        D: serde::Deserializer<'de>,
45852    {
45853        #[serde_with::serde_as]
45854        #[derive(serde :: Deserialize)]
45855        struct UsageImagesResult {
45856            #[serde(rename = "object")]
45857            #[allow(dead_code)]
45858            object: crate::__types::usage_images_result::Object,
45859            #[serde(rename = "images")]
45860            images: i64,
45861            #[serde(rename = "num_model_requests")]
45862            num_model_requests: i64,
45863            #[serde(rename = "source")]
45864            source: Option<String>,
45865            #[serde(rename = "size")]
45866            size: Option<String>,
45867            #[serde(rename = "project_id")]
45868            project_id: Option<String>,
45869            #[serde(rename = "user_id")]
45870            user_id: Option<String>,
45871            #[serde(rename = "api_key_id")]
45872            api_key_id: Option<String>,
45873            #[serde(rename = "model")]
45874            model: Option<String>,
45875        }
45876        let UsageImagesResult {
45877            images,
45878            num_model_requests,
45879            source,
45880            size,
45881            project_id,
45882            user_id,
45883            api_key_id,
45884            model,
45885            ..
45886        } = UsageImagesResult::deserialize(deserializer)?;
45887        Ok(Self {
45888            images,
45889            num_model_requests,
45890            source,
45891            size,
45892            project_id,
45893            user_id,
45894            api_key_id,
45895            model,
45896        })
45897    }
45898}
45899impl serde::Serialize for UsageImagesResult {
45900    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
45901    where
45902        S: serde::Serializer,
45903    {
45904        #[serde_with::serde_as]
45905        #[derive(serde :: Serialize)]
45906        struct UsageImagesResult<'a> {
45907            #[serde(rename = "object")]
45908            object: &'a crate::__types::usage_images_result::Object,
45909            #[serde(rename = "images")]
45910            images: &'a i64,
45911            #[serde(rename = "num_model_requests")]
45912            num_model_requests: &'a i64,
45913            #[serde(rename = "source")]
45914            #[serde(skip_serializing_if = "Option::is_none")]
45915            source: &'a Option<String>,
45916            #[serde(rename = "size")]
45917            #[serde(skip_serializing_if = "Option::is_none")]
45918            size: &'a Option<String>,
45919            #[serde(rename = "project_id")]
45920            #[serde(skip_serializing_if = "Option::is_none")]
45921            project_id: &'a Option<String>,
45922            #[serde(rename = "user_id")]
45923            #[serde(skip_serializing_if = "Option::is_none")]
45924            user_id: &'a Option<String>,
45925            #[serde(rename = "api_key_id")]
45926            #[serde(skip_serializing_if = "Option::is_none")]
45927            api_key_id: &'a Option<String>,
45928            #[serde(rename = "model")]
45929            #[serde(skip_serializing_if = "Option::is_none")]
45930            model: &'a Option<String>,
45931        }
45932        let Self {
45933            images,
45934            num_model_requests,
45935            source,
45936            size,
45937            project_id,
45938            user_id,
45939            api_key_id,
45940            model,
45941        } = self;
45942        UsageImagesResult {
45943            object: &Default::default(),
45944            images,
45945            num_model_requests,
45946            source,
45947            size,
45948            project_id,
45949            user_id,
45950            api_key_id,
45951            model,
45952        }
45953        .serialize(serializer)
45954    }
45955}
45956#[allow(clippy::module_inception)]
45957pub(crate) mod usage_moderations_result {
45958    #[doc = "organization.usage.moderations.result"]
45959    #[derive(Clone, Copy, Debug, Default, PartialEq)]
45960    pub(crate) struct Object;
45961    impl_serde!(Object, "organization.usage.moderations.result");
45962}
45963#[doc = "The aggregated moderations usage details of the specific time bucket."]
45964#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
45965pub struct UsageModerationsResult {
45966    #[doc = "The aggregated number of input tokens used."]
45967    pub input_tokens: i64,
45968    #[doc = "The count of requests made to the model."]
45969    pub num_model_requests: i64,
45970    #[doc = "When `group_by=project_id`, this field provides the project ID of the grouped usage result."]
45971    #[builder(default)]
45972    pub project_id: Option<String>,
45973    #[doc = "When `group_by=user_id`, this field provides the user ID of the grouped usage result."]
45974    #[builder(default)]
45975    pub user_id: Option<String>,
45976    #[doc = "When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result."]
45977    #[builder(default)]
45978    pub api_key_id: Option<String>,
45979    #[doc = "When `group_by=model`, this field provides the model name of the grouped usage result."]
45980    #[builder(default)]
45981    pub model: Option<String>,
45982}
45983impl<'de> serde::Deserialize<'de> for UsageModerationsResult {
45984    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
45985    where
45986        D: serde::Deserializer<'de>,
45987    {
45988        #[serde_with::serde_as]
45989        #[derive(serde :: Deserialize)]
45990        struct UsageModerationsResult {
45991            #[serde(rename = "object")]
45992            #[allow(dead_code)]
45993            object: crate::__types::usage_moderations_result::Object,
45994            #[serde(rename = "input_tokens")]
45995            input_tokens: i64,
45996            #[serde(rename = "num_model_requests")]
45997            num_model_requests: i64,
45998            #[serde(rename = "project_id")]
45999            project_id: Option<String>,
46000            #[serde(rename = "user_id")]
46001            user_id: Option<String>,
46002            #[serde(rename = "api_key_id")]
46003            api_key_id: Option<String>,
46004            #[serde(rename = "model")]
46005            model: Option<String>,
46006        }
46007        let UsageModerationsResult {
46008            input_tokens,
46009            num_model_requests,
46010            project_id,
46011            user_id,
46012            api_key_id,
46013            model,
46014            ..
46015        } = UsageModerationsResult::deserialize(deserializer)?;
46016        Ok(Self {
46017            input_tokens,
46018            num_model_requests,
46019            project_id,
46020            user_id,
46021            api_key_id,
46022            model,
46023        })
46024    }
46025}
46026impl serde::Serialize for UsageModerationsResult {
46027    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
46028    where
46029        S: serde::Serializer,
46030    {
46031        #[serde_with::serde_as]
46032        #[derive(serde :: Serialize)]
46033        struct UsageModerationsResult<'a> {
46034            #[serde(rename = "object")]
46035            object: &'a crate::__types::usage_moderations_result::Object,
46036            #[serde(rename = "input_tokens")]
46037            input_tokens: &'a i64,
46038            #[serde(rename = "num_model_requests")]
46039            num_model_requests: &'a i64,
46040            #[serde(rename = "project_id")]
46041            #[serde(skip_serializing_if = "Option::is_none")]
46042            project_id: &'a Option<String>,
46043            #[serde(rename = "user_id")]
46044            #[serde(skip_serializing_if = "Option::is_none")]
46045            user_id: &'a Option<String>,
46046            #[serde(rename = "api_key_id")]
46047            #[serde(skip_serializing_if = "Option::is_none")]
46048            api_key_id: &'a Option<String>,
46049            #[serde(rename = "model")]
46050            #[serde(skip_serializing_if = "Option::is_none")]
46051            model: &'a Option<String>,
46052        }
46053        let Self {
46054            input_tokens,
46055            num_model_requests,
46056            project_id,
46057            user_id,
46058            api_key_id,
46059            model,
46060        } = self;
46061        UsageModerationsResult {
46062            object: &Default::default(),
46063            input_tokens,
46064            num_model_requests,
46065            project_id,
46066            user_id,
46067            api_key_id,
46068            model,
46069        }
46070        .serialize(serializer)
46071    }
46072}
46073#[allow(clippy::module_inception)]
46074pub(crate) mod usage_response {
46075    #[doc = "page"]
46076    #[derive(Clone, Copy, Debug, Default, PartialEq)]
46077    pub(crate) struct Object;
46078    impl_serde!(Object, "page");
46079}
46080#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
46081pub struct UsageResponse {
46082    pub data: Vec<crate::__types::UsageTimeBucket>,
46083    pub has_more: bool,
46084    pub next_page: String,
46085}
46086impl<'de> serde::Deserialize<'de> for UsageResponse {
46087    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
46088    where
46089        D: serde::Deserializer<'de>,
46090    {
46091        #[serde_with::serde_as]
46092        #[derive(serde :: Deserialize)]
46093        struct UsageResponse {
46094            #[serde(rename = "object")]
46095            #[allow(dead_code)]
46096            object: crate::__types::usage_response::Object,
46097            #[serde(rename = "data")]
46098            data: Vec<crate::__types::UsageTimeBucket>,
46099            #[serde(rename = "has_more")]
46100            has_more: bool,
46101            #[serde(rename = "next_page")]
46102            next_page: String,
46103        }
46104        let UsageResponse {
46105            data,
46106            has_more,
46107            next_page,
46108            ..
46109        } = UsageResponse::deserialize(deserializer)?;
46110        Ok(Self {
46111            data,
46112            has_more,
46113            next_page,
46114        })
46115    }
46116}
46117impl serde::Serialize for UsageResponse {
46118    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
46119    where
46120        S: serde::Serializer,
46121    {
46122        #[serde_with::serde_as]
46123        #[derive(serde :: Serialize)]
46124        struct UsageResponse<'a> {
46125            #[serde(rename = "object")]
46126            object: &'a crate::__types::usage_response::Object,
46127            #[serde(rename = "data")]
46128            data: &'a Vec<crate::__types::UsageTimeBucket>,
46129            #[serde(rename = "has_more")]
46130            has_more: &'a bool,
46131            #[serde(rename = "next_page")]
46132            next_page: &'a String,
46133        }
46134        let Self {
46135            data,
46136            has_more,
46137            next_page,
46138        } = self;
46139        UsageResponse {
46140            object: &Default::default(),
46141            data,
46142            has_more,
46143            next_page,
46144        }
46145        .serialize(serializer)
46146    }
46147}
46148#[allow(clippy::module_inception)]
46149pub mod usage_time_bucket {
46150    #[doc = "bucket"]
46151    #[derive(Clone, Copy, Debug, Default, PartialEq)]
46152    pub(crate) struct Object;
46153    impl_serde!(Object, "bucket");
46154    #[allow(clippy::module_inception)]
46155    pub mod result {
46156        #[derive(Clone, Debug, PartialEq)]
46157        #[serde_with::serde_as]
46158        #[derive(serde :: Deserialize, serde :: Serialize)]
46159        #[serde(untagged)]
46160        #[allow(clippy::large_enum_variant)]
46161        pub enum Item {
46162            OrganizationUsageCompletionsResult(crate::__types::UsageCompletionsResult),
46163            OrganizationUsageEmbeddingsResult(crate::__types::UsageEmbeddingsResult),
46164            OrganizationUsageModerationsResult(crate::__types::UsageModerationsResult),
46165            OrganizationUsageImagesResult(crate::__types::UsageImagesResult),
46166            OrganizationUsageAudioSpeechesResult(crate::__types::UsageAudioSpeechesResult),
46167            OrganizationUsageAudioTranscriptionsResult(
46168                crate::__types::UsageAudioTranscriptionsResult,
46169            ),
46170            OrganizationUsageVectorStoresResult(crate::__types::UsageVectorStoresResult),
46171            OrganizationUsageCodeInterpreterSessionsResult(
46172                crate::__types::UsageCodeInterpreterSessionsResult,
46173            ),
46174            OrganizationCostsResult(crate::__types::CostsResult),
46175        }
46176    }
46177}
46178#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
46179pub struct UsageTimeBucket {
46180    pub start_time: i64,
46181    pub end_time: i64,
46182    pub result: Vec<crate::__types::usage_time_bucket::result::Item>,
46183}
46184impl<'de> serde::Deserialize<'de> for UsageTimeBucket {
46185    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
46186    where
46187        D: serde::Deserializer<'de>,
46188    {
46189        #[serde_with::serde_as]
46190        #[derive(serde :: Deserialize)]
46191        struct UsageTimeBucket {
46192            #[serde(rename = "object")]
46193            #[allow(dead_code)]
46194            object: crate::__types::usage_time_bucket::Object,
46195            #[serde(rename = "start_time")]
46196            start_time: i64,
46197            #[serde(rename = "end_time")]
46198            end_time: i64,
46199            #[serde(rename = "result")]
46200            result: Vec<crate::__types::usage_time_bucket::result::Item>,
46201        }
46202        let UsageTimeBucket {
46203            start_time,
46204            end_time,
46205            result,
46206            ..
46207        } = UsageTimeBucket::deserialize(deserializer)?;
46208        Ok(Self {
46209            start_time,
46210            end_time,
46211            result,
46212        })
46213    }
46214}
46215impl serde::Serialize for UsageTimeBucket {
46216    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
46217    where
46218        S: serde::Serializer,
46219    {
46220        #[serde_with::serde_as]
46221        #[derive(serde :: Serialize)]
46222        struct UsageTimeBucket<'a> {
46223            #[serde(rename = "object")]
46224            object: &'a crate::__types::usage_time_bucket::Object,
46225            #[serde(rename = "start_time")]
46226            start_time: &'a i64,
46227            #[serde(rename = "end_time")]
46228            end_time: &'a i64,
46229            #[serde(rename = "result")]
46230            result: &'a Vec<crate::__types::usage_time_bucket::result::Item>,
46231        }
46232        let Self {
46233            start_time,
46234            end_time,
46235            result,
46236        } = self;
46237        UsageTimeBucket {
46238            object: &Default::default(),
46239            start_time,
46240            end_time,
46241            result,
46242        }
46243        .serialize(serializer)
46244    }
46245}
46246#[allow(clippy::module_inception)]
46247pub(crate) mod usage_vector_stores_result {
46248    #[doc = "organization.usage.vector_stores.result"]
46249    #[derive(Clone, Copy, Debug, Default, PartialEq)]
46250    pub(crate) struct Object;
46251    impl_serde!(Object, "organization.usage.vector_stores.result");
46252}
46253#[doc = "The aggregated vector stores usage details of the specific time bucket."]
46254#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
46255pub struct UsageVectorStoresResult {
46256    #[doc = "The vector stores usage in bytes."]
46257    pub usage_bytes: i64,
46258    #[doc = "When `group_by=project_id`, this field provides the project ID of the grouped usage result."]
46259    #[builder(default)]
46260    pub project_id: Option<String>,
46261}
46262impl<'de> serde::Deserialize<'de> for UsageVectorStoresResult {
46263    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
46264    where
46265        D: serde::Deserializer<'de>,
46266    {
46267        #[serde_with::serde_as]
46268        #[derive(serde :: Deserialize)]
46269        struct UsageVectorStoresResult {
46270            #[serde(rename = "object")]
46271            #[allow(dead_code)]
46272            object: crate::__types::usage_vector_stores_result::Object,
46273            #[serde(rename = "usage_bytes")]
46274            usage_bytes: i64,
46275            #[serde(rename = "project_id")]
46276            project_id: Option<String>,
46277        }
46278        let UsageVectorStoresResult {
46279            usage_bytes,
46280            project_id,
46281            ..
46282        } = UsageVectorStoresResult::deserialize(deserializer)?;
46283        Ok(Self {
46284            usage_bytes,
46285            project_id,
46286        })
46287    }
46288}
46289impl serde::Serialize for UsageVectorStoresResult {
46290    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
46291    where
46292        S: serde::Serializer,
46293    {
46294        #[serde_with::serde_as]
46295        #[derive(serde :: Serialize)]
46296        struct UsageVectorStoresResult<'a> {
46297            #[serde(rename = "object")]
46298            object: &'a crate::__types::usage_vector_stores_result::Object,
46299            #[serde(rename = "usage_bytes")]
46300            usage_bytes: &'a i64,
46301            #[serde(rename = "project_id")]
46302            #[serde(skip_serializing_if = "Option::is_none")]
46303            project_id: &'a Option<String>,
46304        }
46305        let Self {
46306            usage_bytes,
46307            project_id,
46308        } = self;
46309        UsageVectorStoresResult {
46310            object: &Default::default(),
46311            usage_bytes,
46312            project_id,
46313        }
46314        .serialize(serializer)
46315    }
46316}
46317#[allow(clippy::module_inception)]
46318pub mod user {
46319    #[doc = "The object type, which is always `organization.user`"]
46320    #[derive(Clone, Copy, Debug, Default, PartialEq)]
46321    pub(crate) struct Object;
46322    impl_serde!(Object, "organization.user");
46323    #[doc = "`owner` or `reader`"]
46324    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
46325    pub enum Role {
46326        #[doc = "`owner`"]
46327        #[serde(rename = "owner")]
46328        Owner,
46329        #[doc = "`reader`"]
46330        #[serde(rename = "reader")]
46331        Reader,
46332    }
46333}
46334#[doc = "Represents an individual `user` within an organization."]
46335#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
46336pub struct User {
46337    #[doc = "The identifier, which can be referenced in API endpoints"]
46338    pub id: String,
46339    #[doc = "The name of the user"]
46340    pub name: String,
46341    #[doc = "The email address of the user"]
46342    pub email: String,
46343    #[doc = "`owner` or `reader`"]
46344    pub role: crate::__types::user::Role,
46345    #[doc = "The Unix timestamp (in seconds) of when the user was added."]
46346    pub added_at: i64,
46347}
46348impl<'de> serde::Deserialize<'de> for User {
46349    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
46350    where
46351        D: serde::Deserializer<'de>,
46352    {
46353        #[serde_with::serde_as]
46354        #[derive(serde :: Deserialize)]
46355        struct User {
46356            #[serde(rename = "object")]
46357            #[allow(dead_code)]
46358            object: crate::__types::user::Object,
46359            #[serde(rename = "id")]
46360            id: String,
46361            #[serde(rename = "name")]
46362            name: String,
46363            #[serde(rename = "email")]
46364            email: String,
46365            #[serde(rename = "role")]
46366            role: crate::__types::user::Role,
46367            #[serde(rename = "added_at")]
46368            added_at: i64,
46369        }
46370        let User {
46371            id,
46372            name,
46373            email,
46374            role,
46375            added_at,
46376            ..
46377        } = User::deserialize(deserializer)?;
46378        Ok(Self {
46379            id,
46380            name,
46381            email,
46382            role,
46383            added_at,
46384        })
46385    }
46386}
46387impl serde::Serialize for User {
46388    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
46389    where
46390        S: serde::Serializer,
46391    {
46392        #[serde_with::serde_as]
46393        #[derive(serde :: Serialize)]
46394        struct User<'a> {
46395            #[serde(rename = "object")]
46396            object: &'a crate::__types::user::Object,
46397            #[serde(rename = "id")]
46398            id: &'a String,
46399            #[serde(rename = "name")]
46400            name: &'a String,
46401            #[serde(rename = "email")]
46402            email: &'a String,
46403            #[serde(rename = "role")]
46404            role: &'a crate::__types::user::Role,
46405            #[serde(rename = "added_at")]
46406            added_at: &'a i64,
46407        }
46408        let Self {
46409            id,
46410            name,
46411            email,
46412            role,
46413            added_at,
46414        } = self;
46415        User {
46416            object: &Default::default(),
46417            id,
46418            name,
46419            email,
46420            role,
46421            added_at,
46422        }
46423        .serialize(serializer)
46424    }
46425}
46426#[allow(clippy::module_inception)]
46427pub(crate) mod user_delete_response {
46428    #[doc = "organization.user.deleted"]
46429    #[derive(Clone, Copy, Debug, Default, PartialEq)]
46430    pub(crate) struct Object;
46431    impl_serde!(Object, "organization.user.deleted");
46432}
46433#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
46434pub struct UserDeleteResponse {
46435    pub id: String,
46436    pub deleted: bool,
46437}
46438impl<'de> serde::Deserialize<'de> for UserDeleteResponse {
46439    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
46440    where
46441        D: serde::Deserializer<'de>,
46442    {
46443        #[serde_with::serde_as]
46444        #[derive(serde :: Deserialize)]
46445        struct UserDeleteResponse {
46446            #[serde(rename = "object")]
46447            #[allow(dead_code)]
46448            object: crate::__types::user_delete_response::Object,
46449            #[serde(rename = "id")]
46450            id: String,
46451            #[serde(rename = "deleted")]
46452            deleted: bool,
46453        }
46454        let UserDeleteResponse { id, deleted, .. } = UserDeleteResponse::deserialize(deserializer)?;
46455        Ok(Self { id, deleted })
46456    }
46457}
46458impl serde::Serialize for UserDeleteResponse {
46459    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
46460    where
46461        S: serde::Serializer,
46462    {
46463        #[serde_with::serde_as]
46464        #[derive(serde :: Serialize)]
46465        struct UserDeleteResponse<'a> {
46466            #[serde(rename = "object")]
46467            object: &'a crate::__types::user_delete_response::Object,
46468            #[serde(rename = "id")]
46469            id: &'a String,
46470            #[serde(rename = "deleted")]
46471            deleted: &'a bool,
46472        }
46473        let Self { id, deleted } = self;
46474        UserDeleteResponse {
46475            object: &Default::default(),
46476            id,
46477            deleted,
46478        }
46479        .serialize(serializer)
46480    }
46481}
46482#[allow(clippy::module_inception)]
46483pub(crate) mod user_list_response {
46484    #[doc = "list"]
46485    #[derive(Clone, Copy, Debug, Default, PartialEq)]
46486    pub(crate) struct Object;
46487    impl_serde!(Object, "list");
46488}
46489#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
46490pub struct UserListResponse {
46491    pub data: Vec<crate::__types::User>,
46492    pub first_id: String,
46493    pub last_id: String,
46494    pub has_more: bool,
46495}
46496impl<'de> serde::Deserialize<'de> for UserListResponse {
46497    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
46498    where
46499        D: serde::Deserializer<'de>,
46500    {
46501        #[serde_with::serde_as]
46502        #[derive(serde :: Deserialize)]
46503        struct UserListResponse {
46504            #[serde(rename = "object")]
46505            #[allow(dead_code)]
46506            object: crate::__types::user_list_response::Object,
46507            #[serde(rename = "data")]
46508            data: Vec<crate::__types::User>,
46509            #[serde(rename = "first_id")]
46510            first_id: String,
46511            #[serde(rename = "last_id")]
46512            last_id: String,
46513            #[serde(rename = "has_more")]
46514            has_more: bool,
46515        }
46516        let UserListResponse {
46517            data,
46518            first_id,
46519            last_id,
46520            has_more,
46521            ..
46522        } = UserListResponse::deserialize(deserializer)?;
46523        Ok(Self {
46524            data,
46525            first_id,
46526            last_id,
46527            has_more,
46528        })
46529    }
46530}
46531impl serde::Serialize for UserListResponse {
46532    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
46533    where
46534        S: serde::Serializer,
46535    {
46536        #[serde_with::serde_as]
46537        #[derive(serde :: Serialize)]
46538        struct UserListResponse<'a> {
46539            #[serde(rename = "object")]
46540            object: &'a crate::__types::user_list_response::Object,
46541            #[serde(rename = "data")]
46542            data: &'a Vec<crate::__types::User>,
46543            #[serde(rename = "first_id")]
46544            first_id: &'a String,
46545            #[serde(rename = "last_id")]
46546            last_id: &'a String,
46547            #[serde(rename = "has_more")]
46548            has_more: &'a bool,
46549        }
46550        let Self {
46551            data,
46552            first_id,
46553            last_id,
46554            has_more,
46555        } = self;
46556        UserListResponse {
46557            object: &Default::default(),
46558            data,
46559            first_id,
46560            last_id,
46561            has_more,
46562        }
46563        .serialize(serializer)
46564    }
46565}
46566#[allow(clippy::module_inception)]
46567pub mod user_role_update_request {
46568    #[doc = "`owner` or `reader`"]
46569    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
46570    pub enum Role {
46571        #[doc = "`owner`"]
46572        #[serde(rename = "owner")]
46573        Owner,
46574        #[doc = "`reader`"]
46575        #[serde(rename = "reader")]
46576        Reader,
46577    }
46578}
46579#[derive(Clone, Copy, Debug, PartialEq)]
46580#[serde_with::serde_as]
46581#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
46582pub struct UserRoleUpdateRequest {
46583    #[doc = "`owner` or `reader`"]
46584    #[serde(rename = "role")]
46585    pub role: crate::__types::user_role_update_request::Role,
46586}
46587#[allow(clippy::module_inception)]
46588pub mod vad_config {
46589    #[doc = "Must be set to `server_vad` to enable manual chunking using server side VAD."]
46590    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
46591    pub enum Type {
46592        #[doc = "`server_vad`"]
46593        #[serde(rename = "server_vad")]
46594        ServerVad,
46595    }
46596}
46597#[derive(Clone, Debug, PartialEq)]
46598#[serde_with::serde_as]
46599#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
46600pub struct VadConfig {
46601    #[doc = "Must be set to `server_vad` to enable manual chunking using server side VAD."]
46602    #[serde(rename = "type")]
46603    pub r#type: crate::__types::vad_config::Type,
46604    #[doc = "Amount of audio to include before the VAD detected speech (in \nmilliseconds).\n"]
46605    #[serde(rename = "prefix_padding_ms")]
46606    #[serde(skip_serializing_if = "Option::is_none")]
46607    #[builder(default)]
46608    pub prefix_padding_ms: Option<i64>,
46609    #[doc = "Duration of silence to detect speech stop (in milliseconds).\nWith shorter values the model will respond more quickly, \nbut may jump in on short pauses from the user.\n"]
46610    #[serde(rename = "silence_duration_ms")]
46611    #[serde(skip_serializing_if = "Option::is_none")]
46612    #[builder(default)]
46613    pub silence_duration_ms: Option<i64>,
46614    #[doc = "Sensitivity threshold (0.0 to 1.0) for voice activity detection. A \nhigher threshold will require louder audio to activate the model, and \nthus might perform better in noisy environments.\n"]
46615    #[serde(rename = "threshold")]
46616    #[serde(skip_serializing_if = "Option::is_none")]
46617    #[builder(default)]
46618    pub threshold: Option<serde_json::Number>,
46619}
46620#[allow(clippy::module_inception)]
46621pub mod validate_grader_request {
46622    #[doc = "The grader used for the fine-tuning job."]
46623    #[derive(Clone, Debug, PartialEq)]
46624    #[serde_with::serde_as]
46625    #[derive(serde :: Deserialize, serde :: Serialize)]
46626    #[serde(untagged)]
46627    #[allow(clippy::large_enum_variant)]
46628    pub enum Grader {
46629        StringCheck(crate::__types::GraderStringCheck),
46630        TextSimilarity(crate::__types::GraderTextSimilarity),
46631        Python(crate::__types::GraderPython),
46632        ScoreModel(crate::__types::GraderScoreModel),
46633        Multi(crate::__types::GraderMulti),
46634    }
46635}
46636#[derive(Clone, Debug, PartialEq)]
46637#[serde_with::serde_as]
46638#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
46639pub struct ValidateGraderRequest {
46640    #[doc = "The grader used for the fine-tuning job."]
46641    #[serde(rename = "grader")]
46642    pub grader: crate::__types::validate_grader_request::Grader,
46643}
46644#[allow(clippy::module_inception)]
46645pub mod validate_grader_response {
46646    #[doc = "The grader used for the fine-tuning job."]
46647    #[derive(Clone, Debug, PartialEq)]
46648    #[serde_with::serde_as]
46649    #[derive(serde :: Deserialize, serde :: Serialize)]
46650    #[serde(untagged)]
46651    #[allow(clippy::large_enum_variant)]
46652    pub enum Grader {
46653        StringCheck(crate::__types::GraderStringCheck),
46654        TextSimilarity(crate::__types::GraderTextSimilarity),
46655        Python(crate::__types::GraderPython),
46656        ScoreModel(crate::__types::GraderScoreModel),
46657        Multi(crate::__types::GraderMulti),
46658    }
46659}
46660#[derive(Clone, Debug, Default, PartialEq)]
46661#[serde_with::serde_as]
46662#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
46663pub struct ValidateGraderResponse {
46664    #[doc = "The grader used for the fine-tuning job."]
46665    #[serde(rename = "grader")]
46666    #[serde(skip_serializing_if = "Option::is_none")]
46667    #[builder(default)]
46668    pub grader: Option<crate::__types::validate_grader_response::Grader>,
46669}
46670#[allow(clippy::module_inception)]
46671pub(crate) mod vector_store_expiration_after {
46672    #[doc = "Anchor timestamp after which the expiration policy applies. Supported anchors: `last_active_at`."]
46673    #[derive(Clone, Copy, Debug, Default, PartialEq)]
46674    pub(crate) struct Anchor;
46675    impl_serde!(Anchor, "last_active_at");
46676}
46677#[doc = "The expiration policy for a vector store."]
46678#[derive(Clone, Copy, Debug, PartialEq, typed_builder :: TypedBuilder)]
46679pub struct VectorStoreExpirationAfter {
46680    #[doc = "The number of days after the anchor time that the vector store will expire."]
46681    pub days: i64,
46682}
46683impl<'de> serde::Deserialize<'de> for VectorStoreExpirationAfter {
46684    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
46685    where
46686        D: serde::Deserializer<'de>,
46687    {
46688        #[serde_with::serde_as]
46689        #[derive(serde :: Deserialize)]
46690        struct VectorStoreExpirationAfter {
46691            #[serde(rename = "anchor")]
46692            #[allow(dead_code)]
46693            anchor: crate::__types::vector_store_expiration_after::Anchor,
46694            #[serde(rename = "days")]
46695            days: i64,
46696        }
46697        let VectorStoreExpirationAfter { days, .. } =
46698            VectorStoreExpirationAfter::deserialize(deserializer)?;
46699        Ok(Self { days })
46700    }
46701}
46702impl serde::Serialize for VectorStoreExpirationAfter {
46703    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
46704    where
46705        S: serde::Serializer,
46706    {
46707        #[serde_with::serde_as]
46708        #[derive(serde :: Serialize)]
46709        struct VectorStoreExpirationAfter<'a> {
46710            #[serde(rename = "anchor")]
46711            anchor: &'a crate::__types::vector_store_expiration_after::Anchor,
46712            #[serde(rename = "days")]
46713            days: &'a i64,
46714        }
46715        let Self { days } = self;
46716        VectorStoreExpirationAfter {
46717            anchor: &Default::default(),
46718            days,
46719        }
46720        .serialize(serializer)
46721    }
46722}
46723#[allow(clippy::module_inception)]
46724pub mod vector_store_file_attributes {
46725    #[derive(Clone, Debug, PartialEq)]
46726    #[serde_with::serde_as]
46727    #[derive(serde :: Deserialize, serde :: Serialize)]
46728    #[serde(untagged)]
46729    #[allow(clippy::large_enum_variant)]
46730    pub enum Item {
46731        String(String),
46732        Number(serde_json::Number),
46733        Bool(bool),
46734    }
46735}
46736#[doc = "Set of 16 key-value pairs that can be attached to an object. This can be \nuseful for storing additional information about the object in a structured \nformat, and querying for objects via API or the dashboard. Keys are strings \nwith a maximum length of 64 characters. Values are strings with a maximum \nlength of 512 characters, booleans, or numbers.\n"]
46737pub type VectorStoreFileAttributes =
46738    indexmap::IndexMap<String, crate::__types::vector_store_file_attributes::Item>;
46739#[allow(clippy::module_inception)]
46740pub mod vector_store_file_batch_object {
46741    #[doc = "The object type, which is always `vector_store.file_batch`."]
46742    #[derive(Clone, Copy, Debug, Default, PartialEq)]
46743    pub(crate) struct Object;
46744    impl_serde!(Object, "vector_store.files_batch");
46745    #[doc = "The status of the vector store files batch, which can be either `in_progress`, `completed`, `cancelled` or `failed`."]
46746    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
46747    pub enum Status {
46748        #[doc = "`in_progress`"]
46749        #[serde(rename = "in_progress")]
46750        InProgress,
46751        #[doc = "`completed`"]
46752        #[serde(rename = "completed")]
46753        Completed,
46754        #[doc = "`cancelled`"]
46755        #[serde(rename = "cancelled")]
46756        Cancelled,
46757        #[doc = "`failed`"]
46758        #[serde(rename = "failed")]
46759        Failed,
46760    }
46761    #[derive(Clone, Copy, Debug, PartialEq)]
46762    #[serde_with::serde_as]
46763    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
46764    pub struct FileCounts {
46765        #[doc = "The number of files that are currently being processed."]
46766        #[serde(rename = "in_progress")]
46767        pub in_progress: i64,
46768        #[doc = "The number of files that have been processed."]
46769        #[serde(rename = "completed")]
46770        pub completed: i64,
46771        #[doc = "The number of files that have failed to process."]
46772        #[serde(rename = "failed")]
46773        pub failed: i64,
46774        #[doc = "The number of files that where cancelled."]
46775        #[serde(rename = "cancelled")]
46776        pub cancelled: i64,
46777        #[doc = "The total number of files."]
46778        #[serde(rename = "total")]
46779        pub total: i64,
46780    }
46781}
46782#[doc = "A batch of files attached to a vector store."]
46783#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
46784pub struct VectorStoreFileBatchObject {
46785    #[doc = "The identifier, which can be referenced in API endpoints."]
46786    pub id: String,
46787    #[doc = "The Unix timestamp (in seconds) for when the vector store files batch was created."]
46788    pub created_at: i64,
46789    #[doc = "The ID of the [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object) that the [File](https://platform.openai.com/docs/api-reference/files) is attached to."]
46790    pub vector_store_id: String,
46791    #[doc = "The status of the vector store files batch, which can be either `in_progress`, `completed`, `cancelled` or `failed`."]
46792    pub status: crate::__types::vector_store_file_batch_object::Status,
46793    pub file_counts: crate::__types::vector_store_file_batch_object::FileCounts,
46794}
46795impl<'de> serde::Deserialize<'de> for VectorStoreFileBatchObject {
46796    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
46797    where
46798        D: serde::Deserializer<'de>,
46799    {
46800        #[serde_with::serde_as]
46801        #[derive(serde :: Deserialize)]
46802        struct VectorStoreFileBatchObject {
46803            #[serde(rename = "id")]
46804            id: String,
46805            #[serde(rename = "object")]
46806            #[allow(dead_code)]
46807            object: crate::__types::vector_store_file_batch_object::Object,
46808            #[serde(rename = "created_at")]
46809            created_at: i64,
46810            #[serde(rename = "vector_store_id")]
46811            vector_store_id: String,
46812            #[serde(rename = "status")]
46813            status: crate::__types::vector_store_file_batch_object::Status,
46814            #[serde(rename = "file_counts")]
46815            file_counts: crate::__types::vector_store_file_batch_object::FileCounts,
46816        }
46817        let VectorStoreFileBatchObject {
46818            id,
46819            created_at,
46820            vector_store_id,
46821            status,
46822            file_counts,
46823            ..
46824        } = VectorStoreFileBatchObject::deserialize(deserializer)?;
46825        Ok(Self {
46826            id,
46827            created_at,
46828            vector_store_id,
46829            status,
46830            file_counts,
46831        })
46832    }
46833}
46834impl serde::Serialize for VectorStoreFileBatchObject {
46835    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
46836    where
46837        S: serde::Serializer,
46838    {
46839        #[serde_with::serde_as]
46840        #[derive(serde :: Serialize)]
46841        struct VectorStoreFileBatchObject<'a> {
46842            #[serde(rename = "id")]
46843            id: &'a String,
46844            #[serde(rename = "object")]
46845            object: &'a crate::__types::vector_store_file_batch_object::Object,
46846            #[serde(rename = "created_at")]
46847            created_at: &'a i64,
46848            #[serde(rename = "vector_store_id")]
46849            vector_store_id: &'a String,
46850            #[serde(rename = "status")]
46851            status: &'a crate::__types::vector_store_file_batch_object::Status,
46852            #[serde(rename = "file_counts")]
46853            file_counts: &'a crate::__types::vector_store_file_batch_object::FileCounts,
46854        }
46855        let Self {
46856            id,
46857            created_at,
46858            vector_store_id,
46859            status,
46860            file_counts,
46861        } = self;
46862        VectorStoreFileBatchObject {
46863            id,
46864            object: &Default::default(),
46865            created_at,
46866            vector_store_id,
46867            status,
46868            file_counts,
46869        }
46870        .serialize(serializer)
46871    }
46872}
46873#[allow(clippy::module_inception)]
46874pub mod vector_store_file_content_response {
46875    #[doc = "The object type, which is always `vector_store.file_content.page`"]
46876    #[derive(Clone, Copy, Debug, Default, PartialEq)]
46877    pub(crate) struct Object;
46878    impl_serde!(Object, "vector_store.file_content.page");
46879    #[allow(clippy::module_inception)]
46880    pub mod data {
46881        #[derive(Clone, Debug, Default, PartialEq)]
46882        #[serde_with::serde_as]
46883        #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
46884        pub struct Item {
46885            #[doc = "The content type (currently only `\"text\"`)"]
46886            #[serde(rename = "type")]
46887            #[serde(skip_serializing_if = "Option::is_none")]
46888            #[builder(default)]
46889            pub r#type: Option<String>,
46890            #[doc = "The text content"]
46891            #[serde(rename = "text")]
46892            #[serde(skip_serializing_if = "Option::is_none")]
46893            #[builder(default)]
46894            pub text: Option<String>,
46895        }
46896    }
46897}
46898#[doc = "Represents the parsed content of a vector store file."]
46899#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
46900pub struct VectorStoreFileContentResponse {
46901    #[doc = "Parsed content of the file."]
46902    pub data: Vec<crate::__types::vector_store_file_content_response::data::Item>,
46903    #[doc = "Indicates if there are more content pages to fetch."]
46904    pub has_more: bool,
46905    #[doc = "The token for the next page, if any."]
46906    #[builder(default)]
46907    pub next_page: Option<String>,
46908}
46909impl<'de> serde::Deserialize<'de> for VectorStoreFileContentResponse {
46910    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
46911    where
46912        D: serde::Deserializer<'de>,
46913    {
46914        #[serde_with::serde_as]
46915        #[derive(serde :: Deserialize)]
46916        struct VectorStoreFileContentResponse {
46917            #[serde(rename = "object")]
46918            #[allow(dead_code)]
46919            object: crate::__types::vector_store_file_content_response::Object,
46920            #[serde(rename = "data")]
46921            data: Vec<crate::__types::vector_store_file_content_response::data::Item>,
46922            #[serde(rename = "has_more")]
46923            has_more: bool,
46924            #[serde(rename = "next_page")]
46925            next_page: Option<String>,
46926        }
46927        let VectorStoreFileContentResponse {
46928            data,
46929            has_more,
46930            next_page,
46931            ..
46932        } = VectorStoreFileContentResponse::deserialize(deserializer)?;
46933        Ok(Self {
46934            data,
46935            has_more,
46936            next_page,
46937        })
46938    }
46939}
46940impl serde::Serialize for VectorStoreFileContentResponse {
46941    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
46942    where
46943        S: serde::Serializer,
46944    {
46945        #[serde_with::serde_as]
46946        #[derive(serde :: Serialize)]
46947        struct VectorStoreFileContentResponse<'a> {
46948            #[serde(rename = "object")]
46949            object: &'a crate::__types::vector_store_file_content_response::Object,
46950            #[serde(rename = "data")]
46951            data: &'a Vec<crate::__types::vector_store_file_content_response::data::Item>,
46952            #[serde(rename = "has_more")]
46953            has_more: &'a bool,
46954            #[serde(rename = "next_page")]
46955            #[serde(skip_serializing_if = "Option::is_none")]
46956            next_page: &'a Option<String>,
46957        }
46958        let Self {
46959            data,
46960            has_more,
46961            next_page,
46962        } = self;
46963        VectorStoreFileContentResponse {
46964            object: &Default::default(),
46965            data,
46966            has_more,
46967            next_page,
46968        }
46969        .serialize(serializer)
46970    }
46971}
46972#[allow(clippy::module_inception)]
46973pub mod vector_store_file_object {
46974    #[doc = "The object type, which is always `vector_store.file`."]
46975    #[derive(Clone, Copy, Debug, Default, PartialEq)]
46976    pub(crate) struct Object;
46977    impl_serde!(Object, "vector_store.file");
46978    #[doc = "The status of the vector store file, which can be either `in_progress`, `completed`, `cancelled`, or `failed`. The status `completed` indicates that the vector store file is ready for use."]
46979    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
46980    pub enum Status {
46981        #[doc = "`in_progress`"]
46982        #[serde(rename = "in_progress")]
46983        InProgress,
46984        #[doc = "`completed`"]
46985        #[serde(rename = "completed")]
46986        Completed,
46987        #[doc = "`cancelled`"]
46988        #[serde(rename = "cancelled")]
46989        Cancelled,
46990        #[doc = "`failed`"]
46991        #[serde(rename = "failed")]
46992        Failed,
46993    }
46994    #[allow(clippy::module_inception)]
46995    pub mod last_error {
46996        #[doc = "One of `server_error` or `rate_limit_exceeded`."]
46997        #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
46998        pub enum Code {
46999            #[doc = "`server_error`"]
47000            #[serde(rename = "server_error")]
47001            ServerError,
47002            #[doc = "`unsupported_file`"]
47003            #[serde(rename = "unsupported_file")]
47004            UnsupportedFile,
47005            #[doc = "`invalid_file`"]
47006            #[serde(rename = "invalid_file")]
47007            InvalidFile,
47008        }
47009    }
47010    #[doc = "The last error associated with this vector store file. Will be `null` if there are no errors."]
47011    #[derive(Clone, Debug, PartialEq)]
47012    #[serde_with::serde_as]
47013    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
47014    pub struct LastError {
47015        #[doc = "One of `server_error` or `rate_limit_exceeded`."]
47016        #[serde(rename = "code")]
47017        pub code: crate::__types::vector_store_file_object::last_error::Code,
47018        #[doc = "A human-readable description of the error."]
47019        #[serde(rename = "message")]
47020        pub message: String,
47021    }
47022}
47023#[doc = "A list of files attached to a vector store."]
47024#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
47025pub struct VectorStoreFileObject {
47026    #[doc = "The identifier, which can be referenced in API endpoints."]
47027    pub id: String,
47028    #[doc = "The total vector store usage in bytes. Note that this may be different from the original file size."]
47029    pub usage_bytes: i64,
47030    #[doc = "The Unix timestamp (in seconds) for when the vector store file was created."]
47031    pub created_at: i64,
47032    #[doc = "The ID of the [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object) that the [File](https://platform.openai.com/docs/api-reference/files) is attached to."]
47033    pub vector_store_id: String,
47034    #[doc = "The status of the vector store file, which can be either `in_progress`, `completed`, `cancelled`, or `failed`. The status `completed` indicates that the vector store file is ready for use."]
47035    pub status: crate::__types::vector_store_file_object::Status,
47036    #[doc = "The last error associated with this vector store file. Will be `null` if there are no errors."]
47037    #[builder(default)]
47038    pub last_error: Option<crate::__types::vector_store_file_object::LastError>,
47039    #[builder(default)]
47040    pub chunking_strategy: Option<crate::__types::ChunkingStrategyResponse>,
47041    #[builder(default)]
47042    pub attributes: Option<crate::__types::VectorStoreFileAttributes>,
47043}
47044impl<'de> serde::Deserialize<'de> for VectorStoreFileObject {
47045    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
47046    where
47047        D: serde::Deserializer<'de>,
47048    {
47049        #[serde_with::serde_as]
47050        #[derive(serde :: Deserialize)]
47051        struct VectorStoreFileObject {
47052            #[serde(rename = "id")]
47053            id: String,
47054            #[serde(rename = "object")]
47055            #[allow(dead_code)]
47056            object: crate::__types::vector_store_file_object::Object,
47057            #[serde(rename = "usage_bytes")]
47058            usage_bytes: i64,
47059            #[serde(rename = "created_at")]
47060            created_at: i64,
47061            #[serde(rename = "vector_store_id")]
47062            vector_store_id: String,
47063            #[serde(rename = "status")]
47064            status: crate::__types::vector_store_file_object::Status,
47065            #[serde(rename = "last_error")]
47066            last_error: Option<crate::__types::vector_store_file_object::LastError>,
47067            #[serde(rename = "chunking_strategy")]
47068            chunking_strategy: Option<crate::__types::ChunkingStrategyResponse>,
47069            #[serde(rename = "attributes")]
47070            attributes: Option<crate::__types::VectorStoreFileAttributes>,
47071        }
47072        let VectorStoreFileObject {
47073            id,
47074            usage_bytes,
47075            created_at,
47076            vector_store_id,
47077            status,
47078            last_error,
47079            chunking_strategy,
47080            attributes,
47081            ..
47082        } = VectorStoreFileObject::deserialize(deserializer)?;
47083        Ok(Self {
47084            id,
47085            usage_bytes,
47086            created_at,
47087            vector_store_id,
47088            status,
47089            last_error,
47090            chunking_strategy,
47091            attributes,
47092        })
47093    }
47094}
47095impl serde::Serialize for VectorStoreFileObject {
47096    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
47097    where
47098        S: serde::Serializer,
47099    {
47100        #[serde_with::serde_as]
47101        #[derive(serde :: Serialize)]
47102        struct VectorStoreFileObject<'a> {
47103            #[serde(rename = "id")]
47104            id: &'a String,
47105            #[serde(rename = "object")]
47106            object: &'a crate::__types::vector_store_file_object::Object,
47107            #[serde(rename = "usage_bytes")]
47108            usage_bytes: &'a i64,
47109            #[serde(rename = "created_at")]
47110            created_at: &'a i64,
47111            #[serde(rename = "vector_store_id")]
47112            vector_store_id: &'a String,
47113            #[serde(rename = "status")]
47114            status: &'a crate::__types::vector_store_file_object::Status,
47115            #[serde(rename = "last_error")]
47116            #[serde(skip_serializing_if = "Option::is_none")]
47117            last_error: &'a Option<crate::__types::vector_store_file_object::LastError>,
47118            #[serde(rename = "chunking_strategy")]
47119            #[serde(skip_serializing_if = "Option::is_none")]
47120            chunking_strategy: &'a Option<crate::__types::ChunkingStrategyResponse>,
47121            #[serde(rename = "attributes")]
47122            #[serde(skip_serializing_if = "Option::is_none")]
47123            attributes: &'a Option<crate::__types::VectorStoreFileAttributes>,
47124        }
47125        let Self {
47126            id,
47127            usage_bytes,
47128            created_at,
47129            vector_store_id,
47130            status,
47131            last_error,
47132            chunking_strategy,
47133            attributes,
47134        } = self;
47135        VectorStoreFileObject {
47136            id,
47137            object: &Default::default(),
47138            usage_bytes,
47139            created_at,
47140            vector_store_id,
47141            status,
47142            last_error,
47143            chunking_strategy,
47144            attributes,
47145        }
47146        .serialize(serializer)
47147    }
47148}
47149#[allow(clippy::module_inception)]
47150pub mod vector_store_object {
47151    #[doc = "The object type, which is always `vector_store`."]
47152    #[derive(Clone, Copy, Debug, Default, PartialEq)]
47153    pub(crate) struct Object;
47154    impl_serde!(Object, "vector_store");
47155    #[derive(Clone, Copy, Debug, PartialEq)]
47156    #[serde_with::serde_as]
47157    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
47158    pub struct FileCounts {
47159        #[doc = "The number of files that are currently being processed."]
47160        #[serde(rename = "in_progress")]
47161        pub in_progress: i64,
47162        #[doc = "The number of files that have been successfully processed."]
47163        #[serde(rename = "completed")]
47164        pub completed: i64,
47165        #[doc = "The number of files that have failed to process."]
47166        #[serde(rename = "failed")]
47167        pub failed: i64,
47168        #[doc = "The number of files that were cancelled."]
47169        #[serde(rename = "cancelled")]
47170        pub cancelled: i64,
47171        #[doc = "The total number of files."]
47172        #[serde(rename = "total")]
47173        pub total: i64,
47174    }
47175    #[doc = "The status of the vector store, which can be either `expired`, `in_progress`, or `completed`. A status of `completed` indicates that the vector store is ready for use."]
47176    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
47177    pub enum Status {
47178        #[doc = "`expired`"]
47179        #[serde(rename = "expired")]
47180        Expired,
47181        #[doc = "`in_progress`"]
47182        #[serde(rename = "in_progress")]
47183        InProgress,
47184        #[doc = "`completed`"]
47185        #[serde(rename = "completed")]
47186        Completed,
47187    }
47188}
47189#[doc = "A vector store is a collection of processed files can be used by the `file_search` tool."]
47190#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
47191pub struct VectorStoreObject {
47192    #[doc = "The identifier, which can be referenced in API endpoints."]
47193    pub id: String,
47194    #[doc = "The Unix timestamp (in seconds) for when the vector store was created."]
47195    pub created_at: i64,
47196    #[doc = "The name of the vector store."]
47197    pub name: String,
47198    #[doc = "The total number of bytes used by the files in the vector store."]
47199    pub usage_bytes: i64,
47200    pub file_counts: crate::__types::vector_store_object::FileCounts,
47201    #[doc = "The status of the vector store, which can be either `expired`, `in_progress`, or `completed`. A status of `completed` indicates that the vector store is ready for use."]
47202    pub status: crate::__types::vector_store_object::Status,
47203    #[builder(default)]
47204    pub expires_after: Option<crate::__types::VectorStoreExpirationAfter>,
47205    #[doc = "The Unix timestamp (in seconds) for when the vector store will expire."]
47206    #[builder(default)]
47207    pub expires_at: Option<i64>,
47208    #[doc = "The Unix timestamp (in seconds) for when the vector store was last active."]
47209    #[builder(default)]
47210    pub last_active_at: Option<i64>,
47211    #[builder(default)]
47212    pub metadata: Option<crate::__types::Metadata>,
47213}
47214impl<'de> serde::Deserialize<'de> for VectorStoreObject {
47215    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
47216    where
47217        D: serde::Deserializer<'de>,
47218    {
47219        #[serde_with::serde_as]
47220        #[derive(serde :: Deserialize)]
47221        struct VectorStoreObject {
47222            #[serde(rename = "id")]
47223            id: String,
47224            #[serde(rename = "object")]
47225            #[allow(dead_code)]
47226            object: crate::__types::vector_store_object::Object,
47227            #[serde(rename = "created_at")]
47228            created_at: i64,
47229            #[serde(rename = "name")]
47230            name: String,
47231            #[serde(rename = "usage_bytes")]
47232            usage_bytes: i64,
47233            #[serde(rename = "file_counts")]
47234            file_counts: crate::__types::vector_store_object::FileCounts,
47235            #[serde(rename = "status")]
47236            status: crate::__types::vector_store_object::Status,
47237            #[serde(rename = "expires_after")]
47238            expires_after: Option<crate::__types::VectorStoreExpirationAfter>,
47239            #[serde(rename = "expires_at")]
47240            expires_at: Option<i64>,
47241            #[serde(rename = "last_active_at")]
47242            last_active_at: Option<i64>,
47243            #[serde(rename = "metadata")]
47244            metadata: Option<crate::__types::Metadata>,
47245        }
47246        let VectorStoreObject {
47247            id,
47248            created_at,
47249            name,
47250            usage_bytes,
47251            file_counts,
47252            status,
47253            expires_after,
47254            expires_at,
47255            last_active_at,
47256            metadata,
47257            ..
47258        } = VectorStoreObject::deserialize(deserializer)?;
47259        Ok(Self {
47260            id,
47261            created_at,
47262            name,
47263            usage_bytes,
47264            file_counts,
47265            status,
47266            expires_after,
47267            expires_at,
47268            last_active_at,
47269            metadata,
47270        })
47271    }
47272}
47273impl serde::Serialize for VectorStoreObject {
47274    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
47275    where
47276        S: serde::Serializer,
47277    {
47278        #[serde_with::serde_as]
47279        #[derive(serde :: Serialize)]
47280        struct VectorStoreObject<'a> {
47281            #[serde(rename = "id")]
47282            id: &'a String,
47283            #[serde(rename = "object")]
47284            object: &'a crate::__types::vector_store_object::Object,
47285            #[serde(rename = "created_at")]
47286            created_at: &'a i64,
47287            #[serde(rename = "name")]
47288            name: &'a String,
47289            #[serde(rename = "usage_bytes")]
47290            usage_bytes: &'a i64,
47291            #[serde(rename = "file_counts")]
47292            file_counts: &'a crate::__types::vector_store_object::FileCounts,
47293            #[serde(rename = "status")]
47294            status: &'a crate::__types::vector_store_object::Status,
47295            #[serde(rename = "expires_after")]
47296            #[serde(skip_serializing_if = "Option::is_none")]
47297            expires_after: &'a Option<crate::__types::VectorStoreExpirationAfter>,
47298            #[serde(rename = "expires_at")]
47299            #[serde(skip_serializing_if = "Option::is_none")]
47300            expires_at: &'a Option<i64>,
47301            #[serde(rename = "last_active_at")]
47302            #[serde(skip_serializing_if = "Option::is_none")]
47303            last_active_at: &'a Option<i64>,
47304            #[serde(rename = "metadata")]
47305            #[serde(skip_serializing_if = "Option::is_none")]
47306            metadata: &'a Option<crate::__types::Metadata>,
47307        }
47308        let Self {
47309            id,
47310            created_at,
47311            name,
47312            usage_bytes,
47313            file_counts,
47314            status,
47315            expires_after,
47316            expires_at,
47317            last_active_at,
47318            metadata,
47319        } = self;
47320        VectorStoreObject {
47321            id,
47322            object: &Default::default(),
47323            created_at,
47324            name,
47325            usage_bytes,
47326            file_counts,
47327            status,
47328            expires_after,
47329            expires_at,
47330            last_active_at,
47331            metadata,
47332        }
47333        .serialize(serializer)
47334    }
47335}
47336#[allow(clippy::module_inception)]
47337pub mod vector_store_search_request {
47338    #[doc = "A query string for a search"]
47339    #[derive(Clone, Debug, PartialEq)]
47340    #[serde_with::serde_as]
47341    #[derive(serde :: Deserialize, serde :: Serialize)]
47342    #[serde(untagged)]
47343    #[allow(clippy::large_enum_variant)]
47344    pub enum Query {
47345        String(String),
47346        Array(Vec<String>),
47347    }
47348    #[doc = "A filter to apply based on file attributes."]
47349    #[derive(Clone, Debug, PartialEq)]
47350    #[serde_with::serde_as]
47351    #[derive(serde :: Deserialize, serde :: Serialize)]
47352    #[serde(untagged)]
47353    #[allow(clippy::large_enum_variant)]
47354    pub enum Filters {
47355        ComparisonFilter(crate::__types::ComparisonFilter),
47356        CompoundFilter(crate::__types::CompoundFilter),
47357    }
47358    #[allow(clippy::module_inception)]
47359    pub mod ranking_options {
47360        #[doc = "Enable re-ranking; set to `none` to disable, which can help reduce latency."]
47361        #[derive(
47362            Clone, Copy, Debug, Default, PartialEq, serde :: Deserialize, serde :: Serialize,
47363        )]
47364        pub enum Ranker {
47365            #[doc = "`none`"]
47366            #[serde(rename = "none")]
47367            None,
47368            #[doc = "`auto`"]
47369            #[default]
47370            #[serde(rename = "auto")]
47371            Auto,
47372            #[doc = "`default-2024-11-15`"]
47373            #[serde(rename = "default-2024-11-15")]
47374            Default2024_11_15,
47375        }
47376    }
47377    #[doc = "Ranking options for search."]
47378    #[derive(Clone, Debug, Default, PartialEq)]
47379    #[serde_with::serde_as]
47380    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
47381    pub struct RankingOptions {
47382        #[doc = "Enable re-ranking; set to `none` to disable, which can help reduce latency."]
47383        #[serde(rename = "ranker")]
47384        #[serde(skip_serializing_if = "Option::is_none")]
47385        #[builder(default)]
47386        pub ranker: Option<crate::__types::vector_store_search_request::ranking_options::Ranker>,
47387        #[serde(rename = "score_threshold")]
47388        #[serde(skip_serializing_if = "Option::is_none")]
47389        #[builder(default)]
47390        pub score_threshold: Option<serde_json::Number>,
47391    }
47392}
47393#[derive(Clone, Debug, PartialEq)]
47394#[serde_with::serde_as]
47395#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
47396pub struct VectorStoreSearchRequest {
47397    #[doc = "A query string for a search"]
47398    #[serde(rename = "query")]
47399    pub query: crate::__types::vector_store_search_request::Query,
47400    #[doc = "Whether to rewrite the natural language query for vector search."]
47401    #[serde(rename = "rewrite_query")]
47402    #[serde(skip_serializing_if = "Option::is_none")]
47403    #[builder(default)]
47404    pub rewrite_query: Option<bool>,
47405    #[doc = "The maximum number of results to return. This number should be between 1 and 50 inclusive."]
47406    #[serde(rename = "max_num_results")]
47407    #[serde(skip_serializing_if = "Option::is_none")]
47408    #[builder(default)]
47409    pub max_num_results: Option<i64>,
47410    #[doc = "A filter to apply based on file attributes."]
47411    #[serde(rename = "filters")]
47412    #[serde(skip_serializing_if = "Option::is_none")]
47413    #[builder(default)]
47414    pub filters: Option<crate::__types::vector_store_search_request::Filters>,
47415    #[doc = "Ranking options for search."]
47416    #[serde(rename = "ranking_options")]
47417    #[serde(skip_serializing_if = "Option::is_none")]
47418    #[builder(default)]
47419    pub ranking_options: Option<crate::__types::vector_store_search_request::RankingOptions>,
47420}
47421#[allow(clippy::module_inception)]
47422pub mod vector_store_search_result_content_object {
47423    #[doc = "The type of content."]
47424    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
47425    pub enum Type {
47426        #[doc = "`text`"]
47427        #[serde(rename = "text")]
47428        Text,
47429    }
47430}
47431#[derive(Clone, Debug, PartialEq)]
47432#[serde_with::serde_as]
47433#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
47434pub struct VectorStoreSearchResultContentObject {
47435    #[doc = "The type of content."]
47436    #[serde(rename = "type")]
47437    pub r#type: crate::__types::vector_store_search_result_content_object::Type,
47438    #[doc = "The text content returned from search."]
47439    #[serde(rename = "text")]
47440    pub text: String,
47441}
47442#[derive(Clone, Debug, PartialEq)]
47443#[serde_with::serde_as]
47444#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
47445pub struct VectorStoreSearchResultItem {
47446    #[doc = "The ID of the vector store file."]
47447    #[serde(rename = "file_id")]
47448    pub file_id: String,
47449    #[doc = "The name of the vector store file."]
47450    #[serde(rename = "filename")]
47451    pub filename: String,
47452    #[doc = "The similarity score for the result."]
47453    #[serde(rename = "score")]
47454    pub score: serde_json::Number,
47455    #[serde(rename = "attributes")]
47456    #[serde(skip_serializing_if = "Option::is_none")]
47457    #[builder(default)]
47458    pub attributes: Option<crate::__types::VectorStoreFileAttributes>,
47459    #[doc = "Content chunks from the file."]
47460    #[serde(rename = "content")]
47461    pub content: Vec<crate::__types::VectorStoreSearchResultContentObject>,
47462}
47463#[allow(clippy::module_inception)]
47464pub(crate) mod vector_store_search_results_page {
47465    #[doc = "The object type, which is always `vector_store.search_results.page`"]
47466    #[derive(Clone, Copy, Debug, Default, PartialEq)]
47467    pub(crate) struct Object;
47468    impl_serde!(Object, "vector_store.search_results.page");
47469}
47470#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
47471pub struct VectorStoreSearchResultsPage {
47472    pub search_query: Vec<String>,
47473    #[doc = "The list of search result items."]
47474    pub data: Vec<crate::__types::VectorStoreSearchResultItem>,
47475    #[doc = "Indicates if there are more results to fetch."]
47476    pub has_more: bool,
47477    #[doc = "The token for the next page, if any."]
47478    #[builder(default)]
47479    pub next_page: Option<String>,
47480}
47481impl<'de> serde::Deserialize<'de> for VectorStoreSearchResultsPage {
47482    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
47483    where
47484        D: serde::Deserializer<'de>,
47485    {
47486        #[serde_with::serde_as]
47487        #[derive(serde :: Deserialize)]
47488        struct VectorStoreSearchResultsPage {
47489            #[serde(rename = "object")]
47490            #[allow(dead_code)]
47491            object: crate::__types::vector_store_search_results_page::Object,
47492            #[serde(rename = "search_query")]
47493            search_query: Vec<String>,
47494            #[serde(rename = "data")]
47495            data: Vec<crate::__types::VectorStoreSearchResultItem>,
47496            #[serde(rename = "has_more")]
47497            has_more: bool,
47498            #[serde(rename = "next_page")]
47499            next_page: Option<String>,
47500        }
47501        let VectorStoreSearchResultsPage {
47502            search_query,
47503            data,
47504            has_more,
47505            next_page,
47506            ..
47507        } = VectorStoreSearchResultsPage::deserialize(deserializer)?;
47508        Ok(Self {
47509            search_query,
47510            data,
47511            has_more,
47512            next_page,
47513        })
47514    }
47515}
47516impl serde::Serialize for VectorStoreSearchResultsPage {
47517    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
47518    where
47519        S: serde::Serializer,
47520    {
47521        #[serde_with::serde_as]
47522        #[derive(serde :: Serialize)]
47523        struct VectorStoreSearchResultsPage<'a> {
47524            #[serde(rename = "object")]
47525            object: &'a crate::__types::vector_store_search_results_page::Object,
47526            #[serde(rename = "search_query")]
47527            search_query: &'a Vec<String>,
47528            #[serde(rename = "data")]
47529            data: &'a Vec<crate::__types::VectorStoreSearchResultItem>,
47530            #[serde(rename = "has_more")]
47531            has_more: &'a bool,
47532            #[serde(rename = "next_page")]
47533            #[serde(skip_serializing_if = "Option::is_none")]
47534            next_page: &'a Option<String>,
47535        }
47536        let Self {
47537            search_query,
47538            data,
47539            has_more,
47540            next_page,
47541        } = self;
47542        VectorStoreSearchResultsPage {
47543            object: &Default::default(),
47544            search_query,
47545            data,
47546            has_more,
47547            next_page,
47548        }
47549        .serialize(serializer)
47550    }
47551}
47552#[doc = "Constrains the verbosity of the model's response. Lower values will result in\nmore concise responses, while higher values will result in more verbose responses.\nCurrently supported values are `low`, `medium`, and `high`.\n"]
47553#[derive(Clone, Copy, Debug, Default, PartialEq, serde :: Deserialize, serde :: Serialize)]
47554pub enum Verbosity {
47555    #[doc = "`low`"]
47556    #[serde(rename = "low")]
47557    Low,
47558    #[doc = "`medium`"]
47559    #[default]
47560    #[serde(rename = "medium")]
47561    Medium,
47562    #[doc = "`high`"]
47563    #[serde(rename = "high")]
47564    High,
47565}
47566#[allow(clippy::module_inception)]
47567pub(crate) mod voice_ids_shared {
47568    #[doc = "alloy"]
47569    #[derive(Clone, Copy, Debug, Default, PartialEq)]
47570    pub(crate) struct Alloy;
47571    impl_serde!(Alloy, "alloy");
47572    #[doc = "ash"]
47573    #[derive(Clone, Copy, Debug, Default, PartialEq)]
47574    pub(crate) struct Ash;
47575    impl_serde!(Ash, "ash");
47576    #[doc = "ballad"]
47577    #[derive(Clone, Copy, Debug, Default, PartialEq)]
47578    pub(crate) struct Ballad;
47579    impl_serde!(Ballad, "ballad");
47580    #[doc = "coral"]
47581    #[derive(Clone, Copy, Debug, Default, PartialEq)]
47582    pub(crate) struct Coral;
47583    impl_serde!(Coral, "coral");
47584    #[doc = "echo"]
47585    #[derive(Clone, Copy, Debug, Default, PartialEq)]
47586    pub(crate) struct Echo;
47587    impl_serde!(Echo, "echo");
47588    #[doc = "sage"]
47589    #[derive(Clone, Copy, Debug, Default, PartialEq)]
47590    pub(crate) struct Sage;
47591    impl_serde!(Sage, "sage");
47592    #[doc = "shimmer"]
47593    #[derive(Clone, Copy, Debug, Default, PartialEq)]
47594    pub(crate) struct Shimmer;
47595    impl_serde!(Shimmer, "shimmer");
47596    #[doc = "verse"]
47597    #[derive(Clone, Copy, Debug, Default, PartialEq)]
47598    pub(crate) struct Verse;
47599    impl_serde!(Verse, "verse");
47600}
47601#[derive(Clone, Debug, PartialEq)]
47602#[allow(clippy::large_enum_variant)]
47603pub enum VoiceIdsShared {
47604    Other(String),
47605    #[doc = "alloy"]
47606    Alloy,
47607    #[doc = "ash"]
47608    Ash,
47609    #[doc = "ballad"]
47610    Ballad,
47611    #[doc = "coral"]
47612    Coral,
47613    #[doc = "echo"]
47614    Echo,
47615    #[doc = "sage"]
47616    Sage,
47617    #[doc = "shimmer"]
47618    Shimmer,
47619    #[doc = "verse"]
47620    Verse,
47621}
47622impl<'de> serde::Deserialize<'de> for VoiceIdsShared {
47623    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
47624    where
47625        D: serde::Deserializer<'de>,
47626    {
47627        #[serde_with::serde_as]
47628        #[derive(serde :: Deserialize)]
47629        #[serde(untagged)]
47630        #[allow(clippy::enum_variant_names, clippy::large_enum_variant)]
47631        enum VoiceIdsShared {
47632            Alloy(crate::__types::voice_ids_shared::Alloy),
47633            Ash(crate::__types::voice_ids_shared::Ash),
47634            Ballad(crate::__types::voice_ids_shared::Ballad),
47635            Coral(crate::__types::voice_ids_shared::Coral),
47636            Echo(crate::__types::voice_ids_shared::Echo),
47637            Sage(crate::__types::voice_ids_shared::Sage),
47638            Shimmer(crate::__types::voice_ids_shared::Shimmer),
47639            Verse(crate::__types::voice_ids_shared::Verse),
47640            Other(String),
47641        }
47642        Ok(match VoiceIdsShared::deserialize(deserializer)? {
47643            VoiceIdsShared::Other(v) => Self::Other(v),
47644            VoiceIdsShared::Alloy(_) => Self::Alloy,
47645            VoiceIdsShared::Ash(_) => Self::Ash,
47646            VoiceIdsShared::Ballad(_) => Self::Ballad,
47647            VoiceIdsShared::Coral(_) => Self::Coral,
47648            VoiceIdsShared::Echo(_) => Self::Echo,
47649            VoiceIdsShared::Sage(_) => Self::Sage,
47650            VoiceIdsShared::Shimmer(_) => Self::Shimmer,
47651            VoiceIdsShared::Verse(_) => Self::Verse,
47652        })
47653    }
47654}
47655impl serde::Serialize for VoiceIdsShared {
47656    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
47657    where
47658        S: serde::Serializer,
47659    {
47660        #[serde_with::serde_as]
47661        #[derive(serde :: Serialize)]
47662        #[serde(untagged)]
47663        #[allow(clippy::enum_variant_names)]
47664        enum VoiceIdsShared<'a> {
47665            Other(&'a String),
47666            Alloy(crate::__types::voice_ids_shared::Alloy),
47667            Ash(crate::__types::voice_ids_shared::Ash),
47668            Ballad(crate::__types::voice_ids_shared::Ballad),
47669            Coral(crate::__types::voice_ids_shared::Coral),
47670            Echo(crate::__types::voice_ids_shared::Echo),
47671            Sage(crate::__types::voice_ids_shared::Sage),
47672            Shimmer(crate::__types::voice_ids_shared::Shimmer),
47673            Verse(crate::__types::voice_ids_shared::Verse),
47674        }
47675        match self {
47676            Self::Other(v) => VoiceIdsShared::Other(v),
47677            Self::Alloy => VoiceIdsShared::Alloy(Default::default()),
47678            Self::Ash => VoiceIdsShared::Ash(Default::default()),
47679            Self::Ballad => VoiceIdsShared::Ballad(Default::default()),
47680            Self::Coral => VoiceIdsShared::Coral(Default::default()),
47681            Self::Echo => VoiceIdsShared::Echo(Default::default()),
47682            Self::Sage => VoiceIdsShared::Sage(Default::default()),
47683            Self::Shimmer => VoiceIdsShared::Shimmer(Default::default()),
47684            Self::Verse => VoiceIdsShared::Verse(Default::default()),
47685        }
47686        .serialize(serializer)
47687    }
47688}
47689#[allow(clippy::module_inception)]
47690pub(crate) mod wait {
47691    #[doc = "Specifies the event type. For a wait action, this property is \nalways set to `wait`.\n"]
47692    #[derive(Clone, Copy, Debug, Default, PartialEq)]
47693    pub(crate) struct Type;
47694    impl_serde!(Type, "wait");
47695}
47696#[doc = "A wait action.\n"]
47697#[derive(Clone, Copy, Debug, Default, PartialEq, typed_builder :: TypedBuilder)]
47698pub struct Wait {}
47699impl<'de> serde::Deserialize<'de> for Wait {
47700    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
47701    where
47702        D: serde::Deserializer<'de>,
47703    {
47704        #[serde_with::serde_as]
47705        #[derive(serde :: Deserialize)]
47706        struct Wait {
47707            #[serde(rename = "type")]
47708            #[allow(dead_code)]
47709            r#type: crate::__types::wait::Type,
47710        }
47711        let Wait { .. } = Wait::deserialize(deserializer)?;
47712        Ok(Self {})
47713    }
47714}
47715impl serde::Serialize for Wait {
47716    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
47717    where
47718        S: serde::Serializer,
47719    {
47720        #[serde_with::serde_as]
47721        #[derive(serde :: Serialize)]
47722        struct Wait<'a> {
47723            #[serde(rename = "type")]
47724            r#type: &'a crate::__types::wait::Type,
47725        }
47726        let Self {} = self;
47727        Wait {
47728            r#type: &Default::default(),
47729        }
47730        .serialize(serializer)
47731    }
47732}
47733#[allow(clippy::module_inception)]
47734pub(crate) mod web_search_action_find {
47735    #[doc = "The action type.\n"]
47736    #[derive(Clone, Copy, Debug, Default, PartialEq)]
47737    pub(crate) struct Type;
47738    impl_serde!(Type, "find");
47739}
47740#[doc = "Action type \"find\": Searches for a pattern within a loaded page.\n"]
47741#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
47742pub struct WebSearchActionFind {
47743    #[doc = "The URL of the page searched for the pattern.\n"]
47744    pub url: String,
47745    #[doc = "The pattern or text to search for within the page.\n"]
47746    pub pattern: String,
47747}
47748impl<'de> serde::Deserialize<'de> for WebSearchActionFind {
47749    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
47750    where
47751        D: serde::Deserializer<'de>,
47752    {
47753        #[serde_with::serde_as]
47754        #[derive(serde :: Deserialize)]
47755        struct WebSearchActionFind {
47756            #[serde(rename = "type")]
47757            #[allow(dead_code)]
47758            r#type: crate::__types::web_search_action_find::Type,
47759            #[serde(rename = "url")]
47760            url: String,
47761            #[serde(rename = "pattern")]
47762            pattern: String,
47763        }
47764        let WebSearchActionFind { url, pattern, .. } =
47765            WebSearchActionFind::deserialize(deserializer)?;
47766        Ok(Self { url, pattern })
47767    }
47768}
47769impl serde::Serialize for WebSearchActionFind {
47770    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
47771    where
47772        S: serde::Serializer,
47773    {
47774        #[serde_with::serde_as]
47775        #[derive(serde :: Serialize)]
47776        struct WebSearchActionFind<'a> {
47777            #[serde(rename = "type")]
47778            r#type: &'a crate::__types::web_search_action_find::Type,
47779            #[serde(rename = "url")]
47780            url: &'a String,
47781            #[serde(rename = "pattern")]
47782            pattern: &'a String,
47783        }
47784        let Self { url, pattern } = self;
47785        WebSearchActionFind {
47786            r#type: &Default::default(),
47787            url,
47788            pattern,
47789        }
47790        .serialize(serializer)
47791    }
47792}
47793#[allow(clippy::module_inception)]
47794pub(crate) mod web_search_action_open_page {
47795    #[doc = "The action type.\n"]
47796    #[derive(Clone, Copy, Debug, Default, PartialEq)]
47797    pub(crate) struct Type;
47798    impl_serde!(Type, "open_page");
47799}
47800#[doc = "Action type \"open_page\" - Opens a specific URL from search results.\n"]
47801#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
47802pub struct WebSearchActionOpenPage {
47803    #[doc = "The URL opened by the model.\n"]
47804    pub url: String,
47805}
47806impl<'de> serde::Deserialize<'de> for WebSearchActionOpenPage {
47807    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
47808    where
47809        D: serde::Deserializer<'de>,
47810    {
47811        #[serde_with::serde_as]
47812        #[derive(serde :: Deserialize)]
47813        struct WebSearchActionOpenPage {
47814            #[serde(rename = "type")]
47815            #[allow(dead_code)]
47816            r#type: crate::__types::web_search_action_open_page::Type,
47817            #[serde(rename = "url")]
47818            url: String,
47819        }
47820        let WebSearchActionOpenPage { url, .. } =
47821            WebSearchActionOpenPage::deserialize(deserializer)?;
47822        Ok(Self { url })
47823    }
47824}
47825impl serde::Serialize for WebSearchActionOpenPage {
47826    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
47827    where
47828        S: serde::Serializer,
47829    {
47830        #[serde_with::serde_as]
47831        #[derive(serde :: Serialize)]
47832        struct WebSearchActionOpenPage<'a> {
47833            #[serde(rename = "type")]
47834            r#type: &'a crate::__types::web_search_action_open_page::Type,
47835            #[serde(rename = "url")]
47836            url: &'a String,
47837        }
47838        let Self { url } = self;
47839        WebSearchActionOpenPage {
47840            r#type: &Default::default(),
47841            url,
47842        }
47843        .serialize(serializer)
47844    }
47845}
47846#[allow(clippy::module_inception)]
47847pub(crate) mod web_search_action_search {
47848    #[doc = "The action type.\n"]
47849    #[derive(Clone, Copy, Debug, Default, PartialEq)]
47850    pub(crate) struct Type;
47851    impl_serde!(Type, "search");
47852}
47853#[doc = "Action type \"search\" - Performs a web search query.\n"]
47854#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
47855pub struct WebSearchActionSearch {
47856    #[doc = "The search query.\n"]
47857    pub query: String,
47858}
47859impl<'de> serde::Deserialize<'de> for WebSearchActionSearch {
47860    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
47861    where
47862        D: serde::Deserializer<'de>,
47863    {
47864        #[serde_with::serde_as]
47865        #[derive(serde :: Deserialize)]
47866        struct WebSearchActionSearch {
47867            #[serde(rename = "type")]
47868            #[allow(dead_code)]
47869            r#type: crate::__types::web_search_action_search::Type,
47870            #[serde(rename = "query")]
47871            query: String,
47872        }
47873        let WebSearchActionSearch { query, .. } = WebSearchActionSearch::deserialize(deserializer)?;
47874        Ok(Self { query })
47875    }
47876}
47877impl serde::Serialize for WebSearchActionSearch {
47878    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
47879    where
47880        S: serde::Serializer,
47881    {
47882        #[serde_with::serde_as]
47883        #[derive(serde :: Serialize)]
47884        struct WebSearchActionSearch<'a> {
47885            #[serde(rename = "type")]
47886            r#type: &'a crate::__types::web_search_action_search::Type,
47887            #[serde(rename = "query")]
47888            query: &'a String,
47889        }
47890        let Self { query } = self;
47891        WebSearchActionSearch {
47892            r#type: &Default::default(),
47893            query,
47894        }
47895        .serialize(serializer)
47896    }
47897}
47898#[doc = "High level guidance for the amount of context window space to use for the \nsearch. One of `low`, `medium`, or `high`. `medium` is the default.\n"]
47899#[derive(Clone, Copy, Debug, Default, PartialEq, serde :: Deserialize, serde :: Serialize)]
47900pub enum WebSearchContextSize {
47901    #[doc = "`low`"]
47902    #[serde(rename = "low")]
47903    Low,
47904    #[doc = "`medium`"]
47905    #[default]
47906    #[serde(rename = "medium")]
47907    Medium,
47908    #[doc = "`high`"]
47909    #[serde(rename = "high")]
47910    High,
47911}
47912#[doc = "Approximate location parameters for the search."]
47913#[derive(Clone, Debug, Default, PartialEq)]
47914#[serde_with::serde_as]
47915#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
47916pub struct WebSearchLocation {
47917    #[doc = "The two-letter \n[ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user,\ne.g. `US`.\n"]
47918    #[serde(rename = "country")]
47919    #[serde(skip_serializing_if = "Option::is_none")]
47920    #[builder(default)]
47921    pub country: Option<String>,
47922    #[doc = "Free text input for the region of the user, e.g. `California`.\n"]
47923    #[serde(rename = "region")]
47924    #[serde(skip_serializing_if = "Option::is_none")]
47925    #[builder(default)]
47926    pub region: Option<String>,
47927    #[doc = "Free text input for the city of the user, e.g. `San Francisco`.\n"]
47928    #[serde(rename = "city")]
47929    #[serde(skip_serializing_if = "Option::is_none")]
47930    #[builder(default)]
47931    pub city: Option<String>,
47932    #[doc = "The [IANA timezone](https://timeapi.io/documentation/iana-timezones) \nof the user, e.g. `America/Los_Angeles`.\n"]
47933    #[serde(rename = "timezone")]
47934    #[serde(skip_serializing_if = "Option::is_none")]
47935    #[builder(default)]
47936    pub timezone: Option<String>,
47937}
47938#[allow(clippy::module_inception)]
47939pub mod web_search_tool_call {
47940    #[doc = "The type of the web search tool call. Always `web_search_call`.\n"]
47941    #[derive(Clone, Copy, Debug, Default, PartialEq)]
47942    pub(crate) struct Type;
47943    impl_serde!(Type, "web_search_call");
47944    #[doc = "The status of the web search tool call.\n"]
47945    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
47946    pub enum Status {
47947        #[doc = "`in_progress`"]
47948        #[serde(rename = "in_progress")]
47949        InProgress,
47950        #[doc = "`searching`"]
47951        #[serde(rename = "searching")]
47952        Searching,
47953        #[doc = "`completed`"]
47954        #[serde(rename = "completed")]
47955        Completed,
47956        #[doc = "`failed`"]
47957        #[serde(rename = "failed")]
47958        Failed,
47959    }
47960    #[doc = "An object describing the specific action taken in this web search call.\nIncludes details on how the model used the web (search, open_page, find).\n"]
47961    #[derive(Clone, Debug, PartialEq)]
47962    #[serde_with::serde_as]
47963    #[derive(serde :: Deserialize, serde :: Serialize)]
47964    #[serde(untagged)]
47965    #[allow(clippy::large_enum_variant)]
47966    pub enum Action {
47967        Search(crate::__types::WebSearchActionSearch),
47968        OpenPage(crate::__types::WebSearchActionOpenPage),
47969        Find(crate::__types::WebSearchActionFind),
47970    }
47971}
47972#[doc = "The results of a web search tool call. See the \n[web search guide](https://platform.openai.com/docs/guides/tools-web-search) for more information.\n"]
47973#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
47974pub struct WebSearchToolCall {
47975    #[doc = "The unique ID of the web search tool call.\n"]
47976    pub id: String,
47977    #[doc = "The status of the web search tool call.\n"]
47978    pub status: crate::__types::web_search_tool_call::Status,
47979    #[doc = "An object describing the specific action taken in this web search call.\nIncludes details on how the model used the web (search, open_page, find).\n"]
47980    pub action: crate::__types::web_search_tool_call::Action,
47981}
47982impl<'de> serde::Deserialize<'de> for WebSearchToolCall {
47983    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
47984    where
47985        D: serde::Deserializer<'de>,
47986    {
47987        #[serde_with::serde_as]
47988        #[derive(serde :: Deserialize)]
47989        struct WebSearchToolCall {
47990            #[serde(rename = "id")]
47991            id: String,
47992            #[serde(rename = "type")]
47993            #[allow(dead_code)]
47994            r#type: crate::__types::web_search_tool_call::Type,
47995            #[serde(rename = "status")]
47996            status: crate::__types::web_search_tool_call::Status,
47997            #[serde(rename = "action")]
47998            action: crate::__types::web_search_tool_call::Action,
47999        }
48000        let WebSearchToolCall {
48001            id, status, action, ..
48002        } = WebSearchToolCall::deserialize(deserializer)?;
48003        Ok(Self { id, status, action })
48004    }
48005}
48006impl serde::Serialize for WebSearchToolCall {
48007    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
48008    where
48009        S: serde::Serializer,
48010    {
48011        #[serde_with::serde_as]
48012        #[derive(serde :: Serialize)]
48013        struct WebSearchToolCall<'a> {
48014            #[serde(rename = "id")]
48015            id: &'a String,
48016            #[serde(rename = "type")]
48017            r#type: &'a crate::__types::web_search_tool_call::Type,
48018            #[serde(rename = "status")]
48019            status: &'a crate::__types::web_search_tool_call::Status,
48020            #[serde(rename = "action")]
48021            action: &'a crate::__types::web_search_tool_call::Action,
48022        }
48023        let Self { id, status, action } = self;
48024        WebSearchToolCall {
48025            id,
48026            r#type: &Default::default(),
48027            status,
48028            action,
48029        }
48030        .serialize(serializer)
48031    }
48032}
48033#[allow(clippy::module_inception)]
48034pub mod webhook_batch_cancelled {
48035    #[doc = "Event data payload.\n"]
48036    #[derive(Clone, Debug, PartialEq)]
48037    #[serde_with::serde_as]
48038    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
48039    pub struct Data {
48040        #[doc = "The unique ID of the batch API request.\n"]
48041        #[serde(rename = "id")]
48042        pub id: String,
48043    }
48044    #[doc = "The object of the event. Always `event`.\n"]
48045    #[derive(Clone, Copy, Debug, Default, PartialEq)]
48046    pub struct Object;
48047    impl_serde!(Object, "event");
48048    #[doc = "The type of the event. Always `batch.cancelled`.\n"]
48049    #[derive(Clone, Copy, Debug, Default, PartialEq)]
48050    pub(crate) struct Type;
48051    impl_serde!(Type, "batch.cancelled");
48052}
48053#[doc = "Sent when a batch API request has been cancelled.\n"]
48054#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
48055pub struct WebhookBatchCancelled {
48056    #[doc = "The Unix timestamp (in seconds) of when the batch API request was cancelled.\n"]
48057    pub created_at: i64,
48058    #[doc = "The unique ID of the event.\n"]
48059    pub id: String,
48060    #[doc = "Event data payload.\n"]
48061    pub data: crate::__types::webhook_batch_cancelled::Data,
48062    #[doc = "The object of the event. Always `event`.\n"]
48063    #[builder(default)]
48064    pub object: Option<crate::__types::webhook_batch_cancelled::Object>,
48065}
48066impl<'de> serde::Deserialize<'de> for WebhookBatchCancelled {
48067    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
48068    where
48069        D: serde::Deserializer<'de>,
48070    {
48071        #[serde_with::serde_as]
48072        #[derive(serde :: Deserialize)]
48073        struct WebhookBatchCancelled {
48074            #[serde(rename = "created_at")]
48075            created_at: i64,
48076            #[serde(rename = "id")]
48077            id: String,
48078            #[serde(rename = "data")]
48079            data: crate::__types::webhook_batch_cancelled::Data,
48080            #[serde(rename = "object")]
48081            object: Option<crate::__types::webhook_batch_cancelled::Object>,
48082            #[serde(rename = "type")]
48083            #[allow(dead_code)]
48084            r#type: crate::__types::webhook_batch_cancelled::Type,
48085        }
48086        let WebhookBatchCancelled {
48087            created_at,
48088            id,
48089            data,
48090            object,
48091            ..
48092        } = WebhookBatchCancelled::deserialize(deserializer)?;
48093        Ok(Self {
48094            created_at,
48095            id,
48096            data,
48097            object,
48098        })
48099    }
48100}
48101impl serde::Serialize for WebhookBatchCancelled {
48102    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
48103    where
48104        S: serde::Serializer,
48105    {
48106        #[serde_with::serde_as]
48107        #[derive(serde :: Serialize)]
48108        struct WebhookBatchCancelled<'a> {
48109            #[serde(rename = "created_at")]
48110            created_at: &'a i64,
48111            #[serde(rename = "id")]
48112            id: &'a String,
48113            #[serde(rename = "data")]
48114            data: &'a crate::__types::webhook_batch_cancelled::Data,
48115            #[serde(rename = "object")]
48116            #[serde(skip_serializing_if = "Option::is_none")]
48117            object: &'a Option<crate::__types::webhook_batch_cancelled::Object>,
48118            #[serde(rename = "type")]
48119            r#type: &'a crate::__types::webhook_batch_cancelled::Type,
48120        }
48121        let Self {
48122            created_at,
48123            id,
48124            data,
48125            object,
48126        } = self;
48127        WebhookBatchCancelled {
48128            created_at,
48129            id,
48130            data,
48131            object,
48132            r#type: &Default::default(),
48133        }
48134        .serialize(serializer)
48135    }
48136}
48137#[allow(clippy::module_inception)]
48138pub mod webhook_batch_completed {
48139    #[doc = "Event data payload.\n"]
48140    #[derive(Clone, Debug, PartialEq)]
48141    #[serde_with::serde_as]
48142    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
48143    pub struct Data {
48144        #[doc = "The unique ID of the batch API request.\n"]
48145        #[serde(rename = "id")]
48146        pub id: String,
48147    }
48148    #[doc = "The object of the event. Always `event`.\n"]
48149    #[derive(Clone, Copy, Debug, Default, PartialEq)]
48150    pub struct Object;
48151    impl_serde!(Object, "event");
48152    #[doc = "The type of the event. Always `batch.completed`.\n"]
48153    #[derive(Clone, Copy, Debug, Default, PartialEq)]
48154    pub(crate) struct Type;
48155    impl_serde!(Type, "batch.completed");
48156}
48157#[doc = "Sent when a batch API request has been completed.\n"]
48158#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
48159pub struct WebhookBatchCompleted {
48160    #[doc = "The Unix timestamp (in seconds) of when the batch API request was completed.\n"]
48161    pub created_at: i64,
48162    #[doc = "The unique ID of the event.\n"]
48163    pub id: String,
48164    #[doc = "Event data payload.\n"]
48165    pub data: crate::__types::webhook_batch_completed::Data,
48166    #[doc = "The object of the event. Always `event`.\n"]
48167    #[builder(default)]
48168    pub object: Option<crate::__types::webhook_batch_completed::Object>,
48169}
48170impl<'de> serde::Deserialize<'de> for WebhookBatchCompleted {
48171    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
48172    where
48173        D: serde::Deserializer<'de>,
48174    {
48175        #[serde_with::serde_as]
48176        #[derive(serde :: Deserialize)]
48177        struct WebhookBatchCompleted {
48178            #[serde(rename = "created_at")]
48179            created_at: i64,
48180            #[serde(rename = "id")]
48181            id: String,
48182            #[serde(rename = "data")]
48183            data: crate::__types::webhook_batch_completed::Data,
48184            #[serde(rename = "object")]
48185            object: Option<crate::__types::webhook_batch_completed::Object>,
48186            #[serde(rename = "type")]
48187            #[allow(dead_code)]
48188            r#type: crate::__types::webhook_batch_completed::Type,
48189        }
48190        let WebhookBatchCompleted {
48191            created_at,
48192            id,
48193            data,
48194            object,
48195            ..
48196        } = WebhookBatchCompleted::deserialize(deserializer)?;
48197        Ok(Self {
48198            created_at,
48199            id,
48200            data,
48201            object,
48202        })
48203    }
48204}
48205impl serde::Serialize for WebhookBatchCompleted {
48206    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
48207    where
48208        S: serde::Serializer,
48209    {
48210        #[serde_with::serde_as]
48211        #[derive(serde :: Serialize)]
48212        struct WebhookBatchCompleted<'a> {
48213            #[serde(rename = "created_at")]
48214            created_at: &'a i64,
48215            #[serde(rename = "id")]
48216            id: &'a String,
48217            #[serde(rename = "data")]
48218            data: &'a crate::__types::webhook_batch_completed::Data,
48219            #[serde(rename = "object")]
48220            #[serde(skip_serializing_if = "Option::is_none")]
48221            object: &'a Option<crate::__types::webhook_batch_completed::Object>,
48222            #[serde(rename = "type")]
48223            r#type: &'a crate::__types::webhook_batch_completed::Type,
48224        }
48225        let Self {
48226            created_at,
48227            id,
48228            data,
48229            object,
48230        } = self;
48231        WebhookBatchCompleted {
48232            created_at,
48233            id,
48234            data,
48235            object,
48236            r#type: &Default::default(),
48237        }
48238        .serialize(serializer)
48239    }
48240}
48241#[allow(clippy::module_inception)]
48242pub mod webhook_batch_expired {
48243    #[doc = "Event data payload.\n"]
48244    #[derive(Clone, Debug, PartialEq)]
48245    #[serde_with::serde_as]
48246    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
48247    pub struct Data {
48248        #[doc = "The unique ID of the batch API request.\n"]
48249        #[serde(rename = "id")]
48250        pub id: String,
48251    }
48252    #[doc = "The object of the event. Always `event`.\n"]
48253    #[derive(Clone, Copy, Debug, Default, PartialEq)]
48254    pub struct Object;
48255    impl_serde!(Object, "event");
48256    #[doc = "The type of the event. Always `batch.expired`.\n"]
48257    #[derive(Clone, Copy, Debug, Default, PartialEq)]
48258    pub(crate) struct Type;
48259    impl_serde!(Type, "batch.expired");
48260}
48261#[doc = "Sent when a batch API request has expired.\n"]
48262#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
48263pub struct WebhookBatchExpired {
48264    #[doc = "The Unix timestamp (in seconds) of when the batch API request expired.\n"]
48265    pub created_at: i64,
48266    #[doc = "The unique ID of the event.\n"]
48267    pub id: String,
48268    #[doc = "Event data payload.\n"]
48269    pub data: crate::__types::webhook_batch_expired::Data,
48270    #[doc = "The object of the event. Always `event`.\n"]
48271    #[builder(default)]
48272    pub object: Option<crate::__types::webhook_batch_expired::Object>,
48273}
48274impl<'de> serde::Deserialize<'de> for WebhookBatchExpired {
48275    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
48276    where
48277        D: serde::Deserializer<'de>,
48278    {
48279        #[serde_with::serde_as]
48280        #[derive(serde :: Deserialize)]
48281        struct WebhookBatchExpired {
48282            #[serde(rename = "created_at")]
48283            created_at: i64,
48284            #[serde(rename = "id")]
48285            id: String,
48286            #[serde(rename = "data")]
48287            data: crate::__types::webhook_batch_expired::Data,
48288            #[serde(rename = "object")]
48289            object: Option<crate::__types::webhook_batch_expired::Object>,
48290            #[serde(rename = "type")]
48291            #[allow(dead_code)]
48292            r#type: crate::__types::webhook_batch_expired::Type,
48293        }
48294        let WebhookBatchExpired {
48295            created_at,
48296            id,
48297            data,
48298            object,
48299            ..
48300        } = WebhookBatchExpired::deserialize(deserializer)?;
48301        Ok(Self {
48302            created_at,
48303            id,
48304            data,
48305            object,
48306        })
48307    }
48308}
48309impl serde::Serialize for WebhookBatchExpired {
48310    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
48311    where
48312        S: serde::Serializer,
48313    {
48314        #[serde_with::serde_as]
48315        #[derive(serde :: Serialize)]
48316        struct WebhookBatchExpired<'a> {
48317            #[serde(rename = "created_at")]
48318            created_at: &'a i64,
48319            #[serde(rename = "id")]
48320            id: &'a String,
48321            #[serde(rename = "data")]
48322            data: &'a crate::__types::webhook_batch_expired::Data,
48323            #[serde(rename = "object")]
48324            #[serde(skip_serializing_if = "Option::is_none")]
48325            object: &'a Option<crate::__types::webhook_batch_expired::Object>,
48326            #[serde(rename = "type")]
48327            r#type: &'a crate::__types::webhook_batch_expired::Type,
48328        }
48329        let Self {
48330            created_at,
48331            id,
48332            data,
48333            object,
48334        } = self;
48335        WebhookBatchExpired {
48336            created_at,
48337            id,
48338            data,
48339            object,
48340            r#type: &Default::default(),
48341        }
48342        .serialize(serializer)
48343    }
48344}
48345#[allow(clippy::module_inception)]
48346pub mod webhook_batch_failed {
48347    #[doc = "Event data payload.\n"]
48348    #[derive(Clone, Debug, PartialEq)]
48349    #[serde_with::serde_as]
48350    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
48351    pub struct Data {
48352        #[doc = "The unique ID of the batch API request.\n"]
48353        #[serde(rename = "id")]
48354        pub id: String,
48355    }
48356    #[doc = "The object of the event. Always `event`.\n"]
48357    #[derive(Clone, Copy, Debug, Default, PartialEq)]
48358    pub struct Object;
48359    impl_serde!(Object, "event");
48360    #[doc = "The type of the event. Always `batch.failed`.\n"]
48361    #[derive(Clone, Copy, Debug, Default, PartialEq)]
48362    pub(crate) struct Type;
48363    impl_serde!(Type, "batch.failed");
48364}
48365#[doc = "Sent when a batch API request has failed.\n"]
48366#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
48367pub struct WebhookBatchFailed {
48368    #[doc = "The Unix timestamp (in seconds) of when the batch API request failed.\n"]
48369    pub created_at: i64,
48370    #[doc = "The unique ID of the event.\n"]
48371    pub id: String,
48372    #[doc = "Event data payload.\n"]
48373    pub data: crate::__types::webhook_batch_failed::Data,
48374    #[doc = "The object of the event. Always `event`.\n"]
48375    #[builder(default)]
48376    pub object: Option<crate::__types::webhook_batch_failed::Object>,
48377}
48378impl<'de> serde::Deserialize<'de> for WebhookBatchFailed {
48379    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
48380    where
48381        D: serde::Deserializer<'de>,
48382    {
48383        #[serde_with::serde_as]
48384        #[derive(serde :: Deserialize)]
48385        struct WebhookBatchFailed {
48386            #[serde(rename = "created_at")]
48387            created_at: i64,
48388            #[serde(rename = "id")]
48389            id: String,
48390            #[serde(rename = "data")]
48391            data: crate::__types::webhook_batch_failed::Data,
48392            #[serde(rename = "object")]
48393            object: Option<crate::__types::webhook_batch_failed::Object>,
48394            #[serde(rename = "type")]
48395            #[allow(dead_code)]
48396            r#type: crate::__types::webhook_batch_failed::Type,
48397        }
48398        let WebhookBatchFailed {
48399            created_at,
48400            id,
48401            data,
48402            object,
48403            ..
48404        } = WebhookBatchFailed::deserialize(deserializer)?;
48405        Ok(Self {
48406            created_at,
48407            id,
48408            data,
48409            object,
48410        })
48411    }
48412}
48413impl serde::Serialize for WebhookBatchFailed {
48414    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
48415    where
48416        S: serde::Serializer,
48417    {
48418        #[serde_with::serde_as]
48419        #[derive(serde :: Serialize)]
48420        struct WebhookBatchFailed<'a> {
48421            #[serde(rename = "created_at")]
48422            created_at: &'a i64,
48423            #[serde(rename = "id")]
48424            id: &'a String,
48425            #[serde(rename = "data")]
48426            data: &'a crate::__types::webhook_batch_failed::Data,
48427            #[serde(rename = "object")]
48428            #[serde(skip_serializing_if = "Option::is_none")]
48429            object: &'a Option<crate::__types::webhook_batch_failed::Object>,
48430            #[serde(rename = "type")]
48431            r#type: &'a crate::__types::webhook_batch_failed::Type,
48432        }
48433        let Self {
48434            created_at,
48435            id,
48436            data,
48437            object,
48438        } = self;
48439        WebhookBatchFailed {
48440            created_at,
48441            id,
48442            data,
48443            object,
48444            r#type: &Default::default(),
48445        }
48446        .serialize(serializer)
48447    }
48448}
48449#[allow(clippy::module_inception)]
48450pub mod webhook_eval_run_canceled {
48451    #[doc = "Event data payload.\n"]
48452    #[derive(Clone, Debug, PartialEq)]
48453    #[serde_with::serde_as]
48454    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
48455    pub struct Data {
48456        #[doc = "The unique ID of the eval run.\n"]
48457        #[serde(rename = "id")]
48458        pub id: String,
48459    }
48460    #[doc = "The object of the event. Always `event`.\n"]
48461    #[derive(Clone, Copy, Debug, Default, PartialEq)]
48462    pub struct Object;
48463    impl_serde!(Object, "event");
48464    #[doc = "The type of the event. Always `eval.run.canceled`.\n"]
48465    #[derive(Clone, Copy, Debug, Default, PartialEq)]
48466    pub(crate) struct Type;
48467    impl_serde!(Type, "eval.run.canceled");
48468}
48469#[doc = "Sent when an eval run has been canceled.\n"]
48470#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
48471pub struct WebhookEvalRunCanceled {
48472    #[doc = "The Unix timestamp (in seconds) of when the eval run was canceled.\n"]
48473    pub created_at: i64,
48474    #[doc = "The unique ID of the event.\n"]
48475    pub id: String,
48476    #[doc = "Event data payload.\n"]
48477    pub data: crate::__types::webhook_eval_run_canceled::Data,
48478    #[doc = "The object of the event. Always `event`.\n"]
48479    #[builder(default)]
48480    pub object: Option<crate::__types::webhook_eval_run_canceled::Object>,
48481}
48482impl<'de> serde::Deserialize<'de> for WebhookEvalRunCanceled {
48483    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
48484    where
48485        D: serde::Deserializer<'de>,
48486    {
48487        #[serde_with::serde_as]
48488        #[derive(serde :: Deserialize)]
48489        struct WebhookEvalRunCanceled {
48490            #[serde(rename = "created_at")]
48491            created_at: i64,
48492            #[serde(rename = "id")]
48493            id: String,
48494            #[serde(rename = "data")]
48495            data: crate::__types::webhook_eval_run_canceled::Data,
48496            #[serde(rename = "object")]
48497            object: Option<crate::__types::webhook_eval_run_canceled::Object>,
48498            #[serde(rename = "type")]
48499            #[allow(dead_code)]
48500            r#type: crate::__types::webhook_eval_run_canceled::Type,
48501        }
48502        let WebhookEvalRunCanceled {
48503            created_at,
48504            id,
48505            data,
48506            object,
48507            ..
48508        } = WebhookEvalRunCanceled::deserialize(deserializer)?;
48509        Ok(Self {
48510            created_at,
48511            id,
48512            data,
48513            object,
48514        })
48515    }
48516}
48517impl serde::Serialize for WebhookEvalRunCanceled {
48518    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
48519    where
48520        S: serde::Serializer,
48521    {
48522        #[serde_with::serde_as]
48523        #[derive(serde :: Serialize)]
48524        struct WebhookEvalRunCanceled<'a> {
48525            #[serde(rename = "created_at")]
48526            created_at: &'a i64,
48527            #[serde(rename = "id")]
48528            id: &'a String,
48529            #[serde(rename = "data")]
48530            data: &'a crate::__types::webhook_eval_run_canceled::Data,
48531            #[serde(rename = "object")]
48532            #[serde(skip_serializing_if = "Option::is_none")]
48533            object: &'a Option<crate::__types::webhook_eval_run_canceled::Object>,
48534            #[serde(rename = "type")]
48535            r#type: &'a crate::__types::webhook_eval_run_canceled::Type,
48536        }
48537        let Self {
48538            created_at,
48539            id,
48540            data,
48541            object,
48542        } = self;
48543        WebhookEvalRunCanceled {
48544            created_at,
48545            id,
48546            data,
48547            object,
48548            r#type: &Default::default(),
48549        }
48550        .serialize(serializer)
48551    }
48552}
48553#[allow(clippy::module_inception)]
48554pub mod webhook_eval_run_failed {
48555    #[doc = "Event data payload.\n"]
48556    #[derive(Clone, Debug, PartialEq)]
48557    #[serde_with::serde_as]
48558    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
48559    pub struct Data {
48560        #[doc = "The unique ID of the eval run.\n"]
48561        #[serde(rename = "id")]
48562        pub id: String,
48563    }
48564    #[doc = "The object of the event. Always `event`.\n"]
48565    #[derive(Clone, Copy, Debug, Default, PartialEq)]
48566    pub struct Object;
48567    impl_serde!(Object, "event");
48568    #[doc = "The type of the event. Always `eval.run.failed`.\n"]
48569    #[derive(Clone, Copy, Debug, Default, PartialEq)]
48570    pub(crate) struct Type;
48571    impl_serde!(Type, "eval.run.failed");
48572}
48573#[doc = "Sent when an eval run has failed.\n"]
48574#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
48575pub struct WebhookEvalRunFailed {
48576    #[doc = "The Unix timestamp (in seconds) of when the eval run failed.\n"]
48577    pub created_at: i64,
48578    #[doc = "The unique ID of the event.\n"]
48579    pub id: String,
48580    #[doc = "Event data payload.\n"]
48581    pub data: crate::__types::webhook_eval_run_failed::Data,
48582    #[doc = "The object of the event. Always `event`.\n"]
48583    #[builder(default)]
48584    pub object: Option<crate::__types::webhook_eval_run_failed::Object>,
48585}
48586impl<'de> serde::Deserialize<'de> for WebhookEvalRunFailed {
48587    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
48588    where
48589        D: serde::Deserializer<'de>,
48590    {
48591        #[serde_with::serde_as]
48592        #[derive(serde :: Deserialize)]
48593        struct WebhookEvalRunFailed {
48594            #[serde(rename = "created_at")]
48595            created_at: i64,
48596            #[serde(rename = "id")]
48597            id: String,
48598            #[serde(rename = "data")]
48599            data: crate::__types::webhook_eval_run_failed::Data,
48600            #[serde(rename = "object")]
48601            object: Option<crate::__types::webhook_eval_run_failed::Object>,
48602            #[serde(rename = "type")]
48603            #[allow(dead_code)]
48604            r#type: crate::__types::webhook_eval_run_failed::Type,
48605        }
48606        let WebhookEvalRunFailed {
48607            created_at,
48608            id,
48609            data,
48610            object,
48611            ..
48612        } = WebhookEvalRunFailed::deserialize(deserializer)?;
48613        Ok(Self {
48614            created_at,
48615            id,
48616            data,
48617            object,
48618        })
48619    }
48620}
48621impl serde::Serialize for WebhookEvalRunFailed {
48622    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
48623    where
48624        S: serde::Serializer,
48625    {
48626        #[serde_with::serde_as]
48627        #[derive(serde :: Serialize)]
48628        struct WebhookEvalRunFailed<'a> {
48629            #[serde(rename = "created_at")]
48630            created_at: &'a i64,
48631            #[serde(rename = "id")]
48632            id: &'a String,
48633            #[serde(rename = "data")]
48634            data: &'a crate::__types::webhook_eval_run_failed::Data,
48635            #[serde(rename = "object")]
48636            #[serde(skip_serializing_if = "Option::is_none")]
48637            object: &'a Option<crate::__types::webhook_eval_run_failed::Object>,
48638            #[serde(rename = "type")]
48639            r#type: &'a crate::__types::webhook_eval_run_failed::Type,
48640        }
48641        let Self {
48642            created_at,
48643            id,
48644            data,
48645            object,
48646        } = self;
48647        WebhookEvalRunFailed {
48648            created_at,
48649            id,
48650            data,
48651            object,
48652            r#type: &Default::default(),
48653        }
48654        .serialize(serializer)
48655    }
48656}
48657#[allow(clippy::module_inception)]
48658pub mod webhook_eval_run_succeeded {
48659    #[doc = "Event data payload.\n"]
48660    #[derive(Clone, Debug, PartialEq)]
48661    #[serde_with::serde_as]
48662    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
48663    pub struct Data {
48664        #[doc = "The unique ID of the eval run.\n"]
48665        #[serde(rename = "id")]
48666        pub id: String,
48667    }
48668    #[doc = "The object of the event. Always `event`.\n"]
48669    #[derive(Clone, Copy, Debug, Default, PartialEq)]
48670    pub struct Object;
48671    impl_serde!(Object, "event");
48672    #[doc = "The type of the event. Always `eval.run.succeeded`.\n"]
48673    #[derive(Clone, Copy, Debug, Default, PartialEq)]
48674    pub(crate) struct Type;
48675    impl_serde!(Type, "eval.run.succeeded");
48676}
48677#[doc = "Sent when an eval run has succeeded.\n"]
48678#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
48679pub struct WebhookEvalRunSucceeded {
48680    #[doc = "The Unix timestamp (in seconds) of when the eval run succeeded.\n"]
48681    pub created_at: i64,
48682    #[doc = "The unique ID of the event.\n"]
48683    pub id: String,
48684    #[doc = "Event data payload.\n"]
48685    pub data: crate::__types::webhook_eval_run_succeeded::Data,
48686    #[doc = "The object of the event. Always `event`.\n"]
48687    #[builder(default)]
48688    pub object: Option<crate::__types::webhook_eval_run_succeeded::Object>,
48689}
48690impl<'de> serde::Deserialize<'de> for WebhookEvalRunSucceeded {
48691    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
48692    where
48693        D: serde::Deserializer<'de>,
48694    {
48695        #[serde_with::serde_as]
48696        #[derive(serde :: Deserialize)]
48697        struct WebhookEvalRunSucceeded {
48698            #[serde(rename = "created_at")]
48699            created_at: i64,
48700            #[serde(rename = "id")]
48701            id: String,
48702            #[serde(rename = "data")]
48703            data: crate::__types::webhook_eval_run_succeeded::Data,
48704            #[serde(rename = "object")]
48705            object: Option<crate::__types::webhook_eval_run_succeeded::Object>,
48706            #[serde(rename = "type")]
48707            #[allow(dead_code)]
48708            r#type: crate::__types::webhook_eval_run_succeeded::Type,
48709        }
48710        let WebhookEvalRunSucceeded {
48711            created_at,
48712            id,
48713            data,
48714            object,
48715            ..
48716        } = WebhookEvalRunSucceeded::deserialize(deserializer)?;
48717        Ok(Self {
48718            created_at,
48719            id,
48720            data,
48721            object,
48722        })
48723    }
48724}
48725impl serde::Serialize for WebhookEvalRunSucceeded {
48726    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
48727    where
48728        S: serde::Serializer,
48729    {
48730        #[serde_with::serde_as]
48731        #[derive(serde :: Serialize)]
48732        struct WebhookEvalRunSucceeded<'a> {
48733            #[serde(rename = "created_at")]
48734            created_at: &'a i64,
48735            #[serde(rename = "id")]
48736            id: &'a String,
48737            #[serde(rename = "data")]
48738            data: &'a crate::__types::webhook_eval_run_succeeded::Data,
48739            #[serde(rename = "object")]
48740            #[serde(skip_serializing_if = "Option::is_none")]
48741            object: &'a Option<crate::__types::webhook_eval_run_succeeded::Object>,
48742            #[serde(rename = "type")]
48743            r#type: &'a crate::__types::webhook_eval_run_succeeded::Type,
48744        }
48745        let Self {
48746            created_at,
48747            id,
48748            data,
48749            object,
48750        } = self;
48751        WebhookEvalRunSucceeded {
48752            created_at,
48753            id,
48754            data,
48755            object,
48756            r#type: &Default::default(),
48757        }
48758        .serialize(serializer)
48759    }
48760}
48761#[allow(clippy::module_inception)]
48762pub mod webhook_fine_tuning_job_cancelled {
48763    #[doc = "Event data payload.\n"]
48764    #[derive(Clone, Debug, PartialEq)]
48765    #[serde_with::serde_as]
48766    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
48767    pub struct Data {
48768        #[doc = "The unique ID of the fine-tuning job.\n"]
48769        #[serde(rename = "id")]
48770        pub id: String,
48771    }
48772    #[doc = "The object of the event. Always `event`.\n"]
48773    #[derive(Clone, Copy, Debug, Default, PartialEq)]
48774    pub struct Object;
48775    impl_serde!(Object, "event");
48776    #[doc = "The type of the event. Always `fine_tuning.job.cancelled`.\n"]
48777    #[derive(Clone, Copy, Debug, Default, PartialEq)]
48778    pub(crate) struct Type;
48779    impl_serde!(Type, "fine_tuning.job.cancelled");
48780}
48781#[doc = "Sent when a fine-tuning job has been cancelled.\n"]
48782#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
48783pub struct WebhookFineTuningJobCancelled {
48784    #[doc = "The Unix timestamp (in seconds) of when the fine-tuning job was cancelled.\n"]
48785    pub created_at: i64,
48786    #[doc = "The unique ID of the event.\n"]
48787    pub id: String,
48788    #[doc = "Event data payload.\n"]
48789    pub data: crate::__types::webhook_fine_tuning_job_cancelled::Data,
48790    #[doc = "The object of the event. Always `event`.\n"]
48791    #[builder(default)]
48792    pub object: Option<crate::__types::webhook_fine_tuning_job_cancelled::Object>,
48793}
48794impl<'de> serde::Deserialize<'de> for WebhookFineTuningJobCancelled {
48795    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
48796    where
48797        D: serde::Deserializer<'de>,
48798    {
48799        #[serde_with::serde_as]
48800        #[derive(serde :: Deserialize)]
48801        struct WebhookFineTuningJobCancelled {
48802            #[serde(rename = "created_at")]
48803            created_at: i64,
48804            #[serde(rename = "id")]
48805            id: String,
48806            #[serde(rename = "data")]
48807            data: crate::__types::webhook_fine_tuning_job_cancelled::Data,
48808            #[serde(rename = "object")]
48809            object: Option<crate::__types::webhook_fine_tuning_job_cancelled::Object>,
48810            #[serde(rename = "type")]
48811            #[allow(dead_code)]
48812            r#type: crate::__types::webhook_fine_tuning_job_cancelled::Type,
48813        }
48814        let WebhookFineTuningJobCancelled {
48815            created_at,
48816            id,
48817            data,
48818            object,
48819            ..
48820        } = WebhookFineTuningJobCancelled::deserialize(deserializer)?;
48821        Ok(Self {
48822            created_at,
48823            id,
48824            data,
48825            object,
48826        })
48827    }
48828}
48829impl serde::Serialize for WebhookFineTuningJobCancelled {
48830    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
48831    where
48832        S: serde::Serializer,
48833    {
48834        #[serde_with::serde_as]
48835        #[derive(serde :: Serialize)]
48836        struct WebhookFineTuningJobCancelled<'a> {
48837            #[serde(rename = "created_at")]
48838            created_at: &'a i64,
48839            #[serde(rename = "id")]
48840            id: &'a String,
48841            #[serde(rename = "data")]
48842            data: &'a crate::__types::webhook_fine_tuning_job_cancelled::Data,
48843            #[serde(rename = "object")]
48844            #[serde(skip_serializing_if = "Option::is_none")]
48845            object: &'a Option<crate::__types::webhook_fine_tuning_job_cancelled::Object>,
48846            #[serde(rename = "type")]
48847            r#type: &'a crate::__types::webhook_fine_tuning_job_cancelled::Type,
48848        }
48849        let Self {
48850            created_at,
48851            id,
48852            data,
48853            object,
48854        } = self;
48855        WebhookFineTuningJobCancelled {
48856            created_at,
48857            id,
48858            data,
48859            object,
48860            r#type: &Default::default(),
48861        }
48862        .serialize(serializer)
48863    }
48864}
48865#[allow(clippy::module_inception)]
48866pub mod webhook_fine_tuning_job_failed {
48867    #[doc = "Event data payload.\n"]
48868    #[derive(Clone, Debug, PartialEq)]
48869    #[serde_with::serde_as]
48870    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
48871    pub struct Data {
48872        #[doc = "The unique ID of the fine-tuning job.\n"]
48873        #[serde(rename = "id")]
48874        pub id: String,
48875    }
48876    #[doc = "The object of the event. Always `event`.\n"]
48877    #[derive(Clone, Copy, Debug, Default, PartialEq)]
48878    pub struct Object;
48879    impl_serde!(Object, "event");
48880    #[doc = "The type of the event. Always `fine_tuning.job.failed`.\n"]
48881    #[derive(Clone, Copy, Debug, Default, PartialEq)]
48882    pub(crate) struct Type;
48883    impl_serde!(Type, "fine_tuning.job.failed");
48884}
48885#[doc = "Sent when a fine-tuning job has failed.\n"]
48886#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
48887pub struct WebhookFineTuningJobFailed {
48888    #[doc = "The Unix timestamp (in seconds) of when the fine-tuning job failed.\n"]
48889    pub created_at: i64,
48890    #[doc = "The unique ID of the event.\n"]
48891    pub id: String,
48892    #[doc = "Event data payload.\n"]
48893    pub data: crate::__types::webhook_fine_tuning_job_failed::Data,
48894    #[doc = "The object of the event. Always `event`.\n"]
48895    #[builder(default)]
48896    pub object: Option<crate::__types::webhook_fine_tuning_job_failed::Object>,
48897}
48898impl<'de> serde::Deserialize<'de> for WebhookFineTuningJobFailed {
48899    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
48900    where
48901        D: serde::Deserializer<'de>,
48902    {
48903        #[serde_with::serde_as]
48904        #[derive(serde :: Deserialize)]
48905        struct WebhookFineTuningJobFailed {
48906            #[serde(rename = "created_at")]
48907            created_at: i64,
48908            #[serde(rename = "id")]
48909            id: String,
48910            #[serde(rename = "data")]
48911            data: crate::__types::webhook_fine_tuning_job_failed::Data,
48912            #[serde(rename = "object")]
48913            object: Option<crate::__types::webhook_fine_tuning_job_failed::Object>,
48914            #[serde(rename = "type")]
48915            #[allow(dead_code)]
48916            r#type: crate::__types::webhook_fine_tuning_job_failed::Type,
48917        }
48918        let WebhookFineTuningJobFailed {
48919            created_at,
48920            id,
48921            data,
48922            object,
48923            ..
48924        } = WebhookFineTuningJobFailed::deserialize(deserializer)?;
48925        Ok(Self {
48926            created_at,
48927            id,
48928            data,
48929            object,
48930        })
48931    }
48932}
48933impl serde::Serialize for WebhookFineTuningJobFailed {
48934    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
48935    where
48936        S: serde::Serializer,
48937    {
48938        #[serde_with::serde_as]
48939        #[derive(serde :: Serialize)]
48940        struct WebhookFineTuningJobFailed<'a> {
48941            #[serde(rename = "created_at")]
48942            created_at: &'a i64,
48943            #[serde(rename = "id")]
48944            id: &'a String,
48945            #[serde(rename = "data")]
48946            data: &'a crate::__types::webhook_fine_tuning_job_failed::Data,
48947            #[serde(rename = "object")]
48948            #[serde(skip_serializing_if = "Option::is_none")]
48949            object: &'a Option<crate::__types::webhook_fine_tuning_job_failed::Object>,
48950            #[serde(rename = "type")]
48951            r#type: &'a crate::__types::webhook_fine_tuning_job_failed::Type,
48952        }
48953        let Self {
48954            created_at,
48955            id,
48956            data,
48957            object,
48958        } = self;
48959        WebhookFineTuningJobFailed {
48960            created_at,
48961            id,
48962            data,
48963            object,
48964            r#type: &Default::default(),
48965        }
48966        .serialize(serializer)
48967    }
48968}
48969#[allow(clippy::module_inception)]
48970pub mod webhook_fine_tuning_job_succeeded {
48971    #[doc = "Event data payload.\n"]
48972    #[derive(Clone, Debug, PartialEq)]
48973    #[serde_with::serde_as]
48974    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
48975    pub struct Data {
48976        #[doc = "The unique ID of the fine-tuning job.\n"]
48977        #[serde(rename = "id")]
48978        pub id: String,
48979    }
48980    #[doc = "The object of the event. Always `event`.\n"]
48981    #[derive(Clone, Copy, Debug, Default, PartialEq)]
48982    pub struct Object;
48983    impl_serde!(Object, "event");
48984    #[doc = "The type of the event. Always `fine_tuning.job.succeeded`.\n"]
48985    #[derive(Clone, Copy, Debug, Default, PartialEq)]
48986    pub(crate) struct Type;
48987    impl_serde!(Type, "fine_tuning.job.succeeded");
48988}
48989#[doc = "Sent when a fine-tuning job has succeeded.\n"]
48990#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
48991pub struct WebhookFineTuningJobSucceeded {
48992    #[doc = "The Unix timestamp (in seconds) of when the fine-tuning job succeeded.\n"]
48993    pub created_at: i64,
48994    #[doc = "The unique ID of the event.\n"]
48995    pub id: String,
48996    #[doc = "Event data payload.\n"]
48997    pub data: crate::__types::webhook_fine_tuning_job_succeeded::Data,
48998    #[doc = "The object of the event. Always `event`.\n"]
48999    #[builder(default)]
49000    pub object: Option<crate::__types::webhook_fine_tuning_job_succeeded::Object>,
49001}
49002impl<'de> serde::Deserialize<'de> for WebhookFineTuningJobSucceeded {
49003    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
49004    where
49005        D: serde::Deserializer<'de>,
49006    {
49007        #[serde_with::serde_as]
49008        #[derive(serde :: Deserialize)]
49009        struct WebhookFineTuningJobSucceeded {
49010            #[serde(rename = "created_at")]
49011            created_at: i64,
49012            #[serde(rename = "id")]
49013            id: String,
49014            #[serde(rename = "data")]
49015            data: crate::__types::webhook_fine_tuning_job_succeeded::Data,
49016            #[serde(rename = "object")]
49017            object: Option<crate::__types::webhook_fine_tuning_job_succeeded::Object>,
49018            #[serde(rename = "type")]
49019            #[allow(dead_code)]
49020            r#type: crate::__types::webhook_fine_tuning_job_succeeded::Type,
49021        }
49022        let WebhookFineTuningJobSucceeded {
49023            created_at,
49024            id,
49025            data,
49026            object,
49027            ..
49028        } = WebhookFineTuningJobSucceeded::deserialize(deserializer)?;
49029        Ok(Self {
49030            created_at,
49031            id,
49032            data,
49033            object,
49034        })
49035    }
49036}
49037impl serde::Serialize for WebhookFineTuningJobSucceeded {
49038    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
49039    where
49040        S: serde::Serializer,
49041    {
49042        #[serde_with::serde_as]
49043        #[derive(serde :: Serialize)]
49044        struct WebhookFineTuningJobSucceeded<'a> {
49045            #[serde(rename = "created_at")]
49046            created_at: &'a i64,
49047            #[serde(rename = "id")]
49048            id: &'a String,
49049            #[serde(rename = "data")]
49050            data: &'a crate::__types::webhook_fine_tuning_job_succeeded::Data,
49051            #[serde(rename = "object")]
49052            #[serde(skip_serializing_if = "Option::is_none")]
49053            object: &'a Option<crate::__types::webhook_fine_tuning_job_succeeded::Object>,
49054            #[serde(rename = "type")]
49055            r#type: &'a crate::__types::webhook_fine_tuning_job_succeeded::Type,
49056        }
49057        let Self {
49058            created_at,
49059            id,
49060            data,
49061            object,
49062        } = self;
49063        WebhookFineTuningJobSucceeded {
49064            created_at,
49065            id,
49066            data,
49067            object,
49068            r#type: &Default::default(),
49069        }
49070        .serialize(serializer)
49071    }
49072}
49073#[allow(clippy::module_inception)]
49074pub mod webhook_response_cancelled {
49075    #[doc = "Event data payload.\n"]
49076    #[derive(Clone, Debug, PartialEq)]
49077    #[serde_with::serde_as]
49078    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
49079    pub struct Data {
49080        #[doc = "The unique ID of the model response.\n"]
49081        #[serde(rename = "id")]
49082        pub id: String,
49083    }
49084    #[doc = "The object of the event. Always `event`.\n"]
49085    #[derive(Clone, Copy, Debug, Default, PartialEq)]
49086    pub struct Object;
49087    impl_serde!(Object, "event");
49088    #[doc = "The type of the event. Always `response.cancelled`.\n"]
49089    #[derive(Clone, Copy, Debug, Default, PartialEq)]
49090    pub(crate) struct Type;
49091    impl_serde!(Type, "response.cancelled");
49092}
49093#[doc = "Sent when a background response has been cancelled.\n"]
49094#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
49095pub struct WebhookResponseCancelled {
49096    #[doc = "The Unix timestamp (in seconds) of when the model response was cancelled.\n"]
49097    pub created_at: i64,
49098    #[doc = "The unique ID of the event.\n"]
49099    pub id: String,
49100    #[doc = "Event data payload.\n"]
49101    pub data: crate::__types::webhook_response_cancelled::Data,
49102    #[doc = "The object of the event. Always `event`.\n"]
49103    #[builder(default)]
49104    pub object: Option<crate::__types::webhook_response_cancelled::Object>,
49105}
49106impl<'de> serde::Deserialize<'de> for WebhookResponseCancelled {
49107    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
49108    where
49109        D: serde::Deserializer<'de>,
49110    {
49111        #[serde_with::serde_as]
49112        #[derive(serde :: Deserialize)]
49113        struct WebhookResponseCancelled {
49114            #[serde(rename = "created_at")]
49115            created_at: i64,
49116            #[serde(rename = "id")]
49117            id: String,
49118            #[serde(rename = "data")]
49119            data: crate::__types::webhook_response_cancelled::Data,
49120            #[serde(rename = "object")]
49121            object: Option<crate::__types::webhook_response_cancelled::Object>,
49122            #[serde(rename = "type")]
49123            #[allow(dead_code)]
49124            r#type: crate::__types::webhook_response_cancelled::Type,
49125        }
49126        let WebhookResponseCancelled {
49127            created_at,
49128            id,
49129            data,
49130            object,
49131            ..
49132        } = WebhookResponseCancelled::deserialize(deserializer)?;
49133        Ok(Self {
49134            created_at,
49135            id,
49136            data,
49137            object,
49138        })
49139    }
49140}
49141impl serde::Serialize for WebhookResponseCancelled {
49142    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
49143    where
49144        S: serde::Serializer,
49145    {
49146        #[serde_with::serde_as]
49147        #[derive(serde :: Serialize)]
49148        struct WebhookResponseCancelled<'a> {
49149            #[serde(rename = "created_at")]
49150            created_at: &'a i64,
49151            #[serde(rename = "id")]
49152            id: &'a String,
49153            #[serde(rename = "data")]
49154            data: &'a crate::__types::webhook_response_cancelled::Data,
49155            #[serde(rename = "object")]
49156            #[serde(skip_serializing_if = "Option::is_none")]
49157            object: &'a Option<crate::__types::webhook_response_cancelled::Object>,
49158            #[serde(rename = "type")]
49159            r#type: &'a crate::__types::webhook_response_cancelled::Type,
49160        }
49161        let Self {
49162            created_at,
49163            id,
49164            data,
49165            object,
49166        } = self;
49167        WebhookResponseCancelled {
49168            created_at,
49169            id,
49170            data,
49171            object,
49172            r#type: &Default::default(),
49173        }
49174        .serialize(serializer)
49175    }
49176}
49177#[allow(clippy::module_inception)]
49178pub mod webhook_response_completed {
49179    #[doc = "Event data payload.\n"]
49180    #[derive(Clone, Debug, PartialEq)]
49181    #[serde_with::serde_as]
49182    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
49183    pub struct Data {
49184        #[doc = "The unique ID of the model response.\n"]
49185        #[serde(rename = "id")]
49186        pub id: String,
49187    }
49188    #[doc = "The object of the event. Always `event`.\n"]
49189    #[derive(Clone, Copy, Debug, Default, PartialEq)]
49190    pub struct Object;
49191    impl_serde!(Object, "event");
49192    #[doc = "The type of the event. Always `response.completed`.\n"]
49193    #[derive(Clone, Copy, Debug, Default, PartialEq)]
49194    pub(crate) struct Type;
49195    impl_serde!(Type, "response.completed");
49196}
49197#[doc = "Sent when a background response has been completed.\n"]
49198#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
49199pub struct WebhookResponseCompleted {
49200    #[doc = "The Unix timestamp (in seconds) of when the model response was completed.\n"]
49201    pub created_at: i64,
49202    #[doc = "The unique ID of the event.\n"]
49203    pub id: String,
49204    #[doc = "Event data payload.\n"]
49205    pub data: crate::__types::webhook_response_completed::Data,
49206    #[doc = "The object of the event. Always `event`.\n"]
49207    #[builder(default)]
49208    pub object: Option<crate::__types::webhook_response_completed::Object>,
49209}
49210impl<'de> serde::Deserialize<'de> for WebhookResponseCompleted {
49211    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
49212    where
49213        D: serde::Deserializer<'de>,
49214    {
49215        #[serde_with::serde_as]
49216        #[derive(serde :: Deserialize)]
49217        struct WebhookResponseCompleted {
49218            #[serde(rename = "created_at")]
49219            created_at: i64,
49220            #[serde(rename = "id")]
49221            id: String,
49222            #[serde(rename = "data")]
49223            data: crate::__types::webhook_response_completed::Data,
49224            #[serde(rename = "object")]
49225            object: Option<crate::__types::webhook_response_completed::Object>,
49226            #[serde(rename = "type")]
49227            #[allow(dead_code)]
49228            r#type: crate::__types::webhook_response_completed::Type,
49229        }
49230        let WebhookResponseCompleted {
49231            created_at,
49232            id,
49233            data,
49234            object,
49235            ..
49236        } = WebhookResponseCompleted::deserialize(deserializer)?;
49237        Ok(Self {
49238            created_at,
49239            id,
49240            data,
49241            object,
49242        })
49243    }
49244}
49245impl serde::Serialize for WebhookResponseCompleted {
49246    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
49247    where
49248        S: serde::Serializer,
49249    {
49250        #[serde_with::serde_as]
49251        #[derive(serde :: Serialize)]
49252        struct WebhookResponseCompleted<'a> {
49253            #[serde(rename = "created_at")]
49254            created_at: &'a i64,
49255            #[serde(rename = "id")]
49256            id: &'a String,
49257            #[serde(rename = "data")]
49258            data: &'a crate::__types::webhook_response_completed::Data,
49259            #[serde(rename = "object")]
49260            #[serde(skip_serializing_if = "Option::is_none")]
49261            object: &'a Option<crate::__types::webhook_response_completed::Object>,
49262            #[serde(rename = "type")]
49263            r#type: &'a crate::__types::webhook_response_completed::Type,
49264        }
49265        let Self {
49266            created_at,
49267            id,
49268            data,
49269            object,
49270        } = self;
49271        WebhookResponseCompleted {
49272            created_at,
49273            id,
49274            data,
49275            object,
49276            r#type: &Default::default(),
49277        }
49278        .serialize(serializer)
49279    }
49280}
49281#[allow(clippy::module_inception)]
49282pub mod webhook_response_failed {
49283    #[doc = "Event data payload.\n"]
49284    #[derive(Clone, Debug, PartialEq)]
49285    #[serde_with::serde_as]
49286    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
49287    pub struct Data {
49288        #[doc = "The unique ID of the model response.\n"]
49289        #[serde(rename = "id")]
49290        pub id: String,
49291    }
49292    #[doc = "The object of the event. Always `event`.\n"]
49293    #[derive(Clone, Copy, Debug, Default, PartialEq)]
49294    pub struct Object;
49295    impl_serde!(Object, "event");
49296    #[doc = "The type of the event. Always `response.failed`.\n"]
49297    #[derive(Clone, Copy, Debug, Default, PartialEq)]
49298    pub(crate) struct Type;
49299    impl_serde!(Type, "response.failed");
49300}
49301#[doc = "Sent when a background response has failed.\n"]
49302#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
49303pub struct WebhookResponseFailed {
49304    #[doc = "The Unix timestamp (in seconds) of when the model response failed.\n"]
49305    pub created_at: i64,
49306    #[doc = "The unique ID of the event.\n"]
49307    pub id: String,
49308    #[doc = "Event data payload.\n"]
49309    pub data: crate::__types::webhook_response_failed::Data,
49310    #[doc = "The object of the event. Always `event`.\n"]
49311    #[builder(default)]
49312    pub object: Option<crate::__types::webhook_response_failed::Object>,
49313}
49314impl<'de> serde::Deserialize<'de> for WebhookResponseFailed {
49315    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
49316    where
49317        D: serde::Deserializer<'de>,
49318    {
49319        #[serde_with::serde_as]
49320        #[derive(serde :: Deserialize)]
49321        struct WebhookResponseFailed {
49322            #[serde(rename = "created_at")]
49323            created_at: i64,
49324            #[serde(rename = "id")]
49325            id: String,
49326            #[serde(rename = "data")]
49327            data: crate::__types::webhook_response_failed::Data,
49328            #[serde(rename = "object")]
49329            object: Option<crate::__types::webhook_response_failed::Object>,
49330            #[serde(rename = "type")]
49331            #[allow(dead_code)]
49332            r#type: crate::__types::webhook_response_failed::Type,
49333        }
49334        let WebhookResponseFailed {
49335            created_at,
49336            id,
49337            data,
49338            object,
49339            ..
49340        } = WebhookResponseFailed::deserialize(deserializer)?;
49341        Ok(Self {
49342            created_at,
49343            id,
49344            data,
49345            object,
49346        })
49347    }
49348}
49349impl serde::Serialize for WebhookResponseFailed {
49350    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
49351    where
49352        S: serde::Serializer,
49353    {
49354        #[serde_with::serde_as]
49355        #[derive(serde :: Serialize)]
49356        struct WebhookResponseFailed<'a> {
49357            #[serde(rename = "created_at")]
49358            created_at: &'a i64,
49359            #[serde(rename = "id")]
49360            id: &'a String,
49361            #[serde(rename = "data")]
49362            data: &'a crate::__types::webhook_response_failed::Data,
49363            #[serde(rename = "object")]
49364            #[serde(skip_serializing_if = "Option::is_none")]
49365            object: &'a Option<crate::__types::webhook_response_failed::Object>,
49366            #[serde(rename = "type")]
49367            r#type: &'a crate::__types::webhook_response_failed::Type,
49368        }
49369        let Self {
49370            created_at,
49371            id,
49372            data,
49373            object,
49374        } = self;
49375        WebhookResponseFailed {
49376            created_at,
49377            id,
49378            data,
49379            object,
49380            r#type: &Default::default(),
49381        }
49382        .serialize(serializer)
49383    }
49384}
49385#[allow(clippy::module_inception)]
49386pub mod webhook_response_incomplete {
49387    #[doc = "Event data payload.\n"]
49388    #[derive(Clone, Debug, PartialEq)]
49389    #[serde_with::serde_as]
49390    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
49391    pub struct Data {
49392        #[doc = "The unique ID of the model response.\n"]
49393        #[serde(rename = "id")]
49394        pub id: String,
49395    }
49396    #[doc = "The object of the event. Always `event`.\n"]
49397    #[derive(Clone, Copy, Debug, Default, PartialEq)]
49398    pub struct Object;
49399    impl_serde!(Object, "event");
49400    #[doc = "The type of the event. Always `response.incomplete`.\n"]
49401    #[derive(Clone, Copy, Debug, Default, PartialEq)]
49402    pub(crate) struct Type;
49403    impl_serde!(Type, "response.incomplete");
49404}
49405#[doc = "Sent when a background response has been interrupted.\n"]
49406#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
49407pub struct WebhookResponseIncomplete {
49408    #[doc = "The Unix timestamp (in seconds) of when the model response was interrupted.\n"]
49409    pub created_at: i64,
49410    #[doc = "The unique ID of the event.\n"]
49411    pub id: String,
49412    #[doc = "Event data payload.\n"]
49413    pub data: crate::__types::webhook_response_incomplete::Data,
49414    #[doc = "The object of the event. Always `event`.\n"]
49415    #[builder(default)]
49416    pub object: Option<crate::__types::webhook_response_incomplete::Object>,
49417}
49418impl<'de> serde::Deserialize<'de> for WebhookResponseIncomplete {
49419    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
49420    where
49421        D: serde::Deserializer<'de>,
49422    {
49423        #[serde_with::serde_as]
49424        #[derive(serde :: Deserialize)]
49425        struct WebhookResponseIncomplete {
49426            #[serde(rename = "created_at")]
49427            created_at: i64,
49428            #[serde(rename = "id")]
49429            id: String,
49430            #[serde(rename = "data")]
49431            data: crate::__types::webhook_response_incomplete::Data,
49432            #[serde(rename = "object")]
49433            object: Option<crate::__types::webhook_response_incomplete::Object>,
49434            #[serde(rename = "type")]
49435            #[allow(dead_code)]
49436            r#type: crate::__types::webhook_response_incomplete::Type,
49437        }
49438        let WebhookResponseIncomplete {
49439            created_at,
49440            id,
49441            data,
49442            object,
49443            ..
49444        } = WebhookResponseIncomplete::deserialize(deserializer)?;
49445        Ok(Self {
49446            created_at,
49447            id,
49448            data,
49449            object,
49450        })
49451    }
49452}
49453impl serde::Serialize for WebhookResponseIncomplete {
49454    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
49455    where
49456        S: serde::Serializer,
49457    {
49458        #[serde_with::serde_as]
49459        #[derive(serde :: Serialize)]
49460        struct WebhookResponseIncomplete<'a> {
49461            #[serde(rename = "created_at")]
49462            created_at: &'a i64,
49463            #[serde(rename = "id")]
49464            id: &'a String,
49465            #[serde(rename = "data")]
49466            data: &'a crate::__types::webhook_response_incomplete::Data,
49467            #[serde(rename = "object")]
49468            #[serde(skip_serializing_if = "Option::is_none")]
49469            object: &'a Option<crate::__types::webhook_response_incomplete::Object>,
49470            #[serde(rename = "type")]
49471            r#type: &'a crate::__types::webhook_response_incomplete::Type,
49472        }
49473        let Self {
49474            created_at,
49475            id,
49476            data,
49477            object,
49478        } = self;
49479        WebhookResponseIncomplete {
49480            created_at,
49481            id,
49482            data,
49483            object,
49484            r#type: &Default::default(),
49485        }
49486        .serialize(serializer)
49487    }
49488}
49489#[allow(clippy::module_inception)]
49490pub(crate) mod input_text_content {
49491    #[doc = "The type of the input item. Always `input_text`."]
49492    #[derive(Clone, Copy, Debug, Default, PartialEq)]
49493    pub(crate) struct Type;
49494    impl_serde!(Type, "input_text");
49495}
49496#[doc = "A text input to the model."]
49497#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
49498pub struct InputTextContent {
49499    #[doc = "The text input to the model."]
49500    pub text: String,
49501}
49502impl<'de> serde::Deserialize<'de> for InputTextContent {
49503    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
49504    where
49505        D: serde::Deserializer<'de>,
49506    {
49507        #[serde_with::serde_as]
49508        #[derive(serde :: Deserialize)]
49509        struct InputTextContent {
49510            #[serde(rename = "type")]
49511            #[allow(dead_code)]
49512            r#type: crate::__types::input_text_content::Type,
49513            #[serde(rename = "text")]
49514            text: String,
49515        }
49516        let InputTextContent { text, .. } = InputTextContent::deserialize(deserializer)?;
49517        Ok(Self { text })
49518    }
49519}
49520impl serde::Serialize for InputTextContent {
49521    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
49522    where
49523        S: serde::Serializer,
49524    {
49525        #[serde_with::serde_as]
49526        #[derive(serde :: Serialize)]
49527        struct InputTextContent<'a> {
49528            #[serde(rename = "type")]
49529            r#type: &'a crate::__types::input_text_content::Type,
49530            #[serde(rename = "text")]
49531            text: &'a String,
49532        }
49533        let Self { text } = self;
49534        InputTextContent {
49535            r#type: &Default::default(),
49536            text,
49537        }
49538        .serialize(serializer)
49539    }
49540}
49541#[allow(clippy::module_inception)]
49542pub mod input_image_content {
49543    #[doc = "The type of the input item. Always `input_image`."]
49544    #[derive(Clone, Copy, Debug, Default, PartialEq)]
49545    pub(crate) struct Type;
49546    impl_serde!(Type, "input_image");
49547    #[doc = "The detail level of the image to be sent to the model. One of `high`, `low`, or `auto`. Defaults to `auto`."]
49548    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
49549    pub enum Detail {
49550        #[doc = "`low`"]
49551        #[serde(rename = "low")]
49552        Low,
49553        #[doc = "`high`"]
49554        #[serde(rename = "high")]
49555        High,
49556        #[doc = "`auto`"]
49557        #[serde(rename = "auto")]
49558        Auto,
49559    }
49560}
49561#[doc = "An image input to the model. Learn about [image inputs](https://platform.openai.com/docs/guides/vision)."]
49562#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
49563pub struct InputImageContent {
49564    #[doc = "The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL."]
49565    #[builder(default)]
49566    pub image_url: Option<String>,
49567    #[doc = "The ID of the file to be sent to the model."]
49568    #[builder(default)]
49569    pub file_id: Option<String>,
49570    #[doc = "The detail level of the image to be sent to the model. One of `high`, `low`, or `auto`. Defaults to `auto`."]
49571    pub detail: crate::__types::input_image_content::Detail,
49572}
49573impl<'de> serde::Deserialize<'de> for InputImageContent {
49574    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
49575    where
49576        D: serde::Deserializer<'de>,
49577    {
49578        #[serde_with::serde_as]
49579        #[derive(serde :: Deserialize)]
49580        struct InputImageContent {
49581            #[serde(rename = "type")]
49582            #[allow(dead_code)]
49583            r#type: crate::__types::input_image_content::Type,
49584            #[serde(rename = "image_url")]
49585            image_url: Option<String>,
49586            #[serde(rename = "file_id")]
49587            file_id: Option<String>,
49588            #[serde(rename = "detail")]
49589            detail: crate::__types::input_image_content::Detail,
49590        }
49591        let InputImageContent {
49592            image_url,
49593            file_id,
49594            detail,
49595            ..
49596        } = InputImageContent::deserialize(deserializer)?;
49597        Ok(Self {
49598            image_url,
49599            file_id,
49600            detail,
49601        })
49602    }
49603}
49604impl serde::Serialize for InputImageContent {
49605    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
49606    where
49607        S: serde::Serializer,
49608    {
49609        #[serde_with::serde_as]
49610        #[derive(serde :: Serialize)]
49611        struct InputImageContent<'a> {
49612            #[serde(rename = "type")]
49613            r#type: &'a crate::__types::input_image_content::Type,
49614            #[serde(rename = "image_url")]
49615            #[serde(skip_serializing_if = "Option::is_none")]
49616            image_url: &'a Option<String>,
49617            #[serde(rename = "file_id")]
49618            #[serde(skip_serializing_if = "Option::is_none")]
49619            file_id: &'a Option<String>,
49620            #[serde(rename = "detail")]
49621            detail: &'a crate::__types::input_image_content::Detail,
49622        }
49623        let Self {
49624            image_url,
49625            file_id,
49626            detail,
49627        } = self;
49628        InputImageContent {
49629            r#type: &Default::default(),
49630            image_url,
49631            file_id,
49632            detail,
49633        }
49634        .serialize(serializer)
49635    }
49636}
49637#[allow(clippy::module_inception)]
49638pub(crate) mod input_file_content {
49639    #[doc = "The type of the input item. Always `input_file`."]
49640    #[derive(Clone, Copy, Debug, Default, PartialEq)]
49641    pub(crate) struct Type;
49642    impl_serde!(Type, "input_file");
49643}
49644#[doc = "A file input to the model."]
49645#[derive(Clone, Debug, Default, PartialEq, typed_builder :: TypedBuilder)]
49646pub struct InputFileContent {
49647    #[doc = "The ID of the file to be sent to the model."]
49648    #[builder(default)]
49649    pub file_id: Option<String>,
49650    #[doc = "The name of the file to be sent to the model."]
49651    #[builder(default)]
49652    pub filename: Option<String>,
49653    #[doc = "The URL of the file to be sent to the model."]
49654    #[builder(default)]
49655    pub file_url: Option<String>,
49656    #[doc = "The content of the file to be sent to the model.\n"]
49657    #[builder(default)]
49658    pub file_data: Option<String>,
49659}
49660impl<'de> serde::Deserialize<'de> for InputFileContent {
49661    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
49662    where
49663        D: serde::Deserializer<'de>,
49664    {
49665        #[serde_with::serde_as]
49666        #[derive(serde :: Deserialize)]
49667        struct InputFileContent {
49668            #[serde(rename = "type")]
49669            #[allow(dead_code)]
49670            r#type: crate::__types::input_file_content::Type,
49671            #[serde(rename = "file_id")]
49672            file_id: Option<String>,
49673            #[serde(rename = "filename")]
49674            filename: Option<String>,
49675            #[serde(rename = "file_url")]
49676            file_url: Option<String>,
49677            #[serde(rename = "file_data")]
49678            file_data: Option<String>,
49679        }
49680        let InputFileContent {
49681            file_id,
49682            filename,
49683            file_url,
49684            file_data,
49685            ..
49686        } = InputFileContent::deserialize(deserializer)?;
49687        Ok(Self {
49688            file_id,
49689            filename,
49690            file_url,
49691            file_data,
49692        })
49693    }
49694}
49695impl serde::Serialize for InputFileContent {
49696    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
49697    where
49698        S: serde::Serializer,
49699    {
49700        #[serde_with::serde_as]
49701        #[derive(serde :: Serialize)]
49702        struct InputFileContent<'a> {
49703            #[serde(rename = "type")]
49704            r#type: &'a crate::__types::input_file_content::Type,
49705            #[serde(rename = "file_id")]
49706            #[serde(skip_serializing_if = "Option::is_none")]
49707            file_id: &'a Option<String>,
49708            #[serde(rename = "filename")]
49709            #[serde(skip_serializing_if = "Option::is_none")]
49710            filename: &'a Option<String>,
49711            #[serde(rename = "file_url")]
49712            #[serde(skip_serializing_if = "Option::is_none")]
49713            file_url: &'a Option<String>,
49714            #[serde(rename = "file_data")]
49715            #[serde(skip_serializing_if = "Option::is_none")]
49716            file_data: &'a Option<String>,
49717        }
49718        let Self {
49719            file_id,
49720            filename,
49721            file_url,
49722            file_data,
49723        } = self;
49724        InputFileContent {
49725            r#type: &Default::default(),
49726            file_id,
49727            filename,
49728            file_url,
49729            file_data,
49730        }
49731        .serialize(serializer)
49732    }
49733}
49734#[allow(clippy::module_inception)]
49735pub(crate) mod file_citation_body {
49736    #[doc = "The type of the file citation. Always `file_citation`."]
49737    #[derive(Clone, Copy, Debug, Default, PartialEq)]
49738    pub(crate) struct Type;
49739    impl_serde!(Type, "file_citation");
49740}
49741#[doc = "A citation to a file."]
49742#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
49743pub struct FileCitationBody {
49744    #[doc = "The ID of the file."]
49745    pub file_id: String,
49746    #[doc = "The index of the file in the list of files."]
49747    pub index: i64,
49748    #[doc = "The filename of the file cited."]
49749    pub filename: String,
49750}
49751impl<'de> serde::Deserialize<'de> for FileCitationBody {
49752    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
49753    where
49754        D: serde::Deserializer<'de>,
49755    {
49756        #[serde_with::serde_as]
49757        #[derive(serde :: Deserialize)]
49758        struct FileCitationBody {
49759            #[serde(rename = "type")]
49760            #[allow(dead_code)]
49761            r#type: crate::__types::file_citation_body::Type,
49762            #[serde(rename = "file_id")]
49763            file_id: String,
49764            #[serde(rename = "index")]
49765            index: i64,
49766            #[serde(rename = "filename")]
49767            filename: String,
49768        }
49769        let FileCitationBody {
49770            file_id,
49771            index,
49772            filename,
49773            ..
49774        } = FileCitationBody::deserialize(deserializer)?;
49775        Ok(Self {
49776            file_id,
49777            index,
49778            filename,
49779        })
49780    }
49781}
49782impl serde::Serialize for FileCitationBody {
49783    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
49784    where
49785        S: serde::Serializer,
49786    {
49787        #[serde_with::serde_as]
49788        #[derive(serde :: Serialize)]
49789        struct FileCitationBody<'a> {
49790            #[serde(rename = "type")]
49791            r#type: &'a crate::__types::file_citation_body::Type,
49792            #[serde(rename = "file_id")]
49793            file_id: &'a String,
49794            #[serde(rename = "index")]
49795            index: &'a i64,
49796            #[serde(rename = "filename")]
49797            filename: &'a String,
49798        }
49799        let Self {
49800            file_id,
49801            index,
49802            filename,
49803        } = self;
49804        FileCitationBody {
49805            r#type: &Default::default(),
49806            file_id,
49807            index,
49808            filename,
49809        }
49810        .serialize(serializer)
49811    }
49812}
49813#[allow(clippy::module_inception)]
49814pub(crate) mod url_citation_body {
49815    #[doc = "The type of the URL citation. Always `url_citation`."]
49816    #[derive(Clone, Copy, Debug, Default, PartialEq)]
49817    pub(crate) struct Type;
49818    impl_serde!(Type, "url_citation");
49819}
49820#[doc = "A citation for a web resource used to generate a model response."]
49821#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
49822pub struct UrlCitationBody {
49823    #[doc = "The URL of the web resource."]
49824    pub url: String,
49825    #[doc = "The index of the first character of the URL citation in the message."]
49826    pub start_index: i64,
49827    #[doc = "The index of the last character of the URL citation in the message."]
49828    pub end_index: i64,
49829    #[doc = "The title of the web resource."]
49830    pub title: String,
49831}
49832impl<'de> serde::Deserialize<'de> for UrlCitationBody {
49833    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
49834    where
49835        D: serde::Deserializer<'de>,
49836    {
49837        #[serde_with::serde_as]
49838        #[derive(serde :: Deserialize)]
49839        struct UrlCitationBody {
49840            #[serde(rename = "type")]
49841            #[allow(dead_code)]
49842            r#type: crate::__types::url_citation_body::Type,
49843            #[serde(rename = "url")]
49844            url: String,
49845            #[serde(rename = "start_index")]
49846            start_index: i64,
49847            #[serde(rename = "end_index")]
49848            end_index: i64,
49849            #[serde(rename = "title")]
49850            title: String,
49851        }
49852        let UrlCitationBody {
49853            url,
49854            start_index,
49855            end_index,
49856            title,
49857            ..
49858        } = UrlCitationBody::deserialize(deserializer)?;
49859        Ok(Self {
49860            url,
49861            start_index,
49862            end_index,
49863            title,
49864        })
49865    }
49866}
49867impl serde::Serialize for UrlCitationBody {
49868    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
49869    where
49870        S: serde::Serializer,
49871    {
49872        #[serde_with::serde_as]
49873        #[derive(serde :: Serialize)]
49874        struct UrlCitationBody<'a> {
49875            #[serde(rename = "type")]
49876            r#type: &'a crate::__types::url_citation_body::Type,
49877            #[serde(rename = "url")]
49878            url: &'a String,
49879            #[serde(rename = "start_index")]
49880            start_index: &'a i64,
49881            #[serde(rename = "end_index")]
49882            end_index: &'a i64,
49883            #[serde(rename = "title")]
49884            title: &'a String,
49885        }
49886        let Self {
49887            url,
49888            start_index,
49889            end_index,
49890            title,
49891        } = self;
49892        UrlCitationBody {
49893            r#type: &Default::default(),
49894            url,
49895            start_index,
49896            end_index,
49897            title,
49898        }
49899        .serialize(serializer)
49900    }
49901}
49902#[allow(clippy::module_inception)]
49903pub(crate) mod container_file_citation_body {
49904    #[doc = "The type of the container file citation. Always `container_file_citation`."]
49905    #[derive(Clone, Copy, Debug, Default, PartialEq)]
49906    pub(crate) struct Type;
49907    impl_serde!(Type, "container_file_citation");
49908}
49909#[doc = "A citation for a container file used to generate a model response."]
49910#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
49911pub struct ContainerFileCitationBody {
49912    #[doc = "The ID of the container file."]
49913    pub container_id: String,
49914    #[doc = "The ID of the file."]
49915    pub file_id: String,
49916    #[doc = "The index of the first character of the container file citation in the message."]
49917    pub start_index: i64,
49918    #[doc = "The index of the last character of the container file citation in the message."]
49919    pub end_index: i64,
49920    #[doc = "The filename of the container file cited."]
49921    pub filename: String,
49922}
49923impl<'de> serde::Deserialize<'de> for ContainerFileCitationBody {
49924    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
49925    where
49926        D: serde::Deserializer<'de>,
49927    {
49928        #[serde_with::serde_as]
49929        #[derive(serde :: Deserialize)]
49930        struct ContainerFileCitationBody {
49931            #[serde(rename = "type")]
49932            #[allow(dead_code)]
49933            r#type: crate::__types::container_file_citation_body::Type,
49934            #[serde(rename = "container_id")]
49935            container_id: String,
49936            #[serde(rename = "file_id")]
49937            file_id: String,
49938            #[serde(rename = "start_index")]
49939            start_index: i64,
49940            #[serde(rename = "end_index")]
49941            end_index: i64,
49942            #[serde(rename = "filename")]
49943            filename: String,
49944        }
49945        let ContainerFileCitationBody {
49946            container_id,
49947            file_id,
49948            start_index,
49949            end_index,
49950            filename,
49951            ..
49952        } = ContainerFileCitationBody::deserialize(deserializer)?;
49953        Ok(Self {
49954            container_id,
49955            file_id,
49956            start_index,
49957            end_index,
49958            filename,
49959        })
49960    }
49961}
49962impl serde::Serialize for ContainerFileCitationBody {
49963    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
49964    where
49965        S: serde::Serializer,
49966    {
49967        #[serde_with::serde_as]
49968        #[derive(serde :: Serialize)]
49969        struct ContainerFileCitationBody<'a> {
49970            #[serde(rename = "type")]
49971            r#type: &'a crate::__types::container_file_citation_body::Type,
49972            #[serde(rename = "container_id")]
49973            container_id: &'a String,
49974            #[serde(rename = "file_id")]
49975            file_id: &'a String,
49976            #[serde(rename = "start_index")]
49977            start_index: &'a i64,
49978            #[serde(rename = "end_index")]
49979            end_index: &'a i64,
49980            #[serde(rename = "filename")]
49981            filename: &'a String,
49982        }
49983        let Self {
49984            container_id,
49985            file_id,
49986            start_index,
49987            end_index,
49988            filename,
49989        } = self;
49990        ContainerFileCitationBody {
49991            r#type: &Default::default(),
49992            container_id,
49993            file_id,
49994            start_index,
49995            end_index,
49996            filename,
49997        }
49998        .serialize(serializer)
49999    }
50000}
50001#[derive(Clone, Debug, PartialEq)]
50002#[serde_with::serde_as]
50003#[derive(serde :: Deserialize, serde :: Serialize)]
50004#[serde(untagged)]
50005#[allow(clippy::large_enum_variant)]
50006pub enum Annotation {
50007    FileCitation(crate::__types::FileCitationBody),
50008    UrlCitation(crate::__types::UrlCitationBody),
50009    ContainerFileCitation(crate::__types::ContainerFileCitationBody),
50010    FilePath(crate::__types::FilePath),
50011}
50012#[doc = "The top log probability of a token."]
50013#[derive(Clone, Debug, PartialEq)]
50014#[serde_with::serde_as]
50015#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
50016pub struct TopLogProb {
50017    #[serde(rename = "token")]
50018    pub token: String,
50019    #[serde(rename = "logprob")]
50020    pub logprob: serde_json::Number,
50021    #[serde(rename = "bytes")]
50022    pub bytes: Vec<i64>,
50023}
50024#[doc = "The log probability of a token."]
50025#[derive(Clone, Debug, PartialEq)]
50026#[serde_with::serde_as]
50027#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
50028pub struct LogProb {
50029    #[serde(rename = "token")]
50030    pub token: String,
50031    #[serde(rename = "logprob")]
50032    pub logprob: serde_json::Number,
50033    #[serde(rename = "bytes")]
50034    pub bytes: Vec<i64>,
50035    #[serde(rename = "top_logprobs")]
50036    pub top_logprobs: Vec<crate::__types::TopLogProb>,
50037}
50038#[allow(clippy::module_inception)]
50039pub(crate) mod output_text_content {
50040    #[doc = "The type of the output text. Always `output_text`."]
50041    #[derive(Clone, Copy, Debug, Default, PartialEq)]
50042    pub(crate) struct Type;
50043    impl_serde!(Type, "output_text");
50044}
50045#[doc = "A text output from the model."]
50046#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
50047pub struct OutputTextContent {
50048    #[doc = "The text output from the model."]
50049    pub text: String,
50050    #[doc = "The annotations of the text output."]
50051    pub annotations: Vec<crate::__types::Annotation>,
50052    #[builder(default)]
50053    pub logprobs: Option<Vec<crate::__types::LogProb>>,
50054}
50055impl<'de> serde::Deserialize<'de> for OutputTextContent {
50056    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
50057    where
50058        D: serde::Deserializer<'de>,
50059    {
50060        #[serde_with::serde_as]
50061        #[derive(serde :: Deserialize)]
50062        struct OutputTextContent {
50063            #[serde(rename = "type")]
50064            #[allow(dead_code)]
50065            r#type: crate::__types::output_text_content::Type,
50066            #[serde(rename = "text")]
50067            text: String,
50068            #[serde(rename = "annotations")]
50069            annotations: Vec<crate::__types::Annotation>,
50070            #[serde(rename = "logprobs")]
50071            logprobs: Option<Vec<crate::__types::LogProb>>,
50072        }
50073        let OutputTextContent {
50074            text,
50075            annotations,
50076            logprobs,
50077            ..
50078        } = OutputTextContent::deserialize(deserializer)?;
50079        Ok(Self {
50080            text,
50081            annotations,
50082            logprobs,
50083        })
50084    }
50085}
50086impl serde::Serialize for OutputTextContent {
50087    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
50088    where
50089        S: serde::Serializer,
50090    {
50091        #[serde_with::serde_as]
50092        #[derive(serde :: Serialize)]
50093        struct OutputTextContent<'a> {
50094            #[serde(rename = "type")]
50095            r#type: &'a crate::__types::output_text_content::Type,
50096            #[serde(rename = "text")]
50097            text: &'a String,
50098            #[serde(rename = "annotations")]
50099            annotations: &'a Vec<crate::__types::Annotation>,
50100            #[serde(rename = "logprobs")]
50101            #[serde(skip_serializing_if = "Option::is_none")]
50102            logprobs: &'a Option<Vec<crate::__types::LogProb>>,
50103        }
50104        let Self {
50105            text,
50106            annotations,
50107            logprobs,
50108        } = self;
50109        OutputTextContent {
50110            r#type: &Default::default(),
50111            text,
50112            annotations,
50113            logprobs,
50114        }
50115        .serialize(serializer)
50116    }
50117}
50118#[allow(clippy::module_inception)]
50119pub(crate) mod refusal_content {
50120    #[doc = "The type of the refusal. Always `refusal`."]
50121    #[derive(Clone, Copy, Debug, Default, PartialEq)]
50122    pub(crate) struct Type;
50123    impl_serde!(Type, "refusal");
50124}
50125#[doc = "A refusal from the model."]
50126#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
50127pub struct RefusalContent {
50128    #[doc = "The refusal explanation from the model."]
50129    pub refusal: String,
50130}
50131impl<'de> serde::Deserialize<'de> for RefusalContent {
50132    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
50133    where
50134        D: serde::Deserializer<'de>,
50135    {
50136        #[serde_with::serde_as]
50137        #[derive(serde :: Deserialize)]
50138        struct RefusalContent {
50139            #[serde(rename = "type")]
50140            #[allow(dead_code)]
50141            r#type: crate::__types::refusal_content::Type,
50142            #[serde(rename = "refusal")]
50143            refusal: String,
50144        }
50145        let RefusalContent { refusal, .. } = RefusalContent::deserialize(deserializer)?;
50146        Ok(Self { refusal })
50147    }
50148}
50149impl serde::Serialize for RefusalContent {
50150    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
50151    where
50152        S: serde::Serializer,
50153    {
50154        #[serde_with::serde_as]
50155        #[derive(serde :: Serialize)]
50156        struct RefusalContent<'a> {
50157            #[serde(rename = "type")]
50158            r#type: &'a crate::__types::refusal_content::Type,
50159            #[serde(rename = "refusal")]
50160            refusal: &'a String,
50161        }
50162        let Self { refusal } = self;
50163        RefusalContent {
50164            r#type: &Default::default(),
50165            refusal,
50166        }
50167        .serialize(serializer)
50168    }
50169}
50170#[doc = "A pending safety check for the computer call."]
50171#[derive(Clone, Debug, PartialEq)]
50172#[serde_with::serde_as]
50173#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
50174pub struct ComputerCallSafetyCheckParam {
50175    #[doc = "The ID of the pending safety check."]
50176    #[serde(rename = "id")]
50177    pub id: String,
50178    #[doc = "The type of the pending safety check."]
50179    #[serde(rename = "code")]
50180    #[serde(skip_serializing_if = "Option::is_none")]
50181    #[builder(default)]
50182    pub code: Option<String>,
50183    #[doc = "Details about the pending safety check."]
50184    #[serde(rename = "message")]
50185    #[serde(skip_serializing_if = "Option::is_none")]
50186    #[builder(default)]
50187    pub message: Option<String>,
50188}
50189#[allow(clippy::module_inception)]
50190pub mod computer_call_output_item_param {
50191    #[doc = "The type of the computer tool call output. Always `computer_call_output`."]
50192    #[derive(Clone, Copy, Debug, Default, PartialEq)]
50193    pub(crate) struct Type;
50194    impl_serde!(Type, "computer_call_output");
50195    #[doc = "The status of the message input. One of `in_progress`, `completed`, or `incomplete`. Populated when input items are returned via API."]
50196    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
50197    pub enum Status {
50198        #[doc = "`in_progress`"]
50199        #[serde(rename = "in_progress")]
50200        InProgress,
50201        #[doc = "`completed`"]
50202        #[serde(rename = "completed")]
50203        Completed,
50204        #[doc = "`incomplete`"]
50205        #[serde(rename = "incomplete")]
50206        Incomplete,
50207    }
50208}
50209#[doc = "The output of a computer tool call."]
50210#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
50211pub struct ComputerCallOutputItemParam {
50212    #[doc = "The ID of the computer tool call output."]
50213    #[builder(default)]
50214    pub id: Option<String>,
50215    #[doc = "The ID of the computer tool call that produced the output."]
50216    pub call_id: String,
50217    #[builder(default)]
50218    pub output: crate::__types::ComputerScreenshotImage,
50219    #[doc = "The safety checks reported by the API that have been acknowledged by the developer."]
50220    #[builder(default)]
50221    pub acknowledged_safety_checks: Option<Vec<crate::__types::ComputerCallSafetyCheckParam>>,
50222    #[doc = "The status of the message input. One of `in_progress`, `completed`, or `incomplete`. Populated when input items are returned via API."]
50223    #[builder(default)]
50224    pub status: Option<crate::__types::computer_call_output_item_param::Status>,
50225}
50226impl<'de> serde::Deserialize<'de> for ComputerCallOutputItemParam {
50227    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
50228    where
50229        D: serde::Deserializer<'de>,
50230    {
50231        #[serde_with::serde_as]
50232        #[derive(serde :: Deserialize)]
50233        struct ComputerCallOutputItemParam {
50234            #[serde(rename = "id")]
50235            id: Option<String>,
50236            #[serde(rename = "call_id")]
50237            call_id: String,
50238            #[serde(rename = "type")]
50239            #[allow(dead_code)]
50240            r#type: crate::__types::computer_call_output_item_param::Type,
50241            #[serde(rename = "output")]
50242            output: crate::__types::ComputerScreenshotImage,
50243            #[serde(rename = "acknowledged_safety_checks")]
50244            acknowledged_safety_checks: Option<Vec<crate::__types::ComputerCallSafetyCheckParam>>,
50245            #[serde(rename = "status")]
50246            status: Option<crate::__types::computer_call_output_item_param::Status>,
50247        }
50248        let ComputerCallOutputItemParam {
50249            id,
50250            call_id,
50251            output,
50252            acknowledged_safety_checks,
50253            status,
50254            ..
50255        } = ComputerCallOutputItemParam::deserialize(deserializer)?;
50256        Ok(Self {
50257            id,
50258            call_id,
50259            output,
50260            acknowledged_safety_checks,
50261            status,
50262        })
50263    }
50264}
50265impl serde::Serialize for ComputerCallOutputItemParam {
50266    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
50267    where
50268        S: serde::Serializer,
50269    {
50270        #[serde_with::serde_as]
50271        #[derive(serde :: Serialize)]
50272        struct ComputerCallOutputItemParam<'a> {
50273            #[serde(rename = "id")]
50274            #[serde(skip_serializing_if = "Option::is_none")]
50275            id: &'a Option<String>,
50276            #[serde(rename = "call_id")]
50277            call_id: &'a String,
50278            #[serde(rename = "type")]
50279            r#type: &'a crate::__types::computer_call_output_item_param::Type,
50280            #[serde(rename = "output")]
50281            output: &'a crate::__types::ComputerScreenshotImage,
50282            #[serde(rename = "acknowledged_safety_checks")]
50283            #[serde(skip_serializing_if = "Option::is_none")]
50284            acknowledged_safety_checks:
50285                &'a Option<Vec<crate::__types::ComputerCallSafetyCheckParam>>,
50286            #[serde(rename = "status")]
50287            #[serde(skip_serializing_if = "Option::is_none")]
50288            status: &'a Option<crate::__types::computer_call_output_item_param::Status>,
50289        }
50290        let Self {
50291            id,
50292            call_id,
50293            output,
50294            acknowledged_safety_checks,
50295            status,
50296        } = self;
50297        ComputerCallOutputItemParam {
50298            id,
50299            call_id,
50300            r#type: &Default::default(),
50301            output,
50302            acknowledged_safety_checks,
50303            status,
50304        }
50305        .serialize(serializer)
50306    }
50307}
50308#[allow(clippy::module_inception)]
50309pub mod function_call_output_item_param {
50310    #[doc = "The type of the function tool call output. Always `function_call_output`."]
50311    #[derive(Clone, Copy, Debug, Default, PartialEq)]
50312    pub(crate) struct Type;
50313    impl_serde!(Type, "function_call_output");
50314    #[doc = "The status of the item. One of `in_progress`, `completed`, or `incomplete`. Populated when items are returned via API."]
50315    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
50316    pub enum Status {
50317        #[doc = "`in_progress`"]
50318        #[serde(rename = "in_progress")]
50319        InProgress,
50320        #[doc = "`completed`"]
50321        #[serde(rename = "completed")]
50322        Completed,
50323        #[doc = "`incomplete`"]
50324        #[serde(rename = "incomplete")]
50325        Incomplete,
50326    }
50327}
50328#[doc = "The output of a function tool call."]
50329#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
50330pub struct FunctionCallOutputItemParam {
50331    #[doc = "The unique ID of the function tool call output. Populated when this item is returned via API."]
50332    #[builder(default)]
50333    pub id: Option<String>,
50334    #[doc = "The unique ID of the function tool call generated by the model."]
50335    pub call_id: String,
50336    #[doc = "A JSON string of the output of the function tool call."]
50337    pub output: String,
50338    #[doc = "The status of the item. One of `in_progress`, `completed`, or `incomplete`. Populated when items are returned via API."]
50339    #[builder(default)]
50340    pub status: Option<crate::__types::function_call_output_item_param::Status>,
50341}
50342impl<'de> serde::Deserialize<'de> for FunctionCallOutputItemParam {
50343    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
50344    where
50345        D: serde::Deserializer<'de>,
50346    {
50347        #[serde_with::serde_as]
50348        #[derive(serde :: Deserialize)]
50349        struct FunctionCallOutputItemParam {
50350            #[serde(rename = "id")]
50351            id: Option<String>,
50352            #[serde(rename = "call_id")]
50353            call_id: String,
50354            #[serde(rename = "type")]
50355            #[allow(dead_code)]
50356            r#type: crate::__types::function_call_output_item_param::Type,
50357            #[serde(rename = "output")]
50358            output: String,
50359            #[serde(rename = "status")]
50360            status: Option<crate::__types::function_call_output_item_param::Status>,
50361        }
50362        let FunctionCallOutputItemParam {
50363            id,
50364            call_id,
50365            output,
50366            status,
50367            ..
50368        } = FunctionCallOutputItemParam::deserialize(deserializer)?;
50369        Ok(Self {
50370            id,
50371            call_id,
50372            output,
50373            status,
50374        })
50375    }
50376}
50377impl serde::Serialize for FunctionCallOutputItemParam {
50378    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
50379    where
50380        S: serde::Serializer,
50381    {
50382        #[serde_with::serde_as]
50383        #[derive(serde :: Serialize)]
50384        struct FunctionCallOutputItemParam<'a> {
50385            #[serde(rename = "id")]
50386            #[serde(skip_serializing_if = "Option::is_none")]
50387            id: &'a Option<String>,
50388            #[serde(rename = "call_id")]
50389            call_id: &'a String,
50390            #[serde(rename = "type")]
50391            r#type: &'a crate::__types::function_call_output_item_param::Type,
50392            #[serde(rename = "output")]
50393            output: &'a String,
50394            #[serde(rename = "status")]
50395            #[serde(skip_serializing_if = "Option::is_none")]
50396            status: &'a Option<crate::__types::function_call_output_item_param::Status>,
50397        }
50398        let Self {
50399            id,
50400            call_id,
50401            output,
50402            status,
50403        } = self;
50404        FunctionCallOutputItemParam {
50405            id,
50406            call_id,
50407            r#type: &Default::default(),
50408            output,
50409            status,
50410        }
50411        .serialize(serializer)
50412    }
50413}
50414#[allow(clippy::module_inception)]
50415pub mod item_reference_param {
50416    #[doc = "The type of item to reference. Always `item_reference`."]
50417    #[derive(Clone, Copy, Debug, Default, PartialEq)]
50418    pub struct Type;
50419    impl_serde!(Type, "item_reference");
50420}
50421#[doc = "An internal identifier for an item to reference."]
50422#[derive(Clone, Debug, PartialEq)]
50423#[serde_with::serde_as]
50424#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
50425pub struct ItemReferenceParam {
50426    #[doc = "The type of item to reference. Always `item_reference`."]
50427    #[serde(rename = "type")]
50428    #[serde(skip_serializing_if = "Option::is_none")]
50429    #[builder(default)]
50430    pub r#type: Option<crate::__types::item_reference_param::Type>,
50431    #[doc = "The ID of the item to reference."]
50432    #[serde(rename = "id")]
50433    pub id: String,
50434}
50435#[allow(clippy::module_inception)]
50436pub(crate) mod conversation_resource {
50437    #[doc = "The object type, which is always `conversation`."]
50438    #[derive(Clone, Copy, Debug, Default, PartialEq)]
50439    pub(crate) struct Object;
50440    impl_serde!(Object, "conversation");
50441}
50442#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
50443pub struct ConversationResource {
50444    #[doc = "The unique ID of the conversation."]
50445    pub id: String,
50446    #[doc = "Set of 16 key-value pairs that can be attached to an object. This can be         useful for storing additional information about the object in a structured         format, and querying for objects via API or the dashboard.\n        Keys are strings with a maximum length of 64 characters. Values are strings         with a maximum length of 512 characters."]
50447    pub metadata: serde_json::Value,
50448    #[doc = "The time at which the conversation was created, measured in seconds since the Unix epoch."]
50449    pub created_at: i64,
50450}
50451impl<'de> serde::Deserialize<'de> for ConversationResource {
50452    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
50453    where
50454        D: serde::Deserializer<'de>,
50455    {
50456        #[serde_with::serde_as]
50457        #[derive(serde :: Deserialize)]
50458        struct ConversationResource {
50459            #[serde(rename = "id")]
50460            id: String,
50461            #[serde(rename = "object")]
50462            #[allow(dead_code)]
50463            object: crate::__types::conversation_resource::Object,
50464            #[serde(rename = "metadata")]
50465            metadata: serde_json::Value,
50466            #[serde(rename = "created_at")]
50467            created_at: i64,
50468        }
50469        let ConversationResource {
50470            id,
50471            metadata,
50472            created_at,
50473            ..
50474        } = ConversationResource::deserialize(deserializer)?;
50475        Ok(Self {
50476            id,
50477            metadata,
50478            created_at,
50479        })
50480    }
50481}
50482impl serde::Serialize for ConversationResource {
50483    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
50484    where
50485        S: serde::Serializer,
50486    {
50487        #[serde_with::serde_as]
50488        #[derive(serde :: Serialize)]
50489        struct ConversationResource<'a> {
50490            #[serde(rename = "id")]
50491            id: &'a String,
50492            #[serde(rename = "object")]
50493            object: &'a crate::__types::conversation_resource::Object,
50494            #[serde(rename = "metadata")]
50495            metadata: &'a serde_json::Value,
50496            #[serde(rename = "created_at")]
50497            created_at: &'a i64,
50498        }
50499        let Self {
50500            id,
50501            metadata,
50502            created_at,
50503        } = self;
50504        ConversationResource {
50505            id,
50506            object: &Default::default(),
50507            metadata,
50508            created_at,
50509        }
50510        .serialize(serializer)
50511    }
50512}
50513pub type MetadataParam = indexmap::IndexMap<String, String>;
50514#[derive(Clone, Debug, PartialEq)]
50515#[serde_with::serde_as]
50516#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
50517pub struct UpdateConversationBody {
50518    #[doc = "Set of 16 key-value pairs that can be attached to an object. This can be         useful for storing additional information about the object in a structured         format, and querying for objects via API or the dashboard.\n        Keys are strings with a maximum length of 64 characters. Values are strings         with a maximum length of 512 characters."]
50519    #[serde(rename = "metadata")]
50520    pub metadata: crate::__types::MetadataParam,
50521}
50522#[allow(clippy::module_inception)]
50523pub(crate) mod deleted_conversation_resource {
50524    #[doc = "conversation.deleted"]
50525    #[derive(Clone, Copy, Debug, Default, PartialEq)]
50526    pub(crate) struct Object;
50527    impl_serde!(Object, "conversation.deleted");
50528}
50529#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
50530pub struct DeletedConversationResource {
50531    pub deleted: bool,
50532    pub id: String,
50533}
50534impl<'de> serde::Deserialize<'de> for DeletedConversationResource {
50535    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
50536    where
50537        D: serde::Deserializer<'de>,
50538    {
50539        #[serde_with::serde_as]
50540        #[derive(serde :: Deserialize)]
50541        struct DeletedConversationResource {
50542            #[serde(rename = "object")]
50543            #[allow(dead_code)]
50544            object: crate::__types::deleted_conversation_resource::Object,
50545            #[serde(rename = "deleted")]
50546            deleted: bool,
50547            #[serde(rename = "id")]
50548            id: String,
50549        }
50550        let DeletedConversationResource { deleted, id, .. } =
50551            DeletedConversationResource::deserialize(deserializer)?;
50552        Ok(Self { deleted, id })
50553    }
50554}
50555impl serde::Serialize for DeletedConversationResource {
50556    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
50557    where
50558        S: serde::Serializer,
50559    {
50560        #[serde_with::serde_as]
50561        #[derive(serde :: Serialize)]
50562        struct DeletedConversationResource<'a> {
50563            #[serde(rename = "object")]
50564            object: &'a crate::__types::deleted_conversation_resource::Object,
50565            #[serde(rename = "deleted")]
50566            deleted: &'a bool,
50567            #[serde(rename = "id")]
50568            id: &'a String,
50569        }
50570        let Self { deleted, id } = self;
50571        DeletedConversationResource {
50572            object: &Default::default(),
50573            deleted,
50574            id,
50575        }
50576        .serialize(serializer)
50577    }
50578}
50579#[allow(clippy::module_inception)]
50580pub(crate) mod input_text_content_2 {
50581    #[doc = "The type of the input item. Always `input_text`."]
50582    #[derive(Clone, Copy, Debug, Default, PartialEq)]
50583    pub(crate) struct Type;
50584    impl_serde!(Type, "input_text");
50585}
50586#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
50587pub struct InputTextContent2 {
50588    #[doc = "The text input to the model."]
50589    pub text: String,
50590}
50591impl<'de> serde::Deserialize<'de> for InputTextContent2 {
50592    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
50593    where
50594        D: serde::Deserializer<'de>,
50595    {
50596        #[serde_with::serde_as]
50597        #[derive(serde :: Deserialize)]
50598        struct InputTextContent2 {
50599            #[serde(rename = "type")]
50600            #[allow(dead_code)]
50601            r#type: crate::__types::input_text_content_2::Type,
50602            #[serde(rename = "text")]
50603            text: String,
50604        }
50605        let InputTextContent2 { text, .. } = InputTextContent2::deserialize(deserializer)?;
50606        Ok(Self { text })
50607    }
50608}
50609impl serde::Serialize for InputTextContent2 {
50610    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
50611    where
50612        S: serde::Serializer,
50613    {
50614        #[serde_with::serde_as]
50615        #[derive(serde :: Serialize)]
50616        struct InputTextContent2<'a> {
50617            #[serde(rename = "type")]
50618            r#type: &'a crate::__types::input_text_content_2::Type,
50619            #[serde(rename = "text")]
50620            text: &'a String,
50621        }
50622        let Self { text } = self;
50623        InputTextContent2 {
50624            r#type: &Default::default(),
50625            text,
50626        }
50627        .serialize(serializer)
50628    }
50629}
50630#[allow(clippy::module_inception)]
50631pub(crate) mod file_citation_body_2 {
50632    #[doc = "The type of the file citation. Always `file_citation`."]
50633    #[derive(Clone, Copy, Debug, Default, PartialEq)]
50634    pub(crate) struct Type;
50635    impl_serde!(Type, "file_citation");
50636}
50637#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
50638pub struct FileCitationBody2 {
50639    #[doc = "The ID of the file."]
50640    pub file_id: String,
50641    #[doc = "The index of the file in the list of files."]
50642    pub index: i64,
50643    #[doc = "The filename of the file cited."]
50644    pub filename: String,
50645}
50646impl<'de> serde::Deserialize<'de> for FileCitationBody2 {
50647    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
50648    where
50649        D: serde::Deserializer<'de>,
50650    {
50651        #[serde_with::serde_as]
50652        #[derive(serde :: Deserialize)]
50653        struct FileCitationBody2 {
50654            #[serde(rename = "type")]
50655            #[allow(dead_code)]
50656            r#type: crate::__types::file_citation_body_2::Type,
50657            #[serde(rename = "file_id")]
50658            file_id: String,
50659            #[serde(rename = "index")]
50660            index: i64,
50661            #[serde(rename = "filename")]
50662            filename: String,
50663        }
50664        let FileCitationBody2 {
50665            file_id,
50666            index,
50667            filename,
50668            ..
50669        } = FileCitationBody2::deserialize(deserializer)?;
50670        Ok(Self {
50671            file_id,
50672            index,
50673            filename,
50674        })
50675    }
50676}
50677impl serde::Serialize for FileCitationBody2 {
50678    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
50679    where
50680        S: serde::Serializer,
50681    {
50682        #[serde_with::serde_as]
50683        #[derive(serde :: Serialize)]
50684        struct FileCitationBody2<'a> {
50685            #[serde(rename = "type")]
50686            r#type: &'a crate::__types::file_citation_body_2::Type,
50687            #[serde(rename = "file_id")]
50688            file_id: &'a String,
50689            #[serde(rename = "index")]
50690            index: &'a i64,
50691            #[serde(rename = "filename")]
50692            filename: &'a String,
50693        }
50694        let Self {
50695            file_id,
50696            index,
50697            filename,
50698        } = self;
50699        FileCitationBody2 {
50700            r#type: &Default::default(),
50701            file_id,
50702            index,
50703            filename,
50704        }
50705        .serialize(serializer)
50706    }
50707}
50708#[allow(clippy::module_inception)]
50709pub(crate) mod url_citation_body_2 {
50710    #[doc = "The type of the URL citation. Always `url_citation`."]
50711    #[derive(Clone, Copy, Debug, Default, PartialEq)]
50712    pub(crate) struct Type;
50713    impl_serde!(Type, "url_citation");
50714}
50715#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
50716pub struct UrlCitationBody2 {
50717    #[doc = "The URL of the web resource."]
50718    pub url: String,
50719    #[doc = "The index of the first character of the URL citation in the message."]
50720    pub start_index: i64,
50721    #[doc = "The index of the last character of the URL citation in the message."]
50722    pub end_index: i64,
50723    #[doc = "The title of the web resource."]
50724    pub title: String,
50725}
50726impl<'de> serde::Deserialize<'de> for UrlCitationBody2 {
50727    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
50728    where
50729        D: serde::Deserializer<'de>,
50730    {
50731        #[serde_with::serde_as]
50732        #[derive(serde :: Deserialize)]
50733        struct UrlCitationBody2 {
50734            #[serde(rename = "type")]
50735            #[allow(dead_code)]
50736            r#type: crate::__types::url_citation_body_2::Type,
50737            #[serde(rename = "url")]
50738            url: String,
50739            #[serde(rename = "start_index")]
50740            start_index: i64,
50741            #[serde(rename = "end_index")]
50742            end_index: i64,
50743            #[serde(rename = "title")]
50744            title: String,
50745        }
50746        let UrlCitationBody2 {
50747            url,
50748            start_index,
50749            end_index,
50750            title,
50751            ..
50752        } = UrlCitationBody2::deserialize(deserializer)?;
50753        Ok(Self {
50754            url,
50755            start_index,
50756            end_index,
50757            title,
50758        })
50759    }
50760}
50761impl serde::Serialize for UrlCitationBody2 {
50762    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
50763    where
50764        S: serde::Serializer,
50765    {
50766        #[serde_with::serde_as]
50767        #[derive(serde :: Serialize)]
50768        struct UrlCitationBody2<'a> {
50769            #[serde(rename = "type")]
50770            r#type: &'a crate::__types::url_citation_body_2::Type,
50771            #[serde(rename = "url")]
50772            url: &'a String,
50773            #[serde(rename = "start_index")]
50774            start_index: &'a i64,
50775            #[serde(rename = "end_index")]
50776            end_index: &'a i64,
50777            #[serde(rename = "title")]
50778            title: &'a String,
50779        }
50780        let Self {
50781            url,
50782            start_index,
50783            end_index,
50784            title,
50785        } = self;
50786        UrlCitationBody2 {
50787            r#type: &Default::default(),
50788            url,
50789            start_index,
50790            end_index,
50791            title,
50792        }
50793        .serialize(serializer)
50794    }
50795}
50796#[allow(clippy::module_inception)]
50797pub(crate) mod container_file_citation_body_2 {
50798    #[doc = "The type of the container file citation. Always `container_file_citation`."]
50799    #[derive(Clone, Copy, Debug, Default, PartialEq)]
50800    pub(crate) struct Type;
50801    impl_serde!(Type, "container_file_citation");
50802}
50803#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
50804pub struct ContainerFileCitationBody2 {
50805    #[doc = "The ID of the container file."]
50806    pub container_id: String,
50807    #[doc = "The ID of the file."]
50808    pub file_id: String,
50809    #[doc = "The index of the first character of the container file citation in the message."]
50810    pub start_index: i64,
50811    #[doc = "The index of the last character of the container file citation in the message."]
50812    pub end_index: i64,
50813    #[doc = "The filename of the container file cited."]
50814    pub filename: String,
50815}
50816impl<'de> serde::Deserialize<'de> for ContainerFileCitationBody2 {
50817    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
50818    where
50819        D: serde::Deserializer<'de>,
50820    {
50821        #[serde_with::serde_as]
50822        #[derive(serde :: Deserialize)]
50823        struct ContainerFileCitationBody2 {
50824            #[serde(rename = "type")]
50825            #[allow(dead_code)]
50826            r#type: crate::__types::container_file_citation_body_2::Type,
50827            #[serde(rename = "container_id")]
50828            container_id: String,
50829            #[serde(rename = "file_id")]
50830            file_id: String,
50831            #[serde(rename = "start_index")]
50832            start_index: i64,
50833            #[serde(rename = "end_index")]
50834            end_index: i64,
50835            #[serde(rename = "filename")]
50836            filename: String,
50837        }
50838        let ContainerFileCitationBody2 {
50839            container_id,
50840            file_id,
50841            start_index,
50842            end_index,
50843            filename,
50844            ..
50845        } = ContainerFileCitationBody2::deserialize(deserializer)?;
50846        Ok(Self {
50847            container_id,
50848            file_id,
50849            start_index,
50850            end_index,
50851            filename,
50852        })
50853    }
50854}
50855impl serde::Serialize for ContainerFileCitationBody2 {
50856    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
50857    where
50858        S: serde::Serializer,
50859    {
50860        #[serde_with::serde_as]
50861        #[derive(serde :: Serialize)]
50862        struct ContainerFileCitationBody2<'a> {
50863            #[serde(rename = "type")]
50864            r#type: &'a crate::__types::container_file_citation_body_2::Type,
50865            #[serde(rename = "container_id")]
50866            container_id: &'a String,
50867            #[serde(rename = "file_id")]
50868            file_id: &'a String,
50869            #[serde(rename = "start_index")]
50870            start_index: &'a i64,
50871            #[serde(rename = "end_index")]
50872            end_index: &'a i64,
50873            #[serde(rename = "filename")]
50874            filename: &'a String,
50875        }
50876        let Self {
50877            container_id,
50878            file_id,
50879            start_index,
50880            end_index,
50881            filename,
50882        } = self;
50883        ContainerFileCitationBody2 {
50884            r#type: &Default::default(),
50885            container_id,
50886            file_id,
50887            start_index,
50888            end_index,
50889            filename,
50890        }
50891        .serialize(serializer)
50892    }
50893}
50894#[derive(Clone, Debug, PartialEq)]
50895#[serde_with::serde_as]
50896#[derive(serde :: Deserialize, serde :: Serialize)]
50897#[serde(untagged)]
50898#[allow(clippy::large_enum_variant)]
50899pub enum Annotation2 {
50900    FileCitation(crate::__types::FileCitationBody2),
50901    UrlCitation(crate::__types::UrlCitationBody2),
50902    ContainerFileCitation(crate::__types::ContainerFileCitationBody2),
50903}
50904#[derive(Clone, Debug, PartialEq)]
50905#[serde_with::serde_as]
50906#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
50907pub struct TopLogProb2 {
50908    #[serde(rename = "token")]
50909    pub token: String,
50910    #[serde(rename = "logprob")]
50911    pub logprob: serde_json::Number,
50912    #[serde(rename = "bytes")]
50913    pub bytes: Vec<i64>,
50914}
50915#[derive(Clone, Debug, PartialEq)]
50916#[serde_with::serde_as]
50917#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
50918pub struct LogProb2 {
50919    #[serde(rename = "token")]
50920    pub token: String,
50921    #[serde(rename = "logprob")]
50922    pub logprob: serde_json::Number,
50923    #[serde(rename = "bytes")]
50924    pub bytes: Vec<i64>,
50925    #[serde(rename = "top_logprobs")]
50926    pub top_logprobs: Vec<crate::__types::TopLogProb2>,
50927}
50928#[allow(clippy::module_inception)]
50929pub(crate) mod output_text_content_2 {
50930    #[doc = "The type of the output text. Always `output_text`."]
50931    #[derive(Clone, Copy, Debug, Default, PartialEq)]
50932    pub(crate) struct Type;
50933    impl_serde!(Type, "output_text");
50934}
50935#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
50936pub struct OutputTextContent2 {
50937    #[doc = "The text output from the model."]
50938    pub text: String,
50939    #[doc = "The annotations of the text output."]
50940    pub annotations: Vec<crate::__types::Annotation2>,
50941    #[builder(default)]
50942    pub logprobs: Option<Vec<crate::__types::LogProb2>>,
50943}
50944impl<'de> serde::Deserialize<'de> for OutputTextContent2 {
50945    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
50946    where
50947        D: serde::Deserializer<'de>,
50948    {
50949        #[serde_with::serde_as]
50950        #[derive(serde :: Deserialize)]
50951        struct OutputTextContent2 {
50952            #[serde(rename = "type")]
50953            #[allow(dead_code)]
50954            r#type: crate::__types::output_text_content_2::Type,
50955            #[serde(rename = "text")]
50956            text: String,
50957            #[serde(rename = "annotations")]
50958            annotations: Vec<crate::__types::Annotation2>,
50959            #[serde(rename = "logprobs")]
50960            logprobs: Option<Vec<crate::__types::LogProb2>>,
50961        }
50962        let OutputTextContent2 {
50963            text,
50964            annotations,
50965            logprobs,
50966            ..
50967        } = OutputTextContent2::deserialize(deserializer)?;
50968        Ok(Self {
50969            text,
50970            annotations,
50971            logprobs,
50972        })
50973    }
50974}
50975impl serde::Serialize for OutputTextContent2 {
50976    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
50977    where
50978        S: serde::Serializer,
50979    {
50980        #[serde_with::serde_as]
50981        #[derive(serde :: Serialize)]
50982        struct OutputTextContent2<'a> {
50983            #[serde(rename = "type")]
50984            r#type: &'a crate::__types::output_text_content_2::Type,
50985            #[serde(rename = "text")]
50986            text: &'a String,
50987            #[serde(rename = "annotations")]
50988            annotations: &'a Vec<crate::__types::Annotation2>,
50989            #[serde(rename = "logprobs")]
50990            #[serde(skip_serializing_if = "Option::is_none")]
50991            logprobs: &'a Option<Vec<crate::__types::LogProb2>>,
50992        }
50993        let Self {
50994            text,
50995            annotations,
50996            logprobs,
50997        } = self;
50998        OutputTextContent2 {
50999            r#type: &Default::default(),
51000            text,
51001            annotations,
51002            logprobs,
51003        }
51004        .serialize(serializer)
51005    }
51006}
51007#[allow(clippy::module_inception)]
51008pub(crate) mod text_content {
51009    #[doc = "text"]
51010    #[derive(Clone, Copy, Debug, Default, PartialEq)]
51011    pub(crate) struct Type;
51012    impl_serde!(Type, "text");
51013}
51014#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
51015pub struct TextContent {
51016    pub text: String,
51017}
51018impl<'de> serde::Deserialize<'de> for TextContent {
51019    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
51020    where
51021        D: serde::Deserializer<'de>,
51022    {
51023        #[serde_with::serde_as]
51024        #[derive(serde :: Deserialize)]
51025        struct TextContent {
51026            #[serde(rename = "type")]
51027            #[allow(dead_code)]
51028            r#type: crate::__types::text_content::Type,
51029            #[serde(rename = "text")]
51030            text: String,
51031        }
51032        let TextContent { text, .. } = TextContent::deserialize(deserializer)?;
51033        Ok(Self { text })
51034    }
51035}
51036impl serde::Serialize for TextContent {
51037    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
51038    where
51039        S: serde::Serializer,
51040    {
51041        #[serde_with::serde_as]
51042        #[derive(serde :: Serialize)]
51043        struct TextContent<'a> {
51044            #[serde(rename = "type")]
51045            r#type: &'a crate::__types::text_content::Type,
51046            #[serde(rename = "text")]
51047            text: &'a String,
51048        }
51049        let Self { text } = self;
51050        TextContent {
51051            r#type: &Default::default(),
51052            text,
51053        }
51054        .serialize(serializer)
51055    }
51056}
51057#[allow(clippy::module_inception)]
51058pub(crate) mod summary_text_content {
51059    #[doc = "summary_text"]
51060    #[derive(Clone, Copy, Debug, Default, PartialEq)]
51061    pub(crate) struct Type;
51062    impl_serde!(Type, "summary_text");
51063}
51064#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
51065pub struct SummaryTextContent {
51066    pub text: String,
51067}
51068impl<'de> serde::Deserialize<'de> for SummaryTextContent {
51069    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
51070    where
51071        D: serde::Deserializer<'de>,
51072    {
51073        #[serde_with::serde_as]
51074        #[derive(serde :: Deserialize)]
51075        struct SummaryTextContent {
51076            #[serde(rename = "type")]
51077            #[allow(dead_code)]
51078            r#type: crate::__types::summary_text_content::Type,
51079            #[serde(rename = "text")]
51080            text: String,
51081        }
51082        let SummaryTextContent { text, .. } = SummaryTextContent::deserialize(deserializer)?;
51083        Ok(Self { text })
51084    }
51085}
51086impl serde::Serialize for SummaryTextContent {
51087    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
51088    where
51089        S: serde::Serializer,
51090    {
51091        #[serde_with::serde_as]
51092        #[derive(serde :: Serialize)]
51093        struct SummaryTextContent<'a> {
51094            #[serde(rename = "type")]
51095            r#type: &'a crate::__types::summary_text_content::Type,
51096            #[serde(rename = "text")]
51097            text: &'a String,
51098        }
51099        let Self { text } = self;
51100        SummaryTextContent {
51101            r#type: &Default::default(),
51102            text,
51103        }
51104        .serialize(serializer)
51105    }
51106}
51107#[allow(clippy::module_inception)]
51108pub(crate) mod refusal_content_2 {
51109    #[doc = "The type of the refusal. Always `refusal`."]
51110    #[derive(Clone, Copy, Debug, Default, PartialEq)]
51111    pub(crate) struct Type;
51112    impl_serde!(Type, "refusal");
51113}
51114#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
51115pub struct RefusalContent2 {
51116    #[doc = "The refusal explanation from the model."]
51117    pub refusal: String,
51118}
51119impl<'de> serde::Deserialize<'de> for RefusalContent2 {
51120    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
51121    where
51122        D: serde::Deserializer<'de>,
51123    {
51124        #[serde_with::serde_as]
51125        #[derive(serde :: Deserialize)]
51126        struct RefusalContent2 {
51127            #[serde(rename = "type")]
51128            #[allow(dead_code)]
51129            r#type: crate::__types::refusal_content_2::Type,
51130            #[serde(rename = "refusal")]
51131            refusal: String,
51132        }
51133        let RefusalContent2 { refusal, .. } = RefusalContent2::deserialize(deserializer)?;
51134        Ok(Self { refusal })
51135    }
51136}
51137impl serde::Serialize for RefusalContent2 {
51138    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
51139    where
51140        S: serde::Serializer,
51141    {
51142        #[serde_with::serde_as]
51143        #[derive(serde :: Serialize)]
51144        struct RefusalContent2<'a> {
51145            #[serde(rename = "type")]
51146            r#type: &'a crate::__types::refusal_content_2::Type,
51147            #[serde(rename = "refusal")]
51148            refusal: &'a String,
51149        }
51150        let Self { refusal } = self;
51151        RefusalContent2 {
51152            r#type: &Default::default(),
51153            refusal,
51154        }
51155        .serialize(serializer)
51156    }
51157}
51158#[allow(clippy::module_inception)]
51159pub mod input_image_content_2 {
51160    #[doc = "The type of the input item. Always `input_image`."]
51161    #[derive(Clone, Copy, Debug, Default, PartialEq)]
51162    pub(crate) struct Type;
51163    impl_serde!(Type, "input_image");
51164    #[doc = "The detail level of the image to be sent to the model. One of `high`, `low`, or `auto`. Defaults to `auto`."]
51165    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
51166    pub enum Detail {
51167        #[doc = "`low`"]
51168        #[serde(rename = "low")]
51169        Low,
51170        #[doc = "`high`"]
51171        #[serde(rename = "high")]
51172        High,
51173        #[doc = "`auto`"]
51174        #[serde(rename = "auto")]
51175        Auto,
51176    }
51177}
51178#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
51179pub struct InputImageContent2 {
51180    #[doc = "The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL."]
51181    #[builder(default)]
51182    pub image_url: Option<String>,
51183    #[doc = "The ID of the file to be sent to the model."]
51184    #[builder(default)]
51185    pub file_id: Option<String>,
51186    #[doc = "The detail level of the image to be sent to the model. One of `high`, `low`, or `auto`. Defaults to `auto`."]
51187    pub detail: crate::__types::input_image_content_2::Detail,
51188}
51189impl<'de> serde::Deserialize<'de> for InputImageContent2 {
51190    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
51191    where
51192        D: serde::Deserializer<'de>,
51193    {
51194        #[serde_with::serde_as]
51195        #[derive(serde :: Deserialize)]
51196        struct InputImageContent2 {
51197            #[serde(rename = "type")]
51198            #[allow(dead_code)]
51199            r#type: crate::__types::input_image_content_2::Type,
51200            #[serde(rename = "image_url")]
51201            image_url: Option<String>,
51202            #[serde(rename = "file_id")]
51203            file_id: Option<String>,
51204            #[serde(rename = "detail")]
51205            detail: crate::__types::input_image_content_2::Detail,
51206        }
51207        let InputImageContent2 {
51208            image_url,
51209            file_id,
51210            detail,
51211            ..
51212        } = InputImageContent2::deserialize(deserializer)?;
51213        Ok(Self {
51214            image_url,
51215            file_id,
51216            detail,
51217        })
51218    }
51219}
51220impl serde::Serialize for InputImageContent2 {
51221    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
51222    where
51223        S: serde::Serializer,
51224    {
51225        #[serde_with::serde_as]
51226        #[derive(serde :: Serialize)]
51227        struct InputImageContent2<'a> {
51228            #[serde(rename = "type")]
51229            r#type: &'a crate::__types::input_image_content_2::Type,
51230            #[serde(rename = "image_url")]
51231            #[serde(skip_serializing_if = "Option::is_none")]
51232            image_url: &'a Option<String>,
51233            #[serde(rename = "file_id")]
51234            #[serde(skip_serializing_if = "Option::is_none")]
51235            file_id: &'a Option<String>,
51236            #[serde(rename = "detail")]
51237            detail: &'a crate::__types::input_image_content_2::Detail,
51238        }
51239        let Self {
51240            image_url,
51241            file_id,
51242            detail,
51243        } = self;
51244        InputImageContent2 {
51245            r#type: &Default::default(),
51246            image_url,
51247            file_id,
51248            detail,
51249        }
51250        .serialize(serializer)
51251    }
51252}
51253#[allow(clippy::module_inception)]
51254pub(crate) mod computer_screenshot_content {
51255    #[doc = "Specifies the event type. For a computer screenshot, this property is always set to `computer_screenshot`."]
51256    #[derive(Clone, Copy, Debug, Default, PartialEq)]
51257    pub(crate) struct Type;
51258    impl_serde!(Type, "computer_screenshot");
51259}
51260#[derive(Clone, Debug, Default, PartialEq, typed_builder :: TypedBuilder)]
51261pub struct ComputerScreenshotContent {
51262    #[doc = "The URL of the screenshot image."]
51263    #[builder(default)]
51264    pub image_url: Option<String>,
51265    #[doc = "The identifier of an uploaded file that contains the screenshot."]
51266    #[builder(default)]
51267    pub file_id: Option<String>,
51268}
51269impl<'de> serde::Deserialize<'de> for ComputerScreenshotContent {
51270    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
51271    where
51272        D: serde::Deserializer<'de>,
51273    {
51274        #[serde_with::serde_as]
51275        #[derive(serde :: Deserialize)]
51276        struct ComputerScreenshotContent {
51277            #[serde(rename = "type")]
51278            #[allow(dead_code)]
51279            r#type: crate::__types::computer_screenshot_content::Type,
51280            #[serde(rename = "image_url")]
51281            image_url: Option<String>,
51282            #[serde(rename = "file_id")]
51283            file_id: Option<String>,
51284        }
51285        let ComputerScreenshotContent {
51286            image_url, file_id, ..
51287        } = ComputerScreenshotContent::deserialize(deserializer)?;
51288        Ok(Self { image_url, file_id })
51289    }
51290}
51291impl serde::Serialize for ComputerScreenshotContent {
51292    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
51293    where
51294        S: serde::Serializer,
51295    {
51296        #[serde_with::serde_as]
51297        #[derive(serde :: Serialize)]
51298        struct ComputerScreenshotContent<'a> {
51299            #[serde(rename = "type")]
51300            r#type: &'a crate::__types::computer_screenshot_content::Type,
51301            #[serde(rename = "image_url")]
51302            #[serde(skip_serializing_if = "Option::is_none")]
51303            image_url: &'a Option<String>,
51304            #[serde(rename = "file_id")]
51305            #[serde(skip_serializing_if = "Option::is_none")]
51306            file_id: &'a Option<String>,
51307        }
51308        let Self { image_url, file_id } = self;
51309        ComputerScreenshotContent {
51310            r#type: &Default::default(),
51311            image_url,
51312            file_id,
51313        }
51314        .serialize(serializer)
51315    }
51316}
51317#[allow(clippy::module_inception)]
51318pub(crate) mod input_file_content_2 {
51319    #[doc = "The type of the input item. Always `input_file`."]
51320    #[derive(Clone, Copy, Debug, Default, PartialEq)]
51321    pub(crate) struct Type;
51322    impl_serde!(Type, "input_file");
51323}
51324#[derive(Clone, Debug, Default, PartialEq, typed_builder :: TypedBuilder)]
51325pub struct InputFileContent2 {
51326    #[doc = "The ID of the file to be sent to the model."]
51327    #[builder(default)]
51328    pub file_id: Option<String>,
51329    #[doc = "The name of the file to be sent to the model."]
51330    #[builder(default)]
51331    pub filename: Option<String>,
51332    #[doc = "The URL of the file to be sent to the model."]
51333    #[builder(default)]
51334    pub file_url: Option<String>,
51335}
51336impl<'de> serde::Deserialize<'de> for InputFileContent2 {
51337    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
51338    where
51339        D: serde::Deserializer<'de>,
51340    {
51341        #[serde_with::serde_as]
51342        #[derive(serde :: Deserialize)]
51343        struct InputFileContent2 {
51344            #[serde(rename = "type")]
51345            #[allow(dead_code)]
51346            r#type: crate::__types::input_file_content_2::Type,
51347            #[serde(rename = "file_id")]
51348            file_id: Option<String>,
51349            #[serde(rename = "filename")]
51350            filename: Option<String>,
51351            #[serde(rename = "file_url")]
51352            file_url: Option<String>,
51353        }
51354        let InputFileContent2 {
51355            file_id,
51356            filename,
51357            file_url,
51358            ..
51359        } = InputFileContent2::deserialize(deserializer)?;
51360        Ok(Self {
51361            file_id,
51362            filename,
51363            file_url,
51364        })
51365    }
51366}
51367impl serde::Serialize for InputFileContent2 {
51368    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
51369    where
51370        S: serde::Serializer,
51371    {
51372        #[serde_with::serde_as]
51373        #[derive(serde :: Serialize)]
51374        struct InputFileContent2<'a> {
51375            #[serde(rename = "type")]
51376            r#type: &'a crate::__types::input_file_content_2::Type,
51377            #[serde(rename = "file_id")]
51378            #[serde(skip_serializing_if = "Option::is_none")]
51379            file_id: &'a Option<String>,
51380            #[serde(rename = "filename")]
51381            #[serde(skip_serializing_if = "Option::is_none")]
51382            filename: &'a Option<String>,
51383            #[serde(rename = "file_url")]
51384            #[serde(skip_serializing_if = "Option::is_none")]
51385            file_url: &'a Option<String>,
51386        }
51387        let Self {
51388            file_id,
51389            filename,
51390            file_url,
51391        } = self;
51392        InputFileContent2 {
51393            r#type: &Default::default(),
51394            file_id,
51395            filename,
51396            file_url,
51397        }
51398        .serialize(serializer)
51399    }
51400}
51401#[allow(clippy::module_inception)]
51402pub mod message {
51403    #[doc = "The type of the message. Always set to `message`."]
51404    #[derive(Clone, Copy, Debug, Default, PartialEq)]
51405    pub(crate) struct Type;
51406    impl_serde!(Type, "message");
51407    #[doc = "The status of item. One of `in_progress`, `completed`, or `incomplete`. Populated when items are returned via API."]
51408    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
51409    pub enum Status {
51410        #[doc = "`in_progress`"]
51411        #[serde(rename = "in_progress")]
51412        InProgress,
51413        #[doc = "`completed`"]
51414        #[serde(rename = "completed")]
51415        Completed,
51416        #[doc = "`incomplete`"]
51417        #[serde(rename = "incomplete")]
51418        Incomplete,
51419    }
51420    #[doc = "The role of the message. One of `unknown`, `user`, `assistant`, `system`, `critic`, `discriminator`, `developer`, or `tool`."]
51421    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
51422    pub enum Role {
51423        #[doc = "`unknown`"]
51424        #[serde(rename = "unknown")]
51425        Unknown,
51426        #[doc = "`user`"]
51427        #[serde(rename = "user")]
51428        User,
51429        #[doc = "`assistant`"]
51430        #[serde(rename = "assistant")]
51431        Assistant,
51432        #[doc = "`system`"]
51433        #[serde(rename = "system")]
51434        System,
51435        #[doc = "`critic`"]
51436        #[serde(rename = "critic")]
51437        Critic,
51438        #[doc = "`discriminator`"]
51439        #[serde(rename = "discriminator")]
51440        Discriminator,
51441        #[doc = "`developer`"]
51442        #[serde(rename = "developer")]
51443        Developer,
51444        #[doc = "`tool`"]
51445        #[serde(rename = "tool")]
51446        Tool,
51447    }
51448    #[allow(clippy::module_inception)]
51449    pub mod content {
51450        #[derive(Clone, Debug, PartialEq)]
51451        #[serde_with::serde_as]
51452        #[derive(serde :: Deserialize, serde :: Serialize)]
51453        #[serde(untagged)]
51454        #[allow(clippy::large_enum_variant)]
51455        pub enum Item {
51456            InputText(crate::__types::InputTextContent2),
51457            OutputText(crate::__types::OutputTextContent2),
51458            Text(crate::__types::TextContent),
51459            SummaryText(crate::__types::SummaryTextContent),
51460            Refusal(crate::__types::RefusalContent2),
51461            InputImage(crate::__types::InputImageContent2),
51462            ComputerScreenshot(crate::__types::ComputerScreenshotContent),
51463            InputFile(crate::__types::InputFileContent2),
51464        }
51465    }
51466}
51467#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
51468pub struct Message {
51469    #[doc = "The unique ID of the message."]
51470    pub id: String,
51471    #[doc = "The status of item. One of `in_progress`, `completed`, or `incomplete`. Populated when items are returned via API."]
51472    pub status: crate::__types::message::Status,
51473    #[doc = "The role of the message. One of `unknown`, `user`, `assistant`, `system`, `critic`, `discriminator`, `developer`, or `tool`."]
51474    pub role: crate::__types::message::Role,
51475    #[doc = "The content of the message"]
51476    pub content: Vec<crate::__types::message::content::Item>,
51477}
51478impl<'de> serde::Deserialize<'de> for Message {
51479    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
51480    where
51481        D: serde::Deserializer<'de>,
51482    {
51483        #[serde_with::serde_as]
51484        #[derive(serde :: Deserialize)]
51485        struct Message {
51486            #[serde(rename = "type")]
51487            #[allow(dead_code)]
51488            r#type: crate::__types::message::Type,
51489            #[serde(rename = "id")]
51490            id: String,
51491            #[serde(rename = "status")]
51492            status: crate::__types::message::Status,
51493            #[serde(rename = "role")]
51494            role: crate::__types::message::Role,
51495            #[serde(rename = "content")]
51496            content: Vec<crate::__types::message::content::Item>,
51497        }
51498        let Message {
51499            id,
51500            status,
51501            role,
51502            content,
51503            ..
51504        } = Message::deserialize(deserializer)?;
51505        Ok(Self {
51506            id,
51507            status,
51508            role,
51509            content,
51510        })
51511    }
51512}
51513impl serde::Serialize for Message {
51514    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
51515    where
51516        S: serde::Serializer,
51517    {
51518        #[serde_with::serde_as]
51519        #[derive(serde :: Serialize)]
51520        struct Message<'a> {
51521            #[serde(rename = "type")]
51522            r#type: &'a crate::__types::message::Type,
51523            #[serde(rename = "id")]
51524            id: &'a String,
51525            #[serde(rename = "status")]
51526            status: &'a crate::__types::message::Status,
51527            #[serde(rename = "role")]
51528            role: &'a crate::__types::message::Role,
51529            #[serde(rename = "content")]
51530            content: &'a Vec<crate::__types::message::content::Item>,
51531        }
51532        let Self {
51533            id,
51534            status,
51535            role,
51536            content,
51537        } = self;
51538        Message {
51539            r#type: &Default::default(),
51540            id,
51541            status,
51542            role,
51543            content,
51544        }
51545        .serialize(serializer)
51546    }
51547}
51548#[allow(clippy::module_inception)]
51549pub(crate) mod function_tool {
51550    #[doc = "The type of the function tool. Always `function`."]
51551    #[derive(Clone, Copy, Debug, Default, PartialEq)]
51552    pub(crate) struct Type;
51553    impl_serde!(Type, "function");
51554}
51555#[doc = "Defines a function in your own code the model can choose to call. Learn more about [function calling](https://platform.openai.com/docs/guides/function-calling)."]
51556#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
51557pub struct FunctionTool {
51558    #[doc = "The name of the function to call."]
51559    pub name: String,
51560    #[doc = "A description of the function. Used by the model to determine whether or not to call the function."]
51561    #[builder(default)]
51562    pub description: Option<String>,
51563    #[doc = "A JSON schema object describing the parameters of the function."]
51564    #[builder(default)]
51565    pub parameters: Option<indexmap::IndexMap<String, serde_json::Value>>,
51566    #[doc = "Whether to enforce strict parameter validation. Default `true`."]
51567    #[builder(default)]
51568    pub strict: Option<bool>,
51569}
51570impl<'de> serde::Deserialize<'de> for FunctionTool {
51571    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
51572    where
51573        D: serde::Deserializer<'de>,
51574    {
51575        #[serde_with::serde_as]
51576        #[derive(serde :: Deserialize)]
51577        struct FunctionTool {
51578            #[serde(rename = "type")]
51579            #[allow(dead_code)]
51580            r#type: crate::__types::function_tool::Type,
51581            #[serde(rename = "name")]
51582            name: String,
51583            #[serde(rename = "description")]
51584            description: Option<String>,
51585            #[serde(rename = "parameters")]
51586            parameters: Option<indexmap::IndexMap<String, serde_json::Value>>,
51587            #[serde(rename = "strict")]
51588            strict: Option<bool>,
51589        }
51590        let FunctionTool {
51591            name,
51592            description,
51593            parameters,
51594            strict,
51595            ..
51596        } = FunctionTool::deserialize(deserializer)?;
51597        Ok(Self {
51598            name,
51599            description,
51600            parameters,
51601            strict,
51602        })
51603    }
51604}
51605impl serde::Serialize for FunctionTool {
51606    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
51607    where
51608        S: serde::Serializer,
51609    {
51610        #[serde_with::serde_as]
51611        #[derive(serde :: Serialize)]
51612        struct FunctionTool<'a> {
51613            #[serde(rename = "type")]
51614            r#type: &'a crate::__types::function_tool::Type,
51615            #[serde(rename = "name")]
51616            name: &'a String,
51617            #[serde(rename = "description")]
51618            #[serde(skip_serializing_if = "Option::is_none")]
51619            description: &'a Option<String>,
51620            #[serde(rename = "parameters")]
51621            #[serde(skip_serializing_if = "Option::is_none")]
51622            parameters: &'a Option<indexmap::IndexMap<String, serde_json::Value>>,
51623            #[serde(rename = "strict")]
51624            #[serde(skip_serializing_if = "Option::is_none")]
51625            strict: &'a Option<bool>,
51626        }
51627        let Self {
51628            name,
51629            description,
51630            parameters,
51631            strict,
51632        } = self;
51633        FunctionTool {
51634            r#type: &Default::default(),
51635            name,
51636            description,
51637            parameters,
51638            strict,
51639        }
51640        .serialize(serializer)
51641    }
51642}
51643#[allow(clippy::module_inception)]
51644pub mod ranking_options {
51645    #[doc = "The ranker to use for the file search."]
51646    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
51647    pub enum Ranker {
51648        #[doc = "`auto`"]
51649        #[serde(rename = "auto")]
51650        Auto,
51651        #[doc = "`default-2024-11-15`"]
51652        #[serde(rename = "default-2024-11-15")]
51653        Default2024_11_15,
51654    }
51655}
51656#[derive(Clone, Debug, Default, PartialEq)]
51657#[serde_with::serde_as]
51658#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
51659pub struct RankingOptions {
51660    #[doc = "The ranker to use for the file search."]
51661    #[serde(rename = "ranker")]
51662    #[serde(skip_serializing_if = "Option::is_none")]
51663    #[builder(default)]
51664    pub ranker: Option<crate::__types::ranking_options::Ranker>,
51665    #[doc = "The score threshold for the file search, a number between 0 and 1. Numbers closer to 1 will attempt to return only the most relevant results, but may return fewer results."]
51666    #[serde(rename = "score_threshold")]
51667    #[serde(skip_serializing_if = "Option::is_none")]
51668    #[builder(default)]
51669    pub score_threshold: Option<serde_json::Number>,
51670}
51671#[derive(Clone, Debug, PartialEq)]
51672#[serde_with::serde_as]
51673#[derive(serde :: Deserialize, serde :: Serialize)]
51674#[serde(untagged)]
51675#[allow(clippy::large_enum_variant)]
51676pub enum Filters {
51677    ComparisonFilter(crate::__types::ComparisonFilter),
51678    CompoundFilter(crate::__types::CompoundFilter),
51679}
51680#[allow(clippy::module_inception)]
51681pub(crate) mod file_search_tool {
51682    #[doc = "The type of the file search tool. Always `file_search`."]
51683    #[derive(Clone, Copy, Debug, Default, PartialEq)]
51684    pub(crate) struct Type;
51685    impl_serde!(Type, "file_search");
51686}
51687#[doc = "A tool that searches for relevant content from uploaded files. Learn more about the [file search tool](https://platform.openai.com/docs/guides/tools-file-search)."]
51688#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
51689pub struct FileSearchTool {
51690    #[doc = "The IDs of the vector stores to search."]
51691    pub vector_store_ids: Vec<String>,
51692    #[doc = "The maximum number of results to return. This number should be between 1 and 50 inclusive."]
51693    #[builder(default)]
51694    pub max_num_results: Option<i64>,
51695    #[doc = "Ranking options for search."]
51696    #[builder(default)]
51697    pub ranking_options: Option<crate::__types::RankingOptions>,
51698    #[doc = "A filter to apply."]
51699    #[builder(default)]
51700    pub filters: Option<crate::__types::Filters>,
51701}
51702impl<'de> serde::Deserialize<'de> for FileSearchTool {
51703    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
51704    where
51705        D: serde::Deserializer<'de>,
51706    {
51707        #[serde_with::serde_as]
51708        #[derive(serde :: Deserialize)]
51709        struct FileSearchTool {
51710            #[serde(rename = "type")]
51711            #[allow(dead_code)]
51712            r#type: crate::__types::file_search_tool::Type,
51713            #[serde(rename = "vector_store_ids")]
51714            vector_store_ids: Vec<String>,
51715            #[serde(rename = "max_num_results")]
51716            max_num_results: Option<i64>,
51717            #[serde(rename = "ranking_options")]
51718            ranking_options: Option<crate::__types::RankingOptions>,
51719            #[serde(rename = "filters")]
51720            filters: Option<crate::__types::Filters>,
51721        }
51722        let FileSearchTool {
51723            vector_store_ids,
51724            max_num_results,
51725            ranking_options,
51726            filters,
51727            ..
51728        } = FileSearchTool::deserialize(deserializer)?;
51729        Ok(Self {
51730            vector_store_ids,
51731            max_num_results,
51732            ranking_options,
51733            filters,
51734        })
51735    }
51736}
51737impl serde::Serialize for FileSearchTool {
51738    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
51739    where
51740        S: serde::Serializer,
51741    {
51742        #[serde_with::serde_as]
51743        #[derive(serde :: Serialize)]
51744        struct FileSearchTool<'a> {
51745            #[serde(rename = "type")]
51746            r#type: &'a crate::__types::file_search_tool::Type,
51747            #[serde(rename = "vector_store_ids")]
51748            vector_store_ids: &'a Vec<String>,
51749            #[serde(rename = "max_num_results")]
51750            #[serde(skip_serializing_if = "Option::is_none")]
51751            max_num_results: &'a Option<i64>,
51752            #[serde(rename = "ranking_options")]
51753            #[serde(skip_serializing_if = "Option::is_none")]
51754            ranking_options: &'a Option<crate::__types::RankingOptions>,
51755            #[serde(rename = "filters")]
51756            #[serde(skip_serializing_if = "Option::is_none")]
51757            filters: &'a Option<crate::__types::Filters>,
51758        }
51759        let Self {
51760            vector_store_ids,
51761            max_num_results,
51762            ranking_options,
51763            filters,
51764        } = self;
51765        FileSearchTool {
51766            r#type: &Default::default(),
51767            vector_store_ids,
51768            max_num_results,
51769            ranking_options,
51770            filters,
51771        }
51772        .serialize(serializer)
51773    }
51774}
51775#[allow(clippy::module_inception)]
51776pub(crate) mod approximate_location {
51777    #[doc = "The type of location approximation. Always `approximate`."]
51778    #[derive(Clone, Copy, Debug, Default, PartialEq)]
51779    pub(crate) struct Type;
51780    impl_serde!(Type, "approximate");
51781}
51782#[derive(Clone, Debug, Default, PartialEq, typed_builder :: TypedBuilder)]
51783pub struct ApproximateLocation {
51784    #[doc = "The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`."]
51785    #[builder(default)]
51786    pub country: Option<String>,
51787    #[doc = "Free text input for the region of the user, e.g. `California`."]
51788    #[builder(default)]
51789    pub region: Option<String>,
51790    #[doc = "Free text input for the city of the user, e.g. `San Francisco`."]
51791    #[builder(default)]
51792    pub city: Option<String>,
51793    #[doc = "The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`."]
51794    #[builder(default)]
51795    pub timezone: Option<String>,
51796}
51797impl<'de> serde::Deserialize<'de> for ApproximateLocation {
51798    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
51799    where
51800        D: serde::Deserializer<'de>,
51801    {
51802        #[serde_with::serde_as]
51803        #[derive(serde :: Deserialize)]
51804        struct ApproximateLocation {
51805            #[serde(rename = "type")]
51806            #[allow(dead_code)]
51807            r#type: crate::__types::approximate_location::Type,
51808            #[serde(rename = "country")]
51809            country: Option<String>,
51810            #[serde(rename = "region")]
51811            region: Option<String>,
51812            #[serde(rename = "city")]
51813            city: Option<String>,
51814            #[serde(rename = "timezone")]
51815            timezone: Option<String>,
51816        }
51817        let ApproximateLocation {
51818            country,
51819            region,
51820            city,
51821            timezone,
51822            ..
51823        } = ApproximateLocation::deserialize(deserializer)?;
51824        Ok(Self {
51825            country,
51826            region,
51827            city,
51828            timezone,
51829        })
51830    }
51831}
51832impl serde::Serialize for ApproximateLocation {
51833    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
51834    where
51835        S: serde::Serializer,
51836    {
51837        #[serde_with::serde_as]
51838        #[derive(serde :: Serialize)]
51839        struct ApproximateLocation<'a> {
51840            #[serde(rename = "type")]
51841            r#type: &'a crate::__types::approximate_location::Type,
51842            #[serde(rename = "country")]
51843            #[serde(skip_serializing_if = "Option::is_none")]
51844            country: &'a Option<String>,
51845            #[serde(rename = "region")]
51846            #[serde(skip_serializing_if = "Option::is_none")]
51847            region: &'a Option<String>,
51848            #[serde(rename = "city")]
51849            #[serde(skip_serializing_if = "Option::is_none")]
51850            city: &'a Option<String>,
51851            #[serde(rename = "timezone")]
51852            #[serde(skip_serializing_if = "Option::is_none")]
51853            timezone: &'a Option<String>,
51854        }
51855        let Self {
51856            country,
51857            region,
51858            city,
51859            timezone,
51860        } = self;
51861        ApproximateLocation {
51862            r#type: &Default::default(),
51863            country,
51864            region,
51865            city,
51866            timezone,
51867        }
51868        .serialize(serializer)
51869    }
51870}
51871#[allow(clippy::module_inception)]
51872pub mod web_search_preview_tool {
51873    #[doc = "The type of the web search tool. One of `web_search_preview` or `web_search_preview_2025_03_11`."]
51874    #[derive(Clone, Copy, Debug, Default, PartialEq, serde :: Deserialize, serde :: Serialize)]
51875    pub enum Type {
51876        #[doc = "`web_search_preview`"]
51877        #[default]
51878        #[serde(rename = "web_search_preview")]
51879        WebSearchPreview,
51880        #[doc = "`web_search_preview_2025_03_11`"]
51881        #[serde(rename = "web_search_preview_2025_03_11")]
51882        WebSearchPreview2025_03_11,
51883    }
51884    #[doc = "High level guidance for the amount of context window space to use for the search. One of `low`, `medium`, or `high`. `medium` is the default."]
51885    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
51886    pub enum SearchContextSize {
51887        #[doc = "`low`"]
51888        #[serde(rename = "low")]
51889        Low,
51890        #[doc = "`medium`"]
51891        #[serde(rename = "medium")]
51892        Medium,
51893        #[doc = "`high`"]
51894        #[serde(rename = "high")]
51895        High,
51896    }
51897}
51898#[doc = "This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](https://platform.openai.com/docs/guides/tools-web-search)."]
51899#[derive(Clone, Debug, Default, PartialEq)]
51900#[serde_with::serde_as]
51901#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
51902pub struct WebSearchPreviewTool {
51903    #[doc = "The type of the web search tool. One of `web_search_preview` or `web_search_preview_2025_03_11`."]
51904    #[serde(rename = "type")]
51905    #[builder(default)]
51906    pub r#type: crate::__types::web_search_preview_tool::Type,
51907    #[doc = "The user's location."]
51908    #[serde(rename = "user_location")]
51909    #[serde(skip_serializing_if = "Option::is_none")]
51910    #[builder(default)]
51911    pub user_location: Option<crate::__types::ApproximateLocation>,
51912    #[doc = "High level guidance for the amount of context window space to use for the search. One of `low`, `medium`, or `high`. `medium` is the default."]
51913    #[serde(rename = "search_context_size")]
51914    #[serde(skip_serializing_if = "Option::is_none")]
51915    #[builder(default)]
51916    pub search_context_size: Option<crate::__types::web_search_preview_tool::SearchContextSize>,
51917}
51918#[allow(clippy::module_inception)]
51919pub mod computer_use_preview_tool {
51920    #[doc = "The type of the computer use tool. Always `computer_use_preview`."]
51921    #[derive(Clone, Copy, Debug, Default, PartialEq)]
51922    pub(crate) struct Type;
51923    impl_serde!(Type, "computer_use_preview");
51924    #[doc = "The type of computer environment to control."]
51925    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
51926    pub enum Environment {
51927        #[doc = "`windows`"]
51928        #[serde(rename = "windows")]
51929        Windows,
51930        #[doc = "`mac`"]
51931        #[serde(rename = "mac")]
51932        Mac,
51933        #[doc = "`linux`"]
51934        #[serde(rename = "linux")]
51935        Linux,
51936        #[doc = "`ubuntu`"]
51937        #[serde(rename = "ubuntu")]
51938        Ubuntu,
51939        #[doc = "`browser`"]
51940        #[serde(rename = "browser")]
51941        Browser,
51942    }
51943}
51944#[doc = "A tool that controls a virtual computer. Learn more about the [computer tool](https://platform.openai.com/docs/guides/tools-computer-use)."]
51945#[derive(Clone, Copy, Debug, PartialEq, typed_builder :: TypedBuilder)]
51946pub struct ComputerUsePreviewTool {
51947    #[doc = "The type of computer environment to control."]
51948    pub environment: crate::__types::computer_use_preview_tool::Environment,
51949    #[doc = "The width of the computer display."]
51950    pub display_width: i64,
51951    #[doc = "The height of the computer display."]
51952    pub display_height: i64,
51953}
51954impl<'de> serde::Deserialize<'de> for ComputerUsePreviewTool {
51955    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
51956    where
51957        D: serde::Deserializer<'de>,
51958    {
51959        #[serde_with::serde_as]
51960        #[derive(serde :: Deserialize)]
51961        struct ComputerUsePreviewTool {
51962            #[serde(rename = "type")]
51963            #[allow(dead_code)]
51964            r#type: crate::__types::computer_use_preview_tool::Type,
51965            #[serde(rename = "environment")]
51966            environment: crate::__types::computer_use_preview_tool::Environment,
51967            #[serde(rename = "display_width")]
51968            display_width: i64,
51969            #[serde(rename = "display_height")]
51970            display_height: i64,
51971        }
51972        let ComputerUsePreviewTool {
51973            environment,
51974            display_width,
51975            display_height,
51976            ..
51977        } = ComputerUsePreviewTool::deserialize(deserializer)?;
51978        Ok(Self {
51979            environment,
51980            display_width,
51981            display_height,
51982        })
51983    }
51984}
51985impl serde::Serialize for ComputerUsePreviewTool {
51986    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
51987    where
51988        S: serde::Serializer,
51989    {
51990        #[serde_with::serde_as]
51991        #[derive(serde :: Serialize)]
51992        struct ComputerUsePreviewTool<'a> {
51993            #[serde(rename = "type")]
51994            r#type: &'a crate::__types::computer_use_preview_tool::Type,
51995            #[serde(rename = "environment")]
51996            environment: &'a crate::__types::computer_use_preview_tool::Environment,
51997            #[serde(rename = "display_width")]
51998            display_width: &'a i64,
51999            #[serde(rename = "display_height")]
52000            display_height: &'a i64,
52001        }
52002        let Self {
52003            environment,
52004            display_width,
52005            display_height,
52006        } = self;
52007        ComputerUsePreviewTool {
52008            r#type: &Default::default(),
52009            environment,
52010            display_width,
52011            display_height,
52012        }
52013        .serialize(serializer)
52014    }
52015}
52016#[doc = "The input tokens detailed information for the image generation."]
52017#[derive(Clone, Copy, Debug, PartialEq)]
52018#[serde_with::serde_as]
52019#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
52020pub struct ImageGenInputUsageDetails {
52021    #[doc = "The number of text tokens in the input prompt."]
52022    #[serde(rename = "text_tokens")]
52023    pub text_tokens: i64,
52024    #[doc = "The number of image tokens in the input prompt."]
52025    #[serde(rename = "image_tokens")]
52026    pub image_tokens: i64,
52027}
52028#[doc = "For `gpt-image-1` only, the token usage information for the image generation."]
52029#[derive(Clone, Copy, Debug, PartialEq)]
52030#[serde_with::serde_as]
52031#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
52032pub struct ImageGenUsage {
52033    #[doc = "The number of tokens (images and text) in the input prompt."]
52034    #[serde(rename = "input_tokens")]
52035    pub input_tokens: i64,
52036    #[doc = "The total number of tokens (images and text) used for the image generation."]
52037    #[serde(rename = "total_tokens")]
52038    pub total_tokens: i64,
52039    #[doc = "The number of output tokens generated by the model."]
52040    #[serde(rename = "output_tokens")]
52041    pub output_tokens: i64,
52042    #[serde(rename = "input_tokens_details")]
52043    pub input_tokens_details: crate::__types::ImageGenInputUsageDetails,
52044}
52045#[doc = "The conversation that this response belongs to."]
52046#[derive(Clone, Debug, PartialEq)]
52047#[serde_with::serde_as]
52048#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
52049pub struct ConversationParam {
52050    #[doc = "The unique ID of the conversation."]
52051    #[serde(rename = "id")]
52052    pub id: String,
52053}
52054#[doc = "The conversation that this response belongs to. Input items and output items from this response are automatically added to this conversation."]
52055#[derive(Clone, Debug, PartialEq)]
52056#[serde_with::serde_as]
52057#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
52058pub struct Conversation2 {
52059    #[doc = "The unique ID of the conversation."]
52060    #[serde(rename = "id")]
52061    pub id: String,
52062}
52063#[allow(clippy::module_inception)]
52064pub mod realtime_conversation_item_content {
52065    #[doc = "The content type (`input_text`, `input_audio`, `item_reference`, `text`, `audio`).\n"]
52066    #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
52067    pub enum Type {
52068        #[doc = "`input_text`"]
52069        #[serde(rename = "input_text")]
52070        InputText,
52071        #[doc = "`input_audio`"]
52072        #[serde(rename = "input_audio")]
52073        InputAudio,
52074        #[doc = "`item_reference`"]
52075        #[serde(rename = "item_reference")]
52076        ItemReference,
52077        #[doc = "`text`"]
52078        #[serde(rename = "text")]
52079        Text,
52080        #[doc = "`audio`"]
52081        #[serde(rename = "audio")]
52082        Audio,
52083    }
52084}
52085#[derive(Clone, Debug, Default, PartialEq)]
52086#[serde_with::serde_as]
52087#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
52088pub struct RealtimeConversationItemContent {
52089    #[doc = "The content type (`input_text`, `input_audio`, `item_reference`, `text`, `audio`).\n"]
52090    #[serde(rename = "type")]
52091    #[serde(skip_serializing_if = "Option::is_none")]
52092    #[builder(default)]
52093    pub r#type: Option<crate::__types::realtime_conversation_item_content::Type>,
52094    #[doc = "The text content, used for `input_text` and `text` content types.\n"]
52095    #[serde(rename = "text")]
52096    #[serde(skip_serializing_if = "Option::is_none")]
52097    #[builder(default)]
52098    pub text: Option<String>,
52099    #[doc = "ID of a previous conversation item to reference (for `item_reference`\ncontent types in `response.create` events). These can reference both\nclient and server created items.\n"]
52100    #[serde(rename = "id")]
52101    #[serde(skip_serializing_if = "Option::is_none")]
52102    #[builder(default)]
52103    pub id: Option<String>,
52104    #[doc = "Base64-encoded audio bytes, used for `input_audio` content type.\n"]
52105    #[serde(rename = "audio")]
52106    #[serde(skip_serializing_if = "Option::is_none")]
52107    #[builder(default)]
52108    pub audio: Option<String>,
52109    #[doc = "The transcript of the audio, used for `input_audio` and `audio` \ncontent types.\n"]
52110    #[serde(rename = "transcript")]
52111    #[serde(skip_serializing_if = "Option::is_none")]
52112    #[builder(default)]
52113    pub transcript: Option<String>,
52114}
52115#[derive(Clone, Debug, PartialEq)]
52116#[serde_with::serde_as]
52117#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
52118pub struct RealtimeConnectParams {
52119    #[serde(rename = "model")]
52120    pub model: String,
52121}
52122#[allow(clippy::module_inception)]
52123pub mod moderation_image_url_input {
52124    #[doc = "Always `image_url`."]
52125    #[derive(Clone, Copy, Debug, Default, PartialEq)]
52126    pub(crate) struct Type;
52127    impl_serde!(Type, "image_url");
52128    #[doc = "Contains either an image URL or a data URL for a base64 encoded image."]
52129    #[derive(Clone, Debug, PartialEq)]
52130    #[serde_with::serde_as]
52131    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
52132    pub struct ImageUrl {
52133        #[doc = "Either a URL of the image or the base64 encoded image data."]
52134        #[serde(rename = "url")]
52135        pub url: String,
52136    }
52137}
52138#[doc = "An object describing an image to classify."]
52139#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
52140pub struct ModerationImageUrlInput {
52141    #[doc = "Contains either an image URL or a data URL for a base64 encoded image."]
52142    pub image_url: crate::__types::moderation_image_url_input::ImageUrl,
52143}
52144impl<'de> serde::Deserialize<'de> for ModerationImageUrlInput {
52145    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
52146    where
52147        D: serde::Deserializer<'de>,
52148    {
52149        #[serde_with::serde_as]
52150        #[derive(serde :: Deserialize)]
52151        struct ModerationImageUrlInput {
52152            #[serde(rename = "type")]
52153            #[allow(dead_code)]
52154            r#type: crate::__types::moderation_image_url_input::Type,
52155            #[serde(rename = "image_url")]
52156            image_url: crate::__types::moderation_image_url_input::ImageUrl,
52157        }
52158        let ModerationImageUrlInput { image_url, .. } =
52159            ModerationImageUrlInput::deserialize(deserializer)?;
52160        Ok(Self { image_url })
52161    }
52162}
52163impl serde::Serialize for ModerationImageUrlInput {
52164    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
52165    where
52166        S: serde::Serializer,
52167    {
52168        #[serde_with::serde_as]
52169        #[derive(serde :: Serialize)]
52170        struct ModerationImageUrlInput<'a> {
52171            #[serde(rename = "type")]
52172            r#type: &'a crate::__types::moderation_image_url_input::Type,
52173            #[serde(rename = "image_url")]
52174            image_url: &'a crate::__types::moderation_image_url_input::ImageUrl,
52175        }
52176        let Self { image_url } = self;
52177        ModerationImageUrlInput {
52178            r#type: &Default::default(),
52179            image_url,
52180        }
52181        .serialize(serializer)
52182    }
52183}
52184#[allow(clippy::module_inception)]
52185pub(crate) mod moderation_text_input {
52186    #[doc = "Always `text`."]
52187    #[derive(Clone, Copy, Debug, Default, PartialEq)]
52188    pub(crate) struct Type;
52189    impl_serde!(Type, "text");
52190}
52191#[doc = "An object describing text to classify."]
52192#[derive(Clone, Debug, PartialEq, typed_builder :: TypedBuilder)]
52193pub struct ModerationTextInput {
52194    #[doc = "A string of text to classify."]
52195    pub text: String,
52196}
52197impl<'de> serde::Deserialize<'de> for ModerationTextInput {
52198    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
52199    where
52200        D: serde::Deserializer<'de>,
52201    {
52202        #[serde_with::serde_as]
52203        #[derive(serde :: Deserialize)]
52204        struct ModerationTextInput {
52205            #[serde(rename = "type")]
52206            #[allow(dead_code)]
52207            r#type: crate::__types::moderation_text_input::Type,
52208            #[serde(rename = "text")]
52209            text: String,
52210        }
52211        let ModerationTextInput { text, .. } = ModerationTextInput::deserialize(deserializer)?;
52212        Ok(Self { text })
52213    }
52214}
52215impl serde::Serialize for ModerationTextInput {
52216    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
52217    where
52218        S: serde::Serializer,
52219    {
52220        #[serde_with::serde_as]
52221        #[derive(serde :: Serialize)]
52222        struct ModerationTextInput<'a> {
52223            #[serde(rename = "type")]
52224            r#type: &'a crate::__types::moderation_text_input::Type,
52225            #[serde(rename = "text")]
52226            text: &'a String,
52227        }
52228        let Self { text } = self;
52229        ModerationTextInput {
52230            r#type: &Default::default(),
52231            text,
52232        }
52233        .serialize(serializer)
52234    }
52235}
52236#[doc = "The strategy used to chunk the file."]
52237#[derive(Clone, Copy, Debug, PartialEq)]
52238#[serde_with::serde_as]
52239#[derive(serde :: Deserialize, serde :: Serialize)]
52240#[serde(untagged)]
52241#[allow(clippy::large_enum_variant)]
52242pub enum ChunkingStrategyResponse {
52243    Static(crate::__types::StaticChunkingStrategyResponseParam),
52244    Other(crate::__types::OtherChunkingStrategyResponseParam),
52245}
52246#[doc = "The intended purpose of the uploaded file. One of: - `assistants`: Used in the Assistants API - `batch`: Used in the Batch API - `fine-tune`: Used for fine-tuning - `vision`: Images used for vision fine-tuning - `user_data`: Flexible file type for any purpose - `evals`: Used for eval data sets\n"]
52247#[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
52248pub enum FilePurpose {
52249    #[doc = "`assistants`"]
52250    #[serde(rename = "assistants")]
52251    Assistants,
52252    #[doc = "`batch`"]
52253    #[serde(rename = "batch")]
52254    Batch,
52255    #[doc = "`fine-tune`"]
52256    #[serde(rename = "fine-tune")]
52257    FineTune,
52258    #[doc = "`vision`"]
52259    #[serde(rename = "vision")]
52260    Vision,
52261    #[doc = "`user_data`"]
52262    #[serde(rename = "user_data")]
52263    UserData,
52264    #[doc = "`evals`"]
52265    #[serde(rename = "evals")]
52266    Evals,
52267}
52268#[derive(Clone, Debug, Default, PartialEq)]
52269#[serde_with::serde_as]
52270#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
52271pub struct BatchError {
52272    #[doc = "An error code identifying the error type."]
52273    #[serde(rename = "code")]
52274    #[serde(skip_serializing_if = "Option::is_none")]
52275    #[builder(default)]
52276    pub code: Option<String>,
52277    #[doc = "A human-readable message providing more details about the error."]
52278    #[serde(rename = "message")]
52279    #[serde(skip_serializing_if = "Option::is_none")]
52280    #[builder(default)]
52281    pub message: Option<String>,
52282    #[doc = "The name of the parameter that caused the error, if applicable."]
52283    #[serde(rename = "param")]
52284    #[serde(skip_serializing_if = "Option::is_none")]
52285    #[builder(default)]
52286    pub param: Option<String>,
52287    #[doc = "The line number of the input file where the error occurred, if applicable."]
52288    #[serde(rename = "line")]
52289    #[serde(skip_serializing_if = "Option::is_none")]
52290    #[builder(default)]
52291    pub line: Option<i64>,
52292}
52293#[doc = "The request counts for different statuses within the batch."]
52294#[derive(Clone, Copy, Debug, PartialEq)]
52295#[serde_with::serde_as]
52296#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
52297pub struct BatchRequestCounts {
52298    #[doc = "Total number of requests in the batch."]
52299    #[serde(rename = "total")]
52300    pub total: i64,
52301    #[doc = "Number of requests that have been completed successfully."]
52302    #[serde(rename = "completed")]
52303    pub completed: i64,
52304    #[doc = "Number of requests that have failed."]
52305    #[serde(rename = "failed")]
52306    pub failed: i64,
52307}
52308#[derive(Clone, Debug, PartialEq)]
52309#[serde_with::serde_as]
52310#[derive(serde :: Deserialize, serde :: Serialize)]
52311#[serde(untagged)]
52312#[allow(clippy::large_enum_variant)]
52313pub enum AssistantTool {
52314    CodeInterpreter(crate::__types::AssistantToolsCode),
52315    FileSearch(crate::__types::AssistantToolsFileSearch),
52316    Function(crate::__types::AssistantToolsFunction),
52317}
52318#[derive(Clone, Debug, PartialEq)]
52319#[serde_with::serde_as]
52320#[derive(serde :: Deserialize, serde :: Serialize)]
52321#[serde(untagged)]
52322#[allow(clippy::large_enum_variant)]
52323pub enum TextAnnotationDelta {
52324    FileCitation(crate::__types::MessageDeltaContentTextAnnotationsFileCitationObject),
52325    FilePath(crate::__types::MessageDeltaContentTextAnnotationsFilePathObject),
52326}
52327#[derive(Clone, Debug, PartialEq)]
52328#[serde_with::serde_as]
52329#[derive(serde :: Deserialize, serde :: Serialize)]
52330#[serde(untagged)]
52331#[allow(clippy::large_enum_variant)]
52332pub enum TextAnnotation {
52333    FileCitation(crate::__types::MessageContentTextAnnotationsFileCitationObject),
52334    FilePath(crate::__types::MessageContentTextAnnotationsFilePathObject),
52335}
52336#[derive(Clone, Debug, PartialEq)]
52337#[serde_with::serde_as]
52338#[derive(serde :: Deserialize, serde :: Serialize)]
52339#[serde(untagged)]
52340#[allow(clippy::large_enum_variant)]
52341pub enum RunStepDetailsToolCall {
52342    CodeInterpreter(crate::__types::RunStepDetailsToolCallsCodeObject),
52343    FileSearch(crate::__types::RunStepDetailsToolCallsFileSearchObject),
52344    Function(crate::__types::RunStepDetailsToolCallsFunctionObject),
52345}
52346#[derive(Clone, Debug, PartialEq)]
52347#[serde_with::serde_as]
52348#[derive(serde :: Deserialize, serde :: Serialize)]
52349#[serde(untagged)]
52350#[allow(clippy::large_enum_variant)]
52351pub enum RunStepDeltaStepDetailsToolCall {
52352    CodeInterpreter(crate::__types::RunStepDeltaStepDetailsToolCallsCodeObject),
52353    FileSearch(crate::__types::RunStepDeltaStepDetailsToolCallsFileSearchObject),
52354    Function(crate::__types::RunStepDeltaStepDetailsToolCallsFunctionObject),
52355}
52356#[derive(Clone, Debug, PartialEq)]
52357#[serde_with::serde_as]
52358#[derive(serde :: Deserialize, serde :: Serialize)]
52359#[serde(untagged)]
52360#[allow(clippy::large_enum_variant)]
52361pub enum MessageContent {
52362    ImageFile(crate::__types::MessageContentImageFileObject),
52363    ImageUrl(crate::__types::MessageContentImageUrlObject),
52364    Text(crate::__types::MessageContentTextObject),
52365    Refusal(crate::__types::MessageContentRefusalObject),
52366}
52367#[derive(Clone, Debug, PartialEq)]
52368#[serde_with::serde_as]
52369#[derive(serde :: Deserialize, serde :: Serialize)]
52370#[serde(untagged)]
52371#[allow(clippy::large_enum_variant)]
52372pub enum MessageContentDelta {
52373    ImageFile(crate::__types::MessageDeltaContentImageFileObject),
52374    Text(crate::__types::MessageDeltaContentTextObject),
52375    Refusal(crate::__types::MessageDeltaContentRefusalObject),
52376    ImageUrl(crate::__types::MessageDeltaContentImageUrlObject),
52377}
52378#[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
52379pub enum ChatModel {
52380    #[doc = "`gpt-5`"]
52381    #[serde(rename = "gpt-5")]
52382    Gpt5,
52383    #[doc = "`gpt-5-mini`"]
52384    #[serde(rename = "gpt-5-mini")]
52385    Gpt5Mini,
52386    #[doc = "`gpt-5-nano`"]
52387    #[serde(rename = "gpt-5-nano")]
52388    Gpt5Nano,
52389    #[doc = "`gpt-5-2025-08-07`"]
52390    #[serde(rename = "gpt-5-2025-08-07")]
52391    Gpt5_2025_08_07,
52392    #[doc = "`gpt-5-mini-2025-08-07`"]
52393    #[serde(rename = "gpt-5-mini-2025-08-07")]
52394    Gpt5Mini2025_08_07,
52395    #[doc = "`gpt-5-nano-2025-08-07`"]
52396    #[serde(rename = "gpt-5-nano-2025-08-07")]
52397    Gpt5Nano2025_08_07,
52398    #[doc = "`gpt-5-chat-latest`"]
52399    #[serde(rename = "gpt-5-chat-latest")]
52400    Gpt5ChatLatest,
52401    #[doc = "`gpt-4.1`"]
52402    #[serde(rename = "gpt-4.1")]
52403    Gpt4_1,
52404    #[doc = "`gpt-4.1-mini`"]
52405    #[serde(rename = "gpt-4.1-mini")]
52406    Gpt4_1Mini,
52407    #[doc = "`gpt-4.1-nano`"]
52408    #[serde(rename = "gpt-4.1-nano")]
52409    Gpt4_1Nano,
52410    #[doc = "`gpt-4.1-2025-04-14`"]
52411    #[serde(rename = "gpt-4.1-2025-04-14")]
52412    Gpt4_1_2025_04_14,
52413    #[doc = "`gpt-4.1-mini-2025-04-14`"]
52414    #[serde(rename = "gpt-4.1-mini-2025-04-14")]
52415    Gpt4_1Mini2025_04_14,
52416    #[doc = "`gpt-4.1-nano-2025-04-14`"]
52417    #[serde(rename = "gpt-4.1-nano-2025-04-14")]
52418    Gpt4_1Nano2025_04_14,
52419    #[doc = "`o4-mini`"]
52420    #[serde(rename = "o4-mini")]
52421    O4Mini,
52422    #[doc = "`o4-mini-2025-04-16`"]
52423    #[serde(rename = "o4-mini-2025-04-16")]
52424    O4Mini2025_04_16,
52425    #[doc = "`o3`"]
52426    #[serde(rename = "o3")]
52427    O3,
52428    #[doc = "`o3-2025-04-16`"]
52429    #[serde(rename = "o3-2025-04-16")]
52430    O3_2025_04_16,
52431    #[doc = "`o3-mini`"]
52432    #[serde(rename = "o3-mini")]
52433    O3Mini,
52434    #[doc = "`o3-mini-2025-01-31`"]
52435    #[serde(rename = "o3-mini-2025-01-31")]
52436    O3Mini2025_01_31,
52437    #[doc = "`o1`"]
52438    #[serde(rename = "o1")]
52439    O1,
52440    #[doc = "`o1-2024-12-17`"]
52441    #[serde(rename = "o1-2024-12-17")]
52442    O1_2024_12_17,
52443    #[doc = "`o1-preview`"]
52444    #[serde(rename = "o1-preview")]
52445    O1Preview,
52446    #[doc = "`o1-preview-2024-09-12`"]
52447    #[serde(rename = "o1-preview-2024-09-12")]
52448    O1Preview2024_09_12,
52449    #[doc = "`o1-mini`"]
52450    #[serde(rename = "o1-mini")]
52451    O1Mini,
52452    #[doc = "`o1-mini-2024-09-12`"]
52453    #[serde(rename = "o1-mini-2024-09-12")]
52454    O1Mini2024_09_12,
52455    #[doc = "`gpt-4o`"]
52456    #[serde(rename = "gpt-4o")]
52457    Gpt4o,
52458    #[doc = "`gpt-4o-2024-11-20`"]
52459    #[serde(rename = "gpt-4o-2024-11-20")]
52460    Gpt4o2024_11_20,
52461    #[doc = "`gpt-4o-2024-08-06`"]
52462    #[serde(rename = "gpt-4o-2024-08-06")]
52463    Gpt4o2024_08_06,
52464    #[doc = "`gpt-4o-2024-05-13`"]
52465    #[serde(rename = "gpt-4o-2024-05-13")]
52466    Gpt4o2024_05_13,
52467    #[doc = "`gpt-4o-audio-preview`"]
52468    #[serde(rename = "gpt-4o-audio-preview")]
52469    Gpt4oAudioPreview,
52470    #[doc = "`gpt-4o-audio-preview-2024-10-01`"]
52471    #[serde(rename = "gpt-4o-audio-preview-2024-10-01")]
52472    Gpt4oAudioPreview2024_10_01,
52473    #[doc = "`gpt-4o-audio-preview-2024-12-17`"]
52474    #[serde(rename = "gpt-4o-audio-preview-2024-12-17")]
52475    Gpt4oAudioPreview2024_12_17,
52476    #[doc = "`gpt-4o-audio-preview-2025-06-03`"]
52477    #[serde(rename = "gpt-4o-audio-preview-2025-06-03")]
52478    Gpt4oAudioPreview2025_06_03,
52479    #[doc = "`gpt-4o-mini-audio-preview`"]
52480    #[serde(rename = "gpt-4o-mini-audio-preview")]
52481    Gpt4oMiniAudioPreview,
52482    #[doc = "`gpt-4o-mini-audio-preview-2024-12-17`"]
52483    #[serde(rename = "gpt-4o-mini-audio-preview-2024-12-17")]
52484    Gpt4oMiniAudioPreview2024_12_17,
52485    #[doc = "`gpt-4o-search-preview`"]
52486    #[serde(rename = "gpt-4o-search-preview")]
52487    Gpt4oSearchPreview,
52488    #[doc = "`gpt-4o-mini-search-preview`"]
52489    #[serde(rename = "gpt-4o-mini-search-preview")]
52490    Gpt4oMiniSearchPreview,
52491    #[doc = "`gpt-4o-search-preview-2025-03-11`"]
52492    #[serde(rename = "gpt-4o-search-preview-2025-03-11")]
52493    Gpt4oSearchPreview2025_03_11,
52494    #[doc = "`gpt-4o-mini-search-preview-2025-03-11`"]
52495    #[serde(rename = "gpt-4o-mini-search-preview-2025-03-11")]
52496    Gpt4oMiniSearchPreview2025_03_11,
52497    #[doc = "`chatgpt-4o-latest`"]
52498    #[serde(rename = "chatgpt-4o-latest")]
52499    Chatgpt4oLatest,
52500    #[doc = "`codex-mini-latest`"]
52501    #[serde(rename = "codex-mini-latest")]
52502    CodexMiniLatest,
52503    #[doc = "`gpt-4o-mini`"]
52504    #[serde(rename = "gpt-4o-mini")]
52505    Gpt4oMini,
52506    #[doc = "`gpt-4o-mini-2024-07-18`"]
52507    #[serde(rename = "gpt-4o-mini-2024-07-18")]
52508    Gpt4oMini2024_07_18,
52509    #[doc = "`gpt-4-turbo`"]
52510    #[serde(rename = "gpt-4-turbo")]
52511    Gpt4Turbo,
52512    #[doc = "`gpt-4-turbo-2024-04-09`"]
52513    #[serde(rename = "gpt-4-turbo-2024-04-09")]
52514    Gpt4Turbo2024_04_09,
52515    #[doc = "`gpt-4-0125-preview`"]
52516    #[serde(rename = "gpt-4-0125-preview")]
52517    Gpt4_0125Preview,
52518    #[doc = "`gpt-4-turbo-preview`"]
52519    #[serde(rename = "gpt-4-turbo-preview")]
52520    Gpt4TurboPreview,
52521    #[doc = "`gpt-4-1106-preview`"]
52522    #[serde(rename = "gpt-4-1106-preview")]
52523    Gpt4_1106Preview,
52524    #[doc = "`gpt-4-vision-preview`"]
52525    #[serde(rename = "gpt-4-vision-preview")]
52526    Gpt4VisionPreview,
52527    #[doc = "`gpt-4`"]
52528    #[serde(rename = "gpt-4")]
52529    Gpt4,
52530    #[doc = "`gpt-4-0314`"]
52531    #[serde(rename = "gpt-4-0314")]
52532    Gpt4_0314,
52533    #[doc = "`gpt-4-0613`"]
52534    #[serde(rename = "gpt-4-0613")]
52535    Gpt4_0613,
52536    #[doc = "`gpt-4-32k`"]
52537    #[serde(rename = "gpt-4-32k")]
52538    Gpt4_32k,
52539    #[doc = "`gpt-4-32k-0314`"]
52540    #[serde(rename = "gpt-4-32k-0314")]
52541    Gpt4_32k0314,
52542    #[doc = "`gpt-4-32k-0613`"]
52543    #[serde(rename = "gpt-4-32k-0613")]
52544    Gpt4_32k0613,
52545    #[doc = "`gpt-3.5-turbo`"]
52546    #[serde(rename = "gpt-3.5-turbo")]
52547    Gpt3_5Turbo,
52548    #[doc = "`gpt-3.5-turbo-16k`"]
52549    #[serde(rename = "gpt-3.5-turbo-16k")]
52550    Gpt3_5Turbo16k,
52551    #[doc = "`gpt-3.5-turbo-0301`"]
52552    #[serde(rename = "gpt-3.5-turbo-0301")]
52553    Gpt3_5Turbo0301,
52554    #[doc = "`gpt-3.5-turbo-0613`"]
52555    #[serde(rename = "gpt-3.5-turbo-0613")]
52556    Gpt3_5Turbo0613,
52557    #[doc = "`gpt-3.5-turbo-1106`"]
52558    #[serde(rename = "gpt-3.5-turbo-1106")]
52559    Gpt3_5Turbo1106,
52560    #[doc = "`gpt-3.5-turbo-0125`"]
52561    #[serde(rename = "gpt-3.5-turbo-0125")]
52562    Gpt3_5Turbo0125,
52563    #[doc = "`gpt-3.5-turbo-16k-0613`"]
52564    #[serde(rename = "gpt-3.5-turbo-16k-0613")]
52565    Gpt3_5Turbo16k0613,
52566}
52567#[allow(clippy::module_inception)]
52568pub mod create_thread_and_run_request_without_stream {
52569    #[allow(clippy::module_inception)]
52570    pub(crate) mod model {
52571        #[doc = "gpt-5"]
52572        #[derive(Clone, Copy, Debug, Default, PartialEq)]
52573        pub(crate) struct Gpt5;
52574        impl_serde!(Gpt5, "gpt-5");
52575        #[doc = "gpt-5-mini"]
52576        #[derive(Clone, Copy, Debug, Default, PartialEq)]
52577        pub(crate) struct Gpt5Mini;
52578        impl_serde!(Gpt5Mini, "gpt-5-mini");
52579        #[doc = "gpt-5-nano"]
52580        #[derive(Clone, Copy, Debug, Default, PartialEq)]
52581        pub(crate) struct Gpt5Nano;
52582        impl_serde!(Gpt5Nano, "gpt-5-nano");
52583        #[doc = "gpt-5-2025-08-07"]
52584        #[derive(Clone, Copy, Debug, Default, PartialEq)]
52585        pub(crate) struct Gpt5_2025_08_07;
52586        impl_serde!(Gpt5_2025_08_07, "gpt-5-2025-08-07");
52587        #[doc = "gpt-5-mini-2025-08-07"]
52588        #[derive(Clone, Copy, Debug, Default, PartialEq)]
52589        pub(crate) struct Gpt5Mini2025_08_07;
52590        impl_serde!(Gpt5Mini2025_08_07, "gpt-5-mini-2025-08-07");
52591        #[doc = "gpt-5-nano-2025-08-07"]
52592        #[derive(Clone, Copy, Debug, Default, PartialEq)]
52593        pub(crate) struct Gpt5Nano2025_08_07;
52594        impl_serde!(Gpt5Nano2025_08_07, "gpt-5-nano-2025-08-07");
52595        #[doc = "gpt-4.1"]
52596        #[derive(Clone, Copy, Debug, Default, PartialEq)]
52597        pub(crate) struct Gpt4_1;
52598        impl_serde!(Gpt4_1, "gpt-4.1");
52599        #[doc = "gpt-4.1-mini"]
52600        #[derive(Clone, Copy, Debug, Default, PartialEq)]
52601        pub(crate) struct Gpt4_1Mini;
52602        impl_serde!(Gpt4_1Mini, "gpt-4.1-mini");
52603        #[doc = "gpt-4.1-nano"]
52604        #[derive(Clone, Copy, Debug, Default, PartialEq)]
52605        pub(crate) struct Gpt4_1Nano;
52606        impl_serde!(Gpt4_1Nano, "gpt-4.1-nano");
52607        #[doc = "gpt-4.1-2025-04-14"]
52608        #[derive(Clone, Copy, Debug, Default, PartialEq)]
52609        pub(crate) struct Gpt4_1_2025_04_14;
52610        impl_serde!(Gpt4_1_2025_04_14, "gpt-4.1-2025-04-14");
52611        #[doc = "gpt-4.1-mini-2025-04-14"]
52612        #[derive(Clone, Copy, Debug, Default, PartialEq)]
52613        pub(crate) struct Gpt4_1Mini2025_04_14;
52614        impl_serde!(Gpt4_1Mini2025_04_14, "gpt-4.1-mini-2025-04-14");
52615        #[doc = "gpt-4.1-nano-2025-04-14"]
52616        #[derive(Clone, Copy, Debug, Default, PartialEq)]
52617        pub(crate) struct Gpt4_1Nano2025_04_14;
52618        impl_serde!(Gpt4_1Nano2025_04_14, "gpt-4.1-nano-2025-04-14");
52619        #[doc = "gpt-4o"]
52620        #[derive(Clone, Copy, Debug, Default, PartialEq)]
52621        pub(crate) struct Gpt4o;
52622        impl_serde!(Gpt4o, "gpt-4o");
52623        #[doc = "gpt-4o-2024-11-20"]
52624        #[derive(Clone, Copy, Debug, Default, PartialEq)]
52625        pub(crate) struct Gpt4o2024_11_20;
52626        impl_serde!(Gpt4o2024_11_20, "gpt-4o-2024-11-20");
52627        #[doc = "gpt-4o-2024-08-06"]
52628        #[derive(Clone, Copy, Debug, Default, PartialEq)]
52629        pub(crate) struct Gpt4o2024_08_06;
52630        impl_serde!(Gpt4o2024_08_06, "gpt-4o-2024-08-06");
52631        #[doc = "gpt-4o-2024-05-13"]
52632        #[derive(Clone, Copy, Debug, Default, PartialEq)]
52633        pub(crate) struct Gpt4o2024_05_13;
52634        impl_serde!(Gpt4o2024_05_13, "gpt-4o-2024-05-13");
52635        #[doc = "gpt-4o-mini"]
52636        #[derive(Clone, Copy, Debug, Default, PartialEq)]
52637        pub(crate) struct Gpt4oMini;
52638        impl_serde!(Gpt4oMini, "gpt-4o-mini");
52639        #[doc = "gpt-4o-mini-2024-07-18"]
52640        #[derive(Clone, Copy, Debug, Default, PartialEq)]
52641        pub(crate) struct Gpt4oMini2024_07_18;
52642        impl_serde!(Gpt4oMini2024_07_18, "gpt-4o-mini-2024-07-18");
52643        #[doc = "gpt-4.5-preview"]
52644        #[derive(Clone, Copy, Debug, Default, PartialEq)]
52645        pub(crate) struct Gpt4_5Preview;
52646        impl_serde!(Gpt4_5Preview, "gpt-4.5-preview");
52647        #[doc = "gpt-4.5-preview-2025-02-27"]
52648        #[derive(Clone, Copy, Debug, Default, PartialEq)]
52649        pub(crate) struct Gpt4_5Preview2025_02_27;
52650        impl_serde!(Gpt4_5Preview2025_02_27, "gpt-4.5-preview-2025-02-27");
52651        #[doc = "gpt-4-turbo"]
52652        #[derive(Clone, Copy, Debug, Default, PartialEq)]
52653        pub(crate) struct Gpt4Turbo;
52654        impl_serde!(Gpt4Turbo, "gpt-4-turbo");
52655        #[doc = "gpt-4-turbo-2024-04-09"]
52656        #[derive(Clone, Copy, Debug, Default, PartialEq)]
52657        pub(crate) struct Gpt4Turbo2024_04_09;
52658        impl_serde!(Gpt4Turbo2024_04_09, "gpt-4-turbo-2024-04-09");
52659        #[doc = "gpt-4-0125-preview"]
52660        #[derive(Clone, Copy, Debug, Default, PartialEq)]
52661        pub(crate) struct Gpt4_0125Preview;
52662        impl_serde!(Gpt4_0125Preview, "gpt-4-0125-preview");
52663        #[doc = "gpt-4-turbo-preview"]
52664        #[derive(Clone, Copy, Debug, Default, PartialEq)]
52665        pub(crate) struct Gpt4TurboPreview;
52666        impl_serde!(Gpt4TurboPreview, "gpt-4-turbo-preview");
52667        #[doc = "gpt-4-1106-preview"]
52668        #[derive(Clone, Copy, Debug, Default, PartialEq)]
52669        pub(crate) struct Gpt4_1106Preview;
52670        impl_serde!(Gpt4_1106Preview, "gpt-4-1106-preview");
52671        #[doc = "gpt-4-vision-preview"]
52672        #[derive(Clone, Copy, Debug, Default, PartialEq)]
52673        pub(crate) struct Gpt4VisionPreview;
52674        impl_serde!(Gpt4VisionPreview, "gpt-4-vision-preview");
52675        #[doc = "gpt-4"]
52676        #[derive(Clone, Copy, Debug, Default, PartialEq)]
52677        pub(crate) struct Gpt4;
52678        impl_serde!(Gpt4, "gpt-4");
52679        #[doc = "gpt-4-0314"]
52680        #[derive(Clone, Copy, Debug, Default, PartialEq)]
52681        pub(crate) struct Gpt4_0314;
52682        impl_serde!(Gpt4_0314, "gpt-4-0314");
52683        #[doc = "gpt-4-0613"]
52684        #[derive(Clone, Copy, Debug, Default, PartialEq)]
52685        pub(crate) struct Gpt4_0613;
52686        impl_serde!(Gpt4_0613, "gpt-4-0613");
52687        #[doc = "gpt-4-32k"]
52688        #[derive(Clone, Copy, Debug, Default, PartialEq)]
52689        pub(crate) struct Gpt4_32k;
52690        impl_serde!(Gpt4_32k, "gpt-4-32k");
52691        #[doc = "gpt-4-32k-0314"]
52692        #[derive(Clone, Copy, Debug, Default, PartialEq)]
52693        pub(crate) struct Gpt4_32k0314;
52694        impl_serde!(Gpt4_32k0314, "gpt-4-32k-0314");
52695        #[doc = "gpt-4-32k-0613"]
52696        #[derive(Clone, Copy, Debug, Default, PartialEq)]
52697        pub(crate) struct Gpt4_32k0613;
52698        impl_serde!(Gpt4_32k0613, "gpt-4-32k-0613");
52699        #[doc = "gpt-3.5-turbo"]
52700        #[derive(Clone, Copy, Debug, Default, PartialEq)]
52701        pub(crate) struct Gpt3_5Turbo;
52702        impl_serde!(Gpt3_5Turbo, "gpt-3.5-turbo");
52703        #[doc = "gpt-3.5-turbo-16k"]
52704        #[derive(Clone, Copy, Debug, Default, PartialEq)]
52705        pub(crate) struct Gpt3_5Turbo16k;
52706        impl_serde!(Gpt3_5Turbo16k, "gpt-3.5-turbo-16k");
52707        #[doc = "gpt-3.5-turbo-0613"]
52708        #[derive(Clone, Copy, Debug, Default, PartialEq)]
52709        pub(crate) struct Gpt3_5Turbo0613;
52710        impl_serde!(Gpt3_5Turbo0613, "gpt-3.5-turbo-0613");
52711        #[doc = "gpt-3.5-turbo-1106"]
52712        #[derive(Clone, Copy, Debug, Default, PartialEq)]
52713        pub(crate) struct Gpt3_5Turbo1106;
52714        impl_serde!(Gpt3_5Turbo1106, "gpt-3.5-turbo-1106");
52715        #[doc = "gpt-3.5-turbo-0125"]
52716        #[derive(Clone, Copy, Debug, Default, PartialEq)]
52717        pub(crate) struct Gpt3_5Turbo0125;
52718        impl_serde!(Gpt3_5Turbo0125, "gpt-3.5-turbo-0125");
52719        #[doc = "gpt-3.5-turbo-16k-0613"]
52720        #[derive(Clone, Copy, Debug, Default, PartialEq)]
52721        pub(crate) struct Gpt3_5Turbo16k0613;
52722        impl_serde!(Gpt3_5Turbo16k0613, "gpt-3.5-turbo-16k-0613");
52723    }
52724    #[doc = "The ID of the [Model](https://platform.openai.com/docs/api-reference/models) to be used to execute this run. If a value is provided here, it will override the model associated with the assistant. If not, the model associated with the assistant will be used."]
52725    #[derive(Clone, Debug, PartialEq)]
52726    #[allow(clippy::large_enum_variant)]
52727    pub enum Model {
52728        Other(String),
52729        #[doc = "gpt-5"]
52730        Gpt5,
52731        #[doc = "gpt-5-mini"]
52732        Gpt5Mini,
52733        #[doc = "gpt-5-nano"]
52734        Gpt5Nano,
52735        #[doc = "gpt-5-2025-08-07"]
52736        Gpt5_2025_08_07,
52737        #[doc = "gpt-5-mini-2025-08-07"]
52738        Gpt5Mini2025_08_07,
52739        #[doc = "gpt-5-nano-2025-08-07"]
52740        Gpt5Nano2025_08_07,
52741        #[doc = "gpt-4.1"]
52742        Gpt4_1,
52743        #[doc = "gpt-4.1-mini"]
52744        Gpt4_1Mini,
52745        #[doc = "gpt-4.1-nano"]
52746        Gpt4_1Nano,
52747        #[doc = "gpt-4.1-2025-04-14"]
52748        Gpt4_1_2025_04_14,
52749        #[doc = "gpt-4.1-mini-2025-04-14"]
52750        Gpt4_1Mini2025_04_14,
52751        #[doc = "gpt-4.1-nano-2025-04-14"]
52752        Gpt4_1Nano2025_04_14,
52753        #[doc = "gpt-4o"]
52754        Gpt4o,
52755        #[doc = "gpt-4o-2024-11-20"]
52756        Gpt4o2024_11_20,
52757        #[doc = "gpt-4o-2024-08-06"]
52758        Gpt4o2024_08_06,
52759        #[doc = "gpt-4o-2024-05-13"]
52760        Gpt4o2024_05_13,
52761        #[doc = "gpt-4o-mini"]
52762        Gpt4oMini,
52763        #[doc = "gpt-4o-mini-2024-07-18"]
52764        Gpt4oMini2024_07_18,
52765        #[doc = "gpt-4.5-preview"]
52766        Gpt4_5Preview,
52767        #[doc = "gpt-4.5-preview-2025-02-27"]
52768        Gpt4_5Preview2025_02_27,
52769        #[doc = "gpt-4-turbo"]
52770        Gpt4Turbo,
52771        #[doc = "gpt-4-turbo-2024-04-09"]
52772        Gpt4Turbo2024_04_09,
52773        #[doc = "gpt-4-0125-preview"]
52774        Gpt4_0125Preview,
52775        #[doc = "gpt-4-turbo-preview"]
52776        Gpt4TurboPreview,
52777        #[doc = "gpt-4-1106-preview"]
52778        Gpt4_1106Preview,
52779        #[doc = "gpt-4-vision-preview"]
52780        Gpt4VisionPreview,
52781        #[doc = "gpt-4"]
52782        Gpt4,
52783        #[doc = "gpt-4-0314"]
52784        Gpt4_0314,
52785        #[doc = "gpt-4-0613"]
52786        Gpt4_0613,
52787        #[doc = "gpt-4-32k"]
52788        Gpt4_32k,
52789        #[doc = "gpt-4-32k-0314"]
52790        Gpt4_32k0314,
52791        #[doc = "gpt-4-32k-0613"]
52792        Gpt4_32k0613,
52793        #[doc = "gpt-3.5-turbo"]
52794        Gpt3_5Turbo,
52795        #[doc = "gpt-3.5-turbo-16k"]
52796        Gpt3_5Turbo16k,
52797        #[doc = "gpt-3.5-turbo-0613"]
52798        Gpt3_5Turbo0613,
52799        #[doc = "gpt-3.5-turbo-1106"]
52800        Gpt3_5Turbo1106,
52801        #[doc = "gpt-3.5-turbo-0125"]
52802        Gpt3_5Turbo0125,
52803        #[doc = "gpt-3.5-turbo-16k-0613"]
52804        Gpt3_5Turbo16k0613,
52805    }
52806    impl<'de> serde::Deserialize<'de> for Model {
52807        fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
52808        where
52809            D: serde::Deserializer<'de>,
52810        {
52811            #[serde_with::serde_as]
52812            #[derive(serde :: Deserialize)]
52813            #[serde(untagged)]
52814            #[allow(clippy::enum_variant_names, clippy::large_enum_variant)]
52815            enum Model {
52816                Gpt5 (crate :: __types :: create_thread_and_run_request_without_stream :: model :: Gpt5) , Gpt5Mini (crate :: __types :: create_thread_and_run_request_without_stream :: model :: Gpt5Mini) , Gpt5Nano (crate :: __types :: create_thread_and_run_request_without_stream :: model :: Gpt5Nano) , Gpt5_2025_08_07 (crate :: __types :: create_thread_and_run_request_without_stream :: model :: Gpt5_2025_08_07) , Gpt5Mini2025_08_07 (crate :: __types :: create_thread_and_run_request_without_stream :: model :: Gpt5Mini2025_08_07) , Gpt5Nano2025_08_07 (crate :: __types :: create_thread_and_run_request_without_stream :: model :: Gpt5Nano2025_08_07) , Gpt4_1 (crate :: __types :: create_thread_and_run_request_without_stream :: model :: Gpt4_1) , Gpt4_1Mini (crate :: __types :: create_thread_and_run_request_without_stream :: model :: Gpt4_1Mini) , Gpt4_1Nano (crate :: __types :: create_thread_and_run_request_without_stream :: model :: Gpt4_1Nano) , Gpt4_1_2025_04_14 (crate :: __types :: create_thread_and_run_request_without_stream :: model :: Gpt4_1_2025_04_14) , Gpt4_1Mini2025_04_14 (crate :: __types :: create_thread_and_run_request_without_stream :: model :: Gpt4_1Mini2025_04_14) , Gpt4_1Nano2025_04_14 (crate :: __types :: create_thread_and_run_request_without_stream :: model :: Gpt4_1Nano2025_04_14) , Gpt4o (crate :: __types :: create_thread_and_run_request_without_stream :: model :: Gpt4o) , Gpt4o2024_11_20 (crate :: __types :: create_thread_and_run_request_without_stream :: model :: Gpt4o2024_11_20) , Gpt4o2024_08_06 (crate :: __types :: create_thread_and_run_request_without_stream :: model :: Gpt4o2024_08_06) , Gpt4o2024_05_13 (crate :: __types :: create_thread_and_run_request_without_stream :: model :: Gpt4o2024_05_13) , Gpt4oMini (crate :: __types :: create_thread_and_run_request_without_stream :: model :: Gpt4oMini) , Gpt4oMini2024_07_18 (crate :: __types :: create_thread_and_run_request_without_stream :: model :: Gpt4oMini2024_07_18) , Gpt4_5Preview (crate :: __types :: create_thread_and_run_request_without_stream :: model :: Gpt4_5Preview) , Gpt4_5Preview2025_02_27 (crate :: __types :: create_thread_and_run_request_without_stream :: model :: Gpt4_5Preview2025_02_27) , Gpt4Turbo (crate :: __types :: create_thread_and_run_request_without_stream :: model :: Gpt4Turbo) , Gpt4Turbo2024_04_09 (crate :: __types :: create_thread_and_run_request_without_stream :: model :: Gpt4Turbo2024_04_09) , Gpt4_0125Preview (crate :: __types :: create_thread_and_run_request_without_stream :: model :: Gpt4_0125Preview) , Gpt4TurboPreview (crate :: __types :: create_thread_and_run_request_without_stream :: model :: Gpt4TurboPreview) , Gpt4_1106Preview (crate :: __types :: create_thread_and_run_request_without_stream :: model :: Gpt4_1106Preview) , Gpt4VisionPreview (crate :: __types :: create_thread_and_run_request_without_stream :: model :: Gpt4VisionPreview) , Gpt4 (crate :: __types :: create_thread_and_run_request_without_stream :: model :: Gpt4) , Gpt4_0314 (crate :: __types :: create_thread_and_run_request_without_stream :: model :: Gpt4_0314) , Gpt4_0613 (crate :: __types :: create_thread_and_run_request_without_stream :: model :: Gpt4_0613) , Gpt4_32k (crate :: __types :: create_thread_and_run_request_without_stream :: model :: Gpt4_32k) , Gpt4_32k0314 (crate :: __types :: create_thread_and_run_request_without_stream :: model :: Gpt4_32k0314) , Gpt4_32k0613 (crate :: __types :: create_thread_and_run_request_without_stream :: model :: Gpt4_32k0613) , Gpt3_5Turbo (crate :: __types :: create_thread_and_run_request_without_stream :: model :: Gpt3_5Turbo) , Gpt3_5Turbo16k (crate :: __types :: create_thread_and_run_request_without_stream :: model :: Gpt3_5Turbo16k) , Gpt3_5Turbo0613 (crate :: __types :: create_thread_and_run_request_without_stream :: model :: Gpt3_5Turbo0613) , Gpt3_5Turbo1106 (crate :: __types :: create_thread_and_run_request_without_stream :: model :: Gpt3_5Turbo1106) , Gpt3_5Turbo0125 (crate :: __types :: create_thread_and_run_request_without_stream :: model :: Gpt3_5Turbo0125) , Gpt3_5Turbo16k0613 (crate :: __types :: create_thread_and_run_request_without_stream :: model :: Gpt3_5Turbo16k0613) , Other (String) }
52817            Ok(match Model::deserialize(deserializer)? {
52818                Model::Other(v) => Self::Other(v),
52819                Model::Gpt5(_) => Self::Gpt5,
52820                Model::Gpt5Mini(_) => Self::Gpt5Mini,
52821                Model::Gpt5Nano(_) => Self::Gpt5Nano,
52822                Model::Gpt5_2025_08_07(_) => Self::Gpt5_2025_08_07,
52823                Model::Gpt5Mini2025_08_07(_) => Self::Gpt5Mini2025_08_07,
52824                Model::Gpt5Nano2025_08_07(_) => Self::Gpt5Nano2025_08_07,
52825                Model::Gpt4_1(_) => Self::Gpt4_1,
52826                Model::Gpt4_1Mini(_) => Self::Gpt4_1Mini,
52827                Model::Gpt4_1Nano(_) => Self::Gpt4_1Nano,
52828                Model::Gpt4_1_2025_04_14(_) => Self::Gpt4_1_2025_04_14,
52829                Model::Gpt4_1Mini2025_04_14(_) => Self::Gpt4_1Mini2025_04_14,
52830                Model::Gpt4_1Nano2025_04_14(_) => Self::Gpt4_1Nano2025_04_14,
52831                Model::Gpt4o(_) => Self::Gpt4o,
52832                Model::Gpt4o2024_11_20(_) => Self::Gpt4o2024_11_20,
52833                Model::Gpt4o2024_08_06(_) => Self::Gpt4o2024_08_06,
52834                Model::Gpt4o2024_05_13(_) => Self::Gpt4o2024_05_13,
52835                Model::Gpt4oMini(_) => Self::Gpt4oMini,
52836                Model::Gpt4oMini2024_07_18(_) => Self::Gpt4oMini2024_07_18,
52837                Model::Gpt4_5Preview(_) => Self::Gpt4_5Preview,
52838                Model::Gpt4_5Preview2025_02_27(_) => Self::Gpt4_5Preview2025_02_27,
52839                Model::Gpt4Turbo(_) => Self::Gpt4Turbo,
52840                Model::Gpt4Turbo2024_04_09(_) => Self::Gpt4Turbo2024_04_09,
52841                Model::Gpt4_0125Preview(_) => Self::Gpt4_0125Preview,
52842                Model::Gpt4TurboPreview(_) => Self::Gpt4TurboPreview,
52843                Model::Gpt4_1106Preview(_) => Self::Gpt4_1106Preview,
52844                Model::Gpt4VisionPreview(_) => Self::Gpt4VisionPreview,
52845                Model::Gpt4(_) => Self::Gpt4,
52846                Model::Gpt4_0314(_) => Self::Gpt4_0314,
52847                Model::Gpt4_0613(_) => Self::Gpt4_0613,
52848                Model::Gpt4_32k(_) => Self::Gpt4_32k,
52849                Model::Gpt4_32k0314(_) => Self::Gpt4_32k0314,
52850                Model::Gpt4_32k0613(_) => Self::Gpt4_32k0613,
52851                Model::Gpt3_5Turbo(_) => Self::Gpt3_5Turbo,
52852                Model::Gpt3_5Turbo16k(_) => Self::Gpt3_5Turbo16k,
52853                Model::Gpt3_5Turbo0613(_) => Self::Gpt3_5Turbo0613,
52854                Model::Gpt3_5Turbo1106(_) => Self::Gpt3_5Turbo1106,
52855                Model::Gpt3_5Turbo0125(_) => Self::Gpt3_5Turbo0125,
52856                Model::Gpt3_5Turbo16k0613(_) => Self::Gpt3_5Turbo16k0613,
52857            })
52858        }
52859    }
52860    impl serde::Serialize for Model {
52861        fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
52862        where
52863            S: serde::Serializer,
52864        {
52865            #[serde_with::serde_as]
52866            #[derive(serde :: Serialize)]
52867            #[serde(untagged)]
52868            #[allow(clippy::enum_variant_names)]
52869            enum Model<'a> {
52870                Other (& 'a String) , Gpt5 (crate :: __types :: create_thread_and_run_request_without_stream :: model :: Gpt5) , Gpt5Mini (crate :: __types :: create_thread_and_run_request_without_stream :: model :: Gpt5Mini) , Gpt5Nano (crate :: __types :: create_thread_and_run_request_without_stream :: model :: Gpt5Nano) , Gpt5_2025_08_07 (crate :: __types :: create_thread_and_run_request_without_stream :: model :: Gpt5_2025_08_07) , Gpt5Mini2025_08_07 (crate :: __types :: create_thread_and_run_request_without_stream :: model :: Gpt5Mini2025_08_07) , Gpt5Nano2025_08_07 (crate :: __types :: create_thread_and_run_request_without_stream :: model :: Gpt5Nano2025_08_07) , Gpt4_1 (crate :: __types :: create_thread_and_run_request_without_stream :: model :: Gpt4_1) , Gpt4_1Mini (crate :: __types :: create_thread_and_run_request_without_stream :: model :: Gpt4_1Mini) , Gpt4_1Nano (crate :: __types :: create_thread_and_run_request_without_stream :: model :: Gpt4_1Nano) , Gpt4_1_2025_04_14 (crate :: __types :: create_thread_and_run_request_without_stream :: model :: Gpt4_1_2025_04_14) , Gpt4_1Mini2025_04_14 (crate :: __types :: create_thread_and_run_request_without_stream :: model :: Gpt4_1Mini2025_04_14) , Gpt4_1Nano2025_04_14 (crate :: __types :: create_thread_and_run_request_without_stream :: model :: Gpt4_1Nano2025_04_14) , Gpt4o (crate :: __types :: create_thread_and_run_request_without_stream :: model :: Gpt4o) , Gpt4o2024_11_20 (crate :: __types :: create_thread_and_run_request_without_stream :: model :: Gpt4o2024_11_20) , Gpt4o2024_08_06 (crate :: __types :: create_thread_and_run_request_without_stream :: model :: Gpt4o2024_08_06) , Gpt4o2024_05_13 (crate :: __types :: create_thread_and_run_request_without_stream :: model :: Gpt4o2024_05_13) , Gpt4oMini (crate :: __types :: create_thread_and_run_request_without_stream :: model :: Gpt4oMini) , Gpt4oMini2024_07_18 (crate :: __types :: create_thread_and_run_request_without_stream :: model :: Gpt4oMini2024_07_18) , Gpt4_5Preview (crate :: __types :: create_thread_and_run_request_without_stream :: model :: Gpt4_5Preview) , Gpt4_5Preview2025_02_27 (crate :: __types :: create_thread_and_run_request_without_stream :: model :: Gpt4_5Preview2025_02_27) , Gpt4Turbo (crate :: __types :: create_thread_and_run_request_without_stream :: model :: Gpt4Turbo) , Gpt4Turbo2024_04_09 (crate :: __types :: create_thread_and_run_request_without_stream :: model :: Gpt4Turbo2024_04_09) , Gpt4_0125Preview (crate :: __types :: create_thread_and_run_request_without_stream :: model :: Gpt4_0125Preview) , Gpt4TurboPreview (crate :: __types :: create_thread_and_run_request_without_stream :: model :: Gpt4TurboPreview) , Gpt4_1106Preview (crate :: __types :: create_thread_and_run_request_without_stream :: model :: Gpt4_1106Preview) , Gpt4VisionPreview (crate :: __types :: create_thread_and_run_request_without_stream :: model :: Gpt4VisionPreview) , Gpt4 (crate :: __types :: create_thread_and_run_request_without_stream :: model :: Gpt4) , Gpt4_0314 (crate :: __types :: create_thread_and_run_request_without_stream :: model :: Gpt4_0314) , Gpt4_0613 (crate :: __types :: create_thread_and_run_request_without_stream :: model :: Gpt4_0613) , Gpt4_32k (crate :: __types :: create_thread_and_run_request_without_stream :: model :: Gpt4_32k) , Gpt4_32k0314 (crate :: __types :: create_thread_and_run_request_without_stream :: model :: Gpt4_32k0314) , Gpt4_32k0613 (crate :: __types :: create_thread_and_run_request_without_stream :: model :: Gpt4_32k0613) , Gpt3_5Turbo (crate :: __types :: create_thread_and_run_request_without_stream :: model :: Gpt3_5Turbo) , Gpt3_5Turbo16k (crate :: __types :: create_thread_and_run_request_without_stream :: model :: Gpt3_5Turbo16k) , Gpt3_5Turbo0613 (crate :: __types :: create_thread_and_run_request_without_stream :: model :: Gpt3_5Turbo0613) , Gpt3_5Turbo1106 (crate :: __types :: create_thread_and_run_request_without_stream :: model :: Gpt3_5Turbo1106) , Gpt3_5Turbo0125 (crate :: __types :: create_thread_and_run_request_without_stream :: model :: Gpt3_5Turbo0125) , Gpt3_5Turbo16k0613 (crate :: __types :: create_thread_and_run_request_without_stream :: model :: Gpt3_5Turbo16k0613) }
52871            match self {
52872                Self::Other(v) => Model::Other(v),
52873                Self::Gpt5 => Model::Gpt5(Default::default()),
52874                Self::Gpt5Mini => Model::Gpt5Mini(Default::default()),
52875                Self::Gpt5Nano => Model::Gpt5Nano(Default::default()),
52876                Self::Gpt5_2025_08_07 => Model::Gpt5_2025_08_07(Default::default()),
52877                Self::Gpt5Mini2025_08_07 => Model::Gpt5Mini2025_08_07(Default::default()),
52878                Self::Gpt5Nano2025_08_07 => Model::Gpt5Nano2025_08_07(Default::default()),
52879                Self::Gpt4_1 => Model::Gpt4_1(Default::default()),
52880                Self::Gpt4_1Mini => Model::Gpt4_1Mini(Default::default()),
52881                Self::Gpt4_1Nano => Model::Gpt4_1Nano(Default::default()),
52882                Self::Gpt4_1_2025_04_14 => Model::Gpt4_1_2025_04_14(Default::default()),
52883                Self::Gpt4_1Mini2025_04_14 => Model::Gpt4_1Mini2025_04_14(Default::default()),
52884                Self::Gpt4_1Nano2025_04_14 => Model::Gpt4_1Nano2025_04_14(Default::default()),
52885                Self::Gpt4o => Model::Gpt4o(Default::default()),
52886                Self::Gpt4o2024_11_20 => Model::Gpt4o2024_11_20(Default::default()),
52887                Self::Gpt4o2024_08_06 => Model::Gpt4o2024_08_06(Default::default()),
52888                Self::Gpt4o2024_05_13 => Model::Gpt4o2024_05_13(Default::default()),
52889                Self::Gpt4oMini => Model::Gpt4oMini(Default::default()),
52890                Self::Gpt4oMini2024_07_18 => Model::Gpt4oMini2024_07_18(Default::default()),
52891                Self::Gpt4_5Preview => Model::Gpt4_5Preview(Default::default()),
52892                Self::Gpt4_5Preview2025_02_27 => Model::Gpt4_5Preview2025_02_27(Default::default()),
52893                Self::Gpt4Turbo => Model::Gpt4Turbo(Default::default()),
52894                Self::Gpt4Turbo2024_04_09 => Model::Gpt4Turbo2024_04_09(Default::default()),
52895                Self::Gpt4_0125Preview => Model::Gpt4_0125Preview(Default::default()),
52896                Self::Gpt4TurboPreview => Model::Gpt4TurboPreview(Default::default()),
52897                Self::Gpt4_1106Preview => Model::Gpt4_1106Preview(Default::default()),
52898                Self::Gpt4VisionPreview => Model::Gpt4VisionPreview(Default::default()),
52899                Self::Gpt4 => Model::Gpt4(Default::default()),
52900                Self::Gpt4_0314 => Model::Gpt4_0314(Default::default()),
52901                Self::Gpt4_0613 => Model::Gpt4_0613(Default::default()),
52902                Self::Gpt4_32k => Model::Gpt4_32k(Default::default()),
52903                Self::Gpt4_32k0314 => Model::Gpt4_32k0314(Default::default()),
52904                Self::Gpt4_32k0613 => Model::Gpt4_32k0613(Default::default()),
52905                Self::Gpt3_5Turbo => Model::Gpt3_5Turbo(Default::default()),
52906                Self::Gpt3_5Turbo16k => Model::Gpt3_5Turbo16k(Default::default()),
52907                Self::Gpt3_5Turbo0613 => Model::Gpt3_5Turbo0613(Default::default()),
52908                Self::Gpt3_5Turbo1106 => Model::Gpt3_5Turbo1106(Default::default()),
52909                Self::Gpt3_5Turbo0125 => Model::Gpt3_5Turbo0125(Default::default()),
52910                Self::Gpt3_5Turbo16k0613 => Model::Gpt3_5Turbo16k0613(Default::default()),
52911            }
52912            .serialize(serializer)
52913        }
52914    }
52915    #[allow(clippy::module_inception)]
52916    pub mod tool_resources {
52917        #[derive(Clone, Debug, Default, PartialEq)]
52918        #[serde_with::serde_as]
52919        #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
52920        pub struct CodeInterpreter {
52921            #[doc = "A list of [file](https://platform.openai.com/docs/api-reference/files) IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool.\n"]
52922            #[serde(rename = "file_ids")]
52923            #[serde(skip_serializing_if = "Option::is_none")]
52924            #[builder(default)]
52925            pub file_ids: Option<Vec<String>>,
52926        }
52927        #[derive(Clone, Debug, Default, PartialEq)]
52928        #[serde_with::serde_as]
52929        #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
52930        pub struct FileSearch {
52931            #[doc = "The ID of the [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object) attached to this assistant. There can be a maximum of 1 vector store attached to the assistant.\n"]
52932            #[serde(rename = "vector_store_ids")]
52933            #[serde(skip_serializing_if = "Option::is_none")]
52934            #[builder(default)]
52935            pub vector_store_ids: Option<Vec<String>>,
52936        }
52937    }
52938    #[doc = "A set of resources that are used by the assistant's tools. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.\n"]
52939    #[derive(Clone, Debug, Default, PartialEq)]
52940    #[serde_with::serde_as]
52941    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
52942    pub struct ToolResources { # [serde (rename = "code_interpreter")] # [serde (skip_serializing_if = "Option::is_none")] # [builder (default)] pub code_interpreter : Option < crate :: __types :: create_thread_and_run_request_without_stream :: tool_resources :: CodeInterpreter > , # [serde (rename = "file_search")] # [serde (skip_serializing_if = "Option::is_none")] # [builder (default)] pub file_search : Option < crate :: __types :: create_thread_and_run_request_without_stream :: tool_resources :: FileSearch > }
52943}
52944#[derive(Clone, Debug, PartialEq)]
52945#[serde_with::serde_as]
52946#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
52947pub struct CreateThreadAndRunRequestWithoutStream {
52948    #[doc = "The ID of the [assistant](https://platform.openai.com/docs/api-reference/assistants) to use to execute this run."]
52949    #[serde(rename = "assistant_id")]
52950    pub assistant_id: String,
52951    #[serde(rename = "thread")]
52952    #[serde(skip_serializing_if = "Option::is_none")]
52953    #[builder(default)]
52954    pub thread: Option<crate::__types::CreateThreadRequest>,
52955    #[doc = "The ID of the [Model](https://platform.openai.com/docs/api-reference/models) to be used to execute this run. If a value is provided here, it will override the model associated with the assistant. If not, the model associated with the assistant will be used."]
52956    #[serde(rename = "model")]
52957    #[serde(skip_serializing_if = "Option::is_none")]
52958    #[builder(default)]
52959    pub model: Option<crate::__types::create_thread_and_run_request_without_stream::Model>,
52960    #[doc = "Override the default system message of the assistant. This is useful for modifying the behavior on a per-run basis."]
52961    #[serde(rename = "instructions")]
52962    #[serde(skip_serializing_if = "Option::is_none")]
52963    #[builder(default)]
52964    pub instructions: Option<String>,
52965    #[doc = "Override the tools the assistant can use for this run. This is useful for modifying the behavior on a per-run basis."]
52966    #[serde(rename = "tools")]
52967    #[serde(skip_serializing_if = "Option::is_none")]
52968    #[builder(default)]
52969    pub tools: Option<Vec<crate::__types::AssistantTool>>,
52970    #[doc = "A set of resources that are used by the assistant's tools. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.\n"]
52971    #[serde(rename = "tool_resources")]
52972    #[serde(skip_serializing_if = "Option::is_none")]
52973    #[builder(default)]
52974    pub tool_resources:
52975        Option<crate::__types::create_thread_and_run_request_without_stream::ToolResources>,
52976    #[serde(rename = "metadata")]
52977    #[serde(skip_serializing_if = "Option::is_none")]
52978    #[builder(default)]
52979    pub metadata: Option<crate::__types::Metadata>,
52980    #[doc = "What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.\n"]
52981    #[serde(rename = "temperature")]
52982    #[serde(skip_serializing_if = "Option::is_none")]
52983    #[builder(default)]
52984    pub temperature: Option<serde_json::Number>,
52985    #[doc = "An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.\n\nWe generally recommend altering this or temperature but not both.\n"]
52986    #[serde(rename = "top_p")]
52987    #[serde(skip_serializing_if = "Option::is_none")]
52988    #[builder(default)]
52989    pub top_p: Option<serde_json::Number>,
52990    #[doc = "The maximum number of prompt tokens that may be used over the course of the run. The run will make a best effort to use only the number of prompt tokens specified, across multiple turns of the run. If the run exceeds the number of prompt tokens specified, the run will end with status `incomplete`. See `incomplete_details` for more info.\n"]
52991    #[serde(rename = "max_prompt_tokens")]
52992    #[serde(skip_serializing_if = "Option::is_none")]
52993    #[builder(default)]
52994    pub max_prompt_tokens: Option<i64>,
52995    #[doc = "The maximum number of completion tokens that may be used over the course of the run. The run will make a best effort to use only the number of completion tokens specified, across multiple turns of the run. If the run exceeds the number of completion tokens specified, the run will end with status `incomplete`. See `incomplete_details` for more info.\n"]
52996    #[serde(rename = "max_completion_tokens")]
52997    #[serde(skip_serializing_if = "Option::is_none")]
52998    #[builder(default)]
52999    pub max_completion_tokens: Option<i64>,
53000    #[serde(rename = "truncation_strategy")]
53001    #[serde(skip_serializing_if = "Option::is_none")]
53002    #[builder(default)]
53003    pub truncation_strategy: Option<crate::__types::TruncationObject>,
53004    #[serde(rename = "tool_choice")]
53005    #[serde(skip_serializing_if = "Option::is_none")]
53006    #[builder(default)]
53007    pub tool_choice: Option<crate::__types::AssistantsApiToolChoiceOption>,
53008    #[serde(rename = "parallel_tool_calls")]
53009    #[serde(skip_serializing_if = "Option::is_none")]
53010    #[builder(default)]
53011    pub parallel_tool_calls: Option<crate::__types::ParallelToolCalls>,
53012    #[serde(rename = "response_format")]
53013    #[serde(skip_serializing_if = "Option::is_none")]
53014    #[builder(default)]
53015    pub response_format: Option<crate::__types::AssistantsApiResponseFormatOption>,
53016}
53017#[allow(clippy::module_inception)]
53018pub mod create_run_request_without_stream {
53019    #[doc = "The ID of the [Model](https://platform.openai.com/docs/api-reference/models) to be used to execute this run. If a value is provided here, it will override the model associated with the assistant. If not, the model associated with the assistant will be used."]
53020    #[derive(Clone, Debug, PartialEq)]
53021    #[allow(clippy::large_enum_variant)]
53022    pub enum Model {
53023        Other(String),
53024        AssistantSupportedModels(crate::__types::AssistantSupportedModels),
53025    }
53026    impl<'de> serde::Deserialize<'de> for Model {
53027        fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
53028        where
53029            D: serde::Deserializer<'de>,
53030        {
53031            #[serde_with::serde_as]
53032            #[derive(serde :: Deserialize)]
53033            #[serde(untagged)]
53034            #[allow(clippy::enum_variant_names, clippy::large_enum_variant)]
53035            enum Model {
53036                AssistantSupportedModels(crate::__types::AssistantSupportedModels),
53037                Other(String),
53038            }
53039            Ok(match Model::deserialize(deserializer)? {
53040                Model::Other(v) => Self::Other(v),
53041                Model::AssistantSupportedModels(v) => Self::AssistantSupportedModels(v),
53042            })
53043        }
53044    }
53045    impl serde::Serialize for Model {
53046        fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
53047        where
53048            S: serde::Serializer,
53049        {
53050            #[serde_with::serde_as]
53051            #[derive(serde :: Serialize)]
53052            #[serde(untagged)]
53053            #[allow(clippy::enum_variant_names)]
53054            enum Model<'a> {
53055                Other(&'a String),
53056                AssistantSupportedModels(&'a crate::__types::AssistantSupportedModels),
53057            }
53058            match self {
53059                Self::Other(v) => Model::Other(v),
53060                Self::AssistantSupportedModels(v) => Model::AssistantSupportedModels(v),
53061            }
53062            .serialize(serializer)
53063        }
53064    }
53065}
53066#[derive(Clone, Debug, PartialEq)]
53067#[serde_with::serde_as]
53068#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
53069pub struct CreateRunRequestWithoutStream {
53070    #[doc = "The ID of the [assistant](https://platform.openai.com/docs/api-reference/assistants) to use to execute this run."]
53071    #[serde(rename = "assistant_id")]
53072    pub assistant_id: String,
53073    #[doc = "The ID of the [Model](https://platform.openai.com/docs/api-reference/models) to be used to execute this run. If a value is provided here, it will override the model associated with the assistant. If not, the model associated with the assistant will be used."]
53074    #[serde(rename = "model")]
53075    #[serde(skip_serializing_if = "Option::is_none")]
53076    #[builder(default)]
53077    pub model: Option<crate::__types::create_run_request_without_stream::Model>,
53078    #[serde(rename = "reasoning_effort")]
53079    #[serde(skip_serializing_if = "Option::is_none")]
53080    #[builder(default)]
53081    pub reasoning_effort: Option<crate::__types::ReasoningEffort>,
53082    #[doc = "Overrides the [instructions](https://platform.openai.com/docs/api-reference/assistants/createAssistant) of the assistant. This is useful for modifying the behavior on a per-run basis."]
53083    #[serde(rename = "instructions")]
53084    #[serde(skip_serializing_if = "Option::is_none")]
53085    #[builder(default)]
53086    pub instructions: Option<String>,
53087    #[doc = "Appends additional instructions at the end of the instructions for the run. This is useful for modifying the behavior on a per-run basis without overriding other instructions."]
53088    #[serde(rename = "additional_instructions")]
53089    #[serde(skip_serializing_if = "Option::is_none")]
53090    #[builder(default)]
53091    pub additional_instructions: Option<String>,
53092    #[doc = "Adds additional messages to the thread before creating the run."]
53093    #[serde(rename = "additional_messages")]
53094    #[serde(skip_serializing_if = "Option::is_none")]
53095    #[builder(default)]
53096    pub additional_messages: Option<Vec<crate::__types::CreateMessageRequest>>,
53097    #[doc = "Override the tools the assistant can use for this run. This is useful for modifying the behavior on a per-run basis."]
53098    #[serde(rename = "tools")]
53099    #[serde(skip_serializing_if = "Option::is_none")]
53100    #[builder(default)]
53101    pub tools: Option<Vec<crate::__types::AssistantTool>>,
53102    #[serde(rename = "metadata")]
53103    #[serde(skip_serializing_if = "Option::is_none")]
53104    #[builder(default)]
53105    pub metadata: Option<crate::__types::Metadata>,
53106    #[doc = "What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.\n"]
53107    #[serde(rename = "temperature")]
53108    #[serde(skip_serializing_if = "Option::is_none")]
53109    #[builder(default)]
53110    pub temperature: Option<serde_json::Number>,
53111    #[doc = "An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.\n\nWe generally recommend altering this or temperature but not both.\n"]
53112    #[serde(rename = "top_p")]
53113    #[serde(skip_serializing_if = "Option::is_none")]
53114    #[builder(default)]
53115    pub top_p: Option<serde_json::Number>,
53116    #[doc = "The maximum number of prompt tokens that may be used over the course of the run. The run will make a best effort to use only the number of prompt tokens specified, across multiple turns of the run. If the run exceeds the number of prompt tokens specified, the run will end with status `incomplete`. See `incomplete_details` for more info.\n"]
53117    #[serde(rename = "max_prompt_tokens")]
53118    #[serde(skip_serializing_if = "Option::is_none")]
53119    #[builder(default)]
53120    pub max_prompt_tokens: Option<i64>,
53121    #[doc = "The maximum number of completion tokens that may be used over the course of the run. The run will make a best effort to use only the number of completion tokens specified, across multiple turns of the run. If the run exceeds the number of completion tokens specified, the run will end with status `incomplete`. See `incomplete_details` for more info.\n"]
53122    #[serde(rename = "max_completion_tokens")]
53123    #[serde(skip_serializing_if = "Option::is_none")]
53124    #[builder(default)]
53125    pub max_completion_tokens: Option<i64>,
53126    #[serde(rename = "truncation_strategy")]
53127    #[serde(skip_serializing_if = "Option::is_none")]
53128    #[builder(default)]
53129    pub truncation_strategy: Option<crate::__types::TruncationObject>,
53130    #[serde(rename = "tool_choice")]
53131    #[serde(skip_serializing_if = "Option::is_none")]
53132    #[builder(default)]
53133    pub tool_choice: Option<crate::__types::AssistantsApiToolChoiceOption>,
53134    #[serde(rename = "parallel_tool_calls")]
53135    #[serde(skip_serializing_if = "Option::is_none")]
53136    #[builder(default)]
53137    pub parallel_tool_calls: Option<crate::__types::ParallelToolCalls>,
53138    #[serde(rename = "response_format")]
53139    #[serde(skip_serializing_if = "Option::is_none")]
53140    #[builder(default)]
53141    pub response_format: Option<crate::__types::AssistantsApiResponseFormatOption>,
53142}
53143#[allow(clippy::module_inception)]
53144pub mod submit_tool_outputs_run_request_without_stream {
53145    #[allow(clippy::module_inception)]
53146    pub mod tool_outputs {
53147        #[derive(Clone, Debug, Default, PartialEq)]
53148        #[serde_with::serde_as]
53149        #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
53150        pub struct Item {
53151            #[doc = "The ID of the tool call in the `required_action` object within the run object the output is being submitted for."]
53152            #[serde(rename = "tool_call_id")]
53153            #[serde(skip_serializing_if = "Option::is_none")]
53154            #[builder(default)]
53155            pub tool_call_id: Option<String>,
53156            #[doc = "The output of the tool call to be submitted to continue the run."]
53157            #[serde(rename = "output")]
53158            #[serde(skip_serializing_if = "Option::is_none")]
53159            #[builder(default)]
53160            pub output: Option<String>,
53161        }
53162    }
53163}
53164#[derive(Clone, Debug, PartialEq)]
53165#[serde_with::serde_as]
53166#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
53167pub struct SubmitToolOutputsRunRequestWithoutStream {
53168    #[doc = "A list of tools for which the outputs are being submitted."]
53169    #[serde(rename = "tool_outputs")]
53170    pub tool_outputs:
53171        Vec<crate::__types::submit_tool_outputs_run_request_without_stream::tool_outputs::Item>,
53172}
53173#[doc = "The status of the run, which can be either `queued`, `in_progress`, `requires_action`, `cancelling`, `cancelled`, `failed`, `completed`, `incomplete`, or `expired`."]
53174#[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
53175pub enum RunStatus {
53176    #[doc = "`queued`"]
53177    #[serde(rename = "queued")]
53178    Queued,
53179    #[doc = "`in_progress`"]
53180    #[serde(rename = "in_progress")]
53181    InProgress,
53182    #[doc = "`requires_action`"]
53183    #[serde(rename = "requires_action")]
53184    RequiresAction,
53185    #[doc = "`cancelling`"]
53186    #[serde(rename = "cancelling")]
53187    Cancelling,
53188    #[doc = "`cancelled`"]
53189    #[serde(rename = "cancelled")]
53190    Cancelled,
53191    #[doc = "`failed`"]
53192    #[serde(rename = "failed")]
53193    Failed,
53194    #[doc = "`completed`"]
53195    #[serde(rename = "completed")]
53196    Completed,
53197    #[doc = "`incomplete`"]
53198    #[serde(rename = "incomplete")]
53199    Incomplete,
53200    #[doc = "`expired`"]
53201    #[serde(rename = "expired")]
53202    Expired,
53203}
53204#[allow(clippy::module_inception)]
53205pub mod run_step_delta_object_delta {
53206    #[doc = "The details of the run step."]
53207    #[derive(Clone, Debug, PartialEq)]
53208    #[serde_with::serde_as]
53209    #[derive(serde :: Deserialize, serde :: Serialize)]
53210    #[serde(untagged)]
53211    #[allow(clippy::large_enum_variant)]
53212    pub enum StepDetails {
53213        MessageCreation(crate::__types::RunStepDeltaStepDetailsMessageCreationObject),
53214        ToolCalls(crate::__types::RunStepDeltaStepDetailsToolCallsObject),
53215    }
53216}
53217#[doc = "The delta containing the fields that have changed on the run step."]
53218#[derive(Clone, Debug, Default, PartialEq)]
53219#[serde_with::serde_as]
53220#[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
53221pub struct RunStepDeltaObjectDelta {
53222    #[doc = "The details of the run step."]
53223    #[serde(rename = "step_details")]
53224    #[serde(skip_serializing_if = "Option::is_none")]
53225    #[builder(default)]
53226    pub step_details: Option<crate::__types::run_step_delta_object_delta::StepDetails>,
53227}
53228#[allow(clippy::module_inception)]
53229pub mod list_assistants {
53230    #[allow(clippy::module_inception)]
53231    pub mod params {
53232        #[doc = "Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order.\n"]
53233        #[derive(
53234            Clone, Copy, Debug, Default, PartialEq, serde :: Deserialize, serde :: Serialize,
53235        )]
53236        pub enum Order {
53237            #[doc = "`asc`"]
53238            #[serde(rename = "asc")]
53239            Asc,
53240            #[doc = "`desc`"]
53241            #[default]
53242            #[serde(rename = "desc")]
53243            Desc,
53244        }
53245    }
53246    #[derive(Clone, Debug, Default, PartialEq)]
53247    #[serde_with::serde_as]
53248    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
53249    pub struct Params {
53250        #[doc = "A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.\n"]
53251        #[serde(rename = "limit")]
53252        #[serde(skip_serializing_if = "Option::is_none")]
53253        #[builder(default)]
53254        pub limit: Option<i64>,
53255        #[doc = "Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order.\n"]
53256        #[serde(rename = "order")]
53257        #[serde(skip_serializing_if = "Option::is_none")]
53258        #[builder(default)]
53259        pub order: Option<crate::__types::list_assistants::params::Order>,
53260        #[doc = "A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.\n"]
53261        #[serde(rename = "after")]
53262        #[serde(skip_serializing_if = "Option::is_none")]
53263        #[builder(default)]
53264        pub after: Option<String>,
53265        #[doc = "A cursor for use in pagination. `before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.\n"]
53266        #[serde(rename = "before")]
53267        #[serde(skip_serializing_if = "Option::is_none")]
53268        #[builder(default)]
53269        pub before: Option<String>,
53270    }
53271}
53272#[allow(clippy::module_inception)]
53273pub mod get_assistant {
53274    #[derive(Clone, Debug, PartialEq)]
53275    #[serde_with::serde_as]
53276    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
53277    pub struct Params {
53278        #[doc = "The ID of the assistant to retrieve."]
53279        #[serde(rename = "assistant_id")]
53280        pub assistant_id: String,
53281    }
53282}
53283#[allow(clippy::module_inception)]
53284pub mod modify_assistant {
53285    #[derive(Clone, Debug, PartialEq)]
53286    #[serde_with::serde_as]
53287    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
53288    pub struct Params {
53289        #[doc = "The ID of the assistant to modify."]
53290        #[serde(rename = "assistant_id")]
53291        pub assistant_id: String,
53292    }
53293}
53294#[allow(clippy::module_inception)]
53295pub mod delete_assistant {
53296    #[derive(Clone, Debug, PartialEq)]
53297    #[serde_with::serde_as]
53298    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
53299    pub struct Params {
53300        #[doc = "The ID of the assistant to delete."]
53301        #[serde(rename = "assistant_id")]
53302        pub assistant_id: String,
53303    }
53304}
53305#[allow(clippy::module_inception)]
53306pub mod create_transcription {
53307    #[derive(Clone, Debug, PartialEq)]
53308    #[serde_with::serde_as]
53309    #[derive(serde :: Deserialize, serde :: Serialize)]
53310    #[serde(untagged)]
53311    #[allow(clippy::large_enum_variant)]
53312    pub enum Response {
53313        CreateTranscriptionResponseJson(crate::__types::CreateTranscriptionResponseJson),
53314        CreateTranscriptionResponseVerboseJson(
53315            crate::__types::CreateTranscriptionResponseVerboseJson,
53316        ),
53317    }
53318}
53319#[allow(clippy::module_inception)]
53320pub mod create_translation {
53321    #[derive(Clone, Debug, PartialEq)]
53322    #[serde_with::serde_as]
53323    #[derive(serde :: Deserialize, serde :: Serialize)]
53324    #[serde(untagged)]
53325    #[allow(clippy::large_enum_variant)]
53326    pub enum Response {
53327        CreateTranslationResponseJson(crate::__types::CreateTranslationResponseJson),
53328        CreateTranslationResponseVerboseJson(crate::__types::CreateTranslationResponseVerboseJson),
53329    }
53330}
53331#[allow(clippy::module_inception)]
53332pub mod create_batch {
53333    #[allow(clippy::module_inception)]
53334    pub mod request {
53335        #[doc = "The endpoint to be used for all requests in the batch. Currently `/v1/responses`, `/v1/chat/completions`, `/v1/embeddings`, and `/v1/completions` are supported. Note that `/v1/embeddings` batches are also restricted to a maximum of 50,000 embedding inputs across all requests in the batch."]
53336        #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
53337        pub enum Endpoint {
53338            #[doc = "`/v1/responses`"]
53339            #[serde(rename = "/v1/responses")]
53340            V1Responses,
53341            #[doc = "`/v1/chat/completions`"]
53342            #[serde(rename = "/v1/chat/completions")]
53343            V1ChatCompletions,
53344            #[doc = "`/v1/embeddings`"]
53345            #[serde(rename = "/v1/embeddings")]
53346            V1Embeddings,
53347            #[doc = "`/v1/completions`"]
53348            #[serde(rename = "/v1/completions")]
53349            V1Completions,
53350        }
53351        #[doc = "The time frame within which the batch should be processed. Currently only `24h` is supported."]
53352        #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
53353        pub enum CompletionWindow {
53354            #[doc = "`24h`"]
53355            #[serde(rename = "24h")]
53356            _24h,
53357        }
53358    }
53359    #[derive(Clone, Debug, PartialEq)]
53360    #[serde_with::serde_as]
53361    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
53362    pub struct Request {
53363        #[doc = "The ID of an uploaded file that contains requests for the new batch.\n\nSee [upload file](https://platform.openai.com/docs/api-reference/files/create) for how to upload a file.\n\nYour input file must be formatted as a [JSONL file](https://platform.openai.com/docs/api-reference/batch/request-input), and must be uploaded with the purpose `batch`. The file can contain up to 50,000 requests, and can be up to 200 MB in size.\n"]
53364        #[serde(rename = "input_file_id")]
53365        pub input_file_id: String,
53366        #[doc = "The endpoint to be used for all requests in the batch. Currently `/v1/responses`, `/v1/chat/completions`, `/v1/embeddings`, and `/v1/completions` are supported. Note that `/v1/embeddings` batches are also restricted to a maximum of 50,000 embedding inputs across all requests in the batch."]
53367        #[serde(rename = "endpoint")]
53368        pub endpoint: crate::__types::create_batch::request::Endpoint,
53369        #[doc = "The time frame within which the batch should be processed. Currently only `24h` is supported."]
53370        #[serde(rename = "completion_window")]
53371        pub completion_window: crate::__types::create_batch::request::CompletionWindow,
53372        #[serde(rename = "metadata")]
53373        #[serde(skip_serializing_if = "Option::is_none")]
53374        #[builder(default)]
53375        pub metadata: Option<crate::__types::Metadata>,
53376        #[serde(rename = "output_expires_after")]
53377        #[serde(skip_serializing_if = "Option::is_none")]
53378        #[builder(default)]
53379        pub output_expires_after: Option<crate::__types::BatchFileExpirationAfter>,
53380    }
53381}
53382#[allow(clippy::module_inception)]
53383pub mod list_batches {
53384    #[derive(Clone, Debug, Default, PartialEq)]
53385    #[serde_with::serde_as]
53386    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
53387    pub struct Params {
53388        #[doc = "A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.\n"]
53389        #[serde(rename = "after")]
53390        #[serde(skip_serializing_if = "Option::is_none")]
53391        #[builder(default)]
53392        pub after: Option<String>,
53393        #[doc = "A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.\n"]
53394        #[serde(rename = "limit")]
53395        #[serde(skip_serializing_if = "Option::is_none")]
53396        #[builder(default)]
53397        pub limit: Option<i64>,
53398    }
53399}
53400#[allow(clippy::module_inception)]
53401pub mod retrieve_batch {
53402    #[derive(Clone, Debug, PartialEq)]
53403    #[serde_with::serde_as]
53404    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
53405    pub struct Params {
53406        #[doc = "The ID of the batch to retrieve."]
53407        #[serde(rename = "batch_id")]
53408        pub batch_id: String,
53409    }
53410}
53411#[allow(clippy::module_inception)]
53412pub mod cancel_batch {
53413    #[derive(Clone, Debug, PartialEq)]
53414    #[serde_with::serde_as]
53415    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
53416    pub struct Params {
53417        #[doc = "The ID of the batch to cancel."]
53418        #[serde(rename = "batch_id")]
53419        pub batch_id: String,
53420    }
53421}
53422#[allow(clippy::module_inception)]
53423pub mod list_chat_completions {
53424    #[allow(clippy::module_inception)]
53425    pub mod params {
53426        #[doc = "Sort order for Chat Completions by timestamp. Use `asc` for ascending order or `desc` for descending order. Defaults to `asc`."]
53427        #[derive(
53428            Clone, Copy, Debug, Default, PartialEq, serde :: Deserialize, serde :: Serialize,
53429        )]
53430        pub enum Order {
53431            #[doc = "`asc`"]
53432            #[default]
53433            #[serde(rename = "asc")]
53434            Asc,
53435            #[doc = "`desc`"]
53436            #[serde(rename = "desc")]
53437            Desc,
53438        }
53439    }
53440    #[derive(Clone, Debug, Default, PartialEq)]
53441    #[serde_with::serde_as]
53442    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
53443    pub struct Params {
53444        #[doc = "The model used to generate the Chat Completions."]
53445        #[serde(rename = "model")]
53446        #[serde(skip_serializing_if = "Option::is_none")]
53447        #[builder(default)]
53448        pub model: Option<String>,
53449        #[doc = "A list of metadata keys to filter the Chat Completions by. Example:\n\n`metadata[key1]=value1&metadata[key2]=value2`\n"]
53450        #[serde(rename = "metadata")]
53451        #[serde(skip_serializing_if = "Option::is_none")]
53452        #[builder(default)]
53453        pub metadata: Option<crate::__types::Metadata>,
53454        #[doc = "Identifier for the last chat completion from the previous pagination request."]
53455        #[serde(rename = "after")]
53456        #[serde(skip_serializing_if = "Option::is_none")]
53457        #[builder(default)]
53458        pub after: Option<String>,
53459        #[doc = "Number of Chat Completions to retrieve."]
53460        #[serde(rename = "limit")]
53461        #[serde(skip_serializing_if = "Option::is_none")]
53462        #[builder(default)]
53463        pub limit: Option<i64>,
53464        #[doc = "Sort order for Chat Completions by timestamp. Use `asc` for ascending order or `desc` for descending order. Defaults to `asc`."]
53465        #[serde(rename = "order")]
53466        #[serde(skip_serializing_if = "Option::is_none")]
53467        #[builder(default)]
53468        pub order: Option<crate::__types::list_chat_completions::params::Order>,
53469    }
53470}
53471#[allow(clippy::module_inception)]
53472pub mod get_chat_completion {
53473    #[derive(Clone, Debug, PartialEq)]
53474    #[serde_with::serde_as]
53475    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
53476    pub struct Params {
53477        #[doc = "The ID of the chat completion to retrieve."]
53478        #[serde(rename = "completion_id")]
53479        pub completion_id: String,
53480    }
53481}
53482#[allow(clippy::module_inception)]
53483pub mod update_chat_completion {
53484    #[derive(Clone, Debug, PartialEq)]
53485    #[serde_with::serde_as]
53486    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
53487    pub struct Params {
53488        #[doc = "The ID of the chat completion to update."]
53489        #[serde(rename = "completion_id")]
53490        pub completion_id: String,
53491    }
53492    #[derive(Clone, Debug, PartialEq)]
53493    #[serde_with::serde_as]
53494    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
53495    pub struct Request {
53496        #[serde(rename = "metadata")]
53497        #[serde(skip_serializing_if = "Option::is_none")]
53498        #[builder(default)]
53499        pub metadata: Option<crate::__types::Metadata>,
53500    }
53501}
53502#[allow(clippy::module_inception)]
53503pub mod delete_chat_completion {
53504    #[derive(Clone, Debug, PartialEq)]
53505    #[serde_with::serde_as]
53506    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
53507    pub struct Params {
53508        #[doc = "The ID of the chat completion to delete."]
53509        #[serde(rename = "completion_id")]
53510        pub completion_id: String,
53511    }
53512}
53513#[allow(clippy::module_inception)]
53514pub mod get_chat_completion_messages {
53515    #[allow(clippy::module_inception)]
53516    pub mod params {
53517        #[doc = "Sort order for messages by timestamp. Use `asc` for ascending order or `desc` for descending order. Defaults to `asc`."]
53518        #[derive(
53519            Clone, Copy, Debug, Default, PartialEq, serde :: Deserialize, serde :: Serialize,
53520        )]
53521        pub enum Order {
53522            #[doc = "`asc`"]
53523            #[default]
53524            #[serde(rename = "asc")]
53525            Asc,
53526            #[doc = "`desc`"]
53527            #[serde(rename = "desc")]
53528            Desc,
53529        }
53530    }
53531    #[derive(Clone, Debug, PartialEq)]
53532    #[serde_with::serde_as]
53533    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
53534    pub struct Params {
53535        #[doc = "The ID of the chat completion to retrieve messages from."]
53536        #[serde(rename = "completion_id")]
53537        pub completion_id: String,
53538        #[doc = "Identifier for the last message from the previous pagination request."]
53539        #[serde(rename = "after")]
53540        #[serde(skip_serializing_if = "Option::is_none")]
53541        #[builder(default)]
53542        pub after: Option<String>,
53543        #[doc = "Number of messages to retrieve."]
53544        #[serde(rename = "limit")]
53545        #[serde(skip_serializing_if = "Option::is_none")]
53546        #[builder(default)]
53547        pub limit: Option<i64>,
53548        #[doc = "Sort order for messages by timestamp. Use `asc` for ascending order or `desc` for descending order. Defaults to `asc`."]
53549        #[serde(rename = "order")]
53550        #[serde(skip_serializing_if = "Option::is_none")]
53551        #[builder(default)]
53552        pub order: Option<crate::__types::get_chat_completion_messages::params::Order>,
53553    }
53554}
53555#[allow(clippy::module_inception)]
53556pub mod list_containers {
53557    #[allow(clippy::module_inception)]
53558    pub mod params {
53559        #[doc = "Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order.\n"]
53560        #[derive(
53561            Clone, Copy, Debug, Default, PartialEq, serde :: Deserialize, serde :: Serialize,
53562        )]
53563        pub enum Order {
53564            #[doc = "`asc`"]
53565            #[serde(rename = "asc")]
53566            Asc,
53567            #[doc = "`desc`"]
53568            #[default]
53569            #[serde(rename = "desc")]
53570            Desc,
53571        }
53572    }
53573    #[derive(Clone, Debug, Default, PartialEq)]
53574    #[serde_with::serde_as]
53575    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
53576    pub struct Params {
53577        #[doc = "A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.\n"]
53578        #[serde(rename = "limit")]
53579        #[serde(skip_serializing_if = "Option::is_none")]
53580        #[builder(default)]
53581        pub limit: Option<i64>,
53582        #[doc = "Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order.\n"]
53583        #[serde(rename = "order")]
53584        #[serde(skip_serializing_if = "Option::is_none")]
53585        #[builder(default)]
53586        pub order: Option<crate::__types::list_containers::params::Order>,
53587        #[doc = "A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.\n"]
53588        #[serde(rename = "after")]
53589        #[serde(skip_serializing_if = "Option::is_none")]
53590        #[builder(default)]
53591        pub after: Option<String>,
53592    }
53593}
53594#[allow(clippy::module_inception)]
53595pub mod create_container {
53596    #[derive(Clone, Copy, Debug, Default, PartialEq)]
53597    #[serde_with::serde_as]
53598    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
53599    pub struct Params {}
53600}
53601#[allow(clippy::module_inception)]
53602pub mod retrieve_container {
53603    #[derive(Clone, Debug, PartialEq)]
53604    #[serde_with::serde_as]
53605    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
53606    pub struct Params {
53607        #[serde(rename = "container_id")]
53608        pub container_id: String,
53609    }
53610}
53611#[allow(clippy::module_inception)]
53612pub mod delete_container {
53613    #[derive(Clone, Debug, PartialEq)]
53614    #[serde_with::serde_as]
53615    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
53616    pub struct Params {
53617        #[doc = "The ID of the container to delete."]
53618        #[serde(rename = "container_id")]
53619        pub container_id: String,
53620    }
53621}
53622#[allow(clippy::module_inception)]
53623pub mod create_container_file {
53624    #[derive(Clone, Debug, PartialEq)]
53625    #[serde_with::serde_as]
53626    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
53627    pub struct Params {
53628        #[serde(rename = "container_id")]
53629        pub container_id: String,
53630    }
53631}
53632#[allow(clippy::module_inception)]
53633pub mod list_container_files {
53634    #[allow(clippy::module_inception)]
53635    pub mod params {
53636        #[doc = "Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order.\n"]
53637        #[derive(
53638            Clone, Copy, Debug, Default, PartialEq, serde :: Deserialize, serde :: Serialize,
53639        )]
53640        pub enum Order {
53641            #[doc = "`asc`"]
53642            #[serde(rename = "asc")]
53643            Asc,
53644            #[doc = "`desc`"]
53645            #[default]
53646            #[serde(rename = "desc")]
53647            Desc,
53648        }
53649    }
53650    #[derive(Clone, Debug, PartialEq)]
53651    #[serde_with::serde_as]
53652    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
53653    pub struct Params {
53654        #[serde(rename = "container_id")]
53655        pub container_id: String,
53656        #[doc = "A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.\n"]
53657        #[serde(rename = "limit")]
53658        #[serde(skip_serializing_if = "Option::is_none")]
53659        #[builder(default)]
53660        pub limit: Option<i64>,
53661        #[doc = "Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order.\n"]
53662        #[serde(rename = "order")]
53663        #[serde(skip_serializing_if = "Option::is_none")]
53664        #[builder(default)]
53665        pub order: Option<crate::__types::list_container_files::params::Order>,
53666        #[doc = "A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.\n"]
53667        #[serde(rename = "after")]
53668        #[serde(skip_serializing_if = "Option::is_none")]
53669        #[builder(default)]
53670        pub after: Option<String>,
53671    }
53672}
53673#[allow(clippy::module_inception)]
53674pub mod retrieve_container_file {
53675    #[derive(Clone, Debug, PartialEq)]
53676    #[serde_with::serde_as]
53677    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
53678    pub struct Params {
53679        #[serde(rename = "container_id")]
53680        pub container_id: String,
53681        #[serde(rename = "file_id")]
53682        pub file_id: String,
53683    }
53684}
53685#[allow(clippy::module_inception)]
53686pub mod delete_container_file {
53687    #[derive(Clone, Debug, PartialEq)]
53688    #[serde_with::serde_as]
53689    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
53690    pub struct Params {
53691        #[serde(rename = "container_id")]
53692        pub container_id: String,
53693        #[serde(rename = "file_id")]
53694        pub file_id: String,
53695    }
53696}
53697#[allow(clippy::module_inception)]
53698pub mod retrieve_container_file_content {
53699    #[derive(Clone, Debug, PartialEq)]
53700    #[serde_with::serde_as]
53701    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
53702    pub struct Params {
53703        #[serde(rename = "container_id")]
53704        pub container_id: String,
53705        #[serde(rename = "file_id")]
53706        pub file_id: String,
53707    }
53708}
53709#[allow(clippy::module_inception)]
53710pub mod get_conversation {
53711    #[derive(Clone, Debug, PartialEq)]
53712    #[serde_with::serde_as]
53713    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
53714    pub struct Params {
53715        #[doc = "The ID of the conversation to retrieve."]
53716        #[serde(rename = "conversation_id")]
53717        pub conversation_id: String,
53718    }
53719}
53720#[allow(clippy::module_inception)]
53721pub mod update_conversation {
53722    #[derive(Clone, Debug, PartialEq)]
53723    #[serde_with::serde_as]
53724    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
53725    pub struct Params {
53726        #[doc = "The ID of the conversation to update."]
53727        #[serde(rename = "conversation_id")]
53728        pub conversation_id: String,
53729    }
53730}
53731#[allow(clippy::module_inception)]
53732pub mod delete_conversation {
53733    #[derive(Clone, Debug, PartialEq)]
53734    #[serde_with::serde_as]
53735    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
53736    pub struct Params {
53737        #[doc = "The ID of the conversation to delete."]
53738        #[serde(rename = "conversation_id")]
53739        pub conversation_id: String,
53740    }
53741}
53742#[allow(clippy::module_inception)]
53743pub mod create_conversation_items {
53744    #[derive(Clone, Debug, PartialEq)]
53745    #[serde_with::serde_as]
53746    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
53747    pub struct Params {
53748        #[doc = "The ID of the conversation to add the item to."]
53749        #[serde(rename = "conversation_id")]
53750        pub conversation_id: String,
53751        #[doc = "Additional fields to include in the response. See the `include`\nparameter for [listing Conversation items above](https://platform.openai.com/docs/api-reference/conversations/list-items#conversations_list_items-include) for more information.\n"]
53752        #[serde(rename = "include")]
53753        #[serde(skip_serializing_if = "Option::is_none")]
53754        #[builder(default)]
53755        pub include: Option<Vec<crate::__types::Includable>>,
53756    }
53757    #[derive(Clone, Debug, PartialEq)]
53758    #[serde_with::serde_as]
53759    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
53760    pub struct Request {
53761        #[doc = "The items to add to the conversation. You may add up to 20 items at a time.\n"]
53762        #[serde(rename = "items")]
53763        pub items: Vec<crate::__types::InputItem>,
53764    }
53765}
53766#[allow(clippy::module_inception)]
53767pub mod list_conversation_items {
53768    #[allow(clippy::module_inception)]
53769    pub mod params {
53770        #[doc = "The order to return the input items in. Default is `desc`.\n- `asc`: Return the input items in ascending order.\n- `desc`: Return the input items in descending order.\n"]
53771        #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
53772        pub enum Order {
53773            #[doc = "`asc`"]
53774            #[serde(rename = "asc")]
53775            Asc,
53776            #[doc = "`desc`"]
53777            #[serde(rename = "desc")]
53778            Desc,
53779        }
53780    }
53781    #[derive(Clone, Debug, PartialEq)]
53782    #[serde_with::serde_as]
53783    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
53784    pub struct Params {
53785        #[doc = "The ID of the conversation to list items for."]
53786        #[serde(rename = "conversation_id")]
53787        pub conversation_id: String,
53788        #[doc = "A limit on the number of objects to be returned. Limit can range between\n1 and 100, and the default is 20.\n"]
53789        #[serde(rename = "limit")]
53790        #[serde(skip_serializing_if = "Option::is_none")]
53791        #[builder(default)]
53792        pub limit: Option<i64>,
53793        #[doc = "The order to return the input items in. Default is `desc`.\n- `asc`: Return the input items in ascending order.\n- `desc`: Return the input items in descending order.\n"]
53794        #[serde(rename = "order")]
53795        #[serde(skip_serializing_if = "Option::is_none")]
53796        #[builder(default)]
53797        pub order: Option<crate::__types::list_conversation_items::params::Order>,
53798        #[doc = "An item ID to list items after, used in pagination.\n"]
53799        #[serde(rename = "after")]
53800        #[serde(skip_serializing_if = "Option::is_none")]
53801        #[builder(default)]
53802        pub after: Option<String>,
53803        #[doc = "Specify additional output data to include in the model response. Currently\nsupported values are:\n- `code_interpreter_call.outputs`: Includes the outputs of python code execution\n  in code interpreter tool call items.\n- `computer_call_output.output.image_url`: Include image urls from the computer call output.\n- `file_search_call.results`: Include the search results of\n  the file search tool call.\n- `message.input_image.image_url`: Include image urls from the input message.\n- `message.output_text.logprobs`: Include logprobs with assistant messages.\n- `reasoning.encrypted_content`: Includes an encrypted version of reasoning\n  tokens in reasoning item outputs. This enables reasoning items to be used in\n  multi-turn conversations when using the Responses API statelessly (like\n  when the `store` parameter is set to `false`, or when an organization is\n  enrolled in the zero data retention program).\n"]
53804        #[serde(rename = "include")]
53805        #[serde(skip_serializing_if = "Option::is_none")]
53806        #[builder(default)]
53807        pub include: Option<Vec<crate::__types::Includable>>,
53808    }
53809}
53810#[allow(clippy::module_inception)]
53811pub mod get_conversation_item {
53812    #[derive(Clone, Debug, PartialEq)]
53813    #[serde_with::serde_as]
53814    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
53815    pub struct Params {
53816        #[doc = "The ID of the conversation that contains the item."]
53817        #[serde(rename = "conversation_id")]
53818        pub conversation_id: String,
53819        #[doc = "The ID of the item to retrieve."]
53820        #[serde(rename = "item_id")]
53821        pub item_id: String,
53822        #[doc = "Additional fields to include in the response. See the `include`\nparameter for [listing Conversation items above](https://platform.openai.com/docs/api-reference/conversations/list-items#conversations_list_items-include) for more information.\n"]
53823        #[serde(rename = "include")]
53824        #[serde(skip_serializing_if = "Option::is_none")]
53825        #[builder(default)]
53826        pub include: Option<Vec<crate::__types::Includable>>,
53827    }
53828}
53829#[allow(clippy::module_inception)]
53830pub mod delete_conversation_item {
53831    #[derive(Clone, Debug, PartialEq)]
53832    #[serde_with::serde_as]
53833    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
53834    pub struct Params {
53835        #[doc = "The ID of the conversation that contains the item."]
53836        #[serde(rename = "conversation_id")]
53837        pub conversation_id: String,
53838        #[doc = "The ID of the item to delete."]
53839        #[serde(rename = "item_id")]
53840        pub item_id: String,
53841    }
53842}
53843#[allow(clippy::module_inception)]
53844pub mod list_evals {
53845    #[allow(clippy::module_inception)]
53846    pub mod params {
53847        #[doc = "Sort order for evals by timestamp. Use `asc` for ascending order or `desc` for descending order."]
53848        #[derive(
53849            Clone, Copy, Debug, Default, PartialEq, serde :: Deserialize, serde :: Serialize,
53850        )]
53851        pub enum Order {
53852            #[doc = "`asc`"]
53853            #[default]
53854            #[serde(rename = "asc")]
53855            Asc,
53856            #[doc = "`desc`"]
53857            #[serde(rename = "desc")]
53858            Desc,
53859        }
53860        #[doc = "Evals can be ordered by creation time or last updated time. Use\n`created_at` for creation time or `updated_at` for last updated time.\n"]
53861        #[derive(
53862            Clone, Copy, Debug, Default, PartialEq, serde :: Deserialize, serde :: Serialize,
53863        )]
53864        pub enum OrderBy {
53865            #[doc = "`created_at`"]
53866            #[default]
53867            #[serde(rename = "created_at")]
53868            CreatedAt,
53869            #[doc = "`updated_at`"]
53870            #[serde(rename = "updated_at")]
53871            UpdatedAt,
53872        }
53873    }
53874    #[derive(Clone, Debug, Default, PartialEq)]
53875    #[serde_with::serde_as]
53876    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
53877    pub struct Params {
53878        #[doc = "Identifier for the last eval from the previous pagination request."]
53879        #[serde(rename = "after")]
53880        #[serde(skip_serializing_if = "Option::is_none")]
53881        #[builder(default)]
53882        pub after: Option<String>,
53883        #[doc = "Number of evals to retrieve."]
53884        #[serde(rename = "limit")]
53885        #[serde(skip_serializing_if = "Option::is_none")]
53886        #[builder(default)]
53887        pub limit: Option<i64>,
53888        #[doc = "Sort order for evals by timestamp. Use `asc` for ascending order or `desc` for descending order."]
53889        #[serde(rename = "order")]
53890        #[serde(skip_serializing_if = "Option::is_none")]
53891        #[builder(default)]
53892        pub order: Option<crate::__types::list_evals::params::Order>,
53893        #[doc = "Evals can be ordered by creation time or last updated time. Use\n`created_at` for creation time or `updated_at` for last updated time.\n"]
53894        #[serde(rename = "order_by")]
53895        #[serde(skip_serializing_if = "Option::is_none")]
53896        #[builder(default)]
53897        pub order_by: Option<crate::__types::list_evals::params::OrderBy>,
53898    }
53899}
53900#[allow(clippy::module_inception)]
53901pub mod get_eval {
53902    #[derive(Clone, Debug, PartialEq)]
53903    #[serde_with::serde_as]
53904    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
53905    pub struct Params {
53906        #[doc = "The ID of the evaluation to retrieve."]
53907        #[serde(rename = "eval_id")]
53908        pub eval_id: String,
53909    }
53910}
53911#[allow(clippy::module_inception)]
53912pub mod update_eval {
53913    #[derive(Clone, Debug, PartialEq)]
53914    #[serde_with::serde_as]
53915    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
53916    pub struct Params {
53917        #[doc = "The ID of the evaluation to update."]
53918        #[serde(rename = "eval_id")]
53919        pub eval_id: String,
53920    }
53921    #[derive(Clone, Debug, Default, PartialEq)]
53922    #[serde_with::serde_as]
53923    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
53924    pub struct Request {
53925        #[doc = "Rename the evaluation."]
53926        #[serde(rename = "name")]
53927        #[serde(skip_serializing_if = "Option::is_none")]
53928        #[builder(default)]
53929        pub name: Option<String>,
53930        #[serde(rename = "metadata")]
53931        #[serde(skip_serializing_if = "Option::is_none")]
53932        #[builder(default)]
53933        pub metadata: Option<crate::__types::Metadata>,
53934    }
53935}
53936#[allow(clippy::module_inception)]
53937pub mod delete_eval {
53938    #[derive(Clone, Debug, PartialEq)]
53939    #[serde_with::serde_as]
53940    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
53941    pub struct Params {
53942        #[doc = "The ID of the evaluation to delete."]
53943        #[serde(rename = "eval_id")]
53944        pub eval_id: String,
53945    }
53946    #[derive(Clone, Debug, PartialEq)]
53947    #[serde_with::serde_as]
53948    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
53949    pub struct Response {
53950        #[serde(rename = "object")]
53951        pub object: String,
53952        #[serde(rename = "deleted")]
53953        pub deleted: bool,
53954        #[serde(rename = "eval_id")]
53955        pub eval_id: String,
53956    }
53957}
53958#[allow(clippy::module_inception)]
53959pub mod get_eval_runs {
53960    #[allow(clippy::module_inception)]
53961    pub mod params {
53962        #[doc = "Sort order for runs by timestamp. Use `asc` for ascending order or `desc` for descending order. Defaults to `asc`."]
53963        #[derive(
53964            Clone, Copy, Debug, Default, PartialEq, serde :: Deserialize, serde :: Serialize,
53965        )]
53966        pub enum Order {
53967            #[doc = "`asc`"]
53968            #[default]
53969            #[serde(rename = "asc")]
53970            Asc,
53971            #[doc = "`desc`"]
53972            #[serde(rename = "desc")]
53973            Desc,
53974        }
53975        #[doc = "Filter runs by status. One of `queued` | `in_progress` | `failed` | `completed` | `canceled`."]
53976        #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
53977        pub enum Status {
53978            #[doc = "`queued`"]
53979            #[serde(rename = "queued")]
53980            Queued,
53981            #[doc = "`in_progress`"]
53982            #[serde(rename = "in_progress")]
53983            InProgress,
53984            #[doc = "`completed`"]
53985            #[serde(rename = "completed")]
53986            Completed,
53987            #[doc = "`canceled`"]
53988            #[serde(rename = "canceled")]
53989            Canceled,
53990            #[doc = "`failed`"]
53991            #[serde(rename = "failed")]
53992            Failed,
53993        }
53994    }
53995    #[derive(Clone, Debug, PartialEq)]
53996    #[serde_with::serde_as]
53997    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
53998    pub struct Params {
53999        #[doc = "The ID of the evaluation to retrieve runs for."]
54000        #[serde(rename = "eval_id")]
54001        pub eval_id: String,
54002        #[doc = "Identifier for the last run from the previous pagination request."]
54003        #[serde(rename = "after")]
54004        #[serde(skip_serializing_if = "Option::is_none")]
54005        #[builder(default)]
54006        pub after: Option<String>,
54007        #[doc = "Number of runs to retrieve."]
54008        #[serde(rename = "limit")]
54009        #[serde(skip_serializing_if = "Option::is_none")]
54010        #[builder(default)]
54011        pub limit: Option<i64>,
54012        #[doc = "Sort order for runs by timestamp. Use `asc` for ascending order or `desc` for descending order. Defaults to `asc`."]
54013        #[serde(rename = "order")]
54014        #[serde(skip_serializing_if = "Option::is_none")]
54015        #[builder(default)]
54016        pub order: Option<crate::__types::get_eval_runs::params::Order>,
54017        #[doc = "Filter runs by status. One of `queued` | `in_progress` | `failed` | `completed` | `canceled`."]
54018        #[serde(rename = "status")]
54019        #[serde(skip_serializing_if = "Option::is_none")]
54020        #[builder(default)]
54021        pub status: Option<crate::__types::get_eval_runs::params::Status>,
54022    }
54023}
54024#[allow(clippy::module_inception)]
54025pub mod create_eval_run {
54026    #[derive(Clone, Debug, PartialEq)]
54027    #[serde_with::serde_as]
54028    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
54029    pub struct Params {
54030        #[doc = "The ID of the evaluation to create a run for."]
54031        #[serde(rename = "eval_id")]
54032        pub eval_id: String,
54033    }
54034}
54035#[allow(clippy::module_inception)]
54036pub mod get_eval_run {
54037    #[derive(Clone, Debug, PartialEq)]
54038    #[serde_with::serde_as]
54039    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
54040    pub struct Params {
54041        #[doc = "The ID of the evaluation to retrieve runs for."]
54042        #[serde(rename = "eval_id")]
54043        pub eval_id: String,
54044        #[doc = "The ID of the run to retrieve."]
54045        #[serde(rename = "run_id")]
54046        pub run_id: String,
54047    }
54048}
54049#[allow(clippy::module_inception)]
54050pub mod cancel_eval_run {
54051    #[derive(Clone, Debug, PartialEq)]
54052    #[serde_with::serde_as]
54053    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
54054    pub struct Params {
54055        #[doc = "The ID of the evaluation whose run you want to cancel."]
54056        #[serde(rename = "eval_id")]
54057        pub eval_id: String,
54058        #[doc = "The ID of the run to cancel."]
54059        #[serde(rename = "run_id")]
54060        pub run_id: String,
54061    }
54062}
54063#[allow(clippy::module_inception)]
54064pub mod delete_eval_run {
54065    #[derive(Clone, Debug, PartialEq)]
54066    #[serde_with::serde_as]
54067    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
54068    pub struct Params {
54069        #[doc = "The ID of the evaluation to delete the run from."]
54070        #[serde(rename = "eval_id")]
54071        pub eval_id: String,
54072        #[doc = "The ID of the run to delete."]
54073        #[serde(rename = "run_id")]
54074        pub run_id: String,
54075    }
54076    #[derive(Clone, Debug, Default, PartialEq)]
54077    #[serde_with::serde_as]
54078    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
54079    pub struct Response {
54080        #[serde(rename = "object")]
54081        #[serde(skip_serializing_if = "Option::is_none")]
54082        #[builder(default)]
54083        pub object: Option<String>,
54084        #[serde(rename = "deleted")]
54085        #[serde(skip_serializing_if = "Option::is_none")]
54086        #[builder(default)]
54087        pub deleted: Option<bool>,
54088        #[serde(rename = "run_id")]
54089        #[serde(skip_serializing_if = "Option::is_none")]
54090        #[builder(default)]
54091        pub run_id: Option<String>,
54092    }
54093}
54094#[allow(clippy::module_inception)]
54095pub mod get_eval_run_output_items {
54096    #[allow(clippy::module_inception)]
54097    pub mod params {
54098        #[doc = "Filter output items by status. Use `failed` to filter by failed output\nitems or `pass` to filter by passed output items.\n"]
54099        #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
54100        pub enum Status {
54101            #[doc = "`fail`"]
54102            #[serde(rename = "fail")]
54103            Fail,
54104            #[doc = "`pass`"]
54105            #[serde(rename = "pass")]
54106            Pass,
54107        }
54108        #[doc = "Sort order for output items by timestamp. Use `asc` for ascending order or `desc` for descending order. Defaults to `asc`."]
54109        #[derive(
54110            Clone, Copy, Debug, Default, PartialEq, serde :: Deserialize, serde :: Serialize,
54111        )]
54112        pub enum Order {
54113            #[doc = "`asc`"]
54114            #[default]
54115            #[serde(rename = "asc")]
54116            Asc,
54117            #[doc = "`desc`"]
54118            #[serde(rename = "desc")]
54119            Desc,
54120        }
54121    }
54122    #[derive(Clone, Debug, PartialEq)]
54123    #[serde_with::serde_as]
54124    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
54125    pub struct Params {
54126        #[doc = "The ID of the evaluation to retrieve runs for."]
54127        #[serde(rename = "eval_id")]
54128        pub eval_id: String,
54129        #[doc = "The ID of the run to retrieve output items for."]
54130        #[serde(rename = "run_id")]
54131        pub run_id: String,
54132        #[doc = "Identifier for the last output item from the previous pagination request."]
54133        #[serde(rename = "after")]
54134        #[serde(skip_serializing_if = "Option::is_none")]
54135        #[builder(default)]
54136        pub after: Option<String>,
54137        #[doc = "Number of output items to retrieve."]
54138        #[serde(rename = "limit")]
54139        #[serde(skip_serializing_if = "Option::is_none")]
54140        #[builder(default)]
54141        pub limit: Option<i64>,
54142        #[doc = "Filter output items by status. Use `failed` to filter by failed output\nitems or `pass` to filter by passed output items.\n"]
54143        #[serde(rename = "status")]
54144        #[serde(skip_serializing_if = "Option::is_none")]
54145        #[builder(default)]
54146        pub status: Option<crate::__types::get_eval_run_output_items::params::Status>,
54147        #[doc = "Sort order for output items by timestamp. Use `asc` for ascending order or `desc` for descending order. Defaults to `asc`."]
54148        #[serde(rename = "order")]
54149        #[serde(skip_serializing_if = "Option::is_none")]
54150        #[builder(default)]
54151        pub order: Option<crate::__types::get_eval_run_output_items::params::Order>,
54152    }
54153}
54154#[allow(clippy::module_inception)]
54155pub mod get_eval_run_output_item {
54156    #[derive(Clone, Debug, PartialEq)]
54157    #[serde_with::serde_as]
54158    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
54159    pub struct Params {
54160        #[doc = "The ID of the evaluation to retrieve runs for."]
54161        #[serde(rename = "eval_id")]
54162        pub eval_id: String,
54163        #[doc = "The ID of the run to retrieve."]
54164        #[serde(rename = "run_id")]
54165        pub run_id: String,
54166        #[doc = "The ID of the output item to retrieve."]
54167        #[serde(rename = "output_item_id")]
54168        pub output_item_id: String,
54169    }
54170}
54171#[allow(clippy::module_inception)]
54172pub mod list_files {
54173    #[allow(clippy::module_inception)]
54174    pub mod params {
54175        #[doc = "Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order.\n"]
54176        #[derive(
54177            Clone, Copy, Debug, Default, PartialEq, serde :: Deserialize, serde :: Serialize,
54178        )]
54179        pub enum Order {
54180            #[doc = "`asc`"]
54181            #[serde(rename = "asc")]
54182            Asc,
54183            #[doc = "`desc`"]
54184            #[default]
54185            #[serde(rename = "desc")]
54186            Desc,
54187        }
54188    }
54189    #[derive(Clone, Debug, Default, PartialEq)]
54190    #[serde_with::serde_as]
54191    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
54192    pub struct Params {
54193        #[doc = "Only return files with the given purpose."]
54194        #[serde(rename = "purpose")]
54195        #[serde(skip_serializing_if = "Option::is_none")]
54196        #[builder(default)]
54197        pub purpose: Option<String>,
54198        #[doc = "A limit on the number of objects to be returned. Limit can range between 1 and 10,000, and the default is 10,000.\n"]
54199        #[serde(rename = "limit")]
54200        #[serde(skip_serializing_if = "Option::is_none")]
54201        #[builder(default)]
54202        pub limit: Option<i64>,
54203        #[doc = "Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order.\n"]
54204        #[serde(rename = "order")]
54205        #[serde(skip_serializing_if = "Option::is_none")]
54206        #[builder(default)]
54207        pub order: Option<crate::__types::list_files::params::Order>,
54208        #[doc = "A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.\n"]
54209        #[serde(rename = "after")]
54210        #[serde(skip_serializing_if = "Option::is_none")]
54211        #[builder(default)]
54212        pub after: Option<String>,
54213    }
54214}
54215#[allow(clippy::module_inception)]
54216pub mod delete_file {
54217    #[derive(Clone, Debug, PartialEq)]
54218    #[serde_with::serde_as]
54219    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
54220    pub struct Params {
54221        #[doc = "The ID of the file to use for this request."]
54222        #[serde(rename = "file_id")]
54223        pub file_id: String,
54224    }
54225}
54226#[allow(clippy::module_inception)]
54227pub mod retrieve_file {
54228    #[derive(Clone, Debug, PartialEq)]
54229    #[serde_with::serde_as]
54230    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
54231    pub struct Params {
54232        #[doc = "The ID of the file to use for this request."]
54233        #[serde(rename = "file_id")]
54234        pub file_id: String,
54235    }
54236}
54237#[allow(clippy::module_inception)]
54238pub mod download_file {
54239    #[derive(Clone, Debug, PartialEq)]
54240    #[serde_with::serde_as]
54241    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
54242    pub struct Params {
54243        #[doc = "The ID of the file to use for this request."]
54244        #[serde(rename = "file_id")]
54245        pub file_id: String,
54246    }
54247}
54248#[allow(clippy::module_inception)]
54249pub mod list_fine_tuning_checkpoint_permissions {
54250    #[allow(clippy::module_inception)]
54251    pub mod params {
54252        #[doc = "The order in which to retrieve permissions."]
54253        #[derive(
54254            Clone, Copy, Debug, Default, PartialEq, serde :: Deserialize, serde :: Serialize,
54255        )]
54256        pub enum Order {
54257            #[doc = "`ascending`"]
54258            #[serde(rename = "ascending")]
54259            Ascending,
54260            #[doc = "`descending`"]
54261            #[default]
54262            #[serde(rename = "descending")]
54263            Descending,
54264        }
54265    }
54266    #[derive(Clone, Debug, PartialEq)]
54267    #[serde_with::serde_as]
54268    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
54269    pub struct Params {
54270        #[doc = "The ID of the fine-tuned model checkpoint to get permissions for.\n"]
54271        #[serde(rename = "fine_tuned_model_checkpoint")]
54272        pub fine_tuned_model_checkpoint: String,
54273        #[doc = "The ID of the project to get permissions for."]
54274        #[serde(rename = "project_id")]
54275        #[serde(skip_serializing_if = "Option::is_none")]
54276        #[builder(default)]
54277        pub project_id: Option<String>,
54278        #[doc = "Identifier for the last permission ID from the previous pagination request."]
54279        #[serde(rename = "after")]
54280        #[serde(skip_serializing_if = "Option::is_none")]
54281        #[builder(default)]
54282        pub after: Option<String>,
54283        #[doc = "Number of permissions to retrieve."]
54284        #[serde(rename = "limit")]
54285        #[serde(skip_serializing_if = "Option::is_none")]
54286        #[builder(default)]
54287        pub limit: Option<i64>,
54288        #[doc = "The order in which to retrieve permissions."]
54289        #[serde(rename = "order")]
54290        #[serde(skip_serializing_if = "Option::is_none")]
54291        #[builder(default)]
54292        pub order: Option<crate::__types::list_fine_tuning_checkpoint_permissions::params::Order>,
54293    }
54294}
54295#[allow(clippy::module_inception)]
54296pub mod create_fine_tuning_checkpoint_permission {
54297    #[derive(Clone, Debug, PartialEq)]
54298    #[serde_with::serde_as]
54299    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
54300    pub struct Params {
54301        #[doc = "The ID of the fine-tuned model checkpoint to create a permission for.\n"]
54302        #[serde(rename = "fine_tuned_model_checkpoint")]
54303        pub fine_tuned_model_checkpoint: String,
54304    }
54305}
54306#[allow(clippy::module_inception)]
54307pub mod delete_fine_tuning_checkpoint_permission {
54308    #[derive(Clone, Debug, PartialEq)]
54309    #[serde_with::serde_as]
54310    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
54311    pub struct Params {
54312        #[doc = "The ID of the fine-tuned model checkpoint to delete a permission for.\n"]
54313        #[serde(rename = "fine_tuned_model_checkpoint")]
54314        pub fine_tuned_model_checkpoint: String,
54315        #[doc = "The ID of the fine-tuned model checkpoint permission to delete.\n"]
54316        #[serde(rename = "permission_id")]
54317        pub permission_id: String,
54318    }
54319}
54320#[allow(clippy::module_inception)]
54321pub mod list_paginated_fine_tuning_jobs {
54322    #[derive(Clone, Debug, Default, PartialEq)]
54323    #[serde_with::serde_as]
54324    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
54325    pub struct Params {
54326        #[doc = "Identifier for the last job from the previous pagination request."]
54327        #[serde(rename = "after")]
54328        #[serde(skip_serializing_if = "Option::is_none")]
54329        #[builder(default)]
54330        pub after: Option<String>,
54331        #[doc = "Number of fine-tuning jobs to retrieve."]
54332        #[serde(rename = "limit")]
54333        #[serde(skip_serializing_if = "Option::is_none")]
54334        #[builder(default)]
54335        pub limit: Option<i64>,
54336        #[doc = "Optional metadata filter. To filter, use the syntax `metadata[k]=v`. Alternatively, set `metadata=null` to indicate no metadata.\n"]
54337        #[serde(rename = "metadata")]
54338        #[serde(skip_serializing_if = "Option::is_none")]
54339        #[builder(default)]
54340        pub metadata: Option<indexmap::IndexMap<String, String>>,
54341    }
54342}
54343#[allow(clippy::module_inception)]
54344pub mod retrieve_fine_tuning_job {
54345    #[derive(Clone, Debug, PartialEq)]
54346    #[serde_with::serde_as]
54347    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
54348    pub struct Params {
54349        #[doc = "The ID of the fine-tuning job.\n"]
54350        #[serde(rename = "fine_tuning_job_id")]
54351        pub fine_tuning_job_id: String,
54352    }
54353}
54354#[allow(clippy::module_inception)]
54355pub mod cancel_fine_tuning_job {
54356    #[derive(Clone, Debug, PartialEq)]
54357    #[serde_with::serde_as]
54358    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
54359    pub struct Params {
54360        #[doc = "The ID of the fine-tuning job to cancel.\n"]
54361        #[serde(rename = "fine_tuning_job_id")]
54362        pub fine_tuning_job_id: String,
54363    }
54364}
54365#[allow(clippy::module_inception)]
54366pub mod list_fine_tuning_job_checkpoints {
54367    #[derive(Clone, Debug, PartialEq)]
54368    #[serde_with::serde_as]
54369    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
54370    pub struct Params {
54371        #[doc = "The ID of the fine-tuning job to get checkpoints for.\n"]
54372        #[serde(rename = "fine_tuning_job_id")]
54373        pub fine_tuning_job_id: String,
54374        #[doc = "Identifier for the last checkpoint ID from the previous pagination request."]
54375        #[serde(rename = "after")]
54376        #[serde(skip_serializing_if = "Option::is_none")]
54377        #[builder(default)]
54378        pub after: Option<String>,
54379        #[doc = "Number of checkpoints to retrieve."]
54380        #[serde(rename = "limit")]
54381        #[serde(skip_serializing_if = "Option::is_none")]
54382        #[builder(default)]
54383        pub limit: Option<i64>,
54384    }
54385}
54386#[allow(clippy::module_inception)]
54387pub mod list_fine_tuning_events {
54388    #[derive(Clone, Debug, PartialEq)]
54389    #[serde_with::serde_as]
54390    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
54391    pub struct Params {
54392        #[doc = "The ID of the fine-tuning job to get events for.\n"]
54393        #[serde(rename = "fine_tuning_job_id")]
54394        pub fine_tuning_job_id: String,
54395        #[doc = "Identifier for the last event from the previous pagination request."]
54396        #[serde(rename = "after")]
54397        #[serde(skip_serializing_if = "Option::is_none")]
54398        #[builder(default)]
54399        pub after: Option<String>,
54400        #[doc = "Number of events to retrieve."]
54401        #[serde(rename = "limit")]
54402        #[serde(skip_serializing_if = "Option::is_none")]
54403        #[builder(default)]
54404        pub limit: Option<i64>,
54405    }
54406}
54407#[allow(clippy::module_inception)]
54408pub mod pause_fine_tuning_job {
54409    #[derive(Clone, Debug, PartialEq)]
54410    #[serde_with::serde_as]
54411    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
54412    pub struct Params {
54413        #[doc = "The ID of the fine-tuning job to pause.\n"]
54414        #[serde(rename = "fine_tuning_job_id")]
54415        pub fine_tuning_job_id: String,
54416    }
54417}
54418#[allow(clippy::module_inception)]
54419pub mod resume_fine_tuning_job {
54420    #[derive(Clone, Debug, PartialEq)]
54421    #[serde_with::serde_as]
54422    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
54423    pub struct Params {
54424        #[doc = "The ID of the fine-tuning job to resume.\n"]
54425        #[serde(rename = "fine_tuning_job_id")]
54426        pub fine_tuning_job_id: String,
54427    }
54428}
54429#[allow(clippy::module_inception)]
54430pub mod retrieve_model {
54431    #[derive(Clone, Debug, PartialEq)]
54432    #[serde_with::serde_as]
54433    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
54434    pub struct Params {
54435        #[doc = "The ID of the model to use for this request"]
54436        #[serde(rename = "model")]
54437        pub model: String,
54438    }
54439}
54440#[allow(clippy::module_inception)]
54441pub mod delete_model {
54442    #[derive(Clone, Debug, PartialEq)]
54443    #[serde_with::serde_as]
54444    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
54445    pub struct Params {
54446        #[doc = "The model to delete"]
54447        #[serde(rename = "model")]
54448        pub model: String,
54449    }
54450}
54451#[allow(clippy::module_inception)]
54452pub mod admin_api_keys_list {
54453    #[allow(clippy::module_inception)]
54454    pub mod params {
54455        #[derive(
54456            Clone, Copy, Debug, Default, PartialEq, serde :: Deserialize, serde :: Serialize,
54457        )]
54458        pub enum Order {
54459            #[doc = "`asc`"]
54460            #[default]
54461            #[serde(rename = "asc")]
54462            Asc,
54463            #[doc = "`desc`"]
54464            #[serde(rename = "desc")]
54465            Desc,
54466        }
54467    }
54468    #[derive(Clone, Debug, Default, PartialEq)]
54469    #[serde_with::serde_as]
54470    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
54471    pub struct Params {
54472        #[serde(rename = "after")]
54473        #[serde(skip_serializing_if = "Option::is_none")]
54474        #[builder(default)]
54475        pub after: Option<String>,
54476        #[serde(rename = "order")]
54477        #[serde(skip_serializing_if = "Option::is_none")]
54478        #[builder(default)]
54479        pub order: Option<crate::__types::admin_api_keys_list::params::Order>,
54480        #[serde(rename = "limit")]
54481        #[serde(skip_serializing_if = "Option::is_none")]
54482        #[builder(default)]
54483        pub limit: Option<i64>,
54484    }
54485}
54486#[allow(clippy::module_inception)]
54487pub mod admin_api_keys_create {
54488    #[derive(Clone, Debug, PartialEq)]
54489    #[serde_with::serde_as]
54490    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
54491    pub struct Request {
54492        #[serde(rename = "name")]
54493        pub name: String,
54494    }
54495}
54496#[allow(clippy::module_inception)]
54497pub mod admin_api_keys_get {
54498    #[derive(Clone, Debug, PartialEq)]
54499    #[serde_with::serde_as]
54500    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
54501    pub struct Params {
54502        #[serde(rename = "key_id")]
54503        pub key_id: String,
54504    }
54505}
54506#[allow(clippy::module_inception)]
54507pub mod admin_api_keys_delete {
54508    #[derive(Clone, Debug, PartialEq)]
54509    #[serde_with::serde_as]
54510    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
54511    pub struct Params {
54512        #[serde(rename = "key_id")]
54513        pub key_id: String,
54514    }
54515    #[derive(Clone, Debug, Default, PartialEq)]
54516    #[serde_with::serde_as]
54517    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
54518    pub struct Response {
54519        #[serde(rename = "id")]
54520        #[serde(skip_serializing_if = "Option::is_none")]
54521        #[builder(default)]
54522        pub id: Option<String>,
54523        #[serde(rename = "object")]
54524        #[serde(skip_serializing_if = "Option::is_none")]
54525        #[builder(default)]
54526        pub object: Option<String>,
54527        #[serde(rename = "deleted")]
54528        #[serde(skip_serializing_if = "Option::is_none")]
54529        #[builder(default)]
54530        pub deleted: Option<bool>,
54531    }
54532}
54533#[allow(clippy::module_inception)]
54534pub mod list_audit_logs {
54535    #[allow(clippy::module_inception)]
54536    pub mod params {
54537        #[doc = "Return only events whose `effective_at` (Unix seconds) is in this range."]
54538        #[derive(Clone, Copy, Debug, Default, PartialEq)]
54539        #[serde_with::serde_as]
54540        #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
54541        pub struct EffectiveAt {
54542            #[doc = "Return only events whose `effective_at` (Unix seconds) is greater than this value."]
54543            #[serde(rename = "gt")]
54544            #[serde(skip_serializing_if = "Option::is_none")]
54545            #[builder(default)]
54546            pub gt: Option<i64>,
54547            #[doc = "Return only events whose `effective_at` (Unix seconds) is greater than or equal to this value."]
54548            #[serde(rename = "gte")]
54549            #[serde(skip_serializing_if = "Option::is_none")]
54550            #[builder(default)]
54551            pub gte: Option<i64>,
54552            #[doc = "Return only events whose `effective_at` (Unix seconds) is less than this value."]
54553            #[serde(rename = "lt")]
54554            #[serde(skip_serializing_if = "Option::is_none")]
54555            #[builder(default)]
54556            pub lt: Option<i64>,
54557            #[doc = "Return only events whose `effective_at` (Unix seconds) is less than or equal to this value."]
54558            #[serde(rename = "lte")]
54559            #[serde(skip_serializing_if = "Option::is_none")]
54560            #[builder(default)]
54561            pub lte: Option<i64>,
54562        }
54563    }
54564    #[derive(Clone, Debug, Default, PartialEq)]
54565    #[serde_with::serde_as]
54566    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
54567    pub struct Params {
54568        #[doc = "Return only events whose `effective_at` (Unix seconds) is in this range."]
54569        #[serde(rename = "effective_at")]
54570        #[serde(skip_serializing_if = "Option::is_none")]
54571        #[builder(default)]
54572        pub effective_at: Option<crate::__types::list_audit_logs::params::EffectiveAt>,
54573        #[doc = "Return only events for these projects."]
54574        #[serde(rename = "project_ids[]")]
54575        #[serde(skip_serializing_if = "Option::is_none")]
54576        #[builder(default)]
54577        pub project_ids: Option<Vec<String>>,
54578        #[doc = "Return only events with a `type` in one of these values. For example, `project.created`. For all options, see the documentation for the [audit log object](https://platform.openai.com/docs/api-reference/audit-logs/object)."]
54579        #[serde(rename = "event_types[]")]
54580        #[serde(skip_serializing_if = "Option::is_none")]
54581        #[builder(default)]
54582        pub event_types: Option<Vec<crate::__types::AuditLogEventType>>,
54583        #[doc = "Return only events performed by these actors. Can be a user ID, a service account ID, or an api key tracking ID."]
54584        #[serde(rename = "actor_ids[]")]
54585        #[serde(skip_serializing_if = "Option::is_none")]
54586        #[builder(default)]
54587        pub actor_ids: Option<Vec<String>>,
54588        #[doc = "Return only events performed by users with these emails."]
54589        #[serde(rename = "actor_emails[]")]
54590        #[serde(skip_serializing_if = "Option::is_none")]
54591        #[builder(default)]
54592        pub actor_emails: Option<Vec<String>>,
54593        #[doc = "Return only events performed on these targets. For example, a project ID updated."]
54594        #[serde(rename = "resource_ids[]")]
54595        #[serde(skip_serializing_if = "Option::is_none")]
54596        #[builder(default)]
54597        pub resource_ids: Option<Vec<String>>,
54598        #[doc = "A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.\n"]
54599        #[serde(rename = "limit")]
54600        #[serde(skip_serializing_if = "Option::is_none")]
54601        #[builder(default)]
54602        pub limit: Option<i64>,
54603        #[doc = "A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.\n"]
54604        #[serde(rename = "after")]
54605        #[serde(skip_serializing_if = "Option::is_none")]
54606        #[builder(default)]
54607        pub after: Option<String>,
54608        #[doc = "A cursor for use in pagination. `before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.\n"]
54609        #[serde(rename = "before")]
54610        #[serde(skip_serializing_if = "Option::is_none")]
54611        #[builder(default)]
54612        pub before: Option<String>,
54613    }
54614}
54615#[allow(clippy::module_inception)]
54616pub mod list_organization_certificates {
54617    #[allow(clippy::module_inception)]
54618    pub mod params {
54619        #[doc = "Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order.\n"]
54620        #[derive(
54621            Clone, Copy, Debug, Default, PartialEq, serde :: Deserialize, serde :: Serialize,
54622        )]
54623        pub enum Order {
54624            #[doc = "`asc`"]
54625            #[serde(rename = "asc")]
54626            Asc,
54627            #[doc = "`desc`"]
54628            #[default]
54629            #[serde(rename = "desc")]
54630            Desc,
54631        }
54632    }
54633    #[derive(Clone, Debug, Default, PartialEq)]
54634    #[serde_with::serde_as]
54635    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
54636    pub struct Params {
54637        #[doc = "A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.\n"]
54638        #[serde(rename = "limit")]
54639        #[serde(skip_serializing_if = "Option::is_none")]
54640        #[builder(default)]
54641        pub limit: Option<i64>,
54642        #[doc = "A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.\n"]
54643        #[serde(rename = "after")]
54644        #[serde(skip_serializing_if = "Option::is_none")]
54645        #[builder(default)]
54646        pub after: Option<String>,
54647        #[doc = "Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order.\n"]
54648        #[serde(rename = "order")]
54649        #[serde(skip_serializing_if = "Option::is_none")]
54650        #[builder(default)]
54651        pub order: Option<crate::__types::list_organization_certificates::params::Order>,
54652    }
54653}
54654#[allow(clippy::module_inception)]
54655pub mod get_certificate {
54656    #[allow(clippy::module_inception)]
54657    pub mod params {
54658        #[allow(clippy::module_inception)]
54659        pub mod include {
54660            #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
54661            pub enum Item {
54662                #[doc = "`content`"]
54663                #[serde(rename = "content")]
54664                Content,
54665            }
54666        }
54667    }
54668    #[derive(Clone, Debug, PartialEq)]
54669    #[serde_with::serde_as]
54670    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
54671    pub struct Params {
54672        #[doc = "Unique ID of the certificate to retrieve."]
54673        #[serde(rename = "certificate_id")]
54674        pub certificate_id: String,
54675        #[doc = "A list of additional fields to include in the response. Currently the only supported value is `content` to fetch the PEM content of the certificate."]
54676        #[serde(rename = "include")]
54677        #[serde(skip_serializing_if = "Option::is_none")]
54678        #[builder(default)]
54679        pub include: Option<Vec<crate::__types::get_certificate::params::include::Item>>,
54680    }
54681}
54682#[allow(clippy::module_inception)]
54683pub mod usage_costs {
54684    #[allow(clippy::module_inception)]
54685    pub mod params {
54686        #[doc = "Width of each time bucket in response. Currently only `1d` is supported, default to `1d`."]
54687        #[derive(
54688            Clone, Copy, Debug, Default, PartialEq, serde :: Deserialize, serde :: Serialize,
54689        )]
54690        pub enum BucketWidth {
54691            #[doc = "`1d`"]
54692            #[default]
54693            #[serde(rename = "1d")]
54694            _1d,
54695        }
54696        #[allow(clippy::module_inception)]
54697        pub mod group_by {
54698            #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
54699            pub enum Item {
54700                #[doc = "`project_id`"]
54701                #[serde(rename = "project_id")]
54702                ProjectId,
54703                #[doc = "`line_item`"]
54704                #[serde(rename = "line_item")]
54705                LineItem,
54706            }
54707        }
54708    }
54709    #[derive(Clone, Debug, PartialEq)]
54710    #[serde_with::serde_as]
54711    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
54712    pub struct Params {
54713        #[doc = "Start time (Unix seconds) of the query time range, inclusive."]
54714        #[serde(rename = "start_time")]
54715        pub start_time: i64,
54716        #[doc = "End time (Unix seconds) of the query time range, exclusive."]
54717        #[serde(rename = "end_time")]
54718        #[serde(skip_serializing_if = "Option::is_none")]
54719        #[builder(default)]
54720        pub end_time: Option<i64>,
54721        #[doc = "Width of each time bucket in response. Currently only `1d` is supported, default to `1d`."]
54722        #[serde(rename = "bucket_width")]
54723        #[serde(skip_serializing_if = "Option::is_none")]
54724        #[builder(default)]
54725        pub bucket_width: Option<crate::__types::usage_costs::params::BucketWidth>,
54726        #[doc = "Return only costs for these projects."]
54727        #[serde(rename = "project_ids")]
54728        #[serde(skip_serializing_if = "Option::is_none")]
54729        #[builder(default)]
54730        pub project_ids: Option<Vec<String>>,
54731        #[doc = "Group the costs by the specified fields. Support fields include `project_id`, `line_item` and any combination of them."]
54732        #[serde(rename = "group_by")]
54733        #[serde(skip_serializing_if = "Option::is_none")]
54734        #[builder(default)]
54735        pub group_by: Option<Vec<crate::__types::usage_costs::params::group_by::Item>>,
54736        #[doc = "A limit on the number of buckets to be returned. Limit can range between 1 and 180, and the default is 7.\n"]
54737        #[serde(rename = "limit")]
54738        #[serde(skip_serializing_if = "Option::is_none")]
54739        #[builder(default)]
54740        pub limit: Option<i64>,
54741        #[doc = "A cursor for use in pagination. Corresponding to the `next_page` field from the previous response."]
54742        #[serde(rename = "page")]
54743        #[serde(skip_serializing_if = "Option::is_none")]
54744        #[builder(default)]
54745        pub page: Option<String>,
54746    }
54747}
54748#[allow(clippy::module_inception)]
54749pub mod list_invites {
54750    #[derive(Clone, Debug, Default, PartialEq)]
54751    #[serde_with::serde_as]
54752    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
54753    pub struct Params {
54754        #[doc = "A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.\n"]
54755        #[serde(rename = "limit")]
54756        #[serde(skip_serializing_if = "Option::is_none")]
54757        #[builder(default)]
54758        pub limit: Option<i64>,
54759        #[doc = "A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.\n"]
54760        #[serde(rename = "after")]
54761        #[serde(skip_serializing_if = "Option::is_none")]
54762        #[builder(default)]
54763        pub after: Option<String>,
54764    }
54765}
54766#[allow(clippy::module_inception)]
54767pub mod retrieve_invite {
54768    #[derive(Clone, Debug, PartialEq)]
54769    #[serde_with::serde_as]
54770    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
54771    pub struct Params {
54772        #[doc = "The ID of the invite to retrieve."]
54773        #[serde(rename = "invite_id")]
54774        pub invite_id: String,
54775    }
54776}
54777#[allow(clippy::module_inception)]
54778pub mod delete_invite {
54779    #[derive(Clone, Debug, PartialEq)]
54780    #[serde_with::serde_as]
54781    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
54782    pub struct Params {
54783        #[doc = "The ID of the invite to delete."]
54784        #[serde(rename = "invite_id")]
54785        pub invite_id: String,
54786    }
54787}
54788#[allow(clippy::module_inception)]
54789pub mod list_projects {
54790    #[derive(Clone, Debug, Default, PartialEq)]
54791    #[serde_with::serde_as]
54792    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
54793    pub struct Params {
54794        #[doc = "A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.\n"]
54795        #[serde(rename = "limit")]
54796        #[serde(skip_serializing_if = "Option::is_none")]
54797        #[builder(default)]
54798        pub limit: Option<i64>,
54799        #[doc = "A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.\n"]
54800        #[serde(rename = "after")]
54801        #[serde(skip_serializing_if = "Option::is_none")]
54802        #[builder(default)]
54803        pub after: Option<String>,
54804        #[doc = "If `true` returns all projects including those that have been `archived`. Archived projects are not included by default."]
54805        #[serde(rename = "include_archived")]
54806        #[serde(skip_serializing_if = "Option::is_none")]
54807        #[builder(default)]
54808        pub include_archived: Option<bool>,
54809    }
54810}
54811#[allow(clippy::module_inception)]
54812pub mod retrieve_project {
54813    #[derive(Clone, Debug, PartialEq)]
54814    #[serde_with::serde_as]
54815    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
54816    pub struct Params {
54817        #[doc = "The ID of the project."]
54818        #[serde(rename = "project_id")]
54819        pub project_id: String,
54820    }
54821}
54822#[allow(clippy::module_inception)]
54823pub mod modify_project {
54824    #[derive(Clone, Debug, PartialEq)]
54825    #[serde_with::serde_as]
54826    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
54827    pub struct Params {
54828        #[doc = "The ID of the project."]
54829        #[serde(rename = "project_id")]
54830        pub project_id: String,
54831    }
54832}
54833#[allow(clippy::module_inception)]
54834pub mod list_project_api_keys {
54835    #[derive(Clone, Debug, PartialEq)]
54836    #[serde_with::serde_as]
54837    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
54838    pub struct Params {
54839        #[doc = "The ID of the project."]
54840        #[serde(rename = "project_id")]
54841        pub project_id: String,
54842        #[doc = "A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.\n"]
54843        #[serde(rename = "limit")]
54844        #[serde(skip_serializing_if = "Option::is_none")]
54845        #[builder(default)]
54846        pub limit: Option<i64>,
54847        #[doc = "A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.\n"]
54848        #[serde(rename = "after")]
54849        #[serde(skip_serializing_if = "Option::is_none")]
54850        #[builder(default)]
54851        pub after: Option<String>,
54852    }
54853}
54854#[allow(clippy::module_inception)]
54855pub mod retrieve_project_api_key {
54856    #[derive(Clone, Debug, PartialEq)]
54857    #[serde_with::serde_as]
54858    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
54859    pub struct Params {
54860        #[doc = "The ID of the project."]
54861        #[serde(rename = "project_id")]
54862        pub project_id: String,
54863        #[doc = "The ID of the API key."]
54864        #[serde(rename = "key_id")]
54865        pub key_id: String,
54866    }
54867}
54868#[allow(clippy::module_inception)]
54869pub mod delete_project_api_key {
54870    #[derive(Clone, Debug, PartialEq)]
54871    #[serde_with::serde_as]
54872    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
54873    pub struct Params {
54874        #[doc = "The ID of the project."]
54875        #[serde(rename = "project_id")]
54876        pub project_id: String,
54877        #[doc = "The ID of the API key."]
54878        #[serde(rename = "key_id")]
54879        pub key_id: String,
54880    }
54881}
54882#[allow(clippy::module_inception)]
54883pub mod archive_project {
54884    #[derive(Clone, Debug, PartialEq)]
54885    #[serde_with::serde_as]
54886    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
54887    pub struct Params {
54888        #[doc = "The ID of the project."]
54889        #[serde(rename = "project_id")]
54890        pub project_id: String,
54891    }
54892}
54893#[allow(clippy::module_inception)]
54894pub mod list_project_certificates {
54895    #[allow(clippy::module_inception)]
54896    pub mod params {
54897        #[doc = "Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order.\n"]
54898        #[derive(
54899            Clone, Copy, Debug, Default, PartialEq, serde :: Deserialize, serde :: Serialize,
54900        )]
54901        pub enum Order {
54902            #[doc = "`asc`"]
54903            #[serde(rename = "asc")]
54904            Asc,
54905            #[doc = "`desc`"]
54906            #[default]
54907            #[serde(rename = "desc")]
54908            Desc,
54909        }
54910    }
54911    #[derive(Clone, Debug, PartialEq)]
54912    #[serde_with::serde_as]
54913    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
54914    pub struct Params {
54915        #[doc = "The ID of the project."]
54916        #[serde(rename = "project_id")]
54917        pub project_id: String,
54918        #[doc = "A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.\n"]
54919        #[serde(rename = "limit")]
54920        #[serde(skip_serializing_if = "Option::is_none")]
54921        #[builder(default)]
54922        pub limit: Option<i64>,
54923        #[doc = "A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.\n"]
54924        #[serde(rename = "after")]
54925        #[serde(skip_serializing_if = "Option::is_none")]
54926        #[builder(default)]
54927        pub after: Option<String>,
54928        #[doc = "Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order.\n"]
54929        #[serde(rename = "order")]
54930        #[serde(skip_serializing_if = "Option::is_none")]
54931        #[builder(default)]
54932        pub order: Option<crate::__types::list_project_certificates::params::Order>,
54933    }
54934}
54935#[allow(clippy::module_inception)]
54936pub mod activate_project_certificates {
54937    #[derive(Clone, Debug, PartialEq)]
54938    #[serde_with::serde_as]
54939    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
54940    pub struct Params {
54941        #[doc = "The ID of the project."]
54942        #[serde(rename = "project_id")]
54943        pub project_id: String,
54944    }
54945}
54946#[allow(clippy::module_inception)]
54947pub mod deactivate_project_certificates {
54948    #[derive(Clone, Debug, PartialEq)]
54949    #[serde_with::serde_as]
54950    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
54951    pub struct Params {
54952        #[doc = "The ID of the project."]
54953        #[serde(rename = "project_id")]
54954        pub project_id: String,
54955    }
54956}
54957#[allow(clippy::module_inception)]
54958pub mod list_project_rate_limits {
54959    #[derive(Clone, Debug, PartialEq)]
54960    #[serde_with::serde_as]
54961    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
54962    pub struct Params {
54963        #[doc = "The ID of the project."]
54964        #[serde(rename = "project_id")]
54965        pub project_id: String,
54966        #[doc = "A limit on the number of objects to be returned. The default is 100.\n"]
54967        #[serde(rename = "limit")]
54968        #[serde(skip_serializing_if = "Option::is_none")]
54969        #[builder(default)]
54970        pub limit: Option<i64>,
54971        #[doc = "A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.\n"]
54972        #[serde(rename = "after")]
54973        #[serde(skip_serializing_if = "Option::is_none")]
54974        #[builder(default)]
54975        pub after: Option<String>,
54976        #[doc = "A cursor for use in pagination. `before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, beginning with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.\n"]
54977        #[serde(rename = "before")]
54978        #[serde(skip_serializing_if = "Option::is_none")]
54979        #[builder(default)]
54980        pub before: Option<String>,
54981    }
54982}
54983#[allow(clippy::module_inception)]
54984pub mod update_project_rate_limits {
54985    #[derive(Clone, Debug, PartialEq)]
54986    #[serde_with::serde_as]
54987    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
54988    pub struct Params {
54989        #[doc = "The ID of the project."]
54990        #[serde(rename = "project_id")]
54991        pub project_id: String,
54992        #[doc = "The ID of the rate limit."]
54993        #[serde(rename = "rate_limit_id")]
54994        pub rate_limit_id: String,
54995    }
54996}
54997#[allow(clippy::module_inception)]
54998pub mod list_project_service_accounts {
54999    #[derive(Clone, Debug, PartialEq)]
55000    #[serde_with::serde_as]
55001    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
55002    pub struct Params {
55003        #[doc = "The ID of the project."]
55004        #[serde(rename = "project_id")]
55005        pub project_id: String,
55006        #[doc = "A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.\n"]
55007        #[serde(rename = "limit")]
55008        #[serde(skip_serializing_if = "Option::is_none")]
55009        #[builder(default)]
55010        pub limit: Option<i64>,
55011        #[doc = "A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.\n"]
55012        #[serde(rename = "after")]
55013        #[serde(skip_serializing_if = "Option::is_none")]
55014        #[builder(default)]
55015        pub after: Option<String>,
55016    }
55017}
55018#[allow(clippy::module_inception)]
55019pub mod create_project_service_account {
55020    #[derive(Clone, Debug, PartialEq)]
55021    #[serde_with::serde_as]
55022    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
55023    pub struct Params {
55024        #[doc = "The ID of the project."]
55025        #[serde(rename = "project_id")]
55026        pub project_id: String,
55027    }
55028}
55029#[allow(clippy::module_inception)]
55030pub mod retrieve_project_service_account {
55031    #[derive(Clone, Debug, PartialEq)]
55032    #[serde_with::serde_as]
55033    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
55034    pub struct Params {
55035        #[doc = "The ID of the project."]
55036        #[serde(rename = "project_id")]
55037        pub project_id: String,
55038        #[doc = "The ID of the service account."]
55039        #[serde(rename = "service_account_id")]
55040        pub service_account_id: String,
55041    }
55042}
55043#[allow(clippy::module_inception)]
55044pub mod delete_project_service_account {
55045    #[derive(Clone, Debug, PartialEq)]
55046    #[serde_with::serde_as]
55047    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
55048    pub struct Params {
55049        #[doc = "The ID of the project."]
55050        #[serde(rename = "project_id")]
55051        pub project_id: String,
55052        #[doc = "The ID of the service account."]
55053        #[serde(rename = "service_account_id")]
55054        pub service_account_id: String,
55055    }
55056}
55057#[allow(clippy::module_inception)]
55058pub mod list_project_users {
55059    #[derive(Clone, Debug, PartialEq)]
55060    #[serde_with::serde_as]
55061    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
55062    pub struct Params {
55063        #[doc = "The ID of the project."]
55064        #[serde(rename = "project_id")]
55065        pub project_id: String,
55066        #[doc = "A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.\n"]
55067        #[serde(rename = "limit")]
55068        #[serde(skip_serializing_if = "Option::is_none")]
55069        #[builder(default)]
55070        pub limit: Option<i64>,
55071        #[doc = "A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.\n"]
55072        #[serde(rename = "after")]
55073        #[serde(skip_serializing_if = "Option::is_none")]
55074        #[builder(default)]
55075        pub after: Option<String>,
55076    }
55077}
55078#[allow(clippy::module_inception)]
55079pub mod create_project_user {
55080    #[derive(Clone, Debug, PartialEq)]
55081    #[serde_with::serde_as]
55082    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
55083    pub struct Params {
55084        #[doc = "The ID of the project."]
55085        #[serde(rename = "project_id")]
55086        pub project_id: String,
55087    }
55088}
55089#[allow(clippy::module_inception)]
55090pub mod retrieve_project_user {
55091    #[derive(Clone, Debug, PartialEq)]
55092    #[serde_with::serde_as]
55093    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
55094    pub struct Params {
55095        #[doc = "The ID of the project."]
55096        #[serde(rename = "project_id")]
55097        pub project_id: String,
55098        #[doc = "The ID of the user."]
55099        #[serde(rename = "user_id")]
55100        pub user_id: String,
55101    }
55102}
55103#[allow(clippy::module_inception)]
55104pub mod modify_project_user {
55105    #[derive(Clone, Debug, PartialEq)]
55106    #[serde_with::serde_as]
55107    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
55108    pub struct Params {
55109        #[doc = "The ID of the project."]
55110        #[serde(rename = "project_id")]
55111        pub project_id: String,
55112        #[doc = "The ID of the user."]
55113        #[serde(rename = "user_id")]
55114        pub user_id: String,
55115    }
55116}
55117#[allow(clippy::module_inception)]
55118pub mod delete_project_user {
55119    #[derive(Clone, Debug, PartialEq)]
55120    #[serde_with::serde_as]
55121    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
55122    pub struct Params {
55123        #[doc = "The ID of the project."]
55124        #[serde(rename = "project_id")]
55125        pub project_id: String,
55126        #[doc = "The ID of the user."]
55127        #[serde(rename = "user_id")]
55128        pub user_id: String,
55129    }
55130}
55131#[allow(clippy::module_inception)]
55132pub mod usage_audio_speeches {
55133    #[allow(clippy::module_inception)]
55134    pub mod params {
55135        #[doc = "Width of each time bucket in response. Currently `1m`, `1h` and `1d` are supported, default to `1d`."]
55136        #[derive(
55137            Clone, Copy, Debug, Default, PartialEq, serde :: Deserialize, serde :: Serialize,
55138        )]
55139        pub enum BucketWidth {
55140            #[doc = "`1m`"]
55141            #[serde(rename = "1m")]
55142            _1m,
55143            #[doc = "`1h`"]
55144            #[serde(rename = "1h")]
55145            _1h,
55146            #[doc = "`1d`"]
55147            #[default]
55148            #[serde(rename = "1d")]
55149            _1d,
55150        }
55151        #[allow(clippy::module_inception)]
55152        pub mod group_by {
55153            #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
55154            pub enum Item {
55155                #[doc = "`project_id`"]
55156                #[serde(rename = "project_id")]
55157                ProjectId,
55158                #[doc = "`user_id`"]
55159                #[serde(rename = "user_id")]
55160                UserId,
55161                #[doc = "`api_key_id`"]
55162                #[serde(rename = "api_key_id")]
55163                ApiKeyId,
55164                #[doc = "`model`"]
55165                #[serde(rename = "model")]
55166                Model,
55167            }
55168        }
55169    }
55170    #[derive(Clone, Debug, PartialEq)]
55171    #[serde_with::serde_as]
55172    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
55173    pub struct Params {
55174        #[doc = "Start time (Unix seconds) of the query time range, inclusive."]
55175        #[serde(rename = "start_time")]
55176        pub start_time: i64,
55177        #[doc = "End time (Unix seconds) of the query time range, exclusive."]
55178        #[serde(rename = "end_time")]
55179        #[serde(skip_serializing_if = "Option::is_none")]
55180        #[builder(default)]
55181        pub end_time: Option<i64>,
55182        #[doc = "Width of each time bucket in response. Currently `1m`, `1h` and `1d` are supported, default to `1d`."]
55183        #[serde(rename = "bucket_width")]
55184        #[serde(skip_serializing_if = "Option::is_none")]
55185        #[builder(default)]
55186        pub bucket_width: Option<crate::__types::usage_audio_speeches::params::BucketWidth>,
55187        #[doc = "Return only usage for these projects."]
55188        #[serde(rename = "project_ids")]
55189        #[serde(skip_serializing_if = "Option::is_none")]
55190        #[builder(default)]
55191        pub project_ids: Option<Vec<String>>,
55192        #[doc = "Return only usage for these users."]
55193        #[serde(rename = "user_ids")]
55194        #[serde(skip_serializing_if = "Option::is_none")]
55195        #[builder(default)]
55196        pub user_ids: Option<Vec<String>>,
55197        #[doc = "Return only usage for these API keys."]
55198        #[serde(rename = "api_key_ids")]
55199        #[serde(skip_serializing_if = "Option::is_none")]
55200        #[builder(default)]
55201        pub api_key_ids: Option<Vec<String>>,
55202        #[doc = "Return only usage for these models."]
55203        #[serde(rename = "models")]
55204        #[serde(skip_serializing_if = "Option::is_none")]
55205        #[builder(default)]
55206        pub models: Option<Vec<String>>,
55207        #[doc = "Group the usage data by the specified fields. Support fields include `project_id`, `user_id`, `api_key_id`, `model` or any combination of them."]
55208        #[serde(rename = "group_by")]
55209        #[serde(skip_serializing_if = "Option::is_none")]
55210        #[builder(default)]
55211        pub group_by: Option<Vec<crate::__types::usage_audio_speeches::params::group_by::Item>>,
55212        #[doc = "Specifies the number of buckets to return.\n- `bucket_width=1d`: default: 7, max: 31\n- `bucket_width=1h`: default: 24, max: 168\n- `bucket_width=1m`: default: 60, max: 1440\n"]
55213        #[serde(rename = "limit")]
55214        #[serde(skip_serializing_if = "Option::is_none")]
55215        #[builder(default)]
55216        pub limit: Option<i64>,
55217        #[doc = "A cursor for use in pagination. Corresponding to the `next_page` field from the previous response."]
55218        #[serde(rename = "page")]
55219        #[serde(skip_serializing_if = "Option::is_none")]
55220        #[builder(default)]
55221        pub page: Option<String>,
55222    }
55223}
55224#[allow(clippy::module_inception)]
55225pub mod usage_audio_transcriptions {
55226    #[allow(clippy::module_inception)]
55227    pub mod params {
55228        #[doc = "Width of each time bucket in response. Currently `1m`, `1h` and `1d` are supported, default to `1d`."]
55229        #[derive(
55230            Clone, Copy, Debug, Default, PartialEq, serde :: Deserialize, serde :: Serialize,
55231        )]
55232        pub enum BucketWidth {
55233            #[doc = "`1m`"]
55234            #[serde(rename = "1m")]
55235            _1m,
55236            #[doc = "`1h`"]
55237            #[serde(rename = "1h")]
55238            _1h,
55239            #[doc = "`1d`"]
55240            #[default]
55241            #[serde(rename = "1d")]
55242            _1d,
55243        }
55244        #[allow(clippy::module_inception)]
55245        pub mod group_by {
55246            #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
55247            pub enum Item {
55248                #[doc = "`project_id`"]
55249                #[serde(rename = "project_id")]
55250                ProjectId,
55251                #[doc = "`user_id`"]
55252                #[serde(rename = "user_id")]
55253                UserId,
55254                #[doc = "`api_key_id`"]
55255                #[serde(rename = "api_key_id")]
55256                ApiKeyId,
55257                #[doc = "`model`"]
55258                #[serde(rename = "model")]
55259                Model,
55260            }
55261        }
55262    }
55263    #[derive(Clone, Debug, PartialEq)]
55264    #[serde_with::serde_as]
55265    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
55266    pub struct Params {
55267        #[doc = "Start time (Unix seconds) of the query time range, inclusive."]
55268        #[serde(rename = "start_time")]
55269        pub start_time: i64,
55270        #[doc = "End time (Unix seconds) of the query time range, exclusive."]
55271        #[serde(rename = "end_time")]
55272        #[serde(skip_serializing_if = "Option::is_none")]
55273        #[builder(default)]
55274        pub end_time: Option<i64>,
55275        #[doc = "Width of each time bucket in response. Currently `1m`, `1h` and `1d` are supported, default to `1d`."]
55276        #[serde(rename = "bucket_width")]
55277        #[serde(skip_serializing_if = "Option::is_none")]
55278        #[builder(default)]
55279        pub bucket_width: Option<crate::__types::usage_audio_transcriptions::params::BucketWidth>,
55280        #[doc = "Return only usage for these projects."]
55281        #[serde(rename = "project_ids")]
55282        #[serde(skip_serializing_if = "Option::is_none")]
55283        #[builder(default)]
55284        pub project_ids: Option<Vec<String>>,
55285        #[doc = "Return only usage for these users."]
55286        #[serde(rename = "user_ids")]
55287        #[serde(skip_serializing_if = "Option::is_none")]
55288        #[builder(default)]
55289        pub user_ids: Option<Vec<String>>,
55290        #[doc = "Return only usage for these API keys."]
55291        #[serde(rename = "api_key_ids")]
55292        #[serde(skip_serializing_if = "Option::is_none")]
55293        #[builder(default)]
55294        pub api_key_ids: Option<Vec<String>>,
55295        #[doc = "Return only usage for these models."]
55296        #[serde(rename = "models")]
55297        #[serde(skip_serializing_if = "Option::is_none")]
55298        #[builder(default)]
55299        pub models: Option<Vec<String>>,
55300        #[doc = "Group the usage data by the specified fields. Support fields include `project_id`, `user_id`, `api_key_id`, `model` or any combination of them."]
55301        #[serde(rename = "group_by")]
55302        #[serde(skip_serializing_if = "Option::is_none")]
55303        #[builder(default)]
55304        pub group_by:
55305            Option<Vec<crate::__types::usage_audio_transcriptions::params::group_by::Item>>,
55306        #[doc = "Specifies the number of buckets to return.\n- `bucket_width=1d`: default: 7, max: 31\n- `bucket_width=1h`: default: 24, max: 168\n- `bucket_width=1m`: default: 60, max: 1440\n"]
55307        #[serde(rename = "limit")]
55308        #[serde(skip_serializing_if = "Option::is_none")]
55309        #[builder(default)]
55310        pub limit: Option<i64>,
55311        #[doc = "A cursor for use in pagination. Corresponding to the `next_page` field from the previous response."]
55312        #[serde(rename = "page")]
55313        #[serde(skip_serializing_if = "Option::is_none")]
55314        #[builder(default)]
55315        pub page: Option<String>,
55316    }
55317}
55318#[allow(clippy::module_inception)]
55319pub mod usage_code_interpreter_sessions {
55320    #[allow(clippy::module_inception)]
55321    pub mod params {
55322        #[doc = "Width of each time bucket in response. Currently `1m`, `1h` and `1d` are supported, default to `1d`."]
55323        #[derive(
55324            Clone, Copy, Debug, Default, PartialEq, serde :: Deserialize, serde :: Serialize,
55325        )]
55326        pub enum BucketWidth {
55327            #[doc = "`1m`"]
55328            #[serde(rename = "1m")]
55329            _1m,
55330            #[doc = "`1h`"]
55331            #[serde(rename = "1h")]
55332            _1h,
55333            #[doc = "`1d`"]
55334            #[default]
55335            #[serde(rename = "1d")]
55336            _1d,
55337        }
55338        #[allow(clippy::module_inception)]
55339        pub mod group_by {
55340            #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
55341            pub enum Item {
55342                #[doc = "`project_id`"]
55343                #[serde(rename = "project_id")]
55344                ProjectId,
55345            }
55346        }
55347    }
55348    #[derive(Clone, Debug, PartialEq)]
55349    #[serde_with::serde_as]
55350    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
55351    pub struct Params {
55352        #[doc = "Start time (Unix seconds) of the query time range, inclusive."]
55353        #[serde(rename = "start_time")]
55354        pub start_time: i64,
55355        #[doc = "End time (Unix seconds) of the query time range, exclusive."]
55356        #[serde(rename = "end_time")]
55357        #[serde(skip_serializing_if = "Option::is_none")]
55358        #[builder(default)]
55359        pub end_time: Option<i64>,
55360        #[doc = "Width of each time bucket in response. Currently `1m`, `1h` and `1d` are supported, default to `1d`."]
55361        #[serde(rename = "bucket_width")]
55362        #[serde(skip_serializing_if = "Option::is_none")]
55363        #[builder(default)]
55364        pub bucket_width:
55365            Option<crate::__types::usage_code_interpreter_sessions::params::BucketWidth>,
55366        #[doc = "Return only usage for these projects."]
55367        #[serde(rename = "project_ids")]
55368        #[serde(skip_serializing_if = "Option::is_none")]
55369        #[builder(default)]
55370        pub project_ids: Option<Vec<String>>,
55371        #[doc = "Group the usage data by the specified fields. Support fields include `project_id`."]
55372        #[serde(rename = "group_by")]
55373        #[serde(skip_serializing_if = "Option::is_none")]
55374        #[builder(default)]
55375        pub group_by:
55376            Option<Vec<crate::__types::usage_code_interpreter_sessions::params::group_by::Item>>,
55377        #[doc = "Specifies the number of buckets to return.\n- `bucket_width=1d`: default: 7, max: 31\n- `bucket_width=1h`: default: 24, max: 168\n- `bucket_width=1m`: default: 60, max: 1440\n"]
55378        #[serde(rename = "limit")]
55379        #[serde(skip_serializing_if = "Option::is_none")]
55380        #[builder(default)]
55381        pub limit: Option<i64>,
55382        #[doc = "A cursor for use in pagination. Corresponding to the `next_page` field from the previous response."]
55383        #[serde(rename = "page")]
55384        #[serde(skip_serializing_if = "Option::is_none")]
55385        #[builder(default)]
55386        pub page: Option<String>,
55387    }
55388}
55389#[allow(clippy::module_inception)]
55390pub mod usage_completions {
55391    #[allow(clippy::module_inception)]
55392    pub mod params {
55393        #[doc = "Width of each time bucket in response. Currently `1m`, `1h` and `1d` are supported, default to `1d`."]
55394        #[derive(
55395            Clone, Copy, Debug, Default, PartialEq, serde :: Deserialize, serde :: Serialize,
55396        )]
55397        pub enum BucketWidth {
55398            #[doc = "`1m`"]
55399            #[serde(rename = "1m")]
55400            _1m,
55401            #[doc = "`1h`"]
55402            #[serde(rename = "1h")]
55403            _1h,
55404            #[doc = "`1d`"]
55405            #[default]
55406            #[serde(rename = "1d")]
55407            _1d,
55408        }
55409        #[allow(clippy::module_inception)]
55410        pub mod group_by {
55411            #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
55412            pub enum Item {
55413                #[doc = "`project_id`"]
55414                #[serde(rename = "project_id")]
55415                ProjectId,
55416                #[doc = "`user_id`"]
55417                #[serde(rename = "user_id")]
55418                UserId,
55419                #[doc = "`api_key_id`"]
55420                #[serde(rename = "api_key_id")]
55421                ApiKeyId,
55422                #[doc = "`model`"]
55423                #[serde(rename = "model")]
55424                Model,
55425                #[doc = "`batch`"]
55426                #[serde(rename = "batch")]
55427                Batch,
55428            }
55429        }
55430    }
55431    #[derive(Clone, Debug, PartialEq)]
55432    #[serde_with::serde_as]
55433    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
55434    pub struct Params {
55435        #[doc = "Start time (Unix seconds) of the query time range, inclusive."]
55436        #[serde(rename = "start_time")]
55437        pub start_time: i64,
55438        #[doc = "End time (Unix seconds) of the query time range, exclusive."]
55439        #[serde(rename = "end_time")]
55440        #[serde(skip_serializing_if = "Option::is_none")]
55441        #[builder(default)]
55442        pub end_time: Option<i64>,
55443        #[doc = "Width of each time bucket in response. Currently `1m`, `1h` and `1d` are supported, default to `1d`."]
55444        #[serde(rename = "bucket_width")]
55445        #[serde(skip_serializing_if = "Option::is_none")]
55446        #[builder(default)]
55447        pub bucket_width: Option<crate::__types::usage_completions::params::BucketWidth>,
55448        #[doc = "Return only usage for these projects."]
55449        #[serde(rename = "project_ids")]
55450        #[serde(skip_serializing_if = "Option::is_none")]
55451        #[builder(default)]
55452        pub project_ids: Option<Vec<String>>,
55453        #[doc = "Return only usage for these users."]
55454        #[serde(rename = "user_ids")]
55455        #[serde(skip_serializing_if = "Option::is_none")]
55456        #[builder(default)]
55457        pub user_ids: Option<Vec<String>>,
55458        #[doc = "Return only usage for these API keys."]
55459        #[serde(rename = "api_key_ids")]
55460        #[serde(skip_serializing_if = "Option::is_none")]
55461        #[builder(default)]
55462        pub api_key_ids: Option<Vec<String>>,
55463        #[doc = "Return only usage for these models."]
55464        #[serde(rename = "models")]
55465        #[serde(skip_serializing_if = "Option::is_none")]
55466        #[builder(default)]
55467        pub models: Option<Vec<String>>,
55468        #[doc = "If `true`, return batch jobs only. If `false`, return non-batch jobs only. By default, return both.\n"]
55469        #[serde(rename = "batch")]
55470        #[serde(skip_serializing_if = "Option::is_none")]
55471        #[builder(default)]
55472        pub batch: Option<bool>,
55473        #[doc = "Group the usage data by the specified fields. Support fields include `project_id`, `user_id`, `api_key_id`, `model`, `batch` or any combination of them."]
55474        #[serde(rename = "group_by")]
55475        #[serde(skip_serializing_if = "Option::is_none")]
55476        #[builder(default)]
55477        pub group_by: Option<Vec<crate::__types::usage_completions::params::group_by::Item>>,
55478        #[doc = "Specifies the number of buckets to return.\n- `bucket_width=1d`: default: 7, max: 31\n- `bucket_width=1h`: default: 24, max: 168\n- `bucket_width=1m`: default: 60, max: 1440\n"]
55479        #[serde(rename = "limit")]
55480        #[serde(skip_serializing_if = "Option::is_none")]
55481        #[builder(default)]
55482        pub limit: Option<i64>,
55483        #[doc = "A cursor for use in pagination. Corresponding to the `next_page` field from the previous response."]
55484        #[serde(rename = "page")]
55485        #[serde(skip_serializing_if = "Option::is_none")]
55486        #[builder(default)]
55487        pub page: Option<String>,
55488    }
55489}
55490#[allow(clippy::module_inception)]
55491pub mod usage_embeddings {
55492    #[allow(clippy::module_inception)]
55493    pub mod params {
55494        #[doc = "Width of each time bucket in response. Currently `1m`, `1h` and `1d` are supported, default to `1d`."]
55495        #[derive(
55496            Clone, Copy, Debug, Default, PartialEq, serde :: Deserialize, serde :: Serialize,
55497        )]
55498        pub enum BucketWidth {
55499            #[doc = "`1m`"]
55500            #[serde(rename = "1m")]
55501            _1m,
55502            #[doc = "`1h`"]
55503            #[serde(rename = "1h")]
55504            _1h,
55505            #[doc = "`1d`"]
55506            #[default]
55507            #[serde(rename = "1d")]
55508            _1d,
55509        }
55510        #[allow(clippy::module_inception)]
55511        pub mod group_by {
55512            #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
55513            pub enum Item {
55514                #[doc = "`project_id`"]
55515                #[serde(rename = "project_id")]
55516                ProjectId,
55517                #[doc = "`user_id`"]
55518                #[serde(rename = "user_id")]
55519                UserId,
55520                #[doc = "`api_key_id`"]
55521                #[serde(rename = "api_key_id")]
55522                ApiKeyId,
55523                #[doc = "`model`"]
55524                #[serde(rename = "model")]
55525                Model,
55526            }
55527        }
55528    }
55529    #[derive(Clone, Debug, PartialEq)]
55530    #[serde_with::serde_as]
55531    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
55532    pub struct Params {
55533        #[doc = "Start time (Unix seconds) of the query time range, inclusive."]
55534        #[serde(rename = "start_time")]
55535        pub start_time: i64,
55536        #[doc = "End time (Unix seconds) of the query time range, exclusive."]
55537        #[serde(rename = "end_time")]
55538        #[serde(skip_serializing_if = "Option::is_none")]
55539        #[builder(default)]
55540        pub end_time: Option<i64>,
55541        #[doc = "Width of each time bucket in response. Currently `1m`, `1h` and `1d` are supported, default to `1d`."]
55542        #[serde(rename = "bucket_width")]
55543        #[serde(skip_serializing_if = "Option::is_none")]
55544        #[builder(default)]
55545        pub bucket_width: Option<crate::__types::usage_embeddings::params::BucketWidth>,
55546        #[doc = "Return only usage for these projects."]
55547        #[serde(rename = "project_ids")]
55548        #[serde(skip_serializing_if = "Option::is_none")]
55549        #[builder(default)]
55550        pub project_ids: Option<Vec<String>>,
55551        #[doc = "Return only usage for these users."]
55552        #[serde(rename = "user_ids")]
55553        #[serde(skip_serializing_if = "Option::is_none")]
55554        #[builder(default)]
55555        pub user_ids: Option<Vec<String>>,
55556        #[doc = "Return only usage for these API keys."]
55557        #[serde(rename = "api_key_ids")]
55558        #[serde(skip_serializing_if = "Option::is_none")]
55559        #[builder(default)]
55560        pub api_key_ids: Option<Vec<String>>,
55561        #[doc = "Return only usage for these models."]
55562        #[serde(rename = "models")]
55563        #[serde(skip_serializing_if = "Option::is_none")]
55564        #[builder(default)]
55565        pub models: Option<Vec<String>>,
55566        #[doc = "Group the usage data by the specified fields. Support fields include `project_id`, `user_id`, `api_key_id`, `model` or any combination of them."]
55567        #[serde(rename = "group_by")]
55568        #[serde(skip_serializing_if = "Option::is_none")]
55569        #[builder(default)]
55570        pub group_by: Option<Vec<crate::__types::usage_embeddings::params::group_by::Item>>,
55571        #[doc = "Specifies the number of buckets to return.\n- `bucket_width=1d`: default: 7, max: 31\n- `bucket_width=1h`: default: 24, max: 168\n- `bucket_width=1m`: default: 60, max: 1440\n"]
55572        #[serde(rename = "limit")]
55573        #[serde(skip_serializing_if = "Option::is_none")]
55574        #[builder(default)]
55575        pub limit: Option<i64>,
55576        #[doc = "A cursor for use in pagination. Corresponding to the `next_page` field from the previous response."]
55577        #[serde(rename = "page")]
55578        #[serde(skip_serializing_if = "Option::is_none")]
55579        #[builder(default)]
55580        pub page: Option<String>,
55581    }
55582}
55583#[allow(clippy::module_inception)]
55584pub mod usage_images {
55585    #[allow(clippy::module_inception)]
55586    pub mod params {
55587        #[doc = "Width of each time bucket in response. Currently `1m`, `1h` and `1d` are supported, default to `1d`."]
55588        #[derive(
55589            Clone, Copy, Debug, Default, PartialEq, serde :: Deserialize, serde :: Serialize,
55590        )]
55591        pub enum BucketWidth {
55592            #[doc = "`1m`"]
55593            #[serde(rename = "1m")]
55594            _1m,
55595            #[doc = "`1h`"]
55596            #[serde(rename = "1h")]
55597            _1h,
55598            #[doc = "`1d`"]
55599            #[default]
55600            #[serde(rename = "1d")]
55601            _1d,
55602        }
55603        #[allow(clippy::module_inception)]
55604        pub mod sources {
55605            #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
55606            pub enum Item {
55607                #[doc = "`image.generation`"]
55608                #[serde(rename = "image.generation")]
55609                ImageGeneration,
55610                #[doc = "`image.edit`"]
55611                #[serde(rename = "image.edit")]
55612                ImageEdit,
55613                #[doc = "`image.variation`"]
55614                #[serde(rename = "image.variation")]
55615                ImageVariation,
55616            }
55617        }
55618        #[allow(clippy::module_inception)]
55619        pub mod sizes {
55620            #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
55621            pub enum Item {
55622                #[doc = "`256x256`"]
55623                #[serde(rename = "256x256")]
55624                _256x256,
55625                #[doc = "`512x512`"]
55626                #[serde(rename = "512x512")]
55627                _512x512,
55628                #[doc = "`1024x1024`"]
55629                #[serde(rename = "1024x1024")]
55630                _1024x1024,
55631                #[doc = "`1792x1792`"]
55632                #[serde(rename = "1792x1792")]
55633                _1792x1792,
55634                #[doc = "`1024x1792`"]
55635                #[serde(rename = "1024x1792")]
55636                _1024x1792,
55637            }
55638        }
55639        #[allow(clippy::module_inception)]
55640        pub mod group_by {
55641            #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
55642            pub enum Item {
55643                #[doc = "`project_id`"]
55644                #[serde(rename = "project_id")]
55645                ProjectId,
55646                #[doc = "`user_id`"]
55647                #[serde(rename = "user_id")]
55648                UserId,
55649                #[doc = "`api_key_id`"]
55650                #[serde(rename = "api_key_id")]
55651                ApiKeyId,
55652                #[doc = "`model`"]
55653                #[serde(rename = "model")]
55654                Model,
55655                #[doc = "`size`"]
55656                #[serde(rename = "size")]
55657                Size,
55658                #[doc = "`source`"]
55659                #[serde(rename = "source")]
55660                Source,
55661            }
55662        }
55663    }
55664    #[derive(Clone, Debug, PartialEq)]
55665    #[serde_with::serde_as]
55666    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
55667    pub struct Params {
55668        #[doc = "Start time (Unix seconds) of the query time range, inclusive."]
55669        #[serde(rename = "start_time")]
55670        pub start_time: i64,
55671        #[doc = "End time (Unix seconds) of the query time range, exclusive."]
55672        #[serde(rename = "end_time")]
55673        #[serde(skip_serializing_if = "Option::is_none")]
55674        #[builder(default)]
55675        pub end_time: Option<i64>,
55676        #[doc = "Width of each time bucket in response. Currently `1m`, `1h` and `1d` are supported, default to `1d`."]
55677        #[serde(rename = "bucket_width")]
55678        #[serde(skip_serializing_if = "Option::is_none")]
55679        #[builder(default)]
55680        pub bucket_width: Option<crate::__types::usage_images::params::BucketWidth>,
55681        #[doc = "Return only usages for these sources. Possible values are `image.generation`, `image.edit`, `image.variation` or any combination of them."]
55682        #[serde(rename = "sources")]
55683        #[serde(skip_serializing_if = "Option::is_none")]
55684        #[builder(default)]
55685        pub sources: Option<Vec<crate::__types::usage_images::params::sources::Item>>,
55686        #[doc = "Return only usages for these image sizes. Possible values are `256x256`, `512x512`, `1024x1024`, `1792x1792`, `1024x1792` or any combination of them."]
55687        #[serde(rename = "sizes")]
55688        #[serde(skip_serializing_if = "Option::is_none")]
55689        #[builder(default)]
55690        pub sizes: Option<Vec<crate::__types::usage_images::params::sizes::Item>>,
55691        #[doc = "Return only usage for these projects."]
55692        #[serde(rename = "project_ids")]
55693        #[serde(skip_serializing_if = "Option::is_none")]
55694        #[builder(default)]
55695        pub project_ids: Option<Vec<String>>,
55696        #[doc = "Return only usage for these users."]
55697        #[serde(rename = "user_ids")]
55698        #[serde(skip_serializing_if = "Option::is_none")]
55699        #[builder(default)]
55700        pub user_ids: Option<Vec<String>>,
55701        #[doc = "Return only usage for these API keys."]
55702        #[serde(rename = "api_key_ids")]
55703        #[serde(skip_serializing_if = "Option::is_none")]
55704        #[builder(default)]
55705        pub api_key_ids: Option<Vec<String>>,
55706        #[doc = "Return only usage for these models."]
55707        #[serde(rename = "models")]
55708        #[serde(skip_serializing_if = "Option::is_none")]
55709        #[builder(default)]
55710        pub models: Option<Vec<String>>,
55711        #[doc = "Group the usage data by the specified fields. Support fields include `project_id`, `user_id`, `api_key_id`, `model`, `size`, `source` or any combination of them."]
55712        #[serde(rename = "group_by")]
55713        #[serde(skip_serializing_if = "Option::is_none")]
55714        #[builder(default)]
55715        pub group_by: Option<Vec<crate::__types::usage_images::params::group_by::Item>>,
55716        #[doc = "Specifies the number of buckets to return.\n- `bucket_width=1d`: default: 7, max: 31\n- `bucket_width=1h`: default: 24, max: 168\n- `bucket_width=1m`: default: 60, max: 1440\n"]
55717        #[serde(rename = "limit")]
55718        #[serde(skip_serializing_if = "Option::is_none")]
55719        #[builder(default)]
55720        pub limit: Option<i64>,
55721        #[doc = "A cursor for use in pagination. Corresponding to the `next_page` field from the previous response."]
55722        #[serde(rename = "page")]
55723        #[serde(skip_serializing_if = "Option::is_none")]
55724        #[builder(default)]
55725        pub page: Option<String>,
55726    }
55727}
55728#[allow(clippy::module_inception)]
55729pub mod usage_moderations {
55730    #[allow(clippy::module_inception)]
55731    pub mod params {
55732        #[doc = "Width of each time bucket in response. Currently `1m`, `1h` and `1d` are supported, default to `1d`."]
55733        #[derive(
55734            Clone, Copy, Debug, Default, PartialEq, serde :: Deserialize, serde :: Serialize,
55735        )]
55736        pub enum BucketWidth {
55737            #[doc = "`1m`"]
55738            #[serde(rename = "1m")]
55739            _1m,
55740            #[doc = "`1h`"]
55741            #[serde(rename = "1h")]
55742            _1h,
55743            #[doc = "`1d`"]
55744            #[default]
55745            #[serde(rename = "1d")]
55746            _1d,
55747        }
55748        #[allow(clippy::module_inception)]
55749        pub mod group_by {
55750            #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
55751            pub enum Item {
55752                #[doc = "`project_id`"]
55753                #[serde(rename = "project_id")]
55754                ProjectId,
55755                #[doc = "`user_id`"]
55756                #[serde(rename = "user_id")]
55757                UserId,
55758                #[doc = "`api_key_id`"]
55759                #[serde(rename = "api_key_id")]
55760                ApiKeyId,
55761                #[doc = "`model`"]
55762                #[serde(rename = "model")]
55763                Model,
55764            }
55765        }
55766    }
55767    #[derive(Clone, Debug, PartialEq)]
55768    #[serde_with::serde_as]
55769    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
55770    pub struct Params {
55771        #[doc = "Start time (Unix seconds) of the query time range, inclusive."]
55772        #[serde(rename = "start_time")]
55773        pub start_time: i64,
55774        #[doc = "End time (Unix seconds) of the query time range, exclusive."]
55775        #[serde(rename = "end_time")]
55776        #[serde(skip_serializing_if = "Option::is_none")]
55777        #[builder(default)]
55778        pub end_time: Option<i64>,
55779        #[doc = "Width of each time bucket in response. Currently `1m`, `1h` and `1d` are supported, default to `1d`."]
55780        #[serde(rename = "bucket_width")]
55781        #[serde(skip_serializing_if = "Option::is_none")]
55782        #[builder(default)]
55783        pub bucket_width: Option<crate::__types::usage_moderations::params::BucketWidth>,
55784        #[doc = "Return only usage for these projects."]
55785        #[serde(rename = "project_ids")]
55786        #[serde(skip_serializing_if = "Option::is_none")]
55787        #[builder(default)]
55788        pub project_ids: Option<Vec<String>>,
55789        #[doc = "Return only usage for these users."]
55790        #[serde(rename = "user_ids")]
55791        #[serde(skip_serializing_if = "Option::is_none")]
55792        #[builder(default)]
55793        pub user_ids: Option<Vec<String>>,
55794        #[doc = "Return only usage for these API keys."]
55795        #[serde(rename = "api_key_ids")]
55796        #[serde(skip_serializing_if = "Option::is_none")]
55797        #[builder(default)]
55798        pub api_key_ids: Option<Vec<String>>,
55799        #[doc = "Return only usage for these models."]
55800        #[serde(rename = "models")]
55801        #[serde(skip_serializing_if = "Option::is_none")]
55802        #[builder(default)]
55803        pub models: Option<Vec<String>>,
55804        #[doc = "Group the usage data by the specified fields. Support fields include `project_id`, `user_id`, `api_key_id`, `model` or any combination of them."]
55805        #[serde(rename = "group_by")]
55806        #[serde(skip_serializing_if = "Option::is_none")]
55807        #[builder(default)]
55808        pub group_by: Option<Vec<crate::__types::usage_moderations::params::group_by::Item>>,
55809        #[doc = "Specifies the number of buckets to return.\n- `bucket_width=1d`: default: 7, max: 31\n- `bucket_width=1h`: default: 24, max: 168\n- `bucket_width=1m`: default: 60, max: 1440\n"]
55810        #[serde(rename = "limit")]
55811        #[serde(skip_serializing_if = "Option::is_none")]
55812        #[builder(default)]
55813        pub limit: Option<i64>,
55814        #[doc = "A cursor for use in pagination. Corresponding to the `next_page` field from the previous response."]
55815        #[serde(rename = "page")]
55816        #[serde(skip_serializing_if = "Option::is_none")]
55817        #[builder(default)]
55818        pub page: Option<String>,
55819    }
55820}
55821#[allow(clippy::module_inception)]
55822pub mod usage_vector_stores {
55823    #[allow(clippy::module_inception)]
55824    pub mod params {
55825        #[doc = "Width of each time bucket in response. Currently `1m`, `1h` and `1d` are supported, default to `1d`."]
55826        #[derive(
55827            Clone, Copy, Debug, Default, PartialEq, serde :: Deserialize, serde :: Serialize,
55828        )]
55829        pub enum BucketWidth {
55830            #[doc = "`1m`"]
55831            #[serde(rename = "1m")]
55832            _1m,
55833            #[doc = "`1h`"]
55834            #[serde(rename = "1h")]
55835            _1h,
55836            #[doc = "`1d`"]
55837            #[default]
55838            #[serde(rename = "1d")]
55839            _1d,
55840        }
55841        #[allow(clippy::module_inception)]
55842        pub mod group_by {
55843            #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
55844            pub enum Item {
55845                #[doc = "`project_id`"]
55846                #[serde(rename = "project_id")]
55847                ProjectId,
55848            }
55849        }
55850    }
55851    #[derive(Clone, Debug, PartialEq)]
55852    #[serde_with::serde_as]
55853    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
55854    pub struct Params {
55855        #[doc = "Start time (Unix seconds) of the query time range, inclusive."]
55856        #[serde(rename = "start_time")]
55857        pub start_time: i64,
55858        #[doc = "End time (Unix seconds) of the query time range, exclusive."]
55859        #[serde(rename = "end_time")]
55860        #[serde(skip_serializing_if = "Option::is_none")]
55861        #[builder(default)]
55862        pub end_time: Option<i64>,
55863        #[doc = "Width of each time bucket in response. Currently `1m`, `1h` and `1d` are supported, default to `1d`."]
55864        #[serde(rename = "bucket_width")]
55865        #[serde(skip_serializing_if = "Option::is_none")]
55866        #[builder(default)]
55867        pub bucket_width: Option<crate::__types::usage_vector_stores::params::BucketWidth>,
55868        #[doc = "Return only usage for these projects."]
55869        #[serde(rename = "project_ids")]
55870        #[serde(skip_serializing_if = "Option::is_none")]
55871        #[builder(default)]
55872        pub project_ids: Option<Vec<String>>,
55873        #[doc = "Group the usage data by the specified fields. Support fields include `project_id`."]
55874        #[serde(rename = "group_by")]
55875        #[serde(skip_serializing_if = "Option::is_none")]
55876        #[builder(default)]
55877        pub group_by: Option<Vec<crate::__types::usage_vector_stores::params::group_by::Item>>,
55878        #[doc = "Specifies the number of buckets to return.\n- `bucket_width=1d`: default: 7, max: 31\n- `bucket_width=1h`: default: 24, max: 168\n- `bucket_width=1m`: default: 60, max: 1440\n"]
55879        #[serde(rename = "limit")]
55880        #[serde(skip_serializing_if = "Option::is_none")]
55881        #[builder(default)]
55882        pub limit: Option<i64>,
55883        #[doc = "A cursor for use in pagination. Corresponding to the `next_page` field from the previous response."]
55884        #[serde(rename = "page")]
55885        #[serde(skip_serializing_if = "Option::is_none")]
55886        #[builder(default)]
55887        pub page: Option<String>,
55888    }
55889}
55890#[allow(clippy::module_inception)]
55891pub mod list_users {
55892    #[derive(Clone, Debug, Default, PartialEq)]
55893    #[serde_with::serde_as]
55894    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
55895    pub struct Params {
55896        #[doc = "A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.\n"]
55897        #[serde(rename = "limit")]
55898        #[serde(skip_serializing_if = "Option::is_none")]
55899        #[builder(default)]
55900        pub limit: Option<i64>,
55901        #[doc = "A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.\n"]
55902        #[serde(rename = "after")]
55903        #[serde(skip_serializing_if = "Option::is_none")]
55904        #[builder(default)]
55905        pub after: Option<String>,
55906        #[doc = "Filter by the email address of users."]
55907        #[serde(rename = "emails")]
55908        #[serde(skip_serializing_if = "Option::is_none")]
55909        #[builder(default)]
55910        pub emails: Option<Vec<String>>,
55911    }
55912}
55913#[allow(clippy::module_inception)]
55914pub mod retrieve_user {
55915    #[derive(Clone, Debug, PartialEq)]
55916    #[serde_with::serde_as]
55917    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
55918    pub struct Params {
55919        #[doc = "The ID of the user."]
55920        #[serde(rename = "user_id")]
55921        pub user_id: String,
55922    }
55923}
55924#[allow(clippy::module_inception)]
55925pub mod modify_user {
55926    #[derive(Clone, Debug, PartialEq)]
55927    #[serde_with::serde_as]
55928    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
55929    pub struct Params {
55930        #[doc = "The ID of the user."]
55931        #[serde(rename = "user_id")]
55932        pub user_id: String,
55933    }
55934}
55935#[allow(clippy::module_inception)]
55936pub mod delete_user {
55937    #[derive(Clone, Debug, PartialEq)]
55938    #[serde_with::serde_as]
55939    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
55940    pub struct Params {
55941        #[doc = "The ID of the user."]
55942        #[serde(rename = "user_id")]
55943        pub user_id: String,
55944    }
55945}
55946#[allow(clippy::module_inception)]
55947pub mod get_response {
55948    #[derive(Clone, Debug, PartialEq)]
55949    #[serde_with::serde_as]
55950    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
55951    pub struct Params {
55952        #[doc = "The ID of the response to retrieve."]
55953        #[serde(rename = "response_id")]
55954        pub response_id: String,
55955        #[doc = "Additional fields to include in the response. See the `include`\nparameter for Response creation above for more information.\n"]
55956        #[serde(rename = "include")]
55957        #[serde(skip_serializing_if = "Option::is_none")]
55958        #[builder(default)]
55959        pub include: Option<Vec<crate::__types::Includable>>,
55960        #[doc = "If set to true, the model response data will be streamed to the client\nas 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).\nSee the [Streaming section below](https://platform.openai.com/docs/api-reference/responses-streaming)\nfor more information.\n"]
55961        #[serde(rename = "stream")]
55962        #[serde(skip_serializing_if = "Option::is_none")]
55963        #[builder(default)]
55964        pub stream: Option<bool>,
55965        #[doc = "The sequence number of the event after which to start streaming.\n"]
55966        #[serde(rename = "starting_after")]
55967        #[serde(skip_serializing_if = "Option::is_none")]
55968        #[builder(default)]
55969        pub starting_after: Option<i64>,
55970        #[doc = "When true, stream obfuscation will be enabled. Stream obfuscation adds\nrandom characters to an `obfuscation` field on streaming delta events\nto normalize payload sizes as a mitigation to certain side-channel\nattacks. These obfuscation fields are included by default, but add a\nsmall amount of overhead to the data stream. You can set\n`include_obfuscation` to false to optimize for bandwidth if you trust\nthe network links between your application and the OpenAI API.\n"]
55971        #[serde(rename = "include_obfuscation")]
55972        #[serde(skip_serializing_if = "Option::is_none")]
55973        #[builder(default)]
55974        pub include_obfuscation: Option<bool>,
55975    }
55976}
55977#[allow(clippy::module_inception)]
55978pub mod delete_response {
55979    #[derive(Clone, Debug, PartialEq)]
55980    #[serde_with::serde_as]
55981    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
55982    pub struct Params {
55983        #[doc = "The ID of the response to delete."]
55984        #[serde(rename = "response_id")]
55985        pub response_id: String,
55986    }
55987}
55988#[allow(clippy::module_inception)]
55989pub mod cancel_response {
55990    #[derive(Clone, Debug, PartialEq)]
55991    #[serde_with::serde_as]
55992    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
55993    pub struct Params {
55994        #[doc = "The ID of the response to cancel."]
55995        #[serde(rename = "response_id")]
55996        pub response_id: String,
55997    }
55998}
55999#[allow(clippy::module_inception)]
56000pub mod list_input_items {
56001    #[allow(clippy::module_inception)]
56002    pub mod params {
56003        #[doc = "The order to return the input items in. Default is `desc`.\n- `asc`: Return the input items in ascending order.\n- `desc`: Return the input items in descending order.\n"]
56004        #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
56005        pub enum Order {
56006            #[doc = "`asc`"]
56007            #[serde(rename = "asc")]
56008            Asc,
56009            #[doc = "`desc`"]
56010            #[serde(rename = "desc")]
56011            Desc,
56012        }
56013    }
56014    #[derive(Clone, Debug, PartialEq)]
56015    #[serde_with::serde_as]
56016    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
56017    pub struct Params {
56018        #[doc = "The ID of the response to retrieve input items for."]
56019        #[serde(rename = "response_id")]
56020        pub response_id: String,
56021        #[doc = "A limit on the number of objects to be returned. Limit can range between\n1 and 100, and the default is 20.\n"]
56022        #[serde(rename = "limit")]
56023        #[serde(skip_serializing_if = "Option::is_none")]
56024        #[builder(default)]
56025        pub limit: Option<i64>,
56026        #[doc = "The order to return the input items in. Default is `desc`.\n- `asc`: Return the input items in ascending order.\n- `desc`: Return the input items in descending order.\n"]
56027        #[serde(rename = "order")]
56028        #[serde(skip_serializing_if = "Option::is_none")]
56029        #[builder(default)]
56030        pub order: Option<crate::__types::list_input_items::params::Order>,
56031        #[doc = "An item ID to list items after, used in pagination.\n"]
56032        #[serde(rename = "after")]
56033        #[serde(skip_serializing_if = "Option::is_none")]
56034        #[builder(default)]
56035        pub after: Option<String>,
56036        #[doc = "Additional fields to include in the response. See the `include`\nparameter for Response creation above for more information.\n"]
56037        #[serde(rename = "include")]
56038        #[serde(skip_serializing_if = "Option::is_none")]
56039        #[builder(default)]
56040        pub include: Option<Vec<crate::__types::Includable>>,
56041    }
56042}
56043#[allow(clippy::module_inception)]
56044pub mod get_thread {
56045    #[derive(Clone, Debug, PartialEq)]
56046    #[serde_with::serde_as]
56047    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
56048    pub struct Params {
56049        #[doc = "The ID of the thread to retrieve."]
56050        #[serde(rename = "thread_id")]
56051        pub thread_id: String,
56052    }
56053}
56054#[allow(clippy::module_inception)]
56055pub mod modify_thread {
56056    #[derive(Clone, Debug, PartialEq)]
56057    #[serde_with::serde_as]
56058    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
56059    pub struct Params {
56060        #[doc = "The ID of the thread to modify. Only the `metadata` can be modified."]
56061        #[serde(rename = "thread_id")]
56062        pub thread_id: String,
56063    }
56064}
56065#[allow(clippy::module_inception)]
56066pub mod delete_thread {
56067    #[derive(Clone, Debug, PartialEq)]
56068    #[serde_with::serde_as]
56069    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
56070    pub struct Params {
56071        #[doc = "The ID of the thread to delete."]
56072        #[serde(rename = "thread_id")]
56073        pub thread_id: String,
56074    }
56075}
56076#[allow(clippy::module_inception)]
56077pub mod list_messages {
56078    #[allow(clippy::module_inception)]
56079    pub mod params {
56080        #[doc = "Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order.\n"]
56081        #[derive(
56082            Clone, Copy, Debug, Default, PartialEq, serde :: Deserialize, serde :: Serialize,
56083        )]
56084        pub enum Order {
56085            #[doc = "`asc`"]
56086            #[serde(rename = "asc")]
56087            Asc,
56088            #[doc = "`desc`"]
56089            #[default]
56090            #[serde(rename = "desc")]
56091            Desc,
56092        }
56093    }
56094    #[derive(Clone, Debug, PartialEq)]
56095    #[serde_with::serde_as]
56096    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
56097    pub struct Params {
56098        #[doc = "The ID of the [thread](https://platform.openai.com/docs/api-reference/threads) the messages belong to."]
56099        #[serde(rename = "thread_id")]
56100        pub thread_id: String,
56101        #[doc = "A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.\n"]
56102        #[serde(rename = "limit")]
56103        #[serde(skip_serializing_if = "Option::is_none")]
56104        #[builder(default)]
56105        pub limit: Option<i64>,
56106        #[doc = "Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order.\n"]
56107        #[serde(rename = "order")]
56108        #[serde(skip_serializing_if = "Option::is_none")]
56109        #[builder(default)]
56110        pub order: Option<crate::__types::list_messages::params::Order>,
56111        #[doc = "A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.\n"]
56112        #[serde(rename = "after")]
56113        #[serde(skip_serializing_if = "Option::is_none")]
56114        #[builder(default)]
56115        pub after: Option<String>,
56116        #[doc = "A cursor for use in pagination. `before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.\n"]
56117        #[serde(rename = "before")]
56118        #[serde(skip_serializing_if = "Option::is_none")]
56119        #[builder(default)]
56120        pub before: Option<String>,
56121        #[doc = "Filter messages by the run ID that generated them.\n"]
56122        #[serde(rename = "run_id")]
56123        #[serde(skip_serializing_if = "Option::is_none")]
56124        #[builder(default)]
56125        pub run_id: Option<String>,
56126    }
56127}
56128#[allow(clippy::module_inception)]
56129pub mod create_message {
56130    #[derive(Clone, Debug, PartialEq)]
56131    #[serde_with::serde_as]
56132    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
56133    pub struct Params {
56134        #[doc = "The ID of the [thread](https://platform.openai.com/docs/api-reference/threads) to create a message for."]
56135        #[serde(rename = "thread_id")]
56136        pub thread_id: String,
56137    }
56138}
56139#[allow(clippy::module_inception)]
56140pub mod get_message {
56141    #[derive(Clone, Debug, PartialEq)]
56142    #[serde_with::serde_as]
56143    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
56144    pub struct Params {
56145        #[doc = "The ID of the [thread](https://platform.openai.com/docs/api-reference/threads) to which this message belongs."]
56146        #[serde(rename = "thread_id")]
56147        pub thread_id: String,
56148        #[doc = "The ID of the message to retrieve."]
56149        #[serde(rename = "message_id")]
56150        pub message_id: String,
56151    }
56152}
56153#[allow(clippy::module_inception)]
56154pub mod modify_message {
56155    #[derive(Clone, Debug, PartialEq)]
56156    #[serde_with::serde_as]
56157    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
56158    pub struct Params {
56159        #[doc = "The ID of the thread to which this message belongs."]
56160        #[serde(rename = "thread_id")]
56161        pub thread_id: String,
56162        #[doc = "The ID of the message to modify."]
56163        #[serde(rename = "message_id")]
56164        pub message_id: String,
56165    }
56166}
56167#[allow(clippy::module_inception)]
56168pub mod delete_message {
56169    #[derive(Clone, Debug, PartialEq)]
56170    #[serde_with::serde_as]
56171    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
56172    pub struct Params {
56173        #[doc = "The ID of the thread to which this message belongs."]
56174        #[serde(rename = "thread_id")]
56175        pub thread_id: String,
56176        #[doc = "The ID of the message to delete."]
56177        #[serde(rename = "message_id")]
56178        pub message_id: String,
56179    }
56180}
56181#[allow(clippy::module_inception)]
56182pub mod list_runs {
56183    #[allow(clippy::module_inception)]
56184    pub mod params {
56185        #[doc = "Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order.\n"]
56186        #[derive(
56187            Clone, Copy, Debug, Default, PartialEq, serde :: Deserialize, serde :: Serialize,
56188        )]
56189        pub enum Order {
56190            #[doc = "`asc`"]
56191            #[serde(rename = "asc")]
56192            Asc,
56193            #[doc = "`desc`"]
56194            #[default]
56195            #[serde(rename = "desc")]
56196            Desc,
56197        }
56198    }
56199    #[derive(Clone, Debug, PartialEq)]
56200    #[serde_with::serde_as]
56201    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
56202    pub struct Params {
56203        #[doc = "The ID of the thread the run belongs to."]
56204        #[serde(rename = "thread_id")]
56205        pub thread_id: String,
56206        #[doc = "A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.\n"]
56207        #[serde(rename = "limit")]
56208        #[serde(skip_serializing_if = "Option::is_none")]
56209        #[builder(default)]
56210        pub limit: Option<i64>,
56211        #[doc = "Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order.\n"]
56212        #[serde(rename = "order")]
56213        #[serde(skip_serializing_if = "Option::is_none")]
56214        #[builder(default)]
56215        pub order: Option<crate::__types::list_runs::params::Order>,
56216        #[doc = "A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.\n"]
56217        #[serde(rename = "after")]
56218        #[serde(skip_serializing_if = "Option::is_none")]
56219        #[builder(default)]
56220        pub after: Option<String>,
56221        #[doc = "A cursor for use in pagination. `before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.\n"]
56222        #[serde(rename = "before")]
56223        #[serde(skip_serializing_if = "Option::is_none")]
56224        #[builder(default)]
56225        pub before: Option<String>,
56226    }
56227}
56228#[allow(clippy::module_inception)]
56229pub mod create_run {
56230    #[allow(clippy::module_inception)]
56231    pub mod params {
56232        #[allow(clippy::module_inception)]
56233        pub mod include {
56234            #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
56235            pub enum Item {
56236                #[doc = "`step_details.tool_calls[*].file_search.results[*].content`"]
56237                #[serde(rename = "step_details.tool_calls[*].file_search.results[*].content")]
56238                StepDetailsToolCallsFileSearchResultsContent,
56239            }
56240        }
56241    }
56242    #[derive(Clone, Debug, PartialEq)]
56243    #[serde_with::serde_as]
56244    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
56245    pub struct Params {
56246        #[doc = "The ID of the thread to run."]
56247        #[serde(rename = "thread_id")]
56248        pub thread_id: String,
56249        #[doc = "A list of additional fields to include in the response. Currently the only supported value is `step_details.tool_calls[*].file_search.results[*].content` to fetch the file search result content.\n\nSee the [file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search#customizing-file-search-settings) for more information.\n"]
56250        #[serde(rename = "include[]")]
56251        #[serde(skip_serializing_if = "Option::is_none")]
56252        #[builder(default)]
56253        pub include: Option<Vec<crate::__types::create_run::params::include::Item>>,
56254    }
56255}
56256#[allow(clippy::module_inception)]
56257pub mod get_run {
56258    #[derive(Clone, Debug, PartialEq)]
56259    #[serde_with::serde_as]
56260    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
56261    pub struct Params {
56262        #[doc = "The ID of the [thread](https://platform.openai.com/docs/api-reference/threads) that was run."]
56263        #[serde(rename = "thread_id")]
56264        pub thread_id: String,
56265        #[doc = "The ID of the run to retrieve."]
56266        #[serde(rename = "run_id")]
56267        pub run_id: String,
56268    }
56269}
56270#[allow(clippy::module_inception)]
56271pub mod modify_run {
56272    #[derive(Clone, Debug, PartialEq)]
56273    #[serde_with::serde_as]
56274    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
56275    pub struct Params {
56276        #[doc = "The ID of the [thread](https://platform.openai.com/docs/api-reference/threads) that was run."]
56277        #[serde(rename = "thread_id")]
56278        pub thread_id: String,
56279        #[doc = "The ID of the run to modify."]
56280        #[serde(rename = "run_id")]
56281        pub run_id: String,
56282    }
56283}
56284#[allow(clippy::module_inception)]
56285pub mod cancel_run {
56286    #[derive(Clone, Debug, PartialEq)]
56287    #[serde_with::serde_as]
56288    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
56289    pub struct Params {
56290        #[doc = "The ID of the thread to which this run belongs."]
56291        #[serde(rename = "thread_id")]
56292        pub thread_id: String,
56293        #[doc = "The ID of the run to cancel."]
56294        #[serde(rename = "run_id")]
56295        pub run_id: String,
56296    }
56297}
56298#[allow(clippy::module_inception)]
56299pub mod list_run_steps {
56300    #[allow(clippy::module_inception)]
56301    pub mod params {
56302        #[doc = "Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order.\n"]
56303        #[derive(
56304            Clone, Copy, Debug, Default, PartialEq, serde :: Deserialize, serde :: Serialize,
56305        )]
56306        pub enum Order {
56307            #[doc = "`asc`"]
56308            #[serde(rename = "asc")]
56309            Asc,
56310            #[doc = "`desc`"]
56311            #[default]
56312            #[serde(rename = "desc")]
56313            Desc,
56314        }
56315        #[allow(clippy::module_inception)]
56316        pub mod include {
56317            #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
56318            pub enum Item {
56319                #[doc = "`step_details.tool_calls[*].file_search.results[*].content`"]
56320                #[serde(rename = "step_details.tool_calls[*].file_search.results[*].content")]
56321                StepDetailsToolCallsFileSearchResultsContent,
56322            }
56323        }
56324    }
56325    #[derive(Clone, Debug, PartialEq)]
56326    #[serde_with::serde_as]
56327    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
56328    pub struct Params {
56329        #[doc = "The ID of the thread the run and run steps belong to."]
56330        #[serde(rename = "thread_id")]
56331        pub thread_id: String,
56332        #[doc = "The ID of the run the run steps belong to."]
56333        #[serde(rename = "run_id")]
56334        pub run_id: String,
56335        #[doc = "A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.\n"]
56336        #[serde(rename = "limit")]
56337        #[serde(skip_serializing_if = "Option::is_none")]
56338        #[builder(default)]
56339        pub limit: Option<i64>,
56340        #[doc = "Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order.\n"]
56341        #[serde(rename = "order")]
56342        #[serde(skip_serializing_if = "Option::is_none")]
56343        #[builder(default)]
56344        pub order: Option<crate::__types::list_run_steps::params::Order>,
56345        #[doc = "A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.\n"]
56346        #[serde(rename = "after")]
56347        #[serde(skip_serializing_if = "Option::is_none")]
56348        #[builder(default)]
56349        pub after: Option<String>,
56350        #[doc = "A cursor for use in pagination. `before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.\n"]
56351        #[serde(rename = "before")]
56352        #[serde(skip_serializing_if = "Option::is_none")]
56353        #[builder(default)]
56354        pub before: Option<String>,
56355        #[doc = "A list of additional fields to include in the response. Currently the only supported value is `step_details.tool_calls[*].file_search.results[*].content` to fetch the file search result content.\n\nSee the [file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search#customizing-file-search-settings) for more information.\n"]
56356        #[serde(rename = "include[]")]
56357        #[serde(skip_serializing_if = "Option::is_none")]
56358        #[builder(default)]
56359        pub include: Option<Vec<crate::__types::list_run_steps::params::include::Item>>,
56360    }
56361}
56362#[allow(clippy::module_inception)]
56363pub mod get_run_step {
56364    #[allow(clippy::module_inception)]
56365    pub mod params {
56366        #[allow(clippy::module_inception)]
56367        pub mod include {
56368            #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
56369            pub enum Item {
56370                #[doc = "`step_details.tool_calls[*].file_search.results[*].content`"]
56371                #[serde(rename = "step_details.tool_calls[*].file_search.results[*].content")]
56372                StepDetailsToolCallsFileSearchResultsContent,
56373            }
56374        }
56375    }
56376    #[derive(Clone, Debug, PartialEq)]
56377    #[serde_with::serde_as]
56378    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
56379    pub struct Params {
56380        #[doc = "The ID of the thread to which the run and run step belongs."]
56381        #[serde(rename = "thread_id")]
56382        pub thread_id: String,
56383        #[doc = "The ID of the run to which the run step belongs."]
56384        #[serde(rename = "run_id")]
56385        pub run_id: String,
56386        #[doc = "The ID of the run step to retrieve."]
56387        #[serde(rename = "step_id")]
56388        pub step_id: String,
56389        #[doc = "A list of additional fields to include in the response. Currently the only supported value is `step_details.tool_calls[*].file_search.results[*].content` to fetch the file search result content.\n\nSee the [file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search#customizing-file-search-settings) for more information.\n"]
56390        #[serde(rename = "include[]")]
56391        #[serde(skip_serializing_if = "Option::is_none")]
56392        #[builder(default)]
56393        pub include: Option<Vec<crate::__types::get_run_step::params::include::Item>>,
56394    }
56395}
56396#[allow(clippy::module_inception)]
56397pub mod submit_tool_ouputs_to_run {
56398    #[derive(Clone, Debug, PartialEq)]
56399    #[serde_with::serde_as]
56400    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
56401    pub struct Params {
56402        #[doc = "The ID of the [thread](https://platform.openai.com/docs/api-reference/threads) to which this run belongs."]
56403        #[serde(rename = "thread_id")]
56404        pub thread_id: String,
56405        #[doc = "The ID of the run that requires the tool output submission."]
56406        #[serde(rename = "run_id")]
56407        pub run_id: String,
56408    }
56409}
56410#[allow(clippy::module_inception)]
56411pub mod cancel_upload {
56412    #[derive(Clone, Debug, PartialEq)]
56413    #[serde_with::serde_as]
56414    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
56415    pub struct Params {
56416        #[doc = "The ID of the Upload.\n"]
56417        #[serde(rename = "upload_id")]
56418        pub upload_id: String,
56419    }
56420}
56421#[allow(clippy::module_inception)]
56422pub mod complete_upload {
56423    #[derive(Clone, Debug, PartialEq)]
56424    #[serde_with::serde_as]
56425    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
56426    pub struct Params {
56427        #[doc = "The ID of the Upload.\n"]
56428        #[serde(rename = "upload_id")]
56429        pub upload_id: String,
56430    }
56431}
56432#[allow(clippy::module_inception)]
56433pub mod add_upload_part {
56434    #[derive(Clone, Debug, PartialEq)]
56435    #[serde_with::serde_as]
56436    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
56437    pub struct Params {
56438        #[doc = "The ID of the Upload.\n"]
56439        #[serde(rename = "upload_id")]
56440        pub upload_id: String,
56441    }
56442}
56443#[allow(clippy::module_inception)]
56444pub mod list_vector_stores {
56445    #[allow(clippy::module_inception)]
56446    pub mod params {
56447        #[doc = "Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order.\n"]
56448        #[derive(
56449            Clone, Copy, Debug, Default, PartialEq, serde :: Deserialize, serde :: Serialize,
56450        )]
56451        pub enum Order {
56452            #[doc = "`asc`"]
56453            #[serde(rename = "asc")]
56454            Asc,
56455            #[doc = "`desc`"]
56456            #[default]
56457            #[serde(rename = "desc")]
56458            Desc,
56459        }
56460    }
56461    #[derive(Clone, Debug, Default, PartialEq)]
56462    #[serde_with::serde_as]
56463    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
56464    pub struct Params {
56465        #[doc = "A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.\n"]
56466        #[serde(rename = "limit")]
56467        #[serde(skip_serializing_if = "Option::is_none")]
56468        #[builder(default)]
56469        pub limit: Option<i64>,
56470        #[doc = "Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order.\n"]
56471        #[serde(rename = "order")]
56472        #[serde(skip_serializing_if = "Option::is_none")]
56473        #[builder(default)]
56474        pub order: Option<crate::__types::list_vector_stores::params::Order>,
56475        #[doc = "A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.\n"]
56476        #[serde(rename = "after")]
56477        #[serde(skip_serializing_if = "Option::is_none")]
56478        #[builder(default)]
56479        pub after: Option<String>,
56480        #[doc = "A cursor for use in pagination. `before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.\n"]
56481        #[serde(rename = "before")]
56482        #[serde(skip_serializing_if = "Option::is_none")]
56483        #[builder(default)]
56484        pub before: Option<String>,
56485    }
56486}
56487#[allow(clippy::module_inception)]
56488pub mod get_vector_store {
56489    #[derive(Clone, Debug, PartialEq)]
56490    #[serde_with::serde_as]
56491    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
56492    pub struct Params {
56493        #[doc = "The ID of the vector store to retrieve."]
56494        #[serde(rename = "vector_store_id")]
56495        pub vector_store_id: String,
56496    }
56497}
56498#[allow(clippy::module_inception)]
56499pub mod modify_vector_store {
56500    #[derive(Clone, Debug, PartialEq)]
56501    #[serde_with::serde_as]
56502    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
56503    pub struct Params {
56504        #[doc = "The ID of the vector store to modify."]
56505        #[serde(rename = "vector_store_id")]
56506        pub vector_store_id: String,
56507    }
56508}
56509#[allow(clippy::module_inception)]
56510pub mod delete_vector_store {
56511    #[derive(Clone, Debug, PartialEq)]
56512    #[serde_with::serde_as]
56513    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
56514    pub struct Params {
56515        #[doc = "The ID of the vector store to delete."]
56516        #[serde(rename = "vector_store_id")]
56517        pub vector_store_id: String,
56518    }
56519}
56520#[allow(clippy::module_inception)]
56521pub mod create_vector_store_file_batch {
56522    #[derive(Clone, Debug, PartialEq)]
56523    #[serde_with::serde_as]
56524    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
56525    pub struct Params {
56526        #[doc = "The ID of the vector store for which to create a File Batch.\n"]
56527        #[serde(rename = "vector_store_id")]
56528        pub vector_store_id: String,
56529    }
56530}
56531#[allow(clippy::module_inception)]
56532pub mod get_vector_store_file_batch {
56533    #[derive(Clone, Debug, PartialEq)]
56534    #[serde_with::serde_as]
56535    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
56536    pub struct Params {
56537        #[doc = "The ID of the vector store that the file batch belongs to."]
56538        #[serde(rename = "vector_store_id")]
56539        pub vector_store_id: String,
56540        #[doc = "The ID of the file batch being retrieved."]
56541        #[serde(rename = "batch_id")]
56542        pub batch_id: String,
56543    }
56544}
56545#[allow(clippy::module_inception)]
56546pub mod cancel_vector_store_file_batch {
56547    #[derive(Clone, Debug, PartialEq)]
56548    #[serde_with::serde_as]
56549    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
56550    pub struct Params {
56551        #[doc = "The ID of the vector store that the file batch belongs to."]
56552        #[serde(rename = "vector_store_id")]
56553        pub vector_store_id: String,
56554        #[doc = "The ID of the file batch to cancel."]
56555        #[serde(rename = "batch_id")]
56556        pub batch_id: String,
56557    }
56558}
56559#[allow(clippy::module_inception)]
56560pub mod list_files_in_vector_store_batch {
56561    #[allow(clippy::module_inception)]
56562    pub mod params {
56563        #[doc = "Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order.\n"]
56564        #[derive(
56565            Clone, Copy, Debug, Default, PartialEq, serde :: Deserialize, serde :: Serialize,
56566        )]
56567        pub enum Order {
56568            #[doc = "`asc`"]
56569            #[serde(rename = "asc")]
56570            Asc,
56571            #[doc = "`desc`"]
56572            #[default]
56573            #[serde(rename = "desc")]
56574            Desc,
56575        }
56576        #[doc = "Filter by file status. One of `in_progress`, `completed`, `failed`, `cancelled`."]
56577        #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
56578        pub enum Filter {
56579            #[doc = "`in_progress`"]
56580            #[serde(rename = "in_progress")]
56581            InProgress,
56582            #[doc = "`completed`"]
56583            #[serde(rename = "completed")]
56584            Completed,
56585            #[doc = "`failed`"]
56586            #[serde(rename = "failed")]
56587            Failed,
56588            #[doc = "`cancelled`"]
56589            #[serde(rename = "cancelled")]
56590            Cancelled,
56591        }
56592    }
56593    #[derive(Clone, Debug, PartialEq)]
56594    #[serde_with::serde_as]
56595    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
56596    pub struct Params {
56597        #[doc = "The ID of the vector store that the files belong to."]
56598        #[serde(rename = "vector_store_id")]
56599        pub vector_store_id: String,
56600        #[doc = "The ID of the file batch that the files belong to."]
56601        #[serde(rename = "batch_id")]
56602        pub batch_id: String,
56603        #[doc = "A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.\n"]
56604        #[serde(rename = "limit")]
56605        #[serde(skip_serializing_if = "Option::is_none")]
56606        #[builder(default)]
56607        pub limit: Option<i64>,
56608        #[doc = "Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order.\n"]
56609        #[serde(rename = "order")]
56610        #[serde(skip_serializing_if = "Option::is_none")]
56611        #[builder(default)]
56612        pub order: Option<crate::__types::list_files_in_vector_store_batch::params::Order>,
56613        #[doc = "A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.\n"]
56614        #[serde(rename = "after")]
56615        #[serde(skip_serializing_if = "Option::is_none")]
56616        #[builder(default)]
56617        pub after: Option<String>,
56618        #[doc = "A cursor for use in pagination. `before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.\n"]
56619        #[serde(rename = "before")]
56620        #[serde(skip_serializing_if = "Option::is_none")]
56621        #[builder(default)]
56622        pub before: Option<String>,
56623        #[doc = "Filter by file status. One of `in_progress`, `completed`, `failed`, `cancelled`."]
56624        #[serde(rename = "filter")]
56625        #[serde(skip_serializing_if = "Option::is_none")]
56626        #[builder(default)]
56627        pub filter: Option<crate::__types::list_files_in_vector_store_batch::params::Filter>,
56628    }
56629}
56630#[allow(clippy::module_inception)]
56631pub mod list_vector_store_files {
56632    #[allow(clippy::module_inception)]
56633    pub mod params {
56634        #[doc = "Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order.\n"]
56635        #[derive(
56636            Clone, Copy, Debug, Default, PartialEq, serde :: Deserialize, serde :: Serialize,
56637        )]
56638        pub enum Order {
56639            #[doc = "`asc`"]
56640            #[serde(rename = "asc")]
56641            Asc,
56642            #[doc = "`desc`"]
56643            #[default]
56644            #[serde(rename = "desc")]
56645            Desc,
56646        }
56647        #[doc = "Filter by file status. One of `in_progress`, `completed`, `failed`, `cancelled`."]
56648        #[derive(Clone, Copy, Debug, PartialEq, serde :: Deserialize, serde :: Serialize)]
56649        pub enum Filter {
56650            #[doc = "`in_progress`"]
56651            #[serde(rename = "in_progress")]
56652            InProgress,
56653            #[doc = "`completed`"]
56654            #[serde(rename = "completed")]
56655            Completed,
56656            #[doc = "`failed`"]
56657            #[serde(rename = "failed")]
56658            Failed,
56659            #[doc = "`cancelled`"]
56660            #[serde(rename = "cancelled")]
56661            Cancelled,
56662        }
56663    }
56664    #[derive(Clone, Debug, PartialEq)]
56665    #[serde_with::serde_as]
56666    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
56667    pub struct Params {
56668        #[doc = "The ID of the vector store that the files belong to."]
56669        #[serde(rename = "vector_store_id")]
56670        pub vector_store_id: String,
56671        #[doc = "A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.\n"]
56672        #[serde(rename = "limit")]
56673        #[serde(skip_serializing_if = "Option::is_none")]
56674        #[builder(default)]
56675        pub limit: Option<i64>,
56676        #[doc = "Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order.\n"]
56677        #[serde(rename = "order")]
56678        #[serde(skip_serializing_if = "Option::is_none")]
56679        #[builder(default)]
56680        pub order: Option<crate::__types::list_vector_store_files::params::Order>,
56681        #[doc = "A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.\n"]
56682        #[serde(rename = "after")]
56683        #[serde(skip_serializing_if = "Option::is_none")]
56684        #[builder(default)]
56685        pub after: Option<String>,
56686        #[doc = "A cursor for use in pagination. `before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.\n"]
56687        #[serde(rename = "before")]
56688        #[serde(skip_serializing_if = "Option::is_none")]
56689        #[builder(default)]
56690        pub before: Option<String>,
56691        #[doc = "Filter by file status. One of `in_progress`, `completed`, `failed`, `cancelled`."]
56692        #[serde(rename = "filter")]
56693        #[serde(skip_serializing_if = "Option::is_none")]
56694        #[builder(default)]
56695        pub filter: Option<crate::__types::list_vector_store_files::params::Filter>,
56696    }
56697}
56698#[allow(clippy::module_inception)]
56699pub mod create_vector_store_file {
56700    #[derive(Clone, Debug, PartialEq)]
56701    #[serde_with::serde_as]
56702    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
56703    pub struct Params {
56704        #[doc = "The ID of the vector store for which to create a File.\n"]
56705        #[serde(rename = "vector_store_id")]
56706        pub vector_store_id: String,
56707    }
56708}
56709#[allow(clippy::module_inception)]
56710pub mod get_vector_store_file {
56711    #[derive(Clone, Debug, PartialEq)]
56712    #[serde_with::serde_as]
56713    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
56714    pub struct Params {
56715        #[doc = "The ID of the vector store that the file belongs to."]
56716        #[serde(rename = "vector_store_id")]
56717        pub vector_store_id: String,
56718        #[doc = "The ID of the file being retrieved."]
56719        #[serde(rename = "file_id")]
56720        pub file_id: String,
56721    }
56722}
56723#[allow(clippy::module_inception)]
56724pub mod delete_vector_store_file {
56725    #[derive(Clone, Debug, PartialEq)]
56726    #[serde_with::serde_as]
56727    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
56728    pub struct Params {
56729        #[doc = "The ID of the vector store that the file belongs to."]
56730        #[serde(rename = "vector_store_id")]
56731        pub vector_store_id: String,
56732        #[doc = "The ID of the file to delete."]
56733        #[serde(rename = "file_id")]
56734        pub file_id: String,
56735    }
56736}
56737#[allow(clippy::module_inception)]
56738pub mod update_vector_store_file_attributes {
56739    #[derive(Clone, Debug, PartialEq)]
56740    #[serde_with::serde_as]
56741    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
56742    pub struct Params {
56743        #[doc = "The ID of the vector store the file belongs to."]
56744        #[serde(rename = "vector_store_id")]
56745        pub vector_store_id: String,
56746        #[doc = "The ID of the file to update attributes."]
56747        #[serde(rename = "file_id")]
56748        pub file_id: String,
56749    }
56750}
56751#[allow(clippy::module_inception)]
56752pub mod retrieve_vector_store_file_content {
56753    #[derive(Clone, Debug, PartialEq)]
56754    #[serde_with::serde_as]
56755    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
56756    pub struct Params {
56757        #[doc = "The ID of the vector store."]
56758        #[serde(rename = "vector_store_id")]
56759        pub vector_store_id: String,
56760        #[doc = "The ID of the file within the vector store."]
56761        #[serde(rename = "file_id")]
56762        pub file_id: String,
56763    }
56764}
56765#[allow(clippy::module_inception)]
56766pub mod search_vector_store {
56767    #[derive(Clone, Debug, PartialEq)]
56768    #[serde_with::serde_as]
56769    #[derive(serde :: Deserialize, serde :: Serialize, typed_builder :: TypedBuilder)]
56770    pub struct Params {
56771        #[doc = "The ID of the vector store to search."]
56772        #[serde(rename = "vector_store_id")]
56773        pub vector_store_id: String,
56774    }
56775}