1use super::wire::present_nullable;
6use super::{ConversationItem, RealtimeError, RealtimeResponse};
7use crate::Rest;
8use serde::{Deserialize, Serialize};
9
10#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
12#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
13#[derive(gproxy_protocol_macros::DeclaredFields)]
14pub struct RealtimeErrorEvent {
15 pub error: RealtimeError,
16 pub event_id: String,
17 #[serde(rename = "type")]
18 pub type_: RealtimeErrorEventType,
19 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
20 pub rest: Rest,
21}
22
23#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
25#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
26#[derive(gproxy_protocol_macros::DeclaredFields)]
27pub struct RateLimitsUpdatedEvent {
28 pub event_id: String,
29 pub rate_limits: Vec<RateLimitsUpdatedEventRateLimit>,
30 #[serde(rename = "type")]
31 pub type_: RateLimitsUpdatedEventType,
32 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
33 pub rest: Rest,
34}
35
36#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
38#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
39#[derive(gproxy_protocol_macros::DeclaredFields)]
40pub struct ResponseContentPartAddedEvent {
41 pub content_index: i64,
42 pub event_id: String,
43 pub item_id: String,
44 pub output_index: i64,
45 pub part: ResponseContentPartAddedEventPart,
46 pub response_id: String,
47 #[serde(rename = "type")]
48 pub type_: ResponseContentPartAddedEventType,
49 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
50 pub rest: Rest,
51}
52
53#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
55#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
56#[derive(gproxy_protocol_macros::DeclaredFields)]
57pub struct ResponseContentPartDoneEvent {
58 pub content_index: i64,
59 pub event_id: String,
60 pub item_id: String,
61 pub output_index: i64,
62 pub part: ResponseContentPartDoneEventPart,
63 pub response_id: String,
64 #[serde(rename = "type")]
65 pub type_: ResponseContentPartDoneEventType,
66 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
67 pub rest: Rest,
68}
69
70#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
72#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
73#[derive(gproxy_protocol_macros::DeclaredFields)]
74pub struct ResponseCreatedEvent {
75 pub event_id: String,
76 pub response: RealtimeResponse,
77 #[serde(rename = "type")]
78 pub type_: ResponseCreatedEventType,
79 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
80 pub rest: Rest,
81}
82
83#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
85#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
86#[derive(gproxy_protocol_macros::DeclaredFields)]
87pub struct ResponseDoneEvent {
88 pub event_id: String,
89 pub response: RealtimeResponse,
90 #[serde(rename = "type")]
91 pub type_: ResponseDoneEventType,
92 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
93 pub rest: Rest,
94}
95
96#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
98#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
99#[derive(gproxy_protocol_macros::DeclaredFields)]
100pub struct ResponseFunctionCallArgumentsDeltaEvent {
101 pub call_id: String,
102 pub delta: String,
103 pub event_id: String,
104 pub item_id: String,
105 pub output_index: i64,
106 pub response_id: String,
107 #[serde(rename = "type")]
108 pub type_: ResponseFunctionCallArgumentsDeltaEventType,
109 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
110 pub rest: Rest,
111}
112
113#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
115#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
116#[derive(gproxy_protocol_macros::DeclaredFields)]
117pub struct ResponseFunctionCallArgumentsDoneEvent {
118 pub arguments: String,
119 pub call_id: String,
120 pub event_id: String,
121 pub item_id: String,
122 pub name: String,
123 pub output_index: i64,
124 pub response_id: String,
125 #[serde(rename = "type")]
126 pub type_: ResponseFunctionCallArgumentsDoneEventType,
127 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
128 pub rest: Rest,
129}
130
131#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
133#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
134#[derive(gproxy_protocol_macros::DeclaredFields)]
135pub struct ResponseOutputItemAddedEvent {
136 pub event_id: String,
137 pub item: ConversationItem,
138 pub output_index: i64,
139 pub response_id: String,
140 #[serde(rename = "type")]
141 pub type_: ResponseOutputItemAddedEventType,
142 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
143 pub rest: Rest,
144}
145
146#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
148#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
149#[derive(gproxy_protocol_macros::DeclaredFields)]
150pub struct ResponseOutputItemDoneEvent {
151 pub event_id: String,
152 pub item: ConversationItem,
153 pub output_index: i64,
154 pub response_id: String,
155 #[serde(rename = "type")]
156 pub type_: ResponseOutputItemDoneEventType,
157 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
158 pub rest: Rest,
159}
160
161#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
163#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
164#[derive(gproxy_protocol_macros::DeclaredFields)]
165pub struct ResponseTextDeltaEvent {
166 pub content_index: i64,
167 pub delta: String,
168 pub event_id: String,
169 pub item_id: String,
170 pub output_index: i64,
171 pub response_id: String,
172 #[serde(rename = "type")]
173 pub type_: ResponseTextDeltaEventType,
174 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
175 pub rest: Rest,
176}
177
178#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
180#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
181#[derive(gproxy_protocol_macros::DeclaredFields)]
182pub struct ResponseTextDoneEvent {
183 pub content_index: i64,
184 pub event_id: String,
185 pub item_id: String,
186 pub output_index: i64,
187 pub response_id: String,
188 pub text: String,
189 #[serde(rename = "type")]
190 pub type_: ResponseTextDoneEventType,
191 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
192 pub rest: Rest,
193}
194
195#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
197#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
198#[derive(gproxy_protocol_macros::DeclaredFields)]
199pub struct RateLimitsUpdatedEventRateLimit {
200 #[serde(
201 default,
202 deserialize_with = "present_nullable",
203 skip_serializing_if = "Option::is_none"
204 )]
205 pub limit: Option<Option<i64>>,
206 #[serde(
207 default,
208 deserialize_with = "present_nullable",
209 skip_serializing_if = "Option::is_none"
210 )]
211 pub name: Option<Option<RateLimitsUpdatedEventRateLimitName>>,
212 #[serde(
213 default,
214 deserialize_with = "present_nullable",
215 skip_serializing_if = "Option::is_none"
216 )]
217 pub remaining: Option<Option<i64>>,
218 #[serde(
219 default,
220 deserialize_with = "present_nullable",
221 skip_serializing_if = "Option::is_none"
222 )]
223 pub reset_seconds: Option<Option<serde_json::Number>>,
224 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
225 pub rest: Rest,
226}
227
228#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
230#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
231#[derive(gproxy_protocol_macros::DeclaredFields)]
232pub struct ResponseContentPartAddedEventPart {
233 #[serde(
234 default,
235 deserialize_with = "present_nullable",
236 skip_serializing_if = "Option::is_none"
237 )]
238 pub audio: Option<Option<String>>,
239 #[serde(
240 default,
241 deserialize_with = "present_nullable",
242 skip_serializing_if = "Option::is_none"
243 )]
244 pub text: Option<Option<String>>,
245 #[serde(
246 default,
247 deserialize_with = "present_nullable",
248 skip_serializing_if = "Option::is_none"
249 )]
250 pub transcript: Option<Option<String>>,
251 #[serde(rename = "type")]
252 #[serde(
253 default,
254 deserialize_with = "present_nullable",
255 skip_serializing_if = "Option::is_none"
256 )]
257 pub type_: Option<Option<ResponseContentPartAddedEventPartType>>,
258 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
259 pub rest: Rest,
260}
261
262#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
264#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
265#[derive(gproxy_protocol_macros::DeclaredFields)]
266pub struct ResponseContentPartDoneEventPart {
267 #[serde(
268 default,
269 deserialize_with = "present_nullable",
270 skip_serializing_if = "Option::is_none"
271 )]
272 pub audio: Option<Option<String>>,
273 #[serde(
274 default,
275 deserialize_with = "present_nullable",
276 skip_serializing_if = "Option::is_none"
277 )]
278 pub text: Option<Option<String>>,
279 #[serde(
280 default,
281 deserialize_with = "present_nullable",
282 skip_serializing_if = "Option::is_none"
283 )]
284 pub transcript: Option<Option<String>>,
285 #[serde(rename = "type")]
286 #[serde(
287 default,
288 deserialize_with = "present_nullable",
289 skip_serializing_if = "Option::is_none"
290 )]
291 pub type_: Option<Option<ResponseContentPartDoneEventPartType>>,
292 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
293 pub rest: Rest,
294}
295
296#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
297#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
298#[derive(gproxy_protocol_macros::DeclaredFields)]
299pub enum RealtimeErrorEventType {
300 #[serde(rename = "error")]
301 Error,
302}
303
304#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
305#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
306#[derive(gproxy_protocol_macros::DeclaredFields)]
307pub enum RateLimitsUpdatedEventType {
308 #[serde(rename = "rate_limits.updated")]
309 RateLimitsUpdated,
310}
311
312#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
313#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
314#[derive(gproxy_protocol_macros::DeclaredFields)]
315pub enum ResponseContentPartAddedEventType {
316 #[serde(rename = "response.content_part.added")]
317 ResponseContentPartAdded,
318}
319
320#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
321#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
322#[derive(gproxy_protocol_macros::DeclaredFields)]
323pub enum ResponseContentPartDoneEventType {
324 #[serde(rename = "response.content_part.done")]
325 ResponseContentPartDone,
326}
327
328#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
329#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
330#[derive(gproxy_protocol_macros::DeclaredFields)]
331pub enum ResponseCreatedEventType {
332 #[serde(rename = "response.created")]
333 ResponseCreated,
334}
335
336#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
337#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
338#[derive(gproxy_protocol_macros::DeclaredFields)]
339pub enum ResponseDoneEventType {
340 #[serde(rename = "response.done")]
341 ResponseDone,
342}
343
344#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
345#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
346#[derive(gproxy_protocol_macros::DeclaredFields)]
347pub enum ResponseFunctionCallArgumentsDeltaEventType {
348 #[serde(rename = "response.function_call_arguments.delta")]
349 ResponseFunctionCallArgumentsDelta,
350}
351
352#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
353#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
354#[derive(gproxy_protocol_macros::DeclaredFields)]
355pub enum ResponseFunctionCallArgumentsDoneEventType {
356 #[serde(rename = "response.function_call_arguments.done")]
357 ResponseFunctionCallArgumentsDone,
358}
359
360#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
361#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
362#[derive(gproxy_protocol_macros::DeclaredFields)]
363pub enum ResponseOutputItemAddedEventType {
364 #[serde(rename = "response.output_item.added")]
365 ResponseOutputItemAdded,
366}
367
368#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
369#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
370#[derive(gproxy_protocol_macros::DeclaredFields)]
371pub enum ResponseOutputItemDoneEventType {
372 #[serde(rename = "response.output_item.done")]
373 ResponseOutputItemDone,
374}
375
376#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
377#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
378#[derive(gproxy_protocol_macros::DeclaredFields)]
379pub enum ResponseTextDeltaEventType {
380 #[serde(rename = "response.output_text.delta")]
381 ResponseOutputTextDelta,
382}
383
384#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
385#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
386#[derive(gproxy_protocol_macros::DeclaredFields)]
387pub enum ResponseTextDoneEventType {
388 #[serde(rename = "response.output_text.done")]
389 ResponseOutputTextDone,
390}
391
392#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
393#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
394#[derive(gproxy_protocol_macros::DeclaredFields)]
395pub enum RateLimitsUpdatedEventRateLimitName {
396 #[serde(rename = "requests")]
397 Requests,
398 #[serde(rename = "tokens")]
399 Tokens,
400}
401
402#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
403#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
404#[derive(gproxy_protocol_macros::DeclaredFields)]
405pub enum ResponseContentPartAddedEventPartType {
406 #[serde(rename = "text")]
407 Text,
408 #[serde(rename = "audio")]
409 Audio,
410}
411
412#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
413#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
414#[derive(gproxy_protocol_macros::DeclaredFields)]
415pub enum ResponseContentPartDoneEventPartType {
416 #[serde(rename = "text")]
417 Text,
418 #[serde(rename = "audio")]
419 Audio,
420}