"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""

from __future__ import annotations
from .annotationaddedevent import AnnotationAddedEvent, AnnotationAddedEventTypedDict
from .applypatchcalloperationdiffdeltaevent import (
    ApplyPatchCallOperationDiffDeltaEvent,
    ApplyPatchCallOperationDiffDeltaEventTypedDict,
)
from .applypatchcalloperationdiffdoneevent import (
    ApplyPatchCallOperationDiffDoneEvent,
    ApplyPatchCallOperationDiffDoneEventTypedDict,
)
from .contentpartaddedevent import ContentPartAddedEvent, ContentPartAddedEventTypedDict
from .contentpartdoneevent import ContentPartDoneEvent, ContentPartDoneEventTypedDict
from .customtoolcallinputdeltaevent import (
    CustomToolCallInputDeltaEvent,
    CustomToolCallInputDeltaEventTypedDict,
)
from .customtoolcallinputdoneevent import (
    CustomToolCallInputDoneEvent,
    CustomToolCallInputDoneEventTypedDict,
)
from .errorevent import ErrorEvent, ErrorEventTypedDict
from .functioncallargsdeltaevent import (
    FunctionCallArgsDeltaEvent,
    FunctionCallArgsDeltaEventTypedDict,
)
from .functioncallargsdoneevent import (
    FunctionCallArgsDoneEvent,
    FunctionCallArgsDoneEventTypedDict,
)
from .fusioncallanalysiscompletedevent import (
    FusionCallAnalysisCompletedEvent,
    FusionCallAnalysisCompletedEventTypedDict,
)
from .fusioncallanalysisinprogressevent import (
    FusionCallAnalysisInProgressEvent,
    FusionCallAnalysisInProgressEventTypedDict,
)
from .fusioncallcompletedevent import (
    FusionCallCompletedEvent,
    FusionCallCompletedEventTypedDict,
)
from .fusioncallinprogressevent import (
    FusionCallInProgressEvent,
    FusionCallInProgressEventTypedDict,
)
from .fusioncallpaneladdedevent import (
    FusionCallPanelAddedEvent,
    FusionCallPanelAddedEventTypedDict,
)
from .fusioncallpanelcompletedevent import (
    FusionCallPanelCompletedEvent,
    FusionCallPanelCompletedEventTypedDict,
)
from .fusioncallpaneldeltaevent import (
    FusionCallPanelDeltaEvent,
    FusionCallPanelDeltaEventTypedDict,
)
from .fusioncallpanelfailedevent import (
    FusionCallPanelFailedEvent,
    FusionCallPanelFailedEventTypedDict,
)
from .fusioncallpanelreasoningdeltaevent import (
    FusionCallPanelReasoningDeltaEvent,
    FusionCallPanelReasoningDeltaEventTypedDict,
)
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,
        FusionCallInProgressEventTypedDict,
        WebSearchCallCompletedEventTypedDict,
        StreamEventsResponseOutputItemDoneTypedDict,
        FusionCallCompletedEventTypedDict,
        ImageGenCallInProgressEventTypedDict,
        StreamEventsResponseOutputItemAddedTypedDict,
        ImageGenCallCompletedEventTypedDict,
        ImageGenCallGeneratingEventTypedDict,
        WebSearchCallInProgressEventTypedDict,
        WebSearchCallSearchingEventTypedDict,
        FusionCallAnalysisInProgressEventTypedDict,
        CustomToolCallInputDoneEventTypedDict,
        CustomToolCallInputDeltaEventTypedDict,
        FunctionCallArgsDeltaEventTypedDict,
        ApplyPatchCallOperationDiffDeltaEventTypedDict,
        ErrorEventTypedDict,
        ApplyPatchCallOperationDiffDoneEventTypedDict,
        FusionCallPanelAddedEventTypedDict,
        FusionCallAnalysisCompletedEventTypedDict,
        ReasoningSummaryPartDoneEventTypedDict,
        RefusalDoneEventTypedDict,
        ReasoningSummaryTextDoneEventTypedDict,
        ReasoningSummaryTextDeltaEventTypedDict,
        ReasoningSummaryPartAddedEventTypedDict,
        ReasoningDoneEventTypedDict,
        ReasoningDeltaEventTypedDict,
        FunctionCallArgsDoneEventTypedDict,
        ContentPartAddedEventTypedDict,
        ImageGenCallPartialImageEventTypedDict,
        RefusalDeltaEventTypedDict,
        ContentPartDoneEventTypedDict,
        FusionCallPanelDeltaEventTypedDict,
        FusionCallPanelReasoningDeltaEventTypedDict,
        FusionCallPanelCompletedEventTypedDict,
        FusionCallPanelFailedEventTypedDict,
        TextDeltaEventTypedDict,
        TextDoneEventTypedDict,
        AnnotationAddedEventTypedDict,
    ],
)
r"""Union of all possible event types emitted during response streaming"""


StreamEvents = Annotated[
    Union[
        Annotated[ErrorEvent, Tag("error")],
        Annotated[
            ApplyPatchCallOperationDiffDeltaEvent,
            Tag("response.apply_patch_call_operation_diff.delta"),
        ],
        Annotated[
            ApplyPatchCallOperationDiffDoneEvent,
            Tag("response.apply_patch_call_operation_diff.done"),
        ],
        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[
            CustomToolCallInputDeltaEvent, Tag("response.custom_tool_call_input.delta")
        ],
        Annotated[
            CustomToolCallInputDoneEvent, Tag("response.custom_tool_call_input.done")
        ],
        Annotated[StreamEventsResponseFailed, Tag("response.failed")],
        Annotated[
            FunctionCallArgsDeltaEvent, Tag("response.function_call_arguments.delta")
        ],
        Annotated[
            FunctionCallArgsDoneEvent, Tag("response.function_call_arguments.done")
        ],
        Annotated[
            FusionCallAnalysisCompletedEvent,
            Tag("response.fusion_call.analysis.completed"),
        ],
        Annotated[
            FusionCallAnalysisInProgressEvent,
            Tag("response.fusion_call.analysis.in_progress"),
        ],
        Annotated[FusionCallCompletedEvent, Tag("response.fusion_call.completed")],
        Annotated[FusionCallInProgressEvent, Tag("response.fusion_call.in_progress")],
        Annotated[FusionCallPanelAddedEvent, Tag("response.fusion_call.panel.added")],
        Annotated[
            FusionCallPanelCompletedEvent, Tag("response.fusion_call.panel.completed")
        ],
        Annotated[FusionCallPanelDeltaEvent, Tag("response.fusion_call.panel.delta")],
        Annotated[FusionCallPanelFailedEvent, Tag("response.fusion_call.panel.failed")],
        Annotated[
            FusionCallPanelReasoningDeltaEvent,
            Tag("response.fusion_call.panel.reasoning.delta"),
        ],
        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"""
