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

import typing

import pydantic
from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
from .connect_session_settings_audio import ConnectSessionSettingsAudio
from .connect_session_settings_context import ConnectSessionSettingsContext
from .connect_session_settings_variables_value import ConnectSessionSettingsVariablesValue


class ConnectSessionSettings(UniversalBaseModel):
    audio: typing.Optional[ConnectSessionSettingsAudio] = pydantic.Field(default=None)
    """
    Configuration details for the audio input used during the session. Ensures the audio is being correctly set up for processing.
    
    This optional field is only required when the audio input is encoded in PCM Linear 16 (16-bit, little-endian, signed PCM WAV data). For detailed instructions on how to configure session settings for PCM Linear 16 audio, please refer to the [Session Settings section](/docs/empathic-voice-interface-evi/configuration#session-settings) on the EVI Configuration page.
    """

    context: typing.Optional[ConnectSessionSettingsContext] = pydantic.Field(default=None)
    """
    Allows developers to inject additional context into the conversation, which is appended to the end of user messages for the session.
    
    When included in a Session Settings message, the provided context can be used to remind the LLM of its role in every user message, prevent it from forgetting important details, or add new relevant information to the conversation.
    
    Set to `null` to disable context injection.
    """

    custom_session_id: typing.Optional[str] = pydantic.Field(default=None)
    """
    Used to manage conversational state, correlate frontend and backend data, and persist conversations across EVI sessions.
    """

    event_limit: typing.Optional[int] = pydantic.Field(default=None)
    """
    The maximum number of chat events to return from chat history. By default, the system returns up to 300 events (100 events per page × 3 pages). Set this parameter to a smaller value to limit the number of events returned.
    """

    language_model_api_key: typing.Optional[str] = pydantic.Field(default=None)
    """
    Third party API key for the supplemental language model.
    
    When provided, EVI will use this key instead of Hume's API key for the supplemental LLM. This allows you to bypass rate limits and utilize your own API key as needed.
    """

    system_prompt: typing.Optional[str] = pydantic.Field(default=None)
    """
    Instructions used to shape EVI's behavior, responses, and style for the session.
    
    When included in a Session Settings message, the provided Prompt overrides the existing one specified in the EVI configuration. If no Prompt was defined in the configuration, this Prompt will be the one used for the session.
    
    You can use the Prompt to define a specific goal or role for EVI, specifying how it should act or what it should focus on during the conversation. For example, EVI can be instructed to act as a customer support representative, a fitness coach, or a travel advisor, each with its own set of behaviors and response styles.
    
    For help writing a system prompt, see our [Prompting Guide](/docs/speech-to-speech-evi/guides/prompting).
    """

    variables: typing.Optional[typing.Dict[str, ConnectSessionSettingsVariablesValue]] = pydantic.Field(default=None)
    """
    This field allows you to assign values to dynamic variables referenced in your system prompt.
    
    Each key represents the variable name, and the corresponding value is the specific content you wish to assign to that variable within the session. While the values for variables can be strings, numbers, or booleans, the value will ultimately be converted to a string when injected into your system prompt.
    
    Using this field, you can personalize responses based on session-specific details. For more guidance, see our [guide on using dynamic variables](/docs/speech-to-speech-evi/features/dynamic-variables).
    """

    voice_id: typing.Optional[str] = pydantic.Field(default=None)
    """
    The name or ID of the voice from the `Voice Library` to be used as the speaker for this EVI session. This will override the speaker set in the selected configuration.
    """

    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
