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

import typing

import pydantic
from ....core.pydantic_utilities import IS_PYDANTIC_V2
from ....core.unchecked_base_model import UncheckedBaseModel
from .stream_tts_request_message_language import StreamTtsRequestMessageLanguage


class StreamTtsRequestMessage(UncheckedBaseModel):
    voice_id: str = pydantic.Field()
    """
    Voice identifier (e.g., 'aditi', 'male-1', 'female-2')
    """

    text: str = pydantic.Field()
    """
    The text to convert to speech. Can be sent incrementally for streaming input.
    """

    is_streaming: typing.Optional[bool] = pydantic.Field(default=None)
    """
    Indicates if this is part of a streaming text input sequence
    """

    is_final: typing.Optional[bool] = pydantic.Field(default=None)
    """
    Indicates if this is the final chunk in a streaming sequence
    """

    language: typing.Optional[StreamTtsRequestMessageLanguage] = pydantic.Field(default=None)
    """
    Language code for synthesis
    """

    sample_rate: typing.Optional[int] = pydantic.Field(default=None)
    """
    Audio sample rate in Hz
    """

    speed: typing.Optional[float] = pydantic.Field(default=None)
    """
    Speech speed multiplier (0.5 = half speed, 1.0 = normal speed, 2.0 = double speed)
    """

    consistency: typing.Optional[float] = pydantic.Field(default=None)
    """
    Voice consistency parameter for maintaining voice characteristics
    """

    enhancement: typing.Optional[int] = pydantic.Field(default=None)
    """
    Audio enhancement level for improved quality
    """

    similarity: typing.Optional[float] = pydantic.Field(default=None)
    """
    Voice similarity parameter for voice matching
    """

    max_buffer_flush_ms: typing.Optional[int] = pydantic.Field(default=None)
    """
    Maximum buffer time in milliseconds before forcing audio output for low-latency applications
    """

    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
