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

from __future__ import annotations
from opperai.types import BaseModel
from opperai.utils import eventstreaming
from pydantic import SkipValidation
from typing import Dict, List, Optional, Union
from typing_extensions import NotRequired, TypedDict


class FunctionStreamCallStreamPostDataTypedDict(TypedDict):
    r"""The actual data payload containing streaming chunk information"""

    delta: NotRequired[str]
    r"""Incremental text content generated by the model"""
    span_id: NotRequired[str]
    r"""Unique identifier for the execution span"""


class FunctionStreamCallStreamPostData(BaseModel):
    r"""The actual data payload containing streaming chunk information"""

    delta: Optional[str] = None
    r"""Incremental text content generated by the model"""

    span_id: Optional[str] = None
    r"""Unique identifier for the execution span"""


class FunctionStreamCallStreamPostResponseBodyTypedDict(TypedDict):
    r"""Server-Sent Event following the SSE specification"""

    data: FunctionStreamCallStreamPostDataTypedDict
    r"""The actual data payload containing streaming chunk information"""
    id: NotRequired[str]
    r"""Event ID for the SSE event"""
    event: NotRequired[str]
    r"""Event type for the SSE event"""
    retry: NotRequired[int]
    r"""Retry interval in milliseconds for the SSE connection"""


class FunctionStreamCallStreamPostResponseBody(BaseModel):
    r"""Server-Sent Event following the SSE specification"""

    data: FunctionStreamCallStreamPostData
    r"""The actual data payload containing streaming chunk information"""

    id: Optional[str] = None
    r"""Event ID for the SSE event"""

    event: Optional[str] = None
    r"""Event type for the SSE event"""

    retry: Optional[int] = None
    r"""Retry interval in milliseconds for the SSE connection"""


class FunctionStreamCallStreamPostResponseTypedDict(TypedDict):
    headers: Dict[str, List[str]]
    result: Union[
        eventstreaming.EventStream[FunctionStreamCallStreamPostResponseBodyTypedDict],
        eventstreaming.EventStreamAsync[
            FunctionStreamCallStreamPostResponseBodyTypedDict
        ],
    ]


class FunctionStreamCallStreamPostResponse(BaseModel):
    headers: Dict[str, List[str]]

    result: SkipValidation[
        Union[
            eventstreaming.EventStream[FunctionStreamCallStreamPostResponseBody],
            eventstreaming.EventStreamAsync[FunctionStreamCallStreamPostResponseBody],
        ]
    ]
