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