Skip to main content

gproxy_protocol/wire/openai/realtime/
settings.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::{ToolChoiceFunction, ToolChoiceMcp, ToolChoiceOptions};
7use crate::Rest;
8use serde::{Deserialize, Serialize};
9
10/// Source: `openai/types/realtime/realtime_reasoning.py`, `RealtimeReasoning`.
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 RealtimeReasoning {
16    #[serde(
17        default,
18        deserialize_with = "present_nullable",
19        skip_serializing_if = "Option::is_none"
20    )]
21    pub effort: Option<Option<RealtimeReasoningEffort>>,
22    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
23    pub rest: Rest,
24}
25
26/// Source: `openai/types/realtime/realtime_tool_choice_config.py`, `RealtimeToolChoiceConfig`.
27#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
28#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
29#[serde(untagged)]
30#[derive(gproxy_protocol_macros::DeclaredFields)]
31#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
32pub enum RealtimeToolChoiceConfig {
33    ToolChoiceOptions(ToolChoiceOptions),
34    ToolChoiceFunction(ToolChoiceFunction),
35    ToolChoiceMcp(ToolChoiceMcp),
36}
37
38/// Source: `openai/types/realtime/realtime_tracing_config.py`, `RealtimeTracingConfig`.
39#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
40#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
41#[serde(untagged)]
42#[derive(gproxy_protocol_macros::DeclaredFields)]
43#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
44pub enum RealtimeTracingConfig {
45    Literal(RealtimeTracingConfigVariant1),
46    RealtimeTracingConfigTracingConfiguration(RealtimeTracingConfigTracingConfiguration),
47    Variant3(()),
48}
49
50/// Source: `openai/types/realtime/realtime_truncation.py`, `RealtimeTruncation`.
51#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
52#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
53#[serde(untagged)]
54#[derive(gproxy_protocol_macros::DeclaredFields)]
55#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
56pub enum RealtimeTruncation {
57    Literal(RealtimeTruncationVariant1),
58    RealtimeTruncationRetentionRatio(RealtimeTruncationRetentionRatio),
59}
60
61/// Source: `openai/types/realtime/realtime_error.py`, `RealtimeError`.
62#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
63#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
64#[derive(gproxy_protocol_macros::DeclaredFields)]
65#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
66pub struct RealtimeError {
67    pub message: String,
68    #[serde(rename = "type")]
69    pub type_: String,
70    #[serde(
71        default,
72        deserialize_with = "present_nullable",
73        skip_serializing_if = "Option::is_none"
74    )]
75    pub code: Option<Option<String>>,
76    #[serde(
77        default,
78        deserialize_with = "present_nullable",
79        skip_serializing_if = "Option::is_none"
80    )]
81    pub event_id: Option<Option<String>>,
82    #[serde(
83        default,
84        deserialize_with = "present_nullable",
85        skip_serializing_if = "Option::is_none"
86    )]
87    pub param: Option<Option<String>>,
88    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
89    pub rest: Rest,
90}
91
92/// Source: `openai/types/realtime/realtime_reasoning_effort.py`, `RealtimeReasoningEffort`.
93#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
94#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
95#[derive(gproxy_protocol_macros::DeclaredFields)]
96#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
97pub enum RealtimeReasoningEffort {
98    #[serde(rename = "minimal")]
99    Minimal,
100    #[serde(rename = "low")]
101    Low,
102    #[serde(rename = "medium")]
103    Medium,
104    #[serde(rename = "high")]
105    High,
106    #[serde(rename = "xhigh")]
107    Xhigh,
108}
109
110/// Source: `openai/types/realtime/realtime_tracing_config.py`, `TracingConfiguration`.
111#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
112#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
113#[derive(gproxy_protocol_macros::DeclaredFields)]
114#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
115pub struct RealtimeTracingConfigTracingConfiguration {
116    #[serde(
117        default,
118        deserialize_with = "present_nullable",
119        skip_serializing_if = "Option::is_none"
120    )]
121    pub group_id: Option<Option<String>>,
122    #[serde(
123        default,
124        deserialize_with = "present_nullable",
125        skip_serializing_if = "Option::is_none"
126    )]
127    pub metadata: Option<Option<serde_json::Value>>,
128    #[serde(
129        default,
130        deserialize_with = "present_nullable",
131        skip_serializing_if = "Option::is_none"
132    )]
133    pub workflow_name: Option<Option<String>>,
134    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
135    pub rest: Rest,
136}
137
138/// Source: `openai/types/realtime/realtime_truncation_retention_ratio.py`, `RealtimeTruncationRetentionRatio`.
139#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
140#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
141#[derive(gproxy_protocol_macros::DeclaredFields)]
142#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
143pub struct RealtimeTruncationRetentionRatio {
144    pub retention_ratio: serde_json::Number,
145    #[serde(rename = "type")]
146    pub type_: RealtimeTruncationRetentionRatioType,
147    #[serde(
148        default,
149        deserialize_with = "present_nullable",
150        skip_serializing_if = "Option::is_none"
151    )]
152    pub token_limits: Option<Option<RealtimeTruncationRetentionRatioTokenLimits>>,
153    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
154    pub rest: Rest,
155}
156
157/// Source: `openai/types/realtime/realtime_function_tool.py`, `RealtimeFunctionTool`.
158#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
159#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
160#[derive(gproxy_protocol_macros::DeclaredFields)]
161#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
162pub struct RealtimeFunctionTool {
163    #[serde(
164        default,
165        deserialize_with = "present_nullable",
166        skip_serializing_if = "Option::is_none"
167    )]
168    pub description: Option<Option<String>>,
169    #[serde(
170        default,
171        deserialize_with = "present_nullable",
172        skip_serializing_if = "Option::is_none"
173    )]
174    pub name: Option<Option<String>>,
175    #[serde(
176        default,
177        deserialize_with = "present_nullable",
178        skip_serializing_if = "Option::is_none"
179    )]
180    pub parameters: Option<Option<serde_json::Value>>,
181    #[serde(rename = "type")]
182    #[serde(
183        default,
184        deserialize_with = "present_nullable",
185        skip_serializing_if = "Option::is_none"
186    )]
187    pub type_: Option<Option<RealtimeFunctionToolType>>,
188    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
189    pub rest: Rest,
190}
191
192/// Source: `openai/types/realtime/realtime_truncation_retention_ratio.py`, `TokenLimits`.
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 RealtimeTruncationRetentionRatioTokenLimits {
198    #[serde(
199        default,
200        deserialize_with = "present_nullable",
201        skip_serializing_if = "Option::is_none"
202    )]
203    pub post_instructions: Option<Option<i64>>,
204    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
205    pub rest: Rest,
206}
207
208/// Source: `openai/types/realtime/realtime_mcphttp_error.py`, `RealtimeMcphttpError`.
209#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
210#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
211#[derive(gproxy_protocol_macros::DeclaredFields)]
212#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
213pub struct RealtimeMcphttpError {
214    pub code: i64,
215    pub message: String,
216    #[serde(rename = "type")]
217    pub type_: RealtimeMcphttpErrorType,
218    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
219    pub rest: Rest,
220}
221
222#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
223#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
224#[derive(gproxy_protocol_macros::DeclaredFields)]
225#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
226pub enum RealtimeTracingConfigVariant1 {
227    #[serde(rename = "auto")]
228    Auto,
229}
230
231#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
232#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
233#[derive(gproxy_protocol_macros::DeclaredFields)]
234#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
235pub enum RealtimeTruncationVariant1 {
236    #[serde(rename = "auto")]
237    Auto,
238    #[serde(rename = "disabled")]
239    Disabled,
240}
241
242#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
243#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
244#[derive(gproxy_protocol_macros::DeclaredFields)]
245#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
246pub enum RealtimeTruncationRetentionRatioType {
247    #[serde(rename = "retention_ratio")]
248    RetentionRatio,
249}
250
251#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
252#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
253#[derive(gproxy_protocol_macros::DeclaredFields)]
254#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
255pub enum RealtimeFunctionToolType {
256    #[serde(rename = "function")]
257    Function,
258}
259
260#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
261#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
262#[derive(gproxy_protocol_macros::DeclaredFields)]
263#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
264pub enum RealtimeMcphttpErrorType {
265    #[serde(rename = "http_error")]
266    HttpError,
267}