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

import datetime as dt
import typing

from ...commons.types.custom_tool import CustomTool
from ...core.datetime_utils import serialize_datetime
from ...core.pydantic_utilities import pydantic_v1


class CreateWebAgentRequest(pydantic_v1.BaseModel):
    prompt: str = pydantic_v1.Field()
    """
    Provide instructions, relevant information, and examples of the ideal conversation flow.
    """

    voice: typing.Optional[str] = pydantic_v1.Field(default=None)
    """
    Set your agent's voice - all available voices can be found with the [List Voices](https://docs.bland.ai/api-v1/get/voices) endpoint.
    """

    analysis_schema: typing.Optional[typing.Any] = pydantic_v1.Field(default=None)
    """
    Define a JSON schema for how you want to get information about the call - information like email addresses, names, appointment times or any other type of custom data.
    
    In the webhook response or whenever you retrieve call data later, you’ll get the data you defined back under analysis.
    """

    metadata: typing.Optional[typing.Any] = pydantic_v1.Field(default=None)
    """
    Add any additional information you want to associate with the call. This can be useful for tracking or categorizing calls.
    """

    pathway_id: typing.Optional[str] = pydantic_v1.Field(default=None)
    """
    Set the pathway that your agent will follow. This will override the prompt field, so there is no need to pass the ‘prompt’ field if you are setting a pathway.
    
    Warning: Setting a pathway will set the following fields to null / their default value - prompt, first_sentence, model, dynamic_data, tools
    
    Set to null or an empty string to clear the pathway.
    """

    language: typing.Optional[str] = pydantic_v1.Field(default=None)
    """
    Select a supported language of your choice. Optimizes every part of our API for that language - transcription, speech, and other inner workings.
    
    Supported Languages and their codes:
    
    English: ENG
    Spanish: ESP
    French: FRE
    Polish: POL
    German: GER
    Italian: ITA
    Brazilian Portuguese: PBR
    Portuguese: POR
    """

    model: typing.Optional[str] = pydantic_v1.Field(default=None)
    """
    Select a model to use for your call.
    
    Options: base, turbo and enhanced.
    
    In nearly all cases, enhanced is the best choice for now.
    """

    first_sentence: typing.Optional[str] = pydantic_v1.Field(default=None)
    """
    A phrase that your call will start with instead of a generating one on the fly. This works both with and without wait_for_greeting. Can be more than one sentence, but must be less than 200 characters.
    
    To remove, set to null or an empty string.
    """

    tools: typing.Optional[typing.List[CustomTool]] = pydantic_v1.Field(default=None)
    """
    Interact with the real world through API calls.
    
    Detailed tutorial here: [Custom Tools](https://docs.bland.ai/tutorials/custom-tools)
    """

    dynamic_data: typing.Optional[typing.Any] = pydantic_v1.Field(default=None)
    """
    Integrate data from external APIs into your agent’s knowledge.
    
    Set to null or an empty string to clear dynamic data settings.
    
    Detailed usage in the [Send Call](https://docs.bland.ai/api-v1/post/calls) endpoint.
    """

    interruption_threshold: typing.Optional[int] = pydantic_v1.Field(default=None)
    """
    When you increase the interruption latency, you force the AI phone agent to listen longer before responding. In practice, increasing the threshold results in less interruptions and more latency.
    
    Try setting the threshold to 500 milliseconds. You’ll encounter higher latency, but you’ll be interrupted less frequently.
    
    Set to null to reset to default.
    """

    max_duration: typing.Optional[int] = pydantic_v1.Field(default=None)
    """
    Set the maximum duration of the call in seconds. The call will be automatically disconnected after this time.
    
    Set to null to reset to default.
    """

    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
        extra = pydantic_v1.Extra.allow
        json_encoders = {dt.datetime: serialize_datetime}
