"""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[ChatAssistantMessage, Tag("assistant")],
        Annotated[ChatDeveloperMessage, Tag("developer")],
        Annotated[ChatSystemMessage, Tag("system")],
        Annotated[ChatToolMessage, Tag("tool")],
        Annotated[ChatUserMessage, Tag("user")],
    ],
    Discriminator(lambda m: get_discriminator(m, "role", "role")),
]
r"""Chat completion message with role-based discrimination"""
