# 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 .lightningv2request_language import Lightningv2RequestLanguage
from .lightningv2request_output_format import Lightningv2RequestOutputFormat


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

    voice_id: str = pydantic.Field()
    """
    The voice identifier to use for speech generation.
    """

    sample_rate: typing.Optional[int] = pydantic.Field(default=None)
    """
    The sample rate for the generated audio.
    """

    speed: typing.Optional[float] = pydantic.Field(default=None)
    """
    The speed of the generated speech.
    """

    consistency: typing.Optional[float] = pydantic.Field(default=None)
    """
    This parameter controls word repetition and skipping. Decrease it to prevent skipped words, and increase it to prevent repetition.
    """

    similarity: typing.Optional[float] = pydantic.Field(default=None)
    """
    This parameter controls the similarity between the generated speech and the reference audio. Increase it to make the speech more similar to the reference audio.
    """

    enhancement: typing.Optional[float] = pydantic.Field(default=None)
    """
    Enhances speech quality at the cost of increased latency.
    """

    language: typing.Optional[Lightningv2RequestLanguage] = pydantic.Field(default=None)
    """
    Determines how numbers are spelled out. If set to 'en', numbers will be read as individual digits in English. If set to 'hi', numbers will be read as individual digits in Hindi.
    """

    output_format: typing.Optional[Lightningv2RequestOutputFormat] = pydantic.Field(default=None)
    """
    The format of the output audio.
    """

    pronunciation_dicts: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
    """
    The IDs of the pronunciation dictionaries to use for speech generation.
    """

    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
