1use serde::{Deserialize, Serialize};
2
3use crate::types::responses::{
4 Annotation, FunctionShellCallOutputContent, OutputContent, OutputItem, Response,
5 ResponseLogProb, SummaryPart,
6};
7
8#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
10#[serde(tag = "type")]
11pub enum ResponseStreamEvent {
12 #[serde(rename = "response.compaction.compacting")]
13 CompactionCompacting(ResponseCompactionCompactingEvent),
14 #[serde(rename = "response.audio.delta")]
16 ResponseAudioDelta(ResponseAudioDeltaEvent),
17 #[serde(rename = "response.audio.done")]
19 ResponseAudioDone(ResponseAudioDoneEvent),
20 #[serde(rename = "response.audio.transcript.delta")]
22 ResponseAudioTranscriptDelta(ResponseAudioTranscriptDeltaEvent),
23 #[serde(rename = "response.audio.transcript.done")]
25 ResponseAudioTranscriptDone(ResponseAudioTranscriptDoneEvent),
26 #[serde(rename = "response.created")]
28 ResponseCreated(ResponseCreatedEvent),
29 #[serde(rename = "response.in_progress")]
31 ResponseInProgress(ResponseInProgressEvent),
32 #[serde(rename = "response.completed")]
34 ResponseCompleted(ResponseCompletedEvent),
35 #[serde(rename = "response.failed")]
37 ResponseFailed(ResponseFailedEvent),
38 #[serde(rename = "response.incomplete")]
40 ResponseIncomplete(ResponseIncompleteEvent),
41 #[serde(rename = "response.output_item.added")]
43 ResponseOutputItemAdded(ResponseOutputItemAddedEvent),
44 #[serde(rename = "response.output_item.done")]
46 ResponseOutputItemDone(ResponseOutputItemDoneEvent),
47 #[serde(rename = "response.content_part.added")]
49 ResponseContentPartAdded(ResponseContentPartAddedEvent),
50 #[serde(rename = "response.content_part.done")]
52 ResponseContentPartDone(ResponseContentPartDoneEvent),
53 #[serde(rename = "response.output_text.delta")]
55 ResponseOutputTextDelta(ResponseTextDeltaEvent),
56 #[serde(rename = "response.output_text.done")]
58 ResponseOutputTextDone(ResponseTextDoneEvent),
59 #[serde(rename = "response.refusal.delta")]
61 ResponseRefusalDelta(ResponseRefusalDeltaEvent),
62 #[serde(rename = "response.refusal.done")]
63 ResponseRefusalDone(ResponseRefusalDoneEvent),
65 #[serde(rename = "response.function_call_arguments.delta")]
67 ResponseFunctionCallArgumentsDelta(ResponseFunctionCallArgumentsDeltaEvent),
68 #[serde(rename = "response.function_call_arguments.done")]
70 ResponseFunctionCallArgumentsDone(ResponseFunctionCallArgumentsDoneEvent),
71 #[serde(rename = "response.file_search_call.in_progress")]
73 ResponseFileSearchCallInProgress(ResponseFileSearchCallInProgressEvent),
74 #[serde(rename = "response.file_search_call.searching")]
76 ResponseFileSearchCallSearching(ResponseFileSearchCallSearchingEvent),
77 #[serde(rename = "response.file_search_call.completed")]
79 ResponseFileSearchCallCompleted(ResponseFileSearchCallCompletedEvent),
80 #[serde(rename = "response.web_search_call.in_progress")]
82 ResponseWebSearchCallInProgress(ResponseWebSearchCallInProgressEvent),
83 #[serde(rename = "response.web_search_call.searching")]
85 ResponseWebSearchCallSearching(ResponseWebSearchCallSearchingEvent),
86 #[serde(rename = "response.web_search_call.completed")]
88 ResponseWebSearchCallCompleted(ResponseWebSearchCallCompletedEvent),
89 #[serde(rename = "response.reasoning_summary_part.added")]
91 ResponseReasoningSummaryPartAdded(ResponseReasoningSummaryPartAddedEvent),
92 #[serde(rename = "response.reasoning_summary_part.done")]
94 ResponseReasoningSummaryPartDone(ResponseReasoningSummaryPartDoneEvent),
95 #[serde(rename = "response.reasoning_summary_text.delta")]
97 ResponseReasoningSummaryTextDelta(ResponseReasoningSummaryTextDeltaEvent),
98 #[serde(rename = "response.reasoning_summary_text.done")]
100 ResponseReasoningSummaryTextDone(ResponseReasoningSummaryTextDoneEvent),
101 #[serde(rename = "response.reasoning_text.delta")]
103 ResponseReasoningTextDelta(ResponseReasoningTextDeltaEvent),
104 #[serde(rename = "response.reasoning_text.done")]
106 ResponseReasoningTextDone(ResponseReasoningTextDoneEvent),
107 #[serde(rename = "response.image_generation_call.completed")]
109 ResponseImageGenerationCallCompleted(ResponseImageGenCallCompletedEvent),
110 #[serde(rename = "response.image_generation_call.generating")]
112 ResponseImageGenerationCallGenerating(ResponseImageGenCallGeneratingEvent),
113 #[serde(rename = "response.image_generation_call.in_progress")]
115 ResponseImageGenerationCallInProgress(ResponseImageGenCallInProgressEvent),
116 #[serde(rename = "response.image_generation_call.partial_image")]
118 ResponseImageGenerationCallPartialImage(ResponseImageGenCallPartialImageEvent),
119 #[serde(rename = "response.mcp_call_arguments.delta")]
121 ResponseMCPCallArgumentsDelta(ResponseMCPCallArgumentsDeltaEvent),
122 #[serde(rename = "response.mcp_call_arguments.done")]
124 ResponseMCPCallArgumentsDone(ResponseMCPCallArgumentsDoneEvent),
125 #[serde(rename = "response.mcp_call.completed")]
127 ResponseMCPCallCompleted(ResponseMCPCallCompletedEvent),
128 #[serde(rename = "response.mcp_call.failed")]
130 ResponseMCPCallFailed(ResponseMCPCallFailedEvent),
131 #[serde(rename = "response.mcp_call.in_progress")]
133 ResponseMCPCallInProgress(ResponseMCPCallInProgressEvent),
134 #[serde(rename = "response.mcp_list_tools.completed")]
136 ResponseMCPListToolsCompleted(ResponseMCPListToolsCompletedEvent),
137 #[serde(rename = "response.mcp_list_tools.failed")]
139 ResponseMCPListToolsFailed(ResponseMCPListToolsFailedEvent),
140 #[serde(rename = "response.mcp_list_tools.in_progress")]
142 ResponseMCPListToolsInProgress(ResponseMCPListToolsInProgressEvent),
143 #[serde(rename = "response.code_interpreter_call.in_progress")]
145 ResponseCodeInterpreterCallInProgress(ResponseCodeInterpreterCallInProgressEvent),
146 #[serde(rename = "response.code_interpreter_call.interpreting")]
148 ResponseCodeInterpreterCallInterpreting(ResponseCodeInterpreterCallInterpretingEvent),
149 #[serde(rename = "response.code_interpreter_call.completed")]
151 ResponseCodeInterpreterCallCompleted(ResponseCodeInterpreterCallCompletedEvent),
152 #[serde(rename = "response.code_interpreter_call_code.delta")]
154 ResponseCodeInterpreterCallCodeDelta(ResponseCodeInterpreterCallCodeDeltaEvent),
155 #[serde(rename = "response.code_interpreter_call_code.done")]
157 ResponseCodeInterpreterCallCodeDone(ResponseCodeInterpreterCallCodeDoneEvent),
158 #[serde(rename = "response.output_text.annotation.added")]
160 ResponseOutputTextAnnotationAdded(ResponseOutputTextAnnotationAddedEvent),
161 #[serde(rename = "response.queued")]
163 ResponseQueued(ResponseQueuedEvent),
164 #[serde(rename = "response.custom_tool_call_input.delta")]
166 ResponseCustomToolCallInputDelta(ResponseCustomToolCallInputDeltaEvent),
167 #[serde(rename = "response.custom_tool_call_input.done")]
169 ResponseCustomToolCallInputDone(ResponseCustomToolCallInputDoneEvent),
170 #[serde(rename = "error")]
172 ResponseError(ResponseErrorEvent),
173 #[serde(rename = "response.shell_call_command.added")]
174 ResponseShellCallCommandAdded(ResponseShellCallCommandAddedStreamingEvent),
175 #[serde(rename = "response.shell_call_command.delta")]
176 ResponseShellCallCommandDelta(ResponseShellCallCommandDeltaStreamingEvent),
177 #[serde(rename = "response.shell_call_command.done")]
178 ResponseShellCallCommandDone(ResponseShellCallCommandDoneStreamingEvent),
179 #[serde(rename = "response.shell_call_output_content.delta")]
180 ResponseShellCallOutputContentDelta(ResponseShellCallOutputContentDeltaStreamingEvent),
181 #[serde(rename = "response.shell_call_output_content.done")]
182 ResponseShellCallOutputContentDone(ResponseShellCallOutputContentDoneStreamingEvent),
183}
184
185#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Default)]
187pub struct ResponseAudioDeltaEvent {
188 pub sequence_number: u64,
190 pub delta: String,
192}
193
194#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Default)]
196pub struct ResponseAudioDoneEvent {
197 pub sequence_number: u64,
199 pub response_id: String,
201}
202
203#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Default)]
205pub struct ResponseAudioTranscriptDeltaEvent {
206 pub delta: String,
208 pub sequence_number: u64,
210 pub response_id: String,
212}
213
214#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Default)]
216pub struct ResponseAudioTranscriptDoneEvent {
217 pub sequence_number: u64,
219 pub response_id: String,
221}
222
223#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
224pub struct ResponseCreatedEvent {
225 pub sequence_number: u64,
226 pub response: Response,
227}
228
229#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
230pub struct ResponseInProgressEvent {
231 pub sequence_number: u64,
232 pub response: Response,
233}
234
235#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
236pub struct ResponseCompletedEvent {
237 pub sequence_number: u64,
238 pub response: Response,
239}
240
241#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
242pub struct ResponseFailedEvent {
243 pub sequence_number: u64,
244 pub response: Response,
245}
246
247#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
248pub struct ResponseIncompleteEvent {
249 pub sequence_number: u64,
250 pub response: Response,
251}
252
253#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
254pub struct ResponseOutputItemAddedEvent {
255 pub sequence_number: u64,
256 pub output_index: u32,
257 pub item: OutputItem,
262}
263
264#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
265pub struct ResponseOutputItemDoneEvent {
266 pub sequence_number: u64,
267 pub output_index: u32,
268 pub item: OutputItem,
269}
270
271#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
272pub struct ResponseContentPartAddedEvent {
273 pub sequence_number: u64,
274 pub item_id: String,
275 pub output_index: u32,
276 pub content_index: u32,
277 pub part: OutputContent,
278}
279
280#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
281pub struct ResponseContentPartDoneEvent {
282 pub sequence_number: u64,
283 pub item_id: String,
284 pub output_index: u32,
285 pub content_index: u32,
286 pub part: OutputContent,
287}
288
289#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Default)]
290pub struct ResponseTextDeltaEvent {
291 pub sequence_number: u64,
292 pub item_id: String,
293 pub output_index: u32,
294 pub content_index: u32,
295 pub delta: String,
296 #[serde(default, skip_serializing_if = "Option::is_none")]
297 pub logprobs: Option<Vec<ResponseLogProb>>,
298}
299
300#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Default)]
301pub struct ResponseTextDoneEvent {
302 pub sequence_number: u64,
303 pub item_id: String,
304 pub output_index: u32,
305 pub content_index: u32,
306 pub text: String,
307 pub logprobs: Option<Vec<ResponseLogProb>>,
308}
309
310#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Default)]
311pub struct ResponseRefusalDeltaEvent {
312 pub sequence_number: u64,
313 pub item_id: String,
314 pub output_index: u32,
315 pub content_index: u32,
316 pub delta: String,
317}
318
319#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Default)]
320pub struct ResponseRefusalDoneEvent {
321 pub sequence_number: u64,
322 pub item_id: String,
323 pub output_index: u32,
324 pub content_index: u32,
325 pub refusal: String,
326}
327
328#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Default)]
329pub struct ResponseFunctionCallArgumentsDeltaEvent {
330 pub sequence_number: u64,
331 pub item_id: String,
332 pub output_index: u32,
333 pub delta: String,
334}
335
336#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Default)]
337pub struct ResponseFunctionCallArgumentsDoneEvent {
338 pub name: Option<String>,
340 pub sequence_number: u64,
341 pub item_id: String,
342 pub output_index: u32,
343 pub arguments: String,
344}
345
346#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Default)]
347pub struct ResponseFileSearchCallInProgressEvent {
348 pub sequence_number: u64,
349 pub output_index: u32,
350 pub item_id: String,
351}
352
353#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Default)]
354pub struct ResponseFileSearchCallSearchingEvent {
355 pub sequence_number: u64,
356 pub output_index: u32,
357 pub item_id: String,
358}
359
360#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Default)]
361pub struct ResponseFileSearchCallCompletedEvent {
362 pub sequence_number: u64,
363 pub output_index: u32,
364 pub item_id: String,
365}
366
367#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Default)]
368pub struct ResponseWebSearchCallInProgressEvent {
369 pub sequence_number: u64,
370 pub output_index: u32,
371 pub item_id: String,
372}
373
374#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Default)]
375pub struct ResponseWebSearchCallSearchingEvent {
376 pub sequence_number: u64,
377 pub output_index: u32,
378 pub item_id: String,
379}
380
381#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Default)]
382pub struct ResponseWebSearchCallCompletedEvent {
383 pub sequence_number: u64,
384 pub output_index: u32,
385 pub item_id: String,
386}
387
388#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
389pub struct ResponseReasoningSummaryPartAddedEvent {
390 pub sequence_number: u64,
391 pub item_id: String,
392 pub output_index: u32,
393 pub summary_index: u32,
394 pub part: SummaryPart,
395}
396
397#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
398pub struct ResponseReasoningSummaryPartDoneEvent {
399 pub sequence_number: u64,
400 pub item_id: String,
401 pub output_index: u32,
402 pub summary_index: u32,
403 pub part: SummaryPart,
404 #[serde(skip_serializing_if = "Option::is_none")]
407 pub status: Option<String>,
408}
409
410#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Default)]
411pub struct ResponseReasoningSummaryTextDeltaEvent {
412 pub sequence_number: u64,
413 pub item_id: String,
414 pub output_index: u32,
415 pub summary_index: u32,
416 pub delta: String,
417}
418
419#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Default)]
420pub struct ResponseReasoningSummaryTextDoneEvent {
421 pub sequence_number: u64,
422 pub item_id: String,
423 pub output_index: u32,
424 pub summary_index: u32,
425 pub text: String,
426}
427
428#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Default)]
429pub struct ResponseReasoningTextDeltaEvent {
430 pub sequence_number: u64,
431 pub item_id: String,
432 pub output_index: u32,
433 pub content_index: u32,
434 pub delta: String,
435}
436
437#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Default)]
438pub struct ResponseReasoningTextDoneEvent {
439 pub sequence_number: u64,
440 pub item_id: String,
441 pub output_index: u32,
442 pub content_index: u32,
443 pub text: String,
444}
445
446#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Default)]
447pub struct ResponseImageGenCallCompletedEvent {
448 pub sequence_number: u64,
449 pub output_index: u32,
450 pub item_id: String,
451}
452
453#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Default)]
454pub struct ResponseImageGenCallGeneratingEvent {
455 pub sequence_number: u64,
456 pub output_index: u32,
457 pub item_id: String,
458}
459
460#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Default)]
461pub struct ResponseImageGenCallInProgressEvent {
462 pub sequence_number: u64,
463 pub output_index: u32,
464 pub item_id: String,
465}
466
467#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Default)]
468pub struct ResponseImageGenCallPartialImageEvent {
469 pub sequence_number: u64,
470 pub output_index: u32,
471 pub item_id: String,
472 pub partial_image_index: u32,
473 pub partial_image_b64: String,
474 #[serde(skip_serializing_if = "Option::is_none")]
476 pub size: Option<String>,
477
478 #[serde(skip_serializing_if = "Option::is_none")]
480 pub quality: Option<String>,
481
482 #[serde(skip_serializing_if = "Option::is_none")]
484 pub background: Option<String>,
485
486 #[serde(skip_serializing_if = "Option::is_none")]
488 pub output_format: Option<String>,
489}
490
491#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Default)]
492pub struct ResponseMCPCallArgumentsDeltaEvent {
493 pub sequence_number: u64,
494 pub output_index: u32,
495 pub item_id: String,
496 pub delta: String,
497}
498
499#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Default)]
500pub struct ResponseMCPCallArgumentsDoneEvent {
501 pub sequence_number: u64,
502 pub output_index: u32,
503 pub item_id: String,
504 pub arguments: String,
505}
506
507#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Default)]
508pub struct ResponseMCPCallCompletedEvent {
509 pub sequence_number: u64,
510 pub output_index: u32,
511 pub item_id: String,
512}
513
514#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Default)]
515pub struct ResponseMCPCallFailedEvent {
516 pub sequence_number: u64,
517 pub output_index: u32,
518 pub item_id: String,
519}
520
521#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Default)]
522pub struct ResponseMCPCallInProgressEvent {
523 pub sequence_number: u64,
524 pub output_index: u32,
525 pub item_id: String,
526}
527
528#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Default)]
529pub struct ResponseMCPListToolsCompletedEvent {
530 pub sequence_number: u64,
531 pub output_index: u32,
532 pub item_id: String,
533}
534
535#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Default)]
536pub struct ResponseMCPListToolsFailedEvent {
537 pub sequence_number: u64,
538 pub output_index: u32,
539 pub item_id: String,
540}
541
542#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Default)]
543pub struct ResponseMCPListToolsInProgressEvent {
544 pub sequence_number: u64,
545 pub output_index: u32,
546 pub item_id: String,
547}
548
549#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Default)]
550pub struct ResponseCodeInterpreterCallInProgressEvent {
551 pub sequence_number: u64,
552 pub output_index: u32,
553 pub item_id: String,
554}
555
556#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Default)]
557pub struct ResponseCodeInterpreterCallInterpretingEvent {
558 pub sequence_number: u64,
559 pub output_index: u32,
560 pub item_id: String,
561}
562
563#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Default)]
564pub struct ResponseCodeInterpreterCallCompletedEvent {
565 pub sequence_number: u64,
566 pub output_index: u32,
567 pub item_id: String,
568}
569
570#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Default)]
571pub struct ResponseCodeInterpreterCallCodeDeltaEvent {
572 pub sequence_number: u64,
573 pub output_index: u32,
574 pub item_id: String,
575 pub delta: String,
576}
577
578#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Default)]
579pub struct ResponseCodeInterpreterCallCodeDoneEvent {
580 pub sequence_number: u64,
581 pub output_index: u32,
582 pub item_id: String,
583 pub code: String,
584}
585
586#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Default)]
587pub struct ResponseOutputTextAnnotationAddedEvent {
588 pub sequence_number: u64,
589 pub output_index: u32,
590 pub content_index: u32,
591 pub annotation_index: u32,
592 pub item_id: String,
593 pub annotation: Option<Annotation>,
594}
595
596#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
597pub struct ResponseQueuedEvent {
598 pub sequence_number: u64,
599 pub response: Response,
600}
601
602#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Default)]
603pub struct ResponseCustomToolCallInputDeltaEvent {
604 pub sequence_number: u64,
605 pub output_index: u32,
606 pub item_id: String,
607 pub delta: String,
608}
609
610#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Default)]
611pub struct ResponseCustomToolCallInputDoneEvent {
612 pub sequence_number: u64,
613 pub output_index: u32,
614 pub item_id: String,
615 pub input: String,
616}
617
618#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Default)]
619pub struct ResponseErrorEvent {
620 pub sequence_number: u64,
621 pub code: Option<String>,
622 pub message: String,
623 pub param: Option<String>,
624}
625
626#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
628pub struct ResponseShellCallCommandAddedStreamingEvent {
629 pub sequence_number: u64,
631 pub output_index: u32,
633 pub command_index: u32,
635 pub command: String,
637}
638
639#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
641pub struct ResponseShellCallCommandDeltaStreamingEvent {
642 pub sequence_number: u64,
644 pub output_index: u32,
646 pub command_index: u32,
648 pub delta: String,
650 #[serde(skip_serializing_if = "Option::is_none")]
652 pub obfuscation: Option<String>,
653}
654
655#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
657pub struct ResponseShellCallCommandDoneStreamingEvent {
658 pub sequence_number: u64,
660 pub output_index: u32,
662 pub command_index: u32,
664 pub command: String,
666}
667
668#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
670pub struct ResponseShellCallOutputContentDeltaStreamingEvent {
671 pub sequence_number: u64,
673 pub item_id: String,
675 pub output_index: u32,
677 pub command_index: u32,
679 pub delta: ShellCallOutputDelta,
681}
682
683#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
685pub struct ResponseShellCallOutputContentDoneStreamingEvent {
686 pub sequence_number: u64,
688 pub item_id: String,
690 pub output_index: u32,
692 pub command_index: u32,
694 pub output: Vec<FunctionShellCallOutputContent>,
696}
697
698#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
700pub struct ShellCallOutputDelta {
701 #[serde(skip_serializing_if = "Option::is_none")]
703 pub stdout: Option<String>,
704 #[serde(skip_serializing_if = "Option::is_none")]
706 pub stderr: Option<String>,
707}
708
709#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
710pub struct ResponseCompactionCompactingEvent {
711 pub sequence_number: u64,
712 pub output_index: u64,
713 pub item_id: String,
714}
715
716#[cfg(feature = "_api")]
718pub type ResponseStream = crate::types::stream::StreamResponse<ResponseStreamEvent>;
719
720#[cfg(feature = "_api")]
722macro_rules! impl_event_type {
723 ($($ty:ty => $event_type:expr),* $(,)?) => {
724 $(
725 impl crate::traits::EventType for $ty {
726 fn event_type(&self) -> &'static str {
727 $event_type
728 }
729 }
730 )*
731 };
732}
733
734#[cfg(feature = "_api")]
736impl_event_type! {
737 ResponseCompactionCompactingEvent => "response.compaction.compacting",
738 ResponseAudioDeltaEvent => "response.audio.delta",
739 ResponseAudioDoneEvent => "response.audio.done",
740 ResponseAudioTranscriptDeltaEvent => "response.audio.transcript.delta",
741 ResponseAudioTranscriptDoneEvent => "response.audio.transcript.done",
742 ResponseShellCallCommandAddedStreamingEvent => "response.shell_call_command.added",
743 ResponseShellCallCommandDeltaStreamingEvent => "response.shell_call_command.delta",
744 ResponseShellCallCommandDoneStreamingEvent => "response.shell_call_command.done",
745 ResponseShellCallOutputContentDeltaStreamingEvent => "response.shell_call_output_content.delta",
746 ResponseShellCallOutputContentDoneStreamingEvent => "response.shell_call_output_content.done",
747 ResponseCreatedEvent => "response.created",
748 ResponseInProgressEvent => "response.in_progress",
749 ResponseCompletedEvent => "response.completed",
750 ResponseFailedEvent => "response.failed",
751 ResponseIncompleteEvent => "response.incomplete",
752 ResponseOutputItemAddedEvent => "response.output_item.added",
753 ResponseOutputItemDoneEvent => "response.output_item.done",
754 ResponseContentPartAddedEvent => "response.content_part.added",
755 ResponseContentPartDoneEvent => "response.content_part.done",
756 ResponseTextDeltaEvent => "response.output_text.delta",
757 ResponseTextDoneEvent => "response.output_text.done",
758 ResponseRefusalDeltaEvent => "response.refusal.delta",
759 ResponseRefusalDoneEvent => "response.refusal.done",
760 ResponseFunctionCallArgumentsDeltaEvent => "response.function_call_arguments.delta",
761 ResponseFunctionCallArgumentsDoneEvent => "response.function_call_arguments.done",
762 ResponseFileSearchCallInProgressEvent => "response.file_search_call.in_progress",
763 ResponseFileSearchCallSearchingEvent => "response.file_search_call.searching",
764 ResponseFileSearchCallCompletedEvent => "response.file_search_call.completed",
765 ResponseWebSearchCallInProgressEvent => "response.web_search_call.in_progress",
766 ResponseWebSearchCallSearchingEvent => "response.web_search_call.searching",
767 ResponseWebSearchCallCompletedEvent => "response.web_search_call.completed",
768 ResponseReasoningSummaryPartAddedEvent => "response.reasoning_summary_part.added",
769 ResponseReasoningSummaryPartDoneEvent => "response.reasoning_summary_part.done",
770 ResponseReasoningSummaryTextDeltaEvent => "response.reasoning_summary_text.delta",
771 ResponseReasoningSummaryTextDoneEvent => "response.reasoning_summary_text.done",
772 ResponseReasoningTextDeltaEvent => "response.reasoning_text.delta",
773 ResponseReasoningTextDoneEvent => "response.reasoning_text.done",
774 ResponseImageGenCallCompletedEvent => "response.image_generation_call.completed",
775 ResponseImageGenCallGeneratingEvent => "response.image_generation_call.generating",
776 ResponseImageGenCallInProgressEvent => "response.image_generation_call.in_progress",
777 ResponseImageGenCallPartialImageEvent => "response.image_generation_call.partial_image",
778 ResponseMCPCallArgumentsDeltaEvent => "response.mcp_call_arguments.delta",
779 ResponseMCPCallArgumentsDoneEvent => "response.mcp_call_arguments.done",
780 ResponseMCPCallCompletedEvent => "response.mcp_call.completed",
781 ResponseMCPCallFailedEvent => "response.mcp_call.failed",
782 ResponseMCPCallInProgressEvent => "response.mcp_call.in_progress",
783 ResponseMCPListToolsCompletedEvent => "response.mcp_list_tools.completed",
784 ResponseMCPListToolsFailedEvent => "response.mcp_list_tools.failed",
785 ResponseMCPListToolsInProgressEvent => "response.mcp_list_tools.in_progress",
786 ResponseCodeInterpreterCallInProgressEvent => "response.code_interpreter_call.in_progress",
787 ResponseCodeInterpreterCallInterpretingEvent => "response.code_interpreter_call.interpreting",
788 ResponseCodeInterpreterCallCompletedEvent => "response.code_interpreter_call.completed",
789 ResponseCodeInterpreterCallCodeDeltaEvent => "response.code_interpreter_call_code.delta",
790 ResponseCodeInterpreterCallCodeDoneEvent => "response.code_interpreter_call_code.done",
791 ResponseOutputTextAnnotationAddedEvent => "response.output_text.annotation.added",
792 ResponseQueuedEvent => "response.queued",
793 ResponseCustomToolCallInputDeltaEvent => "response.custom_tool_call_input.delta",
794 ResponseCustomToolCallInputDoneEvent => "response.custom_tool_call_input.done",
795 ResponseErrorEvent => "error",
796}
797
798#[cfg(feature = "_api")]
799impl crate::traits::EventType for ResponseStreamEvent {
800 fn event_type(&self) -> &'static str {
801 match self {
802 Self::CompactionCompacting(event) => event.event_type(),
803 Self::ResponseAudioDelta(event) => event.event_type(),
804 Self::ResponseAudioDone(event) => event.event_type(),
805 Self::ResponseAudioTranscriptDelta(event) => event.event_type(),
806 Self::ResponseAudioTranscriptDone(event) => event.event_type(),
807 Self::ResponseShellCallCommandAdded(event) => event.event_type(),
808 Self::ResponseShellCallCommandDelta(event) => event.event_type(),
809 Self::ResponseShellCallCommandDone(event) => event.event_type(),
810 Self::ResponseShellCallOutputContentDelta(event) => event.event_type(),
811 Self::ResponseShellCallOutputContentDone(event) => event.event_type(),
812 Self::ResponseCreated(event) => event.event_type(),
813 Self::ResponseInProgress(event) => event.event_type(),
814 Self::ResponseCompleted(event) => event.event_type(),
815 Self::ResponseFailed(event) => event.event_type(),
816 Self::ResponseIncomplete(event) => event.event_type(),
817 Self::ResponseOutputItemAdded(event) => event.event_type(),
818 Self::ResponseOutputItemDone(event) => event.event_type(),
819 Self::ResponseContentPartAdded(event) => event.event_type(),
820 Self::ResponseContentPartDone(event) => event.event_type(),
821 Self::ResponseOutputTextDelta(event) => event.event_type(),
822 Self::ResponseOutputTextDone(event) => event.event_type(),
823 Self::ResponseRefusalDelta(event) => event.event_type(),
824 Self::ResponseRefusalDone(event) => event.event_type(),
825 Self::ResponseFunctionCallArgumentsDelta(event) => event.event_type(),
826 Self::ResponseFunctionCallArgumentsDone(event) => event.event_type(),
827 Self::ResponseFileSearchCallInProgress(event) => event.event_type(),
828 Self::ResponseFileSearchCallSearching(event) => event.event_type(),
829 Self::ResponseFileSearchCallCompleted(event) => event.event_type(),
830 Self::ResponseWebSearchCallInProgress(event) => event.event_type(),
831 Self::ResponseWebSearchCallSearching(event) => event.event_type(),
832 Self::ResponseWebSearchCallCompleted(event) => event.event_type(),
833 Self::ResponseReasoningSummaryPartAdded(event) => event.event_type(),
834 Self::ResponseReasoningSummaryPartDone(event) => event.event_type(),
835 Self::ResponseReasoningSummaryTextDelta(event) => event.event_type(),
836 Self::ResponseReasoningSummaryTextDone(event) => event.event_type(),
837 Self::ResponseReasoningTextDelta(event) => event.event_type(),
838 Self::ResponseReasoningTextDone(event) => event.event_type(),
839 Self::ResponseImageGenerationCallCompleted(event) => event.event_type(),
840 Self::ResponseImageGenerationCallGenerating(event) => event.event_type(),
841 Self::ResponseImageGenerationCallInProgress(event) => event.event_type(),
842 Self::ResponseImageGenerationCallPartialImage(event) => event.event_type(),
843 Self::ResponseMCPCallArgumentsDelta(event) => event.event_type(),
844 Self::ResponseMCPCallArgumentsDone(event) => event.event_type(),
845 Self::ResponseMCPCallCompleted(event) => event.event_type(),
846 Self::ResponseMCPCallFailed(event) => event.event_type(),
847 Self::ResponseMCPCallInProgress(event) => event.event_type(),
848 Self::ResponseMCPListToolsCompleted(event) => event.event_type(),
849 Self::ResponseMCPListToolsFailed(event) => event.event_type(),
850 Self::ResponseMCPListToolsInProgress(event) => event.event_type(),
851 Self::ResponseCodeInterpreterCallInProgress(event) => event.event_type(),
852 Self::ResponseCodeInterpreterCallInterpreting(event) => event.event_type(),
853 Self::ResponseCodeInterpreterCallCompleted(event) => event.event_type(),
854 Self::ResponseCodeInterpreterCallCodeDelta(event) => event.event_type(),
855 Self::ResponseCodeInterpreterCallCodeDone(event) => event.event_type(),
856 Self::ResponseOutputTextAnnotationAdded(event) => event.event_type(),
857 Self::ResponseQueued(event) => event.event_type(),
858 Self::ResponseCustomToolCallInputDelta(event) => event.event_type(),
859 Self::ResponseCustomToolCallInputDone(event) => event.event_type(),
860 Self::ResponseError(event) => event.event_type(),
861 }
862 }
863}