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

from __future__ import annotations
from openrouter.types import BaseModel
from openrouter.utils import validate_const
import pydantic
from pydantic.functional_validators import AfterValidator
from typing import Literal, Optional
from typing_extensions import Annotated, NotRequired, TypedDict


class ChatStreamingMessageToolCallFunctionTypedDict(TypedDict):
    name: NotRequired[str]
    arguments: NotRequired[str]


class ChatStreamingMessageToolCallFunction(BaseModel):
    name: Optional[str] = None

    arguments: Optional[str] = None


class ChatStreamingMessageToolCallTypedDict(TypedDict):
    index: float
    id: NotRequired[str]
    type: Literal["function"]
    function: NotRequired[ChatStreamingMessageToolCallFunctionTypedDict]


class ChatStreamingMessageToolCall(BaseModel):
    index: float

    id: Optional[str] = None

    TYPE: Annotated[
        Annotated[
            Optional[Literal["function"]], AfterValidator(validate_const("function"))
        ],
        pydantic.Field(alias="type"),
    ] = "function"

    function: Optional[ChatStreamingMessageToolCallFunction] = None
