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

from __future__ import annotations
import pydantic
from pydantic import ConfigDict
from r9s.types import BaseModel
from typing import Any, Dict, List, Literal, Optional
from typing_extensions import NotRequired, TypedDict


ResponseToolType = Literal["function",]
r"""Tool type, currently only supports function"""


ResponseToolSchemasType = Literal["object",]


class ParametersTypedDict(TypedDict):
    r"""Function parameter definition in JSON Schema format"""

    type: NotRequired[ResponseToolSchemasType]
    properties: NotRequired[Dict[str, Any]]
    required: NotRequired[List[str]]


class Parameters(BaseModel):
    r"""Function parameter definition in JSON Schema format"""

    model_config = ConfigDict(
        populate_by_name=True, arbitrary_types_allowed=True, extra="allow"
    )
    __pydantic_extra__: Dict[str, Any] = pydantic.Field(init=False)

    type: Optional[ResponseToolSchemasType] = None

    properties: Optional[Dict[str, Any]] = None

    required: Optional[List[str]] = None

    @property
    def additional_properties(self):
        return self.__pydantic_extra__

    @additional_properties.setter
    def additional_properties(self, value):
        self.__pydantic_extra__ = value  # pyright: ignore[reportIncompatibleVariableOverride]


class ResponseToolTypedDict(TypedDict):
    r"""Tool definition (flat format). Dedicated for /v1/responses endpoint.
    Format: { \"type\": \"function\", \"name\": \"...\", \"description\": \"...\", \"parameters\": {...} }

    """

    type: ResponseToolType
    r"""Tool type, currently only supports function"""
    name: str
    r"""Function name"""
    description: NotRequired[str]
    r"""Function description, helps model understand when to call this function"""
    parameters: NotRequired[ParametersTypedDict]
    r"""Function parameter definition in JSON Schema format"""


class ResponseTool(BaseModel):
    r"""Tool definition (flat format). Dedicated for /v1/responses endpoint.
    Format: { \"type\": \"function\", \"name\": \"...\", \"description\": \"...\", \"parameters\": {...} }

    """

    type: ResponseToolType
    r"""Tool type, currently only supports function"""

    name: str
    r"""Function name"""

    description: Optional[str] = None
    r"""Function description, helps model understand when to call this function"""

    parameters: Optional[Parameters] = None
    r"""Function parameter definition in JSON Schema format"""
