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

from __future__ import annotations
from r9s.types import BaseModel
from typing import Dict, List, Optional, Union
from typing_extensions import NotRequired, TypeAliasType, TypedDict


CompletionRequestStopTypedDict = TypeAliasType(
    "CompletionRequestStopTypedDict", Union[str, List[str]]
)


CompletionRequestStop = TypeAliasType("CompletionRequestStop", Union[str, List[str]])


class CompletionRequestTypedDict(TypedDict):
    model: str
    r"""Model name"""
    prompt: str
    r"""Prompt text"""
    best_of: NotRequired[int]
    r"""Generate multiple results and return the best one"""
    echo: NotRequired[bool]
    r"""Whether to echo the prompt"""
    frequency_penalty: NotRequired[float]
    logit_bias: NotRequired[Dict[str, float]]
    max_tokens: NotRequired[int]
    n: NotRequired[int]
    presence_penalty: NotRequired[float]
    seed: NotRequired[int]
    stop: NotRequired[CompletionRequestStopTypedDict]
    stream: NotRequired[bool]
    temperature: NotRequired[float]
    top_p: NotRequired[float]
    user: NotRequired[str]


class CompletionRequest(BaseModel):
    model: str
    r"""Model name"""

    prompt: str
    r"""Prompt text"""

    best_of: Optional[int] = None
    r"""Generate multiple results and return the best one"""

    echo: Optional[bool] = False
    r"""Whether to echo the prompt"""

    frequency_penalty: Optional[float] = 0

    logit_bias: Optional[Dict[str, float]] = None

    max_tokens: Optional[int] = None

    n: Optional[int] = 1

    presence_penalty: Optional[float] = 0

    seed: Optional[int] = None

    stop: Optional[CompletionRequestStop] = None

    stream: Optional[bool] = False

    temperature: Optional[float] = 1

    top_p: Optional[float] = 1

    user: Optional[str] = None
