1use serde::{Deserialize, Serialize};
2
3use crate::types::responses::{OutputContent, OutputItem, Response, ResponseLogProb, SummaryPart};
4
5#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
7#[serde(tag = "type")]
8pub enum ResponseStreamEvent {
9 #[serde(rename = "response.created")]
11 ResponseCreated(ResponseCreatedEvent),
12 #[serde(rename = "response.in_progress")]
14 ResponseInProgress(ResponseInProgressEvent),
15 #[serde(rename = "response.completed")]
17 ResponseCompleted(ResponseCompletedEvent),
18 #[serde(rename = "response.failed")]
20 ResponseFailed(ResponseFailedEvent),
21 #[serde(rename = "response.incomplete")]
23 ResponseIncomplete(ResponseIncompleteEvent),
24 #[serde(rename = "response.output_item.added")]
26 ResponseOutputItemAdded(ResponseOutputItemAddedEvent),
27 #[serde(rename = "response.output_item.done")]
29 ResponseOutputItemDone(ResponseOutputItemDoneEvent),
30 #[serde(rename = "response.content_part.added")]
32 ResponseContentPartAdded(ResponseContentPartAddedEvent),
33 #[serde(rename = "response.content_part.done")]
35 ResponseContentPartDone(ResponseContentPartDoneEvent),
36 #[serde(rename = "response.output_text.delta")]
38 ResponseOutputTextDelta(ResponseTextDeltaEvent),
39 #[serde(rename = "response.output_text.done")]
41 ResponseOutputTextDone(ResponseTextDoneEvent),
42 #[serde(rename = "response.refusal.delta")]
44 ResponseRefusalDelta(ResponseRefusalDeltaEvent),
45 #[serde(rename = "response.refusal.done")]
46 ResponseRefusalDone(ResponseRefusalDoneEvent),
48 #[serde(rename = "response.function_call_arguments.delta")]
50 ResponseFunctionCallArgumentsDelta(ResponseFunctionCallArgumentsDeltaEvent),
51 #[serde(rename = "response.function_call_arguments.done")]
53 ResponseFunctionCallArgumentsDone(ResponseFunctionCallArgumentsDoneEvent),
54 #[serde(rename = "response.file_search_call.in_progress")]
56 ResponseFileSearchCallInProgress(ResponseFileSearchCallInProgressEvent),
57 #[serde(rename = "response.file_search_call.searching")]
59 ResponseFileSearchCallSearching(ResponseFileSearchCallSearchingEvent),
60 #[serde(rename = "response.file_search_call.completed")]
62 ResponseFileSearchCallCompleted(ResponseFileSearchCallCompletedEvent),
63 #[serde(rename = "response.web_search_call.in_progress")]
65 ResponseWebSearchCallInProgress(ResponseWebSearchCallInProgressEvent),
66 #[serde(rename = "response.web_search_call.searching")]
68 ResponseWebSearchCallSearching(ResponseWebSearchCallSearchingEvent),
69 #[serde(rename = "response.web_search_call.completed")]
71 ResponseWebSearchCallCompleted(ResponseWebSearchCallCompletedEvent),
72 #[serde(rename = "response.reasoning_summary_part.added")]
74 ResponseReasoningSummaryPartAdded(ResponseReasoningSummaryPartAddedEvent),
75 #[serde(rename = "response.reasoning_summary_part.done")]
77 ResponseReasoningSummaryPartDone(ResponseReasoningSummaryPartDoneEvent),
78 #[serde(rename = "response.reasoning_summary_text.delta")]
80 ResponseReasoningSummaryTextDelta(ResponseReasoningSummaryTextDeltaEvent),
81 #[serde(rename = "response.reasoning_summary_text.done")]
83 ResponseReasoningSummaryTextDone(ResponseReasoningSummaryTextDoneEvent),
84 #[serde(rename = "response.reasoning_text.delta")]
86 ResponseReasoningTextDelta(ResponseReasoningTextDeltaEvent),
87 #[serde(rename = "response.reasoning_text.done")]
89 ResponseReasoningTextDone(ResponseReasoningTextDoneEvent),
90 #[serde(rename = "response.image_generation_call.completed")]
92 ResponseImageGenerationCallCompleted(ResponseImageGenCallCompletedEvent),
93 #[serde(rename = "response.image_generation_call.generating")]
95 ResponseImageGenerationCallGenerating(ResponseImageGenCallGeneratingEvent),
96 #[serde(rename = "response.image_generation_call.in_progress")]
98 ResponseImageGenerationCallInProgress(ResponseImageGenCallInProgressEvent),
99 #[serde(rename = "response.image_generation_call.partial_image")]
101 ResponseImageGenerationCallPartialImage(ResponseImageGenCallPartialImageEvent),
102 #[serde(rename = "response.mcp_call_arguments.delta")]
104 ResponseMCPCallArgumentsDelta(ResponseMCPCallArgumentsDeltaEvent),
105 #[serde(rename = "response.mcp_call_arguments.done")]
107 ResponseMCPCallArgumentsDone(ResponseMCPCallArgumentsDoneEvent),
108 #[serde(rename = "response.mcp_call.completed")]
110 ResponseMCPCallCompleted(ResponseMCPCallCompletedEvent),
111 #[serde(rename = "response.mcp_call.failed")]
113 ResponseMCPCallFailed(ResponseMCPCallFailedEvent),
114 #[serde(rename = "response.mcp_call.in_progress")]
116 ResponseMCPCallInProgress(ResponseMCPCallInProgressEvent),
117 #[serde(rename = "response.mcp_list_tools.completed")]
119 ResponseMCPListToolsCompleted(ResponseMCPListToolsCompletedEvent),
120 #[serde(rename = "response.mcp_list_tools.failed")]
122 ResponseMCPListToolsFailed(ResponseMCPListToolsFailedEvent),
123 #[serde(rename = "response.mcp_list_tools.in_progress")]
125 ResponseMCPListToolsInProgress(ResponseMCPListToolsInProgressEvent),
126 #[serde(rename = "response.code_interpreter_call.in_progress")]
128 ResponseCodeInterpreterCallInProgress(ResponseCodeInterpreterCallInProgressEvent),
129 #[serde(rename = "response.code_interpreter_call.interpreting")]
131 ResponseCodeInterpreterCallInterpreting(ResponseCodeInterpreterCallInterpretingEvent),
132 #[serde(rename = "response.code_interpreter_call.completed")]
134 ResponseCodeInterpreterCallCompleted(ResponseCodeInterpreterCallCompletedEvent),
135 #[serde(rename = "response.code_interpreter_call_code.delta")]
137 ResponseCodeInterpreterCallCodeDelta(ResponseCodeInterpreterCallCodeDeltaEvent),
138 #[serde(rename = "response.code_interpreter_call_code.done")]
140 ResponseCodeInterpreterCallCodeDone(ResponseCodeInterpreterCallCodeDoneEvent),
141 #[serde(rename = "response.output_text.annotation.added")]
143 ResponseOutputTextAnnotationAdded(ResponseOutputTextAnnotationAddedEvent),
144 #[serde(rename = "response.queued")]
146 ResponseQueued(ResponseQueuedEvent),
147 #[serde(rename = "response.custom_tool_call_input.delta")]
149 ResponseCustomToolCallInputDelta(ResponseCustomToolCallInputDeltaEvent),
150 #[serde(rename = "response.custom_tool_call_input.done")]
152 ResponseCustomToolCallInputDone(ResponseCustomToolCallInputDoneEvent),
153 #[serde(rename = "error")]
155 ResponseError(ResponseErrorEvent),
156}
157
158#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
159pub struct ResponseCreatedEvent {
160 pub sequence_number: u64,
161 pub response: Response,
162}
163
164#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
165pub struct ResponseInProgressEvent {
166 pub sequence_number: u64,
167 pub response: Response,
168}
169
170#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
171pub struct ResponseCompletedEvent {
172 pub sequence_number: u64,
173 pub response: Response,
174}
175
176#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
177pub struct ResponseFailedEvent {
178 pub sequence_number: u64,
179 pub response: Response,
180}
181
182#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
183pub struct ResponseIncompleteEvent {
184 pub sequence_number: u64,
185 pub response: Response,
186}
187
188#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
189pub struct ResponseOutputItemAddedEvent {
190 pub sequence_number: u64,
191 pub output_index: u32,
192 pub item: OutputItem,
193}
194
195#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
196pub struct ResponseOutputItemDoneEvent {
197 pub sequence_number: u64,
198 pub output_index: u32,
199 pub item: OutputItem,
200}
201
202#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
203pub struct ResponseContentPartAddedEvent {
204 pub sequence_number: u64,
205 pub item_id: String,
206 pub output_index: u32,
207 pub content_index: u32,
208 pub part: OutputContent,
209}
210
211#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
212pub struct ResponseContentPartDoneEvent {
213 pub sequence_number: u64,
214 pub item_id: String,
215 pub output_index: u32,
216 pub content_index: u32,
217 pub part: OutputContent,
218}
219
220#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
221pub struct ResponseTextDeltaEvent {
222 pub sequence_number: u64,
223 pub item_id: String,
224 pub output_index: u32,
225 pub content_index: u32,
226 pub delta: String,
227 #[serde(default, skip_serializing_if = "Option::is_none")]
228 pub logprobs: Option<Vec<ResponseLogProb>>,
229}
230
231#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
232pub struct ResponseTextDoneEvent {
233 pub sequence_number: u64,
234 pub item_id: String,
235 pub output_index: u32,
236 pub content_index: u32,
237 pub text: String,
238 pub logprobs: Option<Vec<ResponseLogProb>>,
239}
240
241#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
242pub struct ResponseRefusalDeltaEvent {
243 pub sequence_number: u64,
244 pub item_id: String,
245 pub output_index: u32,
246 pub content_index: u32,
247 pub delta: String,
248}
249
250#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
251pub struct ResponseRefusalDoneEvent {
252 pub sequence_number: u64,
253 pub item_id: String,
254 pub output_index: u32,
255 pub content_index: u32,
256 pub refusal: String,
257}
258
259#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
260pub struct ResponseFunctionCallArgumentsDeltaEvent {
261 pub sequence_number: u64,
262 pub item_id: String,
263 pub output_index: u32,
264 pub delta: String,
265}
266
267#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
268pub struct ResponseFunctionCallArgumentsDoneEvent {
269 pub name: Option<String>,
271 pub sequence_number: u64,
272 pub item_id: String,
273 pub output_index: u32,
274 pub arguments: String,
275}
276
277#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
278pub struct ResponseFileSearchCallInProgressEvent {
279 pub sequence_number: u64,
280 pub output_index: u32,
281 pub item_id: String,
282}
283
284#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
285pub struct ResponseFileSearchCallSearchingEvent {
286 pub sequence_number: u64,
287 pub output_index: u32,
288 pub item_id: String,
289}
290
291#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
292pub struct ResponseFileSearchCallCompletedEvent {
293 pub sequence_number: u64,
294 pub output_index: u32,
295 pub item_id: String,
296}
297
298#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
299pub struct ResponseWebSearchCallInProgressEvent {
300 pub sequence_number: u64,
301 pub output_index: u32,
302 pub item_id: String,
303}
304
305#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
306pub struct ResponseWebSearchCallSearchingEvent {
307 pub sequence_number: u64,
308 pub output_index: u32,
309 pub item_id: String,
310}
311
312#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
313pub struct ResponseWebSearchCallCompletedEvent {
314 pub sequence_number: u64,
315 pub output_index: u32,
316 pub item_id: String,
317}
318
319#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
320pub struct ResponseReasoningSummaryPartAddedEvent {
321 pub sequence_number: u64,
322 pub item_id: String,
323 pub output_index: u32,
324 pub summary_index: u32,
325 pub part: SummaryPart,
326}
327
328#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
329pub struct ResponseReasoningSummaryPartDoneEvent {
330 pub sequence_number: u64,
331 pub item_id: String,
332 pub output_index: u32,
333 pub summary_index: u32,
334 pub part: SummaryPart,
335}
336
337#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
338pub struct ResponseReasoningSummaryTextDeltaEvent {
339 pub sequence_number: u64,
340 pub item_id: String,
341 pub output_index: u32,
342 pub summary_index: u32,
343 pub delta: String,
344}
345
346#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
347pub struct ResponseReasoningSummaryTextDoneEvent {
348 pub sequence_number: u64,
349 pub item_id: String,
350 pub output_index: u32,
351 pub summary_index: u32,
352 pub text: String,
353}
354
355#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
356pub struct ResponseReasoningTextDeltaEvent {
357 pub sequence_number: u64,
358 pub item_id: String,
359 pub output_index: u32,
360 pub content_index: u32,
361 pub delta: String,
362}
363
364#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
365pub struct ResponseReasoningTextDoneEvent {
366 pub sequence_number: u64,
367 pub item_id: String,
368 pub output_index: u32,
369 pub content_index: u32,
370 pub text: String,
371}
372
373#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
374pub struct ResponseImageGenCallCompletedEvent {
375 pub sequence_number: u64,
376 pub output_index: u32,
377 pub item_id: String,
378}
379
380#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
381pub struct ResponseImageGenCallGeneratingEvent {
382 pub sequence_number: u64,
383 pub output_index: u32,
384 pub item_id: String,
385}
386
387#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
388pub struct ResponseImageGenCallInProgressEvent {
389 pub sequence_number: u64,
390 pub output_index: u32,
391 pub item_id: String,
392}
393
394#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
395pub struct ResponseImageGenCallPartialImageEvent {
396 pub sequence_number: u64,
397 pub output_index: u32,
398 pub item_id: String,
399 pub partial_image_index: u32,
400 pub partial_image_b64: String,
401}
402
403#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
404pub struct ResponseMCPCallArgumentsDeltaEvent {
405 pub sequence_number: u64,
406 pub output_index: u32,
407 pub item_id: String,
408 pub delta: String,
409}
410
411#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
412pub struct ResponseMCPCallArgumentsDoneEvent {
413 pub sequence_number: u64,
414 pub output_index: u32,
415 pub item_id: String,
416 pub arguments: String,
417}
418
419#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
420pub struct ResponseMCPCallCompletedEvent {
421 pub sequence_number: u64,
422 pub output_index: u32,
423 pub item_id: String,
424}
425
426#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
427pub struct ResponseMCPCallFailedEvent {
428 pub sequence_number: u64,
429 pub output_index: u32,
430 pub item_id: String,
431}
432
433#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
434pub struct ResponseMCPCallInProgressEvent {
435 pub sequence_number: u64,
436 pub output_index: u32,
437 pub item_id: String,
438}
439
440#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
441pub struct ResponseMCPListToolsCompletedEvent {
442 pub sequence_number: u64,
443 pub output_index: u32,
444 pub item_id: String,
445}
446
447#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
448pub struct ResponseMCPListToolsFailedEvent {
449 pub sequence_number: u64,
450 pub output_index: u32,
451 pub item_id: String,
452}
453
454#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
455pub struct ResponseMCPListToolsInProgressEvent {
456 pub sequence_number: u64,
457 pub output_index: u32,
458 pub item_id: String,
459}
460
461#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
462pub struct ResponseCodeInterpreterCallInProgressEvent {
463 pub sequence_number: u64,
464 pub output_index: u32,
465 pub item_id: String,
466}
467
468#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
469pub struct ResponseCodeInterpreterCallInterpretingEvent {
470 pub sequence_number: u64,
471 pub output_index: u32,
472 pub item_id: String,
473}
474
475#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
476pub struct ResponseCodeInterpreterCallCompletedEvent {
477 pub sequence_number: u64,
478 pub output_index: u32,
479 pub item_id: String,
480}
481
482#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
483pub struct ResponseCodeInterpreterCallCodeDeltaEvent {
484 pub sequence_number: u64,
485 pub output_index: u32,
486 pub item_id: String,
487 pub delta: String,
488}
489
490#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
491pub struct ResponseCodeInterpreterCallCodeDoneEvent {
492 pub sequence_number: u64,
493 pub output_index: u32,
494 pub item_id: String,
495 pub code: String,
496}
497
498#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
499pub struct ResponseOutputTextAnnotationAddedEvent {
500 pub sequence_number: u64,
501 pub output_index: u32,
502 pub content_index: u32,
503 pub annotation_index: u32,
504 pub item_id: String,
505 pub annotation: serde_json::Value,
506}
507
508#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
509pub struct ResponseQueuedEvent {
510 pub sequence_number: u64,
511 pub response: Response,
512}
513
514#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
515pub struct ResponseCustomToolCallInputDeltaEvent {
516 pub sequence_number: u64,
517 pub output_index: u32,
518 pub item_id: String,
519 pub delta: String,
520}
521
522#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
523pub struct ResponseCustomToolCallInputDoneEvent {
524 pub sequence_number: u64,
525 pub output_index: u32,
526 pub item_id: String,
527 pub input: String,
528}
529
530#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
531pub struct ResponseErrorEvent {
532 pub sequence_number: u64,
533 pub code: Option<String>,
534 pub message: String,
535 pub param: Option<String>,
536}
537
538#[cfg(feature = "_api")]
540pub type ResponseStream = std::pin::Pin<
541 Box<dyn futures::Stream<Item = Result<ResponseStreamEvent, crate::error::OpenAIError>> + Send>,
542>;
543
544#[cfg(feature = "_api")]
546macro_rules! impl_event_type {
547 ($($ty:ty => $event_type:expr),* $(,)?) => {
548 $(
549 impl crate::traits::EventType for $ty {
550 fn event_type(&self) -> &'static str {
551 $event_type
552 }
553 }
554 )*
555 };
556}
557
558#[cfg(feature = "_api")]
560impl_event_type! {
561 ResponseCreatedEvent => "response.created",
562 ResponseInProgressEvent => "response.in_progress",
563 ResponseCompletedEvent => "response.completed",
564 ResponseFailedEvent => "response.failed",
565 ResponseIncompleteEvent => "response.incomplete",
566 ResponseOutputItemAddedEvent => "response.output_item.added",
567 ResponseOutputItemDoneEvent => "response.output_item.done",
568 ResponseContentPartAddedEvent => "response.content_part.added",
569 ResponseContentPartDoneEvent => "response.content_part.done",
570 ResponseTextDeltaEvent => "response.output_text.delta",
571 ResponseTextDoneEvent => "response.output_text.done",
572 ResponseRefusalDeltaEvent => "response.refusal.delta",
573 ResponseRefusalDoneEvent => "response.refusal.done",
574 ResponseFunctionCallArgumentsDeltaEvent => "response.function_call_arguments.delta",
575 ResponseFunctionCallArgumentsDoneEvent => "response.function_call_arguments.done",
576 ResponseFileSearchCallInProgressEvent => "response.file_search_call.in_progress",
577 ResponseFileSearchCallSearchingEvent => "response.file_search_call.searching",
578 ResponseFileSearchCallCompletedEvent => "response.file_search_call.completed",
579 ResponseWebSearchCallInProgressEvent => "response.web_search_call.in_progress",
580 ResponseWebSearchCallSearchingEvent => "response.web_search_call.searching",
581 ResponseWebSearchCallCompletedEvent => "response.web_search_call.completed",
582 ResponseReasoningSummaryPartAddedEvent => "response.reasoning_summary_part.added",
583 ResponseReasoningSummaryPartDoneEvent => "response.reasoning_summary_part.done",
584 ResponseReasoningSummaryTextDeltaEvent => "response.reasoning_summary_text.delta",
585 ResponseReasoningSummaryTextDoneEvent => "response.reasoning_summary_text.done",
586 ResponseReasoningTextDeltaEvent => "response.reasoning_text.delta",
587 ResponseReasoningTextDoneEvent => "response.reasoning_text.done",
588 ResponseImageGenCallCompletedEvent => "response.image_generation_call.completed",
589 ResponseImageGenCallGeneratingEvent => "response.image_generation_call.generating",
590 ResponseImageGenCallInProgressEvent => "response.image_generation_call.in_progress",
591 ResponseImageGenCallPartialImageEvent => "response.image_generation_call.partial_image",
592 ResponseMCPCallArgumentsDeltaEvent => "response.mcp_call_arguments.delta",
593 ResponseMCPCallArgumentsDoneEvent => "response.mcp_call_arguments.done",
594 ResponseMCPCallCompletedEvent => "response.mcp_call.completed",
595 ResponseMCPCallFailedEvent => "response.mcp_call.failed",
596 ResponseMCPCallInProgressEvent => "response.mcp_call.in_progress",
597 ResponseMCPListToolsCompletedEvent => "response.mcp_list_tools.completed",
598 ResponseMCPListToolsFailedEvent => "response.mcp_list_tools.failed",
599 ResponseMCPListToolsInProgressEvent => "response.mcp_list_tools.in_progress",
600 ResponseCodeInterpreterCallInProgressEvent => "response.code_interpreter_call.in_progress",
601 ResponseCodeInterpreterCallInterpretingEvent => "response.code_interpreter_call.interpreting",
602 ResponseCodeInterpreterCallCompletedEvent => "response.code_interpreter_call.completed",
603 ResponseCodeInterpreterCallCodeDeltaEvent => "response.code_interpreter_call_code.delta",
604 ResponseCodeInterpreterCallCodeDoneEvent => "response.code_interpreter_call_code.done",
605 ResponseOutputTextAnnotationAddedEvent => "response.output_text.annotation.added",
606 ResponseQueuedEvent => "response.queued",
607 ResponseCustomToolCallInputDeltaEvent => "response.custom_tool_call_input.delta",
608 ResponseCustomToolCallInputDoneEvent => "response.custom_tool_call_input.done",
609 ResponseErrorEvent => "error",
610}
611
612#[cfg(feature = "_api")]
613impl crate::traits::EventType for ResponseStreamEvent {
614 fn event_type(&self) -> &'static str {
615 match self {
616 ResponseStreamEvent::ResponseCreated(event) => event.event_type(),
617 ResponseStreamEvent::ResponseInProgress(event) => event.event_type(),
618 ResponseStreamEvent::ResponseCompleted(event) => event.event_type(),
619 ResponseStreamEvent::ResponseFailed(event) => event.event_type(),
620 ResponseStreamEvent::ResponseIncomplete(event) => event.event_type(),
621 ResponseStreamEvent::ResponseOutputItemAdded(event) => event.event_type(),
622 ResponseStreamEvent::ResponseOutputItemDone(event) => event.event_type(),
623 ResponseStreamEvent::ResponseContentPartAdded(event) => event.event_type(),
624 ResponseStreamEvent::ResponseContentPartDone(event) => event.event_type(),
625 ResponseStreamEvent::ResponseOutputTextDelta(event) => event.event_type(),
626 ResponseStreamEvent::ResponseOutputTextDone(event) => event.event_type(),
627 ResponseStreamEvent::ResponseRefusalDelta(event) => event.event_type(),
628 ResponseStreamEvent::ResponseRefusalDone(event) => event.event_type(),
629 ResponseStreamEvent::ResponseFunctionCallArgumentsDelta(event) => event.event_type(),
630 ResponseStreamEvent::ResponseFunctionCallArgumentsDone(event) => event.event_type(),
631 ResponseStreamEvent::ResponseFileSearchCallInProgress(event) => event.event_type(),
632 ResponseStreamEvent::ResponseFileSearchCallSearching(event) => event.event_type(),
633 ResponseStreamEvent::ResponseFileSearchCallCompleted(event) => event.event_type(),
634 ResponseStreamEvent::ResponseWebSearchCallInProgress(event) => event.event_type(),
635 ResponseStreamEvent::ResponseWebSearchCallSearching(event) => event.event_type(),
636 ResponseStreamEvent::ResponseWebSearchCallCompleted(event) => event.event_type(),
637 ResponseStreamEvent::ResponseReasoningSummaryPartAdded(event) => event.event_type(),
638 ResponseStreamEvent::ResponseReasoningSummaryPartDone(event) => event.event_type(),
639 ResponseStreamEvent::ResponseReasoningSummaryTextDelta(event) => event.event_type(),
640 ResponseStreamEvent::ResponseReasoningSummaryTextDone(event) => event.event_type(),
641 ResponseStreamEvent::ResponseReasoningTextDelta(event) => event.event_type(),
642 ResponseStreamEvent::ResponseReasoningTextDone(event) => event.event_type(),
643 ResponseStreamEvent::ResponseImageGenerationCallCompleted(event) => event.event_type(),
644 ResponseStreamEvent::ResponseImageGenerationCallGenerating(event) => event.event_type(),
645 ResponseStreamEvent::ResponseImageGenerationCallInProgress(event) => event.event_type(),
646 ResponseStreamEvent::ResponseImageGenerationCallPartialImage(event) => {
647 event.event_type()
648 }
649 ResponseStreamEvent::ResponseMCPCallArgumentsDelta(event) => event.event_type(),
650 ResponseStreamEvent::ResponseMCPCallArgumentsDone(event) => event.event_type(),
651 ResponseStreamEvent::ResponseMCPCallCompleted(event) => event.event_type(),
652 ResponseStreamEvent::ResponseMCPCallFailed(event) => event.event_type(),
653 ResponseStreamEvent::ResponseMCPCallInProgress(event) => event.event_type(),
654 ResponseStreamEvent::ResponseMCPListToolsCompleted(event) => event.event_type(),
655 ResponseStreamEvent::ResponseMCPListToolsFailed(event) => event.event_type(),
656 ResponseStreamEvent::ResponseMCPListToolsInProgress(event) => event.event_type(),
657 ResponseStreamEvent::ResponseCodeInterpreterCallInProgress(event) => event.event_type(),
658 ResponseStreamEvent::ResponseCodeInterpreterCallInterpreting(event) => {
659 event.event_type()
660 }
661 ResponseStreamEvent::ResponseCodeInterpreterCallCompleted(event) => event.event_type(),
662 ResponseStreamEvent::ResponseCodeInterpreterCallCodeDelta(event) => event.event_type(),
663 ResponseStreamEvent::ResponseCodeInterpreterCallCodeDone(event) => event.event_type(),
664 ResponseStreamEvent::ResponseOutputTextAnnotationAdded(event) => event.event_type(),
665 ResponseStreamEvent::ResponseQueued(event) => event.event_type(),
666 ResponseStreamEvent::ResponseCustomToolCallInputDelta(event) => event.event_type(),
667 ResponseStreamEvent::ResponseCustomToolCallInputDone(event) => event.event_type(),
668 ResponseStreamEvent::ResponseError(event) => event.event_type(),
669 }
670 }
671}