from typing import List, Literal, TypeVar, Optional

from openai._models import BaseModel

from nexusflowai.types.chat_completion_message_tool_call import (
    NexusflowAIChatCompletionMessageToolCall,
)


ContentType = TypeVar("ContentType")


class NexusflowAIChatCompletionMessage(BaseModel):
    """
    NexusflowAI chat completion message. Currently the same as openai ChatCompletionMessage
    """

    content: Optional[str]
    """The contents of the message."""

    refusal: Optional[str] = None
    """The refusal message generated by the model."""

    role: Literal["assistant"]
    """The role of the author of this message."""

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

    parsed: Optional[ContentType] = None
    """The auto-parsed message contents"""

    nexusflowai_extras: Optional[str] = None
    """Extra items passed in for Nexusflow client, formatted as a json string."""
