# This file was auto-generated by Fern from our API Definition.

from ..core.unchecked_base_model import UncheckedBaseModel
import typing
from .chat_completion_request_messages_item import ChatCompletionRequestMessagesItem
from .response_format import ResponseFormat
from .chat_completion_request_stop import ChatCompletionRequestStop
from .tool_input import ToolInput
from .chat_completion_request_tool_choice import ChatCompletionRequestToolChoice
from .function_schema import FunctionSchema
from .chat_completion_request_function_call import ChatCompletionRequestFunctionCall
from ..core.pydantic_utilities import IS_PYDANTIC_V2
import pydantic


class ChatCompletionRequest(UncheckedBaseModel):
    """
    https://platform.openai.com/docs/api-reference/chat/create
    """

    model: str
    messages: typing.List[ChatCompletionRequestMessagesItem]
    frequency_penalty: typing.Optional[float] = None
    logit_bias: typing.Optional[typing.Dict[str, typing.Optional[int]]] = None
    logprobs: typing.Optional[bool] = None
    top_logprobs: typing.Optional[int] = None
    max_tokens: typing.Optional[int] = None
    n: typing.Optional[int] = None
    presence_penalty: typing.Optional[float] = None
    response_format: typing.Optional[ResponseFormat] = None
    seed: typing.Optional[int] = None
    stop: typing.Optional[ChatCompletionRequestStop] = None
    stream: typing.Optional[bool] = None
    temperature: typing.Optional[float] = None
    top_p: typing.Optional[float] = None
    user: typing.Optional[str] = None
    tools: typing.Optional[typing.List[ToolInput]] = None
    tool_choice: typing.Optional[ChatCompletionRequestToolChoice] = None
    functions: typing.Optional[typing.List[FunctionSchema]] = None
    function_call: typing.Optional[ChatCompletionRequestFunctionCall] = None

    if IS_PYDANTIC_V2:
        model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True)  # type: ignore # Pydantic v2
    else:

        class Config:
            frozen = True
            smart_union = True
            extra = pydantic.Extra.allow
