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

from __future__ import annotations
from openrouter.types import BaseModel
import pydantic
from typing import List, Literal, Optional
from typing_extensions import Annotated, NotRequired, TypedDict


TextDoneEventType = Literal["response.output_text.done",]


class TextDoneEventTopLogprobTypedDict(TypedDict):
    r"""Alternative token with its log probability"""

    token: NotRequired[str]
    logprob: NotRequired[float]
    bytes_: NotRequired[List[float]]


class TextDoneEventTopLogprob(BaseModel):
    r"""Alternative token with its log probability"""

    token: Optional[str] = None

    logprob: Optional[float] = None

    bytes_: Annotated[Optional[List[float]], pydantic.Field(alias="bytes")] = None


class TextDoneEventLogprobTypedDict(TypedDict):
    r"""Log probability information for a token"""

    logprob: float
    token: str
    top_logprobs: NotRequired[List[TextDoneEventTopLogprobTypedDict]]
    bytes_: NotRequired[List[float]]


class TextDoneEventLogprob(BaseModel):
    r"""Log probability information for a token"""

    logprob: float

    token: str

    top_logprobs: Optional[List[TextDoneEventTopLogprob]] = None

    bytes_: Annotated[Optional[List[float]], pydantic.Field(alias="bytes")] = None


class TextDoneEventTypedDict(TypedDict):
    r"""Event emitted when text streaming is complete"""

    type: TextDoneEventType
    output_index: float
    item_id: str
    content_index: float
    text: str
    sequence_number: float
    logprobs: List[TextDoneEventLogprobTypedDict]


class TextDoneEvent(BaseModel):
    r"""Event emitted when text streaming is complete"""

    type: TextDoneEventType

    output_index: float

    item_id: str

    content_index: float

    text: str

    sequence_number: float

    logprobs: List[TextDoneEventLogprob]
