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

from __future__ import annotations
from .assistantmessage import AssistantMessage, AssistantMessageTypedDict
from .developermessage import DeveloperMessage, DeveloperMessageTypedDict
from .systemmessage import SystemMessage, SystemMessageTypedDict
from .toolresponsemessage import ToolResponseMessage, ToolResponseMessageTypedDict
from .usermessage import UserMessage, UserMessageTypedDict
from openrouter.utils import get_discriminator
from pydantic import Discriminator, Tag
from typing import Union
from typing_extensions import Annotated, TypeAliasType


MessageTypedDict = TypeAliasType(
    "MessageTypedDict",
    Union[
        SystemMessageTypedDict,
        UserMessageTypedDict,
        DeveloperMessageTypedDict,
        ToolResponseMessageTypedDict,
        AssistantMessageTypedDict,
    ],
)
r"""Chat completion message with role-based discrimination"""


Message = Annotated[
    Union[
        Annotated[SystemMessage, Tag("system")],
        Annotated[UserMessage, Tag("user")],
        Annotated[DeveloperMessage, Tag("developer")],
        Annotated[AssistantMessage, Tag("assistant")],
        Annotated[ToolResponseMessage, Tag("tool")],
    ],
    Discriminator(lambda m: get_discriminator(m, "role", "role")),
]
r"""Chat completion message with role-based discrimination"""
