Skip to main content

gproxy_protocol/wire/openai/realtime/
session_response_audio.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 super::{AudioTranscription, NoiseReductionType, RealtimeAudioFormats};
7use crate::Rest;
8use serde::{Deserialize, Serialize};
9
10/// Source: `openai/types/realtime/realtime_session_create_response.py`, `Audio`.
11#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
12#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
13#[derive(gproxy_protocol_macros::DeclaredFields)]
14#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
15pub struct RealtimeSessionCreateResponseAudio {
16    #[serde(
17        default,
18        deserialize_with = "present_nullable",
19        skip_serializing_if = "Option::is_none"
20    )]
21    pub input: Option<Option<RealtimeSessionCreateResponseAudioInput>>,
22    #[serde(
23        default,
24        deserialize_with = "present_nullable",
25        skip_serializing_if = "Option::is_none"
26    )]
27    pub output: Option<Option<RealtimeSessionCreateResponseAudioOutput>>,
28    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
29    pub rest: Rest,
30}
31
32/// Source: `openai/types/realtime/realtime_session_create_response.py`, `AudioInput`.
33#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
34#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
35#[derive(gproxy_protocol_macros::DeclaredFields)]
36#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
37pub struct RealtimeSessionCreateResponseAudioInput {
38    #[serde(
39        default,
40        deserialize_with = "present_nullable",
41        skip_serializing_if = "Option::is_none"
42    )]
43    pub format: Option<Option<RealtimeAudioFormats>>,
44    #[serde(
45        default,
46        deserialize_with = "present_nullable",
47        skip_serializing_if = "Option::is_none"
48    )]
49    pub noise_reduction: Option<Option<RealtimeSessionCreateResponseAudioInputNoiseReduction>>,
50    #[serde(
51        default,
52        deserialize_with = "present_nullable",
53        skip_serializing_if = "Option::is_none"
54    )]
55    pub transcription: Option<Option<AudioTranscription>>,
56    #[serde(
57        default,
58        deserialize_with = "present_nullable",
59        skip_serializing_if = "Option::is_none"
60    )]
61    pub turn_detection: Option<Option<RealtimeSessionCreateResponseAudioInputTurnDetection>>,
62    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
63    pub rest: Rest,
64}
65
66/// Source: `openai/types/realtime/realtime_session_create_response.py`, `AudioOutput`.
67#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
68#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
69#[derive(gproxy_protocol_macros::DeclaredFields)]
70#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
71pub struct RealtimeSessionCreateResponseAudioOutput {
72    #[serde(
73        default,
74        deserialize_with = "present_nullable",
75        skip_serializing_if = "Option::is_none"
76    )]
77    pub format: Option<Option<RealtimeAudioFormats>>,
78    #[serde(
79        default,
80        deserialize_with = "present_nullable",
81        skip_serializing_if = "Option::is_none"
82    )]
83    pub speed: Option<Option<serde_json::Number>>,
84    #[serde(
85        default,
86        deserialize_with = "present_nullable",
87        skip_serializing_if = "Option::is_none"
88    )]
89    pub voice: Option<Option<String>>,
90    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
91    pub rest: Rest,
92}
93
94/// Source: `openai/types/realtime/realtime_session_create_response.py`, `AudioInputNoiseReduction`.
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 RealtimeSessionCreateResponseAudioInputNoiseReduction {
100    #[serde(rename = "type")]
101    #[serde(
102        default,
103        deserialize_with = "present_nullable",
104        skip_serializing_if = "Option::is_none"
105    )]
106    pub type_: Option<Option<NoiseReductionType>>,
107    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
108    pub rest: Rest,
109}
110
111/// Source: `openai/types/realtime/realtime_session_create_response.py`, `AudioInputTurnDetection`.
112#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
113#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
114#[serde(untagged)]
115#[derive(gproxy_protocol_macros::DeclaredFields)]
116#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
117pub enum RealtimeSessionCreateResponseAudioInputTurnDetection {
118    RealtimeSessionCreateResponseAudioInputTurnDetectionServerVad(
119        RealtimeSessionCreateResponseAudioInputTurnDetectionServerVad,
120    ),
121    RealtimeSessionCreateResponseAudioInputTurnDetectionSemanticVad(
122        RealtimeSessionCreateResponseAudioInputTurnDetectionSemanticVad,
123    ),
124    Variant3(()),
125}
126
127/// Source: `openai/types/realtime/realtime_session_create_response.py`, `AudioInputTurnDetectionServerVad`.
128#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
129#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
130#[derive(gproxy_protocol_macros::DeclaredFields)]
131#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
132pub struct RealtimeSessionCreateResponseAudioInputTurnDetectionServerVad {
133    #[serde(rename = "type")]
134    pub type_: RealtimeSessionCreateResponseAudioInputTurnDetectionServerVadType,
135    #[serde(
136        default,
137        deserialize_with = "present_nullable",
138        skip_serializing_if = "Option::is_none"
139    )]
140    pub create_response: Option<Option<bool>>,
141    #[serde(
142        default,
143        deserialize_with = "present_nullable",
144        skip_serializing_if = "Option::is_none"
145    )]
146    pub idle_timeout_ms: Option<Option<i64>>,
147    #[serde(
148        default,
149        deserialize_with = "present_nullable",
150        skip_serializing_if = "Option::is_none"
151    )]
152    pub interrupt_response: Option<Option<bool>>,
153    #[serde(
154        default,
155        deserialize_with = "present_nullable",
156        skip_serializing_if = "Option::is_none"
157    )]
158    pub prefix_padding_ms: Option<Option<i64>>,
159    #[serde(
160        default,
161        deserialize_with = "present_nullable",
162        skip_serializing_if = "Option::is_none"
163    )]
164    pub silence_duration_ms: Option<Option<i64>>,
165    #[serde(
166        default,
167        deserialize_with = "present_nullable",
168        skip_serializing_if = "Option::is_none"
169    )]
170    pub threshold: Option<Option<serde_json::Number>>,
171    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
172    pub rest: Rest,
173}
174
175/// Source: `openai/types/realtime/realtime_session_create_response.py`, `AudioInputTurnDetectionSemanticVad`.
176#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
177#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
178#[derive(gproxy_protocol_macros::DeclaredFields)]
179#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
180pub struct RealtimeSessionCreateResponseAudioInputTurnDetectionSemanticVad {
181    #[serde(rename = "type")]
182    pub type_: RealtimeSessionCreateResponseAudioInputTurnDetectionSemanticVadType,
183    #[serde(
184        default,
185        deserialize_with = "present_nullable",
186        skip_serializing_if = "Option::is_none"
187    )]
188    pub create_response: Option<Option<bool>>,
189    #[serde(
190        default,
191        deserialize_with = "present_nullable",
192        skip_serializing_if = "Option::is_none"
193    )]
194    pub eagerness:
195        Option<Option<RealtimeSessionCreateResponseAudioInputTurnDetectionSemanticVadEagerness>>,
196    #[serde(
197        default,
198        deserialize_with = "present_nullable",
199        skip_serializing_if = "Option::is_none"
200    )]
201    pub interrupt_response: Option<Option<bool>>,
202    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
203    pub rest: Rest,
204}
205
206#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
207#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
208#[derive(gproxy_protocol_macros::DeclaredFields)]
209#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
210pub enum RealtimeSessionCreateResponseAudioInputTurnDetectionServerVadType {
211    #[serde(rename = "server_vad")]
212    ServerVad,
213}
214
215#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
216#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
217#[derive(gproxy_protocol_macros::DeclaredFields)]
218#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
219pub enum RealtimeSessionCreateResponseAudioInputTurnDetectionSemanticVadType {
220    #[serde(rename = "semantic_vad")]
221    SemanticVad,
222}
223
224#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
225#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
226#[derive(gproxy_protocol_macros::DeclaredFields)]
227#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
228pub enum RealtimeSessionCreateResponseAudioInputTurnDetectionSemanticVadEagerness {
229    #[serde(rename = "low")]
230    Low,
231    #[serde(rename = "medium")]
232    Medium,
233    #[serde(rename = "high")]
234    High,
235    #[serde(rename = "auto")]
236    Auto,
237}