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

from __future__ import annotations
from .chatcompletionresponse import (
    ChatCompletionResponse,
    ChatCompletionResponseTypedDict,
)
from .chatcompletionstreamevent import (
    ChatCompletionStreamEvent,
    ChatCompletionStreamEventTypedDict,
)
from r9s.types import BaseModel
from r9s.utils import eventstreaming
from typing import Optional, Union
from typing_extensions import NotRequired, TypeAliasType, TypedDict


class CreateChatCompletionResponseBodyTypedDict(TypedDict):
    r"""Successful response"""

    data: ChatCompletionStreamEventTypedDict
    r"""Chat completion chunk event (data payload for SSE stream)"""
    id: NotRequired[str]
    event: NotRequired[str]
    retry: NotRequired[int]


class CreateChatCompletionResponseBody(BaseModel):
    r"""Successful response"""

    data: ChatCompletionStreamEvent
    r"""Chat completion chunk event (data payload for SSE stream)"""

    id: Optional[str] = None

    event: Optional[str] = None

    retry: Optional[int] = None


CreateChatCompletionResponseTypedDict = TypeAliasType(
    "CreateChatCompletionResponseTypedDict",
    Union[
        ChatCompletionResponseTypedDict,
        Union[
            eventstreaming.EventStream[ChatCompletionStreamEventTypedDict],
            eventstreaming.EventStreamAsync[ChatCompletionStreamEventTypedDict],
        ],
    ],
)


CreateChatCompletionResponse = TypeAliasType(
    "CreateChatCompletionResponse",
    Union[
        ChatCompletionResponse,
        Union[
            eventstreaming.EventStream[ChatCompletionStreamEvent],
            eventstreaming.EventStreamAsync[ChatCompletionStreamEvent],
        ],
    ],
)
