"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations from .annotationaddedevent import AnnotationAddedEvent, AnnotationAddedEventTypedDict from .contentpartaddedevent import ContentPartAddedEvent, ContentPartAddedEventTypedDict from .contentpartdoneevent import ContentPartDoneEvent, ContentPartDoneEventTypedDict from .errorevent import ErrorEvent, ErrorEventTypedDict from .functioncallargsdeltaevent import ( FunctionCallArgsDeltaEvent, FunctionCallArgsDeltaEventTypedDict, ) from .functioncallargsdoneevent import ( FunctionCallArgsDoneEvent, FunctionCallArgsDoneEventTypedDict, ) from .imagegencallcompletedevent import ( ImageGenCallCompletedEvent, ImageGenCallCompletedEventTypedDict, ) from .imagegencallgeneratingevent import ( ImageGenCallGeneratingEvent, ImageGenCallGeneratingEventTypedDict, ) from .imagegencallinprogressevent import ( ImageGenCallInProgressEvent, ImageGenCallInProgressEventTypedDict, ) from .imagegencallpartialimageevent import ( ImageGenCallPartialImageEvent, ImageGenCallPartialImageEventTypedDict, ) from .openresponsescreatedevent import ( OpenResponsesCreatedEvent, OpenResponsesCreatedEventTypedDict, ) from .openresponsesinprogressevent import ( OpenResponsesInProgressEvent, OpenResponsesInProgressEventTypedDict, ) from .reasoningdeltaevent import ReasoningDeltaEvent, ReasoningDeltaEventTypedDict from .reasoningdoneevent import ReasoningDoneEvent, ReasoningDoneEventTypedDict from .reasoningsummarypartaddedevent import ( ReasoningSummaryPartAddedEvent, ReasoningSummaryPartAddedEventTypedDict, ) from .reasoningsummarypartdoneevent import ( ReasoningSummaryPartDoneEvent, ReasoningSummaryPartDoneEventTypedDict, ) from .reasoningsummarytextdeltaevent import ( ReasoningSummaryTextDeltaEvent, ReasoningSummaryTextDeltaEventTypedDict, ) from .reasoningsummarytextdoneevent import ( ReasoningSummaryTextDoneEvent, ReasoningSummaryTextDoneEventTypedDict, ) from .refusaldeltaevent import RefusalDeltaEvent, RefusalDeltaEventTypedDict from .refusaldoneevent import RefusalDoneEvent, RefusalDoneEventTypedDict from .streameventsresponsecompleted import ( StreamEventsResponseCompleted, StreamEventsResponseCompletedTypedDict, ) from .streameventsresponsefailed import ( StreamEventsResponseFailed, StreamEventsResponseFailedTypedDict, ) from .streameventsresponseincomplete import ( StreamEventsResponseIncomplete, StreamEventsResponseIncompleteTypedDict, ) from .streameventsresponseoutputitemadded import ( StreamEventsResponseOutputItemAdded, StreamEventsResponseOutputItemAddedTypedDict, ) from .streameventsresponseoutputitemdone import ( StreamEventsResponseOutputItemDone, StreamEventsResponseOutputItemDoneTypedDict, ) from .textdeltaevent import TextDeltaEvent, TextDeltaEventTypedDict from .textdoneevent import TextDoneEvent, TextDoneEventTypedDict from .websearchcallcompletedevent import ( WebSearchCallCompletedEvent, WebSearchCallCompletedEventTypedDict, ) from .websearchcallinprogressevent import ( WebSearchCallInProgressEvent, WebSearchCallInProgressEventTypedDict, ) from .websearchcallsearchingevent import ( WebSearchCallSearchingEvent, WebSearchCallSearchingEventTypedDict, ) from openrouter.utils import get_discriminator from pydantic import Discriminator, Tag from typing import Union from typing_extensions import Annotated, TypeAliasType StreamEventsTypedDict = TypeAliasType( "StreamEventsTypedDict", Union[ OpenResponsesCreatedEventTypedDict, OpenResponsesInProgressEventTypedDict, StreamEventsResponseCompletedTypedDict, StreamEventsResponseIncompleteTypedDict, StreamEventsResponseFailedTypedDict, StreamEventsResponseOutputItemAddedTypedDict, StreamEventsResponseOutputItemDoneTypedDict, WebSearchCallCompletedEventTypedDict, WebSearchCallSearchingEventTypedDict, WebSearchCallInProgressEventTypedDict, ImageGenCallCompletedEventTypedDict, ImageGenCallGeneratingEventTypedDict, ImageGenCallInProgressEventTypedDict, FunctionCallArgsDeltaEventTypedDict, ErrorEventTypedDict, ReasoningSummaryTextDeltaEventTypedDict, ReasoningSummaryTextDoneEventTypedDict, ReasoningDeltaEventTypedDict, ReasoningDoneEventTypedDict, ReasoningSummaryPartAddedEventTypedDict, ReasoningSummaryPartDoneEventTypedDict, ContentPartAddedEventTypedDict, FunctionCallArgsDoneEventTypedDict, RefusalDoneEventTypedDict, RefusalDeltaEventTypedDict, ImageGenCallPartialImageEventTypedDict, ContentPartDoneEventTypedDict, TextDeltaEventTypedDict, TextDoneEventTypedDict, AnnotationAddedEventTypedDict, ], ) r"""Union of all possible event types emitted during response streaming""" StreamEvents = Annotated[ Union[ Annotated[ErrorEvent, Tag("error")], Annotated[StreamEventsResponseCompleted, Tag("response.completed")], Annotated[ContentPartAddedEvent, Tag("response.content_part.added")], Annotated[ContentPartDoneEvent, Tag("response.content_part.done")], Annotated[OpenResponsesCreatedEvent, Tag("response.created")], Annotated[StreamEventsResponseFailed, Tag("response.failed")], Annotated[ FunctionCallArgsDeltaEvent, Tag("response.function_call_arguments.delta") ], Annotated[ FunctionCallArgsDoneEvent, Tag("response.function_call_arguments.done") ], Annotated[ ImageGenCallCompletedEvent, Tag("response.image_generation_call.completed") ], Annotated[ ImageGenCallGeneratingEvent, Tag("response.image_generation_call.generating"), ], Annotated[ ImageGenCallInProgressEvent, Tag("response.image_generation_call.in_progress"), ], Annotated[ ImageGenCallPartialImageEvent, Tag("response.image_generation_call.partial_image"), ], Annotated[OpenResponsesInProgressEvent, Tag("response.in_progress")], Annotated[StreamEventsResponseIncomplete, Tag("response.incomplete")], Annotated[ StreamEventsResponseOutputItemAdded, Tag("response.output_item.added") ], Annotated[StreamEventsResponseOutputItemDone, Tag("response.output_item.done")], Annotated[AnnotationAddedEvent, Tag("response.output_text.annotation.added")], Annotated[TextDeltaEvent, Tag("response.output_text.delta")], Annotated[TextDoneEvent, Tag("response.output_text.done")], Annotated[ ReasoningSummaryPartAddedEvent, Tag("response.reasoning_summary_part.added") ], Annotated[ ReasoningSummaryPartDoneEvent, Tag("response.reasoning_summary_part.done") ], Annotated[ ReasoningSummaryTextDeltaEvent, Tag("response.reasoning_summary_text.delta") ], Annotated[ ReasoningSummaryTextDoneEvent, Tag("response.reasoning_summary_text.done") ], Annotated[ReasoningDeltaEvent, Tag("response.reasoning_text.delta")], Annotated[ReasoningDoneEvent, Tag("response.reasoning_text.done")], Annotated[RefusalDeltaEvent, Tag("response.refusal.delta")], Annotated[RefusalDoneEvent, Tag("response.refusal.done")], Annotated[ WebSearchCallCompletedEvent, Tag("response.web_search_call.completed") ], Annotated[ WebSearchCallInProgressEvent, Tag("response.web_search_call.in_progress") ], Annotated[ WebSearchCallSearchingEvent, Tag("response.web_search_call.searching") ], ], Discriminator(lambda m: get_discriminator(m, "type", "type")), ] r"""Union of all possible event types emitted during response streaming"""