1#![allow(
5 clippy::manual_async_fn,
6 clippy::needless_return,
7 clippy::single_match,
8 clippy::match_single_binding,
9 clippy::too_many_arguments,
10 clippy::large_enum_variant,
11 clippy::enum_variant_names,
12 dead_code,
13 unused_imports,
14 rustdoc::bare_urls,
15 rustdoc::broken_intra_doc_links
16)]
17
18pub mod spec {}
27pub mod components {
28 #![allow(deprecated)]
29 #![allow(unreachable_patterns)]
30 #![allow(non_camel_case_types)]
31 #![allow(non_snake_case)]
32 #![allow(clippy::all, clippy::pedantic)]
33 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
34 #[serde(untagged)]
35 pub enum ChatCompletionStreamResponseDeltaContent {
36 ChatCompletionStreamResponseDeltaContentVariant0(String),
37 ChatCompletionStreamResponseDeltaContentVariant1(Option<::serde_json::Value>),
38 }
39 impl ::std::convert::From<String> for ChatCompletionStreamResponseDeltaContent {
40 fn from(value: String) -> Self {
41 ChatCompletionStreamResponseDeltaContent::ChatCompletionStreamResponseDeltaContentVariant0(
42 value,
43 )
44 }
45 }
46 impl ::std::convert::TryFrom<ChatCompletionStreamResponseDeltaContent> for String {
47 type Error = ChatCompletionStreamResponseDeltaContent;
48 fn try_from(
53 value: ChatCompletionStreamResponseDeltaContent,
54 ) -> ::std::result::Result<Self, Self::Error> {
55 match value {
56 ChatCompletionStreamResponseDeltaContent::ChatCompletionStreamResponseDeltaContentVariant0(
57 inner,
58 ) => ::std::result::Result::Ok(inner),
59 other => ::std::result::Result::Err(other),
60 }
61 }
62 }
63 impl ::std::convert::From<Option<::serde_json::Value>>
64 for ChatCompletionStreamResponseDeltaContent
65 {
66 fn from(value: Option<::serde_json::Value>) -> Self {
67 ChatCompletionStreamResponseDeltaContent::ChatCompletionStreamResponseDeltaContentVariant1(
68 value,
69 )
70 }
71 }
72 impl ::std::convert::TryFrom<ChatCompletionStreamResponseDeltaContent>
73 for Option<::serde_json::Value>
74 {
75 type Error = ChatCompletionStreamResponseDeltaContent;
76 fn try_from(
81 value: ChatCompletionStreamResponseDeltaContent,
82 ) -> ::std::result::Result<Self, Self::Error> {
83 match value {
84 ChatCompletionStreamResponseDeltaContent::ChatCompletionStreamResponseDeltaContentVariant1(
85 inner,
86 ) => ::std::result::Result::Ok(inner),
87 other => ::std::result::Result::Err(other),
88 }
89 }
90 }
91 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
92 #[deprecated]
93 pub struct ChatCompletionStreamResponseDeltaFunctionCall {
95 #[serde(skip_serializing_if = "Option::is_none")]
96 pub arguments: Option<String>,
98 #[serde(skip_serializing_if = "Option::is_none")]
99 pub name: Option<String>,
101 }
102 #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
104 pub enum ChatCompletionMessageToolCallChunkType {
105 #[serde(rename = "function")]
106 Function,
107 }
108 impl ::std::fmt::Display for ChatCompletionMessageToolCallChunkType {
109 fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
110 match self {
111 Self::Function => ::std::write!(__f, "function"),
112 }
113 }
114 }
115 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
116 pub struct ChatCompletionMessageToolCallChunkFunction {
117 #[serde(skip_serializing_if = "Option::is_none")]
118 pub name: Option<String>,
120 #[serde(skip_serializing_if = "Option::is_none")]
121 pub arguments: Option<String>,
123 }
124 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
125 pub struct ChatCompletionMessageToolCallChunk {
126 pub index: i64,
127 #[serde(skip_serializing_if = "Option::is_none")]
128 pub id: Option<String>,
130 #[serde(skip_serializing_if = "Option::is_none")]
131 pub r#type: Option<ChatCompletionMessageToolCallChunkType>,
133 #[serde(skip_serializing_if = "Option::is_none")]
134 pub function: Option<ChatCompletionMessageToolCallChunkFunction>,
135 }
136 #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
138 pub enum ChatCompletionStreamResponseDeltaRole {
139 #[serde(rename = "developer")]
140 Developer,
141 #[serde(rename = "system")]
142 System,
143 #[serde(rename = "user")]
144 User,
145 #[serde(rename = "assistant")]
146 Assistant,
147 #[serde(rename = "tool")]
148 Tool,
149 }
150 impl ::std::fmt::Display for ChatCompletionStreamResponseDeltaRole {
151 fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
152 match self {
153 Self::Developer => ::std::write!(__f, "developer"),
154 Self::System => ::std::write!(__f, "system"),
155 Self::User => ::std::write!(__f, "user"),
156 Self::Assistant => ::std::write!(__f, "assistant"),
157 Self::Tool => ::std::write!(__f, "tool"),
158 }
159 }
160 }
161 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
162 #[serde(untagged)]
163 pub enum ChatCompletionStreamResponseDeltaRefusal {
164 ChatCompletionStreamResponseDeltaRefusalVariant0(String),
165 ChatCompletionStreamResponseDeltaRefusalVariant1(Option<::serde_json::Value>),
166 }
167 impl ::std::convert::From<String> for ChatCompletionStreamResponseDeltaRefusal {
168 fn from(value: String) -> Self {
169 ChatCompletionStreamResponseDeltaRefusal::ChatCompletionStreamResponseDeltaRefusalVariant0(
170 value,
171 )
172 }
173 }
174 impl ::std::convert::TryFrom<ChatCompletionStreamResponseDeltaRefusal> for String {
175 type Error = ChatCompletionStreamResponseDeltaRefusal;
176 fn try_from(
181 value: ChatCompletionStreamResponseDeltaRefusal,
182 ) -> ::std::result::Result<Self, Self::Error> {
183 match value {
184 ChatCompletionStreamResponseDeltaRefusal::ChatCompletionStreamResponseDeltaRefusalVariant0(
185 inner,
186 ) => ::std::result::Result::Ok(inner),
187 other => ::std::result::Result::Err(other),
188 }
189 }
190 }
191 impl ::std::convert::From<Option<::serde_json::Value>>
192 for ChatCompletionStreamResponseDeltaRefusal
193 {
194 fn from(value: Option<::serde_json::Value>) -> Self {
195 ChatCompletionStreamResponseDeltaRefusal::ChatCompletionStreamResponseDeltaRefusalVariant1(
196 value,
197 )
198 }
199 }
200 impl ::std::convert::TryFrom<ChatCompletionStreamResponseDeltaRefusal>
201 for Option<::serde_json::Value>
202 {
203 type Error = ChatCompletionStreamResponseDeltaRefusal;
204 fn try_from(
209 value: ChatCompletionStreamResponseDeltaRefusal,
210 ) -> ::std::result::Result<Self, Self::Error> {
211 match value {
212 ChatCompletionStreamResponseDeltaRefusal::ChatCompletionStreamResponseDeltaRefusalVariant1(
213 inner,
214 ) => ::std::result::Result::Ok(inner),
215 other => ::std::result::Result::Err(other),
216 }
217 }
218 }
219 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
220 pub struct ChatCompletionStreamResponseDelta {
222 #[serde(skip_serializing_if = "Option::is_none")]
223 pub content: Option<ChatCompletionStreamResponseDeltaContent>,
224 #[serde(skip_serializing_if = "Option::is_none")]
225 #[deprecated]
227 pub function_call: Option<ChatCompletionStreamResponseDeltaFunctionCall>,
228 #[serde(skip_serializing_if = "Option::is_none")]
229 pub tool_calls: Option<Vec<ChatCompletionMessageToolCallChunk>>,
230 #[serde(skip_serializing_if = "Option::is_none")]
231 pub role: Option<ChatCompletionStreamResponseDeltaRole>,
233 #[serde(skip_serializing_if = "Option::is_none")]
234 pub refusal: Option<ChatCompletionStreamResponseDeltaRefusal>,
235 }
236 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
237 #[serde(untagged)]
238 pub enum ChatCompletionTokenLogprobBytes {
239 ChatCompletionTokenLogprobBytesVariant0(Vec<i64>),
240 ChatCompletionTokenLogprobBytesVariant1(Option<::serde_json::Value>),
241 }
242 impl ::std::convert::From<Vec<i64>> for ChatCompletionTokenLogprobBytes {
243 fn from(value: Vec<i64>) -> Self {
244 ChatCompletionTokenLogprobBytes::ChatCompletionTokenLogprobBytesVariant0(value)
245 }
246 }
247 impl ::std::convert::TryFrom<ChatCompletionTokenLogprobBytes> for Vec<i64> {
248 type Error = ChatCompletionTokenLogprobBytes;
249 fn try_from(
254 value: ChatCompletionTokenLogprobBytes,
255 ) -> ::std::result::Result<Self, Self::Error> {
256 match value {
257 ChatCompletionTokenLogprobBytes::ChatCompletionTokenLogprobBytesVariant0(inner) => {
258 ::std::result::Result::Ok(inner)
259 }
260 other => ::std::result::Result::Err(other),
261 }
262 }
263 }
264 impl ::std::convert::From<Option<::serde_json::Value>> for ChatCompletionTokenLogprobBytes {
265 fn from(value: Option<::serde_json::Value>) -> Self {
266 ChatCompletionTokenLogprobBytes::ChatCompletionTokenLogprobBytesVariant1(value)
267 }
268 }
269 impl ::std::convert::TryFrom<ChatCompletionTokenLogprobBytes> for Option<::serde_json::Value> {
270 type Error = ChatCompletionTokenLogprobBytes;
271 fn try_from(
276 value: ChatCompletionTokenLogprobBytes,
277 ) -> ::std::result::Result<Self, Self::Error> {
278 match value {
279 ChatCompletionTokenLogprobBytes::ChatCompletionTokenLogprobBytesVariant1(inner) => {
280 ::std::result::Result::Ok(inner)
281 }
282 other => ::std::result::Result::Err(other),
283 }
284 }
285 }
286 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
287 #[serde(untagged)]
288 pub enum ChatCompletionTokenLogprobTopLogprobsBytes {
289 ChatCompletionTokenLogprobTopLogprobsBytesVariant0(Vec<i64>),
290 ChatCompletionTokenLogprobTopLogprobsBytesVariant1(Option<::serde_json::Value>),
291 }
292 impl ::std::convert::From<Vec<i64>> for ChatCompletionTokenLogprobTopLogprobsBytes {
293 fn from(value: Vec<i64>) -> Self {
294 ChatCompletionTokenLogprobTopLogprobsBytes::ChatCompletionTokenLogprobTopLogprobsBytesVariant0(
295 value,
296 )
297 }
298 }
299 impl ::std::convert::TryFrom<ChatCompletionTokenLogprobTopLogprobsBytes> for Vec<i64> {
300 type Error = ChatCompletionTokenLogprobTopLogprobsBytes;
301 fn try_from(
306 value: ChatCompletionTokenLogprobTopLogprobsBytes,
307 ) -> ::std::result::Result<Self, Self::Error> {
308 match value {
309 ChatCompletionTokenLogprobTopLogprobsBytes::ChatCompletionTokenLogprobTopLogprobsBytesVariant0(
310 inner,
311 ) => ::std::result::Result::Ok(inner),
312 other => ::std::result::Result::Err(other),
313 }
314 }
315 }
316 impl ::std::convert::From<Option<::serde_json::Value>>
317 for ChatCompletionTokenLogprobTopLogprobsBytes
318 {
319 fn from(value: Option<::serde_json::Value>) -> Self {
320 ChatCompletionTokenLogprobTopLogprobsBytes::ChatCompletionTokenLogprobTopLogprobsBytesVariant1(
321 value,
322 )
323 }
324 }
325 impl ::std::convert::TryFrom<ChatCompletionTokenLogprobTopLogprobsBytes>
326 for Option<::serde_json::Value>
327 {
328 type Error = ChatCompletionTokenLogprobTopLogprobsBytes;
329 fn try_from(
334 value: ChatCompletionTokenLogprobTopLogprobsBytes,
335 ) -> ::std::result::Result<Self, Self::Error> {
336 match value {
337 ChatCompletionTokenLogprobTopLogprobsBytes::ChatCompletionTokenLogprobTopLogprobsBytesVariant1(
338 inner,
339 ) => ::std::result::Result::Ok(inner),
340 other => ::std::result::Result::Err(other),
341 }
342 }
343 }
344 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
345 pub struct ChatCompletionTokenLogprobTopLogprobs {
346 pub token: String,
348 pub logprob: f64,
350 pub bytes: ChatCompletionTokenLogprobTopLogprobsBytes,
351 }
352 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
353 pub struct ChatCompletionTokenLogprob {
354 pub token: String,
356 pub logprob: f64,
358 pub bytes: ChatCompletionTokenLogprobBytes,
359 pub top_logprobs: Vec<ChatCompletionTokenLogprobTopLogprobs>,
361 }
362 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
363 pub struct CreateChatCompletionStreamResponseChoicesLogprobs {
365 pub content: Vec<ChatCompletionTokenLogprob>,
367 pub refusal: Vec<ChatCompletionTokenLogprob>,
369 }
370 #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
375 pub enum CreateChatCompletionStreamResponseChoicesFinishReason {
376 #[serde(rename = "stop")]
377 Stop,
378 #[serde(rename = "length")]
379 Length,
380 #[serde(rename = "tool_calls")]
381 ToolCalls,
382 #[serde(rename = "content_filter")]
383 ContentFilter,
384 #[serde(rename = "function_call")]
385 FunctionCall,
386 }
387 impl ::std::fmt::Display for CreateChatCompletionStreamResponseChoicesFinishReason {
388 fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
389 match self {
390 Self::Stop => ::std::write!(__f, "stop"),
391 Self::Length => ::std::write!(__f, "length"),
392 Self::ToolCalls => ::std::write!(__f, "tool_calls"),
393 Self::ContentFilter => ::std::write!(__f, "content_filter"),
394 Self::FunctionCall => ::std::write!(__f, "function_call"),
395 }
396 }
397 }
398 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
399 pub struct CreateChatCompletionStreamResponseChoices {
400 pub delta: ChatCompletionStreamResponseDelta,
401 #[serde(skip_serializing_if = "Option::is_none")]
402 pub logprobs: Option<CreateChatCompletionStreamResponseChoicesLogprobs>,
404 #[serde(skip_serializing_if = "Option::is_none")]
405 pub finish_reason: Option<CreateChatCompletionStreamResponseChoicesFinishReason>,
410 pub index: i64,
412 }
413 #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
421 pub enum ServiceTierVariant0 {
422 #[serde(rename = "auto")]
423 Auto,
424 #[serde(rename = "default")]
425 Default,
426 #[serde(rename = "flex")]
427 Flex,
428 #[serde(rename = "scale")]
429 Scale,
430 #[serde(rename = "priority")]
431 Priority,
432 }
433 impl ::std::fmt::Display for ServiceTierVariant0 {
434 fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
435 match self {
436 Self::Auto => ::std::write!(__f, "auto"),
437 Self::Default => ::std::write!(__f, "default"),
438 Self::Flex => ::std::write!(__f, "flex"),
439 Self::Scale => ::std::write!(__f, "scale"),
440 Self::Priority => ::std::write!(__f, "priority"),
441 }
442 }
443 }
444 impl ::std::convert::From<ServiceTierVariant0> for ServiceTier {
445 fn from(value: ServiceTierVariant0) -> Self {
446 ServiceTier::ServiceTierVariant0(value)
447 }
448 }
449 impl ::std::convert::TryFrom<ServiceTier> for ServiceTierVariant0 {
450 type Error = ServiceTier;
451 fn try_from(value: ServiceTier) -> ::std::result::Result<Self, Self::Error> {
456 match value {
457 ServiceTier::ServiceTierVariant0(inner) => ::std::result::Result::Ok(inner),
458 other => ::std::result::Result::Err(other),
459 }
460 }
461 }
462 impl ::std::convert::From<Option<::serde_json::Value>> for ServiceTier {
463 fn from(value: Option<::serde_json::Value>) -> Self {
464 ServiceTier::ServiceTierVariant1(value)
465 }
466 }
467 impl ::std::convert::TryFrom<ServiceTier> for Option<::serde_json::Value> {
468 type Error = ServiceTier;
469 fn try_from(value: ServiceTier) -> ::std::result::Result<Self, Self::Error> {
474 match value {
475 ServiceTier::ServiceTierVariant1(inner) => ::std::result::Result::Ok(inner),
476 other => ::std::result::Result::Err(other),
477 }
478 }
479 }
480 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
481 #[serde(untagged)]
482 pub enum ServiceTier {
483 ServiceTierVariant0(ServiceTierVariant0),
484 ServiceTierVariant1(Option<::serde_json::Value>),
485 }
486 #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
488 pub enum CreateChatCompletionStreamResponseObject {
489 #[serde(rename = "chat.completion.chunk")]
490 ChatCompletionChunk,
491 }
492 impl ::std::fmt::Display for CreateChatCompletionStreamResponseObject {
493 fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
494 match self {
495 Self::ChatCompletionChunk => ::std::write!(__f, "chat.completion.chunk"),
496 }
497 }
498 }
499 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
500 pub struct CompletionUsageCompletionTokensDetails {
502 #[serde(skip_serializing_if = "Option::is_none")]
503 pub accepted_prediction_tokens: Option<i64>,
506 #[serde(skip_serializing_if = "Option::is_none")]
507 pub audio_tokens: Option<i64>,
509 #[serde(skip_serializing_if = "Option::is_none")]
510 pub reasoning_tokens: Option<i64>,
512 #[serde(skip_serializing_if = "Option::is_none")]
513 pub rejected_prediction_tokens: Option<i64>,
519 }
520 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
521 pub struct CompletionUsagePromptTokensDetails {
523 #[serde(skip_serializing_if = "Option::is_none")]
524 pub audio_tokens: Option<i64>,
526 #[serde(skip_serializing_if = "Option::is_none")]
527 pub cached_tokens: Option<i64>,
529 }
530 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
531 pub struct CompletionUsage {
533 pub completion_tokens: i64,
535 pub prompt_tokens: i64,
537 pub total_tokens: i64,
539 #[serde(skip_serializing_if = "Option::is_none")]
540 pub completion_tokens_details: Option<CompletionUsageCompletionTokensDetails>,
542 #[serde(skip_serializing_if = "Option::is_none")]
543 pub prompt_tokens_details: Option<CompletionUsagePromptTokensDetails>,
545 }
546 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
547 pub struct CreateChatCompletionStreamResponse {
551 pub id: String,
553 pub choices: Vec<CreateChatCompletionStreamResponseChoices>,
556 pub created: i64,
558 pub model: String,
560 #[serde(skip_serializing_if = "Option::is_none")]
561 pub service_tier: Option<ServiceTier>,
562 #[serde(skip_serializing_if = "Option::is_none")]
563 #[deprecated]
566 pub system_fingerprint: Option<String>,
567 pub object: CreateChatCompletionStreamResponseObject,
569 #[serde(skip_serializing_if = "Option::is_none")]
570 pub usage: Option<CompletionUsage>,
571 }
572 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
573 pub struct ChatCompletionStreamOptionsVariant0 {
575 #[serde(skip_serializing_if = "Option::is_none")]
576 pub include_usage: Option<bool>,
585 #[serde(skip_serializing_if = "Option::is_none")]
586 pub include_obfuscation: Option<bool>,
594 }
595 impl ::std::convert::From<ChatCompletionStreamOptionsVariant0> for ChatCompletionStreamOptions {
596 fn from(value: ChatCompletionStreamOptionsVariant0) -> Self {
597 ChatCompletionStreamOptions::ChatCompletionStreamOptionsVariant0(value)
598 }
599 }
600 impl ::std::convert::TryFrom<ChatCompletionStreamOptions> for ChatCompletionStreamOptionsVariant0 {
601 type Error = ChatCompletionStreamOptions;
602 fn try_from(
607 value: ChatCompletionStreamOptions,
608 ) -> ::std::result::Result<Self, Self::Error> {
609 match value {
610 ChatCompletionStreamOptions::ChatCompletionStreamOptionsVariant0(inner) => {
611 ::std::result::Result::Ok(inner)
612 }
613 other => ::std::result::Result::Err(other),
614 }
615 }
616 }
617 impl ::std::convert::From<Option<::serde_json::Value>> for ChatCompletionStreamOptions {
618 fn from(value: Option<::serde_json::Value>) -> Self {
619 ChatCompletionStreamOptions::ChatCompletionStreamOptionsVariant1(value)
620 }
621 }
622 impl ::std::convert::TryFrom<ChatCompletionStreamOptions> for Option<::serde_json::Value> {
623 type Error = ChatCompletionStreamOptions;
624 fn try_from(
629 value: ChatCompletionStreamOptions,
630 ) -> ::std::result::Result<Self, Self::Error> {
631 match value {
632 ChatCompletionStreamOptions::ChatCompletionStreamOptionsVariant1(inner) => {
633 ::std::result::Result::Ok(inner)
634 }
635 other => ::std::result::Result::Err(other),
636 }
637 }
638 }
639 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
640 #[serde(untagged)]
641 pub enum ChatCompletionStreamOptions {
642 ChatCompletionStreamOptionsVariant0(ChatCompletionStreamOptionsVariant0),
643 ChatCompletionStreamOptionsVariant1(Option<::serde_json::Value>),
644 }
645 #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
647 pub enum ChatCompletionToolType {
648 #[serde(rename = "function")]
649 Function,
650 }
651 impl ::std::fmt::Display for ChatCompletionToolType {
652 fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
653 match self {
654 Self::Function => ::std::write!(__f, "function"),
655 }
656 }
657 }
658 pub type FunctionParameters = ::std::collections::BTreeMap<String, ::serde_json::Value>;
662 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
663 #[serde(untagged)]
664 pub enum FunctionObjectStrict {
665 FunctionObjectStrictVariant0(bool),
666 FunctionObjectStrictVariant1(Option<::serde_json::Value>),
667 }
668 impl ::std::convert::From<bool> for FunctionObjectStrict {
669 fn from(value: bool) -> Self {
670 FunctionObjectStrict::FunctionObjectStrictVariant0(value)
671 }
672 }
673 impl ::std::convert::TryFrom<FunctionObjectStrict> for bool {
674 type Error = FunctionObjectStrict;
675 fn try_from(value: FunctionObjectStrict) -> ::std::result::Result<Self, Self::Error> {
680 match value {
681 FunctionObjectStrict::FunctionObjectStrictVariant0(inner) => {
682 ::std::result::Result::Ok(inner)
683 }
684 other => ::std::result::Result::Err(other),
685 }
686 }
687 }
688 impl ::std::convert::From<Option<::serde_json::Value>> for FunctionObjectStrict {
689 fn from(value: Option<::serde_json::Value>) -> Self {
690 FunctionObjectStrict::FunctionObjectStrictVariant1(value)
691 }
692 }
693 impl ::std::convert::TryFrom<FunctionObjectStrict> for Option<::serde_json::Value> {
694 type Error = FunctionObjectStrict;
695 fn try_from(value: FunctionObjectStrict) -> ::std::result::Result<Self, Self::Error> {
700 match value {
701 FunctionObjectStrict::FunctionObjectStrictVariant1(inner) => {
702 ::std::result::Result::Ok(inner)
703 }
704 other => ::std::result::Result::Err(other),
705 }
706 }
707 }
708 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
709 pub struct FunctionObject {
710 #[serde(skip_serializing_if = "Option::is_none")]
711 pub description: Option<String>,
713 pub name: String,
715 #[serde(skip_serializing_if = "Option::is_none")]
716 pub parameters: Option<FunctionParameters>,
717 #[serde(skip_serializing_if = "Option::is_none")]
718 pub strict: Option<FunctionObjectStrict>,
719 }
720 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
721 pub struct ChatCompletionTool {
724 pub r#type: ChatCompletionToolType,
726 pub function: FunctionObject,
727 }
728 #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
731 pub enum ChatCompletionToolChoiceOptionVariant0 {
732 #[serde(rename = "none")]
733 None,
734 #[serde(rename = "auto")]
735 Auto,
736 #[serde(rename = "required")]
737 Required,
738 }
739 impl ::std::fmt::Display for ChatCompletionToolChoiceOptionVariant0 {
740 fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
741 match self {
742 Self::None => ::std::write!(__f, "none"),
743 Self::Auto => ::std::write!(__f, "auto"),
744 Self::Required => ::std::write!(__f, "required"),
745 }
746 }
747 }
748 #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
750 pub enum ChatCompletionAllowedToolsChoiceType {
751 #[serde(rename = "allowed_tools")]
752 AllowedTools,
753 }
754 impl ::std::fmt::Display for ChatCompletionAllowedToolsChoiceType {
755 fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
756 match self {
757 Self::AllowedTools => ::std::write!(__f, "allowed_tools"),
758 }
759 }
760 }
761 #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
768 pub enum ChatCompletionAllowedToolsMode {
769 #[serde(rename = "auto")]
770 Auto,
771 #[serde(rename = "required")]
772 Required,
773 }
774 impl ::std::fmt::Display for ChatCompletionAllowedToolsMode {
775 fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
776 match self {
777 Self::Auto => ::std::write!(__f, "auto"),
778 Self::Required => ::std::write!(__f, "required"),
779 }
780 }
781 }
782 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
783 pub struct ChatCompletionAllowedTools {
786 pub mode: ChatCompletionAllowedToolsMode,
793 pub tools: Vec<::std::collections::BTreeMap<String, ::serde_json::Value>>,
803 }
804 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
805 pub struct ChatCompletionAllowedToolsChoice {
808 pub r#type: ChatCompletionAllowedToolsChoiceType,
810 pub allowed_tools: ChatCompletionAllowedTools,
811 }
812 #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
814 pub enum ChatCompletionNamedToolChoiceType {
815 #[serde(rename = "function")]
816 Function,
817 }
818 impl ::std::fmt::Display for ChatCompletionNamedToolChoiceType {
819 fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
820 match self {
821 Self::Function => ::std::write!(__f, "function"),
822 }
823 }
824 }
825 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
826 pub struct ChatCompletionNamedToolChoiceFunction {
827 pub name: String,
829 }
830 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
831 pub struct ChatCompletionNamedToolChoice {
834 pub r#type: ChatCompletionNamedToolChoiceType,
836 pub function: ChatCompletionNamedToolChoiceFunction,
837 }
838 #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
840 pub enum ChatCompletionNamedToolChoiceCustomType {
841 #[serde(rename = "custom")]
842 Custom,
843 }
844 impl ::std::fmt::Display for ChatCompletionNamedToolChoiceCustomType {
845 fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
846 match self {
847 Self::Custom => ::std::write!(__f, "custom"),
848 }
849 }
850 }
851 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
852 pub struct ChatCompletionNamedToolChoiceCustomCustom {
853 pub name: String,
855 }
856 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
857 pub struct ChatCompletionNamedToolChoiceCustom {
860 pub r#type: ChatCompletionNamedToolChoiceCustomType,
862 pub custom: ChatCompletionNamedToolChoiceCustomCustom,
863 }
864 impl ::std::convert::From<ChatCompletionToolChoiceOptionVariant0>
865 for ChatCompletionToolChoiceOption
866 {
867 fn from(value: ChatCompletionToolChoiceOptionVariant0) -> Self {
868 ChatCompletionToolChoiceOption::ChatCompletionToolChoiceOptionVariant0(value)
869 }
870 }
871 impl ::std::convert::TryFrom<ChatCompletionToolChoiceOption>
872 for ChatCompletionToolChoiceOptionVariant0
873 {
874 type Error = ChatCompletionToolChoiceOption;
875 fn try_from(
880 value: ChatCompletionToolChoiceOption,
881 ) -> ::std::result::Result<Self, Self::Error> {
882 match value {
883 ChatCompletionToolChoiceOption::ChatCompletionToolChoiceOptionVariant0(inner) => {
884 ::std::result::Result::Ok(inner)
885 }
886 other => ::std::result::Result::Err(other),
887 }
888 }
889 }
890 impl ::std::convert::From<ChatCompletionAllowedToolsChoice> for ChatCompletionToolChoiceOption {
891 fn from(value: ChatCompletionAllowedToolsChoice) -> Self {
892 ChatCompletionToolChoiceOption::ChatCompletionAllowedToolsChoice(value)
893 }
894 }
895 impl ::std::convert::TryFrom<ChatCompletionToolChoiceOption> for ChatCompletionAllowedToolsChoice {
896 type Error = ChatCompletionToolChoiceOption;
897 fn try_from(
902 value: ChatCompletionToolChoiceOption,
903 ) -> ::std::result::Result<Self, Self::Error> {
904 match value {
905 ChatCompletionToolChoiceOption::ChatCompletionAllowedToolsChoice(inner) => {
906 ::std::result::Result::Ok(inner)
907 }
908 other => ::std::result::Result::Err(other),
909 }
910 }
911 }
912 impl ::std::convert::From<ChatCompletionNamedToolChoice> for ChatCompletionToolChoiceOption {
913 fn from(value: ChatCompletionNamedToolChoice) -> Self {
914 ChatCompletionToolChoiceOption::ChatCompletionNamedToolChoice(value)
915 }
916 }
917 impl ::std::convert::TryFrom<ChatCompletionToolChoiceOption> for ChatCompletionNamedToolChoice {
918 type Error = ChatCompletionToolChoiceOption;
919 fn try_from(
924 value: ChatCompletionToolChoiceOption,
925 ) -> ::std::result::Result<Self, Self::Error> {
926 match value {
927 ChatCompletionToolChoiceOption::ChatCompletionNamedToolChoice(inner) => {
928 ::std::result::Result::Ok(inner)
929 }
930 other => ::std::result::Result::Err(other),
931 }
932 }
933 }
934 impl ::std::convert::From<ChatCompletionNamedToolChoiceCustom> for ChatCompletionToolChoiceOption {
935 fn from(value: ChatCompletionNamedToolChoiceCustom) -> Self {
936 ChatCompletionToolChoiceOption::ChatCompletionNamedToolChoiceCustom(value)
937 }
938 }
939 impl ::std::convert::TryFrom<ChatCompletionToolChoiceOption>
940 for ChatCompletionNamedToolChoiceCustom
941 {
942 type Error = ChatCompletionToolChoiceOption;
943 fn try_from(
948 value: ChatCompletionToolChoiceOption,
949 ) -> ::std::result::Result<Self, Self::Error> {
950 match value {
951 ChatCompletionToolChoiceOption::ChatCompletionNamedToolChoiceCustom(inner) => {
952 ::std::result::Result::Ok(inner)
953 }
954 other => ::std::result::Result::Err(other),
955 }
956 }
957 }
958 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
959 #[serde(untagged)]
960 pub enum ChatCompletionToolChoiceOption {
968 ChatCompletionToolChoiceOptionVariant0(ChatCompletionToolChoiceOptionVariant0),
969 ChatCompletionAllowedToolsChoice(ChatCompletionAllowedToolsChoice),
970 ChatCompletionNamedToolChoice(ChatCompletionNamedToolChoice),
971 ChatCompletionNamedToolChoiceCustom(ChatCompletionNamedToolChoiceCustom),
972 }
973 #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
974 pub enum VoiceIdsSharedVariant1 {
975 #[serde(rename = "alloy")]
976 Alloy,
977 #[serde(rename = "ash")]
978 Ash,
979 #[serde(rename = "ballad")]
980 Ballad,
981 #[serde(rename = "coral")]
982 Coral,
983 #[serde(rename = "echo")]
984 Echo,
985 #[serde(rename = "sage")]
986 Sage,
987 #[serde(rename = "shimmer")]
988 Shimmer,
989 #[serde(rename = "verse")]
990 Verse,
991 #[serde(rename = "marin")]
992 Marin,
993 #[serde(rename = "cedar")]
994 Cedar,
995 }
996 impl ::std::fmt::Display for VoiceIdsSharedVariant1 {
997 fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
998 match self {
999 Self::Alloy => ::std::write!(__f, "alloy"),
1000 Self::Ash => ::std::write!(__f, "ash"),
1001 Self::Ballad => ::std::write!(__f, "ballad"),
1002 Self::Coral => ::std::write!(__f, "coral"),
1003 Self::Echo => ::std::write!(__f, "echo"),
1004 Self::Sage => ::std::write!(__f, "sage"),
1005 Self::Shimmer => ::std::write!(__f, "shimmer"),
1006 Self::Verse => ::std::write!(__f, "verse"),
1007 Self::Marin => ::std::write!(__f, "marin"),
1008 Self::Cedar => ::std::write!(__f, "cedar"),
1009 }
1010 }
1011 }
1012 impl ::std::convert::From<String> for VoiceIdsShared {
1013 fn from(value: String) -> Self {
1014 VoiceIdsShared::VoiceIdsSharedVariant0(value)
1015 }
1016 }
1017 impl ::std::convert::TryFrom<VoiceIdsShared> for String {
1018 type Error = VoiceIdsShared;
1019 fn try_from(value: VoiceIdsShared) -> ::std::result::Result<Self, Self::Error> {
1024 match value {
1025 VoiceIdsShared::VoiceIdsSharedVariant0(inner) => ::std::result::Result::Ok(inner),
1026 other => ::std::result::Result::Err(other),
1027 }
1028 }
1029 }
1030 impl ::std::convert::From<VoiceIdsSharedVariant1> for VoiceIdsShared {
1031 fn from(value: VoiceIdsSharedVariant1) -> Self {
1032 VoiceIdsShared::VoiceIdsSharedVariant1(value)
1033 }
1034 }
1035 impl ::std::convert::TryFrom<VoiceIdsShared> for VoiceIdsSharedVariant1 {
1036 type Error = VoiceIdsShared;
1037 fn try_from(value: VoiceIdsShared) -> ::std::result::Result<Self, Self::Error> {
1042 match value {
1043 VoiceIdsShared::VoiceIdsSharedVariant1(inner) => ::std::result::Result::Ok(inner),
1044 other => ::std::result::Result::Err(other),
1045 }
1046 }
1047 }
1048 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
1049 #[serde(untagged)]
1050 pub enum VoiceIdsShared {
1051 VoiceIdsSharedVariant0(String),
1052 VoiceIdsSharedVariant1(VoiceIdsSharedVariant1),
1053 }
1054 impl ::std::convert::From<::std::collections::BTreeMap<String, String>> for Metadata {
1055 fn from(value: ::std::collections::BTreeMap<String, String>) -> Self {
1056 Metadata::MetadataVariant0(value)
1057 }
1058 }
1059 impl ::std::convert::TryFrom<Metadata> for ::std::collections::BTreeMap<String, String> {
1060 type Error = Metadata;
1061 fn try_from(value: Metadata) -> ::std::result::Result<Self, Self::Error> {
1066 match value {
1067 Metadata::MetadataVariant0(inner) => ::std::result::Result::Ok(inner),
1068 other => ::std::result::Result::Err(other),
1069 }
1070 }
1071 }
1072 impl ::std::convert::From<Option<::serde_json::Value>> for Metadata {
1073 fn from(value: Option<::serde_json::Value>) -> Self {
1074 Metadata::MetadataVariant1(value)
1075 }
1076 }
1077 impl ::std::convert::TryFrom<Metadata> for Option<::serde_json::Value> {
1078 type Error = Metadata;
1079 fn try_from(value: Metadata) -> ::std::result::Result<Self, Self::Error> {
1084 match value {
1085 Metadata::MetadataVariant1(inner) => ::std::result::Result::Ok(inner),
1086 other => ::std::result::Result::Err(other),
1087 }
1088 }
1089 }
1090 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
1091 #[serde(untagged)]
1092 pub enum Metadata {
1093 MetadataVariant0(::std::collections::BTreeMap<String, String>),
1094 MetadataVariant1(Option<::serde_json::Value>),
1095 }
1096 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
1097 #[serde(untagged)]
1098 pub enum CreateModelResponsePropertiesTopLogprobs {
1099 CreateModelResponsePropertiesTopLogprobsVariant0(i64),
1100 CreateModelResponsePropertiesTopLogprobsVariant1(Option<::serde_json::Value>),
1101 }
1102 impl ::std::convert::From<i64> for CreateModelResponsePropertiesTopLogprobs {
1103 fn from(value: i64) -> Self {
1104 CreateModelResponsePropertiesTopLogprobs::CreateModelResponsePropertiesTopLogprobsVariant0(
1105 value,
1106 )
1107 }
1108 }
1109 impl ::std::convert::TryFrom<CreateModelResponsePropertiesTopLogprobs> for i64 {
1110 type Error = CreateModelResponsePropertiesTopLogprobs;
1111 fn try_from(
1116 value: CreateModelResponsePropertiesTopLogprobs,
1117 ) -> ::std::result::Result<Self, Self::Error> {
1118 match value {
1119 CreateModelResponsePropertiesTopLogprobs::CreateModelResponsePropertiesTopLogprobsVariant0(
1120 inner,
1121 ) => ::std::result::Result::Ok(inner),
1122 other => ::std::result::Result::Err(other),
1123 }
1124 }
1125 }
1126 impl ::std::convert::From<Option<::serde_json::Value>>
1127 for CreateModelResponsePropertiesTopLogprobs
1128 {
1129 fn from(value: Option<::serde_json::Value>) -> Self {
1130 CreateModelResponsePropertiesTopLogprobs::CreateModelResponsePropertiesTopLogprobsVariant1(
1131 value,
1132 )
1133 }
1134 }
1135 impl ::std::convert::TryFrom<CreateModelResponsePropertiesTopLogprobs>
1136 for Option<::serde_json::Value>
1137 {
1138 type Error = CreateModelResponsePropertiesTopLogprobs;
1139 fn try_from(
1144 value: CreateModelResponsePropertiesTopLogprobs,
1145 ) -> ::std::result::Result<Self, Self::Error> {
1146 match value {
1147 CreateModelResponsePropertiesTopLogprobs::CreateModelResponsePropertiesTopLogprobsVariant1(
1148 inner,
1149 ) => ::std::result::Result::Ok(inner),
1150 other => ::std::result::Result::Err(other),
1151 }
1152 }
1153 }
1154 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
1155 #[serde(untagged)]
1156 pub enum CreateModelResponsePropertiesTemperature {
1157 CreateModelResponsePropertiesTemperatureVariant0(f64),
1158 CreateModelResponsePropertiesTemperatureVariant1(Option<::serde_json::Value>),
1159 }
1160 impl ::std::convert::From<f64> for CreateModelResponsePropertiesTemperature {
1161 fn from(value: f64) -> Self {
1162 CreateModelResponsePropertiesTemperature::CreateModelResponsePropertiesTemperatureVariant0(
1163 value,
1164 )
1165 }
1166 }
1167 impl ::std::convert::TryFrom<CreateModelResponsePropertiesTemperature> for f64 {
1168 type Error = CreateModelResponsePropertiesTemperature;
1169 fn try_from(
1174 value: CreateModelResponsePropertiesTemperature,
1175 ) -> ::std::result::Result<Self, Self::Error> {
1176 match value {
1177 CreateModelResponsePropertiesTemperature::CreateModelResponsePropertiesTemperatureVariant0(
1178 inner,
1179 ) => ::std::result::Result::Ok(inner),
1180 other => ::std::result::Result::Err(other),
1181 }
1182 }
1183 }
1184 impl ::std::convert::From<Option<::serde_json::Value>>
1185 for CreateModelResponsePropertiesTemperature
1186 {
1187 fn from(value: Option<::serde_json::Value>) -> Self {
1188 CreateModelResponsePropertiesTemperature::CreateModelResponsePropertiesTemperatureVariant1(
1189 value,
1190 )
1191 }
1192 }
1193 impl ::std::convert::TryFrom<CreateModelResponsePropertiesTemperature>
1194 for Option<::serde_json::Value>
1195 {
1196 type Error = CreateModelResponsePropertiesTemperature;
1197 fn try_from(
1202 value: CreateModelResponsePropertiesTemperature,
1203 ) -> ::std::result::Result<Self, Self::Error> {
1204 match value {
1205 CreateModelResponsePropertiesTemperature::CreateModelResponsePropertiesTemperatureVariant1(
1206 inner,
1207 ) => ::std::result::Result::Ok(inner),
1208 other => ::std::result::Result::Err(other),
1209 }
1210 }
1211 }
1212 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
1213 #[serde(untagged)]
1214 pub enum CreateModelResponsePropertiesTopP {
1215 CreateModelResponsePropertiesTopPVariant0(f64),
1216 CreateModelResponsePropertiesTopPVariant1(Option<::serde_json::Value>),
1217 }
1218 impl ::std::convert::From<f64> for CreateModelResponsePropertiesTopP {
1219 fn from(value: f64) -> Self {
1220 CreateModelResponsePropertiesTopP::CreateModelResponsePropertiesTopPVariant0(value)
1221 }
1222 }
1223 impl ::std::convert::TryFrom<CreateModelResponsePropertiesTopP> for f64 {
1224 type Error = CreateModelResponsePropertiesTopP;
1225 fn try_from(
1230 value: CreateModelResponsePropertiesTopP,
1231 ) -> ::std::result::Result<Self, Self::Error> {
1232 match value {
1233 CreateModelResponsePropertiesTopP::CreateModelResponsePropertiesTopPVariant0(
1234 inner,
1235 ) => ::std::result::Result::Ok(inner),
1236 other => ::std::result::Result::Err(other),
1237 }
1238 }
1239 }
1240 impl ::std::convert::From<Option<::serde_json::Value>> for CreateModelResponsePropertiesTopP {
1241 fn from(value: Option<::serde_json::Value>) -> Self {
1242 CreateModelResponsePropertiesTopP::CreateModelResponsePropertiesTopPVariant1(value)
1243 }
1244 }
1245 impl ::std::convert::TryFrom<CreateModelResponsePropertiesTopP> for Option<::serde_json::Value> {
1246 type Error = CreateModelResponsePropertiesTopP;
1247 fn try_from(
1252 value: CreateModelResponsePropertiesTopP,
1253 ) -> ::std::result::Result<Self, Self::Error> {
1254 match value {
1255 CreateModelResponsePropertiesTopP::CreateModelResponsePropertiesTopPVariant1(
1256 inner,
1257 ) => ::std::result::Result::Ok(inner),
1258 other => ::std::result::Result::Err(other),
1259 }
1260 }
1261 }
1262 #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
1264 pub enum CreateModelResponsePropertiesPromptCacheRetentionVariant0 {
1265 #[serde(rename = "in_memory")]
1266 InMemory,
1267 #[serde(rename = "24h")]
1268 _24h,
1269 }
1270 impl ::std::fmt::Display for CreateModelResponsePropertiesPromptCacheRetentionVariant0 {
1271 fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
1272 match self {
1273 Self::InMemory => ::std::write!(__f, "in_memory"),
1274 Self::_24h => ::std::write!(__f, "24h"),
1275 }
1276 }
1277 }
1278 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
1279 #[serde(untagged)]
1280 pub enum CreateModelResponsePropertiesPromptCacheRetention {
1281 CreateModelResponsePropertiesPromptCacheRetentionVariant0(
1282 CreateModelResponsePropertiesPromptCacheRetentionVariant0,
1283 ),
1284 CreateModelResponsePropertiesPromptCacheRetentionVariant1(Option<::serde_json::Value>),
1285 }
1286 impl ::std::convert::From<CreateModelResponsePropertiesPromptCacheRetentionVariant0>
1287 for CreateModelResponsePropertiesPromptCacheRetention
1288 {
1289 fn from(value: CreateModelResponsePropertiesPromptCacheRetentionVariant0) -> Self {
1290 CreateModelResponsePropertiesPromptCacheRetention::CreateModelResponsePropertiesPromptCacheRetentionVariant0(
1291 value,
1292 )
1293 }
1294 }
1295 impl ::std::convert::TryFrom<CreateModelResponsePropertiesPromptCacheRetention>
1296 for CreateModelResponsePropertiesPromptCacheRetentionVariant0
1297 {
1298 type Error = CreateModelResponsePropertiesPromptCacheRetention;
1299 fn try_from(
1304 value: CreateModelResponsePropertiesPromptCacheRetention,
1305 ) -> ::std::result::Result<Self, Self::Error> {
1306 match value {
1307 CreateModelResponsePropertiesPromptCacheRetention::CreateModelResponsePropertiesPromptCacheRetentionVariant0(
1308 inner,
1309 ) => ::std::result::Result::Ok(inner),
1310 other => ::std::result::Result::Err(other),
1311 }
1312 }
1313 }
1314 impl ::std::convert::From<Option<::serde_json::Value>>
1315 for CreateModelResponsePropertiesPromptCacheRetention
1316 {
1317 fn from(value: Option<::serde_json::Value>) -> Self {
1318 CreateModelResponsePropertiesPromptCacheRetention::CreateModelResponsePropertiesPromptCacheRetentionVariant1(
1319 value,
1320 )
1321 }
1322 }
1323 impl ::std::convert::TryFrom<CreateModelResponsePropertiesPromptCacheRetention>
1324 for Option<::serde_json::Value>
1325 {
1326 type Error = CreateModelResponsePropertiesPromptCacheRetention;
1327 fn try_from(
1332 value: CreateModelResponsePropertiesPromptCacheRetention,
1333 ) -> ::std::result::Result<Self, Self::Error> {
1334 match value {
1335 CreateModelResponsePropertiesPromptCacheRetention::CreateModelResponsePropertiesPromptCacheRetentionVariant1(
1336 inner,
1337 ) => ::std::result::Result::Ok(inner),
1338 other => ::std::result::Result::Err(other),
1339 }
1340 }
1341 }
1342 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
1343 pub struct CreateModelResponseProperties {
1344 #[serde(skip_serializing_if = "Option::is_none")]
1345 pub metadata: Option<Metadata>,
1346 #[serde(skip_serializing_if = "Option::is_none")]
1347 pub top_logprobs: Option<CreateModelResponsePropertiesTopLogprobs>,
1348 #[serde(skip_serializing_if = "Option::is_none")]
1349 pub temperature: Option<CreateModelResponsePropertiesTemperature>,
1350 #[serde(skip_serializing_if = "Option::is_none")]
1351 pub top_p: Option<CreateModelResponsePropertiesTopP>,
1352 #[serde(skip_serializing_if = "Option::is_none")]
1353 #[deprecated]
1357 pub user: Option<String>,
1358 #[serde(skip_serializing_if = "Option::is_none")]
1359 pub safety_identifier: Option<String>,
1362 #[serde(skip_serializing_if = "Option::is_none")]
1363 pub prompt_cache_key: Option<String>,
1365 #[serde(skip_serializing_if = "Option::is_none")]
1366 pub service_tier: Option<ServiceTier>,
1367 #[serde(skip_serializing_if = "Option::is_none")]
1368 pub prompt_cache_retention: Option<CreateModelResponsePropertiesPromptCacheRetention>,
1369 }
1370 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
1371 pub struct VoiceIdsOrCustomVoiceVariant1 {
1373 pub id: String,
1375 }
1376 impl ::std::convert::From<VoiceIdsShared> for VoiceIdsOrCustomVoice {
1377 fn from(value: VoiceIdsShared) -> Self {
1378 VoiceIdsOrCustomVoice::VoiceIdsShared(value)
1379 }
1380 }
1381 impl ::std::convert::TryFrom<VoiceIdsOrCustomVoice> for VoiceIdsShared {
1382 type Error = VoiceIdsOrCustomVoice;
1383 fn try_from(value: VoiceIdsOrCustomVoice) -> ::std::result::Result<Self, Self::Error> {
1388 match value {
1389 VoiceIdsOrCustomVoice::VoiceIdsShared(inner) => ::std::result::Result::Ok(inner),
1390 other => ::std::result::Result::Err(other),
1391 }
1392 }
1393 }
1394 impl ::std::convert::From<VoiceIdsOrCustomVoiceVariant1> for VoiceIdsOrCustomVoice {
1395 fn from(value: VoiceIdsOrCustomVoiceVariant1) -> Self {
1396 VoiceIdsOrCustomVoice::VoiceIdsOrCustomVoiceVariant1(value)
1397 }
1398 }
1399 impl ::std::convert::TryFrom<VoiceIdsOrCustomVoice> for VoiceIdsOrCustomVoiceVariant1 {
1400 type Error = VoiceIdsOrCustomVoice;
1401 fn try_from(value: VoiceIdsOrCustomVoice) -> ::std::result::Result<Self, Self::Error> {
1406 match value {
1407 VoiceIdsOrCustomVoice::VoiceIdsOrCustomVoiceVariant1(inner) => {
1408 ::std::result::Result::Ok(inner)
1409 }
1410 other => ::std::result::Result::Err(other),
1411 }
1412 }
1413 }
1414 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
1415 #[serde(untagged)]
1416 pub enum VoiceIdsOrCustomVoice {
1419 VoiceIdsShared(VoiceIdsShared),
1420 VoiceIdsOrCustomVoiceVariant1(VoiceIdsOrCustomVoiceVariant1),
1421 }
1422 #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
1424 pub enum CustomToolChatCompletionsType {
1425 #[serde(rename = "custom")]
1426 Custom,
1427 }
1428 impl ::std::fmt::Display for CustomToolChatCompletionsType {
1429 fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
1430 match self {
1431 Self::Custom => ::std::write!(__f, "custom"),
1432 }
1433 }
1434 }
1435 #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
1437 pub enum CustomToolChatCompletionsCustomFormatVariant0Type {
1438 #[serde(rename = "text")]
1439 Text,
1440 }
1441 impl ::std::fmt::Display for CustomToolChatCompletionsCustomFormatVariant0Type {
1442 fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
1443 match self {
1444 Self::Text => ::std::write!(__f, "text"),
1445 }
1446 }
1447 }
1448 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
1449 pub struct CustomToolChatCompletionsCustomFormatVariant0 {
1452 pub r#type: CustomToolChatCompletionsCustomFormatVariant0Type,
1454 }
1455 #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
1457 pub enum CustomToolChatCompletionsCustomFormatVariant1Type {
1458 #[serde(rename = "grammar")]
1459 Grammar,
1460 }
1461 impl ::std::fmt::Display for CustomToolChatCompletionsCustomFormatVariant1Type {
1462 fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
1463 match self {
1464 Self::Grammar => ::std::write!(__f, "grammar"),
1465 }
1466 }
1467 }
1468 #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
1470 pub enum CustomToolChatCompletionsCustomFormatVariant1GrammarSyntax {
1471 #[serde(rename = "lark")]
1472 Lark,
1473 #[serde(rename = "regex")]
1474 Regex,
1475 }
1476 impl ::std::fmt::Display for CustomToolChatCompletionsCustomFormatVariant1GrammarSyntax {
1477 fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
1478 match self {
1479 Self::Lark => ::std::write!(__f, "lark"),
1480 Self::Regex => ::std::write!(__f, "regex"),
1481 }
1482 }
1483 }
1484 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
1485 pub struct CustomToolChatCompletionsCustomFormatVariant1Grammar {
1488 pub definition: String,
1490 pub syntax: CustomToolChatCompletionsCustomFormatVariant1GrammarSyntax,
1492 }
1493 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
1494 pub struct CustomToolChatCompletionsCustomFormatVariant1 {
1497 pub r#type: CustomToolChatCompletionsCustomFormatVariant1Type,
1499 pub grammar: CustomToolChatCompletionsCustomFormatVariant1Grammar,
1501 }
1502 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
1503 #[serde(untagged)]
1504 pub enum CustomToolChatCompletionsCustomFormat {
1506 CustomToolChatCompletionsCustomFormatVariant0(
1507 CustomToolChatCompletionsCustomFormatVariant0,
1508 ),
1509 CustomToolChatCompletionsCustomFormatVariant1(
1510 CustomToolChatCompletionsCustomFormatVariant1,
1511 ),
1512 }
1513 impl ::std::convert::From<CustomToolChatCompletionsCustomFormatVariant0>
1514 for CustomToolChatCompletionsCustomFormat
1515 {
1516 fn from(value: CustomToolChatCompletionsCustomFormatVariant0) -> Self {
1517 CustomToolChatCompletionsCustomFormat::CustomToolChatCompletionsCustomFormatVariant0(
1518 value,
1519 )
1520 }
1521 }
1522 impl ::std::convert::TryFrom<CustomToolChatCompletionsCustomFormat>
1523 for CustomToolChatCompletionsCustomFormatVariant0
1524 {
1525 type Error = CustomToolChatCompletionsCustomFormat;
1526 fn try_from(
1531 value: CustomToolChatCompletionsCustomFormat,
1532 ) -> ::std::result::Result<Self, Self::Error> {
1533 match value {
1534 CustomToolChatCompletionsCustomFormat::CustomToolChatCompletionsCustomFormatVariant0(
1535 inner,
1536 ) => ::std::result::Result::Ok(inner),
1537 other => ::std::result::Result::Err(other),
1538 }
1539 }
1540 }
1541 impl ::std::convert::From<CustomToolChatCompletionsCustomFormatVariant1>
1542 for CustomToolChatCompletionsCustomFormat
1543 {
1544 fn from(value: CustomToolChatCompletionsCustomFormatVariant1) -> Self {
1545 CustomToolChatCompletionsCustomFormat::CustomToolChatCompletionsCustomFormatVariant1(
1546 value,
1547 )
1548 }
1549 }
1550 impl ::std::convert::TryFrom<CustomToolChatCompletionsCustomFormat>
1551 for CustomToolChatCompletionsCustomFormatVariant1
1552 {
1553 type Error = CustomToolChatCompletionsCustomFormat;
1554 fn try_from(
1559 value: CustomToolChatCompletionsCustomFormat,
1560 ) -> ::std::result::Result<Self, Self::Error> {
1561 match value {
1562 CustomToolChatCompletionsCustomFormat::CustomToolChatCompletionsCustomFormatVariant1(
1563 inner,
1564 ) => ::std::result::Result::Ok(inner),
1565 other => ::std::result::Result::Err(other),
1566 }
1567 }
1568 }
1569 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
1570 pub struct CustomToolChatCompletionsCustom {
1573 pub name: String,
1575 #[serde(skip_serializing_if = "Option::is_none")]
1576 pub description: Option<String>,
1578 #[serde(skip_serializing_if = "Option::is_none")]
1579 pub format: Option<CustomToolChatCompletionsCustomFormat>,
1581 }
1582 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
1583 pub struct CustomToolChatCompletions {
1586 pub r#type: CustomToolChatCompletionsType,
1588 pub custom: CustomToolChatCompletionsCustom,
1590 }
1591 #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
1592 pub enum ModelIdsSharedVariant1 {
1593 #[serde(rename = "gpt-5.4")]
1594 Gpt54,
1595 #[serde(rename = "gpt-5.4-mini")]
1596 Gpt54Mini,
1597 #[serde(rename = "gpt-5.4-nano")]
1598 Gpt54Nano,
1599 #[serde(rename = "gpt-5.4-mini-2026-03-17")]
1600 Gpt54Mini2026Minus03Minus17,
1601 #[serde(rename = "gpt-5.4-nano-2026-03-17")]
1602 Gpt54Nano2026Minus03Minus17,
1603 #[serde(rename = "gpt-5.3-chat-latest")]
1604 Gpt53ChatLatest,
1605 #[serde(rename = "gpt-5.2")]
1606 Gpt52,
1607 #[serde(rename = "gpt-5.2-2025-12-11")]
1608 Gpt52Minus2025Minus12Minus11,
1609 #[serde(rename = "gpt-5.2-chat-latest")]
1610 Gpt52ChatLatest,
1611 #[serde(rename = "gpt-5.2-pro")]
1612 Gpt52Pro,
1613 #[serde(rename = "gpt-5.2-pro-2025-12-11")]
1614 Gpt52Pro2025Minus12Minus11,
1615 #[serde(rename = "gpt-5.1")]
1616 Gpt51,
1617 #[serde(rename = "gpt-5.1-2025-11-13")]
1618 Gpt51Minus2025Minus11Minus13,
1619 #[serde(rename = "gpt-5.1-codex")]
1620 Gpt51Codex,
1621 #[serde(rename = "gpt-5.1-mini")]
1622 Gpt51Mini,
1623 #[serde(rename = "gpt-5.1-chat-latest")]
1624 Gpt51ChatLatest,
1625 #[serde(rename = "gpt-5")]
1626 Gpt5,
1627 #[serde(rename = "gpt-5-mini")]
1628 Gpt5Mini,
1629 #[serde(rename = "gpt-5-nano")]
1630 Gpt5Nano,
1631 #[serde(rename = "gpt-5-2025-08-07")]
1632 Gpt5Minus2025Minus08Minus07,
1633 #[serde(rename = "gpt-5-mini-2025-08-07")]
1634 Gpt5Mini2025Minus08Minus07,
1635 #[serde(rename = "gpt-5-nano-2025-08-07")]
1636 Gpt5Nano2025Minus08Minus07,
1637 #[serde(rename = "gpt-5-chat-latest")]
1638 Gpt5ChatLatest,
1639 #[serde(rename = "gpt-4.1")]
1640 Gpt41,
1641 #[serde(rename = "gpt-4.1-mini")]
1642 Gpt41Mini,
1643 #[serde(rename = "gpt-4.1-nano")]
1644 Gpt41Nano,
1645 #[serde(rename = "gpt-4.1-2025-04-14")]
1646 Gpt41Minus2025Minus04Minus14,
1647 #[serde(rename = "gpt-4.1-mini-2025-04-14")]
1648 Gpt41Mini2025Minus04Minus14,
1649 #[serde(rename = "gpt-4.1-nano-2025-04-14")]
1650 Gpt41Nano2025Minus04Minus14,
1651 #[serde(rename = "o4-mini")]
1652 O4Mini,
1653 #[serde(rename = "o4-mini-2025-04-16")]
1654 O4Mini2025Minus04Minus16,
1655 #[serde(rename = "o3")]
1656 O3,
1657 #[serde(rename = "o3-2025-04-16")]
1658 O3Minus2025Minus04Minus16,
1659 #[serde(rename = "o3-mini")]
1660 O3Mini,
1661 #[serde(rename = "o3-mini-2025-01-31")]
1662 O3Mini2025Minus01Minus31,
1663 #[serde(rename = "o1")]
1664 O1,
1665 #[serde(rename = "o1-2024-12-17")]
1666 O1Minus2024Minus12Minus17,
1667 #[serde(rename = "o1-preview")]
1668 O1Preview,
1669 #[serde(rename = "o1-preview-2024-09-12")]
1670 O1Preview2024Minus09Minus12,
1671 #[serde(rename = "o1-mini")]
1672 O1Mini,
1673 #[serde(rename = "o1-mini-2024-09-12")]
1674 O1Mini2024Minus09Minus12,
1675 #[serde(rename = "gpt-4o")]
1676 Gpt4o,
1677 #[serde(rename = "gpt-4o-2024-11-20")]
1678 Gpt4o2024Minus11Minus20,
1679 #[serde(rename = "gpt-4o-2024-08-06")]
1680 Gpt4o2024Minus08Minus06,
1681 #[serde(rename = "gpt-4o-2024-05-13")]
1682 Gpt4o2024Minus05Minus13,
1683 #[serde(rename = "gpt-4o-audio-preview")]
1684 Gpt4oAudioPreview,
1685 #[serde(rename = "gpt-4o-audio-preview-2024-10-01")]
1686 Gpt4oAudioPreview2024Minus10Minus01,
1687 #[serde(rename = "gpt-4o-audio-preview-2024-12-17")]
1688 Gpt4oAudioPreview2024Minus12Minus17,
1689 #[serde(rename = "gpt-4o-audio-preview-2025-06-03")]
1690 Gpt4oAudioPreview2025Minus06Minus03,
1691 #[serde(rename = "gpt-4o-mini-audio-preview")]
1692 Gpt4oMiniAudioPreview,
1693 #[serde(rename = "gpt-4o-mini-audio-preview-2024-12-17")]
1694 Gpt4oMiniAudioPreview2024Minus12Minus17,
1695 #[serde(rename = "gpt-4o-search-preview")]
1696 Gpt4oSearchPreview,
1697 #[serde(rename = "gpt-4o-mini-search-preview")]
1698 Gpt4oMiniSearchPreview,
1699 #[serde(rename = "gpt-4o-search-preview-2025-03-11")]
1700 Gpt4oSearchPreview2025Minus03Minus11,
1701 #[serde(rename = "gpt-4o-mini-search-preview-2025-03-11")]
1702 Gpt4oMiniSearchPreview2025Minus03Minus11,
1703 #[serde(rename = "chatgpt-4o-latest")]
1704 Chatgpt4oLatest,
1705 #[serde(rename = "codex-mini-latest")]
1706 CodexMiniLatest,
1707 #[serde(rename = "gpt-4o-mini")]
1708 Gpt4oMini,
1709 #[serde(rename = "gpt-4o-mini-2024-07-18")]
1710 Gpt4oMini2024Minus07Minus18,
1711 #[serde(rename = "gpt-4-turbo")]
1712 Gpt4Turbo,
1713 #[serde(rename = "gpt-4-turbo-2024-04-09")]
1714 Gpt4Turbo2024Minus04Minus09,
1715 #[serde(rename = "gpt-4-0125-preview")]
1716 Gpt4Minus0125Preview,
1717 #[serde(rename = "gpt-4-turbo-preview")]
1718 Gpt4TurboPreview,
1719 #[serde(rename = "gpt-4-1106-preview")]
1720 Gpt4Minus1106Preview,
1721 #[serde(rename = "gpt-4-vision-preview")]
1722 Gpt4VisionPreview,
1723 #[serde(rename = "gpt-4")]
1724 Gpt4,
1725 #[serde(rename = "gpt-4-0314")]
1726 Gpt4Minus0314,
1727 #[serde(rename = "gpt-4-0613")]
1728 Gpt4Minus0613,
1729 #[serde(rename = "gpt-4-32k")]
1730 Gpt4Minus32k,
1731 #[serde(rename = "gpt-4-32k-0314")]
1732 Gpt4Minus32k0314,
1733 #[serde(rename = "gpt-4-32k-0613")]
1734 Gpt4Minus32k0613,
1735 #[serde(rename = "gpt-3.5-turbo")]
1736 Gpt35Turbo,
1737 #[serde(rename = "gpt-3.5-turbo-16k")]
1738 Gpt35Turbo16k,
1739 #[serde(rename = "gpt-3.5-turbo-0301")]
1740 Gpt35Turbo0301,
1741 #[serde(rename = "gpt-3.5-turbo-0613")]
1742 Gpt35Turbo0613,
1743 #[serde(rename = "gpt-3.5-turbo-1106")]
1744 Gpt35Turbo1106,
1745 #[serde(rename = "gpt-3.5-turbo-0125")]
1746 Gpt35Turbo0125,
1747 #[serde(rename = "gpt-3.5-turbo-16k-0613")]
1748 Gpt35Turbo16k0613,
1749 }
1750 impl ::std::fmt::Display for ModelIdsSharedVariant1 {
1751 fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
1752 match self {
1753 Self::Gpt54 => ::std::write!(__f, "gpt-5.4"),
1754 Self::Gpt54Mini => ::std::write!(__f, "gpt-5.4-mini"),
1755 Self::Gpt54Nano => ::std::write!(__f, "gpt-5.4-nano"),
1756 Self::Gpt54Mini2026Minus03Minus17 => {
1757 ::std::write!(__f, "gpt-5.4-mini-2026-03-17")
1758 }
1759 Self::Gpt54Nano2026Minus03Minus17 => {
1760 ::std::write!(__f, "gpt-5.4-nano-2026-03-17")
1761 }
1762 Self::Gpt53ChatLatest => ::std::write!(__f, "gpt-5.3-chat-latest"),
1763 Self::Gpt52 => ::std::write!(__f, "gpt-5.2"),
1764 Self::Gpt52Minus2025Minus12Minus11 => {
1765 ::std::write!(__f, "gpt-5.2-2025-12-11")
1766 }
1767 Self::Gpt52ChatLatest => ::std::write!(__f, "gpt-5.2-chat-latest"),
1768 Self::Gpt52Pro => ::std::write!(__f, "gpt-5.2-pro"),
1769 Self::Gpt52Pro2025Minus12Minus11 => {
1770 ::std::write!(__f, "gpt-5.2-pro-2025-12-11")
1771 }
1772 Self::Gpt51 => ::std::write!(__f, "gpt-5.1"),
1773 Self::Gpt51Minus2025Minus11Minus13 => {
1774 ::std::write!(__f, "gpt-5.1-2025-11-13")
1775 }
1776 Self::Gpt51Codex => ::std::write!(__f, "gpt-5.1-codex"),
1777 Self::Gpt51Mini => ::std::write!(__f, "gpt-5.1-mini"),
1778 Self::Gpt51ChatLatest => ::std::write!(__f, "gpt-5.1-chat-latest"),
1779 Self::Gpt5 => ::std::write!(__f, "gpt-5"),
1780 Self::Gpt5Mini => ::std::write!(__f, "gpt-5-mini"),
1781 Self::Gpt5Nano => ::std::write!(__f, "gpt-5-nano"),
1782 Self::Gpt5Minus2025Minus08Minus07 => {
1783 ::std::write!(__f, "gpt-5-2025-08-07")
1784 }
1785 Self::Gpt5Mini2025Minus08Minus07 => {
1786 ::std::write!(__f, "gpt-5-mini-2025-08-07")
1787 }
1788 Self::Gpt5Nano2025Minus08Minus07 => {
1789 ::std::write!(__f, "gpt-5-nano-2025-08-07")
1790 }
1791 Self::Gpt5ChatLatest => ::std::write!(__f, "gpt-5-chat-latest"),
1792 Self::Gpt41 => ::std::write!(__f, "gpt-4.1"),
1793 Self::Gpt41Mini => ::std::write!(__f, "gpt-4.1-mini"),
1794 Self::Gpt41Nano => ::std::write!(__f, "gpt-4.1-nano"),
1795 Self::Gpt41Minus2025Minus04Minus14 => {
1796 ::std::write!(__f, "gpt-4.1-2025-04-14")
1797 }
1798 Self::Gpt41Mini2025Minus04Minus14 => {
1799 ::std::write!(__f, "gpt-4.1-mini-2025-04-14")
1800 }
1801 Self::Gpt41Nano2025Minus04Minus14 => {
1802 ::std::write!(__f, "gpt-4.1-nano-2025-04-14")
1803 }
1804 Self::O4Mini => ::std::write!(__f, "o4-mini"),
1805 Self::O4Mini2025Minus04Minus16 => {
1806 ::std::write!(__f, "o4-mini-2025-04-16")
1807 }
1808 Self::O3 => ::std::write!(__f, "o3"),
1809 Self::O3Minus2025Minus04Minus16 => ::std::write!(__f, "o3-2025-04-16"),
1810 Self::O3Mini => ::std::write!(__f, "o3-mini"),
1811 Self::O3Mini2025Minus01Minus31 => {
1812 ::std::write!(__f, "o3-mini-2025-01-31")
1813 }
1814 Self::O1 => ::std::write!(__f, "o1"),
1815 Self::O1Minus2024Minus12Minus17 => ::std::write!(__f, "o1-2024-12-17"),
1816 Self::O1Preview => ::std::write!(__f, "o1-preview"),
1817 Self::O1Preview2024Minus09Minus12 => {
1818 ::std::write!(__f, "o1-preview-2024-09-12")
1819 }
1820 Self::O1Mini => ::std::write!(__f, "o1-mini"),
1821 Self::O1Mini2024Minus09Minus12 => {
1822 ::std::write!(__f, "o1-mini-2024-09-12")
1823 }
1824 Self::Gpt4o => ::std::write!(__f, "gpt-4o"),
1825 Self::Gpt4o2024Minus11Minus20 => ::std::write!(__f, "gpt-4o-2024-11-20"),
1826 Self::Gpt4o2024Minus08Minus06 => ::std::write!(__f, "gpt-4o-2024-08-06"),
1827 Self::Gpt4o2024Minus05Minus13 => ::std::write!(__f, "gpt-4o-2024-05-13"),
1828 Self::Gpt4oAudioPreview => ::std::write!(__f, "gpt-4o-audio-preview"),
1829 Self::Gpt4oAudioPreview2024Minus10Minus01 => {
1830 ::std::write!(__f, "gpt-4o-audio-preview-2024-10-01")
1831 }
1832 Self::Gpt4oAudioPreview2024Minus12Minus17 => {
1833 ::std::write!(__f, "gpt-4o-audio-preview-2024-12-17")
1834 }
1835 Self::Gpt4oAudioPreview2025Minus06Minus03 => {
1836 ::std::write!(__f, "gpt-4o-audio-preview-2025-06-03")
1837 }
1838 Self::Gpt4oMiniAudioPreview => {
1839 ::std::write!(__f, "gpt-4o-mini-audio-preview")
1840 }
1841 Self::Gpt4oMiniAudioPreview2024Minus12Minus17 => {
1842 ::std::write!(__f, "gpt-4o-mini-audio-preview-2024-12-17")
1843 }
1844 Self::Gpt4oSearchPreview => ::std::write!(__f, "gpt-4o-search-preview"),
1845 Self::Gpt4oMiniSearchPreview => {
1846 ::std::write!(__f, "gpt-4o-mini-search-preview")
1847 }
1848 Self::Gpt4oSearchPreview2025Minus03Minus11 => {
1849 ::std::write!(__f, "gpt-4o-search-preview-2025-03-11")
1850 }
1851 Self::Gpt4oMiniSearchPreview2025Minus03Minus11 => {
1852 ::std::write!(__f, "gpt-4o-mini-search-preview-2025-03-11")
1853 }
1854 Self::Chatgpt4oLatest => ::std::write!(__f, "chatgpt-4o-latest"),
1855 Self::CodexMiniLatest => ::std::write!(__f, "codex-mini-latest"),
1856 Self::Gpt4oMini => ::std::write!(__f, "gpt-4o-mini"),
1857 Self::Gpt4oMini2024Minus07Minus18 => {
1858 ::std::write!(__f, "gpt-4o-mini-2024-07-18")
1859 }
1860 Self::Gpt4Turbo => ::std::write!(__f, "gpt-4-turbo"),
1861 Self::Gpt4Turbo2024Minus04Minus09 => {
1862 ::std::write!(__f, "gpt-4-turbo-2024-04-09")
1863 }
1864 Self::Gpt4Minus0125Preview => ::std::write!(__f, "gpt-4-0125-preview"),
1865 Self::Gpt4TurboPreview => ::std::write!(__f, "gpt-4-turbo-preview"),
1866 Self::Gpt4Minus1106Preview => ::std::write!(__f, "gpt-4-1106-preview"),
1867 Self::Gpt4VisionPreview => ::std::write!(__f, "gpt-4-vision-preview"),
1868 Self::Gpt4 => ::std::write!(__f, "gpt-4"),
1869 Self::Gpt4Minus0314 => ::std::write!(__f, "gpt-4-0314"),
1870 Self::Gpt4Minus0613 => ::std::write!(__f, "gpt-4-0613"),
1871 Self::Gpt4Minus32k => ::std::write!(__f, "gpt-4-32k"),
1872 Self::Gpt4Minus32k0314 => ::std::write!(__f, "gpt-4-32k-0314"),
1873 Self::Gpt4Minus32k0613 => ::std::write!(__f, "gpt-4-32k-0613"),
1874 Self::Gpt35Turbo => ::std::write!(__f, "gpt-3.5-turbo"),
1875 Self::Gpt35Turbo16k => ::std::write!(__f, "gpt-3.5-turbo-16k"),
1876 Self::Gpt35Turbo0301 => ::std::write!(__f, "gpt-3.5-turbo-0301"),
1877 Self::Gpt35Turbo0613 => ::std::write!(__f, "gpt-3.5-turbo-0613"),
1878 Self::Gpt35Turbo1106 => ::std::write!(__f, "gpt-3.5-turbo-1106"),
1879 Self::Gpt35Turbo0125 => ::std::write!(__f, "gpt-3.5-turbo-0125"),
1880 Self::Gpt35Turbo16k0613 => ::std::write!(__f, "gpt-3.5-turbo-16k-0613"),
1881 }
1882 }
1883 }
1884 impl ::std::convert::From<String> for ModelIdsShared {
1885 fn from(value: String) -> Self {
1886 ModelIdsShared::ModelIdsSharedVariant0(value)
1887 }
1888 }
1889 impl ::std::convert::TryFrom<ModelIdsShared> for String {
1890 type Error = ModelIdsShared;
1891 fn try_from(value: ModelIdsShared) -> ::std::result::Result<Self, Self::Error> {
1896 match value {
1897 ModelIdsShared::ModelIdsSharedVariant0(inner) => ::std::result::Result::Ok(inner),
1898 other => ::std::result::Result::Err(other),
1899 }
1900 }
1901 }
1902 impl ::std::convert::From<ModelIdsSharedVariant1> for ModelIdsShared {
1903 fn from(value: ModelIdsSharedVariant1) -> Self {
1904 ModelIdsShared::ModelIdsSharedVariant1(value)
1905 }
1906 }
1907 impl ::std::convert::TryFrom<ModelIdsShared> for ModelIdsSharedVariant1 {
1908 type Error = ModelIdsShared;
1909 fn try_from(value: ModelIdsShared) -> ::std::result::Result<Self, Self::Error> {
1914 match value {
1915 ModelIdsShared::ModelIdsSharedVariant1(inner) => ::std::result::Result::Ok(inner),
1916 other => ::std::result::Result::Err(other),
1917 }
1918 }
1919 }
1920 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
1921 #[serde(untagged)]
1922 pub enum ModelIdsShared {
1923 ModelIdsSharedVariant0(String),
1924 ModelIdsSharedVariant1(ModelIdsSharedVariant1),
1925 }
1926 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
1927 #[serde(untagged)]
1928 pub enum ModelResponsePropertiesTopLogprobs {
1929 ModelResponsePropertiesTopLogprobsVariant0(i64),
1930 ModelResponsePropertiesTopLogprobsVariant1(Option<::serde_json::Value>),
1931 }
1932 impl ::std::convert::From<i64> for ModelResponsePropertiesTopLogprobs {
1933 fn from(value: i64) -> Self {
1934 ModelResponsePropertiesTopLogprobs::ModelResponsePropertiesTopLogprobsVariant0(value)
1935 }
1936 }
1937 impl ::std::convert::TryFrom<ModelResponsePropertiesTopLogprobs> for i64 {
1938 type Error = ModelResponsePropertiesTopLogprobs;
1939 fn try_from(
1944 value: ModelResponsePropertiesTopLogprobs,
1945 ) -> ::std::result::Result<Self, Self::Error> {
1946 match value {
1947 ModelResponsePropertiesTopLogprobs::ModelResponsePropertiesTopLogprobsVariant0(
1948 inner,
1949 ) => ::std::result::Result::Ok(inner),
1950 other => ::std::result::Result::Err(other),
1951 }
1952 }
1953 }
1954 impl ::std::convert::From<Option<::serde_json::Value>> for ModelResponsePropertiesTopLogprobs {
1955 fn from(value: Option<::serde_json::Value>) -> Self {
1956 ModelResponsePropertiesTopLogprobs::ModelResponsePropertiesTopLogprobsVariant1(value)
1957 }
1958 }
1959 impl ::std::convert::TryFrom<ModelResponsePropertiesTopLogprobs> for Option<::serde_json::Value> {
1960 type Error = ModelResponsePropertiesTopLogprobs;
1961 fn try_from(
1966 value: ModelResponsePropertiesTopLogprobs,
1967 ) -> ::std::result::Result<Self, Self::Error> {
1968 match value {
1969 ModelResponsePropertiesTopLogprobs::ModelResponsePropertiesTopLogprobsVariant1(
1970 inner,
1971 ) => ::std::result::Result::Ok(inner),
1972 other => ::std::result::Result::Err(other),
1973 }
1974 }
1975 }
1976 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
1977 #[serde(untagged)]
1978 pub enum ModelResponsePropertiesTemperature {
1979 ModelResponsePropertiesTemperatureVariant0(f64),
1980 ModelResponsePropertiesTemperatureVariant1(Option<::serde_json::Value>),
1981 }
1982 impl ::std::convert::From<f64> for ModelResponsePropertiesTemperature {
1983 fn from(value: f64) -> Self {
1984 ModelResponsePropertiesTemperature::ModelResponsePropertiesTemperatureVariant0(value)
1985 }
1986 }
1987 impl ::std::convert::TryFrom<ModelResponsePropertiesTemperature> for f64 {
1988 type Error = ModelResponsePropertiesTemperature;
1989 fn try_from(
1994 value: ModelResponsePropertiesTemperature,
1995 ) -> ::std::result::Result<Self, Self::Error> {
1996 match value {
1997 ModelResponsePropertiesTemperature::ModelResponsePropertiesTemperatureVariant0(
1998 inner,
1999 ) => ::std::result::Result::Ok(inner),
2000 other => ::std::result::Result::Err(other),
2001 }
2002 }
2003 }
2004 impl ::std::convert::From<Option<::serde_json::Value>> for ModelResponsePropertiesTemperature {
2005 fn from(value: Option<::serde_json::Value>) -> Self {
2006 ModelResponsePropertiesTemperature::ModelResponsePropertiesTemperatureVariant1(value)
2007 }
2008 }
2009 impl ::std::convert::TryFrom<ModelResponsePropertiesTemperature> for Option<::serde_json::Value> {
2010 type Error = ModelResponsePropertiesTemperature;
2011 fn try_from(
2016 value: ModelResponsePropertiesTemperature,
2017 ) -> ::std::result::Result<Self, Self::Error> {
2018 match value {
2019 ModelResponsePropertiesTemperature::ModelResponsePropertiesTemperatureVariant1(
2020 inner,
2021 ) => ::std::result::Result::Ok(inner),
2022 other => ::std::result::Result::Err(other),
2023 }
2024 }
2025 }
2026 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
2027 #[serde(untagged)]
2028 pub enum ModelResponsePropertiesTopP {
2029 ModelResponsePropertiesTopPVariant0(f64),
2030 ModelResponsePropertiesTopPVariant1(Option<::serde_json::Value>),
2031 }
2032 impl ::std::convert::From<f64> for ModelResponsePropertiesTopP {
2033 fn from(value: f64) -> Self {
2034 ModelResponsePropertiesTopP::ModelResponsePropertiesTopPVariant0(value)
2035 }
2036 }
2037 impl ::std::convert::TryFrom<ModelResponsePropertiesTopP> for f64 {
2038 type Error = ModelResponsePropertiesTopP;
2039 fn try_from(
2044 value: ModelResponsePropertiesTopP,
2045 ) -> ::std::result::Result<Self, Self::Error> {
2046 match value {
2047 ModelResponsePropertiesTopP::ModelResponsePropertiesTopPVariant0(inner) => {
2048 ::std::result::Result::Ok(inner)
2049 }
2050 other => ::std::result::Result::Err(other),
2051 }
2052 }
2053 }
2054 impl ::std::convert::From<Option<::serde_json::Value>> for ModelResponsePropertiesTopP {
2055 fn from(value: Option<::serde_json::Value>) -> Self {
2056 ModelResponsePropertiesTopP::ModelResponsePropertiesTopPVariant1(value)
2057 }
2058 }
2059 impl ::std::convert::TryFrom<ModelResponsePropertiesTopP> for Option<::serde_json::Value> {
2060 type Error = ModelResponsePropertiesTopP;
2061 fn try_from(
2066 value: ModelResponsePropertiesTopP,
2067 ) -> ::std::result::Result<Self, Self::Error> {
2068 match value {
2069 ModelResponsePropertiesTopP::ModelResponsePropertiesTopPVariant1(inner) => {
2070 ::std::result::Result::Ok(inner)
2071 }
2072 other => ::std::result::Result::Err(other),
2073 }
2074 }
2075 }
2076 #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
2078 pub enum ModelResponsePropertiesPromptCacheRetentionVariant0 {
2079 #[serde(rename = "in_memory")]
2080 InMemory,
2081 #[serde(rename = "24h")]
2082 _24h,
2083 }
2084 impl ::std::fmt::Display for ModelResponsePropertiesPromptCacheRetentionVariant0 {
2085 fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
2086 match self {
2087 Self::InMemory => ::std::write!(__f, "in_memory"),
2088 Self::_24h => ::std::write!(__f, "24h"),
2089 }
2090 }
2091 }
2092 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
2093 #[serde(untagged)]
2094 pub enum ModelResponsePropertiesPromptCacheRetention {
2095 ModelResponsePropertiesPromptCacheRetentionVariant0(
2096 ModelResponsePropertiesPromptCacheRetentionVariant0,
2097 ),
2098 ModelResponsePropertiesPromptCacheRetentionVariant1(Option<::serde_json::Value>),
2099 }
2100 impl ::std::convert::From<ModelResponsePropertiesPromptCacheRetentionVariant0>
2101 for ModelResponsePropertiesPromptCacheRetention
2102 {
2103 fn from(value: ModelResponsePropertiesPromptCacheRetentionVariant0) -> Self {
2104 ModelResponsePropertiesPromptCacheRetention::ModelResponsePropertiesPromptCacheRetentionVariant0(
2105 value,
2106 )
2107 }
2108 }
2109 impl ::std::convert::TryFrom<ModelResponsePropertiesPromptCacheRetention>
2110 for ModelResponsePropertiesPromptCacheRetentionVariant0
2111 {
2112 type Error = ModelResponsePropertiesPromptCacheRetention;
2113 fn try_from(
2118 value: ModelResponsePropertiesPromptCacheRetention,
2119 ) -> ::std::result::Result<Self, Self::Error> {
2120 match value {
2121 ModelResponsePropertiesPromptCacheRetention::ModelResponsePropertiesPromptCacheRetentionVariant0(
2122 inner,
2123 ) => ::std::result::Result::Ok(inner),
2124 other => ::std::result::Result::Err(other),
2125 }
2126 }
2127 }
2128 impl ::std::convert::From<Option<::serde_json::Value>>
2129 for ModelResponsePropertiesPromptCacheRetention
2130 {
2131 fn from(value: Option<::serde_json::Value>) -> Self {
2132 ModelResponsePropertiesPromptCacheRetention::ModelResponsePropertiesPromptCacheRetentionVariant1(
2133 value,
2134 )
2135 }
2136 }
2137 impl ::std::convert::TryFrom<ModelResponsePropertiesPromptCacheRetention>
2138 for Option<::serde_json::Value>
2139 {
2140 type Error = ModelResponsePropertiesPromptCacheRetention;
2141 fn try_from(
2146 value: ModelResponsePropertiesPromptCacheRetention,
2147 ) -> ::std::result::Result<Self, Self::Error> {
2148 match value {
2149 ModelResponsePropertiesPromptCacheRetention::ModelResponsePropertiesPromptCacheRetentionVariant1(
2150 inner,
2151 ) => ::std::result::Result::Ok(inner),
2152 other => ::std::result::Result::Err(other),
2153 }
2154 }
2155 }
2156 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
2157 pub struct ModelResponseProperties {
2158 #[serde(skip_serializing_if = "Option::is_none")]
2159 pub metadata: Option<Metadata>,
2160 #[serde(skip_serializing_if = "Option::is_none")]
2161 pub top_logprobs: Option<ModelResponsePropertiesTopLogprobs>,
2162 #[serde(skip_serializing_if = "Option::is_none")]
2163 pub temperature: Option<ModelResponsePropertiesTemperature>,
2164 #[serde(skip_serializing_if = "Option::is_none")]
2165 pub top_p: Option<ModelResponsePropertiesTopP>,
2166 #[serde(skip_serializing_if = "Option::is_none")]
2167 #[deprecated]
2171 pub user: Option<String>,
2172 #[serde(skip_serializing_if = "Option::is_none")]
2173 pub safety_identifier: Option<String>,
2176 #[serde(skip_serializing_if = "Option::is_none")]
2177 pub prompt_cache_key: Option<String>,
2179 #[serde(skip_serializing_if = "Option::is_none")]
2180 pub service_tier: Option<ServiceTier>,
2181 #[serde(skip_serializing_if = "Option::is_none")]
2182 pub prompt_cache_retention: Option<ModelResponsePropertiesPromptCacheRetention>,
2183 }
2184 #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
2188 pub enum VerbosityVariant0 {
2189 #[serde(rename = "low")]
2190 Low,
2191 #[serde(rename = "medium")]
2192 Medium,
2193 #[serde(rename = "high")]
2194 High,
2195 }
2196 impl ::std::fmt::Display for VerbosityVariant0 {
2197 fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
2198 match self {
2199 Self::Low => ::std::write!(__f, "low"),
2200 Self::Medium => ::std::write!(__f, "medium"),
2201 Self::High => ::std::write!(__f, "high"),
2202 }
2203 }
2204 }
2205 impl ::std::convert::From<VerbosityVariant0> for Verbosity {
2206 fn from(value: VerbosityVariant0) -> Self {
2207 Verbosity::VerbosityVariant0(value)
2208 }
2209 }
2210 impl ::std::convert::TryFrom<Verbosity> for VerbosityVariant0 {
2211 type Error = Verbosity;
2212 fn try_from(value: Verbosity) -> ::std::result::Result<Self, Self::Error> {
2217 match value {
2218 Verbosity::VerbosityVariant0(inner) => ::std::result::Result::Ok(inner),
2219 other => ::std::result::Result::Err(other),
2220 }
2221 }
2222 }
2223 impl ::std::convert::From<Option<::serde_json::Value>> for Verbosity {
2224 fn from(value: Option<::serde_json::Value>) -> Self {
2225 Verbosity::VerbosityVariant1(value)
2226 }
2227 }
2228 impl ::std::convert::TryFrom<Verbosity> for Option<::serde_json::Value> {
2229 type Error = Verbosity;
2230 fn try_from(value: Verbosity) -> ::std::result::Result<Self, Self::Error> {
2235 match value {
2236 Verbosity::VerbosityVariant1(inner) => ::std::result::Result::Ok(inner),
2237 other => ::std::result::Result::Err(other),
2238 }
2239 }
2240 }
2241 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
2242 #[serde(untagged)]
2243 pub enum Verbosity {
2244 VerbosityVariant0(VerbosityVariant0),
2245 VerbosityVariant1(Option<::serde_json::Value>),
2246 }
2247 #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
2250 pub enum PredictionContentType {
2251 #[serde(rename = "content")]
2252 Content,
2253 }
2254 impl ::std::fmt::Display for PredictionContentType {
2255 fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
2256 match self {
2257 Self::Content => ::std::write!(__f, "content"),
2258 }
2259 }
2260 }
2261 #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
2263 pub enum ChatCompletionRequestMessageContentPartTextType {
2264 #[serde(rename = "text")]
2265 Text,
2266 }
2267 impl ::std::fmt::Display for ChatCompletionRequestMessageContentPartTextType {
2268 fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
2269 match self {
2270 Self::Text => ::std::write!(__f, "text"),
2271 }
2272 }
2273 }
2274 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
2275 pub struct ChatCompletionRequestMessageContentPartText {
2278 pub r#type: ChatCompletionRequestMessageContentPartTextType,
2280 pub text: String,
2282 }
2283 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
2284 #[serde(untagged)]
2285 pub enum PredictionContentContent {
2289 PredictionContentContentVariant0(String),
2290 PredictionContentContentVariant1(Vec<ChatCompletionRequestMessageContentPartText>),
2291 }
2292 impl ::std::convert::From<String> for PredictionContentContent {
2293 fn from(value: String) -> Self {
2294 PredictionContentContent::PredictionContentContentVariant0(value)
2295 }
2296 }
2297 impl ::std::convert::TryFrom<PredictionContentContent> for String {
2298 type Error = PredictionContentContent;
2299 fn try_from(value: PredictionContentContent) -> ::std::result::Result<Self, Self::Error> {
2304 match value {
2305 PredictionContentContent::PredictionContentContentVariant0(inner) => {
2306 ::std::result::Result::Ok(inner)
2307 }
2308 other => ::std::result::Result::Err(other),
2309 }
2310 }
2311 }
2312 impl ::std::convert::From<Vec<ChatCompletionRequestMessageContentPartText>>
2313 for PredictionContentContent
2314 {
2315 fn from(value: Vec<ChatCompletionRequestMessageContentPartText>) -> Self {
2316 PredictionContentContent::PredictionContentContentVariant1(value)
2317 }
2318 }
2319 impl ::std::convert::TryFrom<PredictionContentContent>
2320 for Vec<ChatCompletionRequestMessageContentPartText>
2321 {
2322 type Error = PredictionContentContent;
2323 fn try_from(value: PredictionContentContent) -> ::std::result::Result<Self, Self::Error> {
2328 match value {
2329 PredictionContentContent::PredictionContentContentVariant1(inner) => {
2330 ::std::result::Result::Ok(inner)
2331 }
2332 other => ::std::result::Result::Err(other),
2333 }
2334 }
2335 }
2336 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
2337 pub struct PredictionContent {
2341 pub r#type: PredictionContentType,
2344 pub content: PredictionContentContent,
2348 }
2349 #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
2360 pub enum ReasoningEffortVariant0 {
2361 #[serde(rename = "none")]
2362 None,
2363 #[serde(rename = "minimal")]
2364 Minimal,
2365 #[serde(rename = "low")]
2366 Low,
2367 #[serde(rename = "medium")]
2368 Medium,
2369 #[serde(rename = "high")]
2370 High,
2371 #[serde(rename = "xhigh")]
2372 Xhigh,
2373 }
2374 impl ::std::fmt::Display for ReasoningEffortVariant0 {
2375 fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
2376 match self {
2377 Self::None => ::std::write!(__f, "none"),
2378 Self::Minimal => ::std::write!(__f, "minimal"),
2379 Self::Low => ::std::write!(__f, "low"),
2380 Self::Medium => ::std::write!(__f, "medium"),
2381 Self::High => ::std::write!(__f, "high"),
2382 Self::Xhigh => ::std::write!(__f, "xhigh"),
2383 }
2384 }
2385 }
2386 impl ::std::convert::From<ReasoningEffortVariant0> for ReasoningEffort {
2387 fn from(value: ReasoningEffortVariant0) -> Self {
2388 ReasoningEffort::ReasoningEffortVariant0(value)
2389 }
2390 }
2391 impl ::std::convert::TryFrom<ReasoningEffort> for ReasoningEffortVariant0 {
2392 type Error = ReasoningEffort;
2393 fn try_from(value: ReasoningEffort) -> ::std::result::Result<Self, Self::Error> {
2398 match value {
2399 ReasoningEffort::ReasoningEffortVariant0(inner) => ::std::result::Result::Ok(inner),
2400 other => ::std::result::Result::Err(other),
2401 }
2402 }
2403 }
2404 impl ::std::convert::From<Option<::serde_json::Value>> for ReasoningEffort {
2405 fn from(value: Option<::serde_json::Value>) -> Self {
2406 ReasoningEffort::ReasoningEffortVariant1(value)
2407 }
2408 }
2409 impl ::std::convert::TryFrom<ReasoningEffort> for Option<::serde_json::Value> {
2410 type Error = ReasoningEffort;
2411 fn try_from(value: ReasoningEffort) -> ::std::result::Result<Self, Self::Error> {
2416 match value {
2417 ReasoningEffort::ReasoningEffortVariant1(inner) => ::std::result::Result::Ok(inner),
2418 other => ::std::result::Result::Err(other),
2419 }
2420 }
2421 }
2422 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
2423 #[serde(untagged)]
2424 pub enum ReasoningEffort {
2425 ReasoningEffortVariant0(ReasoningEffortVariant0),
2426 ReasoningEffortVariant1(Option<::serde_json::Value>),
2427 }
2428 impl ::std::convert::From<String> for StopConfiguration {
2429 fn from(value: String) -> Self {
2430 StopConfiguration::StopConfigurationVariant0(value)
2431 }
2432 }
2433 impl ::std::convert::TryFrom<StopConfiguration> for String {
2434 type Error = StopConfiguration;
2435 fn try_from(value: StopConfiguration) -> ::std::result::Result<Self, Self::Error> {
2440 match value {
2441 StopConfiguration::StopConfigurationVariant0(inner) => {
2442 ::std::result::Result::Ok(inner)
2443 }
2444 other => ::std::result::Result::Err(other),
2445 }
2446 }
2447 }
2448 impl ::std::convert::From<Vec<String>> for StopConfiguration {
2449 fn from(value: Vec<String>) -> Self {
2450 StopConfiguration::StopConfigurationVariant1(value)
2451 }
2452 }
2453 impl ::std::convert::TryFrom<StopConfiguration> for Vec<String> {
2454 type Error = StopConfiguration;
2455 fn try_from(value: StopConfiguration) -> ::std::result::Result<Self, Self::Error> {
2460 match value {
2461 StopConfiguration::StopConfigurationVariant1(inner) => {
2462 ::std::result::Result::Ok(inner)
2463 }
2464 other => ::std::result::Result::Err(other),
2465 }
2466 }
2467 }
2468 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
2469 #[serde(untagged)]
2470 pub enum StopConfiguration {
2475 StopConfigurationVariant0(String),
2476 StopConfigurationVariant1(Vec<String>),
2477 }
2478 #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
2479 pub enum ResponseModalitiesVariant0 {
2480 #[serde(rename = "text")]
2481 Text,
2482 #[serde(rename = "audio")]
2483 Audio,
2484 }
2485 impl ::std::fmt::Display for ResponseModalitiesVariant0 {
2486 fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
2487 match self {
2488 Self::Text => ::std::write!(__f, "text"),
2489 Self::Audio => ::std::write!(__f, "audio"),
2490 }
2491 }
2492 }
2493 impl ::std::convert::From<Vec<ResponseModalitiesVariant0>> for ResponseModalities {
2494 fn from(value: Vec<ResponseModalitiesVariant0>) -> Self {
2495 ResponseModalities::ResponseModalitiesVariant0(value)
2496 }
2497 }
2498 impl ::std::convert::TryFrom<ResponseModalities> for Vec<ResponseModalitiesVariant0> {
2499 type Error = ResponseModalities;
2500 fn try_from(value: ResponseModalities) -> ::std::result::Result<Self, Self::Error> {
2505 match value {
2506 ResponseModalities::ResponseModalitiesVariant0(inner) => {
2507 ::std::result::Result::Ok(inner)
2508 }
2509 other => ::std::result::Result::Err(other),
2510 }
2511 }
2512 }
2513 impl ::std::convert::From<Option<::serde_json::Value>> for ResponseModalities {
2514 fn from(value: Option<::serde_json::Value>) -> Self {
2515 ResponseModalities::ResponseModalitiesVariant1(value)
2516 }
2517 }
2518 impl ::std::convert::TryFrom<ResponseModalities> for Option<::serde_json::Value> {
2519 type Error = ResponseModalities;
2520 fn try_from(value: ResponseModalities) -> ::std::result::Result<Self, Self::Error> {
2525 match value {
2526 ResponseModalities::ResponseModalitiesVariant1(inner) => {
2527 ::std::result::Result::Ok(inner)
2528 }
2529 other => ::std::result::Result::Err(other),
2530 }
2531 }
2532 }
2533 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
2534 #[serde(untagged)]
2535 pub enum ResponseModalities {
2536 ResponseModalitiesVariant0(Vec<ResponseModalitiesVariant0>),
2537 ResponseModalitiesVariant1(Option<::serde_json::Value>),
2538 }
2539 #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
2541 pub enum ResponseFormatTextType {
2542 #[serde(rename = "text")]
2543 Text,
2544 }
2545 impl ::std::fmt::Display for ResponseFormatTextType {
2546 fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
2547 match self {
2548 Self::Text => ::std::write!(__f, "text"),
2549 }
2550 }
2551 }
2552 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
2553 pub struct ResponseFormatText {
2556 pub r#type: ResponseFormatTextType,
2558 }
2559 pub type ResponseFormatJsonSchemaSchema =
2563 ::std::collections::BTreeMap<String, ::serde_json::Value>;
2564 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
2565 pub struct WebSearchLocation {
2568 #[serde(skip_serializing_if = "Option::is_none")]
2569 pub country: Option<String>,
2573 #[serde(skip_serializing_if = "Option::is_none")]
2574 pub region: Option<String>,
2576 #[serde(skip_serializing_if = "Option::is_none")]
2577 pub city: Option<String>,
2579 #[serde(skip_serializing_if = "Option::is_none")]
2580 pub timezone: Option<String>,
2583 }
2584 impl ::std::fmt::Display for WebSearchContextSize {
2585 fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
2586 match self {
2587 Self::Low => ::std::write!(__f, "low"),
2588 Self::Medium => ::std::write!(__f, "medium"),
2589 Self::High => ::std::write!(__f, "high"),
2590 }
2591 }
2592 }
2593 #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
2596 pub enum WebSearchContextSize {
2597 #[serde(rename = "low")]
2598 Low,
2599 #[serde(rename = "medium")]
2600 Medium,
2601 #[serde(rename = "high")]
2602 High,
2603 }
2604 #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
2606 pub enum ModelObject {
2607 #[serde(rename = "model")]
2608 Model,
2609 }
2610 impl ::std::fmt::Display for ModelObject {
2611 fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
2612 match self {
2613 Self::Model => ::std::write!(__f, "model"),
2614 }
2615 }
2616 }
2617 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
2618 pub struct Model {
2621 pub id: String,
2623 pub created: i64,
2625 pub object: ModelObject,
2627 pub owned_by: String,
2629 }
2630 #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
2631 pub enum ListModelsResponseObject {
2632 #[serde(rename = "list")]
2633 List,
2634 }
2635 impl ::std::fmt::Display for ListModelsResponseObject {
2636 fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
2637 match self {
2638 Self::List => ::std::write!(__f, "list"),
2639 }
2640 }
2641 }
2642 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
2643 pub struct ListModelsResponse {
2644 pub object: ListModelsResponseObject,
2645 pub data: Vec<Model>,
2646 }
2647 #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
2649 pub enum ResponseFormatJsonSchemaType {
2650 #[serde(rename = "json_schema")]
2651 JsonSchema,
2652 }
2653 impl ::std::fmt::Display for ResponseFormatJsonSchemaType {
2654 fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
2655 match self {
2656 Self::JsonSchema => ::std::write!(__f, "json_schema"),
2657 }
2658 }
2659 }
2660 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
2661 #[serde(untagged)]
2662 pub enum ResponseFormatJsonSchemaJsonSchemaStrict {
2663 ResponseFormatJsonSchemaJsonSchemaStrictVariant0(bool),
2664 ResponseFormatJsonSchemaJsonSchemaStrictVariant1(Option<::serde_json::Value>),
2665 }
2666 impl ::std::convert::From<bool> for ResponseFormatJsonSchemaJsonSchemaStrict {
2667 fn from(value: bool) -> Self {
2668 ResponseFormatJsonSchemaJsonSchemaStrict::ResponseFormatJsonSchemaJsonSchemaStrictVariant0(
2669 value,
2670 )
2671 }
2672 }
2673 impl ::std::convert::TryFrom<ResponseFormatJsonSchemaJsonSchemaStrict> for bool {
2674 type Error = ResponseFormatJsonSchemaJsonSchemaStrict;
2675 fn try_from(
2680 value: ResponseFormatJsonSchemaJsonSchemaStrict,
2681 ) -> ::std::result::Result<Self, Self::Error> {
2682 match value {
2683 ResponseFormatJsonSchemaJsonSchemaStrict::ResponseFormatJsonSchemaJsonSchemaStrictVariant0(
2684 inner,
2685 ) => ::std::result::Result::Ok(inner),
2686 other => ::std::result::Result::Err(other),
2687 }
2688 }
2689 }
2690 impl ::std::convert::From<Option<::serde_json::Value>>
2691 for ResponseFormatJsonSchemaJsonSchemaStrict
2692 {
2693 fn from(value: Option<::serde_json::Value>) -> Self {
2694 ResponseFormatJsonSchemaJsonSchemaStrict::ResponseFormatJsonSchemaJsonSchemaStrictVariant1(
2695 value,
2696 )
2697 }
2698 }
2699 impl ::std::convert::TryFrom<ResponseFormatJsonSchemaJsonSchemaStrict>
2700 for Option<::serde_json::Value>
2701 {
2702 type Error = ResponseFormatJsonSchemaJsonSchemaStrict;
2703 fn try_from(
2708 value: ResponseFormatJsonSchemaJsonSchemaStrict,
2709 ) -> ::std::result::Result<Self, Self::Error> {
2710 match value {
2711 ResponseFormatJsonSchemaJsonSchemaStrict::ResponseFormatJsonSchemaJsonSchemaStrictVariant1(
2712 inner,
2713 ) => ::std::result::Result::Ok(inner),
2714 other => ::std::result::Result::Err(other),
2715 }
2716 }
2717 }
2718 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
2719 pub struct ResponseFormatJsonSchemaJsonSchema {
2722 #[serde(skip_serializing_if = "Option::is_none")]
2723 pub description: Option<String>,
2726 pub name: String,
2729 #[serde(skip_serializing_if = "Option::is_none")]
2730 pub schema: Option<ResponseFormatJsonSchemaSchema>,
2731 #[serde(skip_serializing_if = "Option::is_none")]
2732 pub strict: Option<ResponseFormatJsonSchemaJsonSchemaStrict>,
2733 }
2734 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
2735 pub struct ResponseFormatJsonSchema {
2739 pub r#type: ResponseFormatJsonSchemaType,
2741 pub json_schema: ResponseFormatJsonSchemaJsonSchema,
2743 }
2744 #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
2746 pub enum ResponseFormatJsonObjectType {
2747 #[serde(rename = "json_object")]
2748 JsonObject,
2749 }
2750 impl ::std::fmt::Display for ResponseFormatJsonObjectType {
2751 fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
2752 match self {
2753 Self::JsonObject => ::std::write!(__f, "json_object"),
2754 }
2755 }
2756 }
2757 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
2758 pub struct ResponseFormatJsonObject {
2764 pub r#type: ResponseFormatJsonObjectType,
2766 }
2767 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
2768 pub struct ChatCompletionFunctionCallOption {
2770 pub name: String,
2772 }
2773 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
2774 #[deprecated]
2775 pub struct ChatCompletionFunctions {
2776 #[serde(skip_serializing_if = "Option::is_none")]
2777 pub description: Option<String>,
2779 pub name: String,
2781 #[serde(skip_serializing_if = "Option::is_none")]
2782 pub parameters: Option<FunctionParameters>,
2783 }
2784 pub type ParallelToolCalls = bool;
2786 #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
2788 pub enum ChatCompletionMessageCustomToolCallType {
2789 #[serde(rename = "custom")]
2790 Custom,
2791 }
2792 impl ::std::fmt::Display for ChatCompletionMessageCustomToolCallType {
2793 fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
2794 match self {
2795 Self::Custom => ::std::write!(__f, "custom"),
2796 }
2797 }
2798 }
2799 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
2800 pub struct ChatCompletionMessageCustomToolCallCustom {
2802 pub name: String,
2804 pub input: String,
2806 }
2807 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
2808 pub struct ChatCompletionMessageCustomToolCall {
2811 pub id: String,
2813 pub r#type: ChatCompletionMessageCustomToolCallType,
2815 pub custom: ChatCompletionMessageCustomToolCallCustom,
2817 }
2818 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
2819 #[serde(untagged)]
2820 pub enum CreateChatCompletionRequestTopLogprobs {
2821 CreateChatCompletionRequestTopLogprobsVariant0(i64),
2822 CreateChatCompletionRequestTopLogprobsVariant1(Option<::serde_json::Value>),
2823 }
2824 impl ::std::convert::From<i64> for CreateChatCompletionRequestTopLogprobs {
2825 fn from(value: i64) -> Self {
2826 CreateChatCompletionRequestTopLogprobs::CreateChatCompletionRequestTopLogprobsVariant0(
2827 value,
2828 )
2829 }
2830 }
2831 impl ::std::convert::TryFrom<CreateChatCompletionRequestTopLogprobs> for i64 {
2832 type Error = CreateChatCompletionRequestTopLogprobs;
2833 fn try_from(
2838 value: CreateChatCompletionRequestTopLogprobs,
2839 ) -> ::std::result::Result<Self, Self::Error> {
2840 match value {
2841 CreateChatCompletionRequestTopLogprobs::CreateChatCompletionRequestTopLogprobsVariant0(
2842 inner,
2843 ) => ::std::result::Result::Ok(inner),
2844 other => ::std::result::Result::Err(other),
2845 }
2846 }
2847 }
2848 impl ::std::convert::From<Option<::serde_json::Value>> for CreateChatCompletionRequestTopLogprobs {
2849 fn from(value: Option<::serde_json::Value>) -> Self {
2850 CreateChatCompletionRequestTopLogprobs::CreateChatCompletionRequestTopLogprobsVariant1(
2851 value,
2852 )
2853 }
2854 }
2855 impl ::std::convert::TryFrom<CreateChatCompletionRequestTopLogprobs>
2856 for Option<::serde_json::Value>
2857 {
2858 type Error = CreateChatCompletionRequestTopLogprobs;
2859 fn try_from(
2864 value: CreateChatCompletionRequestTopLogprobs,
2865 ) -> ::std::result::Result<Self, Self::Error> {
2866 match value {
2867 CreateChatCompletionRequestTopLogprobs::CreateChatCompletionRequestTopLogprobsVariant1(
2868 inner,
2869 ) => ::std::result::Result::Ok(inner),
2870 other => ::std::result::Result::Err(other),
2871 }
2872 }
2873 }
2874 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
2875 #[serde(untagged)]
2876 pub enum CreateChatCompletionRequestTemperature {
2877 CreateChatCompletionRequestTemperatureVariant0(f64),
2878 CreateChatCompletionRequestTemperatureVariant1(Option<::serde_json::Value>),
2879 }
2880 impl ::std::convert::From<f64> for CreateChatCompletionRequestTemperature {
2881 fn from(value: f64) -> Self {
2882 CreateChatCompletionRequestTemperature::CreateChatCompletionRequestTemperatureVariant0(
2883 value,
2884 )
2885 }
2886 }
2887 impl ::std::convert::TryFrom<CreateChatCompletionRequestTemperature> for f64 {
2888 type Error = CreateChatCompletionRequestTemperature;
2889 fn try_from(
2894 value: CreateChatCompletionRequestTemperature,
2895 ) -> ::std::result::Result<Self, Self::Error> {
2896 match value {
2897 CreateChatCompletionRequestTemperature::CreateChatCompletionRequestTemperatureVariant0(
2898 inner,
2899 ) => ::std::result::Result::Ok(inner),
2900 other => ::std::result::Result::Err(other),
2901 }
2902 }
2903 }
2904 impl ::std::convert::From<Option<::serde_json::Value>> for CreateChatCompletionRequestTemperature {
2905 fn from(value: Option<::serde_json::Value>) -> Self {
2906 CreateChatCompletionRequestTemperature::CreateChatCompletionRequestTemperatureVariant1(
2907 value,
2908 )
2909 }
2910 }
2911 impl ::std::convert::TryFrom<CreateChatCompletionRequestTemperature>
2912 for Option<::serde_json::Value>
2913 {
2914 type Error = CreateChatCompletionRequestTemperature;
2915 fn try_from(
2920 value: CreateChatCompletionRequestTemperature,
2921 ) -> ::std::result::Result<Self, Self::Error> {
2922 match value {
2923 CreateChatCompletionRequestTemperature::CreateChatCompletionRequestTemperatureVariant1(
2924 inner,
2925 ) => ::std::result::Result::Ok(inner),
2926 other => ::std::result::Result::Err(other),
2927 }
2928 }
2929 }
2930 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
2931 #[serde(untagged)]
2932 pub enum CreateChatCompletionRequestTopP {
2933 CreateChatCompletionRequestTopPVariant0(f64),
2934 CreateChatCompletionRequestTopPVariant1(Option<::serde_json::Value>),
2935 }
2936 impl ::std::convert::From<f64> for CreateChatCompletionRequestTopP {
2937 fn from(value: f64) -> Self {
2938 CreateChatCompletionRequestTopP::CreateChatCompletionRequestTopPVariant0(value)
2939 }
2940 }
2941 impl ::std::convert::TryFrom<CreateChatCompletionRequestTopP> for f64 {
2942 type Error = CreateChatCompletionRequestTopP;
2943 fn try_from(
2948 value: CreateChatCompletionRequestTopP,
2949 ) -> ::std::result::Result<Self, Self::Error> {
2950 match value {
2951 CreateChatCompletionRequestTopP::CreateChatCompletionRequestTopPVariant0(inner) => {
2952 ::std::result::Result::Ok(inner)
2953 }
2954 other => ::std::result::Result::Err(other),
2955 }
2956 }
2957 }
2958 impl ::std::convert::From<Option<::serde_json::Value>> for CreateChatCompletionRequestTopP {
2959 fn from(value: Option<::serde_json::Value>) -> Self {
2960 CreateChatCompletionRequestTopP::CreateChatCompletionRequestTopPVariant1(value)
2961 }
2962 }
2963 impl ::std::convert::TryFrom<CreateChatCompletionRequestTopP> for Option<::serde_json::Value> {
2964 type Error = CreateChatCompletionRequestTopP;
2965 fn try_from(
2970 value: CreateChatCompletionRequestTopP,
2971 ) -> ::std::result::Result<Self, Self::Error> {
2972 match value {
2973 CreateChatCompletionRequestTopP::CreateChatCompletionRequestTopPVariant1(inner) => {
2974 ::std::result::Result::Ok(inner)
2975 }
2976 other => ::std::result::Result::Err(other),
2977 }
2978 }
2979 }
2980 #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
2982 pub enum CreateChatCompletionRequestPromptCacheRetentionVariant0 {
2983 #[serde(rename = "in_memory")]
2984 InMemory,
2985 #[serde(rename = "24h")]
2986 _24h,
2987 }
2988 impl ::std::fmt::Display for CreateChatCompletionRequestPromptCacheRetentionVariant0 {
2989 fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
2990 match self {
2991 Self::InMemory => ::std::write!(__f, "in_memory"),
2992 Self::_24h => ::std::write!(__f, "24h"),
2993 }
2994 }
2995 }
2996 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
2997 #[serde(untagged)]
2998 pub enum CreateChatCompletionRequestPromptCacheRetention {
2999 CreateChatCompletionRequestPromptCacheRetentionVariant0(
3000 CreateChatCompletionRequestPromptCacheRetentionVariant0,
3001 ),
3002 CreateChatCompletionRequestPromptCacheRetentionVariant1(Option<::serde_json::Value>),
3003 }
3004 impl ::std::convert::From<CreateChatCompletionRequestPromptCacheRetentionVariant0>
3005 for CreateChatCompletionRequestPromptCacheRetention
3006 {
3007 fn from(value: CreateChatCompletionRequestPromptCacheRetentionVariant0) -> Self {
3008 CreateChatCompletionRequestPromptCacheRetention::CreateChatCompletionRequestPromptCacheRetentionVariant0(
3009 value,
3010 )
3011 }
3012 }
3013 impl ::std::convert::TryFrom<CreateChatCompletionRequestPromptCacheRetention>
3014 for CreateChatCompletionRequestPromptCacheRetentionVariant0
3015 {
3016 type Error = CreateChatCompletionRequestPromptCacheRetention;
3017 fn try_from(
3022 value: CreateChatCompletionRequestPromptCacheRetention,
3023 ) -> ::std::result::Result<Self, Self::Error> {
3024 match value {
3025 CreateChatCompletionRequestPromptCacheRetention::CreateChatCompletionRequestPromptCacheRetentionVariant0(
3026 inner,
3027 ) => ::std::result::Result::Ok(inner),
3028 other => ::std::result::Result::Err(other),
3029 }
3030 }
3031 }
3032 impl ::std::convert::From<Option<::serde_json::Value>>
3033 for CreateChatCompletionRequestPromptCacheRetention
3034 {
3035 fn from(value: Option<::serde_json::Value>) -> Self {
3036 CreateChatCompletionRequestPromptCacheRetention::CreateChatCompletionRequestPromptCacheRetentionVariant1(
3037 value,
3038 )
3039 }
3040 }
3041 impl ::std::convert::TryFrom<CreateChatCompletionRequestPromptCacheRetention>
3042 for Option<::serde_json::Value>
3043 {
3044 type Error = CreateChatCompletionRequestPromptCacheRetention;
3045 fn try_from(
3050 value: CreateChatCompletionRequestPromptCacheRetention,
3051 ) -> ::std::result::Result<Self, Self::Error> {
3052 match value {
3053 CreateChatCompletionRequestPromptCacheRetention::CreateChatCompletionRequestPromptCacheRetentionVariant1(
3054 inner,
3055 ) => ::std::result::Result::Ok(inner),
3056 other => ::std::result::Result::Err(other),
3057 }
3058 }
3059 }
3060 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3061 #[serde(untagged)]
3062 pub enum ChatCompletionRequestDeveloperMessageContent {
3064 ChatCompletionRequestDeveloperMessageContentVariant0(String),
3065 ChatCompletionRequestDeveloperMessageContentVariant1(
3066 Vec<ChatCompletionRequestMessageContentPartText>,
3067 ),
3068 }
3069 impl ::std::convert::From<String> for ChatCompletionRequestDeveloperMessageContent {
3070 fn from(value: String) -> Self {
3071 ChatCompletionRequestDeveloperMessageContent::ChatCompletionRequestDeveloperMessageContentVariant0(
3072 value,
3073 )
3074 }
3075 }
3076 impl ::std::convert::TryFrom<ChatCompletionRequestDeveloperMessageContent> for String {
3077 type Error = ChatCompletionRequestDeveloperMessageContent;
3078 fn try_from(
3083 value: ChatCompletionRequestDeveloperMessageContent,
3084 ) -> ::std::result::Result<Self, Self::Error> {
3085 match value {
3086 ChatCompletionRequestDeveloperMessageContent::ChatCompletionRequestDeveloperMessageContentVariant0(
3087 inner,
3088 ) => ::std::result::Result::Ok(inner),
3089 other => ::std::result::Result::Err(other),
3090 }
3091 }
3092 }
3093 impl ::std::convert::From<Vec<ChatCompletionRequestMessageContentPartText>>
3094 for ChatCompletionRequestDeveloperMessageContent
3095 {
3096 fn from(value: Vec<ChatCompletionRequestMessageContentPartText>) -> Self {
3097 ChatCompletionRequestDeveloperMessageContent::ChatCompletionRequestDeveloperMessageContentVariant1(
3098 value,
3099 )
3100 }
3101 }
3102 impl ::std::convert::TryFrom<ChatCompletionRequestDeveloperMessageContent>
3103 for Vec<ChatCompletionRequestMessageContentPartText>
3104 {
3105 type Error = ChatCompletionRequestDeveloperMessageContent;
3106 fn try_from(
3111 value: ChatCompletionRequestDeveloperMessageContent,
3112 ) -> ::std::result::Result<Self, Self::Error> {
3113 match value {
3114 ChatCompletionRequestDeveloperMessageContent::ChatCompletionRequestDeveloperMessageContentVariant1(
3115 inner,
3116 ) => ::std::result::Result::Ok(inner),
3117 other => ::std::result::Result::Err(other),
3118 }
3119 }
3120 }
3121 #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
3123 pub enum ChatCompletionRequestDeveloperMessageRole {
3124 #[serde(rename = "developer")]
3125 Developer,
3126 }
3127 impl ::std::fmt::Display for ChatCompletionRequestDeveloperMessageRole {
3128 fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
3129 match self {
3130 Self::Developer => ::std::write!(__f, "developer"),
3131 }
3132 }
3133 }
3134 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3135 pub struct ChatCompletionRequestDeveloperMessage {
3140 pub content: ChatCompletionRequestDeveloperMessageContent,
3142 pub role: ChatCompletionRequestDeveloperMessageRole,
3144 #[serde(skip_serializing_if = "Option::is_none")]
3145 pub name: Option<String>,
3147 }
3148 impl ::std::convert::From<ChatCompletionRequestMessageContentPartText>
3149 for ChatCompletionRequestSystemMessageContentPart
3150 {
3151 fn from(value: ChatCompletionRequestMessageContentPartText) -> Self {
3152 ChatCompletionRequestSystemMessageContentPart::ChatCompletionRequestMessageContentPartText(
3153 value,
3154 )
3155 }
3156 }
3157 impl ::std::convert::TryFrom<ChatCompletionRequestSystemMessageContentPart>
3158 for ChatCompletionRequestMessageContentPartText
3159 {
3160 type Error = ChatCompletionRequestSystemMessageContentPart;
3161 fn try_from(
3166 value: ChatCompletionRequestSystemMessageContentPart,
3167 ) -> ::std::result::Result<Self, Self::Error> {
3168 match value {
3169 ChatCompletionRequestSystemMessageContentPart::ChatCompletionRequestMessageContentPartText(
3170 inner,
3171 ) => ::std::result::Result::Ok(inner),
3172 other => ::std::result::Result::Err(other),
3173 }
3174 }
3175 }
3176 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3177 #[serde(untagged)]
3178 pub enum ChatCompletionRequestSystemMessageContentPart {
3179 ChatCompletionRequestMessageContentPartText(ChatCompletionRequestMessageContentPartText),
3180 }
3181 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3182 #[serde(untagged)]
3183 pub enum ChatCompletionRequestSystemMessageContent {
3185 ChatCompletionRequestSystemMessageContentVariant0(String),
3186 ChatCompletionRequestSystemMessageContentVariant1(
3187 Vec<ChatCompletionRequestSystemMessageContentPart>,
3188 ),
3189 }
3190 impl ::std::convert::From<String> for ChatCompletionRequestSystemMessageContent {
3191 fn from(value: String) -> Self {
3192 ChatCompletionRequestSystemMessageContent::ChatCompletionRequestSystemMessageContentVariant0(
3193 value,
3194 )
3195 }
3196 }
3197 impl ::std::convert::TryFrom<ChatCompletionRequestSystemMessageContent> for String {
3198 type Error = ChatCompletionRequestSystemMessageContent;
3199 fn try_from(
3204 value: ChatCompletionRequestSystemMessageContent,
3205 ) -> ::std::result::Result<Self, Self::Error> {
3206 match value {
3207 ChatCompletionRequestSystemMessageContent::ChatCompletionRequestSystemMessageContentVariant0(
3208 inner,
3209 ) => ::std::result::Result::Ok(inner),
3210 other => ::std::result::Result::Err(other),
3211 }
3212 }
3213 }
3214 impl ::std::convert::From<Vec<ChatCompletionRequestSystemMessageContentPart>>
3215 for ChatCompletionRequestSystemMessageContent
3216 {
3217 fn from(value: Vec<ChatCompletionRequestSystemMessageContentPart>) -> Self {
3218 ChatCompletionRequestSystemMessageContent::ChatCompletionRequestSystemMessageContentVariant1(
3219 value,
3220 )
3221 }
3222 }
3223 impl ::std::convert::TryFrom<ChatCompletionRequestSystemMessageContent>
3224 for Vec<ChatCompletionRequestSystemMessageContentPart>
3225 {
3226 type Error = ChatCompletionRequestSystemMessageContent;
3227 fn try_from(
3232 value: ChatCompletionRequestSystemMessageContent,
3233 ) -> ::std::result::Result<Self, Self::Error> {
3234 match value {
3235 ChatCompletionRequestSystemMessageContent::ChatCompletionRequestSystemMessageContentVariant1(
3236 inner,
3237 ) => ::std::result::Result::Ok(inner),
3238 other => ::std::result::Result::Err(other),
3239 }
3240 }
3241 }
3242 #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
3244 pub enum ChatCompletionRequestSystemMessageRole {
3245 #[serde(rename = "system")]
3246 System,
3247 }
3248 impl ::std::fmt::Display for ChatCompletionRequestSystemMessageRole {
3249 fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
3250 match self {
3251 Self::System => ::std::write!(__f, "system"),
3252 }
3253 }
3254 }
3255 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3256 pub struct ChatCompletionRequestSystemMessage {
3261 pub content: ChatCompletionRequestSystemMessageContent,
3263 pub role: ChatCompletionRequestSystemMessageRole,
3265 #[serde(skip_serializing_if = "Option::is_none")]
3266 pub name: Option<String>,
3268 }
3269 #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
3271 pub enum ChatCompletionRequestMessageContentPartImageType {
3272 #[serde(rename = "image_url")]
3273 ImageUrl,
3274 }
3275 impl ::std::fmt::Display for ChatCompletionRequestMessageContentPartImageType {
3276 fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
3277 match self {
3278 Self::ImageUrl => ::std::write!(__f, "image_url"),
3279 }
3280 }
3281 }
3282 #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
3284 pub enum ChatCompletionRequestMessageContentPartImageImageUrlDetail {
3285 #[serde(rename = "auto")]
3286 Auto,
3287 #[serde(rename = "low")]
3288 Low,
3289 #[serde(rename = "high")]
3290 High,
3291 }
3292 impl ::std::fmt::Display for ChatCompletionRequestMessageContentPartImageImageUrlDetail {
3293 fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
3294 match self {
3295 Self::Auto => ::std::write!(__f, "auto"),
3296 Self::Low => ::std::write!(__f, "low"),
3297 Self::High => ::std::write!(__f, "high"),
3298 }
3299 }
3300 }
3301 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3302 pub struct ChatCompletionRequestMessageContentPartImageImageUrl {
3303 pub url: String,
3305 #[serde(skip_serializing_if = "Option::is_none")]
3306 pub detail: Option<ChatCompletionRequestMessageContentPartImageImageUrlDetail>,
3308 }
3309 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3310 pub struct ChatCompletionRequestMessageContentPartImage {
3313 pub r#type: ChatCompletionRequestMessageContentPartImageType,
3315 pub image_url: ChatCompletionRequestMessageContentPartImageImageUrl,
3316 }
3317 #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
3319 pub enum ChatCompletionRequestMessageContentPartAudioType {
3320 #[serde(rename = "input_audio")]
3321 InputAudio,
3322 }
3323 impl ::std::fmt::Display for ChatCompletionRequestMessageContentPartAudioType {
3324 fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
3325 match self {
3326 Self::InputAudio => ::std::write!(__f, "input_audio"),
3327 }
3328 }
3329 }
3330 #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
3332 pub enum ChatCompletionRequestMessageContentPartAudioInputAudioFormat {
3333 #[serde(rename = "wav")]
3334 Wav,
3335 #[serde(rename = "mp3")]
3336 Mp3,
3337 }
3338 impl ::std::fmt::Display for ChatCompletionRequestMessageContentPartAudioInputAudioFormat {
3339 fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
3340 match self {
3341 Self::Wav => ::std::write!(__f, "wav"),
3342 Self::Mp3 => ::std::write!(__f, "mp3"),
3343 }
3344 }
3345 }
3346 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3347 pub struct ChatCompletionRequestMessageContentPartAudioInputAudio {
3348 pub data: String,
3350 pub format: ChatCompletionRequestMessageContentPartAudioInputAudioFormat,
3352 }
3353 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3354 pub struct ChatCompletionRequestMessageContentPartAudio {
3357 pub r#type: ChatCompletionRequestMessageContentPartAudioType,
3359 pub input_audio: ChatCompletionRequestMessageContentPartAudioInputAudio,
3360 }
3361 #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
3363 pub enum ChatCompletionRequestMessageContentPartFileType {
3364 #[serde(rename = "file")]
3365 File,
3366 }
3367 impl ::std::fmt::Display for ChatCompletionRequestMessageContentPartFileType {
3368 fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
3369 match self {
3370 Self::File => ::std::write!(__f, "file"),
3371 }
3372 }
3373 }
3374 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3375 pub struct ChatCompletionRequestMessageContentPartFileFile {
3376 #[serde(skip_serializing_if = "Option::is_none")]
3377 pub filename: Option<String>,
3380 #[serde(skip_serializing_if = "Option::is_none")]
3381 pub file_data: Option<String>,
3384 #[serde(skip_serializing_if = "Option::is_none")]
3385 pub file_id: Option<String>,
3387 }
3388 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3389 pub struct ChatCompletionRequestMessageContentPartFile {
3392 pub r#type: ChatCompletionRequestMessageContentPartFileType,
3394 pub file: ChatCompletionRequestMessageContentPartFileFile,
3395 }
3396 impl ::std::convert::From<ChatCompletionRequestMessageContentPartText>
3397 for ChatCompletionRequestUserMessageContentPart
3398 {
3399 fn from(value: ChatCompletionRequestMessageContentPartText) -> Self {
3400 ChatCompletionRequestUserMessageContentPart::ChatCompletionRequestMessageContentPartText(
3401 value,
3402 )
3403 }
3404 }
3405 impl ::std::convert::TryFrom<ChatCompletionRequestUserMessageContentPart>
3406 for ChatCompletionRequestMessageContentPartText
3407 {
3408 type Error = ChatCompletionRequestUserMessageContentPart;
3409 fn try_from(
3414 value: ChatCompletionRequestUserMessageContentPart,
3415 ) -> ::std::result::Result<Self, Self::Error> {
3416 match value {
3417 ChatCompletionRequestUserMessageContentPart::ChatCompletionRequestMessageContentPartText(
3418 inner,
3419 ) => ::std::result::Result::Ok(inner),
3420 other => ::std::result::Result::Err(other),
3421 }
3422 }
3423 }
3424 impl ::std::convert::From<ChatCompletionRequestMessageContentPartImage>
3425 for ChatCompletionRequestUserMessageContentPart
3426 {
3427 fn from(value: ChatCompletionRequestMessageContentPartImage) -> Self {
3428 ChatCompletionRequestUserMessageContentPart::ChatCompletionRequestMessageContentPartImage(
3429 value,
3430 )
3431 }
3432 }
3433 impl ::std::convert::TryFrom<ChatCompletionRequestUserMessageContentPart>
3434 for ChatCompletionRequestMessageContentPartImage
3435 {
3436 type Error = ChatCompletionRequestUserMessageContentPart;
3437 fn try_from(
3442 value: ChatCompletionRequestUserMessageContentPart,
3443 ) -> ::std::result::Result<Self, Self::Error> {
3444 match value {
3445 ChatCompletionRequestUserMessageContentPart::ChatCompletionRequestMessageContentPartImage(
3446 inner,
3447 ) => ::std::result::Result::Ok(inner),
3448 other => ::std::result::Result::Err(other),
3449 }
3450 }
3451 }
3452 impl ::std::convert::From<ChatCompletionRequestMessageContentPartAudio>
3453 for ChatCompletionRequestUserMessageContentPart
3454 {
3455 fn from(value: ChatCompletionRequestMessageContentPartAudio) -> Self {
3456 ChatCompletionRequestUserMessageContentPart::ChatCompletionRequestMessageContentPartAudio(
3457 value,
3458 )
3459 }
3460 }
3461 impl ::std::convert::TryFrom<ChatCompletionRequestUserMessageContentPart>
3462 for ChatCompletionRequestMessageContentPartAudio
3463 {
3464 type Error = ChatCompletionRequestUserMessageContentPart;
3465 fn try_from(
3470 value: ChatCompletionRequestUserMessageContentPart,
3471 ) -> ::std::result::Result<Self, Self::Error> {
3472 match value {
3473 ChatCompletionRequestUserMessageContentPart::ChatCompletionRequestMessageContentPartAudio(
3474 inner,
3475 ) => ::std::result::Result::Ok(inner),
3476 other => ::std::result::Result::Err(other),
3477 }
3478 }
3479 }
3480 impl ::std::convert::From<ChatCompletionRequestMessageContentPartFile>
3481 for ChatCompletionRequestUserMessageContentPart
3482 {
3483 fn from(value: ChatCompletionRequestMessageContentPartFile) -> Self {
3484 ChatCompletionRequestUserMessageContentPart::ChatCompletionRequestMessageContentPartFile(
3485 value,
3486 )
3487 }
3488 }
3489 impl ::std::convert::TryFrom<ChatCompletionRequestUserMessageContentPart>
3490 for ChatCompletionRequestMessageContentPartFile
3491 {
3492 type Error = ChatCompletionRequestUserMessageContentPart;
3493 fn try_from(
3498 value: ChatCompletionRequestUserMessageContentPart,
3499 ) -> ::std::result::Result<Self, Self::Error> {
3500 match value {
3501 ChatCompletionRequestUserMessageContentPart::ChatCompletionRequestMessageContentPartFile(
3502 inner,
3503 ) => ::std::result::Result::Ok(inner),
3504 other => ::std::result::Result::Err(other),
3505 }
3506 }
3507 }
3508 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3509 #[serde(untagged)]
3510 pub enum ChatCompletionRequestUserMessageContentPart {
3511 ChatCompletionRequestMessageContentPartText(ChatCompletionRequestMessageContentPartText),
3512 ChatCompletionRequestMessageContentPartImage(ChatCompletionRequestMessageContentPartImage),
3513 ChatCompletionRequestMessageContentPartAudio(ChatCompletionRequestMessageContentPartAudio),
3514 ChatCompletionRequestMessageContentPartFile(ChatCompletionRequestMessageContentPartFile),
3515 }
3516 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3517 #[serde(untagged)]
3518 pub enum ChatCompletionRequestUserMessageContent {
3520 ChatCompletionRequestUserMessageContentVariant0(String),
3521 ChatCompletionRequestUserMessageContentVariant1(
3522 Vec<ChatCompletionRequestUserMessageContentPart>,
3523 ),
3524 }
3525 impl ::std::convert::From<String> for ChatCompletionRequestUserMessageContent {
3526 fn from(value: String) -> Self {
3527 ChatCompletionRequestUserMessageContent::ChatCompletionRequestUserMessageContentVariant0(
3528 value,
3529 )
3530 }
3531 }
3532 impl ::std::convert::TryFrom<ChatCompletionRequestUserMessageContent> for String {
3533 type Error = ChatCompletionRequestUserMessageContent;
3534 fn try_from(
3539 value: ChatCompletionRequestUserMessageContent,
3540 ) -> ::std::result::Result<Self, Self::Error> {
3541 match value {
3542 ChatCompletionRequestUserMessageContent::ChatCompletionRequestUserMessageContentVariant0(
3543 inner,
3544 ) => ::std::result::Result::Ok(inner),
3545 other => ::std::result::Result::Err(other),
3546 }
3547 }
3548 }
3549 impl ::std::convert::From<Vec<ChatCompletionRequestUserMessageContentPart>>
3550 for ChatCompletionRequestUserMessageContent
3551 {
3552 fn from(value: Vec<ChatCompletionRequestUserMessageContentPart>) -> Self {
3553 ChatCompletionRequestUserMessageContent::ChatCompletionRequestUserMessageContentVariant1(
3554 value,
3555 )
3556 }
3557 }
3558 impl ::std::convert::TryFrom<ChatCompletionRequestUserMessageContent>
3559 for Vec<ChatCompletionRequestUserMessageContentPart>
3560 {
3561 type Error = ChatCompletionRequestUserMessageContent;
3562 fn try_from(
3567 value: ChatCompletionRequestUserMessageContent,
3568 ) -> ::std::result::Result<Self, Self::Error> {
3569 match value {
3570 ChatCompletionRequestUserMessageContent::ChatCompletionRequestUserMessageContentVariant1(
3571 inner,
3572 ) => ::std::result::Result::Ok(inner),
3573 other => ::std::result::Result::Err(other),
3574 }
3575 }
3576 }
3577 #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
3579 pub enum ChatCompletionRequestUserMessageRole {
3580 #[serde(rename = "user")]
3581 User,
3582 }
3583 impl ::std::fmt::Display for ChatCompletionRequestUserMessageRole {
3584 fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
3585 match self {
3586 Self::User => ::std::write!(__f, "user"),
3587 }
3588 }
3589 }
3590 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3591 pub struct ChatCompletionRequestUserMessage {
3595 pub content: ChatCompletionRequestUserMessageContent,
3597 pub role: ChatCompletionRequestUserMessageRole,
3599 #[serde(skip_serializing_if = "Option::is_none")]
3600 pub name: Option<String>,
3602 }
3603 #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
3605 pub enum ChatCompletionRequestMessageContentPartRefusalType {
3606 #[serde(rename = "refusal")]
3607 Refusal,
3608 }
3609 impl ::std::fmt::Display for ChatCompletionRequestMessageContentPartRefusalType {
3610 fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
3611 match self {
3612 Self::Refusal => ::std::write!(__f, "refusal"),
3613 }
3614 }
3615 }
3616 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3617 pub struct ChatCompletionRequestMessageContentPartRefusal {
3619 pub r#type: ChatCompletionRequestMessageContentPartRefusalType,
3621 pub refusal: String,
3623 }
3624 impl ::std::convert::From<ChatCompletionRequestMessageContentPartText>
3625 for ChatCompletionRequestAssistantMessageContentPart
3626 {
3627 fn from(value: ChatCompletionRequestMessageContentPartText) -> Self {
3628 ChatCompletionRequestAssistantMessageContentPart::ChatCompletionRequestMessageContentPartText(
3629 value,
3630 )
3631 }
3632 }
3633 impl ::std::convert::TryFrom<ChatCompletionRequestAssistantMessageContentPart>
3634 for ChatCompletionRequestMessageContentPartText
3635 {
3636 type Error = ChatCompletionRequestAssistantMessageContentPart;
3637 fn try_from(
3642 value: ChatCompletionRequestAssistantMessageContentPart,
3643 ) -> ::std::result::Result<Self, Self::Error> {
3644 match value {
3645 ChatCompletionRequestAssistantMessageContentPart::ChatCompletionRequestMessageContentPartText(
3646 inner,
3647 ) => ::std::result::Result::Ok(inner),
3648 other => ::std::result::Result::Err(other),
3649 }
3650 }
3651 }
3652 impl ::std::convert::From<ChatCompletionRequestMessageContentPartRefusal>
3653 for ChatCompletionRequestAssistantMessageContentPart
3654 {
3655 fn from(value: ChatCompletionRequestMessageContentPartRefusal) -> Self {
3656 ChatCompletionRequestAssistantMessageContentPart::ChatCompletionRequestMessageContentPartRefusal(
3657 value,
3658 )
3659 }
3660 }
3661 impl ::std::convert::TryFrom<ChatCompletionRequestAssistantMessageContentPart>
3662 for ChatCompletionRequestMessageContentPartRefusal
3663 {
3664 type Error = ChatCompletionRequestAssistantMessageContentPart;
3665 fn try_from(
3670 value: ChatCompletionRequestAssistantMessageContentPart,
3671 ) -> ::std::result::Result<Self, Self::Error> {
3672 match value {
3673 ChatCompletionRequestAssistantMessageContentPart::ChatCompletionRequestMessageContentPartRefusal(
3674 inner,
3675 ) => ::std::result::Result::Ok(inner),
3676 other => ::std::result::Result::Err(other),
3677 }
3678 }
3679 }
3680 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3681 #[serde(untagged)]
3682 pub enum ChatCompletionRequestAssistantMessageContentPart {
3683 ChatCompletionRequestMessageContentPartText(ChatCompletionRequestMessageContentPartText),
3684 ChatCompletionRequestMessageContentPartRefusal(
3685 ChatCompletionRequestMessageContentPartRefusal,
3686 ),
3687 }
3688 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3689 #[serde(untagged)]
3690 pub enum ChatCompletionRequestAssistantMessageContentVariant0 {
3692 ChatCompletionRequestAssistantMessageContentVariant0Variant0(String),
3693 ChatCompletionRequestAssistantMessageContentVariant0Variant1(
3694 Vec<ChatCompletionRequestAssistantMessageContentPart>,
3695 ),
3696 }
3697 impl ::std::convert::From<String> for ChatCompletionRequestAssistantMessageContentVariant0 {
3698 fn from(value: String) -> Self {
3699 ChatCompletionRequestAssistantMessageContentVariant0::ChatCompletionRequestAssistantMessageContentVariant0Variant0(
3700 value,
3701 )
3702 }
3703 }
3704 impl ::std::convert::TryFrom<ChatCompletionRequestAssistantMessageContentVariant0> for String {
3705 type Error = ChatCompletionRequestAssistantMessageContentVariant0;
3706 fn try_from(
3711 value: ChatCompletionRequestAssistantMessageContentVariant0,
3712 ) -> ::std::result::Result<Self, Self::Error> {
3713 match value {
3714 ChatCompletionRequestAssistantMessageContentVariant0::ChatCompletionRequestAssistantMessageContentVariant0Variant0(
3715 inner,
3716 ) => ::std::result::Result::Ok(inner),
3717 other => ::std::result::Result::Err(other),
3718 }
3719 }
3720 }
3721 impl ::std::convert::From<Vec<ChatCompletionRequestAssistantMessageContentPart>>
3722 for ChatCompletionRequestAssistantMessageContentVariant0
3723 {
3724 fn from(value: Vec<ChatCompletionRequestAssistantMessageContentPart>) -> Self {
3725 ChatCompletionRequestAssistantMessageContentVariant0::ChatCompletionRequestAssistantMessageContentVariant0Variant1(
3726 value,
3727 )
3728 }
3729 }
3730 impl ::std::convert::TryFrom<ChatCompletionRequestAssistantMessageContentVariant0>
3731 for Vec<ChatCompletionRequestAssistantMessageContentPart>
3732 {
3733 type Error = ChatCompletionRequestAssistantMessageContentVariant0;
3734 fn try_from(
3739 value: ChatCompletionRequestAssistantMessageContentVariant0,
3740 ) -> ::std::result::Result<Self, Self::Error> {
3741 match value {
3742 ChatCompletionRequestAssistantMessageContentVariant0::ChatCompletionRequestAssistantMessageContentVariant0Variant1(
3743 inner,
3744 ) => ::std::result::Result::Ok(inner),
3745 other => ::std::result::Result::Err(other),
3746 }
3747 }
3748 }
3749 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3750 #[serde(untagged)]
3751 pub enum ChatCompletionRequestAssistantMessageContent {
3752 ChatCompletionRequestAssistantMessageContentVariant0(
3753 ChatCompletionRequestAssistantMessageContentVariant0,
3754 ),
3755 ChatCompletionRequestAssistantMessageContentVariant1(Option<::serde_json::Value>),
3756 }
3757 impl ::std::convert::From<ChatCompletionRequestAssistantMessageContentVariant0>
3758 for ChatCompletionRequestAssistantMessageContent
3759 {
3760 fn from(value: ChatCompletionRequestAssistantMessageContentVariant0) -> Self {
3761 ChatCompletionRequestAssistantMessageContent::ChatCompletionRequestAssistantMessageContentVariant0(
3762 value,
3763 )
3764 }
3765 }
3766 impl ::std::convert::TryFrom<ChatCompletionRequestAssistantMessageContent>
3767 for ChatCompletionRequestAssistantMessageContentVariant0
3768 {
3769 type Error = ChatCompletionRequestAssistantMessageContent;
3770 fn try_from(
3775 value: ChatCompletionRequestAssistantMessageContent,
3776 ) -> ::std::result::Result<Self, Self::Error> {
3777 match value {
3778 ChatCompletionRequestAssistantMessageContent::ChatCompletionRequestAssistantMessageContentVariant0(
3779 inner,
3780 ) => ::std::result::Result::Ok(inner),
3781 other => ::std::result::Result::Err(other),
3782 }
3783 }
3784 }
3785 impl ::std::convert::From<Option<::serde_json::Value>>
3786 for ChatCompletionRequestAssistantMessageContent
3787 {
3788 fn from(value: Option<::serde_json::Value>) -> Self {
3789 ChatCompletionRequestAssistantMessageContent::ChatCompletionRequestAssistantMessageContentVariant1(
3790 value,
3791 )
3792 }
3793 }
3794 impl ::std::convert::TryFrom<ChatCompletionRequestAssistantMessageContent>
3795 for Option<::serde_json::Value>
3796 {
3797 type Error = ChatCompletionRequestAssistantMessageContent;
3798 fn try_from(
3803 value: ChatCompletionRequestAssistantMessageContent,
3804 ) -> ::std::result::Result<Self, Self::Error> {
3805 match value {
3806 ChatCompletionRequestAssistantMessageContent::ChatCompletionRequestAssistantMessageContentVariant1(
3807 inner,
3808 ) => ::std::result::Result::Ok(inner),
3809 other => ::std::result::Result::Err(other),
3810 }
3811 }
3812 }
3813 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3814 #[serde(untagged)]
3815 pub enum ChatCompletionRequestAssistantMessageRefusal {
3816 ChatCompletionRequestAssistantMessageRefusalVariant0(String),
3817 ChatCompletionRequestAssistantMessageRefusalVariant1(Option<::serde_json::Value>),
3818 }
3819 impl ::std::convert::From<String> for ChatCompletionRequestAssistantMessageRefusal {
3820 fn from(value: String) -> Self {
3821 ChatCompletionRequestAssistantMessageRefusal::ChatCompletionRequestAssistantMessageRefusalVariant0(
3822 value,
3823 )
3824 }
3825 }
3826 impl ::std::convert::TryFrom<ChatCompletionRequestAssistantMessageRefusal> for String {
3827 type Error = ChatCompletionRequestAssistantMessageRefusal;
3828 fn try_from(
3833 value: ChatCompletionRequestAssistantMessageRefusal,
3834 ) -> ::std::result::Result<Self, Self::Error> {
3835 match value {
3836 ChatCompletionRequestAssistantMessageRefusal::ChatCompletionRequestAssistantMessageRefusalVariant0(
3837 inner,
3838 ) => ::std::result::Result::Ok(inner),
3839 other => ::std::result::Result::Err(other),
3840 }
3841 }
3842 }
3843 impl ::std::convert::From<Option<::serde_json::Value>>
3844 for ChatCompletionRequestAssistantMessageRefusal
3845 {
3846 fn from(value: Option<::serde_json::Value>) -> Self {
3847 ChatCompletionRequestAssistantMessageRefusal::ChatCompletionRequestAssistantMessageRefusalVariant1(
3848 value,
3849 )
3850 }
3851 }
3852 impl ::std::convert::TryFrom<ChatCompletionRequestAssistantMessageRefusal>
3853 for Option<::serde_json::Value>
3854 {
3855 type Error = ChatCompletionRequestAssistantMessageRefusal;
3856 fn try_from(
3861 value: ChatCompletionRequestAssistantMessageRefusal,
3862 ) -> ::std::result::Result<Self, Self::Error> {
3863 match value {
3864 ChatCompletionRequestAssistantMessageRefusal::ChatCompletionRequestAssistantMessageRefusalVariant1(
3865 inner,
3866 ) => ::std::result::Result::Ok(inner),
3867 other => ::std::result::Result::Err(other),
3868 }
3869 }
3870 }
3871 #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
3873 pub enum ChatCompletionRequestAssistantMessageRole {
3874 #[serde(rename = "assistant")]
3875 Assistant,
3876 }
3877 impl ::std::fmt::Display for ChatCompletionRequestAssistantMessageRole {
3878 fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
3879 match self {
3880 Self::Assistant => ::std::write!(__f, "assistant"),
3881 }
3882 }
3883 }
3884 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3885 pub struct ChatCompletionRequestAssistantMessageAudioVariant0 {
3888 pub id: String,
3890 }
3891 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3892 #[serde(untagged)]
3893 pub enum ChatCompletionRequestAssistantMessageAudio {
3894 ChatCompletionRequestAssistantMessageAudioVariant0(
3895 ChatCompletionRequestAssistantMessageAudioVariant0,
3896 ),
3897 ChatCompletionRequestAssistantMessageAudioVariant1(Option<::serde_json::Value>),
3898 }
3899 impl ::std::convert::From<ChatCompletionRequestAssistantMessageAudioVariant0>
3900 for ChatCompletionRequestAssistantMessageAudio
3901 {
3902 fn from(value: ChatCompletionRequestAssistantMessageAudioVariant0) -> Self {
3903 ChatCompletionRequestAssistantMessageAudio::ChatCompletionRequestAssistantMessageAudioVariant0(
3904 value,
3905 )
3906 }
3907 }
3908 impl ::std::convert::TryFrom<ChatCompletionRequestAssistantMessageAudio>
3909 for ChatCompletionRequestAssistantMessageAudioVariant0
3910 {
3911 type Error = ChatCompletionRequestAssistantMessageAudio;
3912 fn try_from(
3917 value: ChatCompletionRequestAssistantMessageAudio,
3918 ) -> ::std::result::Result<Self, Self::Error> {
3919 match value {
3920 ChatCompletionRequestAssistantMessageAudio::ChatCompletionRequestAssistantMessageAudioVariant0(
3921 inner,
3922 ) => ::std::result::Result::Ok(inner),
3923 other => ::std::result::Result::Err(other),
3924 }
3925 }
3926 }
3927 impl ::std::convert::From<Option<::serde_json::Value>>
3928 for ChatCompletionRequestAssistantMessageAudio
3929 {
3930 fn from(value: Option<::serde_json::Value>) -> Self {
3931 ChatCompletionRequestAssistantMessageAudio::ChatCompletionRequestAssistantMessageAudioVariant1(
3932 value,
3933 )
3934 }
3935 }
3936 impl ::std::convert::TryFrom<ChatCompletionRequestAssistantMessageAudio>
3937 for Option<::serde_json::Value>
3938 {
3939 type Error = ChatCompletionRequestAssistantMessageAudio;
3940 fn try_from(
3945 value: ChatCompletionRequestAssistantMessageAudio,
3946 ) -> ::std::result::Result<Self, Self::Error> {
3947 match value {
3948 ChatCompletionRequestAssistantMessageAudio::ChatCompletionRequestAssistantMessageAudioVariant1(
3949 inner,
3950 ) => ::std::result::Result::Ok(inner),
3951 other => ::std::result::Result::Err(other),
3952 }
3953 }
3954 }
3955 #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
3957 pub enum ChatCompletionMessageToolCallType {
3958 #[serde(rename = "function")]
3959 Function,
3960 }
3961 impl ::std::fmt::Display for ChatCompletionMessageToolCallType {
3962 fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
3963 match self {
3964 Self::Function => ::std::write!(__f, "function"),
3965 }
3966 }
3967 }
3968 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3969 pub struct ChatCompletionMessageToolCallFunction {
3971 pub name: String,
3973 pub arguments: String,
3975 }
3976 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3977 pub struct ChatCompletionMessageToolCall {
3980 pub id: String,
3982 pub r#type: ChatCompletionMessageToolCallType,
3984 pub function: ChatCompletionMessageToolCallFunction,
3986 }
3987 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3988 #[serde(untagged)]
3989 pub enum ChatCompletionMessageToolCallsItem {
3990 ChatCompletionMessageToolCall(ChatCompletionMessageToolCall),
3991 ChatCompletionMessageCustomToolCall(ChatCompletionMessageCustomToolCall),
3992 }
3993 impl ::std::convert::From<ChatCompletionMessageToolCall> for ChatCompletionMessageToolCallsItem {
3994 fn from(value: ChatCompletionMessageToolCall) -> Self {
3995 ChatCompletionMessageToolCallsItem::ChatCompletionMessageToolCall(value)
3996 }
3997 }
3998 impl ::std::convert::TryFrom<ChatCompletionMessageToolCallsItem> for ChatCompletionMessageToolCall {
3999 type Error = ChatCompletionMessageToolCallsItem;
4000 fn try_from(
4005 value: ChatCompletionMessageToolCallsItem,
4006 ) -> ::std::result::Result<Self, Self::Error> {
4007 match value {
4008 ChatCompletionMessageToolCallsItem::ChatCompletionMessageToolCall(inner) => {
4009 ::std::result::Result::Ok(inner)
4010 }
4011 other => ::std::result::Result::Err(other),
4012 }
4013 }
4014 }
4015 impl ::std::convert::From<ChatCompletionMessageCustomToolCall>
4016 for ChatCompletionMessageToolCallsItem
4017 {
4018 fn from(value: ChatCompletionMessageCustomToolCall) -> Self {
4019 ChatCompletionMessageToolCallsItem::ChatCompletionMessageCustomToolCall(value)
4020 }
4021 }
4022 impl ::std::convert::TryFrom<ChatCompletionMessageToolCallsItem>
4023 for ChatCompletionMessageCustomToolCall
4024 {
4025 type Error = ChatCompletionMessageToolCallsItem;
4026 fn try_from(
4031 value: ChatCompletionMessageToolCallsItem,
4032 ) -> ::std::result::Result<Self, Self::Error> {
4033 match value {
4034 ChatCompletionMessageToolCallsItem::ChatCompletionMessageCustomToolCall(inner) => {
4035 ::std::result::Result::Ok(inner)
4036 }
4037 other => ::std::result::Result::Err(other),
4038 }
4039 }
4040 }
4041 pub type ChatCompletionMessageToolCalls = Vec<ChatCompletionMessageToolCallsItem>;
4043 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
4044 #[deprecated]
4045 pub struct ChatCompletionRequestAssistantMessageFunctionCallVariant0 {
4047 pub arguments: String,
4049 pub name: String,
4051 }
4052 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
4053 #[serde(untagged)]
4054 pub enum ChatCompletionRequestAssistantMessageFunctionCall {
4055 ChatCompletionRequestAssistantMessageFunctionCallVariant0(
4056 ChatCompletionRequestAssistantMessageFunctionCallVariant0,
4057 ),
4058 ChatCompletionRequestAssistantMessageFunctionCallVariant1(Option<::serde_json::Value>),
4059 }
4060 impl ::std::convert::From<ChatCompletionRequestAssistantMessageFunctionCallVariant0>
4061 for ChatCompletionRequestAssistantMessageFunctionCall
4062 {
4063 fn from(value: ChatCompletionRequestAssistantMessageFunctionCallVariant0) -> Self {
4064 ChatCompletionRequestAssistantMessageFunctionCall::ChatCompletionRequestAssistantMessageFunctionCallVariant0(
4065 value,
4066 )
4067 }
4068 }
4069 impl ::std::convert::TryFrom<ChatCompletionRequestAssistantMessageFunctionCall>
4070 for ChatCompletionRequestAssistantMessageFunctionCallVariant0
4071 {
4072 type Error = ChatCompletionRequestAssistantMessageFunctionCall;
4073 fn try_from(
4078 value: ChatCompletionRequestAssistantMessageFunctionCall,
4079 ) -> ::std::result::Result<Self, Self::Error> {
4080 match value {
4081 ChatCompletionRequestAssistantMessageFunctionCall::ChatCompletionRequestAssistantMessageFunctionCallVariant0(
4082 inner,
4083 ) => ::std::result::Result::Ok(inner),
4084 other => ::std::result::Result::Err(other),
4085 }
4086 }
4087 }
4088 impl ::std::convert::From<Option<::serde_json::Value>>
4089 for ChatCompletionRequestAssistantMessageFunctionCall
4090 {
4091 fn from(value: Option<::serde_json::Value>) -> Self {
4092 ChatCompletionRequestAssistantMessageFunctionCall::ChatCompletionRequestAssistantMessageFunctionCallVariant1(
4093 value,
4094 )
4095 }
4096 }
4097 impl ::std::convert::TryFrom<ChatCompletionRequestAssistantMessageFunctionCall>
4098 for Option<::serde_json::Value>
4099 {
4100 type Error = ChatCompletionRequestAssistantMessageFunctionCall;
4101 fn try_from(
4106 value: ChatCompletionRequestAssistantMessageFunctionCall,
4107 ) -> ::std::result::Result<Self, Self::Error> {
4108 match value {
4109 ChatCompletionRequestAssistantMessageFunctionCall::ChatCompletionRequestAssistantMessageFunctionCallVariant1(
4110 inner,
4111 ) => ::std::result::Result::Ok(inner),
4112 other => ::std::result::Result::Err(other),
4113 }
4114 }
4115 }
4116 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
4117 pub struct ChatCompletionRequestAssistantMessage {
4120 #[serde(skip_serializing_if = "Option::is_none")]
4121 pub content: Option<ChatCompletionRequestAssistantMessageContent>,
4122 #[serde(skip_serializing_if = "Option::is_none")]
4123 pub refusal: Option<ChatCompletionRequestAssistantMessageRefusal>,
4124 pub role: ChatCompletionRequestAssistantMessageRole,
4126 #[serde(skip_serializing_if = "Option::is_none")]
4127 pub name: Option<String>,
4129 #[serde(skip_serializing_if = "Option::is_none")]
4130 pub audio: Option<ChatCompletionRequestAssistantMessageAudio>,
4131 #[serde(skip_serializing_if = "Option::is_none")]
4132 pub tool_calls: Option<ChatCompletionMessageToolCalls>,
4133 #[serde(skip_serializing_if = "Option::is_none")]
4134 pub function_call: Option<ChatCompletionRequestAssistantMessageFunctionCall>,
4135 #[serde(skip_serializing_if = "Option::is_none")]
4136 pub reasoning_content: Option<String>,
4138 }
4139 #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
4141 pub enum ChatCompletionRequestToolMessageRole {
4142 #[serde(rename = "tool")]
4143 Tool,
4144 }
4145 impl ::std::fmt::Display for ChatCompletionRequestToolMessageRole {
4146 fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
4147 match self {
4148 Self::Tool => ::std::write!(__f, "tool"),
4149 }
4150 }
4151 }
4152 impl ::std::convert::From<ChatCompletionRequestMessageContentPartText>
4153 for ChatCompletionRequestToolMessageContentPart
4154 {
4155 fn from(value: ChatCompletionRequestMessageContentPartText) -> Self {
4156 ChatCompletionRequestToolMessageContentPart::ChatCompletionRequestMessageContentPartText(
4157 value,
4158 )
4159 }
4160 }
4161 impl ::std::convert::TryFrom<ChatCompletionRequestToolMessageContentPart>
4162 for ChatCompletionRequestMessageContentPartText
4163 {
4164 type Error = ChatCompletionRequestToolMessageContentPart;
4165 fn try_from(
4170 value: ChatCompletionRequestToolMessageContentPart,
4171 ) -> ::std::result::Result<Self, Self::Error> {
4172 match value {
4173 ChatCompletionRequestToolMessageContentPart::ChatCompletionRequestMessageContentPartText(
4174 inner,
4175 ) => ::std::result::Result::Ok(inner),
4176 other => ::std::result::Result::Err(other),
4177 }
4178 }
4179 }
4180 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
4181 #[serde(untagged)]
4182 pub enum ChatCompletionRequestToolMessageContentPart {
4183 ChatCompletionRequestMessageContentPartText(ChatCompletionRequestMessageContentPartText),
4184 }
4185 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
4186 #[serde(untagged)]
4187 pub enum ChatCompletionRequestToolMessageContent {
4189 ChatCompletionRequestToolMessageContentVariant0(String),
4190 ChatCompletionRequestToolMessageContentVariant1(
4191 Vec<ChatCompletionRequestToolMessageContentPart>,
4192 ),
4193 }
4194 impl ::std::convert::From<String> for ChatCompletionRequestToolMessageContent {
4195 fn from(value: String) -> Self {
4196 ChatCompletionRequestToolMessageContent::ChatCompletionRequestToolMessageContentVariant0(
4197 value,
4198 )
4199 }
4200 }
4201 impl ::std::convert::TryFrom<ChatCompletionRequestToolMessageContent> for String {
4202 type Error = ChatCompletionRequestToolMessageContent;
4203 fn try_from(
4208 value: ChatCompletionRequestToolMessageContent,
4209 ) -> ::std::result::Result<Self, Self::Error> {
4210 match value {
4211 ChatCompletionRequestToolMessageContent::ChatCompletionRequestToolMessageContentVariant0(
4212 inner,
4213 ) => ::std::result::Result::Ok(inner),
4214 other => ::std::result::Result::Err(other),
4215 }
4216 }
4217 }
4218 impl ::std::convert::From<Vec<ChatCompletionRequestToolMessageContentPart>>
4219 for ChatCompletionRequestToolMessageContent
4220 {
4221 fn from(value: Vec<ChatCompletionRequestToolMessageContentPart>) -> Self {
4222 ChatCompletionRequestToolMessageContent::ChatCompletionRequestToolMessageContentVariant1(
4223 value,
4224 )
4225 }
4226 }
4227 impl ::std::convert::TryFrom<ChatCompletionRequestToolMessageContent>
4228 for Vec<ChatCompletionRequestToolMessageContentPart>
4229 {
4230 type Error = ChatCompletionRequestToolMessageContent;
4231 fn try_from(
4236 value: ChatCompletionRequestToolMessageContent,
4237 ) -> ::std::result::Result<Self, Self::Error> {
4238 match value {
4239 ChatCompletionRequestToolMessageContent::ChatCompletionRequestToolMessageContentVariant1(
4240 inner,
4241 ) => ::std::result::Result::Ok(inner),
4242 other => ::std::result::Result::Err(other),
4243 }
4244 }
4245 }
4246 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
4247 pub struct ChatCompletionRequestToolMessage {
4249 pub role: ChatCompletionRequestToolMessageRole,
4251 pub content: ChatCompletionRequestToolMessageContent,
4253 pub tool_call_id: String,
4255 }
4256 #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
4258 pub enum ChatCompletionRequestFunctionMessageRole {
4259 #[serde(rename = "function")]
4260 Function,
4261 }
4262 impl ::std::fmt::Display for ChatCompletionRequestFunctionMessageRole {
4263 fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
4264 match self {
4265 Self::Function => ::std::write!(__f, "function"),
4266 }
4267 }
4268 }
4269 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
4270 #[serde(untagged)]
4271 pub enum ChatCompletionRequestFunctionMessageContent {
4272 ChatCompletionRequestFunctionMessageContentVariant0(String),
4273 ChatCompletionRequestFunctionMessageContentVariant1(Option<::serde_json::Value>),
4274 }
4275 impl ::std::convert::From<String> for ChatCompletionRequestFunctionMessageContent {
4276 fn from(value: String) -> Self {
4277 ChatCompletionRequestFunctionMessageContent::ChatCompletionRequestFunctionMessageContentVariant0(
4278 value,
4279 )
4280 }
4281 }
4282 impl ::std::convert::TryFrom<ChatCompletionRequestFunctionMessageContent> for String {
4283 type Error = ChatCompletionRequestFunctionMessageContent;
4284 fn try_from(
4289 value: ChatCompletionRequestFunctionMessageContent,
4290 ) -> ::std::result::Result<Self, Self::Error> {
4291 match value {
4292 ChatCompletionRequestFunctionMessageContent::ChatCompletionRequestFunctionMessageContentVariant0(
4293 inner,
4294 ) => ::std::result::Result::Ok(inner),
4295 other => ::std::result::Result::Err(other),
4296 }
4297 }
4298 }
4299 impl ::std::convert::From<Option<::serde_json::Value>>
4300 for ChatCompletionRequestFunctionMessageContent
4301 {
4302 fn from(value: Option<::serde_json::Value>) -> Self {
4303 ChatCompletionRequestFunctionMessageContent::ChatCompletionRequestFunctionMessageContentVariant1(
4304 value,
4305 )
4306 }
4307 }
4308 impl ::std::convert::TryFrom<ChatCompletionRequestFunctionMessageContent>
4309 for Option<::serde_json::Value>
4310 {
4311 type Error = ChatCompletionRequestFunctionMessageContent;
4312 fn try_from(
4317 value: ChatCompletionRequestFunctionMessageContent,
4318 ) -> ::std::result::Result<Self, Self::Error> {
4319 match value {
4320 ChatCompletionRequestFunctionMessageContent::ChatCompletionRequestFunctionMessageContentVariant1(
4321 inner,
4322 ) => ::std::result::Result::Ok(inner),
4323 other => ::std::result::Result::Err(other),
4324 }
4325 }
4326 }
4327 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
4328 #[deprecated]
4329 pub struct ChatCompletionRequestFunctionMessage {
4331 pub role: ChatCompletionRequestFunctionMessageRole,
4333 pub content: ChatCompletionRequestFunctionMessageContent,
4334 pub name: String,
4336 }
4337 impl ::std::convert::From<ChatCompletionRequestDeveloperMessage> for ChatCompletionRequestMessage {
4338 fn from(value: ChatCompletionRequestDeveloperMessage) -> Self {
4339 ChatCompletionRequestMessage::ChatCompletionRequestDeveloperMessage(value)
4340 }
4341 }
4342 impl ::std::convert::TryFrom<ChatCompletionRequestMessage>
4343 for ChatCompletionRequestDeveloperMessage
4344 {
4345 type Error = ChatCompletionRequestMessage;
4346 fn try_from(
4351 value: ChatCompletionRequestMessage,
4352 ) -> ::std::result::Result<Self, Self::Error> {
4353 match value {
4354 ChatCompletionRequestMessage::ChatCompletionRequestDeveloperMessage(inner) => {
4355 ::std::result::Result::Ok(inner)
4356 }
4357 other => ::std::result::Result::Err(other),
4358 }
4359 }
4360 }
4361 impl ::std::convert::From<ChatCompletionRequestSystemMessage> for ChatCompletionRequestMessage {
4362 fn from(value: ChatCompletionRequestSystemMessage) -> Self {
4363 ChatCompletionRequestMessage::ChatCompletionRequestSystemMessage(value)
4364 }
4365 }
4366 impl ::std::convert::TryFrom<ChatCompletionRequestMessage> for ChatCompletionRequestSystemMessage {
4367 type Error = ChatCompletionRequestMessage;
4368 fn try_from(
4373 value: ChatCompletionRequestMessage,
4374 ) -> ::std::result::Result<Self, Self::Error> {
4375 match value {
4376 ChatCompletionRequestMessage::ChatCompletionRequestSystemMessage(inner) => {
4377 ::std::result::Result::Ok(inner)
4378 }
4379 other => ::std::result::Result::Err(other),
4380 }
4381 }
4382 }
4383 impl ::std::convert::From<ChatCompletionRequestUserMessage> for ChatCompletionRequestMessage {
4384 fn from(value: ChatCompletionRequestUserMessage) -> Self {
4385 ChatCompletionRequestMessage::ChatCompletionRequestUserMessage(value)
4386 }
4387 }
4388 impl ::std::convert::TryFrom<ChatCompletionRequestMessage> for ChatCompletionRequestUserMessage {
4389 type Error = ChatCompletionRequestMessage;
4390 fn try_from(
4395 value: ChatCompletionRequestMessage,
4396 ) -> ::std::result::Result<Self, Self::Error> {
4397 match value {
4398 ChatCompletionRequestMessage::ChatCompletionRequestUserMessage(inner) => {
4399 ::std::result::Result::Ok(inner)
4400 }
4401 other => ::std::result::Result::Err(other),
4402 }
4403 }
4404 }
4405 impl ::std::convert::From<ChatCompletionRequestAssistantMessage> for ChatCompletionRequestMessage {
4406 fn from(value: ChatCompletionRequestAssistantMessage) -> Self {
4407 ChatCompletionRequestMessage::ChatCompletionRequestAssistantMessage(value)
4408 }
4409 }
4410 impl ::std::convert::TryFrom<ChatCompletionRequestMessage>
4411 for ChatCompletionRequestAssistantMessage
4412 {
4413 type Error = ChatCompletionRequestMessage;
4414 fn try_from(
4419 value: ChatCompletionRequestMessage,
4420 ) -> ::std::result::Result<Self, Self::Error> {
4421 match value {
4422 ChatCompletionRequestMessage::ChatCompletionRequestAssistantMessage(inner) => {
4423 ::std::result::Result::Ok(inner)
4424 }
4425 other => ::std::result::Result::Err(other),
4426 }
4427 }
4428 }
4429 impl ::std::convert::From<ChatCompletionRequestToolMessage> for ChatCompletionRequestMessage {
4430 fn from(value: ChatCompletionRequestToolMessage) -> Self {
4431 ChatCompletionRequestMessage::ChatCompletionRequestToolMessage(value)
4432 }
4433 }
4434 impl ::std::convert::TryFrom<ChatCompletionRequestMessage> for ChatCompletionRequestToolMessage {
4435 type Error = ChatCompletionRequestMessage;
4436 fn try_from(
4441 value: ChatCompletionRequestMessage,
4442 ) -> ::std::result::Result<Self, Self::Error> {
4443 match value {
4444 ChatCompletionRequestMessage::ChatCompletionRequestToolMessage(inner) => {
4445 ::std::result::Result::Ok(inner)
4446 }
4447 other => ::std::result::Result::Err(other),
4448 }
4449 }
4450 }
4451 impl ::std::convert::From<ChatCompletionRequestFunctionMessage> for ChatCompletionRequestMessage {
4452 fn from(value: ChatCompletionRequestFunctionMessage) -> Self {
4453 ChatCompletionRequestMessage::ChatCompletionRequestFunctionMessage(value)
4454 }
4455 }
4456 impl ::std::convert::TryFrom<ChatCompletionRequestMessage>
4457 for ChatCompletionRequestFunctionMessage
4458 {
4459 type Error = ChatCompletionRequestMessage;
4460 fn try_from(
4465 value: ChatCompletionRequestMessage,
4466 ) -> ::std::result::Result<Self, Self::Error> {
4467 match value {
4468 ChatCompletionRequestMessage::ChatCompletionRequestFunctionMessage(inner) => {
4469 ::std::result::Result::Ok(inner)
4470 }
4471 other => ::std::result::Result::Err(other),
4472 }
4473 }
4474 }
4475 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
4476 #[serde(untagged)]
4477 pub enum ChatCompletionRequestMessage {
4478 ChatCompletionRequestDeveloperMessage(ChatCompletionRequestDeveloperMessage),
4479 ChatCompletionRequestSystemMessage(ChatCompletionRequestSystemMessage),
4480 ChatCompletionRequestUserMessage(ChatCompletionRequestUserMessage),
4481 ChatCompletionRequestAssistantMessage(ChatCompletionRequestAssistantMessage),
4482 ChatCompletionRequestToolMessage(ChatCompletionRequestToolMessage),
4483 ChatCompletionRequestFunctionMessage(ChatCompletionRequestFunctionMessage),
4484 }
4485 #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
4487 pub enum CreateChatCompletionRequestWebSearchOptionsUserLocationType {
4488 #[serde(rename = "approximate")]
4489 Approximate,
4490 }
4491 impl ::std::fmt::Display for CreateChatCompletionRequestWebSearchOptionsUserLocationType {
4492 fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
4493 match self {
4494 Self::Approximate => ::std::write!(__f, "approximate"),
4495 }
4496 }
4497 }
4498 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
4499 pub struct CreateChatCompletionRequestWebSearchOptionsUserLocation {
4501 pub r#type: CreateChatCompletionRequestWebSearchOptionsUserLocationType,
4503 pub approximate: WebSearchLocation,
4504 }
4505 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
4506 pub struct CreateChatCompletionRequestWebSearchOptions {
4510 #[serde(skip_serializing_if = "Option::is_none")]
4511 pub user_location: Option<CreateChatCompletionRequestWebSearchOptionsUserLocation>,
4513 #[serde(skip_serializing_if = "Option::is_none")]
4514 pub search_context_size: Option<WebSearchContextSize>,
4515 }
4516 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
4517 #[serde(untagged)]
4518 pub enum CreateChatCompletionRequestResponseFormat {
4529 ResponseFormatText(ResponseFormatText),
4530 ResponseFormatJsonSchema(ResponseFormatJsonSchema),
4531 ResponseFormatJsonObject(ResponseFormatJsonObject),
4532 }
4533 impl ::std::convert::From<ResponseFormatText> for CreateChatCompletionRequestResponseFormat {
4534 fn from(value: ResponseFormatText) -> Self {
4535 CreateChatCompletionRequestResponseFormat::ResponseFormatText(value)
4536 }
4537 }
4538 impl ::std::convert::TryFrom<CreateChatCompletionRequestResponseFormat> for ResponseFormatText {
4539 type Error = CreateChatCompletionRequestResponseFormat;
4540 fn try_from(
4545 value: CreateChatCompletionRequestResponseFormat,
4546 ) -> ::std::result::Result<Self, Self::Error> {
4547 match value {
4548 CreateChatCompletionRequestResponseFormat::ResponseFormatText(inner) => {
4549 ::std::result::Result::Ok(inner)
4550 }
4551 other => ::std::result::Result::Err(other),
4552 }
4553 }
4554 }
4555 impl ::std::convert::From<ResponseFormatJsonSchema> for CreateChatCompletionRequestResponseFormat {
4556 fn from(value: ResponseFormatJsonSchema) -> Self {
4557 CreateChatCompletionRequestResponseFormat::ResponseFormatJsonSchema(value)
4558 }
4559 }
4560 impl ::std::convert::TryFrom<CreateChatCompletionRequestResponseFormat>
4561 for ResponseFormatJsonSchema
4562 {
4563 type Error = CreateChatCompletionRequestResponseFormat;
4564 fn try_from(
4569 value: CreateChatCompletionRequestResponseFormat,
4570 ) -> ::std::result::Result<Self, Self::Error> {
4571 match value {
4572 CreateChatCompletionRequestResponseFormat::ResponseFormatJsonSchema(inner) => {
4573 ::std::result::Result::Ok(inner)
4574 }
4575 other => ::std::result::Result::Err(other),
4576 }
4577 }
4578 }
4579 impl ::std::convert::From<ResponseFormatJsonObject> for CreateChatCompletionRequestResponseFormat {
4580 fn from(value: ResponseFormatJsonObject) -> Self {
4581 CreateChatCompletionRequestResponseFormat::ResponseFormatJsonObject(value)
4582 }
4583 }
4584 impl ::std::convert::TryFrom<CreateChatCompletionRequestResponseFormat>
4585 for ResponseFormatJsonObject
4586 {
4587 type Error = CreateChatCompletionRequestResponseFormat;
4588 fn try_from(
4593 value: CreateChatCompletionRequestResponseFormat,
4594 ) -> ::std::result::Result<Self, Self::Error> {
4595 match value {
4596 CreateChatCompletionRequestResponseFormat::ResponseFormatJsonObject(inner) => {
4597 ::std::result::Result::Ok(inner)
4598 }
4599 other => ::std::result::Result::Err(other),
4600 }
4601 }
4602 }
4603 #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
4606 pub enum CreateChatCompletionRequestAudioFormat {
4607 #[serde(rename = "wav")]
4608 Wav,
4609 #[serde(rename = "aac")]
4610 Aac,
4611 #[serde(rename = "mp3")]
4612 Mp3,
4613 #[serde(rename = "flac")]
4614 Flac,
4615 #[serde(rename = "opus")]
4616 Opus,
4617 #[serde(rename = "pcm16")]
4618 Pcm16,
4619 }
4620 impl ::std::fmt::Display for CreateChatCompletionRequestAudioFormat {
4621 fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
4622 match self {
4623 Self::Wav => ::std::write!(__f, "wav"),
4624 Self::Aac => ::std::write!(__f, "aac"),
4625 Self::Mp3 => ::std::write!(__f, "mp3"),
4626 Self::Flac => ::std::write!(__f, "flac"),
4627 Self::Opus => ::std::write!(__f, "opus"),
4628 Self::Pcm16 => ::std::write!(__f, "pcm16"),
4629 }
4630 }
4631 }
4632 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
4633 pub struct CreateChatCompletionRequestAudio {
4636 pub voice: VoiceIdsOrCustomVoice,
4637 pub format: CreateChatCompletionRequestAudioFormat,
4640 }
4641 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
4642 #[serde(untagged)]
4643 pub enum CreateChatCompletionRequestPrediction {
4648 PredictionContent(PredictionContent),
4649 }
4650 impl ::std::convert::From<PredictionContent> for CreateChatCompletionRequestPrediction {
4651 fn from(value: PredictionContent) -> Self {
4652 CreateChatCompletionRequestPrediction::PredictionContent(value)
4653 }
4654 }
4655 impl ::std::convert::TryFrom<CreateChatCompletionRequestPrediction> for PredictionContent {
4656 type Error = CreateChatCompletionRequestPrediction;
4657 fn try_from(
4662 value: CreateChatCompletionRequestPrediction,
4663 ) -> ::std::result::Result<Self, Self::Error> {
4664 match value {
4665 CreateChatCompletionRequestPrediction::PredictionContent(inner) => {
4666 ::std::result::Result::Ok(inner)
4667 }
4668 other => ::std::result::Result::Err(other),
4669 }
4670 }
4671 }
4672 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
4673 #[serde(untagged)]
4674 pub enum CreateChatCompletionRequestTools {
4675 ChatCompletionTool(ChatCompletionTool),
4676 CustomToolChatCompletions(CustomToolChatCompletions),
4677 }
4678 impl ::std::convert::From<ChatCompletionTool> for CreateChatCompletionRequestTools {
4679 fn from(value: ChatCompletionTool) -> Self {
4680 CreateChatCompletionRequestTools::ChatCompletionTool(value)
4681 }
4682 }
4683 impl ::std::convert::TryFrom<CreateChatCompletionRequestTools> for ChatCompletionTool {
4684 type Error = CreateChatCompletionRequestTools;
4685 fn try_from(
4690 value: CreateChatCompletionRequestTools,
4691 ) -> ::std::result::Result<Self, Self::Error> {
4692 match value {
4693 CreateChatCompletionRequestTools::ChatCompletionTool(inner) => {
4694 ::std::result::Result::Ok(inner)
4695 }
4696 other => ::std::result::Result::Err(other),
4697 }
4698 }
4699 }
4700 impl ::std::convert::From<CustomToolChatCompletions> for CreateChatCompletionRequestTools {
4701 fn from(value: CustomToolChatCompletions) -> Self {
4702 CreateChatCompletionRequestTools::CustomToolChatCompletions(value)
4703 }
4704 }
4705 impl ::std::convert::TryFrom<CreateChatCompletionRequestTools> for CustomToolChatCompletions {
4706 type Error = CreateChatCompletionRequestTools;
4707 fn try_from(
4712 value: CreateChatCompletionRequestTools,
4713 ) -> ::std::result::Result<Self, Self::Error> {
4714 match value {
4715 CreateChatCompletionRequestTools::CustomToolChatCompletions(inner) => {
4716 ::std::result::Result::Ok(inner)
4717 }
4718 other => ::std::result::Result::Err(other),
4719 }
4720 }
4721 }
4722 #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
4724 pub enum CreateChatCompletionRequestFunctionCallVariant0 {
4725 #[serde(rename = "none")]
4726 None,
4727 #[serde(rename = "auto")]
4728 Auto,
4729 }
4730 impl ::std::fmt::Display for CreateChatCompletionRequestFunctionCallVariant0 {
4731 fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
4732 match self {
4733 Self::None => ::std::write!(__f, "none"),
4734 Self::Auto => ::std::write!(__f, "auto"),
4735 }
4736 }
4737 }
4738 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
4739 #[serde(untagged)]
4740 #[deprecated]
4741 pub enum CreateChatCompletionRequestFunctionCall {
4757 CreateChatCompletionRequestFunctionCallVariant0(
4758 CreateChatCompletionRequestFunctionCallVariant0,
4759 ),
4760 ChatCompletionFunctionCallOption(ChatCompletionFunctionCallOption),
4761 }
4762 impl ::std::convert::From<CreateChatCompletionRequestFunctionCallVariant0>
4763 for CreateChatCompletionRequestFunctionCall
4764 {
4765 fn from(value: CreateChatCompletionRequestFunctionCallVariant0) -> Self {
4766 CreateChatCompletionRequestFunctionCall::CreateChatCompletionRequestFunctionCallVariant0(
4767 value,
4768 )
4769 }
4770 }
4771 impl ::std::convert::TryFrom<CreateChatCompletionRequestFunctionCall>
4772 for CreateChatCompletionRequestFunctionCallVariant0
4773 {
4774 type Error = CreateChatCompletionRequestFunctionCall;
4775 fn try_from(
4780 value: CreateChatCompletionRequestFunctionCall,
4781 ) -> ::std::result::Result<Self, Self::Error> {
4782 match value {
4783 CreateChatCompletionRequestFunctionCall::CreateChatCompletionRequestFunctionCallVariant0(
4784 inner,
4785 ) => ::std::result::Result::Ok(inner),
4786 other => ::std::result::Result::Err(other),
4787 }
4788 }
4789 }
4790 impl ::std::convert::From<ChatCompletionFunctionCallOption>
4791 for CreateChatCompletionRequestFunctionCall
4792 {
4793 fn from(value: ChatCompletionFunctionCallOption) -> Self {
4794 CreateChatCompletionRequestFunctionCall::ChatCompletionFunctionCallOption(value)
4795 }
4796 }
4797 impl ::std::convert::TryFrom<CreateChatCompletionRequestFunctionCall>
4798 for ChatCompletionFunctionCallOption
4799 {
4800 type Error = CreateChatCompletionRequestFunctionCall;
4801 fn try_from(
4806 value: CreateChatCompletionRequestFunctionCall,
4807 ) -> ::std::result::Result<Self, Self::Error> {
4808 match value {
4809 CreateChatCompletionRequestFunctionCall::ChatCompletionFunctionCallOption(
4810 inner,
4811 ) => ::std::result::Result::Ok(inner),
4812 other => ::std::result::Result::Err(other),
4813 }
4814 }
4815 }
4816 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
4817 pub struct CreateChatCompletionRequest {
4818 #[serde(skip_serializing_if = "Option::is_none")]
4819 pub metadata: Option<Metadata>,
4820 #[serde(skip_serializing_if = "Option::is_none")]
4821 pub top_logprobs: Option<CreateChatCompletionRequestTopLogprobs>,
4822 #[serde(skip_serializing_if = "Option::is_none")]
4823 pub temperature: Option<CreateChatCompletionRequestTemperature>,
4824 #[serde(skip_serializing_if = "Option::is_none")]
4825 pub top_p: Option<CreateChatCompletionRequestTopP>,
4826 #[serde(skip_serializing_if = "Option::is_none")]
4827 #[deprecated]
4831 pub user: Option<String>,
4832 #[serde(skip_serializing_if = "Option::is_none")]
4833 pub safety_identifier: Option<String>,
4836 #[serde(skip_serializing_if = "Option::is_none")]
4837 pub prompt_cache_key: Option<String>,
4839 #[serde(skip_serializing_if = "Option::is_none")]
4840 pub service_tier: Option<ServiceTier>,
4841 #[serde(skip_serializing_if = "Option::is_none")]
4842 pub prompt_cache_retention: Option<CreateChatCompletionRequestPromptCacheRetention>,
4843 pub messages: Vec<ChatCompletionRequestMessage>,
4848 pub model: ModelIdsShared,
4849 #[serde(skip_serializing_if = "Option::is_none")]
4850 pub modalities: Option<ResponseModalities>,
4851 #[serde(skip_serializing_if = "Option::is_none")]
4852 pub verbosity: Option<Verbosity>,
4853 #[serde(skip_serializing_if = "Option::is_none")]
4854 pub reasoning_effort: Option<ReasoningEffort>,
4855 #[serde(skip_serializing_if = "Option::is_none")]
4856 pub max_completion_tokens: Option<i64>,
4858 #[serde(skip_serializing_if = "Option::is_none")]
4859 pub frequency_penalty: Option<f64>,
4863 #[serde(skip_serializing_if = "Option::is_none")]
4864 pub presence_penalty: Option<f64>,
4868 #[serde(skip_serializing_if = "Option::is_none")]
4869 pub web_search_options: Option<CreateChatCompletionRequestWebSearchOptions>,
4872 #[serde(skip_serializing_if = "Option::is_none")]
4873 pub response_format: Option<CreateChatCompletionRequestResponseFormat>,
4884 #[serde(skip_serializing_if = "Option::is_none")]
4885 pub audio: Option<CreateChatCompletionRequestAudio>,
4888 #[serde(skip_serializing_if = "Option::is_none")]
4889 pub store: Option<bool>,
4895 #[serde(skip_serializing_if = "Option::is_none")]
4896 pub stream: Option<bool>,
4902 #[serde(skip_serializing_if = "Option::is_none")]
4903 pub stop: Option<StopConfiguration>,
4904 #[serde(skip_serializing_if = "Option::is_none")]
4905 pub logit_bias: Option<::std::collections::BTreeMap<String, i64>>,
4914 #[serde(skip_serializing_if = "Option::is_none")]
4915 pub logprobs: Option<bool>,
4919 #[serde(skip_serializing_if = "Option::is_none")]
4920 #[deprecated]
4927 pub max_tokens: Option<i64>,
4928 #[serde(skip_serializing_if = "Option::is_none")]
4929 pub n: Option<i64>,
4931 #[serde(skip_serializing_if = "Option::is_none")]
4932 pub prediction: Option<CreateChatCompletionRequestPrediction>,
4937 #[serde(skip_serializing_if = "Option::is_none")]
4938 #[deprecated]
4942 pub seed: Option<i64>,
4943 #[serde(skip_serializing_if = "Option::is_none")]
4944 pub stream_options: Option<ChatCompletionStreamOptions>,
4945 #[serde(skip_serializing_if = "Option::is_none")]
4946 pub tools: Option<Vec<CreateChatCompletionRequestTools>>,
4950 #[serde(skip_serializing_if = "Option::is_none")]
4951 pub tool_choice: Option<ChatCompletionToolChoiceOption>,
4952 #[serde(skip_serializing_if = "Option::is_none")]
4953 pub parallel_tool_calls: Option<ParallelToolCalls>,
4954 #[serde(skip_serializing_if = "Option::is_none")]
4955 #[deprecated]
4971 pub function_call: Option<CreateChatCompletionRequestFunctionCall>,
4972 #[serde(skip_serializing_if = "Option::is_none")]
4973 #[deprecated]
4977 pub functions: Option<Vec<ChatCompletionFunctions>>,
4978 }
4979 #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
4984 pub enum CreateChatCompletionResponseChoicesFinishReason {
4985 #[serde(rename = "stop")]
4986 Stop,
4987 #[serde(rename = "length")]
4988 Length,
4989 #[serde(rename = "tool_calls")]
4990 ToolCalls,
4991 #[serde(rename = "content_filter")]
4992 ContentFilter,
4993 #[serde(rename = "function_call")]
4994 FunctionCall,
4995 }
4996 impl ::std::fmt::Display for CreateChatCompletionResponseChoicesFinishReason {
4997 fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
4998 match self {
4999 Self::Stop => ::std::write!(__f, "stop"),
5000 Self::Length => ::std::write!(__f, "length"),
5001 Self::ToolCalls => ::std::write!(__f, "tool_calls"),
5002 Self::ContentFilter => ::std::write!(__f, "content_filter"),
5003 Self::FunctionCall => ::std::write!(__f, "function_call"),
5004 }
5005 }
5006 }
5007 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
5008 #[serde(untagged)]
5009 pub enum ChatCompletionResponseMessageContent {
5010 ChatCompletionResponseMessageContentVariant0(String),
5011 ChatCompletionResponseMessageContentVariant1(Option<::serde_json::Value>),
5012 }
5013 impl ::std::convert::From<String> for ChatCompletionResponseMessageContent {
5014 fn from(value: String) -> Self {
5015 ChatCompletionResponseMessageContent::ChatCompletionResponseMessageContentVariant0(
5016 value,
5017 )
5018 }
5019 }
5020 impl ::std::convert::TryFrom<ChatCompletionResponseMessageContent> for String {
5021 type Error = ChatCompletionResponseMessageContent;
5022 fn try_from(
5027 value: ChatCompletionResponseMessageContent,
5028 ) -> ::std::result::Result<Self, Self::Error> {
5029 match value {
5030 ChatCompletionResponseMessageContent::ChatCompletionResponseMessageContentVariant0(
5031 inner,
5032 ) => ::std::result::Result::Ok(inner),
5033 other => ::std::result::Result::Err(other),
5034 }
5035 }
5036 }
5037 impl ::std::convert::From<Option<::serde_json::Value>> for ChatCompletionResponseMessageContent {
5038 fn from(value: Option<::serde_json::Value>) -> Self {
5039 ChatCompletionResponseMessageContent::ChatCompletionResponseMessageContentVariant1(
5040 value,
5041 )
5042 }
5043 }
5044 impl ::std::convert::TryFrom<ChatCompletionResponseMessageContent> for Option<::serde_json::Value> {
5045 type Error = ChatCompletionResponseMessageContent;
5046 fn try_from(
5051 value: ChatCompletionResponseMessageContent,
5052 ) -> ::std::result::Result<Self, Self::Error> {
5053 match value {
5054 ChatCompletionResponseMessageContent::ChatCompletionResponseMessageContentVariant1(
5055 inner,
5056 ) => ::std::result::Result::Ok(inner),
5057 other => ::std::result::Result::Err(other),
5058 }
5059 }
5060 }
5061 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
5062 #[serde(untagged)]
5063 pub enum ChatCompletionResponseMessageRefusal {
5064 ChatCompletionResponseMessageRefusalVariant0(String),
5065 ChatCompletionResponseMessageRefusalVariant1(Option<::serde_json::Value>),
5066 }
5067 impl ::std::convert::From<String> for ChatCompletionResponseMessageRefusal {
5068 fn from(value: String) -> Self {
5069 ChatCompletionResponseMessageRefusal::ChatCompletionResponseMessageRefusalVariant0(
5070 value,
5071 )
5072 }
5073 }
5074 impl ::std::convert::TryFrom<ChatCompletionResponseMessageRefusal> for String {
5075 type Error = ChatCompletionResponseMessageRefusal;
5076 fn try_from(
5081 value: ChatCompletionResponseMessageRefusal,
5082 ) -> ::std::result::Result<Self, Self::Error> {
5083 match value {
5084 ChatCompletionResponseMessageRefusal::ChatCompletionResponseMessageRefusalVariant0(
5085 inner,
5086 ) => ::std::result::Result::Ok(inner),
5087 other => ::std::result::Result::Err(other),
5088 }
5089 }
5090 }
5091 impl ::std::convert::From<Option<::serde_json::Value>> for ChatCompletionResponseMessageRefusal {
5092 fn from(value: Option<::serde_json::Value>) -> Self {
5093 ChatCompletionResponseMessageRefusal::ChatCompletionResponseMessageRefusalVariant1(
5094 value,
5095 )
5096 }
5097 }
5098 impl ::std::convert::TryFrom<ChatCompletionResponseMessageRefusal> for Option<::serde_json::Value> {
5099 type Error = ChatCompletionResponseMessageRefusal;
5100 fn try_from(
5105 value: ChatCompletionResponseMessageRefusal,
5106 ) -> ::std::result::Result<Self, Self::Error> {
5107 match value {
5108 ChatCompletionResponseMessageRefusal::ChatCompletionResponseMessageRefusalVariant1(
5109 inner,
5110 ) => ::std::result::Result::Ok(inner),
5111 other => ::std::result::Result::Err(other),
5112 }
5113 }
5114 }
5115 #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
5117 pub enum ChatCompletionResponseMessageAnnotationsType {
5118 #[serde(rename = "url_citation")]
5119 UrlCitation,
5120 }
5121 impl ::std::fmt::Display for ChatCompletionResponseMessageAnnotationsType {
5122 fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
5123 match self {
5124 Self::UrlCitation => ::std::write!(__f, "url_citation"),
5125 }
5126 }
5127 }
5128 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
5129 pub struct ChatCompletionResponseMessageAnnotationsUrlCitation {
5131 pub end_index: i64,
5133 pub start_index: i64,
5135 pub url: String,
5137 pub title: String,
5139 }
5140 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
5141 pub struct ChatCompletionResponseMessageAnnotations {
5143 pub r#type: ChatCompletionResponseMessageAnnotationsType,
5145 pub url_citation: ChatCompletionResponseMessageAnnotationsUrlCitation,
5147 }
5148 #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
5150 pub enum ChatCompletionResponseMessageRole {
5151 #[serde(rename = "assistant")]
5152 Assistant,
5153 }
5154 impl ::std::fmt::Display for ChatCompletionResponseMessageRole {
5155 fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
5156 match self {
5157 Self::Assistant => ::std::write!(__f, "assistant"),
5158 }
5159 }
5160 }
5161 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
5162 #[deprecated]
5163 pub struct ChatCompletionResponseMessageFunctionCall {
5165 pub arguments: String,
5167 pub name: String,
5169 }
5170 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
5171 pub struct ChatCompletionResponseMessageAudioVariant0 {
5174 pub id: String,
5176 pub expires_at: i64,
5180 pub data: String,
5183 pub transcript: String,
5185 }
5186 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
5187 #[serde(untagged)]
5188 pub enum ChatCompletionResponseMessageAudio {
5189 ChatCompletionResponseMessageAudioVariant0(ChatCompletionResponseMessageAudioVariant0),
5190 ChatCompletionResponseMessageAudioVariant1(Option<::serde_json::Value>),
5191 }
5192 impl ::std::convert::From<ChatCompletionResponseMessageAudioVariant0>
5193 for ChatCompletionResponseMessageAudio
5194 {
5195 fn from(value: ChatCompletionResponseMessageAudioVariant0) -> Self {
5196 ChatCompletionResponseMessageAudio::ChatCompletionResponseMessageAudioVariant0(value)
5197 }
5198 }
5199 impl ::std::convert::TryFrom<ChatCompletionResponseMessageAudio>
5200 for ChatCompletionResponseMessageAudioVariant0
5201 {
5202 type Error = ChatCompletionResponseMessageAudio;
5203 fn try_from(
5208 value: ChatCompletionResponseMessageAudio,
5209 ) -> ::std::result::Result<Self, Self::Error> {
5210 match value {
5211 ChatCompletionResponseMessageAudio::ChatCompletionResponseMessageAudioVariant0(
5212 inner,
5213 ) => ::std::result::Result::Ok(inner),
5214 other => ::std::result::Result::Err(other),
5215 }
5216 }
5217 }
5218 impl ::std::convert::From<Option<::serde_json::Value>> for ChatCompletionResponseMessageAudio {
5219 fn from(value: Option<::serde_json::Value>) -> Self {
5220 ChatCompletionResponseMessageAudio::ChatCompletionResponseMessageAudioVariant1(value)
5221 }
5222 }
5223 impl ::std::convert::TryFrom<ChatCompletionResponseMessageAudio> for Option<::serde_json::Value> {
5224 type Error = ChatCompletionResponseMessageAudio;
5225 fn try_from(
5230 value: ChatCompletionResponseMessageAudio,
5231 ) -> ::std::result::Result<Self, Self::Error> {
5232 match value {
5233 ChatCompletionResponseMessageAudio::ChatCompletionResponseMessageAudioVariant1(
5234 inner,
5235 ) => ::std::result::Result::Ok(inner),
5236 other => ::std::result::Result::Err(other),
5237 }
5238 }
5239 }
5240 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
5241 pub struct ChatCompletionResponseMessage {
5243 pub content: ChatCompletionResponseMessageContent,
5244 pub refusal: ChatCompletionResponseMessageRefusal,
5245 #[serde(skip_serializing_if = "Option::is_none")]
5246 pub tool_calls: Option<ChatCompletionMessageToolCalls>,
5247 #[serde(skip_serializing_if = "Option::is_none")]
5248 pub annotations: Option<Vec<ChatCompletionResponseMessageAnnotations>>,
5251 pub role: ChatCompletionResponseMessageRole,
5253 #[serde(skip_serializing_if = "Option::is_none")]
5254 #[deprecated]
5256 pub function_call: Option<ChatCompletionResponseMessageFunctionCall>,
5257 #[serde(skip_serializing_if = "Option::is_none")]
5258 pub audio: Option<ChatCompletionResponseMessageAudio>,
5259 }
5260 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
5261 #[serde(untagged)]
5262 pub enum CreateChatCompletionResponseChoicesLogprobsVariant0Content {
5263 CreateChatCompletionResponseChoicesLogprobsVariant0ContentVariant0(
5264 Vec<ChatCompletionTokenLogprob>,
5265 ),
5266 CreateChatCompletionResponseChoicesLogprobsVariant0ContentVariant1(
5267 Option<::serde_json::Value>,
5268 ),
5269 }
5270 impl ::std::convert::From<Vec<ChatCompletionTokenLogprob>>
5271 for CreateChatCompletionResponseChoicesLogprobsVariant0Content
5272 {
5273 fn from(value: Vec<ChatCompletionTokenLogprob>) -> Self {
5274 CreateChatCompletionResponseChoicesLogprobsVariant0Content::CreateChatCompletionResponseChoicesLogprobsVariant0ContentVariant0(
5275 value,
5276 )
5277 }
5278 }
5279 impl ::std::convert::TryFrom<CreateChatCompletionResponseChoicesLogprobsVariant0Content>
5280 for Vec<ChatCompletionTokenLogprob>
5281 {
5282 type Error = CreateChatCompletionResponseChoicesLogprobsVariant0Content;
5283 fn try_from(
5288 value: CreateChatCompletionResponseChoicesLogprobsVariant0Content,
5289 ) -> ::std::result::Result<Self, Self::Error> {
5290 match value {
5291 CreateChatCompletionResponseChoicesLogprobsVariant0Content::CreateChatCompletionResponseChoicesLogprobsVariant0ContentVariant0(
5292 inner,
5293 ) => ::std::result::Result::Ok(inner),
5294 other => ::std::result::Result::Err(other),
5295 }
5296 }
5297 }
5298 impl ::std::convert::From<Option<::serde_json::Value>>
5299 for CreateChatCompletionResponseChoicesLogprobsVariant0Content
5300 {
5301 fn from(value: Option<::serde_json::Value>) -> Self {
5302 CreateChatCompletionResponseChoicesLogprobsVariant0Content::CreateChatCompletionResponseChoicesLogprobsVariant0ContentVariant1(
5303 value,
5304 )
5305 }
5306 }
5307 impl ::std::convert::TryFrom<CreateChatCompletionResponseChoicesLogprobsVariant0Content>
5308 for Option<::serde_json::Value>
5309 {
5310 type Error = CreateChatCompletionResponseChoicesLogprobsVariant0Content;
5311 fn try_from(
5316 value: CreateChatCompletionResponseChoicesLogprobsVariant0Content,
5317 ) -> ::std::result::Result<Self, Self::Error> {
5318 match value {
5319 CreateChatCompletionResponseChoicesLogprobsVariant0Content::CreateChatCompletionResponseChoicesLogprobsVariant0ContentVariant1(
5320 inner,
5321 ) => ::std::result::Result::Ok(inner),
5322 other => ::std::result::Result::Err(other),
5323 }
5324 }
5325 }
5326 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
5327 #[serde(untagged)]
5328 pub enum CreateChatCompletionResponseChoicesLogprobsVariant0Refusal {
5329 CreateChatCompletionResponseChoicesLogprobsVariant0RefusalVariant0(
5330 Vec<ChatCompletionTokenLogprob>,
5331 ),
5332 CreateChatCompletionResponseChoicesLogprobsVariant0RefusalVariant1(
5333 Option<::serde_json::Value>,
5334 ),
5335 }
5336 impl ::std::convert::From<Vec<ChatCompletionTokenLogprob>>
5337 for CreateChatCompletionResponseChoicesLogprobsVariant0Refusal
5338 {
5339 fn from(value: Vec<ChatCompletionTokenLogprob>) -> Self {
5340 CreateChatCompletionResponseChoicesLogprobsVariant0Refusal::CreateChatCompletionResponseChoicesLogprobsVariant0RefusalVariant0(
5341 value,
5342 )
5343 }
5344 }
5345 impl ::std::convert::TryFrom<CreateChatCompletionResponseChoicesLogprobsVariant0Refusal>
5346 for Vec<ChatCompletionTokenLogprob>
5347 {
5348 type Error = CreateChatCompletionResponseChoicesLogprobsVariant0Refusal;
5349 fn try_from(
5354 value: CreateChatCompletionResponseChoicesLogprobsVariant0Refusal,
5355 ) -> ::std::result::Result<Self, Self::Error> {
5356 match value {
5357 CreateChatCompletionResponseChoicesLogprobsVariant0Refusal::CreateChatCompletionResponseChoicesLogprobsVariant0RefusalVariant0(
5358 inner,
5359 ) => ::std::result::Result::Ok(inner),
5360 other => ::std::result::Result::Err(other),
5361 }
5362 }
5363 }
5364 impl ::std::convert::From<Option<::serde_json::Value>>
5365 for CreateChatCompletionResponseChoicesLogprobsVariant0Refusal
5366 {
5367 fn from(value: Option<::serde_json::Value>) -> Self {
5368 CreateChatCompletionResponseChoicesLogprobsVariant0Refusal::CreateChatCompletionResponseChoicesLogprobsVariant0RefusalVariant1(
5369 value,
5370 )
5371 }
5372 }
5373 impl ::std::convert::TryFrom<CreateChatCompletionResponseChoicesLogprobsVariant0Refusal>
5374 for Option<::serde_json::Value>
5375 {
5376 type Error = CreateChatCompletionResponseChoicesLogprobsVariant0Refusal;
5377 fn try_from(
5382 value: CreateChatCompletionResponseChoicesLogprobsVariant0Refusal,
5383 ) -> ::std::result::Result<Self, Self::Error> {
5384 match value {
5385 CreateChatCompletionResponseChoicesLogprobsVariant0Refusal::CreateChatCompletionResponseChoicesLogprobsVariant0RefusalVariant1(
5386 inner,
5387 ) => ::std::result::Result::Ok(inner),
5388 other => ::std::result::Result::Err(other),
5389 }
5390 }
5391 }
5392 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
5393 pub struct CreateChatCompletionResponseChoicesLogprobsVariant0 {
5395 pub content: CreateChatCompletionResponseChoicesLogprobsVariant0Content,
5396 pub refusal: CreateChatCompletionResponseChoicesLogprobsVariant0Refusal,
5397 }
5398 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
5399 #[serde(untagged)]
5400 pub enum CreateChatCompletionResponseChoicesLogprobs {
5401 CreateChatCompletionResponseChoicesLogprobsVariant0(
5402 CreateChatCompletionResponseChoicesLogprobsVariant0,
5403 ),
5404 CreateChatCompletionResponseChoicesLogprobsVariant1(Option<::serde_json::Value>),
5405 }
5406 impl ::std::convert::From<CreateChatCompletionResponseChoicesLogprobsVariant0>
5407 for CreateChatCompletionResponseChoicesLogprobs
5408 {
5409 fn from(value: CreateChatCompletionResponseChoicesLogprobsVariant0) -> Self {
5410 CreateChatCompletionResponseChoicesLogprobs::CreateChatCompletionResponseChoicesLogprobsVariant0(
5411 value,
5412 )
5413 }
5414 }
5415 impl ::std::convert::TryFrom<CreateChatCompletionResponseChoicesLogprobs>
5416 for CreateChatCompletionResponseChoicesLogprobsVariant0
5417 {
5418 type Error = CreateChatCompletionResponseChoicesLogprobs;
5419 fn try_from(
5424 value: CreateChatCompletionResponseChoicesLogprobs,
5425 ) -> ::std::result::Result<Self, Self::Error> {
5426 match value {
5427 CreateChatCompletionResponseChoicesLogprobs::CreateChatCompletionResponseChoicesLogprobsVariant0(
5428 inner,
5429 ) => ::std::result::Result::Ok(inner),
5430 other => ::std::result::Result::Err(other),
5431 }
5432 }
5433 }
5434 impl ::std::convert::From<Option<::serde_json::Value>>
5435 for CreateChatCompletionResponseChoicesLogprobs
5436 {
5437 fn from(value: Option<::serde_json::Value>) -> Self {
5438 CreateChatCompletionResponseChoicesLogprobs::CreateChatCompletionResponseChoicesLogprobsVariant1(
5439 value,
5440 )
5441 }
5442 }
5443 impl ::std::convert::TryFrom<CreateChatCompletionResponseChoicesLogprobs>
5444 for Option<::serde_json::Value>
5445 {
5446 type Error = CreateChatCompletionResponseChoicesLogprobs;
5447 fn try_from(
5452 value: CreateChatCompletionResponseChoicesLogprobs,
5453 ) -> ::std::result::Result<Self, Self::Error> {
5454 match value {
5455 CreateChatCompletionResponseChoicesLogprobs::CreateChatCompletionResponseChoicesLogprobsVariant1(
5456 inner,
5457 ) => ::std::result::Result::Ok(inner),
5458 other => ::std::result::Result::Err(other),
5459 }
5460 }
5461 }
5462 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
5463 pub struct CreateChatCompletionResponseChoices {
5464 pub finish_reason: CreateChatCompletionResponseChoicesFinishReason,
5469 pub index: i64,
5471 pub message: ChatCompletionResponseMessage,
5472 pub logprobs: CreateChatCompletionResponseChoicesLogprobs,
5473 }
5474 #[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
5476 pub enum CreateChatCompletionResponseObject {
5477 #[serde(rename = "chat.completion")]
5478 ChatCompletion,
5479 }
5480 impl ::std::fmt::Display for CreateChatCompletionResponseObject {
5481 fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
5482 match self {
5483 Self::ChatCompletion => ::std::write!(__f, "chat.completion"),
5484 }
5485 }
5486 }
5487 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
5488 pub struct CreateChatCompletionResponse {
5490 pub id: String,
5492 pub choices: Vec<CreateChatCompletionResponseChoices>,
5494 pub created: i64,
5496 pub model: String,
5498 #[serde(skip_serializing_if = "Option::is_none")]
5499 pub service_tier: Option<ServiceTier>,
5500 #[serde(skip_serializing_if = "Option::is_none")]
5501 #[deprecated]
5505 pub system_fingerprint: Option<String>,
5506 pub object: CreateChatCompletionResponseObject,
5508 #[serde(skip_serializing_if = "Option::is_none")]
5509 pub usage: Option<CompletionUsage>,
5510 }
5511 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
5512 pub struct OpenAiErrorResponseError {
5513 pub message: String,
5515 pub r#type: String,
5517 #[serde(skip_serializing_if = "Option::is_none")]
5518 pub code: Option<String>,
5520 #[serde(skip_serializing_if = "Option::is_none")]
5521 pub param: Option<String>,
5523 }
5524 #[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
5525 pub struct OpenAiErrorResponse {
5527 pub error: OpenAiErrorResponseError,
5528 }
5529}
5530pub mod operations {
5531 #![allow(deprecated)]
5532 #![allow(unreachable_patterns)]
5533 #![allow(non_camel_case_types)]
5534 #![allow(non_snake_case)]
5535 #![allow(clippy::all, clippy::pedantic)]
5536 pub mod models {
5537 pub mod get {
5538 #[derive(Debug, Clone, PartialEq)]
5539 pub struct Request {}
5541 impl Request {
5542 pub const METHOD: ::http::Method = ::http::Method::GET;
5545 pub const PATH_TEMPLATE: &'static str = "/models";
5549 pub const SECURITY: &'static [&'static [&'static str]] = &[&["ApiKeyAuth"]];
5554 pub fn with_accept(self, accept: ::http::HeaderValue) -> ::toac::WithAccept<Self> {
5562 ::toac::WithAccept::new(self, accept)
5563 }
5564 }
5565 impl ::toac::MakeRequest for Request {
5566 type Error = ::std::convert::Infallible;
5567 fn make_request(
5568 self,
5569 ) -> impl ::std::future::Future<
5570 Output = ::std::result::Result<::toac::Request, Self::Error>,
5571 > + Send {
5572 async move {
5573 let mut __path = ::std::string::String::new();
5574 __path.push_str("/models");
5575 let mut __builder = ::http::Request::builder()
5576 .method(::http::Method::GET)
5577 .uri(__path);
5578 __builder = __builder.header(
5579 ::http::header::ACCEPT,
5580 ::http::HeaderValue::from_static("application/json"),
5581 );
5582 let mut __request = __builder
5583 .body(::toac::body::Body::empty())
5584 .expect("valid generated HTTP request");
5585 __request
5586 .extensions_mut()
5587 .insert(::toac::OperationSecurity(&[&["ApiKeyAuth"]]));
5588 ::std::result::Result::Ok(__request)
5589 }
5590 }
5591 }
5592 #[derive(Debug, Clone, PartialEq)]
5593 pub enum ResponseBody {
5594 Status200(crate::wire::openai::components::ListModelsResponse),
5596 Status400(crate::wire::openai::components::OpenAiErrorResponse),
5598 Status401(crate::wire::openai::components::OpenAiErrorResponse),
5600 Status403(crate::wire::openai::components::OpenAiErrorResponse),
5602 Status404(crate::wire::openai::components::OpenAiErrorResponse),
5604 Status413(crate::wire::openai::components::OpenAiErrorResponse),
5606 Status429(crate::wire::openai::components::OpenAiErrorResponse),
5608 Status500(crate::wire::openai::components::OpenAiErrorResponse),
5610 Status502(crate::wire::openai::components::OpenAiErrorResponse),
5612 Status503(crate::wire::openai::components::OpenAiErrorResponse),
5614 }
5615 #[derive(Debug, Clone, PartialEq)]
5616 pub struct Response {
5617 pub headers: ::http::HeaderMap,
5619 pub body: ResponseBody,
5622 }
5623 impl ::toac::ParseResponse for Response {
5624 type Error = ::toac::DecodeError;
5625 fn parse_response<__B>(
5626 response: ::http::Response<__B>,
5627 ) -> impl ::std::future::Future<
5628 Output = ::std::result::Result<Self, Self::Error>,
5629 > + ::std::marker::Send
5630 where
5631 __B: ::http_body::Body<Data = ::bytes::Bytes>
5632 + ::std::marker::Send
5633 + ::std::marker::Sync
5634 + 'static,
5635 __B::Error: ::std::convert::Into<::toac::BoxError>,
5636 {
5637 async move {
5638 let (__parts, __body) = response.into_parts();
5639 let __status = __parts.status;
5640 let __headers = __parts.headers;
5641 match __status.as_u16() {
5642 200u16 => {
5643 let __decoder = <::toac::body::codec::json::JsonDecoder as ::std::default::Default>::default();
5644 let __value = ::toac::body::codec::decode_body(&__decoder, __body)
5645 .await
5646 .map_err(|e| {
5647 ::toac::DecodeError::Codec(::std::convert::Into::into(e))
5648 })?;
5649 return ::std::result::Result::Ok(Self {
5650 headers: __headers,
5651 body: ResponseBody::Status200(__value),
5652 });
5653 }
5654 400u16 => {
5655 let __decoder = <::toac::body::codec::json::JsonDecoder as ::std::default::Default>::default();
5656 let __value = ::toac::body::codec::decode_body(&__decoder, __body)
5657 .await
5658 .map_err(|e| {
5659 ::toac::DecodeError::Codec(::std::convert::Into::into(e))
5660 })?;
5661 return ::std::result::Result::Ok(Self {
5662 headers: __headers,
5663 body: ResponseBody::Status400(__value),
5664 });
5665 }
5666 401u16 => {
5667 let __decoder = <::toac::body::codec::json::JsonDecoder as ::std::default::Default>::default();
5668 let __value = ::toac::body::codec::decode_body(&__decoder, __body)
5669 .await
5670 .map_err(|e| {
5671 ::toac::DecodeError::Codec(::std::convert::Into::into(e))
5672 })?;
5673 return ::std::result::Result::Ok(Self {
5674 headers: __headers,
5675 body: ResponseBody::Status401(__value),
5676 });
5677 }
5678 403u16 => {
5679 let __decoder = <::toac::body::codec::json::JsonDecoder as ::std::default::Default>::default();
5680 let __value = ::toac::body::codec::decode_body(&__decoder, __body)
5681 .await
5682 .map_err(|e| {
5683 ::toac::DecodeError::Codec(::std::convert::Into::into(e))
5684 })?;
5685 return ::std::result::Result::Ok(Self {
5686 headers: __headers,
5687 body: ResponseBody::Status403(__value),
5688 });
5689 }
5690 404u16 => {
5691 let __decoder = <::toac::body::codec::json::JsonDecoder as ::std::default::Default>::default();
5692 let __value = ::toac::body::codec::decode_body(&__decoder, __body)
5693 .await
5694 .map_err(|e| {
5695 ::toac::DecodeError::Codec(::std::convert::Into::into(e))
5696 })?;
5697 return ::std::result::Result::Ok(Self {
5698 headers: __headers,
5699 body: ResponseBody::Status404(__value),
5700 });
5701 }
5702 413u16 => {
5703 let __decoder = <::toac::body::codec::json::JsonDecoder as ::std::default::Default>::default();
5704 let __value = ::toac::body::codec::decode_body(&__decoder, __body)
5705 .await
5706 .map_err(|e| {
5707 ::toac::DecodeError::Codec(::std::convert::Into::into(e))
5708 })?;
5709 return ::std::result::Result::Ok(Self {
5710 headers: __headers,
5711 body: ResponseBody::Status413(__value),
5712 });
5713 }
5714 429u16 => {
5715 let __decoder = <::toac::body::codec::json::JsonDecoder as ::std::default::Default>::default();
5716 let __value = ::toac::body::codec::decode_body(&__decoder, __body)
5717 .await
5718 .map_err(|e| {
5719 ::toac::DecodeError::Codec(::std::convert::Into::into(e))
5720 })?;
5721 return ::std::result::Result::Ok(Self {
5722 headers: __headers,
5723 body: ResponseBody::Status429(__value),
5724 });
5725 }
5726 500u16 => {
5727 let __decoder = <::toac::body::codec::json::JsonDecoder as ::std::default::Default>::default();
5728 let __value = ::toac::body::codec::decode_body(&__decoder, __body)
5729 .await
5730 .map_err(|e| {
5731 ::toac::DecodeError::Codec(::std::convert::Into::into(e))
5732 })?;
5733 return ::std::result::Result::Ok(Self {
5734 headers: __headers,
5735 body: ResponseBody::Status500(__value),
5736 });
5737 }
5738 502u16 => {
5739 let __decoder = <::toac::body::codec::json::JsonDecoder as ::std::default::Default>::default();
5740 let __value = ::toac::body::codec::decode_body(&__decoder, __body)
5741 .await
5742 .map_err(|e| {
5743 ::toac::DecodeError::Codec(::std::convert::Into::into(e))
5744 })?;
5745 return ::std::result::Result::Ok(Self {
5746 headers: __headers,
5747 body: ResponseBody::Status502(__value),
5748 });
5749 }
5750 503u16 => {
5751 let __decoder = <::toac::body::codec::json::JsonDecoder as ::std::default::Default>::default();
5752 let __value = ::toac::body::codec::decode_body(&__decoder, __body)
5753 .await
5754 .map_err(|e| {
5755 ::toac::DecodeError::Codec(::std::convert::Into::into(e))
5756 })?;
5757 return ::std::result::Result::Ok(Self {
5758 headers: __headers,
5759 body: ResponseBody::Status503(__value),
5760 });
5761 }
5762 _ => {}
5763 }
5764 ::std::mem::drop(__body);
5765 return ::std::result::Result::Err(::toac::DecodeError::UnexpectedStatus(
5766 __status,
5767 ));
5768 }
5769 }
5770 }
5771 impl ::toac::Operation for Request {
5772 type Response = Response;
5773 }
5774 }
5775 }
5776 pub mod chat {
5777 pub mod completions {
5778 pub mod post {
5779 #[derive(Debug, Clone, PartialEq)]
5780 pub struct Request {
5801 pub body: crate::wire::openai::components::CreateChatCompletionRequest,
5802 }
5803 impl Request {
5804 pub const METHOD: ::http::Method = ::http::Method::POST;
5807 pub const PATH_TEMPLATE: &'static str = "/chat/completions";
5811 pub const SECURITY: &'static [&'static [&'static str]] = &[&["ApiKeyAuth"]];
5816 pub fn with_accept(
5824 self,
5825 accept: ::http::HeaderValue,
5826 ) -> ::toac::WithAccept<Self> {
5827 ::toac::WithAccept::new(self, accept)
5828 }
5829 }
5830 impl ::toac::MakeRequest for Request {
5831 type Error = ::serde_json::Error;
5832 fn make_request(
5833 self,
5834 ) -> impl ::std::future::Future<
5835 Output = ::std::result::Result<::toac::Request, Self::Error>,
5836 > + Send {
5837 async move {
5838 let mut __path = ::std::string::String::new();
5839 __path.push_str("/chat/completions");
5840 let mut __builder = ::http::Request::builder()
5841 .method(::http::Method::POST)
5842 .uri(__path);
5843 __builder = __builder.header(
5844 ::http::header::ACCEPT,
5845 ::http::HeaderValue::from_static(
5846 "application/json, text/event-stream",
5847 ),
5848 );
5849 let mut __request = __builder
5850 .body(::toac::body::Body::empty())
5851 .expect("valid generated HTTP request");
5852 __request
5853 .extensions_mut()
5854 .insert(::toac::OperationSecurity(&[&["ApiKeyAuth"]]));
5855 {
5856 let __payload = &self.body;
5857 ::toac::body::codec::encode_body(
5858 &<::toac::body::codec::json::JsonEncoder as ::std::default::Default>::default(),
5859 __payload,
5860 __request,
5861 )
5862 }
5863 }
5864 }
5865 }
5866 pub enum ResponseBody {
5867 Status200Json(crate::wire::openai::components::CreateChatCompletionResponse),
5869 Status200Sse(::toac::body::codec::sse::SseEventStream),
5871 Status400(crate::wire::openai::components::OpenAiErrorResponse),
5873 Status401(crate::wire::openai::components::OpenAiErrorResponse),
5875 Status403(crate::wire::openai::components::OpenAiErrorResponse),
5877 Status404(crate::wire::openai::components::OpenAiErrorResponse),
5879 Status413(crate::wire::openai::components::OpenAiErrorResponse),
5881 Status429(crate::wire::openai::components::OpenAiErrorResponse),
5883 Status500(crate::wire::openai::components::OpenAiErrorResponse),
5885 Status502(crate::wire::openai::components::OpenAiErrorResponse),
5887 Status503(crate::wire::openai::components::OpenAiErrorResponse),
5889 }
5890 pub struct Response {
5891 pub headers: ::http::HeaderMap,
5893 pub body: ResponseBody,
5896 }
5897 impl ::toac::ParseResponse for Response {
5898 type Error = ::toac::DecodeError;
5899 fn parse_response<__B>(
5900 response: ::http::Response<__B>,
5901 ) -> impl ::std::future::Future<
5902 Output = ::std::result::Result<Self, Self::Error>,
5903 > + ::std::marker::Send
5904 where
5905 __B: ::http_body::Body<Data = ::bytes::Bytes>
5906 + ::std::marker::Send
5907 + ::std::marker::Sync
5908 + 'static,
5909 __B::Error: ::std::convert::Into<::toac::BoxError>,
5910 {
5911 async move {
5912 let (__parts, __body) = response.into_parts();
5913 let __status = __parts.status;
5914 let __headers = __parts.headers;
5915 let __content_type = __headers
5916 .get(::http::header::CONTENT_TYPE)
5917 .and_then(|v| v.to_str().ok())
5918 .map(|s| {
5919 s.split(';').next().unwrap_or(s).trim().to_ascii_lowercase()
5920 });
5921 match __status.as_u16() {
5922 200u16 => match __content_type.as_deref() {
5923 ::std::option::Option::Some(__ct)
5924 if __ct == "application/json" =>
5925 {
5926 let __decoder = <::toac::body::codec::json::JsonDecoder as ::std::default::Default>::default();
5927 let __value =
5928 ::toac::body::codec::decode_body(&__decoder, __body)
5929 .await
5930 .map_err(|e| {
5931 ::toac::DecodeError::Codec(
5932 ::std::convert::Into::into(e),
5933 )
5934 })?;
5935 return ::std::result::Result::Ok(Self {
5936 headers: __headers,
5937 body: ResponseBody::Status200Json(__value),
5938 });
5939 }
5940 ::std::option::Option::Some(__ct)
5941 if __ct == "text/event-stream" =>
5942 {
5943 let __decoder = <::toac::body::codec::sse::SseDecoder as ::std::default::Default>::default();
5944 let __value =
5945 ::toac::body::codec::decode_body(&__decoder, __body)
5946 .await
5947 .map_err(|e| {
5948 ::toac::DecodeError::Codec(
5949 ::std::convert::Into::into(e),
5950 )
5951 })?;
5952 return ::std::result::Result::Ok(Self {
5953 headers: __headers,
5954 body: ResponseBody::Status200Sse(__value),
5955 });
5956 }
5957 _ => {
5958 let __decoder = <::toac::body::codec::json::JsonDecoder as ::std::default::Default>::default();
5959 let __value =
5960 ::toac::body::codec::decode_body(&__decoder, __body)
5961 .await
5962 .map_err(|e| {
5963 ::toac::DecodeError::Codec(
5964 ::std::convert::Into::into(e),
5965 )
5966 })?;
5967 return ::std::result::Result::Ok(Self {
5968 headers: __headers,
5969 body: ResponseBody::Status200Json(__value),
5970 });
5971 }
5972 },
5973 400u16 => {
5974 let __decoder = <::toac::body::codec::json::JsonDecoder as ::std::default::Default>::default();
5975 let __value =
5976 ::toac::body::codec::decode_body(&__decoder, __body)
5977 .await
5978 .map_err(|e| {
5979 ::toac::DecodeError::Codec(
5980 ::std::convert::Into::into(e),
5981 )
5982 })?;
5983 return ::std::result::Result::Ok(Self {
5984 headers: __headers,
5985 body: ResponseBody::Status400(__value),
5986 });
5987 }
5988 401u16 => {
5989 let __decoder = <::toac::body::codec::json::JsonDecoder as ::std::default::Default>::default();
5990 let __value =
5991 ::toac::body::codec::decode_body(&__decoder, __body)
5992 .await
5993 .map_err(|e| {
5994 ::toac::DecodeError::Codec(
5995 ::std::convert::Into::into(e),
5996 )
5997 })?;
5998 return ::std::result::Result::Ok(Self {
5999 headers: __headers,
6000 body: ResponseBody::Status401(__value),
6001 });
6002 }
6003 403u16 => {
6004 let __decoder = <::toac::body::codec::json::JsonDecoder as ::std::default::Default>::default();
6005 let __value =
6006 ::toac::body::codec::decode_body(&__decoder, __body)
6007 .await
6008 .map_err(|e| {
6009 ::toac::DecodeError::Codec(
6010 ::std::convert::Into::into(e),
6011 )
6012 })?;
6013 return ::std::result::Result::Ok(Self {
6014 headers: __headers,
6015 body: ResponseBody::Status403(__value),
6016 });
6017 }
6018 404u16 => {
6019 let __decoder = <::toac::body::codec::json::JsonDecoder as ::std::default::Default>::default();
6020 let __value =
6021 ::toac::body::codec::decode_body(&__decoder, __body)
6022 .await
6023 .map_err(|e| {
6024 ::toac::DecodeError::Codec(
6025 ::std::convert::Into::into(e),
6026 )
6027 })?;
6028 return ::std::result::Result::Ok(Self {
6029 headers: __headers,
6030 body: ResponseBody::Status404(__value),
6031 });
6032 }
6033 413u16 => {
6034 let __decoder = <::toac::body::codec::json::JsonDecoder as ::std::default::Default>::default();
6035 let __value =
6036 ::toac::body::codec::decode_body(&__decoder, __body)
6037 .await
6038 .map_err(|e| {
6039 ::toac::DecodeError::Codec(
6040 ::std::convert::Into::into(e),
6041 )
6042 })?;
6043 return ::std::result::Result::Ok(Self {
6044 headers: __headers,
6045 body: ResponseBody::Status413(__value),
6046 });
6047 }
6048 429u16 => {
6049 let __decoder = <::toac::body::codec::json::JsonDecoder as ::std::default::Default>::default();
6050 let __value =
6051 ::toac::body::codec::decode_body(&__decoder, __body)
6052 .await
6053 .map_err(|e| {
6054 ::toac::DecodeError::Codec(
6055 ::std::convert::Into::into(e),
6056 )
6057 })?;
6058 return ::std::result::Result::Ok(Self {
6059 headers: __headers,
6060 body: ResponseBody::Status429(__value),
6061 });
6062 }
6063 500u16 => {
6064 let __decoder = <::toac::body::codec::json::JsonDecoder as ::std::default::Default>::default();
6065 let __value =
6066 ::toac::body::codec::decode_body(&__decoder, __body)
6067 .await
6068 .map_err(|e| {
6069 ::toac::DecodeError::Codec(
6070 ::std::convert::Into::into(e),
6071 )
6072 })?;
6073 return ::std::result::Result::Ok(Self {
6074 headers: __headers,
6075 body: ResponseBody::Status500(__value),
6076 });
6077 }
6078 502u16 => {
6079 let __decoder = <::toac::body::codec::json::JsonDecoder as ::std::default::Default>::default();
6080 let __value =
6081 ::toac::body::codec::decode_body(&__decoder, __body)
6082 .await
6083 .map_err(|e| {
6084 ::toac::DecodeError::Codec(
6085 ::std::convert::Into::into(e),
6086 )
6087 })?;
6088 return ::std::result::Result::Ok(Self {
6089 headers: __headers,
6090 body: ResponseBody::Status502(__value),
6091 });
6092 }
6093 503u16 => {
6094 let __decoder = <::toac::body::codec::json::JsonDecoder as ::std::default::Default>::default();
6095 let __value =
6096 ::toac::body::codec::decode_body(&__decoder, __body)
6097 .await
6098 .map_err(|e| {
6099 ::toac::DecodeError::Codec(
6100 ::std::convert::Into::into(e),
6101 )
6102 })?;
6103 return ::std::result::Result::Ok(Self {
6104 headers: __headers,
6105 body: ResponseBody::Status503(__value),
6106 });
6107 }
6108 _ => {}
6109 }
6110 ::std::mem::drop(__body);
6111 return ::std::result::Result::Err(
6112 ::toac::DecodeError::UnexpectedStatus(__status),
6113 );
6114 }
6115 }
6116 }
6117 impl ::toac::Operation for Request {
6118 type Response = Response;
6119 }
6120 }
6121 }
6122 }
6123}
6124pub mod servers {
6125 #![allow(deprecated)]
6126 #![allow(unreachable_patterns)]
6127 #![allow(non_camel_case_types)]
6128 #![allow(non_snake_case)]
6129 #![allow(clippy::all, clippy::pedantic)]
6130 #[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
6132 pub struct ServerOption0;
6133 impl ::toac::Server for ServerOption0 {
6134 fn base_url(&self) -> ::std::borrow::Cow<'_, str> {
6135 ::std::borrow::Cow::Borrowed("https://api.openai.com/v1")
6136 }
6137 }
6138 pub type ApiServer = ServerOption0;
6139}
6140pub mod security {
6141 #![allow(deprecated)]
6142 #![allow(unreachable_patterns)]
6143 #![allow(non_camel_case_types)]
6144 #![allow(non_snake_case)]
6145 #![allow(clippy::all, clippy::pedantic)]
6146 #[derive(Debug, Clone)]
6149 pub struct AdminApiKeyAuthCredential {
6150 pub token: ::std::string::String,
6151 }
6152 impl AdminApiKeyAuthCredential {
6153 pub fn new<T: ::std::convert::Into<::std::string::String>>(token: T) -> Self {
6155 Self {
6156 token: token.into(),
6157 }
6158 }
6159 fn as_runtime(&self) -> ::toac::security::BearerCredential {
6160 ::toac::security::BearerCredential {
6161 token: self.token.clone(),
6162 }
6163 }
6164 }
6165 impl ::toac::SecurityCredential for AdminApiKeyAuthCredential {
6166 fn apply(
6167 &self,
6168 req: ::toac::Request,
6169 ) -> impl ::std::future::Future<
6170 Output = ::std::result::Result<::toac::Request, ::toac::BoxError>,
6171 > + ::std::marker::Send {
6172 let __cred = self.as_runtime();
6173 async move { ::toac::SecurityCredential::apply(&__cred, req).await }
6174 }
6175 }
6176 #[derive(Debug, Clone)]
6179 pub struct ApiKeyAuthCredential {
6180 pub token: ::std::string::String,
6181 }
6182 impl ApiKeyAuthCredential {
6183 pub fn new<T: ::std::convert::Into<::std::string::String>>(token: T) -> Self {
6185 Self {
6186 token: token.into(),
6187 }
6188 }
6189 fn as_runtime(&self) -> ::toac::security::BearerCredential {
6190 ::toac::security::BearerCredential {
6191 token: self.token.clone(),
6192 }
6193 }
6194 }
6195 impl ::toac::SecurityCredential for ApiKeyAuthCredential {
6196 fn apply(
6197 &self,
6198 req: ::toac::Request,
6199 ) -> impl ::std::future::Future<
6200 Output = ::std::result::Result<::toac::Request, ::toac::BoxError>,
6201 > + ::std::marker::Send {
6202 let __cred = self.as_runtime();
6203 async move { ::toac::SecurityCredential::apply(&__cred, req).await }
6204 }
6205 }
6206 #[derive(Debug, Clone, Default)]
6211 pub struct AuthConfig {
6212 pub admin_api_key_auth: ::std::option::Option<AdminApiKeyAuthCredential>,
6213 pub api_key_auth: ::std::option::Option<ApiKeyAuthCredential>,
6214 }
6215 impl AuthConfig {
6216 pub fn builder() -> AuthConfigBuilder {
6220 <AuthConfigBuilder as ::std::default::Default>::default()
6221 }
6222 }
6223 #[derive(Debug, Clone, Default)]
6224 pub struct AuthConfigBuilder {
6225 admin_api_key_auth: ::std::option::Option<AdminApiKeyAuthCredential>,
6226 api_key_auth: ::std::option::Option<ApiKeyAuthCredential>,
6227 }
6228 impl AuthConfigBuilder {
6229 pub fn admin_api_key_auth<T>(mut self, token: T) -> Self
6231 where
6232 T: ::std::convert::Into<::std::string::String>,
6233 {
6234 self.admin_api_key_auth =
6235 ::std::option::Option::Some(AdminApiKeyAuthCredential::new(token));
6236 self
6237 }
6238 pub fn api_key_auth<T>(mut self, token: T) -> Self
6240 where
6241 T: ::std::convert::Into<::std::string::String>,
6242 {
6243 self.api_key_auth = ::std::option::Option::Some(ApiKeyAuthCredential::new(token));
6244 self
6245 }
6246 pub fn build(self) -> AuthConfig {
6248 let Self {
6249 admin_api_key_auth,
6250 api_key_auth,
6251 } = self;
6252 AuthConfig {
6253 admin_api_key_auth,
6254 api_key_auth,
6255 }
6256 }
6257 }
6258 impl ::toac::AuthSelector for AuthConfig {
6259 fn apply_for(
6260 &self,
6261 req: ::toac::Request,
6262 requirements: &'static [&'static [&'static str]],
6263 ) -> ::toac::security::AuthFuture<'_> {
6264 ::std::boxed::Box::pin(async move {
6265 if requirements.is_empty() {
6266 return ::std::result::Result::Ok(req);
6267 }
6268 let mut __chosen: ::std::option::Option<&'static [&'static str]> =
6269 ::std::option::Option::None;
6270 for __alt in requirements {
6271 let mut __can_satisfy = true;
6272 let mut __matched_any = false;
6273 for __scheme in __alt.iter().copied() {
6274 if __scheme == "AdminApiKeyAuth" {
6275 let ::std::option::Option::Some(_) = &self.admin_api_key_auth else {
6276 __can_satisfy = false;
6277 break;
6278 };
6279 __matched_any = true;
6280 continue;
6281 }
6282 if __scheme == "ApiKeyAuth" {
6283 let ::std::option::Option::Some(_) = &self.api_key_auth else {
6284 __can_satisfy = false;
6285 break;
6286 };
6287 __matched_any = true;
6288 continue;
6289 }
6290 let _ = __matched_any;
6291 __can_satisfy = false;
6292 break;
6293 }
6294 if __can_satisfy && __matched_any {
6295 __chosen = ::std::option::Option::Some(__alt);
6296 break;
6297 }
6298 }
6299 let ::std::option::Option::Some(__alt) = __chosen else {
6300 return ::std::result::Result::Err(::std::convert::Into::into(::std::format!(
6301 "no configured credentials satisfy {:?}",
6302 requirements,
6303 )));
6304 };
6305 let mut __req = req;
6306 for __scheme in __alt.iter().copied() {
6307 if __scheme == "AdminApiKeyAuth" {
6308 let ::std::option::Option::Some(__cred) = &self.admin_api_key_auth else {
6309 continue;
6310 };
6311 __req = ::toac::SecurityCredential::apply(__cred, __req).await?;
6312 continue;
6313 }
6314 if __scheme == "ApiKeyAuth" {
6315 let ::std::option::Option::Some(__cred) = &self.api_key_auth else {
6316 continue;
6317 };
6318 __req = ::toac::SecurityCredential::apply(__cred, __req).await?;
6319 continue;
6320 }
6321 }
6322 ::std::result::Result::Ok(__req)
6323 })
6324 }
6325 }
6326}