openai-types 0.1.2

Typed OpenAI API models — zero dependencies beyond serde
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
// AUTO-GENERATED by py2rust — do not edit.
// Re-generate: python3 scripts/py2rust.py sync <python_dir> <rust_dir>
// Domain: chat
#![allow(unused_imports)]

use super::*;
use serde::{Deserialize, Serialize};

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum ChatCompletionChoiceFinishReason {
    #[serde(rename = "stop")]
    Stop,
    #[serde(rename = "length")]
    Length,
    #[serde(rename = "tool_calls")]
    ToolCalls,
    #[serde(rename = "content_filter")]
    ContentFilter,
    #[serde(rename = "function_call")]
    FunctionCall,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum ChatCompletionServiceTier {
    #[serde(rename = "auto")]
    Auto,
    #[serde(rename = "default")]
    Default,
    #[serde(rename = "flex")]
    Flex,
    #[serde(rename = "scale")]
    Scale,
    #[serde(rename = "priority")]
    Priority,
}

/// Represents a chat completion response returned by model, based on the provided input.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ChatCompletion {
    /// A unique identifier for the chat completion.
    pub id: String,
    /// A list of chat completion choices.
    pub choices: Vec<serde_json::Value>,
    /// The Unix timestamp (in seconds) of when the chat completion was created.
    pub created: i64,
    /// The model used for the chat completion.
    pub model: String,
    /// The object type, which is always `chat.completion`.
    pub object: String,
    /// Specifies the processing type used for serving the request.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub service_tier: Option<ChatCompletionServiceTier>,
    /// This fingerprint represents the backend configuration that the model runs with.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub system_fingerprint: Option<String>,
    /// Usage statistics for the completion request.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub usage: Option<serde_json::Value>,
}

/// If the audio output modality is requested, this object contains data
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ChatCompletionAudio {
    /// Unique identifier for this audio response.
    pub id: String,
    /// Base64 encoded audio bytes generated by the model, in the format specified in
    pub data: String,
    /// The Unix timestamp (in seconds) for when this audio response will no longer be
    pub expires_at: i64,
    /// Transcript of the audio generated by the model.
    pub transcript: String,
}

/// Deprecated and replaced by `tool_calls`.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ChoiceDeltaFunctionCall {
    /// The arguments to call the function with, as generated by the model in JSON
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub arguments: Option<String>,
    /// The name of the function to call.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub name: Option<String>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ChoiceDeltaToolCallFunction {
    /// The arguments to call the function with, as generated by the model in JSON
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub arguments: Option<String>,
    /// The name of the function to call.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub name: Option<String>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ChoiceDeltaToolCall {
    pub index: i64,
    /// The ID of the tool call.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub id: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub function: Option<ChoiceDeltaToolCallFunction>,
    /// The type of the tool. Currently, only `function` is supported.
    #[serde(rename = "type", skip_serializing_if = "Option::is_none", default)]
    pub type_: Option<String>,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum ChoiceDeltaRole {
    #[serde(rename = "developer")]
    Developer,
    #[serde(rename = "system")]
    System,
    #[serde(rename = "user")]
    User,
    #[serde(rename = "assistant")]
    Assistant,
    #[serde(rename = "tool")]
    Tool,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum ChunkChoiceFinishReason {
    #[serde(rename = "stop")]
    Stop,
    #[serde(rename = "length")]
    Length,
    #[serde(rename = "tool_calls")]
    ToolCalls,
    #[serde(rename = "content_filter")]
    ContentFilter,
    #[serde(rename = "function_call")]
    FunctionCall,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum ChatCompletionChunkServiceTier {
    #[serde(rename = "auto")]
    Auto,
    #[serde(rename = "default")]
    Default,
    #[serde(rename = "flex")]
    Flex,
    #[serde(rename = "scale")]
    Scale,
    #[serde(rename = "priority")]
    Priority,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum ImageURLDetail {
    #[serde(rename = "auto")]
    Auto,
    #[serde(rename = "low")]
    Low,
    #[serde(rename = "high")]
    High,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ImageURL {
    /// Either a URL of the image or the base64 encoded image data.
    pub url: String,
    /// Specifies the detail level of the image.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub detail: Option<ImageURLDetail>,
}

/// Learn about [image inputs](https://platform.openai.com/docs/guides/vision).
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ChatCompletionContentPartImage {
    pub image_url: ImageURL,
    /// The type of the content part.
    #[serde(rename = "type")]
    pub type_: String,
}

/// Learn about [text inputs](https://platform.openai.com/docs/guides/text-generation).
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ChatCompletionContentPartText {
    /// The text content.
    pub text: String,
    /// The type of the content part.
    #[serde(rename = "type")]
    pub type_: String,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ChatCompletionDeleted {
    /// The ID of the chat completion that was deleted.
    pub id: String,
    /// Whether the chat completion was deleted.
    pub deleted: bool,
    /// The type of object being deleted.
    pub object: String,
}

/// A function tool that can be used to generate a response.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ChatCompletionFunctionTool {
    pub function: serde_json::Value,
    /// The type of the tool. Currently, only `function` is supported.
    #[serde(rename = "type")]
    pub type_: String,
}

/// A URL citation when using web search.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct AnnotationURLCitation {
    /// The index of the last character of the URL citation in the message.
    pub end_index: i64,
    /// The index of the first character of the URL citation in the message.
    pub start_index: i64,
    /// The title of the web resource.
    pub title: String,
    /// The URL of the web resource.
    pub url: String,
}

/// The custom tool that the model called.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct Custom {
    /// The input for the custom tool call generated by the model.
    pub input: String,
    /// The name of the custom tool to call.
    pub name: String,
}

/// A call to a custom tool created by the model.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ChatCompletionMessageCustomToolCall {
    /// The ID of the tool call.
    pub id: String,
    /// The custom tool that the model called.
    pub custom: Custom,
    /// The type of the tool. Always `custom`.
    #[serde(rename = "type")]
    pub type_: String,
}

/// The function that the model called.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct MessageFunctionFunction {
    /// The arguments to call the function with, as generated by the model in JSON
    pub arguments: String,
    /// The name of the function to call.
    pub name: String,
}

