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

from __future__ import annotations
from .message import Message, MessageTypedDict
from r9s.types import BaseModel
from typing import Literal, Optional
from typing_extensions import NotRequired, TypedDict


FinishReason = Literal[
    "stop",
    "length",
    "tool_calls",
    "content_filter",
]


class LogprobsTypedDict(TypedDict):
    pass


class Logprobs(BaseModel):
    pass


class ChatCompletionChoiceTypedDict(TypedDict):
    index: int
    message: MessageTypedDict
    r"""Message object. Note: Different API endpoints have different field requirements and support.

    **Field support:**
    - /v1/chat/completions: Supports all fields (tool_calls, tool_call_id, etc.)
    - /v1/responses: Only supports basic fields (role, content, name); does not support tool_calls and tool_call_id

    **content field requirements:**
    - /v1/chat/completions: When tool_calls is present, content can be omitted or null
    - /v1/responses: content field is always required and cannot be null; tool_calls field is not supported

    """
    finish_reason: FinishReason
    logprobs: NotRequired[LogprobsTypedDict]


class ChatCompletionChoice(BaseModel):
    index: int

    message: Message
    r"""Message object. Note: Different API endpoints have different field requirements and support.

    **Field support:**
    - /v1/chat/completions: Supports all fields (tool_calls, tool_call_id, etc.)
    - /v1/responses: Only supports basic fields (role, content, name); does not support tool_calls and tool_call_id

    **content field requirements:**
    - /v1/chat/completions: When tool_calls is present, content can be omitted or null
    - /v1/responses: content field is always required and cannot be null; tool_calls field is not supported

    """

    finish_reason: FinishReason

    logprobs: Optional[Logprobs] = None
