# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import List, Union, Optional

from ..._models import BaseModel
from .chat_completion_message_tool_call import ChatCompletionMessageToolCall

__all__ = ["ChatMessage", "ContentUnionMember1", "ContentUnionMember1ImageURL"]


class ContentUnionMember1ImageURL(BaseModel):
    url: str

    detail: Optional[str] = None


class ContentUnionMember1(BaseModel):
    type: str

    image_url: Optional[ContentUnionMember1ImageURL] = None

    text: Optional[str] = None


class ChatMessage(BaseModel):
    """A chat completion message."""

    role: str
    """The role of the messages author. One of `system`, `user`, or `assistant`."""

    content: Union[str, List[ContentUnionMember1], None] = None
    """The contents of the message.

    `content` is required for all messages, and may be null for assistant messages
    with function calls.
    """

    reasoning_content: Optional[str] = None
    """The reasoning or thinking process generated by the model.

    This field is only available for certain reasoning models (GLM 4.5, GLM 4.5 Air,
    GPT OSS 120B, GPT OSS 20B) and contains the model's internal reasoning that
    would otherwise appear in `<think></think>` tags within the content field.
    """

    tool_call_id: Optional[str] = None

    tool_calls: Optional[List[ChatCompletionMessageToolCall]] = None
    """The tool calls generated by the model, such as function calls."""
