Skip to main content

gproxy_protocol/openai/realtime/server_events/payloads/
control.rs

1use serde::{Deserialize, Serialize};
2
3use crate::openai::common::Rest;
4
5use super::super::super::{RealtimeError, RealtimeRateLimit, RealtimeResponse, RealtimeSession};
6
7#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
8#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
9pub struct RealtimeErrorEvent {
10    pub error: RealtimeError,
11    #[serde(default, flatten)]
12    pub rest: Rest,
13}
14
15#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
16#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
17pub struct RealtimeSessionEvent {
18    pub session: Box<RealtimeSession>,
19    #[serde(default, flatten)]
20    pub rest: Rest,
21}
22
23#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
24#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
25pub struct RealtimeRateLimitsEvent {
26    pub rate_limits: Vec<RealtimeRateLimit>,
27    #[serde(default, flatten)]
28    pub rest: Rest,
29}
30
31#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
32#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
33pub struct RealtimeResponseEvent {
34    pub response: Box<RealtimeResponse>,
35    #[serde(default, flatten)]
36    pub rest: Rest,
37}
38
39/// A telephony keypad press relayed by the server; `received_at` is a UTC Unix
40/// timestamp, not a session-relative offset.
41#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
42#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
43pub struct RealtimeDtmfEvent {
44    pub event: String,
45    #[serde(skip_serializing_if = "Option::is_none")]
46    pub received_at: Option<f64>,
47    #[serde(default, flatten)]
48    pub rest: Rest,
49}