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

from __future__ import annotations
from .chatcompletionchoice import ChatCompletionChoice, ChatCompletionChoiceTypedDict
from .usage import Usage, UsageTypedDict
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 ChatCompletionResponseTypedDict(TypedDict):
    id: str
    created: int
    model: str
    choices: List[ChatCompletionChoiceTypedDict]
    object: Literal["chat.completion"]
    usage: NotRequired[UsageTypedDict]
    system_fingerprint: NotRequired[str]


class ChatCompletionResponse(BaseModel):
    id: str

    created: int

    model: str

    choices: List[ChatCompletionChoice]

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

    usage: Optional[Usage] = None

    system_fingerprint: Optional[str] = None
