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