UNPKG

phonic

Version:

[![fern shield](https://img.shields.io/badge/%F0%9F%8C%BF-Built%20with%20Fern-brightgreen)](https://buildwithfern.com?utm_source=github&utm_medium=github&utm_campaign=readme&utm_source=https%3A%2F%2Fgithub.com%2FPhonic-Co%2Fphonic-node) [![npm shield](htt

124 lines (123 loc) 7.77 kB
import type * as Phonic from "../index.mjs"; /** * When an `agent` is provided, these `config` options override the agent settings. */ export interface OutboundCallConfig { /** The name of the agent to use for the call. */ agent?: string | undefined; /** The name of the project to use for the call. */ project?: string | undefined; /** When `true`, the welcome message will be automatically generated and the `welcome_message` field will be ignored. */ generate_welcome_message?: boolean | undefined; /** When `false`, the welcome message will not be interruptible by the user. */ is_welcome_message_interruptible?: boolean | undefined; /** Message to play when the conversation starts. Can contain template variables like `{{customer_name}}`. Ignored when `generate_welcome_message` is `true`. */ welcome_message?: (string | null) | undefined; /** Instructions for the conversation. Can contain template variables like `{{subject}}`. */ system_prompt?: string | undefined; /** Variables that can be used in the welcome message and the system prompt. */ template_variables?: Record<string, string> | undefined; /** The voice ID to use for the agent. */ voice_id?: string | undefined; /** Whether to have the no-input poke text be generated by AI. */ generate_no_input_poke_text?: boolean | undefined; /** Number of seconds of silence before sending a poke message. `null` disables the poke message. */ no_input_poke_sec?: (number | null) | undefined; /** The message to send after the specified silence. Ignored when generate_no_input_poke_text is true. */ no_input_poke_text?: string | undefined; /** Seconds of silence before ending the conversation. */ no_input_end_conversation_sec?: number | undefined; /** ISO 639-1 language code that sets the agent's default language to recognize and speak. Welcome message and no input poke text should be in this language. */ default_language?: Phonic.LanguageCode | undefined; /** Array of additional ISO 639-1 language codes that the agent should be able to recognize and speak. Should not include `default_language`. When `multilingual_mode` is `"auto"`, a maximum of 2 additional languages is allowed. */ additional_languages?: Phonic.LanguageCode[] | undefined; /** Array of ISO 639-1 language codes that the agent should be able to recognize. This field is deprecated. Use `default_language` and `additional_languages` instead. */ languages?: Phonic.LanguageCode[] | undefined; /** If `"auto"`, each user audio is automatically identified for the language to respond in. If `"request"`, user must request to change language (recommended). If `"initial"` the first turn user audio determines the language for the rest of the conversation. */ multilingual_mode?: OutboundCallConfig.MultilingualMode | undefined; /** Push to talk mode. User must send mute/unmute messages to turn on/off listening to audio. Defaults to false. */ push_to_talk?: boolean | undefined; /** The intelligence level of the agent. `high` uses a more capable model for more complex reasoning, while `standard` is optimized for lower latency. */ intelligence_level?: OutboundCallConfig.IntelligenceLevel | undefined; /** These words, or short phrases, will be more accurately recognized by the agent. */ boosted_keywords?: string[] | undefined; /** Array of `{ word, pronunciation }` entries. Words must be unique. */ pronunciation_dictionary?: OutboundCallConfig.PronunciationDictionary.Item[] | undefined; /** Minimum number of words required to interrupt the assistant. */ min_words_to_interrupt?: number | undefined; /** Array of built-in or custom tool names to use. */ tools?: OutboundCallConfig.Tools.Item[] | undefined; /** When `true`, PII and PHI are redacted from text transcripts (e.g. replaced with tags like `[PHONE NUMBER]`) and bleeped from audio recordings after the conversation ends. */ enable_redaction?: boolean | undefined; /** The speech-to-speech model to use. */ model?: "merritt" | undefined; /** The audio speed of the agent. */ audio_speed?: number | undefined; /** The background noise type. Can be "office", "call-center", "coffee-shop", or null. */ background_noise?: (OutboundCallConfig.BackgroundNoise | null) | undefined; /** The background noise level of the agent. */ background_noise_level?: number | undefined; /** Array of MCP server names to use. */ mcp_servers?: string[] | undefined; /** Array of task objects with `name` and `description` fields. */ tasks?: Phonic.Task[] | undefined; /** Pool of phone numbers used for outbound calls. */ outbound_number_pool?: (Phonic.OutboundNumberPool | null) | undefined; /** When `true`, the assistant will produce backchannel responses (e.g. "mm-hmm") while the user is speaking. */ enable_assistant_backchannel?: boolean | undefined; /** How aggressively the assistant produces backchannel responses. Only relevant when `enable_assistant_backchannel` is `true`. */ assistant_backchannel_aggressiveness?: number | undefined; /** When not `null`, at the beginning of the conversation the agent will make a POST request to this endpoint to get configuration options. */ configuration_endpoint?: (OutboundCallConfig.ConfigurationEndpoint | null) | undefined; /** Additional runtime parameters. */ additional_params?: Record<string, unknown> | undefined; /** Controls how long transcripts and audio recordings are retained before deletion. */ data_retention_policy?: Phonic.DataRetentionPolicy | undefined; } export declare namespace OutboundCallConfig { /** If `"auto"`, each user audio is automatically identified for the language to respond in. If `"request"`, user must request to change language (recommended). If `"initial"` the first turn user audio determines the language for the rest of the conversation. */ const MultilingualMode: { readonly Auto: "auto"; readonly Request: "request"; readonly Initial: "initial"; }; type MultilingualMode = (typeof MultilingualMode)[keyof typeof MultilingualMode]; /** The intelligence level of the agent. `high` uses a more capable model for more complex reasoning, while `standard` is optimized for lower latency. */ const IntelligenceLevel: { readonly Standard: "standard"; readonly High: "high"; }; type IntelligenceLevel = (typeof IntelligenceLevel)[keyof typeof IntelligenceLevel]; type PronunciationDictionary = PronunciationDictionary.Item[]; namespace PronunciationDictionary { interface Item { word: string; pronunciation: string; } } type Tools = Tools.Item[]; namespace Tools { type Item = "keypad_input" | "natural_conversation_ending" /** * Custom tool */ | string; } /** The background noise type. Can be "office", "call-center", "coffee-shop", or null. */ const BackgroundNoise: { readonly Office: "office"; readonly CallCenter: "call-center"; readonly CoffeeShop: "coffee-shop"; }; type BackgroundNoise = (typeof BackgroundNoise)[keyof typeof BackgroundNoise]; /** * When not `null`, at the beginning of the conversation the agent will make a POST request to this endpoint to get configuration options. */ interface ConfigurationEndpoint { /** URL to call */ url: string; /** Object of key-value pairs. */ headers?: Record<string, string> | undefined; /** Timeout in milliseconds for the endpoint call. */ timeout_ms?: number | undefined; } }