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

from __future__ import annotations
from .formatjsonobjectconfig import (
    FormatJSONObjectConfig,
    FormatJSONObjectConfigTypedDict,
)
from .formatjsonschemaconfig import (
    FormatJSONSchemaConfig,
    FormatJSONSchemaConfigTypedDict,
)
from .formattextconfig import FormatTextConfig, FormatTextConfigTypedDict
from openrouter.utils import get_discriminator
from pydantic import Discriminator, Tag
from typing import Union
from typing_extensions import Annotated, TypeAliasType


FormatsTypedDict = TypeAliasType(
    "FormatsTypedDict",
    Union[
        FormatTextConfigTypedDict,
        FormatJSONObjectConfigTypedDict,
        FormatJSONSchemaConfigTypedDict,
    ],
)
r"""Text response format configuration"""


Formats = Annotated[
    Union[
        Annotated[FormatTextConfig, Tag("text")],
        Annotated[FormatJSONObjectConfig, Tag("json_object")],
        Annotated[FormatJSONSchemaConfig, Tag("json_schema")],
    ],
    Discriminator(lambda m: get_discriminator(m, "type", "type")),
]
r"""Text response format configuration"""
