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

import typing

import pydantic
import typing_extensions
from ....core.pydantic_utilities import IS_PYDANTIC_V2
from ....core.serialization import FieldMetadata
from ....core.unchecked_base_model import UncheckedBaseModel
from .lightning_v31tts_request_message_language import LightningV31TtsRequestMessageLanguage


class LightningV31TtsRequestMessage(UncheckedBaseModel):
    voice_id: str = pydantic.Field()
    """
    The ID of the voice to use
    """

    text: str = pydantic.Field()
    """
    The text to convert to speech
    """

    max_buffer_flush_ms: typing.Optional[int] = pydantic.Field(default=None)
    """
    The maximum time (in ms) to wait for more input before generating output. It flushes when either this time is reached or enough input is received for optimal output—whichever comes first. This is useful for input streams. Defaults to 0
    """

    continue_: typing_extensions.Annotated[
        typing.Optional[bool],
        FieldMetadata(alias="continue"),
        pydantic.Field(
            alias="continue",
            description="This setting controls whether the system should buffer and wait for more input after receiving the current one. If not set, it assumes no more input is coming.",
        ),
    ] = None
    flush: typing.Optional[bool] = pydantic.Field(default=None)
    """
    This setting controls whether the system should flush the current buffer.
    """

    complete_backoff_ms: typing.Optional[float] = pydantic.Field(default=None)
    """
    The time in ms to wait after the last chunk is sent before sending the complete response. Default is 4000ms. Maximum is 10000ms.
    """

    language: typing.Optional[LightningV31TtsRequestMessageLanguage] = pydantic.Field(default=None)
    """
    The language code, available options: `en`, `hi`
    """

    sample_rate: typing.Optional[int] = pydantic.Field(default=None)
    """
    Audio sample rate in Hz. Supported values: 8000, 16000, 24000, 44100
    """

    speed: typing.Optional[float] = pydantic.Field(default=None)
    """
    Speaking speed multiplier
    """

    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
