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