/// A call to a function tool created by the model.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ChatCompletionMessageFunctionToolCall {
    /// The ID of the tool call.
    pub id: String,
    /// The function that the model called.
    pub function: serde_json::Value,
    /// The type of the tool. Currently, only `function` is supported.
    #[serde(rename = "type")]
    pub type_: String,
}

pub type ChatCompletionMessageToolCallUnion = serde_json::Value;

pub type ChatCompletionMessageToolCall = ChatCompletionMessageFunctionToolCall;

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum ChatCompletionModality {
    #[serde(rename = "text")]
    Text,
    #[serde(rename = "audio")]
    Audio,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum ChatCompletionRole {
    #[serde(rename = "developer")]
    Developer,
    #[serde(rename = "system")]
    System,
    #[serde(rename = "user")]
    User,
    #[serde(rename = "assistant")]
    Assistant,
    #[serde(rename = "tool")]
    Tool,
    #[serde(rename = "function")]
    Function,
}

pub type ChatCompletionStoreMessageContentPart = serde_json::Value;

#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ChatCompletionTokenLogprob {
    /// The token.
    pub token: String,
    /// A list of integers representing the UTF-8 bytes representation of the token.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub bytes: Option<Vec<i64>>,
    /// The log probability of this token, if it is within the top 20 most likely
    pub logprob: f64,
    /// List of the most likely tokens and their log probability, at this token
    pub top_logprobs: Vec<TopLogprob>,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum CompletionCreateParamsBasePromptCacheRetention {
    #[serde(rename = "in-memory")]
    InMemory,
    #[serde(rename = "24h")]
    V24h,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum CompletionCreateParamsBaseServiceTier {
    #[serde(rename = "auto")]
    Auto,
    #[serde(rename = "default")]
    Default,
    #[serde(rename = "flex")]
    Flex,
    #[serde(rename = "scale")]
    Scale,
    #[serde(rename = "priority")]
    Priority,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum CompletionCreateParamsBaseVerbosity {
    #[serde(rename = "low")]
    Low,
    #[serde(rename = "medium")]
    Medium,
    #[serde(rename = "high")]
    High,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct CompletionCreateParamsBase {
    /// A list of messages comprising the conversation so far.
    pub messages: Vec<serde_json::Value>,
    /// Model ID used to generate the response, like `gpt-4o` or `o3`.
    pub model: String,
    /// Parameters for audio output.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub audio: Option<serde_json::Value>,
    /// Number between -2.0 and 2.0.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub frequency_penalty: Option<f64>,
    /// Deprecated in favor of `tool_choice`.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub function_call: Option<FunctionCall>,
    /// Deprecated in favor of `tools`.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub functions: Option<Vec<serde_json::Value>>,
    /// Modify the likelihood of specified tokens appearing in the completion.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub logit_bias: Option<std::collections::HashMap<String, i64>>,
    /// Whether to return log probabilities of the output tokens or not.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub logprobs: Option<bool>,
    /// An upper bound for the number of tokens that can be generated for a completion,
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub max_completion_tokens: Option<i64>,
    /// The maximum number of [tokens](/tokenizer) that can be generated in the chat
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub max_tokens: Option<i64>,
    /// Set of 16 key-value pairs that can be attached to an object.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub metadata: Option<serde_json::Value>,
    /// Output types that you would like the model to generate. Most models are capable
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub modalities: Option<Vec<serde_json::Value>>,
    /// How many chat completion choices to generate for each input message.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub n: Option<i64>,
    /// Whether to enable
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub parallel_tool_calls: Option<bool>,
    /// Static predicted output content, such as the content of a text file that is
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub prediction: Option<serde_json::Value>,
    /// Number between -2.0 and 2.0.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub presence_penalty: Option<f64>,
    /// Used by OpenAI to cache responses for similar requests to optimize your cache
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub prompt_cache_key: Option<String>,
    /// The retention policy for the prompt cache.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub prompt_cache_retention: Option<CompletionCreateParamsBasePromptCacheRetention>,
    /// Constrains effort on reasoning for
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub reasoning_effort: Option<serde_json::Value>,
    /// An object specifying the format that the model must output.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub response_format: Option<ResponseFormat>,
    /// A stable identifier used to help detect users of your application that may be
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub safety_identifier: Option<String>,
    /// This feature is in Beta. If specified, our system will make a best effort to
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub seed: Option<i64>,
    /// Specifies the processing type used for serving the request.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub service_tier: Option<CompletionCreateParamsBaseServiceTier>,
    /// Not supported with latest reasoning models `o3` and `o4-mini`.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub stop: Option<serde_json::Value>,
    /// Whether or not to store the output of this chat completion request for use in
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub store: Option<bool>,
    /// Options for streaming response. Only set this when you set `stream: true`.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub stream_options: Option<serde_json::Value>,
    /// What sampling temperature to use, between 0 and 2.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub temperature: Option<f64>,
    /// Controls which (if any) tool is called by the model. `none` means the model will
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub tool_choice: Option<serde_json::Value>,
    /// A list of tools the model may call.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub tools: Option<Vec<serde_json::Value>>,
    /// An integer between 0 and 20 specifying the number of most likely tokens to
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub top_logprobs: Option<i64>,
    /// An alternative to sampling with temperature, called nucleus sampling, where the
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub top_p: Option<f64>,
    /// This field is being replaced by `safety_identifier` and `prompt_cache_key`.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub user: Option<String>,
    /// Constrains the verbosity of the model's response.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub verbosity: Option<CompletionCreateParamsBaseVerbosity>,
    /// This tool searches the web for relevant results to use in a response. Learn more
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub web_search_options: Option<WebSearchOptions>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct CompletionCreateFunction {
    /// The name of the function to be called.
    pub name: String,
    /// A description of what the function does, used by the model to choose when and
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub description: Option<String>,
    /// The parameters the functions accepts, described as a JSON Schema object.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub parameters: Option<serde_json::Value>,
}

/// Approximate location parameters for the search.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct WebSearchOptionsUserLocationApproximate {
    /// Free text input for the city of the user, e.g. `San Francisco`.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub city: Option<String>,
    /// The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub country: Option<String>,
    /// Free text input for the region of the user, e.g. `California`.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub region: Option<String>,
    /// The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub timezone: Option<String>,
}

/// Approximate location parameters for the search.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct WebSearchOptionsUserLocation {
    /// Approximate location parameters for the search.
    pub approximate: WebSearchOptionsUserLocationApproximate,
    /// The type of location approximation. Always `approximate`.
    #[serde(rename = "type")]
    pub type_: String,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum WebSearchOptionsSearchContextSize {
    #[serde(rename = "low")]
    Low,
    #[serde(rename = "medium")]
    Medium,
    #[serde(rename = "high")]
    High,
}

pub type CompletionCreateParams = serde_json::Value;

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum CompletionListParamsOrder {
    #[serde(rename = "asc")]
    Asc,
    #[serde(rename = "desc")]
    Desc,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct CompletionListParams {
    /// Identifier for the last chat completion from the previous pagination request.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub after: Option<String>,
    /// Number of Chat Completions to retrieve.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub limit: Option<i64>,
    /// A list of metadata keys to filter the Chat Completions by. Example:
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub metadata: Option<serde_json::Value>,
    /// The model used to generate the Chat Completions.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub model: Option<String>,
    /// Sort order for Chat Completions by timestamp.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub order: Option<CompletionListParamsOrder>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct CompletionUpdateParams {
    /// Set of 16 key-value pairs that can be attached to an object.
    pub metadata: Option<serde_json::Value>,
}