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///`ChatCompletionStreamChoice`
260///
261/// <details><summary>JSON schema</summary>
262///
263/// ```json
264///{
265/// "type": "object",
266/// "required": [
267/// "delta",
268/// "index"
269/// ],
270/// "properties": {
271/// "delta": {
272/// "$ref": "#/definitions/ChatCompletionStreamResponseDelta"
273/// },
274/// "finish_reason": {
275/// "$ref": "#/definitions/FinishReason"
276/// },
277/// "index": {
278/// "description": "The index of the choice in the list of choices.",
279/// "type": "integer"
280/// },
281/// "logprobs": {
282/// "description": "Log probability information for the choice.",
283/// "type": "object",
284/// "required": [
285/// "content",
286/// "refusal"
287/// ],
288/// "properties": {
289/// "content": {
290/// "description": "A list of message content tokens with log probability information.",
291/// "type": "array",
292/// "items": {
293/// "$ref": "#/definitions/ChatCompletionTokenLogprob"
294/// }
295/// },
296/// "refusal": {
297/// "description": "A list of message refusal tokens with log probability information.",
298/// "type": "array",
299/// "items": {
300/// "$ref": "#/definitions/ChatCompletionTokenLogprob"
301/// }
302/// }
303/// }
304/// }
305/// }
306///}
307/// ```
308/// </details>
309#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
310pub struct ChatCompletionStreamChoice {
311 pub delta: ChatCompletionStreamResponseDelta,
312 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
313 pub finish_reason: ::std::option::Option<FinishReason>,
314 ///The index of the choice in the list of choices.
315 pub index: i64,
316 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
317 pub logprobs: ::std::option::Option<ChatCompletionStreamChoiceLogprobs>,
318}
319///Log probability information for the choice.
320///
321/// <details><summary>JSON schema</summary>
322///
323/// ```json
324///{
325/// "description": "Log probability information for the choice.",
326/// "type": "object",
327/// "required": [
328/// "content",
329/// "refusal"
330/// ],
331/// "properties": {
332/// "content": {
333/// "description": "A list of message content tokens with log probability information.",
334/// "type": "array",
335/// "items": {
336/// "$ref": "#/definitions/ChatCompletionTokenLogprob"
337/// }
338/// },
339/// "refusal": {
340/// "description": "A list of message refusal tokens with log probability information.",
341/// "type": "array",
342/// "items": {
343/// "$ref": "#/definitions/ChatCompletionTokenLogprob"
344/// }
345/// }
346/// }
347///}
348/// ```
349/// </details>
350#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
351pub struct ChatCompletionStreamChoiceLogprobs {
352 ///A list of message content tokens with log probability information.
353 pub content: ::std::vec::Vec<ChatCompletionTokenLogprob>,
354 ///A list of message refusal tokens with log probability information.
355 pub refusal: ::std::vec::Vec<ChatCompletionTokenLogprob>,
356}
357/**Options for streaming response. Only set this when you set `stream: true`.
358*/
359///
360/// <details><summary>JSON schema</summary>
361///
362/// ```json
363///{
364/// "description": "Options for streaming response. Only set this when you set `stream: true`.\n",
365/// "type": "object",
366/// "required": [
367/// "include_usage"
368/// ],
369/// "properties": {
370/// "include_usage": {
371/// "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",
372/// "type": "boolean"
373/// }
374/// }
375///}
376/// ```
377/// </details>
378#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
379pub struct ChatCompletionStreamOptions {
380 /**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.
381 */
382 pub include_usage: bool,
383}
384///A chat completion delta generated by streamed model responses.
385///
386/// <details><summary>JSON schema</summary>
387///
388/// ```json
389///{
390/// "description": "A chat completion delta generated by streamed model responses.",
391/// "type": "object",
392/// "properties": {
393/// "content": {
394/// "description": "The contents of the chunk message.",
395/// "type": "string"
396/// },
397/// "reasoning": {
398/// "description": "The reasoning of the chunk message. Same as reasoning_content.",
399/// "type": "string"
400/// },
401/// "reasoning_content": {
402/// "description": "The reasoning content of the chunk message.",
403/// "type": "string"
404/// },
405/// "refusal": {
406/// "description": "The refusal message generated by the model.",
407/// "type": "string"
408/// },
409/// "role": {
410/// "$ref": "#/definitions/MessageRole"
411/// },
412/// "tool_calls": {
413/// "type": "array",
414/// "items": {
415/// "$ref": "#/definitions/ChatCompletionMessageToolCallChunk"
416/// }
417/// }
418/// }
419///}
420/// ```
421/// </details>
422#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
423pub struct ChatCompletionStreamResponseDelta {
424 ///The contents of the chunk message.
425 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
426 pub content: ::std::option::Option<::std::string::String>,
427 ///The reasoning of the chunk message. Same as reasoning_content.
428 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
429 pub reasoning: ::std::option::Option<::std::string::String>,
430 ///The reasoning content of the chunk message.
431 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
432 pub reasoning_content: ::std::option::Option<::std::string::String>,
433 ///The refusal message generated by the model.
434 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
435 pub refusal: ::std::option::Option<::std::string::String>,
436 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
437 pub role: ::std::option::Option<MessageRole>,
438 #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
439 pub tool_calls: ::std::vec::Vec<ChatCompletionMessageToolCallChunk>,
440}
441impl ::std::default::Default for ChatCompletionStreamResponseDelta {
442 fn default() -> Self {
443 Self {
444 content: Default::default(),
445 reasoning: Default::default(),
446 reasoning_content: Default::default(),
447 refusal: Default::default(),
448 role: Default::default(),
449 tool_calls: Default::default(),
450 }
451 }
452}
453///`ChatCompletionTokenLogprob`
454///
455/// <details><summary>JSON schema</summary>
456///
457/// ```json
458///{
459/// "type": "object",
460/// "required": [
461/// "bytes",
462/// "logprob",
463/// "token",
464/// "top_logprobs"
465/// ],
466/// "properties": {
467/// "bytes": {
468/// "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.",
469/// "type": "array",
470/// "items": {
471/// "type": "integer"
472/// }
473/// },
474/// "logprob": {
475/// "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.",
476/// "type": "number"
477/// },
478/// "token": {
479/// "description": "The token.",
480/// "type": "string"
481/// },
482/// "top_logprobs": {
483/// "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.",
484/// "type": "array",
485/// "items": {
486/// "type": "object",
487/// "required": [
488/// "bytes",
489/// "logprob",
490/// "token"
491/// ],
492/// "properties": {
493/// "bytes": {
494/// "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.",
495/// "type": "array",
496/// "items": {
497/// "type": "integer"
498/// }
499/// },
500/// "logprob": {
501/// "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.",
502/// "type": "number"
503/// },
504/// "token": {
505/// "description": "The token.",
506/// "type": "string"
507/// }
508/// }
509/// }
510/// }
511/// }
512///}
513/// ```
514/// </details>
515#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
516pub struct ChatCompletionTokenLogprob {
517 ///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.
518 pub bytes: ::std::vec::Vec<i64>,
519 ///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.
520 pub logprob: f64,
521 ///The token.
522 pub token: ::std::string::String,
523 ///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.
524 pub top_logprobs: ::std::vec::Vec<ChatCompletionTokenLogprobTopLogprobsItem>,
525}
526///`ChatCompletionTokenLogprobTopLogprobsItem`
527///
528/// <details><summary>JSON schema</summary>
529///
530/// ```json
531///{
532/// "type": "object",
533/// "required": [
534/// "bytes",
535/// "logprob",
536/// "token"
537/// ],
538/// "properties": {
539/// "bytes": {
540/// "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.",
541/// "type": "array",
542/// "items": {
543/// "type": "integer"
544/// }
545/// },
546/// "logprob": {
547/// "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.",
548/// "type": "number"
549/// },
550/// "token": {
551/// "description": "The token.",
552/// "type": "string"
553/// }
554/// }
555///}
556/// ```
557/// </details>
558#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
559pub struct ChatCompletionTokenLogprobTopLogprobsItem {
560 ///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.
561 pub bytes: ::std::vec::Vec<i64>,
562 ///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.
563 pub logprob: f64,
564 ///The token.
565 pub token: ::std::string::String,
566}
567///`ChatCompletionTool`
568///
569/// <details><summary>JSON schema</summary>
570///
571/// ```json
572///{
573/// "type": "object",
574/// "required": [
575/// "function",
576/// "type"
577/// ],
578/// "properties": {
579/// "function": {
580/// "$ref": "#/definitions/FunctionObject"
581/// },
582/// "type": {
583/// "$ref": "#/definitions/ChatCompletionToolType"
584/// }
585/// }
586///}
587/// ```
588/// </details>
589#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
590pub struct ChatCompletionTool {
591 pub function: FunctionObject,
592 #[serde(rename = "type")]
593 pub type_: ChatCompletionToolType,
594}
595///The type of the tool. Currently, only `function` is supported.
596///
597/// <details><summary>JSON schema</summary>
598///
599/// ```json
600///{
601/// "description": "The type of the tool. Currently, only `function` is supported.",
602/// "type": "string",
603/// "enum": [
604/// "function"
605/// ]
606///}
607/// ```
608/// </details>
609#[derive(
610 ::serde::Deserialize,
611 ::serde::Serialize,
612 Clone,
613 Copy,
614 Debug,
615 Eq,
616 Hash,
617 Ord,
618 PartialEq,
619 PartialOrd,
620)]
621pub enum ChatCompletionToolType {
622 #[serde(rename = "function")]
623 Function,
624}
625impl ::std::fmt::Display for ChatCompletionToolType {
626 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
627 match *self {
628 Self::Function => f.write_str("function"),
629 }
630 }
631}
632impl ::std::str::FromStr for ChatCompletionToolType {
633 type Err = self::error::ConversionError;
634 fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
635 match value {
636 "function" => Ok(Self::Function),
637 _ => Err("invalid value".into()),
638 }
639 }
640}
641impl ::std::convert::TryFrom<&str> for ChatCompletionToolType {
642 type Error = self::error::ConversionError;
643 fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
644 value.parse()
645 }
646}
647impl ::std::convert::TryFrom<&::std::string::String> for ChatCompletionToolType {
648 type Error = self::error::ConversionError;
649 fn try_from(
650 value: &::std::string::String,
651 ) -> ::std::result::Result<Self, self::error::ConversionError> {
652 value.parse()
653 }
654}
655impl ::std::convert::TryFrom<::std::string::String> for ChatCompletionToolType {
656 type Error = self::error::ConversionError;
657 fn try_from(
658 value: ::std::string::String,
659 ) -> ::std::result::Result<Self, self::error::ConversionError> {
660 value.parse()
661 }
662}
663///Usage statistics for the completion request.
664///
665/// <details><summary>JSON schema</summary>
666///
667/// ```json
668///{
669/// "description": "Usage statistics for the completion request.",
670/// "type": "object",
671/// "required": [
672/// "completion_tokens",
673/// "prompt_tokens",
674/// "total_tokens"
675/// ],
676/// "properties": {
677/// "completion_tokens": {
678/// "description": "Number of tokens in the generated completion.",
679/// "default": 0,
680/// "type": "integer",
681/// "format": "int64"
682/// },
683/// "prompt_tokens": {
684/// "description": "Number of tokens in the prompt.",
685/// "default": 0,
686/// "type": "integer",
687/// "format": "int64"
688/// },
689/// "total_tokens": {
690/// "description": "Total number of tokens used in the request (prompt + completion).",
691/// "default": 0,
692/// "type": "integer",
693/// "format": "int64"
694/// }
695/// }
696///}
697/// ```
698/// </details>
699#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
700pub struct CompletionUsage {
701 ///Number of tokens in the generated completion.
702 pub completion_tokens: i64,
703 ///Number of tokens in the prompt.
704 pub prompt_tokens: i64,
705 ///Total number of tokens used in the request (prompt + completion).
706 pub total_tokens: i64,
707}
708///`Config`
709///
710/// <details><summary>JSON schema</summary>
711///
712/// ```json
713///{}
714/// ```
715/// </details>
716#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
717#[serde(transparent)]
718pub struct Config(pub ::serde_json::Value);
719impl ::std::ops::Deref for Config {
720 type Target = ::serde_json::Value;
721 fn deref(&self) -> &::serde_json::Value {
722 &self.0
723 }
724}
725impl ::std::convert::From<Config> for ::serde_json::Value {
726 fn from(value: Config) -> Self {
727 value.0
728 }
729}
730impl ::std::convert::From<::serde_json::Value> for Config {
731 fn from(value: ::serde_json::Value) -> Self {
732 Self(value)
733 }
734}
735///A content part within a multimodal message
736///
737/// <details><summary>JSON schema</summary>
738///
739/// ```json
740///{
741/// "description": "A content part within a multimodal message",
742/// "type": "object",
743/// "oneOf": [
744/// {
745/// "$ref": "#/definitions/TextContentPart"
746/// },
747/// {
748/// "$ref": "#/definitions/ImageContentPart"
749/// }
750/// ]
751///}
752/// ```
753/// </details>
754#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
755#[serde(untagged)]
756pub enum ContentPart {
757 TextContentPart(TextContentPart),
758 ImageContentPart(ImageContentPart),
759}
760impl ::std::convert::From<TextContentPart> for ContentPart {
761 fn from(value: TextContentPart) -> Self {
762 Self::TextContentPart(value)
763 }
764}
765impl ::std::convert::From<ImageContentPart> for ContentPart {
766 fn from(value: ImageContentPart) -> Self {
767 Self::ImageContentPart(value)
768 }
769}
770///`CreateChatCompletionRequest`
771///
772/// <details><summary>JSON schema</summary>
773///
774/// ```json
775///{
776/// "type": "object",
777/// "required": [
778/// "messages",
779/// "model"
780/// ],
781/// "properties": {
782/// "max_tokens": {
783/// "description": "An upper bound for the number of tokens that can be generated for a completion, including visible output tokens and reasoning tokens.\n",
784/// "type": "integer"
785/// },
786/// "messages": {
787/// "description": "A list of messages comprising the conversation so far.\n",
788/// "type": "array",
789/// "items": {
790/// "$ref": "#/definitions/Message"
791/// },
792/// "minItems": 1
793/// },
794/// "model": {
795/// "description": "Model ID to use",
796/// "type": "string"
797/// },
798/// "reasoning_format": {
799/// "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",
800/// "type": "string"
801/// },
802/// "stream": {
803/// "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",
804/// "default": false,
805/// "type": "boolean"
806/// },
807/// "stream_options": {
808/// "$ref": "#/definitions/ChatCompletionStreamOptions"
809/// },
810/// "tools": {
811/// "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",
812/// "type": "array",
813/// "items": {
814/// "$ref": "#/definitions/ChatCompletionTool"
815/// }
816/// }
817/// }
818///}
819/// ```
820/// </details>
821#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
822pub struct CreateChatCompletionRequest {
823 /**An upper bound for the number of tokens that can be generated for a completion, including visible output tokens and reasoning tokens.
824 */
825 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
826 pub max_tokens: ::std::option::Option<i64>,
827 /**A list of messages comprising the conversation so far.
828 */
829 pub messages: ::std::vec::Vec<Message>,
830 ///Model ID to use
831 pub model: ::std::string::String,
832 /**The format of the reasoning content. Can be `raw` or `parsed`.
833 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.
834 */
835 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
836 pub reasoning_format: ::std::option::Option<::std::string::String>,
837 /**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).
838 */
839 #[serde(default)]
840 pub stream: bool,
841 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
842 pub stream_options: ::std::option::Option<ChatCompletionStreamOptions>,
843 /**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.
844 */
845 #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
846 pub tools: ::std::vec::Vec<ChatCompletionTool>,
847}
848///Represents a chat completion response returned by model, based on the provided input.
849///
850/// <details><summary>JSON schema</summary>
851///
852/// ```json
853///{
854/// "description": "Represents a chat completion response returned by model, based on the provided input.",
855/// "type": "object",
856/// "required": [
857/// "choices",
858/// "created",
859/// "id",
860/// "model",
861/// "object"
862/// ],
863/// "properties": {
864/// "choices": {
865/// "description": "A list of chat completion choices. Can be more than one if `n` is greater than 1.",
866/// "type": "array",
867/// "items": {
868/// "$ref": "#/definitions/ChatCompletionChoice"
869/// }
870/// },
871/// "created": {
872/// "description": "The Unix timestamp (in seconds) of when the chat completion was created.",
873/// "type": "integer"
874/// },
875/// "id": {
876/// "description": "A unique identifier for the chat completion.",
877/// "type": "string"
878/// },
879/// "model": {
880/// "description": "The model used for the chat completion.",
881/// "type": "string"
882/// },
883/// "object": {
884/// "description": "The object type, which is always `chat.completion`.",
885/// "type": "string"
886/// },
887/// "usage": {
888/// "$ref": "#/definitions/CompletionUsage"
889/// }
890/// }
891///}
892/// ```
893/// </details>
894#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
895pub struct CreateChatCompletionResponse {
896 ///A list of chat completion choices. Can be more than one if `n` is greater than 1.
897 pub choices: ::std::vec::Vec<ChatCompletionChoice>,
898 ///The Unix timestamp (in seconds) of when the chat completion was created.
899 pub created: i64,
900 ///A unique identifier for the chat completion.
901 pub id: ::std::string::String,
902 ///The model used for the chat completion.
903 pub model: ::std::string::String,
904 ///The object type, which is always `chat.completion`.
905 pub object: ::std::string::String,
906 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
907 pub usage: ::std::option::Option<CompletionUsage>,
908}
909/**Represents a streamed chunk of a chat completion response returned
910by the model, based on the provided input.
911*/
912///
913/// <details><summary>JSON schema</summary>
914///
915/// ```json
916///{
917/// "description": "Represents a streamed chunk of a chat completion response returned\nby the model, based on the provided input.\n",
918/// "type": "object",
919/// "required": [
920/// "choices",
921/// "created",
922/// "id",
923/// "model",
924/// "object"
925/// ],
926/// "properties": {
927/// "choices": {
928/// "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",
929/// "type": "array",
930/// "items": {
931/// "$ref": "#/definitions/ChatCompletionStreamChoice"
932/// }
933/// },
934/// "created": {
935/// "description": "The Unix timestamp (in seconds) of when the chat completion was created. Each chunk has the same timestamp.",
936/// "type": "integer"
937/// },
938/// "id": {
939/// "description": "A unique identifier for the chat completion. Each chunk has the same ID.",
940/// "type": "string"
941/// },
942/// "model": {
943/// "description": "The model to generate the completion.",
944/// "type": "string"
945/// },
946/// "object": {
947/// "description": "The object type, which is always `chat.completion.chunk`.",
948/// "type": "string"
949/// },
950/// "reasoning_format": {
951/// "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",
952/// "type": "string"
953/// },
954/// "system_fingerprint": {
955/// "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",
956/// "type": "string"
957/// },
958/// "usage": {
959/// "$ref": "#/definitions/CompletionUsage"
960/// }
961/// }
962///}
963/// ```
964/// </details>
965#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
966pub struct CreateChatCompletionStreamResponse {
967 /**A list of chat completion choices. Can contain more than one elements if `n` is greater than 1. Can also be empty for the
968 last chunk if you set `stream_options: {"include_usage": true}`.
969 */
970 pub choices: ::std::vec::Vec<ChatCompletionStreamChoice>,
971 ///The Unix timestamp (in seconds) of when the chat completion was created. Each chunk has the same timestamp.
972 pub created: i64,
973 ///A unique identifier for the chat completion. Each chunk has the same ID.
974 pub id: ::std::string::String,
975 ///The model to generate the completion.
976 pub model: ::std::string::String,
977 ///The object type, which is always `chat.completion.chunk`.
978 pub object: ::std::string::String,
979 /**The format of the reasoning content. Can be `raw` or `parsed`.
980 When specified as raw some reasoning models will output <think /> tags. When specified as parsed the model will output the reasoning under reasoning_content.
981 */
982 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
983 pub reasoning_format: ::std::option::Option<::std::string::String>,
984 /**This fingerprint represents the backend configuration that the model runs with.
985 Can be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism.
986 */
987 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
988 pub system_fingerprint: ::std::option::Option<::std::string::String>,
989 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
990 pub usage: ::std::option::Option<CompletionUsage>,
991}
992///`Endpoints`
993///
994/// <details><summary>JSON schema</summary>
995///
996/// ```json
997///{
998/// "type": "object",
999/// "required": [
1000/// "chat",
1001/// "models"
1002/// ],
1003/// "properties": {
1004/// "chat": {
1005/// "type": "string"
1006/// },
1007/// "models": {
1008/// "type": "string"
1009/// }
1010/// }
1011///}
1012/// ```
1013/// </details>
1014#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
1015pub struct Endpoints {
1016 pub chat: ::std::string::String,
1017 pub models: ::std::string::String,
1018}
1019///`Error`
1020///
1021/// <details><summary>JSON schema</summary>
1022///
1023/// ```json
1024///{
1025/// "type": "object",
1026/// "properties": {
1027/// "error": {
1028/// "type": "string"
1029/// }
1030/// }
1031///}
1032/// ```
1033/// </details>
1034#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
1035pub struct Error {
1036 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1037 pub error: ::std::option::Option<::std::string::String>,
1038}
1039impl ::std::default::Default for Error {
1040 fn default() -> Self {
1041 Self {
1042 error: Default::default(),
1043 }
1044 }
1045}
1046/**The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence,
1047`length` if the maximum number of tokens specified in the request was reached,
1048`content_filter` if content was omitted due to a flag from our content filters,
1049`tool_calls` if the model called a tool.
1050*/
1051///
1052/// <details><summary>JSON schema</summary>
1053///
1054/// ```json
1055///{
1056/// "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",
1057/// "type": "string",
1058/// "enum": [
1059/// "stop",
1060/// "length",
1061/// "tool_calls",
1062/// "content_filter",
1063/// "function_call"
1064/// ]
1065///}
1066/// ```
1067/// </details>
1068#[derive(
1069 ::serde::Deserialize,
1070 ::serde::Serialize,
1071 Clone,
1072 Copy,
1073 Debug,
1074 Eq,
1075 Hash,
1076 Ord,
1077 PartialEq,
1078 PartialOrd,
1079)]
1080pub enum FinishReason {
1081 #[serde(rename = "stop")]
1082 Stop,
1083 #[serde(rename = "length")]
1084 Length,
1085 #[serde(rename = "tool_calls")]
1086 ToolCalls,
1087 #[serde(rename = "content_filter")]
1088 ContentFilter,
1089 #[serde(rename = "function_call")]
1090 FunctionCall,
1091}
1092impl ::std::fmt::Display for FinishReason {
1093 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
1094 match *self {
1095 Self::Stop => f.write_str("stop"),
1096 Self::Length => f.write_str("length"),
1097 Self::ToolCalls => f.write_str("tool_calls"),
1098 Self::ContentFilter => f.write_str("content_filter"),
1099 Self::FunctionCall => f.write_str("function_call"),
1100 }
1101 }
1102}
1103impl ::std::str::FromStr for FinishReason {
1104 type Err = self::error::ConversionError;
1105 fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
1106 match value {
1107 "stop" => Ok(Self::Stop),
1108 "length" => Ok(Self::Length),
1109 "tool_calls" => Ok(Self::ToolCalls),
1110 "content_filter" => Ok(Self::ContentFilter),
1111 "function_call" => Ok(Self::FunctionCall),
1112 _ => Err("invalid value".into()),
1113 }
1114 }
1115}
1116impl ::std::convert::TryFrom<&str> for FinishReason {
1117 type Error = self::error::ConversionError;
1118 fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
1119 value.parse()
1120 }
1121}
1122impl ::std::convert::TryFrom<&::std::string::String> for FinishReason {
1123 type Error = self::error::ConversionError;
1124 fn try_from(
1125 value: &::std::string::String,
1126 ) -> ::std::result::Result<Self, self::error::ConversionError> {
1127 value.parse()
1128 }
1129}
1130impl ::std::convert::TryFrom<::std::string::String> for FinishReason {
1131 type Error = self::error::ConversionError;
1132 fn try_from(
1133 value: ::std::string::String,
1134 ) -> ::std::result::Result<Self, self::error::ConversionError> {
1135 value.parse()
1136 }
1137}
1138///`FunctionObject`
1139///
1140/// <details><summary>JSON schema</summary>
1141///
1142/// ```json
1143///{
1144/// "type": "object",
1145/// "required": [
1146/// "name"
1147/// ],
1148/// "properties": {
1149/// "description": {
1150/// "description": "A description of what the function does, used by the model to choose when and how to call the function.",
1151/// "type": "string"
1152/// },
1153/// "name": {
1154/// "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.",
1155/// "type": "string"
1156/// },
1157/// "parameters": {
1158/// "$ref": "#/definitions/FunctionParameters"
1159/// },
1160/// "strict": {
1161/// "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).",
1162/// "default": false,
1163/// "type": "boolean"
1164/// }
1165/// }
1166///}
1167/// ```
1168/// </details>
1169#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
1170pub struct FunctionObject {
1171 ///A description of what the function does, used by the model to choose when and how to call the function.
1172 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1173 pub description: ::std::option::Option<::std::string::String>,
1174 ///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.
1175 pub name: ::std::string::String,
1176 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1177 pub parameters: ::std::option::Option<FunctionParameters>,
1178 ///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).
1179 #[serde(default)]
1180 pub strict: bool,
1181}
1182/**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.
1183Omitting `parameters` defines a function with an empty parameter list.*/
1184///
1185/// <details><summary>JSON schema</summary>
1186///
1187/// ```json
1188///{
1189/// "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.",
1190/// "type": "object",
1191/// "additionalProperties": true
1192///}
1193/// ```
1194/// </details>
1195#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
1196#[serde(transparent)]
1197pub struct FunctionParameters(pub ::serde_json::Map<::std::string::String, ::serde_json::Value>);
1198impl ::std::ops::Deref for FunctionParameters {
1199 type Target = ::serde_json::Map<::std::string::String, ::serde_json::Value>;
1200 fn deref(&self) -> &::serde_json::Map<::std::string::String, ::serde_json::Value> {
1201 &self.0
1202 }
1203}
1204impl ::std::convert::From<FunctionParameters>
1205 for ::serde_json::Map<::std::string::String, ::serde_json::Value>
1206{
1207 fn from(value: FunctionParameters) -> Self {
1208 value.0
1209 }
1210}
1211impl ::std::convert::From<::serde_json::Map<::std::string::String, ::serde_json::Value>>
1212 for FunctionParameters
1213{
1214 fn from(value: ::serde_json::Map<::std::string::String, ::serde_json::Value>) -> Self {
1215 Self(value)
1216 }
1217}
1218///Image content part
1219///
1220/// <details><summary>JSON schema</summary>
1221///
1222/// ```json
1223///{
1224/// "description": "Image content part",
1225/// "type": "object",
1226/// "required": [
1227/// "image_url",
1228/// "type"
1229/// ],
1230/// "properties": {
1231/// "image_url": {
1232/// "$ref": "#/definitions/ImageURL"
1233/// },
1234/// "type": {
1235/// "description": "Content type identifier",
1236/// "type": "string",
1237/// "enum": [
1238/// "image_url"
1239/// ]
1240/// }
1241/// }
1242///}
1243/// ```
1244/// </details>
1245#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
1246pub struct ImageContentPart {
1247 pub image_url: ImageUrl,
1248 ///Content type identifier
1249 #[serde(rename = "type")]
1250 pub type_: ImageContentPartType,
1251}
1252///Content type identifier
1253///
1254/// <details><summary>JSON schema</summary>
1255///
1256/// ```json
1257///{
1258/// "description": "Content type identifier",
1259/// "type": "string",
1260/// "enum": [
1261/// "image_url"
1262/// ]
1263///}
1264/// ```
1265/// </details>
1266#[derive(
1267 ::serde::Deserialize,
1268 ::serde::Serialize,
1269 Clone,
1270 Copy,
1271 Debug,
1272 Eq,
1273 Hash,
1274 Ord,
1275 PartialEq,
1276 PartialOrd,
1277)]
1278pub enum ImageContentPartType {
1279 #[serde(rename = "image_url")]
1280 ImageUrl,
1281}
1282impl ::std::fmt::Display for ImageContentPartType {
1283 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
1284 match *self {
1285 Self::ImageUrl => f.write_str("image_url"),
1286 }
1287 }
1288}
1289impl ::std::str::FromStr for ImageContentPartType {
1290 type Err = self::error::ConversionError;
1291 fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
1292 match value {
1293 "image_url" => Ok(Self::ImageUrl),
1294 _ => Err("invalid value".into()),
1295 }
1296 }
1297}
1298impl ::std::convert::TryFrom<&str> for ImageContentPartType {
1299 type Error = self::error::ConversionError;
1300 fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
1301 value.parse()
1302 }
1303}
1304impl ::std::convert::TryFrom<&::std::string::String> for ImageContentPartType {
1305 type Error = self::error::ConversionError;
1306 fn try_from(
1307 value: &::std::string::String,
1308 ) -> ::std::result::Result<Self, self::error::ConversionError> {
1309 value.parse()
1310 }
1311}
1312impl ::std::convert::TryFrom<::std::string::String> for ImageContentPartType {
1313 type Error = self::error::ConversionError;
1314 fn try_from(
1315 value: ::std::string::String,
1316 ) -> ::std::result::Result<Self, self::error::ConversionError> {
1317 value.parse()
1318 }
1319}
1320///Image URL configuration
1321///
1322/// <details><summary>JSON schema</summary>
1323///
1324/// ```json
1325///{
1326/// "description": "Image URL configuration",
1327/// "type": "object",
1328/// "required": [
1329/// "url"
1330/// ],
1331/// "properties": {
1332/// "detail": {
1333/// "description": "Image detail level for vision processing",
1334/// "default": "auto",
1335/// "type": "string",
1336/// "enum": [
1337/// "auto",
1338/// "low",
1339/// "high"
1340/// ]
1341/// },
1342/// "url": {
1343/// "description": "URL of the image (data URLs supported)",
1344/// "type": "string"
1345/// }
1346/// }
1347///}
1348/// ```
1349/// </details>
1350#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
1351pub struct ImageUrl {
1352 ///Image detail level for vision processing
1353 #[serde(default = "defaults::image_url_detail")]
1354 pub detail: ImageUrlDetail,
1355 ///URL of the image (data URLs supported)
1356 pub url: ::std::string::String,
1357}
1358///Image detail level for vision processing
1359///
1360/// <details><summary>JSON schema</summary>
1361///
1362/// ```json
1363///{
1364/// "description": "Image detail level for vision processing",
1365/// "default": "auto",
1366/// "type": "string",
1367/// "enum": [
1368/// "auto",
1369/// "low",
1370/// "high"
1371/// ]
1372///}
1373/// ```
1374/// </details>
1375#[derive(
1376 ::serde::Deserialize,
1377 ::serde::Serialize,
1378 Clone,
1379 Copy,
1380 Debug,
1381 Eq,
1382 Hash,
1383 Ord,
1384 PartialEq,
1385 PartialOrd,
1386)]
1387pub enum ImageUrlDetail {
1388 #[serde(rename = "auto")]
1389 Auto,
1390 #[serde(rename = "low")]
1391 Low,
1392 #[serde(rename = "high")]
1393 High,
1394}
1395impl ::std::fmt::Display for ImageUrlDetail {
1396 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
1397 match *self {
1398 Self::Auto => f.write_str("auto"),
1399 Self::Low => f.write_str("low"),
1400 Self::High => f.write_str("high"),
1401 }
1402 }
1403}
1404impl ::std::str::FromStr for ImageUrlDetail {
1405 type Err = self::error::ConversionError;
1406 fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
1407 match value {
1408 "auto" => Ok(Self::Auto),
1409 "low" => Ok(Self::Low),
1410 "high" => Ok(Self::High),
1411 _ => Err("invalid value".into()),
1412 }
1413 }
1414}
1415impl ::std::convert::TryFrom<&str> for ImageUrlDetail {
1416 type Error = self::error::ConversionError;
1417 fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
1418 value.parse()
1419 }
1420}
1421impl ::std::convert::TryFrom<&::std::string::String> for ImageUrlDetail {
1422 type Error = self::error::ConversionError;
1423 fn try_from(
1424 value: &::std::string::String,
1425 ) -> ::std::result::Result<Self, self::error::ConversionError> {
1426 value.parse()
1427 }
1428}
1429impl ::std::convert::TryFrom<::std::string::String> for ImageUrlDetail {
1430 type Error = self::error::ConversionError;
1431 fn try_from(
1432 value: ::std::string::String,
1433 ) -> ::std::result::Result<Self, self::error::ConversionError> {
1434 value.parse()
1435 }
1436}
1437impl ::std::default::Default for ImageUrlDetail {
1438 fn default() -> Self {
1439 ImageUrlDetail::Auto
1440 }
1441}
1442///Response structure for listing models
1443///
1444/// <details><summary>JSON schema</summary>
1445///
1446/// ```json
1447///{
1448/// "description": "Response structure for listing models",
1449/// "type": "object",
1450/// "required": [
1451/// "data",
1452/// "object"
1453/// ],
1454/// "properties": {
1455/// "data": {
1456/// "default": [],
1457/// "type": "array",
1458/// "items": {
1459/// "$ref": "#/definitions/Model"
1460/// }
1461/// },
1462/// "object": {
1463/// "type": "string"
1464/// },
1465/// "provider": {
1466/// "$ref": "#/definitions/Provider"
1467/// }
1468/// }
1469///}
1470/// ```
1471/// </details>
1472#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
1473pub struct ListModelsResponse {
1474 pub data: ::std::vec::Vec<Model>,
1475 pub object: ::std::string::String,
1476 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1477 pub provider: ::std::option::Option<Provider>,
1478}
1479///Response structure for listing MCP tools
1480///
1481/// <details><summary>JSON schema</summary>
1482///
1483/// ```json
1484///{
1485/// "description": "Response structure for listing MCP tools",
1486/// "type": "object",
1487/// "required": [
1488/// "data",
1489/// "object"
1490/// ],
1491/// "properties": {
1492/// "data": {
1493/// "description": "Array of available MCP tools",
1494/// "default": [],
1495/// "type": "array",
1496/// "items": {
1497/// "$ref": "#/definitions/MCPTool"
1498/// }
1499/// },
1500/// "object": {
1501/// "description": "Always \"list\"",
1502/// "type": "string"
1503/// }
1504/// }
1505///}
1506/// ```
1507/// </details>
1508#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
1509pub struct ListToolsResponse {
1510 ///Array of available MCP tools
1511 pub data: ::std::vec::Vec<McpTool>,
1512 ///Always "list"
1513 pub object: ::std::string::String,
1514}
1515///An MCP tool definition
1516///
1517/// <details><summary>JSON schema</summary>
1518///
1519/// ```json
1520///{
1521/// "description": "An MCP tool definition",
1522/// "type": "object",
1523/// "required": [
1524/// "description",
1525/// "name",
1526/// "server"
1527/// ],
1528/// "properties": {
1529/// "description": {
1530/// "description": "A description of what the tool does",
1531/// "type": "string"
1532/// },
1533/// "input_schema": {
1534/// "description": "JSON schema for the tool's input parameters",
1535/// "type": "object",
1536/// "additionalProperties": true
1537/// },
1538/// "name": {
1539/// "description": "The name of the tool",
1540/// "type": "string"
1541/// },
1542/// "server": {
1543/// "description": "The MCP server that provides this tool",
1544/// "type": "string"
1545/// }
1546/// }
1547///}
1548/// ```
1549/// </details>
1550#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
1551pub struct McpTool {
1552 ///A description of what the tool does
1553 pub description: ::std::string::String,
1554 ///JSON schema for the tool's input parameters
1555 #[serde(default, skip_serializing_if = "::serde_json::Map::is_empty")]
1556 pub input_schema: ::serde_json::Map<::std::string::String, ::serde_json::Value>,
1557 ///The name of the tool
1558 pub name: ::std::string::String,
1559 ///The MCP server that provides this tool
1560 pub server: ::std::string::String,
1561}
1562///Message structure for provider requests
1563///
1564/// <details><summary>JSON schema</summary>
1565///
1566/// ```json
1567///{
1568/// "description": "Message structure for provider requests",
1569/// "type": "object",
1570/// "required": [
1571/// "content",
1572/// "role"
1573/// ],
1574/// "properties": {
1575/// "content": {
1576/// "$ref": "#/definitions/MessageContent"
1577/// },
1578/// "reasoning": {
1579/// "description": "The reasoning of the chunk message. Same as reasoning_content.",
1580/// "type": "string"
1581/// },
1582/// "reasoning_content": {
1583/// "description": "The reasoning content of the chunk message.",
1584/// "type": "string"
1585/// },
1586/// "role": {
1587/// "$ref": "#/definitions/MessageRole"
1588/// },
1589/// "tool_call_id": {
1590/// "type": "string"
1591/// },
1592/// "tool_calls": {
1593/// "type": "array",
1594/// "items": {
1595/// "$ref": "#/definitions/ChatCompletionMessageToolCall"
1596/// }
1597/// }
1598/// }
1599///}
1600/// ```
1601/// </details>
1602#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
1603pub struct Message {
1604 pub content: MessageContent,
1605 ///The reasoning of the chunk message. Same as reasoning_content.
1606 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1607 pub reasoning: ::std::option::Option<::std::string::String>,
1608 ///The reasoning content of the chunk message.
1609 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1610 pub reasoning_content: ::std::option::Option<::std::string::String>,
1611 pub role: MessageRole,
1612 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1613 pub tool_call_id: ::std::option::Option<::std::string::String>,
1614 #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
1615 pub tool_calls: ::std::vec::Vec<ChatCompletionMessageToolCall>,
1616}
1617///Message content - either text or multimodal content parts
1618///
1619/// <details><summary>JSON schema</summary>
1620///
1621/// ```json
1622///{
1623/// "description": "Message content - either text or multimodal content parts",
1624/// "oneOf": [
1625/// {
1626/// "description": "Text content (backward compatibility)",
1627/// "type": "string"
1628/// },
1629/// {
1630/// "description": "Array of content parts for multimodal messages",
1631/// "type": "array",
1632/// "items": {
1633/// "$ref": "#/definitions/ContentPart"
1634/// }
1635/// }
1636/// ]
1637///}
1638/// ```
1639/// </details>
1640#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
1641#[serde(untagged)]
1642pub enum MessageContent {
1643 String(::std::string::String),
1644 Array(::std::vec::Vec<ContentPart>),
1645}
1646impl ::std::convert::From<::std::vec::Vec<ContentPart>> for MessageContent {
1647 fn from(value: ::std::vec::Vec<ContentPart>) -> Self {
1648 Self::Array(value)
1649 }
1650}
1651///Role of the message sender
1652///
1653/// <details><summary>JSON schema</summary>
1654///
1655/// ```json
1656///{
1657/// "description": "Role of the message sender",
1658/// "type": "string",
1659/// "enum": [
1660/// "system",
1661/// "user",
1662/// "assistant",
1663/// "tool"
1664/// ]
1665///}
1666/// ```
1667/// </details>
1668#[derive(
1669 ::serde::Deserialize,
1670 ::serde::Serialize,
1671 Clone,
1672 Copy,
1673 Debug,
1674 Eq,
1675 Hash,
1676 Ord,
1677 PartialEq,
1678 PartialOrd,
1679)]
1680pub enum MessageRole {
1681 #[serde(rename = "system")]
1682 System,
1683 #[serde(rename = "user")]
1684 User,
1685 #[serde(rename = "assistant")]
1686 Assistant,
1687 #[serde(rename = "tool")]
1688 Tool,
1689}
1690impl ::std::fmt::Display for MessageRole {
1691 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
1692 match *self {
1693 Self::System => f.write_str("system"),
1694 Self::User => f.write_str("user"),
1695 Self::Assistant => f.write_str("assistant"),
1696 Self::Tool => f.write_str("tool"),
1697 }
1698 }
1699}
1700impl ::std::str::FromStr for MessageRole {
1701 type Err = self::error::ConversionError;
1702 fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
1703 match value {
1704 "system" => Ok(Self::System),
1705 "user" => Ok(Self::User),
1706 "assistant" => Ok(Self::Assistant),
1707 "tool" => Ok(Self::Tool),
1708 _ => Err("invalid value".into()),
1709 }
1710 }
1711}
1712impl ::std::convert::TryFrom<&str> for MessageRole {
1713 type Error = self::error::ConversionError;
1714 fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
1715 value.parse()
1716 }
1717}
1718impl ::std::convert::TryFrom<&::std::string::String> for MessageRole {
1719 type Error = self::error::ConversionError;
1720 fn try_from(
1721 value: &::std::string::String,
1722 ) -> ::std::result::Result<Self, self::error::ConversionError> {
1723 value.parse()
1724 }
1725}
1726impl ::std::convert::TryFrom<::std::string::String> for MessageRole {
1727 type Error = self::error::ConversionError;
1728 fn try_from(
1729 value: ::std::string::String,
1730 ) -> ::std::result::Result<Self, self::error::ConversionError> {
1731 value.parse()
1732 }
1733}
1734///Common model information
1735///
1736/// <details><summary>JSON schema</summary>
1737///
1738/// ```json
1739///{
1740/// "description": "Common model information",
1741/// "type": "object",
1742/// "required": [
1743/// "created",
1744/// "id",
1745/// "object",
1746/// "owned_by",
1747/// "served_by"
1748/// ],
1749/// "properties": {
1750/// "created": {
1751/// "type": "integer",
1752/// "format": "int64"
1753/// },
1754/// "id": {
1755/// "type": "string"
1756/// },
1757/// "object": {
1758/// "type": "string"
1759/// },
1760/// "owned_by": {
1761/// "type": "string"
1762/// },
1763/// "served_by": {
1764/// "$ref": "#/definitions/Provider"
1765/// }
1766/// }
1767///}
1768/// ```
1769/// </details>
1770#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
1771pub struct Model {
1772 pub created: i64,
1773 pub id: ::std::string::String,
1774 pub object: ::std::string::String,
1775 pub owned_by: ::std::string::String,
1776 pub served_by: Provider,
1777}
1778///`Provider`
1779///
1780/// <details><summary>JSON schema</summary>
1781///
1782/// ```json
1783///{
1784/// "type": "string",
1785/// "enum": [
1786/// "ollama",
1787/// "ollama_cloud",
1788/// "groq",
1789/// "openai",
1790/// "cloudflare",
1791/// "cohere",
1792/// "anthropic",
1793/// "deepseek",
1794/// "google",
1795/// "mistral",
1796/// "moonshot"
1797/// ]
1798///}
1799/// ```
1800/// </details>
1801#[derive(
1802 ::serde::Deserialize,
1803 ::serde::Serialize,
1804 Clone,
1805 Copy,
1806 Debug,
1807 Eq,
1808 Hash,
1809 Ord,
1810 PartialEq,
1811 PartialOrd,
1812)]
1813pub enum Provider {
1814 #[serde(rename = "ollama")]
1815 Ollama,
1816 #[serde(rename = "ollama_cloud")]
1817 OllamaCloud,
1818 #[serde(rename = "groq")]
1819 Groq,
1820 #[serde(rename = "openai")]
1821 Openai,
1822 #[serde(rename = "cloudflare")]
1823 Cloudflare,
1824 #[serde(rename = "cohere")]
1825 Cohere,
1826 #[serde(rename = "anthropic")]
1827 Anthropic,
1828 #[serde(rename = "deepseek")]
1829 Deepseek,
1830 #[serde(rename = "google")]
1831 Google,
1832 #[serde(rename = "mistral")]
1833 Mistral,
1834 #[serde(rename = "moonshot")]
1835 Moonshot,
1836}
1837impl ::std::fmt::Display for Provider {
1838 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
1839 match *self {
1840 Self::Ollama => f.write_str("ollama"),
1841 Self::OllamaCloud => f.write_str("ollama_cloud"),
1842 Self::Groq => f.write_str("groq"),
1843 Self::Openai => f.write_str("openai"),
1844 Self::Cloudflare => f.write_str("cloudflare"),
1845 Self::Cohere => f.write_str("cohere"),
1846 Self::Anthropic => f.write_str("anthropic"),
1847 Self::Deepseek => f.write_str("deepseek"),
1848 Self::Google => f.write_str("google"),
1849 Self::Mistral => f.write_str("mistral"),
1850 Self::Moonshot => f.write_str("moonshot"),
1851 }
1852 }
1853}
1854impl ::std::str::FromStr for Provider {
1855 type Err = self::error::ConversionError;
1856 fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
1857 match value {
1858 "ollama" => Ok(Self::Ollama),
1859 "ollama_cloud" => Ok(Self::OllamaCloud),
1860 "groq" => Ok(Self::Groq),
1861 "openai" => Ok(Self::Openai),
1862 "cloudflare" => Ok(Self::Cloudflare),
1863 "cohere" => Ok(Self::Cohere),
1864 "anthropic" => Ok(Self::Anthropic),
1865 "deepseek" => Ok(Self::Deepseek),
1866 "google" => Ok(Self::Google),
1867 "mistral" => Ok(Self::Mistral),
1868 "moonshot" => Ok(Self::Moonshot),
1869 _ => Err("invalid value".into()),
1870 }
1871 }
1872}
1873impl ::std::convert::TryFrom<&str> for Provider {
1874 type Error = self::error::ConversionError;
1875 fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
1876 value.parse()
1877 }
1878}
1879impl ::std::convert::TryFrom<&::std::string::String> for Provider {
1880 type Error = self::error::ConversionError;
1881 fn try_from(
1882 value: &::std::string::String,
1883 ) -> ::std::result::Result<Self, self::error::ConversionError> {
1884 value.parse()
1885 }
1886}
1887impl ::std::convert::TryFrom<::std::string::String> for Provider {
1888 type Error = self::error::ConversionError;
1889 fn try_from(
1890 value: ::std::string::String,
1891 ) -> ::std::result::Result<Self, self::error::ConversionError> {
1892 value.parse()
1893 }
1894}
1895///Authentication type for providers
1896///
1897/// <details><summary>JSON schema</summary>
1898///
1899/// ```json
1900///{
1901/// "description": "Authentication type for providers",
1902/// "type": "string",
1903/// "enum": [
1904/// "bearer",
1905/// "xheader",
1906/// "query",
1907/// "none"
1908/// ]
1909///}
1910/// ```
1911/// </details>
1912#[derive(
1913 ::serde::Deserialize,
1914 ::serde::Serialize,
1915 Clone,
1916 Copy,
1917 Debug,
1918 Eq,
1919 Hash,
1920 Ord,
1921 PartialEq,
1922 PartialOrd,
1923)]
1924pub enum ProviderAuthType {
1925 #[serde(rename = "bearer")]
1926 Bearer,
1927 #[serde(rename = "xheader")]
1928 Xheader,
1929 #[serde(rename = "query")]
1930 Query,
1931 #[serde(rename = "none")]
1932 None,
1933}
1934impl ::std::fmt::Display for ProviderAuthType {
1935 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
1936 match *self {
1937 Self::Bearer => f.write_str("bearer"),
1938 Self::Xheader => f.write_str("xheader"),
1939 Self::Query => f.write_str("query"),
1940 Self::None => f.write_str("none"),
1941 }
1942 }
1943}
1944impl ::std::str::FromStr for ProviderAuthType {
1945 type Err = self::error::ConversionError;
1946 fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
1947 match value {
1948 "bearer" => Ok(Self::Bearer),
1949 "xheader" => Ok(Self::Xheader),
1950 "query" => Ok(Self::Query),
1951 "none" => Ok(Self::None),
1952 _ => Err("invalid value".into()),
1953 }
1954 }
1955}
1956impl ::std::convert::TryFrom<&str> for ProviderAuthType {
1957 type Error = self::error::ConversionError;
1958 fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
1959 value.parse()
1960 }
1961}
1962impl ::std::convert::TryFrom<&::std::string::String> for ProviderAuthType {
1963 type Error = self::error::ConversionError;
1964 fn try_from(
1965 value: &::std::string::String,
1966 ) -> ::std::result::Result<Self, self::error::ConversionError> {
1967 value.parse()
1968 }
1969}
1970impl ::std::convert::TryFrom<::std::string::String> for ProviderAuthType {
1971 type Error = self::error::ConversionError;
1972 fn try_from(
1973 value: ::std::string::String,
1974 ) -> ::std::result::Result<Self, self::error::ConversionError> {
1975 value.parse()
1976 }
1977}
1978/**Provider-specific response format. Examples:
1979
1980OpenAI GET /v1/models?provider=openai response:
1981```json
1982{
1983 "provider": "openai",
1984 "object": "list",
1985 "data": [
1986 {
1987 "id": "gpt-4",
1988 "object": "model",
1989 "created": 1687882410,
1990 "owned_by": "openai",
1991 "served_by": "openai"
1992 }
1993 ]
1994}
1995```
1996
1997Anthropic GET /v1/models?provider=anthropic response:
1998```json
1999{
2000 "provider": "anthropic",
2001 "object": "list",
2002 "data": [
2003 {
2004 "id": "gpt-4",
2005 "object": "model",
2006 "created": 1687882410,
2007 "owned_by": "openai",
2008 "served_by": "openai"
2009 }
2010 ]
2011}
2012```
2013*/
2014///
2015/// <details><summary>JSON schema</summary>
2016///
2017/// ```json
2018///{
2019/// "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",
2020/// "type": "object"
2021///}
2022/// ```
2023/// </details>
2024#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
2025#[serde(transparent)]
2026pub struct ProviderSpecificResponse(
2027 pub ::serde_json::Map<::std::string::String, ::serde_json::Value>,
2028);
2029impl ::std::ops::Deref for ProviderSpecificResponse {
2030 type Target = ::serde_json::Map<::std::string::String, ::serde_json::Value>;
2031 fn deref(&self) -> &::serde_json::Map<::std::string::String, ::serde_json::Value> {
2032 &self.0
2033 }
2034}
2035impl ::std::convert::From<ProviderSpecificResponse>
2036 for ::serde_json::Map<::std::string::String, ::serde_json::Value>
2037{
2038 fn from(value: ProviderSpecificResponse) -> Self {
2039 value.0
2040 }
2041}
2042impl ::std::convert::From<::serde_json::Map<::std::string::String, ::serde_json::Value>>
2043 for ProviderSpecificResponse
2044{
2045 fn from(value: ::serde_json::Map<::std::string::String, ::serde_json::Value>) -> Self {
2046 Self(value)
2047 }
2048}
2049///`SsEvent`
2050///
2051/// <details><summary>JSON schema</summary>
2052///
2053/// ```json
2054///{
2055/// "type": "object",
2056/// "properties": {
2057/// "data": {
2058/// "type": "string",
2059/// "format": "byte"
2060/// },
2061/// "event": {
2062/// "type": "string",
2063/// "enum": [
2064/// "message-start",
2065/// "stream-start",
2066/// "content-start",
2067/// "content-delta",
2068/// "content-end",
2069/// "message-end",
2070/// "stream-end"
2071/// ]
2072/// },
2073/// "retry": {
2074/// "type": "integer"
2075/// }
2076/// }
2077///}
2078/// ```
2079/// </details>
2080#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
2081pub struct SsEvent {
2082 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
2083 pub data: ::std::option::Option<::std::string::String>,
2084 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
2085 pub event: ::std::option::Option<SsEventEvent>,
2086 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
2087 pub retry: ::std::option::Option<i64>,
2088}
2089impl ::std::default::Default for SsEvent {
2090 fn default() -> Self {
2091 Self {
2092 data: Default::default(),
2093 event: Default::default(),
2094 retry: Default::default(),
2095 }
2096 }
2097}
2098///`SsEventEvent`
2099///
2100/// <details><summary>JSON schema</summary>
2101///
2102/// ```json
2103///{
2104/// "type": "string",
2105/// "enum": [
2106/// "message-start",
2107/// "stream-start",
2108/// "content-start",
2109/// "content-delta",
2110/// "content-end",
2111/// "message-end",
2112/// "stream-end"
2113/// ]
2114///}
2115/// ```
2116/// </details>
2117#[derive(
2118 ::serde::Deserialize,
2119 ::serde::Serialize,
2120 Clone,
2121 Copy,
2122 Debug,
2123 Eq,
2124 Hash,
2125 Ord,
2126 PartialEq,
2127 PartialOrd,
2128)]
2129pub enum SsEventEvent {
2130 #[serde(rename = "message-start")]
2131 MessageStart,
2132 #[serde(rename = "stream-start")]
2133 StreamStart,
2134 #[serde(rename = "content-start")]
2135 ContentStart,
2136 #[serde(rename = "content-delta")]
2137 ContentDelta,
2138 #[serde(rename = "content-end")]
2139 ContentEnd,
2140 #[serde(rename = "message-end")]
2141 MessageEnd,
2142 #[serde(rename = "stream-end")]
2143 StreamEnd,
2144}
2145impl ::std::fmt::Display for SsEventEvent {
2146 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
2147 match *self {
2148 Self::MessageStart => f.write_str("message-start"),
2149 Self::StreamStart => f.write_str("stream-start"),
2150 Self::ContentStart => f.write_str("content-start"),
2151 Self::ContentDelta => f.write_str("content-delta"),
2152 Self::ContentEnd => f.write_str("content-end"),
2153 Self::MessageEnd => f.write_str("message-end"),
2154 Self::StreamEnd => f.write_str("stream-end"),
2155 }
2156 }
2157}
2158impl ::std::str::FromStr for SsEventEvent {
2159 type Err = self::error::ConversionError;
2160 fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
2161 match value {
2162 "message-start" => Ok(Self::MessageStart),
2163 "stream-start" => Ok(Self::StreamStart),
2164 "content-start" => Ok(Self::ContentStart),
2165 "content-delta" => Ok(Self::ContentDelta),
2166 "content-end" => Ok(Self::ContentEnd),
2167 "message-end" => Ok(Self::MessageEnd),
2168 "stream-end" => Ok(Self::StreamEnd),
2169 _ => Err("invalid value".into()),
2170 }
2171 }
2172}
2173impl ::std::convert::TryFrom<&str> for SsEventEvent {
2174 type Error = self::error::ConversionError;
2175 fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
2176 value.parse()
2177 }
2178}
2179impl ::std::convert::TryFrom<&::std::string::String> for SsEventEvent {
2180 type Error = self::error::ConversionError;
2181 fn try_from(
2182 value: &::std::string::String,
2183 ) -> ::std::result::Result<Self, self::error::ConversionError> {
2184 value.parse()
2185 }
2186}
2187impl ::std::convert::TryFrom<::std::string::String> for SsEventEvent {
2188 type Error = self::error::ConversionError;
2189 fn try_from(
2190 value: ::std::string::String,
2191 ) -> ::std::result::Result<Self, self::error::ConversionError> {
2192 value.parse()
2193 }
2194}
2195///Text content part
2196///
2197/// <details><summary>JSON schema</summary>
2198///
2199/// ```json
2200///{
2201/// "description": "Text content part",
2202/// "type": "object",
2203/// "required": [
2204/// "text",
2205/// "type"
2206/// ],
2207/// "properties": {
2208/// "text": {
2209/// "description": "The text content",
2210/// "type": "string"
2211/// },
2212/// "type": {
2213/// "description": "Content type identifier",
2214/// "type": "string",
2215/// "enum": [
2216/// "text"
2217/// ]
2218/// }
2219/// }
2220///}
2221/// ```
2222/// </details>
2223#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
2224pub struct TextContentPart {
2225 ///The text content
2226 pub text: ::std::string::String,
2227 ///Content type identifier
2228 #[serde(rename = "type")]
2229 pub type_: TextContentPartType,
2230}
2231///Content type identifier
2232///
2233/// <details><summary>JSON schema</summary>
2234///
2235/// ```json
2236///{
2237/// "description": "Content type identifier",
2238/// "type": "string",
2239/// "enum": [
2240/// "text"
2241/// ]
2242///}
2243/// ```
2244/// </details>
2245#[derive(
2246 ::serde::Deserialize,
2247 ::serde::Serialize,
2248 Clone,
2249 Copy,
2250 Debug,
2251 Eq,
2252 Hash,
2253 Ord,
2254 PartialEq,
2255 PartialOrd,
2256)]
2257pub enum TextContentPartType {
2258 #[serde(rename = "text")]
2259 Text,
2260}
2261impl ::std::fmt::Display for TextContentPartType {
2262 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
2263 match *self {
2264 Self::Text => f.write_str("text"),
2265 }
2266 }
2267}
2268impl ::std::str::FromStr for TextContentPartType {
2269 type Err = self::error::ConversionError;
2270 fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
2271 match value {
2272 "text" => Ok(Self::Text),
2273 _ => Err("invalid value".into()),
2274 }
2275 }
2276}
2277impl ::std::convert::TryFrom<&str> for TextContentPartType {
2278 type Error = self::error::ConversionError;
2279 fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
2280 value.parse()
2281 }
2282}
2283impl ::std::convert::TryFrom<&::std::string::String> for TextContentPartType {
2284 type Error = self::error::ConversionError;
2285 fn try_from(
2286 value: &::std::string::String,
2287 ) -> ::std::result::Result<Self, self::error::ConversionError> {
2288 value.parse()
2289 }
2290}
2291impl ::std::convert::TryFrom<::std::string::String> for TextContentPartType {
2292 type Error = self::error::ConversionError;
2293 fn try_from(
2294 value: ::std::string::String,
2295 ) -> ::std::result::Result<Self, self::error::ConversionError> {
2296 value.parse()
2297 }
2298}
2299/**Provider-specific opaque data attached to a tool call. The contents are
2300not interpreted by the gateway, but must be echoed back verbatim on the
2301next request that references this tool call. Currently used by Google
2302Gemini extended-thinking models to carry the per-call `thought_signature`.
2303Other providers may ignore the field.
2304*/
2305///
2306/// <details><summary>JSON schema</summary>
2307///
2308/// ```json
2309///{
2310/// "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",
2311/// "type": "object",
2312/// "properties": {
2313/// "google": {
2314/// "description": "Google Gemini-specific extra content.",
2315/// "type": "object",
2316/// "properties": {
2317/// "thought_signature": {
2318/// "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",
2319/// "type": "string"
2320/// }
2321/// },
2322/// "additionalProperties": true
2323/// }
2324/// }
2325///}
2326/// ```
2327/// </details>
2328#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
2329pub struct ToolCallExtraContent {
2330 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
2331 pub google: ::std::option::Option<ToolCallExtraContentGoogle>,
2332}
2333impl ::std::default::Default for ToolCallExtraContent {
2334 fn default() -> Self {
2335 Self {
2336 google: Default::default(),
2337 }
2338 }
2339}
2340///Google Gemini-specific extra content.
2341///
2342/// <details><summary>JSON schema</summary>
2343///
2344/// ```json
2345///{
2346/// "description": "Google Gemini-specific extra content.",
2347/// "type": "object",
2348/// "properties": {
2349/// "thought_signature": {
2350/// "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",
2351/// "type": "string"
2352/// }
2353/// },
2354/// "additionalProperties": true
2355///}
2356/// ```
2357/// </details>
2358#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
2359pub struct ToolCallExtraContentGoogle {
2360 /**Opaque signature returned with reasoning-enabled tool calls.
2361 Must be echoed back verbatim in the next request that includes
2362 this tool call, or Google will reject the request.
2363 */
2364 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
2365 pub thought_signature: ::std::option::Option<::std::string::String>,
2366}
2367impl ::std::default::Default for ToolCallExtraContentGoogle {
2368 fn default() -> Self {
2369 Self {
2370 thought_signature: Default::default(),
2371 }
2372 }
2373}
2374/// Generation of default values for serde.
2375pub mod defaults {
2376 pub(super) fn image_url_detail() -> super::ImageUrlDetail {
2377 super::ImageUrlDetail::Auto
2378 }
2379}