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

from __future__ import annotations
from .completionstreamchoice import (
    CompletionStreamChoice,
    CompletionStreamChoiceTypedDict,
)
import pydantic
from pydantic.functional_validators import AfterValidator
from r9s.types import BaseModel
from r9s.utils import validate_const
from typing import List, Literal, Optional
from typing_extensions import Annotated, NotRequired, TypedDict


class CompletionStreamEventTypedDict(TypedDict):
    r"""Completion stream event (data payload for SSE stream)"""

    id: str
    created: int
    r"""Unix timestamp"""
    model: str
    choices: List[CompletionStreamChoiceTypedDict]
    object: Literal["completion"]
    system_fingerprint: NotRequired[str]
    obfuscation: NotRequired[str]
    r"""Obfuscation token (server-specific field)"""


class CompletionStreamEvent(BaseModel):
    r"""Completion stream event (data payload for SSE stream)"""

    id: str

    created: int
    r"""Unix timestamp"""

    model: str

    choices: List[CompletionStreamChoice]

    OBJECT: Annotated[
        Annotated[Literal["completion"], AfterValidator(validate_const("completion"))],
        pydantic.Field(alias="object"),
    ] = "completion"

    system_fingerprint: Optional[str] = None

    obfuscation: Optional[str] = None
    r"""Obfuscation token (server-specific field)"""
