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

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


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


class FunctionTypedDict(TypedDict):
    name: str
    r"""Function name"""
    description: NotRequired[str]
    r"""Function description, helps model understand when to call this function"""
    parameters: NotRequired[Dict[str, Any]]
    r"""Function parameter definition in JSON Schema format"""


class Function(BaseModel):
    name: str
    r"""Function name"""

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

    parameters: Optional[Dict[str, Any]] = None
    r"""Function parameter definition in JSON Schema format"""


class ToolTypedDict(TypedDict):
    r"""Tool definition (nested format). Used for /v1/chat/completions and other endpoints.
    Format: { \"type\": \"function\", \"function\": { \"name\": \"...\", \"description\": \"...\", \"parameters\": {...} } }

    """

    type: ToolType
    r"""Tool type, currently only supports function"""
    function: FunctionTypedDict


class Tool(BaseModel):
    r"""Tool definition (nested format). Used for /v1/chat/completions and other endpoints.
    Format: { \"type\": \"function\", \"function\": { \"name\": \"...\", \"description\": \"...\", \"parameters\": {...} } }

    """

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

    function: Function
