inference_gateway_sdk/generated/schemas.rs
1// @generated - DO NOT EDIT.
2// Regenerate with `task generate-types` (or `cargo run -p gen-types --release`).
3// Source: openapi.yaml (components.schemas).
4
5#![allow(clippy::all)]
6#![allow(missing_docs)]
7#![allow(unused_imports)]
8#![allow(non_camel_case_types)]
9#![allow(dead_code)]
10
11/// Error types.
12pub mod error {
13 /// Error from a `TryFrom` or `FromStr` implementation.
14 pub struct ConversionError(::std::borrow::Cow<'static, str>);
15 impl ::std::error::Error for ConversionError {}
16 impl ::std::fmt::Display for ConversionError {
17 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> Result<(), ::std::fmt::Error> {
18 ::std::fmt::Display::fmt(&self.0, f)
19 }
20 }
21 impl ::std::fmt::Debug for ConversionError {
22 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> Result<(), ::std::fmt::Error> {
23 ::std::fmt::Debug::fmt(&self.0, f)
24 }
25 }
26 impl From<&'static str> for ConversionError {
27 fn from(value: &'static str) -> Self {
28 Self(value.into())
29 }
30 }
31 impl From<String> for ConversionError {
32 fn from(value: String) -> Self {
33 Self(value.into())
34 }
35 }
36}
37///`ChatCompletionChoice`
38///
39/// <details><summary>JSON schema</summary>
40///
41/// ```json
42///{
43/// "type": "object",
44/// "required": [
45/// "finish_reason",
46/// "index",
47/// "message"
48/// ],
49/// "properties": {
50/// "finish_reason": {
51/// "$ref": "#/definitions/FinishReason"
52/// },
53/// "index": {
54/// "description": "The index of the choice in the list of choices.",
55/// "type": "integer"
56/// },
57/// "logprobs": {
58/// "description": "Log probability information for the choice.",
59/// "type": "object",
60/// "required": [
61/// "content",
62/// "refusal"
63/// ],
64/// "properties": {
65/// "content": {
66/// "description": "A list of message content tokens with log probability information.",
67/// "type": "array",
68/// "items": {
69/// "$ref": "#/definitions/ChatCompletionTokenLogprob"
70/// }
71/// },
72/// "refusal": {
73/// "description": "A list of message refusal tokens with log probability information.",
74/// "type": "array",
75/// "items": {
76/// "$ref": "#/definitions/ChatCompletionTokenLogprob"
77/// }
78/// }
79/// },
80/// "nullable": true
81/// },
82/// "message": {
83/// "$ref": "#/definitions/Message"
84/// }
85/// }
86///}
87/// ```
88/// </details>
89#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
90pub struct ChatCompletionChoice {
91 pub finish_reason: FinishReason,
92 ///The index of the choice in the list of choices.
93 pub index: i64,
94 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
95 pub logprobs: ::std::option::Option<ChatCompletionChoiceLogprobs>,
96 pub message: Message,
97}
98///Log probability information for the choice.
99///
100/// <details><summary>JSON schema</summary>
101///
102/// ```json
103///{
104/// "description": "Log probability information for the choice.",
105/// "type": "object",
106/// "required": [
107/// "content",
108/// "refusal"
109/// ],
110/// "properties": {
111/// "content": {
112/// "description": "A list of message content tokens with log probability information.",
113/// "type": "array",
114/// "items": {
115/// "$ref": "#/definitions/ChatCompletionTokenLogprob"
116/// }
117/// },
118/// "refusal": {
119/// "description": "A list of message refusal tokens with log probability information.",
120/// "type": "array",
121/// "items": {
122/// "$ref": "#/definitions/ChatCompletionTokenLogprob"
123/// }
124/// }
125/// },
126/// "nullable": true
127///}
128/// ```
129/// </details>
130#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
131pub struct ChatCompletionChoiceLogprobs {
132 ///A list of message content tokens with log probability information.
133 pub content: ::std::vec::Vec<ChatCompletionTokenLogprob>,
134 ///A list of message refusal tokens with log probability information.
135 pub refusal: ::std::vec::Vec<ChatCompletionTokenLogprob>,
136}
137///`ChatCompletionMessageToolCall`
138///
139/// <details><summary>JSON schema</summary>
140///
141/// ```json
142///{
143/// "type": "object",
144/// "required": [
145/// "function",
146/// "id",
147/// "type"
148/// ],
149/// "properties": {
150/// "extra_content": {
151/// "$ref": "#/definitions/ToolCallExtraContent"
152/// },
153/// "function": {
154/// "$ref": "#/definitions/ChatCompletionMessageToolCallFunction"
155/// },
156/// "id": {
157/// "description": "The ID of the tool call.",
158/// "type": "string"
159/// },
160/// "type": {
161/// "$ref": "#/definitions/ChatCompletionToolType"
162/// }
163/// }
164///}
165/// ```
166/// </details>
167#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
168pub struct ChatCompletionMessageToolCall {
169 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
170 pub extra_content: ::std::option::Option<ToolCallExtraContent>,
171 pub function: ChatCompletionMessageToolCallFunction,
172 ///The ID of the tool call.
173 pub id: ::std::string::String,
174 #[serde(rename = "type")]
175 pub type_: ChatCompletionToolType,
176}
177///`ChatCompletionMessageToolCallChunk`
178///
179/// <details><summary>JSON schema</summary>
180///
181/// ```json
182///{
183/// "type": "object",
184/// "required": [
185/// "index"
186/// ],
187/// "properties": {
188/// "extra_content": {
189/// "$ref": "#/definitions/ToolCallExtraContent"
190/// },
191/// "function": {
192/// "$ref": "#/definitions/ChatCompletionMessageToolCallFunction"
193/// },
194/// "id": {
195/// "description": "The ID of the tool call.",
196/// "type": "string"
197/// },
198/// "index": {
199/// "type": "integer"
200/// },
201/// "type": {
202/// "description": "The type of the tool. Currently, only `function` is supported.",
203/// "type": "string"
204/// }
205/// }
206///}
207/// ```
208/// </details>
209#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
210pub struct ChatCompletionMessageToolCallChunk {
211 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
212 pub extra_content: ::std::option::Option<ToolCallExtraContent>,
213 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
214 pub function: ::std::option::Option<ChatCompletionMessageToolCallFunction>,
215 ///The ID of the tool call.
216 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
217 pub id: ::std::option::Option<::std::string::String>,
218 pub index: i64,
219 ///The type of the tool. Currently, only `function` is supported.
220 #[serde(
221 rename = "type",
222 default,
223 skip_serializing_if = "::std::option::Option::is_none"
224 )]
225 pub type_: ::std::option::Option<::std::string::String>,
226}
227///The function that the model called.
228///
229/// <details><summary>JSON schema</summary>
230///
231/// ```json
232///{
233/// "description": "The function that the model called.",
234/// "type": "object",
235/// "required": [
236/// "arguments",
237/// "name"
238/// ],
239/// "properties": {
240/// "arguments": {
241/// "description": "The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function.",
242/// "type": "string"
243/// },
244/// "name": {
245/// "description": "The name of the function to call.",
246/// "type": "string"
247/// }
248/// }
249///}
250/// ```
251/// </details>
252#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
253pub struct ChatCompletionMessageToolCallFunction {
254 ///The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function.
255 pub arguments: ::std::string::String,
256 ///The name of the function to call.
257 pub name: ::std::string::String,
258}
259/**Specifies a tool the model should use. Use to force the model to call a specific function.
260*/
261///
262/// <details><summary>JSON schema</summary>
263///
264/// ```json
265///{
266/// "description": "Specifies a tool the model should use. Use to force the model to call a specific function.\n",
267/// "type": "object",
268/// "required": [
269/// "function",
270/// "type"
271/// ],
272/// "properties": {
273/// "function": {
274/// "type": "object",
275/// "required": [
276/// "name"
277/// ],
278/// "properties": {
279/// "name": {
280/// "description": "The name of the function to call.",
281/// "type": "string"
282/// }
283/// }
284/// },
285/// "type": {
286/// "$ref": "#/definitions/ChatCompletionToolType"
287/// }
288/// }
289///}
290/// ```
291/// </details>
292#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
293pub struct ChatCompletionNamedToolChoice {
294 pub function: ChatCompletionNamedToolChoiceFunction,
295 #[serde(rename = "type")]
296 pub type_: ChatCompletionToolType,
297}
298///`ChatCompletionNamedToolChoiceFunction`
299///
300/// <details><summary>JSON schema</summary>
301///
302/// ```json
303///{
304/// "type": "object",
305/// "required": [
306/// "name"
307/// ],
308/// "properties": {
309/// "name": {
310/// "description": "The name of the function to call.",
311/// "type": "string"
312/// }
313/// }
314///}
315/// ```
316/// </details>
317#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
318pub struct ChatCompletionNamedToolChoiceFunction {
319 ///The name of the function to call.
320 pub name: ::std::string::String,
321}
322///`ChatCompletionStreamChoice`
323///
324/// <details><summary>JSON schema</summary>
325///
326/// ```json
327///{
328/// "type": "object",
329/// "required": [
330/// "delta",
331/// "index"
332/// ],
333/// "properties": {
334/// "delta": {
335/// "$ref": "#/definitions/ChatCompletionStreamResponseDelta"
336/// },
337/// "finish_reason": {
338/// "$ref": "#/definitions/FinishReason"
339/// },
340/// "index": {
341/// "description": "The index of the choice in the list of choices.",
342/// "type": "integer"
343/// },
344/// "logprobs": {
345/// "description": "Log probability information for the choice.",
346/// "type": "object",
347/// "required": [
348/// "content",
349/// "refusal"
350/// ],
351/// "properties": {
352/// "content": {
353/// "description": "A list of message content tokens with log probability information.",
354/// "type": "array",
355/// "items": {
356/// "$ref": "#/definitions/ChatCompletionTokenLogprob"
357/// }
358/// },
359/// "refusal": {
360/// "description": "A list of message refusal tokens with log probability information.",
361/// "type": "array",
362/// "items": {
363/// "$ref": "#/definitions/ChatCompletionTokenLogprob"
364/// }
365/// }
366/// }
367/// }
368/// }
369///}
370/// ```
371/// </details>
372#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
373pub struct ChatCompletionStreamChoice {
374 pub delta: ChatCompletionStreamResponseDelta,
375 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
376 pub finish_reason: ::std::option::Option<FinishReason>,
377 ///The index of the choice in the list of choices.
378 pub index: i64,
379 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
380 pub logprobs: ::std::option::Option<ChatCompletionStreamChoiceLogprobs>,
381}
382///Log probability information for the choice.
383///
384/// <details><summary>JSON schema</summary>
385///
386/// ```json
387///{
388/// "description": "Log probability information for the choice.",
389/// "type": "object",
390/// "required": [
391/// "content",
392/// "refusal"
393/// ],
394/// "properties": {
395/// "content": {
396/// "description": "A list of message content tokens with log probability information.",
397/// "type": "array",
398/// "items": {
399/// "$ref": "#/definitions/ChatCompletionTokenLogprob"
400/// }
401/// },
402/// "refusal": {
403/// "description": "A list of message refusal tokens with log probability information.",
404/// "type": "array",
405/// "items": {
406/// "$ref": "#/definitions/ChatCompletionTokenLogprob"
407/// }
408/// }
409/// }
410///}
411/// ```
412/// </details>
413#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
414pub struct ChatCompletionStreamChoiceLogprobs {
415 ///A list of message content tokens with log probability information.
416 pub content: ::std::vec::Vec<ChatCompletionTokenLogprob>,
417 ///A list of message refusal tokens with log probability information.
418 pub refusal: ::std::vec::Vec<ChatCompletionTokenLogprob>,
419}
420/**Options for streaming response. Only set this when you set `stream: true`.
421*/
422///
423/// <details><summary>JSON schema</summary>
424///
425/// ```json
426///{
427/// "description": "Options for streaming response. Only set this when you set `stream: true`.\n",
428/// "type": "object",
429/// "required": [
430/// "include_usage"
431/// ],
432/// "properties": {
433/// "include_usage": {
434/// "description": "If set, an additional chunk will be streamed before the `data: [DONE]` message. The `usage` field on this chunk shows the token usage statistics for the entire request, and the `choices` field will always be an empty array. All other chunks will also include a `usage` field, but with a null value.\n",
435/// "type": "boolean"
436/// }
437/// }
438///}
439/// ```
440/// </details>
441#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
442pub struct ChatCompletionStreamOptions {
443 /**If set, an additional chunk will be streamed before the `data: [DONE]` message. The `usage` field on this chunk shows the token usage statistics for the entire request, and the `choices` field will always be an empty array. All other chunks will also include a `usage` field, but with a null value.
444 */
445 pub include_usage: bool,
446}
447///A chat completion delta generated by streamed model responses.
448///
449/// <details><summary>JSON schema</summary>
450///
451/// ```json
452///{
453/// "description": "A chat completion delta generated by streamed model responses.",
454/// "type": "object",
455/// "properties": {
456/// "content": {
457/// "description": "The contents of the chunk message.",
458/// "type": "string"
459/// },
460/// "reasoning": {
461/// "description": "The reasoning of the chunk message. Same as reasoning_content.",
462/// "type": "string"
463/// },
464/// "reasoning_content": {
465/// "description": "The reasoning content of the chunk message.",
466/// "type": "string"
467/// },
468/// "refusal": {
469/// "description": "The refusal message generated by the model.",
470/// "type": "string"
471/// },
472/// "role": {
473/// "$ref": "#/definitions/MessageRole"
474/// },
475/// "tool_calls": {
476/// "type": "array",
477/// "items": {
478/// "$ref": "#/definitions/ChatCompletionMessageToolCallChunk"
479/// }
480/// }
481/// }
482///}
483/// ```
484/// </details>
485#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
486pub struct ChatCompletionStreamResponseDelta {
487 ///The contents of the chunk message.
488 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
489 pub content: ::std::option::Option<::std::string::String>,
490 ///The reasoning of the chunk message. Same as reasoning_content.
491 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
492 pub reasoning: ::std::option::Option<::std::string::String>,
493 ///The reasoning content of the chunk message.
494 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
495 pub reasoning_content: ::std::option::Option<::std::string::String>,
496 ///The refusal message generated by the model.
497 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
498 pub refusal: ::std::option::Option<::std::string::String>,
499 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
500 pub role: ::std::option::Option<MessageRole>,
501 #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
502 pub tool_calls: ::std::vec::Vec<ChatCompletionMessageToolCallChunk>,
503}
504impl ::std::default::Default for ChatCompletionStreamResponseDelta {
505 fn default() -> Self {
506 Self {
507 content: Default::default(),
508 reasoning: Default::default(),
509 reasoning_content: Default::default(),
510 refusal: Default::default(),
511 role: Default::default(),
512 tool_calls: Default::default(),
513 }
514 }
515}
516///`ChatCompletionTokenLogprob`
517///
518/// <details><summary>JSON schema</summary>
519///
520/// ```json
521///{
522/// "type": "object",
523/// "required": [
524/// "bytes",
525/// "logprob",
526/// "token",
527/// "top_logprobs"
528/// ],
529/// "properties": {
530/// "bytes": {
531/// "description": "A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be `null` if there is no bytes representation for the token.",
532/// "type": "array",
533/// "items": {
534/// "type": "integer"
535/// }
536/// },
537/// "logprob": {
538/// "description": "The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value `-9999.0` is used to signify that the token is very unlikely.",
539/// "type": "number"
540/// },
541/// "token": {
542/// "description": "The token.",
543/// "type": "string"
544/// },
545/// "top_logprobs": {
546/// "description": "List of the most likely tokens and their log probability, at this token position. In rare cases, there may be fewer than the number of requested `top_logprobs` returned.",
547/// "type": "array",
548/// "items": {
549/// "type": "object",
550/// "required": [
551/// "bytes",
552/// "logprob",
553/// "token"
554/// ],
555/// "properties": {
556/// "bytes": {
557/// "description": "A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be `null` if there is no bytes representation for the token.",
558/// "type": "array",
559/// "items": {
560/// "type": "integer"
561/// }
562/// },
563/// "logprob": {
564/// "description": "The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value `-9999.0` is used to signify that the token is very unlikely.",
565/// "type": "number"
566/// },
567/// "token": {
568/// "description": "The token.",
569/// "type": "string"
570/// }
571/// }
572/// }
573/// }
574/// }
575///}
576/// ```
577/// </details>
578#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
579pub struct ChatCompletionTokenLogprob {
580 ///A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be `null` if there is no bytes representation for the token.
581 pub bytes: ::std::vec::Vec<i64>,
582 ///The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value `-9999.0` is used to signify that the token is very unlikely.
583 pub logprob: f64,
584 ///The token.
585 pub token: ::std::string::String,
586 ///List of the most likely tokens and their log probability, at this token position. In rare cases, there may be fewer than the number of requested `top_logprobs` returned.
587 pub top_logprobs: ::std::vec::Vec<ChatCompletionTokenLogprobTopLogprobsItem>,
588}
589///`ChatCompletionTokenLogprobTopLogprobsItem`
590///
591/// <details><summary>JSON schema</summary>
592///
593/// ```json
594///{
595/// "type": "object",
596/// "required": [
597/// "bytes",
598/// "logprob",
599/// "token"
600/// ],
601/// "properties": {
602/// "bytes": {
603/// "description": "A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be `null` if there is no bytes representation for the token.",
604/// "type": "array",
605/// "items": {
606/// "type": "integer"
607/// }
608/// },
609/// "logprob": {
610/// "description": "The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value `-9999.0` is used to signify that the token is very unlikely.",
611/// "type": "number"
612/// },
613/// "token": {
614/// "description": "The token.",
615/// "type": "string"
616/// }
617/// }
618///}
619/// ```
620/// </details>
621#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
622pub struct ChatCompletionTokenLogprobTopLogprobsItem {
623 ///A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be `null` if there is no bytes representation for the token.
624 pub bytes: ::std::vec::Vec<i64>,
625 ///The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value `-9999.0` is used to signify that the token is very unlikely.
626 pub logprob: f64,
627 ///The token.
628 pub token: ::std::string::String,
629}
630///`ChatCompletionTool`
631///
632/// <details><summary>JSON schema</summary>
633///
634/// ```json
635///{
636/// "type": "object",
637/// "required": [
638/// "function",
639/// "type"
640/// ],
641/// "properties": {
642/// "function": {
643/// "$ref": "#/definitions/FunctionObject"
644/// },
645/// "type": {
646/// "$ref": "#/definitions/ChatCompletionToolType"
647/// }
648/// }
649///}
650/// ```
651/// </details>
652#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
653pub struct ChatCompletionTool {
654 pub function: FunctionObject,
655 #[serde(rename = "type")]
656 pub type_: ChatCompletionToolType,
657}
658/**Controls which (if any) tool is called by the model. `none` means the model will not call any tool and instead generates a message. `auto` means the model can pick between generating a message or calling one or more tools. `required` means the model must call one or more tools. Specifying a particular tool via `{"type": "function", "function": {"name": "my_function"}}` forces the model to call that tool.
659`none` is the default when no tools are present. `auto` is the default if tools are present.
660*/
661///
662/// <details><summary>JSON schema</summary>
663///
664/// ```json
665///{
666/// "description": "Controls which (if any) tool is called by the model. `none` means the model will not call any tool and instead generates a message. `auto` means the model can pick between generating a message or calling one or more tools. `required` means the model must call one or more tools. Specifying a particular tool via `{\"type\": \"function\", \"function\": {\"name\": \"my_function\"}}` forces the model to call that tool.\n`none` is the default when no tools are present. `auto` is the default if tools are present.\n",
667/// "oneOf": [
668/// {
669/// "description": "`none` means the model will not call any tool and instead generates a message. `auto` means the model can pick between generating a message or calling one or more tools. `required` means the model must call one or more tools.\n",
670/// "type": "string",
671/// "enum": [
672/// "none",
673/// "auto",
674/// "required"
675/// ]
676/// },
677/// {
678/// "$ref": "#/definitions/ChatCompletionNamedToolChoice"
679/// }
680/// ]
681///}
682/// ```
683/// </details>
684#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
685#[serde(untagged)]
686pub enum ChatCompletionToolChoiceOption {
687 String(ChatCompletionToolChoiceOptionString),
688 ChatCompletionNamedToolChoice(ChatCompletionNamedToolChoice),
689}
690impl ::std::convert::From<ChatCompletionToolChoiceOptionString> for ChatCompletionToolChoiceOption {
691 fn from(value: ChatCompletionToolChoiceOptionString) -> Self {
692 Self::String(value)
693 }
694}
695impl ::std::convert::From<ChatCompletionNamedToolChoice> for ChatCompletionToolChoiceOption {
696 fn from(value: ChatCompletionNamedToolChoice) -> Self {
697 Self::ChatCompletionNamedToolChoice(value)
698 }
699}
700/**`none` means the model will not call any tool and instead generates a message. `auto` means the model can pick between generating a message or calling one or more tools. `required` means the model must call one or more tools.
701*/
702///
703/// <details><summary>JSON schema</summary>
704///
705/// ```json
706///{
707/// "description": "`none` means the model will not call any tool and instead generates a message. `auto` means the model can pick between generating a message or calling one or more tools. `required` means the model must call one or more tools.\n",
708/// "type": "string",
709/// "enum": [
710/// "none",
711/// "auto",
712/// "required"
713/// ]
714///}
715/// ```
716/// </details>
717#[derive(
718 ::serde::Deserialize,
719 ::serde::Serialize,
720 Clone,
721 Copy,
722 Debug,
723 Eq,
724 Hash,
725 Ord,
726 PartialEq,
727 PartialOrd,
728)]
729pub enum ChatCompletionToolChoiceOptionString {
730 #[serde(rename = "none")]
731 None,
732 #[serde(rename = "auto")]
733 Auto,
734 #[serde(rename = "required")]
735 Required,
736}
737impl ::std::fmt::Display for ChatCompletionToolChoiceOptionString {
738 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
739 match *self {
740 Self::None => f.write_str("none"),
741 Self::Auto => f.write_str("auto"),
742 Self::Required => f.write_str("required"),
743 }
744 }
745}
746impl ::std::str::FromStr for ChatCompletionToolChoiceOptionString {
747 type Err = self::error::ConversionError;
748 fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
749 match value {
750 "none" => Ok(Self::None),
751 "auto" => Ok(Self::Auto),
752 "required" => Ok(Self::Required),
753 _ => Err("invalid value".into()),
754 }
755 }
756}
757impl ::std::convert::TryFrom<&str> for ChatCompletionToolChoiceOptionString {
758 type Error = self::error::ConversionError;
759 fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
760 value.parse()
761 }
762}
763impl ::std::convert::TryFrom<&::std::string::String> for ChatCompletionToolChoiceOptionString {
764 type Error = self::error::ConversionError;
765 fn try_from(
766 value: &::std::string::String,
767 ) -> ::std::result::Result<Self, self::error::ConversionError> {
768 value.parse()
769 }
770}
771impl ::std::convert::TryFrom<::std::string::String> for ChatCompletionToolChoiceOptionString {
772 type Error = self::error::ConversionError;
773 fn try_from(
774 value: ::std::string::String,
775 ) -> ::std::result::Result<Self, self::error::ConversionError> {
776 value.parse()
777 }
778}
779///The type of the tool. Currently, only `function` is supported.
780///
781/// <details><summary>JSON schema</summary>
782///
783/// ```json
784///{
785/// "description": "The type of the tool. Currently, only `function` is supported.",
786/// "type": "string",
787/// "enum": [
788/// "function"
789/// ]
790///}
791/// ```
792/// </details>
793#[derive(
794 ::serde::Deserialize,
795 ::serde::Serialize,
796 Clone,
797 Copy,
798 Debug,
799 Eq,
800 Hash,
801 Ord,
802 PartialEq,
803 PartialOrd,
804)]
805pub enum ChatCompletionToolType {
806 #[serde(rename = "function")]
807 Function,
808}
809impl ::std::fmt::Display for ChatCompletionToolType {
810 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
811 match *self {
812 Self::Function => f.write_str("function"),
813 }
814 }
815}
816impl ::std::str::FromStr for ChatCompletionToolType {
817 type Err = self::error::ConversionError;
818 fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
819 match value {
820 "function" => Ok(Self::Function),
821 _ => Err("invalid value".into()),
822 }
823 }
824}
825impl ::std::convert::TryFrom<&str> for ChatCompletionToolType {
826 type Error = self::error::ConversionError;
827 fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
828 value.parse()
829 }
830}
831impl ::std::convert::TryFrom<&::std::string::String> for ChatCompletionToolType {
832 type Error = self::error::ConversionError;
833 fn try_from(
834 value: &::std::string::String,
835 ) -> ::std::result::Result<Self, self::error::ConversionError> {
836 value.parse()
837 }
838}
839impl ::std::convert::TryFrom<::std::string::String> for ChatCompletionToolType {
840 type Error = self::error::ConversionError;
841 fn try_from(
842 value: ::std::string::String,
843 ) -> ::std::result::Result<Self, self::error::ConversionError> {
844 value.parse()
845 }
846}
847///Usage statistics for the completion request.
848///
849/// <details><summary>JSON schema</summary>
850///
851/// ```json
852///{
853/// "description": "Usage statistics for the completion request.",
854/// "type": "object",
855/// "required": [
856/// "completion_tokens",
857/// "prompt_tokens",
858/// "total_tokens"
859/// ],
860/// "properties": {
861/// "completion_tokens": {
862/// "description": "Number of tokens in the generated completion.",
863/// "default": 0,
864/// "type": "integer",
865/// "format": "int64"
866/// },
867/// "prompt_tokens": {
868/// "description": "Number of tokens in the prompt.",
869/// "default": 0,
870/// "type": "integer",
871/// "format": "int64"
872/// },
873/// "total_tokens": {
874/// "description": "Total number of tokens used in the request (prompt + completion).",
875/// "default": 0,
876/// "type": "integer",
877/// "format": "int64"
878/// }
879/// }
880///}
881/// ```
882/// </details>
883#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
884pub struct CompletionUsage {
885 ///Number of tokens in the generated completion.
886 pub completion_tokens: i64,
887 ///Number of tokens in the prompt.
888 pub prompt_tokens: i64,
889 ///Total number of tokens used in the request (prompt + completion).
890 pub total_tokens: i64,
891}
892///`Config`
893///
894/// <details><summary>JSON schema</summary>
895///
896/// ```json
897///{}
898/// ```
899/// </details>
900#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
901#[serde(transparent)]
902pub struct Config(pub ::serde_json::Value);
903impl ::std::ops::Deref for Config {
904 type Target = ::serde_json::Value;
905 fn deref(&self) -> &::serde_json::Value {
906 &self.0
907 }
908}
909impl ::std::convert::From<Config> for ::serde_json::Value {
910 fn from(value: Config) -> Self {
911 value.0
912 }
913}
914impl ::std::convert::From<::serde_json::Value> for Config {
915 fn from(value: ::serde_json::Value) -> Self {
916 Self(value)
917 }
918}
919///A content part within a multimodal message
920///
921/// <details><summary>JSON schema</summary>
922///
923/// ```json
924///{
925/// "description": "A content part within a multimodal message",
926/// "type": "object",
927/// "oneOf": [
928/// {
929/// "$ref": "#/definitions/TextContentPart"
930/// },
931/// {
932/// "$ref": "#/definitions/ImageContentPart"
933/// }
934/// ]
935///}
936/// ```
937/// </details>
938#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
939#[serde(untagged)]
940pub enum ContentPart {
941 TextContentPart(TextContentPart),
942 ImageContentPart(ImageContentPart),
943}
944impl ::std::convert::From<TextContentPart> for ContentPart {
945 fn from(value: TextContentPart) -> Self {
946 Self::TextContentPart(value)
947 }
948}
949impl ::std::convert::From<ImageContentPart> for ContentPart {
950 fn from(value: ImageContentPart) -> Self {
951 Self::ImageContentPart(value)
952 }
953}
954///`CreateChatCompletionRequest`
955///
956/// <details><summary>JSON schema</summary>
957///
958/// ```json
959///{
960/// "type": "object",
961/// "required": [
962/// "messages",
963/// "model"
964/// ],
965/// "properties": {
966/// "frequency_penalty": {
967/// "description": "Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim.\n",
968/// "default": 0,
969/// "type": "number",
970/// "maximum": 2.0,
971/// "minimum": -2.0
972/// },
973/// "logit_bias": {
974/// "description": "Modify the likelihood of specified tokens appearing in the completion. Accepts a JSON object that maps tokens (specified by their token ID in the tokenizer) to an associated bias value from -100 to 100. The bias is added to the logits generated by the model prior to sampling.\n",
975/// "type": "object",
976/// "additionalProperties": {
977/// "type": "integer"
978/// }
979/// },
980/// "logprobs": {
981/// "description": "Whether to return log probabilities of the output tokens or not. If true, returns the log probabilities of each output token returned in the `content` of `message`.\n",
982/// "default": false,
983/// "type": "boolean"
984/// },
985/// "max_completion_tokens": {
986/// "description": "An upper bound for the number of tokens that can be generated for a completion, including visible output tokens and reasoning tokens.\n",
987/// "type": "integer"
988/// },
989/// "max_tokens": {
990/// "description": "The maximum number of tokens that can be generated in the chat completion. This value can be used to control costs for text generated via API. This value is now deprecated in favor of `max_completion_tokens`, and is not compatible with o-series models.\n",
991/// "deprecated": true,
992/// "type": "integer"
993/// },
994/// "messages": {
995/// "description": "A list of messages comprising the conversation so far.\n",
996/// "type": "array",
997/// "items": {
998/// "$ref": "#/definitions/Message"
999/// },
1000/// "minItems": 1
1001/// },
1002/// "model": {
1003/// "description": "Model ID to use",
1004/// "type": "string"
1005/// },
1006/// "n": {
1007/// "description": "How many chat completion choices to generate for each input message.\n",
1008/// "default": 1,
1009/// "type": "integer",
1010/// "maximum": 128.0,
1011/// "minimum": 1.0
1012/// },
1013/// "parallel_tool_calls": {
1014/// "description": "Whether to enable parallel function calling during tool use.\n",
1015/// "default": true,
1016/// "type": "boolean"
1017/// },
1018/// "presence_penalty": {
1019/// "description": "Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics.\n",
1020/// "default": 0,
1021/// "type": "number",
1022/// "maximum": 2.0,
1023/// "minimum": -2.0
1024/// },
1025/// "reasoning_effort": {
1026/// "description": "Constrains effort on reasoning for reasoning models. Currently supported values are `minimal`, `low`, `medium`, and `high`. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response.\n",
1027/// "type": "string",
1028/// "enum": [
1029/// "minimal",
1030/// "low",
1031/// "medium",
1032/// "high"
1033/// ]
1034/// },
1035/// "reasoning_format": {
1036/// "description": "The format of the reasoning content. Can be `raw` or `parsed`.\nWhen specified as raw some reasoning models will output <think /> tags. When specified as parsed the model will output the reasoning under `reasoning` or `reasoning_content` attribute.\n",
1037/// "type": "string"
1038/// },
1039/// "response_format": {
1040/// "description": "An object specifying the format that the model must output. Setting to `{ \"type\": \"json_schema\", \"json_schema\": {...} }` enables Structured Outputs which guarantees the model will match your supplied JSON schema. Setting to `{ \"type\": \"json_object\" }` enables the older JSON mode, which ensures the message the model generates is valid JSON.\n",
1041/// "oneOf": [
1042/// {
1043/// "$ref": "#/definitions/ResponseFormatText"
1044/// },
1045/// {
1046/// "$ref": "#/definitions/ResponseFormatJsonSchema"
1047/// },
1048/// {
1049/// "$ref": "#/definitions/ResponseFormatJsonObject"
1050/// }
1051/// ]
1052/// },
1053/// "seed": {
1054/// "description": "If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same `seed` and parameters should return the same result. Determinism is not guaranteed, and you should refer to the `system_fingerprint` response parameter to monitor changes in the backend.\n",
1055/// "type": "integer"
1056/// },
1057/// "stop": {
1058/// "description": "Up to 4 sequences where the API will stop generating further tokens.\n",
1059/// "oneOf": [
1060/// {
1061/// "type": "string"
1062/// },
1063/// {
1064/// "type": "array",
1065/// "items": {
1066/// "type": "string"
1067/// },
1068/// "maxItems": 4,
1069/// "minItems": 1
1070/// }
1071/// ]
1072/// },
1073/// "stream": {
1074/// "description": "If set to true, the model response data will be streamed to the client as it is generated using [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format).\n",
1075/// "default": false,
1076/// "type": "boolean"
1077/// },
1078/// "stream_options": {
1079/// "$ref": "#/definitions/ChatCompletionStreamOptions"
1080/// },
1081/// "temperature": {
1082/// "description": "What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.\n",
1083/// "default": 1,
1084/// "type": "number",
1085/// "maximum": 2.0,
1086/// "minimum": 0.0
1087/// },
1088/// "tool_choice": {
1089/// "$ref": "#/definitions/ChatCompletionToolChoiceOption"
1090/// },
1091/// "tools": {
1092/// "description": "A list of tools the model may call. Currently, only functions are supported as a tool. Use this to provide a list of functions the model may generate JSON inputs for. A max of 128 functions are supported.\n",
1093/// "type": "array",
1094/// "items": {
1095/// "$ref": "#/definitions/ChatCompletionTool"
1096/// }
1097/// },
1098/// "top_logprobs": {
1099/// "description": "An integer between 0 and 20 specifying the number of most likely tokens to return at each token position, each with an associated log probability. `logprobs` must be set to `true` if this parameter is used.\n",
1100/// "type": "integer",
1101/// "maximum": 20.0,
1102/// "minimum": 0.0
1103/// },
1104/// "top_p": {
1105/// "description": "An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass.\n",
1106/// "default": 1,
1107/// "type": "number",
1108/// "maximum": 1.0,
1109/// "minimum": 0.0
1110/// },
1111/// "user": {
1112/// "description": "A unique identifier representing your end-user, which can help to monitor and detect abuse.\n",
1113/// "type": "string"
1114/// }
1115/// }
1116///}
1117/// ```
1118/// </details>
1119#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
1120pub struct CreateChatCompletionRequest {
1121 /**Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim.
1122 */
1123 #[serde(default = "defaults::create_chat_completion_request_frequency_penalty")]
1124 pub frequency_penalty: f64,
1125 /**Modify the likelihood of specified tokens appearing in the completion. Accepts a JSON object that maps tokens (specified by their token ID in the tokenizer) to an associated bias value from -100 to 100. The bias is added to the logits generated by the model prior to sampling.
1126 */
1127 #[serde(
1128 default,
1129 skip_serializing_if = ":: std :: collections :: HashMap::is_empty"
1130 )]
1131 pub logit_bias: ::std::collections::HashMap<::std::string::String, i64>,
1132 /**Whether to return log probabilities of the output tokens or not. If true, returns the log probabilities of each output token returned in the `content` of `message`.
1133 */
1134 #[serde(default)]
1135 pub logprobs: bool,
1136 /**An upper bound for the number of tokens that can be generated for a completion, including visible output tokens and reasoning tokens.
1137 */
1138 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1139 pub max_completion_tokens: ::std::option::Option<i64>,
1140 /**The maximum number of tokens that can be generated in the chat completion. This value can be used to control costs for text generated via API. This value is now deprecated in favor of `max_completion_tokens`, and is not compatible with o-series models.
1141 */
1142 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1143 pub max_tokens: ::std::option::Option<i64>,
1144 /**A list of messages comprising the conversation so far.
1145 */
1146 pub messages: ::std::vec::Vec<Message>,
1147 ///Model ID to use
1148 pub model: ::std::string::String,
1149 /**How many chat completion choices to generate for each input message.
1150 */
1151 #[serde(default = "defaults::default_nzu64::<::std::num::NonZeroU64, 1>")]
1152 pub n: ::std::num::NonZeroU64,
1153 /**Whether to enable parallel function calling during tool use.
1154 */
1155 #[serde(default = "defaults::default_bool::<true>")]
1156 pub parallel_tool_calls: bool,
1157 /**Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics.
1158 */
1159 #[serde(default = "defaults::create_chat_completion_request_presence_penalty")]
1160 pub presence_penalty: f64,
1161 /**Constrains effort on reasoning for reasoning models. Currently supported values are `minimal`, `low`, `medium`, and `high`. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response.
1162 */
1163 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1164 pub reasoning_effort: ::std::option::Option<CreateChatCompletionRequestReasoningEffort>,
1165 /**The format of the reasoning content. Can be `raw` or `parsed`.
1166 When specified as raw some reasoning models will output <think /> tags. When specified as parsed the model will output the reasoning under `reasoning` or `reasoning_content` attribute.
1167 */
1168 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1169 pub reasoning_format: ::std::option::Option<::std::string::String>,
1170 /**An object specifying the format that the model must output. Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured Outputs which guarantees the model will match your supplied JSON schema. Setting to `{ "type": "json_object" }` enables the older JSON mode, which ensures the message the model generates is valid JSON.
1171 */
1172 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1173 pub response_format: ::std::option::Option<CreateChatCompletionRequestResponseFormat>,
1174 /**If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same `seed` and parameters should return the same result. Determinism is not guaranteed, and you should refer to the `system_fingerprint` response parameter to monitor changes in the backend.
1175 */
1176 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1177 pub seed: ::std::option::Option<i64>,
1178 /**Up to 4 sequences where the API will stop generating further tokens.
1179 */
1180 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1181 pub stop: ::std::option::Option<CreateChatCompletionRequestStop>,
1182 /**If set to true, the model response data will be streamed to the client as it is generated using [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format).
1183 */
1184 #[serde(default)]
1185 pub stream: bool,
1186 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1187 pub stream_options: ::std::option::Option<ChatCompletionStreamOptions>,
1188 /**What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.
1189 */
1190 #[serde(default = "defaults::create_chat_completion_request_temperature")]
1191 pub temperature: f64,
1192 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1193 pub tool_choice: ::std::option::Option<ChatCompletionToolChoiceOption>,
1194 /**A list of tools the model may call. Currently, only functions are supported as a tool. Use this to provide a list of functions the model may generate JSON inputs for. A max of 128 functions are supported.
1195 */
1196 #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
1197 pub tools: ::std::vec::Vec<ChatCompletionTool>,
1198 /**An integer between 0 and 20 specifying the number of most likely tokens to return at each token position, each with an associated log probability. `logprobs` must be set to `true` if this parameter is used.
1199 */
1200 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1201 pub top_logprobs: ::std::option::Option<i64>,
1202 /**An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass.
1203 */
1204 #[serde(default = "defaults::create_chat_completion_request_top_p")]
1205 pub top_p: f64,
1206 /**A unique identifier representing your end-user, which can help to monitor and detect abuse.
1207 */
1208 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1209 pub user: ::std::option::Option<::std::string::String>,
1210}
1211/**Constrains effort on reasoning for reasoning models. Currently supported values are `minimal`, `low`, `medium`, and `high`. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response.
1212*/
1213///
1214/// <details><summary>JSON schema</summary>
1215///
1216/// ```json
1217///{
1218/// "description": "Constrains effort on reasoning for reasoning models. Currently supported values are `minimal`, `low`, `medium`, and `high`. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response.\n",
1219/// "type": "string",
1220/// "enum": [
1221/// "minimal",
1222/// "low",
1223/// "medium",
1224/// "high"
1225/// ]
1226///}
1227/// ```
1228/// </details>
1229#[derive(
1230 ::serde::Deserialize,
1231 ::serde::Serialize,
1232 Clone,
1233 Copy,
1234 Debug,
1235 Eq,
1236 Hash,
1237 Ord,
1238 PartialEq,
1239 PartialOrd,
1240)]
1241pub enum CreateChatCompletionRequestReasoningEffort {
1242 #[serde(rename = "minimal")]
1243 Minimal,
1244 #[serde(rename = "low")]
1245 Low,
1246 #[serde(rename = "medium")]
1247 Medium,
1248 #[serde(rename = "high")]
1249 High,
1250}
1251impl ::std::fmt::Display for CreateChatCompletionRequestReasoningEffort {
1252 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
1253 match *self {
1254 Self::Minimal => f.write_str("minimal"),
1255 Self::Low => f.write_str("low"),
1256 Self::Medium => f.write_str("medium"),
1257 Self::High => f.write_str("high"),
1258 }
1259 }
1260}
1261impl ::std::str::FromStr for CreateChatCompletionRequestReasoningEffort {
1262 type Err = self::error::ConversionError;
1263 fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
1264 match value {
1265 "minimal" => Ok(Self::Minimal),
1266 "low" => Ok(Self::Low),
1267 "medium" => Ok(Self::Medium),
1268 "high" => Ok(Self::High),
1269 _ => Err("invalid value".into()),
1270 }
1271 }
1272}
1273impl ::std::convert::TryFrom<&str> for CreateChatCompletionRequestReasoningEffort {
1274 type Error = self::error::ConversionError;
1275 fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
1276 value.parse()
1277 }
1278}
1279impl ::std::convert::TryFrom<&::std::string::String>
1280 for CreateChatCompletionRequestReasoningEffort
1281{
1282 type Error = self::error::ConversionError;
1283 fn try_from(
1284 value: &::std::string::String,
1285 ) -> ::std::result::Result<Self, self::error::ConversionError> {
1286 value.parse()
1287 }
1288}
1289impl ::std::convert::TryFrom<::std::string::String> for CreateChatCompletionRequestReasoningEffort {
1290 type Error = self::error::ConversionError;
1291 fn try_from(
1292 value: ::std::string::String,
1293 ) -> ::std::result::Result<Self, self::error::ConversionError> {
1294 value.parse()
1295 }
1296}
1297/**An object specifying the format that the model must output. Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured Outputs which guarantees the model will match your supplied JSON schema. Setting to `{ "type": "json_object" }` enables the older JSON mode, which ensures the message the model generates is valid JSON.
1298*/
1299///
1300/// <details><summary>JSON schema</summary>
1301///
1302/// ```json
1303///{
1304/// "description": "An object specifying the format that the model must output. Setting to `{ \"type\": \"json_schema\", \"json_schema\": {...} }` enables Structured Outputs which guarantees the model will match your supplied JSON schema. Setting to `{ \"type\": \"json_object\" }` enables the older JSON mode, which ensures the message the model generates is valid JSON.\n",
1305/// "oneOf": [
1306/// {
1307/// "$ref": "#/definitions/ResponseFormatText"
1308/// },
1309/// {
1310/// "$ref": "#/definitions/ResponseFormatJsonSchema"
1311/// },
1312/// {
1313/// "$ref": "#/definitions/ResponseFormatJsonObject"
1314/// }
1315/// ]
1316///}
1317/// ```
1318/// </details>
1319#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
1320#[serde(untagged)]
1321pub enum CreateChatCompletionRequestResponseFormat {
1322 Text(ResponseFormatText),
1323 JsonSchema(ResponseFormatJsonSchema),
1324 JsonObject(ResponseFormatJsonObject),
1325}
1326impl ::std::convert::From<ResponseFormatText> for CreateChatCompletionRequestResponseFormat {
1327 fn from(value: ResponseFormatText) -> Self {
1328 Self::Text(value)
1329 }
1330}
1331impl ::std::convert::From<ResponseFormatJsonSchema> for CreateChatCompletionRequestResponseFormat {
1332 fn from(value: ResponseFormatJsonSchema) -> Self {
1333 Self::JsonSchema(value)
1334 }
1335}
1336impl ::std::convert::From<ResponseFormatJsonObject> for CreateChatCompletionRequestResponseFormat {
1337 fn from(value: ResponseFormatJsonObject) -> Self {
1338 Self::JsonObject(value)
1339 }
1340}
1341/**Up to 4 sequences where the API will stop generating further tokens.
1342*/
1343///
1344/// <details><summary>JSON schema</summary>
1345///
1346/// ```json
1347///{
1348/// "description": "Up to 4 sequences where the API will stop generating further tokens.\n",
1349/// "oneOf": [
1350/// {
1351/// "type": "string"
1352/// },
1353/// {
1354/// "type": "array",
1355/// "items": {
1356/// "type": "string"
1357/// },
1358/// "maxItems": 4,
1359/// "minItems": 1
1360/// }
1361/// ]
1362///}
1363/// ```
1364/// </details>
1365#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
1366#[serde(untagged)]
1367pub enum CreateChatCompletionRequestStop {
1368 String(::std::string::String),
1369 Array(::std::vec::Vec<::std::string::String>),
1370}
1371impl ::std::convert::From<::std::vec::Vec<::std::string::String>>
1372 for CreateChatCompletionRequestStop
1373{
1374 fn from(value: ::std::vec::Vec<::std::string::String>) -> Self {
1375 Self::Array(value)
1376 }
1377}
1378///Represents a chat completion response returned by model, based on the provided input.
1379///
1380/// <details><summary>JSON schema</summary>
1381///
1382/// ```json
1383///{
1384/// "description": "Represents a chat completion response returned by model, based on the provided input.",
1385/// "type": "object",
1386/// "required": [
1387/// "choices",
1388/// "created",
1389/// "id",
1390/// "model",
1391/// "object"
1392/// ],
1393/// "properties": {
1394/// "choices": {
1395/// "description": "A list of chat completion choices. Can be more than one if `n` is greater than 1.",
1396/// "type": "array",
1397/// "items": {
1398/// "$ref": "#/definitions/ChatCompletionChoice"
1399/// }
1400/// },
1401/// "created": {
1402/// "description": "The Unix timestamp (in seconds) of when the chat completion was created.",
1403/// "type": "integer"
1404/// },
1405/// "id": {
1406/// "description": "A unique identifier for the chat completion.",
1407/// "type": "string"
1408/// },
1409/// "model": {
1410/// "description": "The model used for the chat completion.",
1411/// "type": "string"
1412/// },
1413/// "object": {
1414/// "description": "The object type, which is always `chat.completion`.",
1415/// "type": "string"
1416/// },
1417/// "usage": {
1418/// "$ref": "#/definitions/CompletionUsage"
1419/// }
1420/// }
1421///}
1422/// ```
1423/// </details>
1424#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
1425pub struct CreateChatCompletionResponse {
1426 ///A list of chat completion choices. Can be more than one if `n` is greater than 1.
1427 pub choices: ::std::vec::Vec<ChatCompletionChoice>,
1428 ///The Unix timestamp (in seconds) of when the chat completion was created.
1429 pub created: i64,
1430 ///A unique identifier for the chat completion.
1431 pub id: ::std::string::String,
1432 ///The model used for the chat completion.
1433 pub model: ::std::string::String,
1434 ///The object type, which is always `chat.completion`.
1435 pub object: ::std::string::String,
1436 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1437 pub usage: ::std::option::Option<CompletionUsage>,
1438}
1439/**Represents a streamed chunk of a chat completion response returned
1440by the model, based on the provided input.
1441*/
1442///
1443/// <details><summary>JSON schema</summary>
1444///
1445/// ```json
1446///{
1447/// "description": "Represents a streamed chunk of a chat completion response returned\nby the model, based on the provided input.\n",
1448/// "type": "object",
1449/// "required": [
1450/// "choices",
1451/// "created",
1452/// "id",
1453/// "model",
1454/// "object"
1455/// ],
1456/// "properties": {
1457/// "choices": {
1458/// "description": "A list of chat completion choices. Can contain more than one elements if `n` is greater than 1. Can also be empty for the\nlast chunk if you set `stream_options: {\"include_usage\": true}`.\n",
1459/// "type": "array",
1460/// "items": {
1461/// "$ref": "#/definitions/ChatCompletionStreamChoice"
1462/// }
1463/// },
1464/// "created": {
1465/// "description": "The Unix timestamp (in seconds) of when the chat completion was created. Each chunk has the same timestamp.",
1466/// "type": "integer"
1467/// },
1468/// "id": {
1469/// "description": "A unique identifier for the chat completion. Each chunk has the same ID.",
1470/// "type": "string"
1471/// },
1472/// "model": {
1473/// "description": "The model to generate the completion.",
1474/// "type": "string"
1475/// },
1476/// "object": {
1477/// "description": "The object type, which is always `chat.completion.chunk`.",
1478/// "type": "string"
1479/// },
1480/// "reasoning_format": {
1481/// "description": "The format of the reasoning content. Can be `raw` or `parsed`.\nWhen specified as raw some reasoning models will output <think /> tags. When specified as parsed the model will output the reasoning under reasoning_content.\n",
1482/// "type": "string"
1483/// },
1484/// "system_fingerprint": {
1485/// "description": "This fingerprint represents the backend configuration that the model runs with.\nCan be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism.\n",
1486/// "type": "string"
1487/// },
1488/// "usage": {
1489/// "$ref": "#/definitions/CompletionUsage"
1490/// }
1491/// }
1492///}
1493/// ```
1494/// </details>
1495#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
1496pub struct CreateChatCompletionStreamResponse {
1497 /**A list of chat completion choices. Can contain more than one elements if `n` is greater than 1. Can also be empty for the
1498 last chunk if you set `stream_options: {"include_usage": true}`.
1499 */
1500 pub choices: ::std::vec::Vec<ChatCompletionStreamChoice>,
1501 ///The Unix timestamp (in seconds) of when the chat completion was created. Each chunk has the same timestamp.
1502 pub created: i64,
1503 ///A unique identifier for the chat completion. Each chunk has the same ID.
1504 pub id: ::std::string::String,
1505 ///The model to generate the completion.
1506 pub model: ::std::string::String,
1507 ///The object type, which is always `chat.completion.chunk`.
1508 pub object: ::std::string::String,
1509 /**The format of the reasoning content. Can be `raw` or `parsed`.
1510 When specified as raw some reasoning models will output <think /> tags. When specified as parsed the model will output the reasoning under reasoning_content.
1511 */
1512 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1513 pub reasoning_format: ::std::option::Option<::std::string::String>,
1514 /**This fingerprint represents the backend configuration that the model runs with.
1515 Can be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism.
1516 */
1517 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1518 pub system_fingerprint: ::std::option::Option<::std::string::String>,
1519 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1520 pub usage: ::std::option::Option<CompletionUsage>,
1521}
1522///`Endpoints`
1523///
1524/// <details><summary>JSON schema</summary>
1525///
1526/// ```json
1527///{
1528/// "type": "object",
1529/// "required": [
1530/// "chat",
1531/// "models"
1532/// ],
1533/// "properties": {
1534/// "chat": {
1535/// "type": "string"
1536/// },
1537/// "models": {
1538/// "type": "string"
1539/// }
1540/// }
1541///}
1542/// ```
1543/// </details>
1544#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
1545pub struct Endpoints {
1546 pub chat: ::std::string::String,
1547 pub models: ::std::string::String,
1548}
1549///`Error`
1550///
1551/// <details><summary>JSON schema</summary>
1552///
1553/// ```json
1554///{
1555/// "type": "object",
1556/// "properties": {
1557/// "error": {
1558/// "type": "string"
1559/// }
1560/// }
1561///}
1562/// ```
1563/// </details>
1564#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
1565pub struct Error {
1566 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1567 pub error: ::std::option::Option<::std::string::String>,
1568}
1569impl ::std::default::Default for Error {
1570 fn default() -> Self {
1571 Self {
1572 error: Default::default(),
1573 }
1574 }
1575}
1576/**The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence,
1577`length` if the maximum number of tokens specified in the request was reached,
1578`content_filter` if content was omitted due to a flag from our content filters,
1579`tool_calls` if the model called a tool.
1580*/
1581///
1582/// <details><summary>JSON schema</summary>
1583///
1584/// ```json
1585///{
1586/// "description": "The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence,\n`length` if the maximum number of tokens specified in the request was reached,\n`content_filter` if content was omitted due to a flag from our content filters,\n`tool_calls` if the model called a tool.\n",
1587/// "type": "string",
1588/// "enum": [
1589/// "stop",
1590/// "length",
1591/// "tool_calls",
1592/// "content_filter",
1593/// "function_call"
1594/// ]
1595///}
1596/// ```
1597/// </details>
1598#[derive(
1599 ::serde::Deserialize,
1600 ::serde::Serialize,
1601 Clone,
1602 Copy,
1603 Debug,
1604 Eq,
1605 Hash,
1606 Ord,
1607 PartialEq,
1608 PartialOrd,
1609)]
1610pub enum FinishReason {
1611 #[serde(rename = "stop")]
1612 Stop,
1613 #[serde(rename = "length")]
1614 Length,
1615 #[serde(rename = "tool_calls")]
1616 ToolCalls,
1617 #[serde(rename = "content_filter")]
1618 ContentFilter,
1619 #[serde(rename = "function_call")]
1620 FunctionCall,
1621}
1622impl ::std::fmt::Display for FinishReason {
1623 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
1624 match *self {
1625 Self::Stop => f.write_str("stop"),
1626 Self::Length => f.write_str("length"),
1627 Self::ToolCalls => f.write_str("tool_calls"),
1628 Self::ContentFilter => f.write_str("content_filter"),
1629 Self::FunctionCall => f.write_str("function_call"),
1630 }
1631 }
1632}
1633impl ::std::str::FromStr for FinishReason {
1634 type Err = self::error::ConversionError;
1635 fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
1636 match value {
1637 "stop" => Ok(Self::Stop),
1638 "length" => Ok(Self::Length),
1639 "tool_calls" => Ok(Self::ToolCalls),
1640 "content_filter" => Ok(Self::ContentFilter),
1641 "function_call" => Ok(Self::FunctionCall),
1642 _ => Err("invalid value".into()),
1643 }
1644 }
1645}
1646impl ::std::convert::TryFrom<&str> for FinishReason {
1647 type Error = self::error::ConversionError;
1648 fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
1649 value.parse()
1650 }
1651}
1652impl ::std::convert::TryFrom<&::std::string::String> for FinishReason {
1653 type Error = self::error::ConversionError;
1654 fn try_from(
1655 value: &::std::string::String,
1656 ) -> ::std::result::Result<Self, self::error::ConversionError> {
1657 value.parse()
1658 }
1659}
1660impl ::std::convert::TryFrom<::std::string::String> for FinishReason {
1661 type Error = self::error::ConversionError;
1662 fn try_from(
1663 value: ::std::string::String,
1664 ) -> ::std::result::Result<Self, self::error::ConversionError> {
1665 value.parse()
1666 }
1667}
1668///`FunctionObject`
1669///
1670/// <details><summary>JSON schema</summary>
1671///
1672/// ```json
1673///{
1674/// "type": "object",
1675/// "required": [
1676/// "name"
1677/// ],
1678/// "properties": {
1679/// "description": {
1680/// "description": "A description of what the function does, used by the model to choose when and how to call the function.",
1681/// "type": "string"
1682/// },
1683/// "name": {
1684/// "description": "The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.",
1685/// "type": "string"
1686/// },
1687/// "parameters": {
1688/// "$ref": "#/definitions/FunctionParameters"
1689/// },
1690/// "strict": {
1691/// "description": "Whether to enable strict schema adherence when generating the function call. If set to true, the model will follow the exact schema defined in the `parameters` field. Only a subset of JSON Schema is supported when `strict` is `true`. Learn more about Structured Outputs in the [function calling guide](docs/guides/function-calling).",
1692/// "default": false,
1693/// "type": "boolean"
1694/// }
1695/// }
1696///}
1697/// ```
1698/// </details>
1699#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
1700pub struct FunctionObject {
1701 ///A description of what the function does, used by the model to choose when and how to call the function.
1702 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1703 pub description: ::std::option::Option<::std::string::String>,
1704 ///The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.
1705 pub name: ::std::string::String,
1706 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1707 pub parameters: ::std::option::Option<FunctionParameters>,
1708 ///Whether to enable strict schema adherence when generating the function call. If set to true, the model will follow the exact schema defined in the `parameters` field. Only a subset of JSON Schema is supported when `strict` is `true`. Learn more about Structured Outputs in the [function calling guide](docs/guides/function-calling).
1709 #[serde(default)]
1710 pub strict: bool,
1711}
1712/**The parameters the functions accepts, described as a JSON Schema object. See the [guide](/docs/guides/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format.
1713Omitting `parameters` defines a function with an empty parameter list.*/
1714///
1715/// <details><summary>JSON schema</summary>
1716///
1717/// ```json
1718///{
1719/// "description": "The parameters the functions accepts, described as a JSON Schema object. See the [guide](/docs/guides/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format. \nOmitting `parameters` defines a function with an empty parameter list.",
1720/// "type": "object",
1721/// "additionalProperties": true
1722///}
1723/// ```
1724/// </details>
1725#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
1726#[serde(transparent)]
1727pub struct FunctionParameters(pub ::serde_json::Map<::std::string::String, ::serde_json::Value>);
1728impl ::std::ops::Deref for FunctionParameters {
1729 type Target = ::serde_json::Map<::std::string::String, ::serde_json::Value>;
1730 fn deref(&self) -> &::serde_json::Map<::std::string::String, ::serde_json::Value> {
1731 &self.0
1732 }
1733}
1734impl ::std::convert::From<FunctionParameters>
1735 for ::serde_json::Map<::std::string::String, ::serde_json::Value>
1736{
1737 fn from(value: FunctionParameters) -> Self {
1738 value.0
1739 }
1740}
1741impl ::std::convert::From<::serde_json::Map<::std::string::String, ::serde_json::Value>>
1742 for FunctionParameters
1743{
1744 fn from(value: ::serde_json::Map<::std::string::String, ::serde_json::Value>) -> Self {
1745 Self(value)
1746 }
1747}
1748///Image content part
1749///
1750/// <details><summary>JSON schema</summary>
1751///
1752/// ```json
1753///{
1754/// "description": "Image content part",
1755/// "type": "object",
1756/// "required": [
1757/// "image_url",
1758/// "type"
1759/// ],
1760/// "properties": {
1761/// "image_url": {
1762/// "$ref": "#/definitions/ImageURL"
1763/// },
1764/// "type": {
1765/// "description": "Content type identifier",
1766/// "type": "string",
1767/// "enum": [
1768/// "image_url"
1769/// ]
1770/// }
1771/// }
1772///}
1773/// ```
1774/// </details>
1775#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
1776pub struct ImageContentPart {
1777 pub image_url: ImageUrl,
1778 ///Content type identifier
1779 #[serde(rename = "type")]
1780 pub type_: ImageContentPartType,
1781}
1782///Content type identifier
1783///
1784/// <details><summary>JSON schema</summary>
1785///
1786/// ```json
1787///{
1788/// "description": "Content type identifier",
1789/// "type": "string",
1790/// "enum": [
1791/// "image_url"
1792/// ]
1793///}
1794/// ```
1795/// </details>
1796#[derive(
1797 ::serde::Deserialize,
1798 ::serde::Serialize,
1799 Clone,
1800 Copy,
1801 Debug,
1802 Eq,
1803 Hash,
1804 Ord,
1805 PartialEq,
1806 PartialOrd,
1807)]
1808pub enum ImageContentPartType {
1809 #[serde(rename = "image_url")]
1810 ImageUrl,
1811}
1812impl ::std::fmt::Display for ImageContentPartType {
1813 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
1814 match *self {
1815 Self::ImageUrl => f.write_str("image_url"),
1816 }
1817 }
1818}
1819impl ::std::str::FromStr for ImageContentPartType {
1820 type Err = self::error::ConversionError;
1821 fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
1822 match value {
1823 "image_url" => Ok(Self::ImageUrl),
1824 _ => Err("invalid value".into()),
1825 }
1826 }
1827}
1828impl ::std::convert::TryFrom<&str> for ImageContentPartType {
1829 type Error = self::error::ConversionError;
1830 fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
1831 value.parse()
1832 }
1833}
1834impl ::std::convert::TryFrom<&::std::string::String> for ImageContentPartType {
1835 type Error = self::error::ConversionError;
1836 fn try_from(
1837 value: &::std::string::String,
1838 ) -> ::std::result::Result<Self, self::error::ConversionError> {
1839 value.parse()
1840 }
1841}
1842impl ::std::convert::TryFrom<::std::string::String> for ImageContentPartType {
1843 type Error = self::error::ConversionError;
1844 fn try_from(
1845 value: ::std::string::String,
1846 ) -> ::std::result::Result<Self, self::error::ConversionError> {
1847 value.parse()
1848 }
1849}
1850///Image URL configuration
1851///
1852/// <details><summary>JSON schema</summary>
1853///
1854/// ```json
1855///{
1856/// "description": "Image URL configuration",
1857/// "type": "object",
1858/// "required": [
1859/// "url"
1860/// ],
1861/// "properties": {
1862/// "detail": {
1863/// "description": "Image detail level for vision processing",
1864/// "default": "auto",
1865/// "type": "string",
1866/// "enum": [
1867/// "auto",
1868/// "low",
1869/// "high"
1870/// ]
1871/// },
1872/// "url": {
1873/// "description": "URL of the image (data URLs supported)",
1874/// "type": "string"
1875/// }
1876/// }
1877///}
1878/// ```
1879/// </details>
1880#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
1881pub struct ImageUrl {
1882 ///Image detail level for vision processing
1883 #[serde(default = "defaults::image_url_detail")]
1884 pub detail: ImageUrlDetail,
1885 ///URL of the image (data URLs supported)
1886 pub url: ::std::string::String,
1887}
1888///Image detail level for vision processing
1889///
1890/// <details><summary>JSON schema</summary>
1891///
1892/// ```json
1893///{
1894/// "description": "Image detail level for vision processing",
1895/// "default": "auto",
1896/// "type": "string",
1897/// "enum": [
1898/// "auto",
1899/// "low",
1900/// "high"
1901/// ]
1902///}
1903/// ```
1904/// </details>
1905#[derive(
1906 ::serde::Deserialize,
1907 ::serde::Serialize,
1908 Clone,
1909 Copy,
1910 Debug,
1911 Eq,
1912 Hash,
1913 Ord,
1914 PartialEq,
1915 PartialOrd,
1916)]
1917pub enum ImageUrlDetail {
1918 #[serde(rename = "auto")]
1919 Auto,
1920 #[serde(rename = "low")]
1921 Low,
1922 #[serde(rename = "high")]
1923 High,
1924}
1925impl ::std::fmt::Display for ImageUrlDetail {
1926 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
1927 match *self {
1928 Self::Auto => f.write_str("auto"),
1929 Self::Low => f.write_str("low"),
1930 Self::High => f.write_str("high"),
1931 }
1932 }
1933}
1934impl ::std::str::FromStr for ImageUrlDetail {
1935 type Err = self::error::ConversionError;
1936 fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
1937 match value {
1938 "auto" => Ok(Self::Auto),
1939 "low" => Ok(Self::Low),
1940 "high" => Ok(Self::High),
1941 _ => Err("invalid value".into()),
1942 }
1943 }
1944}
1945impl ::std::convert::TryFrom<&str> for ImageUrlDetail {
1946 type Error = self::error::ConversionError;
1947 fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
1948 value.parse()
1949 }
1950}
1951impl ::std::convert::TryFrom<&::std::string::String> for ImageUrlDetail {
1952 type Error = self::error::ConversionError;
1953 fn try_from(
1954 value: &::std::string::String,
1955 ) -> ::std::result::Result<Self, self::error::ConversionError> {
1956 value.parse()
1957 }
1958}
1959impl ::std::convert::TryFrom<::std::string::String> for ImageUrlDetail {
1960 type Error = self::error::ConversionError;
1961 fn try_from(
1962 value: ::std::string::String,
1963 ) -> ::std::result::Result<Self, self::error::ConversionError> {
1964 value.parse()
1965 }
1966}
1967impl ::std::default::Default for ImageUrlDetail {
1968 fn default() -> Self {
1969 ImageUrlDetail::Auto
1970 }
1971}
1972///Response structure for listing models
1973///
1974/// <details><summary>JSON schema</summary>
1975///
1976/// ```json
1977///{
1978/// "description": "Response structure for listing models",
1979/// "type": "object",
1980/// "required": [
1981/// "data",
1982/// "object"
1983/// ],
1984/// "properties": {
1985/// "data": {
1986/// "default": [],
1987/// "type": "array",
1988/// "items": {
1989/// "$ref": "#/definitions/Model"
1990/// }
1991/// },
1992/// "object": {
1993/// "type": "string"
1994/// },
1995/// "provider": {
1996/// "$ref": "#/definitions/Provider"
1997/// }
1998/// }
1999///}
2000/// ```
2001/// </details>
2002#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
2003pub struct ListModelsResponse {
2004 pub data: ::std::vec::Vec<Model>,
2005 pub object: ::std::string::String,
2006 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
2007 pub provider: ::std::option::Option<Provider>,
2008}
2009///Response structure for listing MCP tools
2010///
2011/// <details><summary>JSON schema</summary>
2012///
2013/// ```json
2014///{
2015/// "description": "Response structure for listing MCP tools",
2016/// "type": "object",
2017/// "required": [
2018/// "data",
2019/// "object"
2020/// ],
2021/// "properties": {
2022/// "data": {
2023/// "description": "Array of available MCP tools",
2024/// "default": [],
2025/// "type": "array",
2026/// "items": {
2027/// "$ref": "#/definitions/MCPTool"
2028/// }
2029/// },
2030/// "object": {
2031/// "description": "Always \"list\"",
2032/// "type": "string"
2033/// }
2034/// }
2035///}
2036/// ```
2037/// </details>
2038#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
2039pub struct ListToolsResponse {
2040 ///Array of available MCP tools
2041 pub data: ::std::vec::Vec<McpTool>,
2042 ///Always "list"
2043 pub object: ::std::string::String,
2044}
2045///An MCP tool definition
2046///
2047/// <details><summary>JSON schema</summary>
2048///
2049/// ```json
2050///{
2051/// "description": "An MCP tool definition",
2052/// "type": "object",
2053/// "required": [
2054/// "description",
2055/// "name",
2056/// "server"
2057/// ],
2058/// "properties": {
2059/// "description": {
2060/// "description": "A description of what the tool does",
2061/// "type": "string"
2062/// },
2063/// "input_schema": {
2064/// "description": "JSON schema for the tool's input parameters",
2065/// "type": "object",
2066/// "additionalProperties": true
2067/// },
2068/// "name": {
2069/// "description": "The name of the tool",
2070/// "type": "string"
2071/// },
2072/// "server": {
2073/// "description": "The MCP server that provides this tool",
2074/// "type": "string"
2075/// }
2076/// }
2077///}
2078/// ```
2079/// </details>
2080#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
2081pub struct McpTool {
2082 ///A description of what the tool does
2083 pub description: ::std::string::String,
2084 ///JSON schema for the tool's input parameters
2085 #[serde(default, skip_serializing_if = "::serde_json::Map::is_empty")]
2086 pub input_schema: ::serde_json::Map<::std::string::String, ::serde_json::Value>,
2087 ///The name of the tool
2088 pub name: ::std::string::String,
2089 ///The MCP server that provides this tool
2090 pub server: ::std::string::String,
2091}
2092///Message structure for provider requests
2093///
2094/// <details><summary>JSON schema</summary>
2095///
2096/// ```json
2097///{
2098/// "description": "Message structure for provider requests",
2099/// "type": "object",
2100/// "required": [
2101/// "content",
2102/// "role"
2103/// ],
2104/// "properties": {
2105/// "content": {
2106/// "$ref": "#/definitions/MessageContent"
2107/// },
2108/// "reasoning": {
2109/// "description": "The reasoning of the chunk message. Same as reasoning_content.",
2110/// "type": "string"
2111/// },
2112/// "reasoning_content": {
2113/// "description": "The reasoning content of the chunk message.",
2114/// "type": "string"
2115/// },
2116/// "role": {
2117/// "$ref": "#/definitions/MessageRole"
2118/// },
2119/// "tool_call_id": {
2120/// "type": "string"
2121/// },
2122/// "tool_calls": {
2123/// "type": "array",
2124/// "items": {
2125/// "$ref": "#/definitions/ChatCompletionMessageToolCall"
2126/// }
2127/// }
2128/// }
2129///}
2130/// ```
2131/// </details>
2132#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
2133pub struct Message {
2134 pub content: MessageContent,
2135 ///The reasoning of the chunk message. Same as reasoning_content.
2136 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
2137 pub reasoning: ::std::option::Option<::std::string::String>,
2138 ///The reasoning content of the chunk message.
2139 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
2140 pub reasoning_content: ::std::option::Option<::std::string::String>,
2141 pub role: MessageRole,
2142 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
2143 pub tool_call_id: ::std::option::Option<::std::string::String>,
2144 #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
2145 pub tool_calls: ::std::vec::Vec<ChatCompletionMessageToolCall>,
2146}
2147///Message content - either text or multimodal content parts
2148///
2149/// <details><summary>JSON schema</summary>
2150///
2151/// ```json
2152///{
2153/// "description": "Message content - either text or multimodal content parts",
2154/// "oneOf": [
2155/// {
2156/// "description": "Text content (backward compatibility)",
2157/// "type": "string"
2158/// },
2159/// {
2160/// "description": "Array of content parts for multimodal messages",
2161/// "type": "array",
2162/// "items": {
2163/// "$ref": "#/definitions/ContentPart"
2164/// }
2165/// }
2166/// ]
2167///}
2168/// ```
2169/// </details>
2170#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
2171#[serde(untagged)]
2172pub enum MessageContent {
2173 String(::std::string::String),
2174 Array(::std::vec::Vec<ContentPart>),
2175}
2176impl ::std::convert::From<::std::vec::Vec<ContentPart>> for MessageContent {
2177 fn from(value: ::std::vec::Vec<ContentPart>) -> Self {
2178 Self::Array(value)
2179 }
2180}
2181///Role of the message sender
2182///
2183/// <details><summary>JSON schema</summary>
2184///
2185/// ```json
2186///{
2187/// "description": "Role of the message sender",
2188/// "type": "string",
2189/// "enum": [
2190/// "system",
2191/// "user",
2192/// "assistant",
2193/// "tool"
2194/// ]
2195///}
2196/// ```
2197/// </details>
2198#[derive(
2199 ::serde::Deserialize,
2200 ::serde::Serialize,
2201 Clone,
2202 Copy,
2203 Debug,
2204 Eq,
2205 Hash,
2206 Ord,
2207 PartialEq,
2208 PartialOrd,
2209)]
2210pub enum MessageRole {
2211 #[serde(rename = "system")]
2212 System,
2213 #[serde(rename = "user")]
2214 User,
2215 #[serde(rename = "assistant")]
2216 Assistant,
2217 #[serde(rename = "tool")]
2218 Tool,
2219}
2220impl ::std::fmt::Display for MessageRole {
2221 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
2222 match *self {
2223 Self::System => f.write_str("system"),
2224 Self::User => f.write_str("user"),
2225 Self::Assistant => f.write_str("assistant"),
2226 Self::Tool => f.write_str("tool"),
2227 }
2228 }
2229}
2230impl ::std::str::FromStr for MessageRole {
2231 type Err = self::error::ConversionError;
2232 fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
2233 match value {
2234 "system" => Ok(Self::System),
2235 "user" => Ok(Self::User),
2236 "assistant" => Ok(Self::Assistant),
2237 "tool" => Ok(Self::Tool),
2238 _ => Err("invalid value".into()),
2239 }
2240 }
2241}
2242impl ::std::convert::TryFrom<&str> for MessageRole {
2243 type Error = self::error::ConversionError;
2244 fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
2245 value.parse()
2246 }
2247}
2248impl ::std::convert::TryFrom<&::std::string::String> for MessageRole {
2249 type Error = self::error::ConversionError;
2250 fn try_from(
2251 value: &::std::string::String,
2252 ) -> ::std::result::Result<Self, self::error::ConversionError> {
2253 value.parse()
2254 }
2255}
2256impl ::std::convert::TryFrom<::std::string::String> for MessageRole {
2257 type Error = self::error::ConversionError;
2258 fn try_from(
2259 value: ::std::string::String,
2260 ) -> ::std::result::Result<Self, self::error::ConversionError> {
2261 value.parse()
2262 }
2263}
2264///Common model information
2265///
2266/// <details><summary>JSON schema</summary>
2267///
2268/// ```json
2269///{
2270/// "description": "Common model information",
2271/// "type": "object",
2272/// "required": [
2273/// "created",
2274/// "id",
2275/// "object",
2276/// "owned_by",
2277/// "served_by"
2278/// ],
2279/// "properties": {
2280/// "created": {
2281/// "type": "integer",
2282/// "format": "int64"
2283/// },
2284/// "id": {
2285/// "type": "string"
2286/// },
2287/// "object": {
2288/// "type": "string"
2289/// },
2290/// "owned_by": {
2291/// "type": "string"
2292/// },
2293/// "served_by": {
2294/// "$ref": "#/definitions/Provider"
2295/// }
2296/// }
2297///}
2298/// ```
2299/// </details>
2300#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
2301pub struct Model {
2302 pub created: i64,
2303 pub id: ::std::string::String,
2304 pub object: ::std::string::String,
2305 pub owned_by: ::std::string::String,
2306 pub served_by: Provider,
2307}
2308///`Provider`
2309///
2310/// <details><summary>JSON schema</summary>
2311///
2312/// ```json
2313///{
2314/// "type": "string",
2315/// "enum": [
2316/// "ollama",
2317/// "ollama_cloud",
2318/// "groq",
2319/// "openai",
2320/// "cloudflare",
2321/// "cohere",
2322/// "anthropic",
2323/// "deepseek",
2324/// "google",
2325/// "mistral",
2326/// "minimax",
2327/// "moonshot",
2328/// "nvidia"
2329/// ]
2330///}
2331/// ```
2332/// </details>
2333#[derive(
2334 ::serde::Deserialize,
2335 ::serde::Serialize,
2336 Clone,
2337 Copy,
2338 Debug,
2339 Eq,
2340 Hash,
2341 Ord,
2342 PartialEq,
2343 PartialOrd,
2344)]
2345pub enum Provider {
2346 #[serde(rename = "ollama")]
2347 Ollama,
2348 #[serde(rename = "ollama_cloud")]
2349 OllamaCloud,
2350 #[serde(rename = "groq")]
2351 Groq,
2352 #[serde(rename = "openai")]
2353 Openai,
2354 #[serde(rename = "cloudflare")]
2355 Cloudflare,
2356 #[serde(rename = "cohere")]
2357 Cohere,
2358 #[serde(rename = "anthropic")]
2359 Anthropic,
2360 #[serde(rename = "deepseek")]
2361 Deepseek,
2362 #[serde(rename = "google")]
2363 Google,
2364 #[serde(rename = "mistral")]
2365 Mistral,
2366 #[serde(rename = "minimax")]
2367 Minimax,
2368 #[serde(rename = "moonshot")]
2369 Moonshot,
2370 #[serde(rename = "nvidia")]
2371 Nvidia,
2372}
2373impl ::std::fmt::Display for Provider {
2374 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
2375 match *self {
2376 Self::Ollama => f.write_str("ollama"),
2377 Self::OllamaCloud => f.write_str("ollama_cloud"),
2378 Self::Groq => f.write_str("groq"),
2379 Self::Openai => f.write_str("openai"),
2380 Self::Cloudflare => f.write_str("cloudflare"),
2381 Self::Cohere => f.write_str("cohere"),
2382 Self::Anthropic => f.write_str("anthropic"),
2383 Self::Deepseek => f.write_str("deepseek"),
2384 Self::Google => f.write_str("google"),
2385 Self::Mistral => f.write_str("mistral"),
2386 Self::Minimax => f.write_str("minimax"),
2387 Self::Moonshot => f.write_str("moonshot"),
2388 Self::Nvidia => f.write_str("nvidia"),
2389 }
2390 }
2391}
2392impl ::std::str::FromStr for Provider {
2393 type Err = self::error::ConversionError;
2394 fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
2395 match value {
2396 "ollama" => Ok(Self::Ollama),
2397 "ollama_cloud" => Ok(Self::OllamaCloud),
2398 "groq" => Ok(Self::Groq),
2399 "openai" => Ok(Self::Openai),
2400 "cloudflare" => Ok(Self::Cloudflare),
2401 "cohere" => Ok(Self::Cohere),
2402 "anthropic" => Ok(Self::Anthropic),
2403 "deepseek" => Ok(Self::Deepseek),
2404 "google" => Ok(Self::Google),
2405 "mistral" => Ok(Self::Mistral),
2406 "minimax" => Ok(Self::Minimax),
2407 "moonshot" => Ok(Self::Moonshot),
2408 "nvidia" => Ok(Self::Nvidia),
2409 _ => Err("invalid value".into()),
2410 }
2411 }
2412}
2413impl ::std::convert::TryFrom<&str> for Provider {
2414 type Error = self::error::ConversionError;
2415 fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
2416 value.parse()
2417 }
2418}
2419impl ::std::convert::TryFrom<&::std::string::String> for Provider {
2420 type Error = self::error::ConversionError;
2421 fn try_from(
2422 value: &::std::string::String,
2423 ) -> ::std::result::Result<Self, self::error::ConversionError> {
2424 value.parse()
2425 }
2426}
2427impl ::std::convert::TryFrom<::std::string::String> for Provider {
2428 type Error = self::error::ConversionError;
2429 fn try_from(
2430 value: ::std::string::String,
2431 ) -> ::std::result::Result<Self, self::error::ConversionError> {
2432 value.parse()
2433 }
2434}
2435///Authentication type for providers
2436///
2437/// <details><summary>JSON schema</summary>
2438///
2439/// ```json
2440///{
2441/// "description": "Authentication type for providers",
2442/// "type": "string",
2443/// "enum": [
2444/// "bearer",
2445/// "xheader",
2446/// "query",
2447/// "none"
2448/// ]
2449///}
2450/// ```
2451/// </details>
2452#[derive(
2453 ::serde::Deserialize,
2454 ::serde::Serialize,
2455 Clone,
2456 Copy,
2457 Debug,
2458 Eq,
2459 Hash,
2460 Ord,
2461 PartialEq,
2462 PartialOrd,
2463)]
2464pub enum ProviderAuthType {
2465 #[serde(rename = "bearer")]
2466 Bearer,
2467 #[serde(rename = "xheader")]
2468 Xheader,
2469 #[serde(rename = "query")]
2470 Query,
2471 #[serde(rename = "none")]
2472 None,
2473}
2474impl ::std::fmt::Display for ProviderAuthType {
2475 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
2476 match *self {
2477 Self::Bearer => f.write_str("bearer"),
2478 Self::Xheader => f.write_str("xheader"),
2479 Self::Query => f.write_str("query"),
2480 Self::None => f.write_str("none"),
2481 }
2482 }
2483}
2484impl ::std::str::FromStr for ProviderAuthType {
2485 type Err = self::error::ConversionError;
2486 fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
2487 match value {
2488 "bearer" => Ok(Self::Bearer),
2489 "xheader" => Ok(Self::Xheader),
2490 "query" => Ok(Self::Query),
2491 "none" => Ok(Self::None),
2492 _ => Err("invalid value".into()),
2493 }
2494 }
2495}
2496impl ::std::convert::TryFrom<&str> for ProviderAuthType {
2497 type Error = self::error::ConversionError;
2498 fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
2499 value.parse()
2500 }
2501}
2502impl ::std::convert::TryFrom<&::std::string::String> for ProviderAuthType {
2503 type Error = self::error::ConversionError;
2504 fn try_from(
2505 value: &::std::string::String,
2506 ) -> ::std::result::Result<Self, self::error::ConversionError> {
2507 value.parse()
2508 }
2509}
2510impl ::std::convert::TryFrom<::std::string::String> for ProviderAuthType {
2511 type Error = self::error::ConversionError;
2512 fn try_from(
2513 value: ::std::string::String,
2514 ) -> ::std::result::Result<Self, self::error::ConversionError> {
2515 value.parse()
2516 }
2517}
2518/**Provider-specific response format. Examples:
2519
2520OpenAI GET /v1/models?provider=openai response:
2521```json
2522{
2523 "provider": "openai",
2524 "object": "list",
2525 "data": [
2526 {
2527 "id": "gpt-4",
2528 "object": "model",
2529 "created": 1687882410,
2530 "owned_by": "openai",
2531 "served_by": "openai"
2532 }
2533 ]
2534}
2535```
2536
2537Anthropic GET /v1/models?provider=anthropic response:
2538```json
2539{
2540 "provider": "anthropic",
2541 "object": "list",
2542 "data": [
2543 {
2544 "id": "gpt-4",
2545 "object": "model",
2546 "created": 1687882410,
2547 "owned_by": "openai",
2548 "served_by": "openai"
2549 }
2550 ]
2551}
2552```
2553*/
2554///
2555/// <details><summary>JSON schema</summary>
2556///
2557/// ```json
2558///{
2559/// "description": "Provider-specific response format. Examples:\n\nOpenAI GET /v1/models?provider=openai response:\n```json\n{\n \"provider\": \"openai\",\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"gpt-4\",\n \"object\": \"model\",\n \"created\": 1687882410,\n \"owned_by\": \"openai\",\n \"served_by\": \"openai\"\n }\n ]\n}\n```\n\nAnthropic GET /v1/models?provider=anthropic response:\n```json\n{\n \"provider\": \"anthropic\",\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"gpt-4\",\n \"object\": \"model\",\n \"created\": 1687882410,\n \"owned_by\": \"openai\",\n \"served_by\": \"openai\"\n }\n ]\n}\n```\n",
2560/// "type": "object"
2561///}
2562/// ```
2563/// </details>
2564#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
2565#[serde(transparent)]
2566pub struct ProviderSpecificResponse(
2567 pub ::serde_json::Map<::std::string::String, ::serde_json::Value>,
2568);
2569impl ::std::ops::Deref for ProviderSpecificResponse {
2570 type Target = ::serde_json::Map<::std::string::String, ::serde_json::Value>;
2571 fn deref(&self) -> &::serde_json::Map<::std::string::String, ::serde_json::Value> {
2572 &self.0
2573 }
2574}
2575impl ::std::convert::From<ProviderSpecificResponse>
2576 for ::serde_json::Map<::std::string::String, ::serde_json::Value>
2577{
2578 fn from(value: ProviderSpecificResponse) -> Self {
2579 value.0
2580 }
2581}
2582impl ::std::convert::From<::serde_json::Map<::std::string::String, ::serde_json::Value>>
2583 for ProviderSpecificResponse
2584{
2585 fn from(value: ::serde_json::Map<::std::string::String, ::serde_json::Value>) -> Self {
2586 Self(value)
2587 }
2588}
2589/**JSON object response format. An older method of generating JSON responses. Using `json_schema` is recommended for models that support it. Note that the model will not generate JSON without a system or user message instructing it to do so.
2590*/
2591///
2592/// <details><summary>JSON schema</summary>
2593///
2594/// ```json
2595///{
2596/// "description": "JSON object response format. An older method of generating JSON responses. Using `json_schema` is recommended for models that support it. Note that the model will not generate JSON without a system or user message instructing it to do so.\n",
2597/// "type": "object",
2598/// "required": [
2599/// "type"
2600/// ],
2601/// "properties": {
2602/// "type": {
2603/// "description": "The type of response format being defined. Always `json_object`.",
2604/// "type": "string",
2605/// "enum": [
2606/// "json_object"
2607/// ]
2608/// }
2609/// }
2610///}
2611/// ```
2612/// </details>
2613#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
2614pub struct ResponseFormatJsonObject {
2615 ///The type of response format being defined. Always `json_object`.
2616 #[serde(rename = "type")]
2617 pub type_: ResponseFormatJsonObjectType,
2618}
2619///The type of response format being defined. Always `json_object`.
2620///
2621/// <details><summary>JSON schema</summary>
2622///
2623/// ```json
2624///{
2625/// "description": "The type of response format being defined. Always `json_object`.",
2626/// "type": "string",
2627/// "enum": [
2628/// "json_object"
2629/// ]
2630///}
2631/// ```
2632/// </details>
2633#[derive(
2634 ::serde::Deserialize,
2635 ::serde::Serialize,
2636 Clone,
2637 Copy,
2638 Debug,
2639 Eq,
2640 Hash,
2641 Ord,
2642 PartialEq,
2643 PartialOrd,
2644)]
2645pub enum ResponseFormatJsonObjectType {
2646 #[serde(rename = "json_object")]
2647 JsonObject,
2648}
2649impl ::std::fmt::Display for ResponseFormatJsonObjectType {
2650 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
2651 match *self {
2652 Self::JsonObject => f.write_str("json_object"),
2653 }
2654 }
2655}
2656impl ::std::str::FromStr for ResponseFormatJsonObjectType {
2657 type Err = self::error::ConversionError;
2658 fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
2659 match value {
2660 "json_object" => Ok(Self::JsonObject),
2661 _ => Err("invalid value".into()),
2662 }
2663 }
2664}
2665impl ::std::convert::TryFrom<&str> for ResponseFormatJsonObjectType {
2666 type Error = self::error::ConversionError;
2667 fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
2668 value.parse()
2669 }
2670}
2671impl ::std::convert::TryFrom<&::std::string::String> for ResponseFormatJsonObjectType {
2672 type Error = self::error::ConversionError;
2673 fn try_from(
2674 value: &::std::string::String,
2675 ) -> ::std::result::Result<Self, self::error::ConversionError> {
2676 value.parse()
2677 }
2678}
2679impl ::std::convert::TryFrom<::std::string::String> for ResponseFormatJsonObjectType {
2680 type Error = self::error::ConversionError;
2681 fn try_from(
2682 value: ::std::string::String,
2683 ) -> ::std::result::Result<Self, self::error::ConversionError> {
2684 value.parse()
2685 }
2686}
2687/**JSON Schema response format. Used to generate structured JSON responses.
2688*/
2689///
2690/// <details><summary>JSON schema</summary>
2691///
2692/// ```json
2693///{
2694/// "description": "JSON Schema response format. Used to generate structured JSON responses.\n",
2695/// "type": "object",
2696/// "required": [
2697/// "json_schema",
2698/// "type"
2699/// ],
2700/// "properties": {
2701/// "json_schema": {
2702/// "description": "Structured Outputs configuration options, including a JSON Schema.",
2703/// "type": "object",
2704/// "required": [
2705/// "name"
2706/// ],
2707/// "properties": {
2708/// "description": {
2709/// "description": "A description of what the response format is for, used by the model to determine how to respond in the format.\n",
2710/// "type": "string"
2711/// },
2712/// "name": {
2713/// "description": "The name of the response format. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.\n",
2714/// "type": "string"
2715/// },
2716/// "schema": {
2717/// "$ref": "#/definitions/ResponseFormatJsonSchemaSchema"
2718/// },
2719/// "strict": {
2720/// "description": "Whether to enable strict schema adherence when generating the output. If set to true, the model will always follow the exact schema defined in the `schema` field. Only a subset of JSON Schema is supported when `strict` is `true`.\n",
2721/// "default": false,
2722/// "type": "boolean"
2723/// }
2724/// }
2725/// },
2726/// "type": {
2727/// "description": "The type of response format being defined. Always `json_schema`.",
2728/// "type": "string",
2729/// "enum": [
2730/// "json_schema"
2731/// ]
2732/// }
2733/// }
2734///}
2735/// ```
2736/// </details>
2737#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
2738pub struct ResponseFormatJsonSchema {
2739 pub json_schema: ResponseFormatJsonSchemaJsonSchema,
2740 ///The type of response format being defined. Always `json_schema`.
2741 #[serde(rename = "type")]
2742 pub type_: ResponseFormatJsonSchemaType,
2743}
2744///Structured Outputs configuration options, including a JSON Schema.
2745///
2746/// <details><summary>JSON schema</summary>
2747///
2748/// ```json
2749///{
2750/// "description": "Structured Outputs configuration options, including a JSON Schema.",
2751/// "type": "object",
2752/// "required": [
2753/// "name"
2754/// ],
2755/// "properties": {
2756/// "description": {
2757/// "description": "A description of what the response format is for, used by the model to determine how to respond in the format.\n",
2758/// "type": "string"
2759/// },
2760/// "name": {
2761/// "description": "The name of the response format. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.\n",
2762/// "type": "string"
2763/// },
2764/// "schema": {
2765/// "$ref": "#/definitions/ResponseFormatJsonSchemaSchema"
2766/// },
2767/// "strict": {
2768/// "description": "Whether to enable strict schema adherence when generating the output. If set to true, the model will always follow the exact schema defined in the `schema` field. Only a subset of JSON Schema is supported when `strict` is `true`.\n",
2769/// "default": false,
2770/// "type": "boolean"
2771/// }
2772/// }
2773///}
2774/// ```
2775/// </details>
2776#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
2777pub struct ResponseFormatJsonSchemaJsonSchema {
2778 /**A description of what the response format is for, used by the model to determine how to respond in the format.
2779 */
2780 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
2781 pub description: ::std::option::Option<::std::string::String>,
2782 /**The name of the response format. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.
2783 */
2784 pub name: ::std::string::String,
2785 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
2786 pub schema: ::std::option::Option<ResponseFormatJsonSchemaSchema>,
2787 /**Whether to enable strict schema adherence when generating the output. If set to true, the model will always follow the exact schema defined in the `schema` field. Only a subset of JSON Schema is supported when `strict` is `true`.
2788 */
2789 #[serde(default)]
2790 pub strict: bool,
2791}
2792/**The schema for the response format, described as a JSON Schema object.
2793*/
2794///
2795/// <details><summary>JSON schema</summary>
2796///
2797/// ```json
2798///{
2799/// "description": "The schema for the response format, described as a JSON Schema object.\n",
2800/// "type": "object",
2801/// "additionalProperties": true
2802///}
2803/// ```
2804/// </details>
2805#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
2806#[serde(transparent)]
2807pub struct ResponseFormatJsonSchemaSchema(
2808 pub ::serde_json::Map<::std::string::String, ::serde_json::Value>,
2809);
2810impl ::std::ops::Deref for ResponseFormatJsonSchemaSchema {
2811 type Target = ::serde_json::Map<::std::string::String, ::serde_json::Value>;
2812 fn deref(&self) -> &::serde_json::Map<::std::string::String, ::serde_json::Value> {
2813 &self.0
2814 }
2815}
2816impl ::std::convert::From<ResponseFormatJsonSchemaSchema>
2817 for ::serde_json::Map<::std::string::String, ::serde_json::Value>
2818{
2819 fn from(value: ResponseFormatJsonSchemaSchema) -> Self {
2820 value.0
2821 }
2822}
2823impl ::std::convert::From<::serde_json::Map<::std::string::String, ::serde_json::Value>>
2824 for ResponseFormatJsonSchemaSchema
2825{
2826 fn from(value: ::serde_json::Map<::std::string::String, ::serde_json::Value>) -> Self {
2827 Self(value)
2828 }
2829}
2830///The type of response format being defined. Always `json_schema`.
2831///
2832/// <details><summary>JSON schema</summary>
2833///
2834/// ```json
2835///{
2836/// "description": "The type of response format being defined. Always `json_schema`.",
2837/// "type": "string",
2838/// "enum": [
2839/// "json_schema"
2840/// ]
2841///}
2842/// ```
2843/// </details>
2844#[derive(
2845 ::serde::Deserialize,
2846 ::serde::Serialize,
2847 Clone,
2848 Copy,
2849 Debug,
2850 Eq,
2851 Hash,
2852 Ord,
2853 PartialEq,
2854 PartialOrd,
2855)]
2856pub enum ResponseFormatJsonSchemaType {
2857 #[serde(rename = "json_schema")]
2858 JsonSchema,
2859}
2860impl ::std::fmt::Display for ResponseFormatJsonSchemaType {
2861 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
2862 match *self {
2863 Self::JsonSchema => f.write_str("json_schema"),
2864 }
2865 }
2866}
2867impl ::std::str::FromStr for ResponseFormatJsonSchemaType {
2868 type Err = self::error::ConversionError;
2869 fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
2870 match value {
2871 "json_schema" => Ok(Self::JsonSchema),
2872 _ => Err("invalid value".into()),
2873 }
2874 }
2875}
2876impl ::std::convert::TryFrom<&str> for ResponseFormatJsonSchemaType {
2877 type Error = self::error::ConversionError;
2878 fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
2879 value.parse()
2880 }
2881}
2882impl ::std::convert::TryFrom<&::std::string::String> for ResponseFormatJsonSchemaType {
2883 type Error = self::error::ConversionError;
2884 fn try_from(
2885 value: &::std::string::String,
2886 ) -> ::std::result::Result<Self, self::error::ConversionError> {
2887 value.parse()
2888 }
2889}
2890impl ::std::convert::TryFrom<::std::string::String> for ResponseFormatJsonSchemaType {
2891 type Error = self::error::ConversionError;
2892 fn try_from(
2893 value: ::std::string::String,
2894 ) -> ::std::result::Result<Self, self::error::ConversionError> {
2895 value.parse()
2896 }
2897}
2898///Default response format. Used to generate text responses.
2899///
2900/// <details><summary>JSON schema</summary>
2901///
2902/// ```json
2903///{
2904/// "description": "Default response format. Used to generate text responses.",
2905/// "type": "object",
2906/// "required": [
2907/// "type"
2908/// ],
2909/// "properties": {
2910/// "type": {
2911/// "description": "The type of response format being defined. Always `text`.",
2912/// "type": "string",
2913/// "enum": [
2914/// "text"
2915/// ]
2916/// }
2917/// }
2918///}
2919/// ```
2920/// </details>
2921#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
2922pub struct ResponseFormatText {
2923 ///The type of response format being defined. Always `text`.
2924 #[serde(rename = "type")]
2925 pub type_: ResponseFormatTextType,
2926}
2927///The type of response format being defined. Always `text`.
2928///
2929/// <details><summary>JSON schema</summary>
2930///
2931/// ```json
2932///{
2933/// "description": "The type of response format being defined. Always `text`.",
2934/// "type": "string",
2935/// "enum": [
2936/// "text"
2937/// ]
2938///}
2939/// ```
2940/// </details>
2941#[derive(
2942 ::serde::Deserialize,
2943 ::serde::Serialize,
2944 Clone,
2945 Copy,
2946 Debug,
2947 Eq,
2948 Hash,
2949 Ord,
2950 PartialEq,
2951 PartialOrd,
2952)]
2953pub enum ResponseFormatTextType {
2954 #[serde(rename = "text")]
2955 Text,
2956}
2957impl ::std::fmt::Display for ResponseFormatTextType {
2958 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
2959 match *self {
2960 Self::Text => f.write_str("text"),
2961 }
2962 }
2963}
2964impl ::std::str::FromStr for ResponseFormatTextType {
2965 type Err = self::error::ConversionError;
2966 fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
2967 match value {
2968 "text" => Ok(Self::Text),
2969 _ => Err("invalid value".into()),
2970 }
2971 }
2972}
2973impl ::std::convert::TryFrom<&str> for ResponseFormatTextType {
2974 type Error = self::error::ConversionError;
2975 fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
2976 value.parse()
2977 }
2978}
2979impl ::std::convert::TryFrom<&::std::string::String> for ResponseFormatTextType {
2980 type Error = self::error::ConversionError;
2981 fn try_from(
2982 value: &::std::string::String,
2983 ) -> ::std::result::Result<Self, self::error::ConversionError> {
2984 value.parse()
2985 }
2986}
2987impl ::std::convert::TryFrom<::std::string::String> for ResponseFormatTextType {
2988 type Error = self::error::ConversionError;
2989 fn try_from(
2990 value: ::std::string::String,
2991 ) -> ::std::result::Result<Self, self::error::ConversionError> {
2992 value.parse()
2993 }
2994}
2995///`SsEvent`
2996///
2997/// <details><summary>JSON schema</summary>
2998///
2999/// ```json
3000///{
3001/// "type": "object",
3002/// "properties": {
3003/// "data": {
3004/// "type": "string",
3005/// "format": "byte"
3006/// },
3007/// "event": {
3008/// "type": "string",
3009/// "enum": [
3010/// "message-start",
3011/// "stream-start",
3012/// "content-start",
3013/// "content-delta",
3014/// "content-end",
3015/// "message-end",
3016/// "stream-end"
3017/// ]
3018/// },
3019/// "retry": {
3020/// "type": "integer"
3021/// }
3022/// }
3023///}
3024/// ```
3025/// </details>
3026#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
3027pub struct SsEvent {
3028 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
3029 pub data: ::std::option::Option<::std::string::String>,
3030 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
3031 pub event: ::std::option::Option<SsEventEvent>,
3032 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
3033 pub retry: ::std::option::Option<i64>,
3034}
3035impl ::std::default::Default for SsEvent {
3036 fn default() -> Self {
3037 Self {
3038 data: Default::default(),
3039 event: Default::default(),
3040 retry: Default::default(),
3041 }
3042 }
3043}
3044///`SsEventEvent`
3045///
3046/// <details><summary>JSON schema</summary>
3047///
3048/// ```json
3049///{
3050/// "type": "string",
3051/// "enum": [
3052/// "message-start",
3053/// "stream-start",
3054/// "content-start",
3055/// "content-delta",
3056/// "content-end",
3057/// "message-end",
3058/// "stream-end"
3059/// ]
3060///}
3061/// ```
3062/// </details>
3063#[derive(
3064 ::serde::Deserialize,
3065 ::serde::Serialize,
3066 Clone,
3067 Copy,
3068 Debug,
3069 Eq,
3070 Hash,
3071 Ord,
3072 PartialEq,
3073 PartialOrd,
3074)]
3075pub enum SsEventEvent {
3076 #[serde(rename = "message-start")]
3077 MessageStart,
3078 #[serde(rename = "stream-start")]
3079 StreamStart,
3080 #[serde(rename = "content-start")]
3081 ContentStart,
3082 #[serde(rename = "content-delta")]
3083 ContentDelta,
3084 #[serde(rename = "content-end")]
3085 ContentEnd,
3086 #[serde(rename = "message-end")]
3087 MessageEnd,
3088 #[serde(rename = "stream-end")]
3089 StreamEnd,
3090}
3091impl ::std::fmt::Display for SsEventEvent {
3092 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
3093 match *self {
3094 Self::MessageStart => f.write_str("message-start"),
3095 Self::StreamStart => f.write_str("stream-start"),
3096 Self::ContentStart => f.write_str("content-start"),
3097 Self::ContentDelta => f.write_str("content-delta"),
3098 Self::ContentEnd => f.write_str("content-end"),
3099 Self::MessageEnd => f.write_str("message-end"),
3100 Self::StreamEnd => f.write_str("stream-end"),
3101 }
3102 }
3103}
3104impl ::std::str::FromStr for SsEventEvent {
3105 type Err = self::error::ConversionError;
3106 fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
3107 match value {
3108 "message-start" => Ok(Self::MessageStart),
3109 "stream-start" => Ok(Self::StreamStart),
3110 "content-start" => Ok(Self::ContentStart),
3111 "content-delta" => Ok(Self::ContentDelta),
3112 "content-end" => Ok(Self::ContentEnd),
3113 "message-end" => Ok(Self::MessageEnd),
3114 "stream-end" => Ok(Self::StreamEnd),
3115 _ => Err("invalid value".into()),
3116 }
3117 }
3118}
3119impl ::std::convert::TryFrom<&str> for SsEventEvent {
3120 type Error = self::error::ConversionError;
3121 fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
3122 value.parse()
3123 }
3124}
3125impl ::std::convert::TryFrom<&::std::string::String> for SsEventEvent {
3126 type Error = self::error::ConversionError;
3127 fn try_from(
3128 value: &::std::string::String,
3129 ) -> ::std::result::Result<Self, self::error::ConversionError> {
3130 value.parse()
3131 }
3132}
3133impl ::std::convert::TryFrom<::std::string::String> for SsEventEvent {
3134 type Error = self::error::ConversionError;
3135 fn try_from(
3136 value: ::std::string::String,
3137 ) -> ::std::result::Result<Self, self::error::ConversionError> {
3138 value.parse()
3139 }
3140}
3141///Text content part
3142///
3143/// <details><summary>JSON schema</summary>
3144///
3145/// ```json
3146///{
3147/// "description": "Text content part",
3148/// "type": "object",
3149/// "required": [
3150/// "text",
3151/// "type"
3152/// ],
3153/// "properties": {
3154/// "text": {
3155/// "description": "The text content",
3156/// "type": "string"
3157/// },
3158/// "type": {
3159/// "description": "Content type identifier",
3160/// "type": "string",
3161/// "enum": [
3162/// "text"
3163/// ]
3164/// }
3165/// }
3166///}
3167/// ```
3168/// </details>
3169#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
3170pub struct TextContentPart {
3171 ///The text content
3172 pub text: ::std::string::String,
3173 ///Content type identifier
3174 #[serde(rename = "type")]
3175 pub type_: TextContentPartType,
3176}
3177///Content type identifier
3178///
3179/// <details><summary>JSON schema</summary>
3180///
3181/// ```json
3182///{
3183/// "description": "Content type identifier",
3184/// "type": "string",
3185/// "enum": [
3186/// "text"
3187/// ]
3188///}
3189/// ```
3190/// </details>
3191#[derive(
3192 ::serde::Deserialize,
3193 ::serde::Serialize,
3194 Clone,
3195 Copy,
3196 Debug,
3197 Eq,
3198 Hash,
3199 Ord,
3200 PartialEq,
3201 PartialOrd,
3202)]
3203pub enum TextContentPartType {
3204 #[serde(rename = "text")]
3205 Text,
3206}
3207impl ::std::fmt::Display for TextContentPartType {
3208 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
3209 match *self {
3210 Self::Text => f.write_str("text"),
3211 }
3212 }
3213}
3214impl ::std::str::FromStr for TextContentPartType {
3215 type Err = self::error::ConversionError;
3216 fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
3217 match value {
3218 "text" => Ok(Self::Text),
3219 _ => Err("invalid value".into()),
3220 }
3221 }
3222}
3223impl ::std::convert::TryFrom<&str> for TextContentPartType {
3224 type Error = self::error::ConversionError;
3225 fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
3226 value.parse()
3227 }
3228}
3229impl ::std::convert::TryFrom<&::std::string::String> for TextContentPartType {
3230 type Error = self::error::ConversionError;
3231 fn try_from(
3232 value: &::std::string::String,
3233 ) -> ::std::result::Result<Self, self::error::ConversionError> {
3234 value.parse()
3235 }
3236}
3237impl ::std::convert::TryFrom<::std::string::String> for TextContentPartType {
3238 type Error = self::error::ConversionError;
3239 fn try_from(
3240 value: ::std::string::String,
3241 ) -> ::std::result::Result<Self, self::error::ConversionError> {
3242 value.parse()
3243 }
3244}
3245/**Provider-specific opaque data attached to a tool call. The contents are
3246not interpreted by the gateway, but must be echoed back verbatim on the
3247next request that references this tool call. Currently used by Google
3248Gemini extended-thinking models to carry the per-call `thought_signature`.
3249Other providers may ignore the field.
3250*/
3251///
3252/// <details><summary>JSON schema</summary>
3253///
3254/// ```json
3255///{
3256/// "description": "Provider-specific opaque data attached to a tool call. The contents are\nnot interpreted by the gateway, but must be echoed back verbatim on the\nnext request that references this tool call. Currently used by Google\nGemini extended-thinking models to carry the per-call `thought_signature`.\nOther providers may ignore the field.\n",
3257/// "type": "object",
3258/// "properties": {
3259/// "google": {
3260/// "description": "Google Gemini-specific extra content.",
3261/// "type": "object",
3262/// "properties": {
3263/// "thought_signature": {
3264/// "description": "Opaque signature returned with reasoning-enabled tool calls.\nMust be echoed back verbatim in the next request that includes\nthis tool call, or Google will reject the request.\n",
3265/// "type": "string"
3266/// }
3267/// },
3268/// "additionalProperties": true
3269/// }
3270/// }
3271///}
3272/// ```
3273/// </details>
3274#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
3275pub struct ToolCallExtraContent {
3276 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
3277 pub google: ::std::option::Option<ToolCallExtraContentGoogle>,
3278}
3279impl ::std::default::Default for ToolCallExtraContent {
3280 fn default() -> Self {
3281 Self {
3282 google: Default::default(),
3283 }
3284 }
3285}
3286///Google Gemini-specific extra content.
3287///
3288/// <details><summary>JSON schema</summary>
3289///
3290/// ```json
3291///{
3292/// "description": "Google Gemini-specific extra content.",
3293/// "type": "object",
3294/// "properties": {
3295/// "thought_signature": {
3296/// "description": "Opaque signature returned with reasoning-enabled tool calls.\nMust be echoed back verbatim in the next request that includes\nthis tool call, or Google will reject the request.\n",
3297/// "type": "string"
3298/// }
3299/// },
3300/// "additionalProperties": true
3301///}
3302/// ```
3303/// </details>
3304#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
3305pub struct ToolCallExtraContentGoogle {
3306 /**Opaque signature returned with reasoning-enabled tool calls.
3307 Must be echoed back verbatim in the next request that includes
3308 this tool call, or Google will reject the request.
3309 */
3310 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
3311 pub thought_signature: ::std::option::Option<::std::string::String>,
3312}
3313impl ::std::default::Default for ToolCallExtraContentGoogle {
3314 fn default() -> Self {
3315 Self {
3316 thought_signature: Default::default(),
3317 }
3318 }
3319}
3320/// Generation of default values for serde.
3321pub mod defaults {
3322 pub(super) fn default_bool<const V: bool>() -> bool {
3323 V
3324 }
3325 pub(super) fn default_i64<T, const V: i64>() -> T
3326 where
3327 T: ::std::convert::TryFrom<i64>,
3328 <T as ::std::convert::TryFrom<i64>>::Error: ::std::fmt::Debug,
3329 {
3330 T::try_from(V).unwrap()
3331 }
3332 pub(super) fn default_nzu64<T, const V: u64>() -> T
3333 where
3334 T: ::std::convert::TryFrom<::std::num::NonZeroU64>,
3335 <T as ::std::convert::TryFrom<::std::num::NonZeroU64>>::Error: ::std::fmt::Debug,
3336 {
3337 T::try_from(::std::num::NonZeroU64::try_from(V).unwrap()).unwrap()
3338 }
3339 pub(super) fn create_chat_completion_request_frequency_penalty() -> f64 {
3340 0_f64
3341 }
3342 pub(super) fn create_chat_completion_request_presence_penalty() -> f64 {
3343 0_f64
3344 }
3345 pub(super) fn create_chat_completion_request_temperature() -> f64 {
3346 1_f64
3347 }
3348 pub(super) fn create_chat_completion_request_top_p() -> f64 {
3349 1_f64
3350 }
3351 pub(super) fn image_url_detail() -> super::ImageUrlDetail {
3352 super::ImageUrlDetail::Auto
3353 }
3354}