1use super::wire::present_nullable;
6use super::{LogProbProperties, TranscriptionLanguage};
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 ConversationItemInputAudioTranscriptionCompletedEvent {
15 pub content_index: i64,
16 pub event_id: String,
17 pub item_id: String,
18 pub transcript: String,
19 #[serde(rename = "type")]
20 pub type_: ConversationItemInputAudioTranscriptionCompletedEventType,
21 pub usage: ConversationItemInputAudioTranscriptionCompletedEventUsage,
22 #[serde(
23 default,
24 deserialize_with = "present_nullable",
25 skip_serializing_if = "Option::is_none"
26 )]
27 pub languages: Option<Option<Vec<TranscriptionLanguage>>>,
28 #[serde(
29 default,
30 deserialize_with = "present_nullable",
31 skip_serializing_if = "Option::is_none"
32 )]
33 pub logprobs: Option<Option<Vec<LogProbProperties>>>,
34 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
35 pub rest: Rest,
36}
37
38#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
40#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
41#[derive(gproxy_protocol_macros::DeclaredFields)]
42pub struct ConversationItemInputAudioTranscriptionDeltaEvent {
43 pub event_id: String,
44 pub item_id: String,
45 #[serde(rename = "type")]
46 pub type_: ConversationItemInputAudioTranscriptionDeltaEventType,
47 #[serde(
48 default,
49 deserialize_with = "present_nullable",
50 skip_serializing_if = "Option::is_none"
51 )]
52 pub content_index: Option<Option<i64>>,
53 #[serde(
54 default,
55 deserialize_with = "present_nullable",
56 skip_serializing_if = "Option::is_none"
57 )]
58 pub delta: Option<Option<String>>,
59 #[serde(
60 default,
61 deserialize_with = "present_nullable",
62 skip_serializing_if = "Option::is_none"
63 )]
64 pub logprobs: Option<Option<Vec<LogProbProperties>>>,
65 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
66 pub rest: Rest,
67}
68
69#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
71#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
72#[derive(gproxy_protocol_macros::DeclaredFields)]
73pub struct ConversationItemInputAudioTranscriptionFailedEvent {
74 pub content_index: i64,
75 pub error: ConversationItemInputAudioTranscriptionFailedEventError,
76 pub event_id: String,
77 pub item_id: String,
78 #[serde(rename = "type")]
79 pub type_: ConversationItemInputAudioTranscriptionFailedEventType,
80 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
81 pub rest: Rest,
82}
83
84#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
86#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
87#[derive(gproxy_protocol_macros::DeclaredFields)]
88pub struct ConversationItemInputAudioTranscriptionSegment {
89 pub id: String,
90 pub content_index: i64,
91 pub end: serde_json::Number,
92 pub event_id: String,
93 pub item_id: String,
94 pub speaker: String,
95 pub start: serde_json::Number,
96 pub text: String,
97 #[serde(rename = "type")]
98 pub type_: ConversationItemInputAudioTranscriptionSegmentType,
99 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
100 pub rest: Rest,
101}
102
103#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
105#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
106#[serde(untagged)]
107#[derive(gproxy_protocol_macros::DeclaredFields)]
108pub enum ConversationItemInputAudioTranscriptionCompletedEventUsage {
109 ConversationItemInputAudioTranscriptionCompletedEventUsageTranscriptTextUsageTokens(
110 ConversationItemInputAudioTranscriptionCompletedEventUsageTranscriptTextUsageTokens,
111 ),
112 ConversationItemInputAudioTranscriptionCompletedEventUsageTranscriptTextUsageDuration(
113 ConversationItemInputAudioTranscriptionCompletedEventUsageTranscriptTextUsageDuration,
114 ),
115}
116
117#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
119#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
120#[derive(gproxy_protocol_macros::DeclaredFields)]
121pub struct ConversationItemInputAudioTranscriptionFailedEventError {
122 #[serde(
123 default,
124 deserialize_with = "present_nullable",
125 skip_serializing_if = "Option::is_none"
126 )]
127 pub code: Option<Option<String>>,
128 #[serde(
129 default,
130 deserialize_with = "present_nullable",
131 skip_serializing_if = "Option::is_none"
132 )]
133 pub message: Option<Option<String>>,
134 #[serde(
135 default,
136 deserialize_with = "present_nullable",
137 skip_serializing_if = "Option::is_none"
138 )]
139 pub param: Option<Option<String>>,
140 #[serde(rename = "type")]
141 #[serde(
142 default,
143 deserialize_with = "present_nullable",
144 skip_serializing_if = "Option::is_none"
145 )]
146 pub type_: Option<Option<String>>,
147 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
148 pub rest: Rest,
149}
150
151#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
153#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
154#[derive(gproxy_protocol_macros::DeclaredFields)]
155pub struct ConversationItemInputAudioTranscriptionCompletedEventUsageTranscriptTextUsageTokens {
156 pub input_tokens: i64,
157 pub output_tokens: i64,
158 pub total_tokens: i64,
159 #[serde(rename = "type")]
160 pub type_: ConversationItemInputAudioTranscriptionCompletedEventUsageTranscriptTextUsageTokensType,
161 #[serde(default, deserialize_with = "present_nullable", skip_serializing_if = "Option::is_none")]
162 pub input_token_details: Option<Option<ConversationItemInputAudioTranscriptionCompletedEventUsageTranscriptTextUsageTokensInputTokenDetails>>,
163 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
164 pub rest: Rest,
165}
166
167#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
169#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
170#[derive(gproxy_protocol_macros::DeclaredFields)]
171pub struct ConversationItemInputAudioTranscriptionCompletedEventUsageTranscriptTextUsageDuration {
172 pub seconds: serde_json::Number,
173 #[serde(rename = "type")]
174 pub type_:
175 ConversationItemInputAudioTranscriptionCompletedEventUsageTranscriptTextUsageDurationType,
176 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
177 pub rest: Rest,
178}
179
180#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
182#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
183#[derive(gproxy_protocol_macros::DeclaredFields)]
184pub struct ConversationItemInputAudioTranscriptionCompletedEventUsageTranscriptTextUsageTokensInputTokenDetails
185{
186 #[serde(
187 default,
188 deserialize_with = "present_nullable",
189 skip_serializing_if = "Option::is_none"
190 )]
191 pub audio_tokens: Option<Option<i64>>,
192 #[serde(
193 default,
194 deserialize_with = "present_nullable",
195 skip_serializing_if = "Option::is_none"
196 )]
197 pub text_tokens: Option<Option<i64>>,
198 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
199 pub rest: Rest,
200}
201
202#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
203#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
204#[derive(gproxy_protocol_macros::DeclaredFields)]
205pub enum ConversationItemInputAudioTranscriptionCompletedEventType {
206 #[serde(rename = "conversation.item.input_audio_transcription.completed")]
207 ConversationItemInputAudioTranscriptionCompleted,
208}
209
210#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
211#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
212#[derive(gproxy_protocol_macros::DeclaredFields)]
213pub enum ConversationItemInputAudioTranscriptionDeltaEventType {
214 #[serde(rename = "conversation.item.input_audio_transcription.delta")]
215 ConversationItemInputAudioTranscriptionDelta,
216}
217
218#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
219#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
220#[derive(gproxy_protocol_macros::DeclaredFields)]
221pub enum ConversationItemInputAudioTranscriptionFailedEventType {
222 #[serde(rename = "conversation.item.input_audio_transcription.failed")]
223 ConversationItemInputAudioTranscriptionFailed,
224}
225
226#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
227#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
228#[derive(gproxy_protocol_macros::DeclaredFields)]
229pub enum ConversationItemInputAudioTranscriptionSegmentType {
230 #[serde(rename = "conversation.item.input_audio_transcription.segment")]
231 ConversationItemInputAudioTranscriptionSegment,
232}
233
234#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
235#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
236#[derive(gproxy_protocol_macros::DeclaredFields)]
237pub enum ConversationItemInputAudioTranscriptionCompletedEventUsageTranscriptTextUsageTokensType {
238 #[serde(rename = "tokens")]
239 Tokens,
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)]
245pub enum ConversationItemInputAudioTranscriptionCompletedEventUsageTranscriptTextUsageDurationType {
246 #[serde(rename = "duration")]
247 Duration,
248}