Skip to main content

gproxy_protocol/wire/openai/realtime/
prompt.rs

1//! Native Realtime wire DTOs. Source definitions are cited on each object.
2//! Verified with Realtime.md and openai-python snapshot
3//! e12b81d3bbf644ec7045e152d69bc4b68d69cd48 (2026-09-13).
4//! https://github.com/openai/openai-python/tree/e12b81d3bbf644ec7045e152d69bc4b68d69cd48/src/openai/types/realtime
5use super::wire::present_nullable;
6use crate::Rest;
7use serde::{Deserialize, Serialize};
8
9/// Source: `openai/types/responses/response_prompt.py`, `ResponsePrompt`.
10#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
11#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
12#[derive(gproxy_protocol_macros::DeclaredFields)]
13pub struct ResponsePrompt {
14    pub id: String,
15    #[serde(
16        default,
17        deserialize_with = "present_nullable",
18        skip_serializing_if = "Option::is_none"
19    )]
20    pub variables: Option<Option<std::collections::BTreeMap<String, ResponsePromptVariables>>>,
21    #[serde(
22        default,
23        deserialize_with = "present_nullable",
24        skip_serializing_if = "Option::is_none"
25    )]
26    pub version: Option<Option<String>>,
27    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
28    pub rest: Rest,
29}
30
31/// Source: `openai/types/responses/response_prompt.py`, `Variables`.
32#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
33#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
34#[serde(untagged)]
35#[derive(gproxy_protocol_macros::DeclaredFields)]
36pub enum ResponsePromptVariables {
37    Text(String),
38    ResponseInputText(ResponseInputText),
39    ResponseInputImage(ResponseInputImage),
40    ResponseInputFile(ResponseInputFile),
41}
42
43/// Source: `openai/types/responses/tool_choice_options.py`, `ToolChoiceOptions`.
44#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
45#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
46#[derive(gproxy_protocol_macros::DeclaredFields)]
47pub enum ToolChoiceOptions {
48    #[serde(rename = "none")]
49    None,
50    #[serde(rename = "auto")]
51    Auto,
52    #[serde(rename = "required")]
53    Required,
54}
55
56/// Source: `openai/types/responses/tool_choice_function.py`, `ToolChoiceFunction`.
57#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
58#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
59#[derive(gproxy_protocol_macros::DeclaredFields)]
60pub struct ToolChoiceFunction {
61    pub name: String,
62    #[serde(rename = "type")]
63    pub type_: ToolChoiceFunctionType,
64    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
65    pub rest: Rest,
66}
67
68/// Source: `openai/types/responses/tool_choice_mcp.py`, `ToolChoiceMcp`.
69#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
70#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
71#[derive(gproxy_protocol_macros::DeclaredFields)]
72pub struct ToolChoiceMcp {
73    pub server_label: String,
74    #[serde(rename = "type")]
75    pub type_: ToolChoiceMcpType,
76    #[serde(
77        default,
78        deserialize_with = "present_nullable",
79        skip_serializing_if = "Option::is_none"
80    )]
81    pub name: Option<Option<String>>,
82    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
83    pub rest: Rest,
84}
85
86/// Source: `openai/types/shared/metadata.py`, `Metadata`.
87pub type Metadata = std::collections::BTreeMap<String, String>;
88
89/// Source: `openai/types/responses/response_input_text.py`, `ResponseInputText`.
90#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
91#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
92#[derive(gproxy_protocol_macros::DeclaredFields)]
93pub struct ResponseInputText {
94    pub text: String,
95    #[serde(rename = "type")]
96    pub type_: ResponseInputTextType,
97    #[serde(
98        default,
99        deserialize_with = "present_nullable",
100        skip_serializing_if = "Option::is_none"
101    )]
102    pub prompt_cache_breakpoint: Option<Option<ResponseInputTextPromptCacheBreakpoint>>,
103    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
104    pub rest: Rest,
105}
106
107/// Source: `openai/types/responses/response_input_image.py`, `ResponseInputImage`.
108#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
109#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
110#[derive(gproxy_protocol_macros::DeclaredFields)]
111pub struct ResponseInputImage {
112    pub detail: ImageDetail,
113    #[serde(rename = "type")]
114    pub type_: ResponseInputImageType,
115    #[serde(
116        default,
117        deserialize_with = "present_nullable",
118        skip_serializing_if = "Option::is_none"
119    )]
120    pub file_id: Option<Option<String>>,
121    #[serde(
122        default,
123        deserialize_with = "present_nullable",
124        skip_serializing_if = "Option::is_none"
125    )]
126    pub image_url: Option<Option<String>>,
127    #[serde(
128        default,
129        deserialize_with = "present_nullable",
130        skip_serializing_if = "Option::is_none"
131    )]
132    pub prompt_cache_breakpoint: Option<Option<ResponseInputImagePromptCacheBreakpoint>>,
133    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
134    pub rest: Rest,
135}
136
137/// Source: `openai/types/responses/response_input_file.py`, `ResponseInputFile`.
138#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
139#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
140#[derive(gproxy_protocol_macros::DeclaredFields)]
141pub struct ResponseInputFile {
142    #[serde(rename = "type")]
143    pub type_: ResponseInputFileType,
144    #[serde(
145        default,
146        deserialize_with = "present_nullable",
147        skip_serializing_if = "Option::is_none"
148    )]
149    pub detail: Option<Option<ResponseInputFileDetail>>,
150    #[serde(
151        default,
152        deserialize_with = "present_nullable",
153        skip_serializing_if = "Option::is_none"
154    )]
155    pub file_data: Option<Option<String>>,
156    #[serde(
157        default,
158        deserialize_with = "present_nullable",
159        skip_serializing_if = "Option::is_none"
160    )]
161    pub file_id: Option<Option<String>>,
162    #[serde(
163        default,
164        deserialize_with = "present_nullable",
165        skip_serializing_if = "Option::is_none"
166    )]
167    pub file_url: Option<Option<String>>,
168    #[serde(
169        default,
170        deserialize_with = "present_nullable",
171        skip_serializing_if = "Option::is_none"
172    )]
173    pub filename: Option<Option<String>>,
174    #[serde(
175        default,
176        deserialize_with = "present_nullable",
177        skip_serializing_if = "Option::is_none"
178    )]
179    pub prompt_cache_breakpoint: Option<Option<ResponseInputFilePromptCacheBreakpoint>>,
180    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
181    pub rest: Rest,
182}
183
184/// Source: `openai/types/responses/response_input_text.py`, `PromptCacheBreakpoint`.
185#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
186#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
187#[derive(gproxy_protocol_macros::DeclaredFields)]
188pub struct ResponseInputTextPromptCacheBreakpoint {
189    pub mode: ResponseInputTextPromptCacheBreakpointMode,
190    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
191    pub rest: Rest,
192}
193
194/// Source: `openai/types/responses/image_detail.py`, `ImageDetail`.
195#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
196#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
197#[derive(gproxy_protocol_macros::DeclaredFields)]
198pub enum ImageDetail {
199    #[serde(rename = "low")]
200    Low,
201    #[serde(rename = "high")]
202    High,
203    #[serde(rename = "auto")]
204    Auto,
205    #[serde(rename = "original")]
206    Original,
207}
208
209/// Source: `openai/types/responses/response_input_image.py`, `PromptCacheBreakpoint`.
210#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
211#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
212#[derive(gproxy_protocol_macros::DeclaredFields)]
213pub struct ResponseInputImagePromptCacheBreakpoint {
214    pub mode: ResponseInputImagePromptCacheBreakpointMode,
215    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
216    pub rest: Rest,
217}
218
219/// Source: `openai/types/responses/response_input_file.py`, `PromptCacheBreakpoint`.
220#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
221#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
222#[derive(gproxy_protocol_macros::DeclaredFields)]
223pub struct ResponseInputFilePromptCacheBreakpoint {
224    pub mode: ResponseInputFilePromptCacheBreakpointMode,
225    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
226    pub rest: Rest,
227}
228
229#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
230#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
231#[derive(gproxy_protocol_macros::DeclaredFields)]
232pub enum ToolChoiceFunctionType {
233    #[serde(rename = "function")]
234    Function,
235}
236
237#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
238#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
239#[derive(gproxy_protocol_macros::DeclaredFields)]
240pub enum ToolChoiceMcpType {
241    #[serde(rename = "mcp")]
242    Mcp,
243}
244
245#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
246#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
247#[derive(gproxy_protocol_macros::DeclaredFields)]
248pub enum ResponseInputTextType {
249    #[serde(rename = "input_text")]
250    InputText,
251}
252
253#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
254#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
255#[derive(gproxy_protocol_macros::DeclaredFields)]
256pub enum ResponseInputImageType {
257    #[serde(rename = "input_image")]
258    InputImage,
259}
260
261#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
262#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
263#[derive(gproxy_protocol_macros::DeclaredFields)]
264pub enum ResponseInputFileType {
265    #[serde(rename = "input_file")]
266    InputFile,
267}
268
269#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
270#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
271#[derive(gproxy_protocol_macros::DeclaredFields)]
272pub enum ResponseInputFileDetail {
273    #[serde(rename = "auto")]
274    Auto,
275    #[serde(rename = "low")]
276    Low,
277    #[serde(rename = "high")]
278    High,
279}
280
281#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
282#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
283#[derive(gproxy_protocol_macros::DeclaredFields)]
284pub enum ResponseInputTextPromptCacheBreakpointMode {
285    #[serde(rename = "explicit")]
286    Explicit,
287}
288
289#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
290#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
291#[derive(gproxy_protocol_macros::DeclaredFields)]
292pub enum ResponseInputImagePromptCacheBreakpointMode {
293    #[serde(rename = "explicit")]
294    Explicit,
295}
296
297#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
298#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
299#[derive(gproxy_protocol_macros::DeclaredFields)]
300pub enum ResponseInputFilePromptCacheBreakpointMode {
301    #[serde(rename = "explicit")]
302    Explicit,
303}