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

import datetime as dt
import typing

from ...core.datetime_utils import serialize_datetime

try:
    import pydantic.v1 as pydantic  # type: ignore
except ImportError:
    import pydantic  # type: ignore


class VoiceSettings(pydantic.BaseModel):
    stability: typing.Optional[float] = pydantic.Field(default=None)
    """
    Note: This is an experimental parameter and may behave unexpectedly.
    
    Adjust the predictability and consistency of the AI agent's voice. Lower values allow larger deviations from the baseline voice, whether default or cloned. Setting this too high however can cause a monotone voice.
    
    Accepts decimal values between `0` and `1` (inclusive).
    """

    similarity: typing.Optional[float] = pydantic.Field(default=None)
    """
    Note: This is an experimental parameter and may behave unexpectedly.
    
    Higher values will make speech differences between the selected voice and others more prominent. Extremely high values can cause voice distortion.
    
    Use lower values to lower the distinctiveness of the voice or eliminate unwanted audio static spikes.
    
    Accepts decimal values between `0` and `1` (inclusive).
    """

    speed: typing.Optional[float] = pydantic.Field(default=None)
    """
    Note: This is an experimental parameter and may behave unexpectedly.
    
    Note #2: Setting `reduce_latency` to false will cause this parameter to be ignored.
    
    How fast your agent talks! This parameter is simply a speech-speed multiplier, and works with fractional values such as `0.5` or large ones like `2`.
    
    Accepts decimal values between `0.1` and `5` (inclusive).
    """

    def json(self, **kwargs: typing.Any) -> str:
        kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
        return super().json(**kwargs_with_defaults)

    def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
        kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
        return super().dict(**kwargs_with_defaults)

    class Config:
        frozen = True
        smart_union = True
        json_encoders = {dt.datetime: serialize_datetime}
