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

from __future__ import annotations
from .streamedcompletionschoice import (
    StreamedCompletionsChoice,
    StreamedCompletionsChoiceTypedDict,
)
from .usage import Usage, UsageTypedDict
from friendli.types import BaseModel
from typing import List, Literal, Optional
from typing_extensions import NotRequired, TypedDict


StreamedCompletionsResultObject = Literal["text_completion"]
r"""The object type, which is always set to `text_completion`."""


class StreamedCompletionsResultDataTypedDict(TypedDict):
    choices: List[StreamedCompletionsChoiceTypedDict]
    created: int
    r"""The Unix timestamp (in seconds) for when the token sampled."""
    id: NotRequired[str]
    r"""A unique ID of the completion."""
    object: NotRequired[StreamedCompletionsResultObject]
    r"""The object type, which is always set to `text_completion`."""
    usage: NotRequired[UsageTypedDict]


class StreamedCompletionsResultData(BaseModel):
    choices: List[StreamedCompletionsChoice]

    created: int
    r"""The Unix timestamp (in seconds) for when the token sampled."""

    id: Optional[str] = None
    r"""A unique ID of the completion."""

    object: Optional[StreamedCompletionsResultObject] = None
    r"""The object type, which is always set to `text_completion`."""

    usage: Optional[Usage] = None


class StreamedCompletionsResultTypedDict(TypedDict):
    r"""Successfully generated completions."""

    data: StreamedCompletionsResultDataTypedDict


class StreamedCompletionsResult(BaseModel):
    r"""Successfully generated completions."""

    data: StreamedCompletionsResultData
