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

from __future__ import annotations
from .toolfunction import ToolFunction, ToolFunctionTypedDict
import pydantic
from pydantic.functional_validators import AfterValidator
from syllable_sdk.types import BaseModel
from syllable_sdk.utils import validate_const
from typing import Literal, Optional
from typing_extensions import Annotated, TypedDict


class InternalToolTypedDict(TypedDict):
    r"""A tool definition to be used by the OpenAI API."""

    function: ToolFunctionTypedDict
    r"""A function available to an agent.

    See:
    - https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/function-calling
    """
    type: Literal["function"]
    r"""Always `function`."""


class InternalTool(BaseModel):
    r"""A tool definition to be used by the OpenAI API."""

    function: ToolFunction
    r"""A function available to an agent.

    See:
    - https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/function-calling
    """

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