"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT."""

from __future__ import annotations
import dataclasses
from dataclasses_json import Undefined, dataclass_json
from retellclient import utils
from typing import Dict, List, Optional, Literal, Union

@dataclass_json(undefined=Undefined.EXCLUDE)
@dataclasses.dataclass
class FunctionParameters:
    type: Literal["object"] = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('type') }})
    r"""The type of parameters is object."""
    properties: Dict[str, any] = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('properties') }})
    r"""Key-value pairs object where each key is the name of a property and each value is a schema used to validate that property."""
    required: Optional[List[str]] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('required'), 'exclude': lambda f: f is None }})
    r"""Defines what properties are required for the parameters."""


@dataclass_json(undefined=Undefined.EXCLUDE)
@dataclasses.dataclass
class Function:
    url: str = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('url') }})
    r"""Link to the url where the function call parameters would sent to as a json body. Most likely your server endpoint you expose for this function."""
    name: str = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('name') }})
    r"""The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64."""
    description: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('description'), 'exclude': lambda f: f is None }})
    r"""A description of what the function does, used by the model to choose when and how to call the function. Recommended to populate this for better results."""
    parameters: Optional[FunctionParameters] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('parameters'), 'exclude': lambda f: f is None }})
    r"""The parameters the functions accepts, described as a JSON Schema object for type object. """

@dataclass_json(undefined=Undefined.EXCLUDE)
@dataclasses.dataclass
class RetellLlmSetting:
    provider: Literal["retell"] = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('provider') }})
    r"""Retell picked LLM based conversation response."""
    prompt: str = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('prompt') }})
    r"""The prompt agent will follow. Can use `${YOUR_PARAM_NAME}` to represent dynamic data that would get injected at each call."""

@dataclass_json(undefined=Undefined.EXCLUDE)
@dataclasses.dataclass
class CustomLlmSetting:
    provider: Literal["custom"] = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('provider') }})
    r"""Custom response system, usually your custom LLM. Note that you may see a higher latency if provided server is slow."""
    url: str = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('url') }})
    r"""The URL we will call for getting response, usually your server."""
    stream: bool = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('stream') }})
    r"""Whether the provided URL support return response via Server Sent Events."""

@dataclass_json(undefined=Undefined.EXCLUDE)
@dataclasses.dataclass
class InteractionSettingRequest:
    enable_begin_message: Optional[bool] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('enable_begin_message'), 'exclude': lambda f: f is None }})
    r"""Whether the agent begins the call with a pre-defined message. When this is false, the agent will still start the call, but with a dynamic message. If you wish for user to be the first to talk, set this to true and set `begin_message` as empty string."""
    begin_message: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('begin_message'), 'exclude': lambda f: f is None }})
    r"""Pre-defined message for agent to say in the begining of call. Only used when `enable_begin_message` is true. When empty, agent would wait for user to talk first."""
    enable_end_call: Optional[bool] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('enable_end_call'), 'exclude': lambda f: f is None }})
    r"""Whether the agent can end a call. If false, the agent would never end a call."""
    enable_end_message: Optional[bool] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('enable_end_message'), 'exclude': lambda f: f is None }})
    r"""Whether the agent attempts to end the call with a pre-defined message. When this is false, the agent might still be the last one speaking in the call, but the massage can be dynamic."""
    end_message: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('end_message'), 'exclude': lambda f: f is None }})
    r"""Pre-defined message for agent to say when agent ends the call. Only used when `enable_end_call` and `enable_end_message` is true. If you wish for agent to hang up without saying anything, set this to empty string."""

@dataclass_json(undefined=Undefined.EXCLUDE)
@dataclasses.dataclass
class InteractionSettingResponse:
    enable_begin_message: bool = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('enable_begin_message') }})
    r"""Whether the agent begins the call with a pre-defined message. When this is false, the agent will still start the call, but with a dynamic message. If you wish for user to be the first to talk, set this to true and set `begin_message` as empty string."""
    enable_end_call: bool = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('enable_end_call') }})
    r"""Whether the agent can end a call. If false, the agent would never end a call."""
    enable_end_message: bool = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('enable_end_message') }})
    r"""Whether the agent attempts to end the call with a pre-defined message. When this is false, the agent might still be the last one speaking in the call, but the massage can be dynamic."""
    begin_message: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('begin_message'), 'exclude': lambda f: f is None }})
    r"""Pre-defined message for agent to say in the begining of call. Only used when `enable_begin_message` is true. When empty, agent would wait for user to talk first."""
    end_message: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('end_message'), 'exclude': lambda f: f is None }})
    r"""Pre-defined message for agent to say when agent ends the call. Only used when `enable_end_call` and `enable_end_message` is true. If you wish for agent to hang up without saying anything, set this to empty string."""
    

@dataclass_json(undefined=Undefined.EXCLUDE)
@dataclasses.dataclass
class Agent:
    agent_id: str = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('agent_id') }})
    r"""Unique id of agent."""
    voice_id: str = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('voice_id') }})
    r"""Unique voice id used for the agent. Find list of available voices in documentation."""
    llm_setting: Union[RetellLlmSetting, CustomLlmSetting] = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('llm_setting') }})
    r"""Determines how to generate the response in the call. Currently supports using our in-house LLM response system or your own custom response generation system."""
    interaction_setting: InteractionSettingResponse = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('interaction_setting') }})
    r"""Setting combination that controls interaction flow, like begin and end logic."""
    last_modification_timestamp: int = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('last_modification_timestamp') }})
    r"""Last modification timestamp (milliseconds since epoch). Either the time of last update or creation if no updates available."""
    agent_name: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('agent_name'), 'exclude': lambda f: f is None }})
    r"""The name of the agent. Only used for your own reference."""
    functions: Optional[List[Function]] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('functions'), 'exclude': lambda f: f is None }})
    r"""Functions are the actions that the agent can perform, like booking appointments, retriving information, etc."""

