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

from __future__ import annotations
from .customformatgrammar import CustomFormatGrammar, CustomFormatGrammarTypedDict
from .customformattext import CustomFormatText, CustomFormatTextTypedDict
from opperai.types import BaseModel
import pydantic
from pydantic import Field
from typing import Optional, Union
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict


FormatTypedDict = TypeAliasType(
    "FormatTypedDict", Union[CustomFormatTextTypedDict, CustomFormatGrammarTypedDict]
)


Format = Annotated[
    Union[CustomFormatText, CustomFormatGrammar], Field(discriminator="TYPE")
]


class OpenaiTypesChatChatCompletionCustomToolParamCustomTypedDict(TypedDict):
    name: str
    description: NotRequired[str]
    format_: NotRequired[FormatTypedDict]


class OpenaiTypesChatChatCompletionCustomToolParamCustom(BaseModel):
    name: str

    description: Optional[str] = None

    format_: Annotated[Optional[Format], pydantic.Field(alias="format")] = None
