Skip to main content

gproxy_protocol/openai/generate_content/responses/items/content/
payloads.rs

1use serde::{Deserialize, Serialize};
2
3use crate::openai::common::*;
4
5use super::super::ResponseAnnotation;
6
7#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
8#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
9pub struct ResponseInputText {
10    pub text: String,
11    #[serde(skip_serializing_if = "Option::is_none")]
12    pub prompt_cache_breakpoint: Option<PromptCacheBreakpoint>,
13    #[serde(default, flatten)]
14    pub rest: Rest,
15}
16
17#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
18#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
19pub struct ResponseInputImage {
20    #[serde(skip_serializing_if = "Option::is_none")]
21    pub detail: Option<DetailLevel>,
22    #[serde(skip_serializing_if = "Option::is_none")]
23    pub file_id: Option<String>,
24    #[serde(skip_serializing_if = "Option::is_none")]
25    pub image_url: Option<String>,
26    #[serde(skip_serializing_if = "Option::is_none")]
27    pub prompt_cache_breakpoint: Option<PromptCacheBreakpoint>,
28    #[serde(default, flatten)]
29    pub rest: Rest,
30}
31
32#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
33#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
34pub struct ResponseInputFile {
35    #[serde(skip_serializing_if = "Option::is_none")]
36    pub detail: Option<InputFileDetailLevel>,
37    #[serde(skip_serializing_if = "Option::is_none")]
38    pub file_data: Option<String>,
39    #[serde(skip_serializing_if = "Option::is_none")]
40    pub file_id: Option<String>,
41    #[serde(skip_serializing_if = "Option::is_none")]
42    pub file_url: Option<String>,
43    #[serde(skip_serializing_if = "Option::is_none")]
44    pub filename: Option<String>,
45    #[serde(skip_serializing_if = "Option::is_none")]
46    pub prompt_cache_breakpoint: Option<PromptCacheBreakpoint>,
47    #[serde(default, flatten)]
48    pub rest: Rest,
49}
50
51#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
52#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
53pub struct ResponseInputAudio {
54    pub input_audio: InputAudioContent,
55    #[serde(default, flatten)]
56    pub rest: Rest,
57}
58
59#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
60#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
61pub struct ResponseOutputText {
62    #[serde(rename = "type")]
63    pub type_: ResponseOutputTextType,
64    #[serde(default)]
65    pub annotations: Vec<ResponseAnnotation>,
66    #[serde(skip_serializing_if = "Option::is_none")]
67    pub logprobs: Option<Vec<TokenLogprob>>,
68    pub text: String,
69    #[serde(default, flatten)]
70    pub rest: Rest,
71}
72
73#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
74#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
75pub enum ResponseOutputTextType {
76    #[serde(rename = "output_text")]
77    OutputText,
78}
79
80#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
81#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
82pub struct ResponseRefusal {
83    #[serde(rename = "type")]
84    pub type_: ResponseRefusalType,
85    pub refusal: String,
86    #[serde(default, flatten)]
87    pub rest: Rest,
88}
89
90#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
91#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
92pub enum ResponseRefusalType {
93    #[serde(rename = "refusal")]
94    Refusal,
95}
96
97#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
98#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
99pub struct ResponseReasoningText {
100    #[serde(rename = "type")]
101    pub type_: ResponseReasoningTextType,
102    pub text: String,
103    #[serde(default, flatten)]
104    pub rest: Rest,
105}
106
107#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
108#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
109pub enum ResponseReasoningTextType {
110    #[serde(rename = "reasoning_text")]
111    ReasoningText,
112}
113
114#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
115#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
116pub struct InputAudioContent {
117    pub data: String,
118    pub format: InputAudioFormat,
119    #[serde(default, flatten)]
120    pub rest: Rest,
121}