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

from __future__ import annotations
from .chatassistantmessage import ChatAssistantMessage, ChatAssistantMessageTypedDict
from .chatdevelopermessage import ChatDeveloperMessage, ChatDeveloperMessageTypedDict
from .chatsystemmessage import ChatSystemMessage, ChatSystemMessageTypedDict
from .chattoolmessage import ChatToolMessage, ChatToolMessageTypedDict
from .chatusermessage import ChatUserMessage, ChatUserMessageTypedDict
from openrouter.utils import get_discriminator
from pydantic import Discriminator, Tag
from typing import Union
from typing_extensions import Annotated, TypeAliasType


ChatMessagesTypedDict = TypeAliasType(
    "ChatMessagesTypedDict",
    Union[
        ChatSystemMessageTypedDict,
        ChatUserMessageTypedDict,
        ChatDeveloperMessageTypedDict,
        ChatToolMessageTypedDict,
        ChatAssistantMessageTypedDict,
    ],
)
r"""Chat completion message with role-based discrimination"""


ChatMessages = Annotated[
    Union[
        Annotated[ChatSystemMessage, Tag("system")],
        Annotated[ChatUserMessage, Tag("user")],
        Annotated[ChatDeveloperMessage, Tag("developer")],
        Annotated[ChatAssistantMessage, Tag("assistant")],
        Annotated[ChatToolMessage, Tag("tool")],
    ],
    Discriminator(lambda m: get_discriminator(m, "role", "role")),
]
r"""Chat completion message with role-based discrimination"""
