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

199 lines (198 loc) 10.3 kB
import type * as Phonic from "../index.mjs"; export interface Conversation { /** The conversation ID. */ id: string; /** The agent associated with the conversation. */ agent: Conversation.Agent | null; /** The organization/workspace name. */ workspace: string; /** The project associated with the conversation. */ project: Conversation.Project; /** External ID for conversation tracking. */ external_id: string | null; /** The origin of the conversation. */ origin: Conversation.Origin; /** The STS model used. */ model: string; /** Will be `true` if welcome message was automatically generated. */ generate_welcome_message: boolean; /** When `false`, the welcome message will not be interruptible by the user. */ is_welcome_message_interruptible: boolean; /** Welcome message played at start. Will be `null` when `generate_welcome_message` is `true`. */ welcome_message: string | null; /** Template variables used in the conversation. */ template_variables: Record<string, string>; /** System prompt used in the conversation. */ system_prompt?: (string | null) | undefined; /** Audio input format. */ input_format: string; /** Audio output format. */ output_format: string; /** Background noise level used in the conversation. */ background_noise_level: number; /** The background noise type used in the conversation. */ background_noise: Conversation.BackgroundNoise | null; /** Live transcript of the conversation. */ live_transcript: string | null; /** Post-call processed transcript. */ post_call_transcript: string | null; /** Duration of the conversation in milliseconds. */ duration_ms: number; /** Presigned URL to the conversation audio file. Expires in 1 day. */ audio_url: string | null; /** When the conversation started. */ started_at: string | null; /** When the conversation ended. */ ended_at: string | null; /** Who or what ended the conversation. */ ended_by: Conversation.EndedBy | null; /** These words, or short phrases, are more accurately recognized by the model. */ boosted_keywords: string[] | null; /** Array of `{ word, pronunciation }` entries. Words must be unique. */ pronunciation_dictionary: Conversation.PronunciationDictionary.Item[]; /** Minimum number of words required to interrupt the assistant. */ min_words_to_interrupt: number; /** 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; /** 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[] | null; /** 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: Conversation.MultilingualMode; /** Push to talk mode. User must send mute/unmute messages to turn on/off listening to audio. Defaults to false. */ push_to_talk: boolean; /** Array of ISO 639-1 language codes recognized by the model. This field is deprecated. Use `default_language` and `additional_languages` instead. */ languages?: string[] | undefined; /** Whether the no-input poke text was generated by AI. */ generate_no_input_poke_text?: (boolean | null) | undefined; /** Number of seconds of silence before a poke message is sent. `null` means the poke message is disabled. */ no_input_poke_sec: number | null; /** The message to send after the specified silence. Relevant only if `no_input_poke_sec` is not `null`. Ignored when generate_no_input_poke_text is true. */ no_input_poke_text: string | null; /** Seconds of silence before the conversation is ended. */ no_input_end_conversation_sec: number | null; /** The WebSocket idle timeout in seconds. */ websocket_timeout_sec?: number | undefined; /** Voice activity detection prebuffer duration in milliseconds. `null` when not applicable or unknown (e.g. push-to-talk, or legacy stored conversations). */ vad_prebuffer_duration_ms?: (number | null) | undefined; /** Minimum speech duration for voice activity detection in milliseconds. `null` when not applicable or unknown. */ vad_min_speech_duration_ms?: (number | null) | undefined; /** Minimum silence duration for voice activity detection in milliseconds. `null` when not applicable or unknown. */ vad_min_silence_duration_ms?: (number | null) | undefined; /** Voice activity detection threshold. `null` when not applicable or unknown. */ vad_threshold?: (number | null) | undefined; /** Results from conversation evaluations and extractions. */ task_results: Record<string, unknown>; /** Array of conversation items (turns). */ items: Phonic.ConversationItem[]; /** Phone call metadata. `null` for non-phone call conversations. */ call_info: Conversation.CallInfo | null; /** Analysis of the conversation including latencies and interruptions. */ analysis: Phonic.ConversationAnalysis; /** Whether PII and PHI have been redacted from the conversation. */ is_redacted?: boolean | undefined; /** The redacted transcript of the conversation. `null` when the conversation is not redacted. */ redacted_transcript?: (string | null) | undefined; /** Arbitrary metadata associated with the conversation. */ metadata?: (Record<string, unknown> | null) | undefined; /** Controls how long transcripts and audio recordings are retained before deletion. */ data_retention_policy?: Phonic.DataRetentionPolicy | undefined; /** Information about when transcripts and audio recordings are or were scheduled to be deleted. */ deletion_info?: Conversation.DeletionInfo | undefined; /** Whether the assistant produced backchannel responses during the conversation. */ enable_assistant_backchannel?: boolean | undefined; /** How aggressively the assistant produced backchannel responses during the conversation. */ assistant_backchannel_aggressiveness?: (number | null) | undefined; } export declare namespace Conversation { /** * The agent associated with the conversation. */ interface Agent { /** The ID of the agent. */ id: string; /** The name of the agent. */ name: string; /** Whether the agent has been deleted. */ is_deleted: boolean; } /** * The project associated with the conversation. */ interface Project { /** The ID of the project. */ id: string; /** The name of the project. */ name: string; } /** The origin of the conversation. */ const Origin: { readonly Web: "web"; readonly WebPlayground: "web-playground"; readonly WebDemo: "web-demo"; readonly Direct: "direct"; readonly LivekitAgentsPy: "livekit-agents-py"; readonly LivekitAgentsJs: "livekit-agents-js"; readonly SdkPy: "sdk-py"; readonly SdkJs: "sdk-js"; readonly Inbound: "inbound"; readonly TelephonyInbound: "telephony-inbound"; readonly Outbound: "outbound"; readonly TelephonyOutbound: "telephony-outbound"; readonly Replay: "replay"; }; type Origin = (typeof Origin)[keyof typeof Origin]; /** The background noise type used in the conversation. */ const BackgroundNoise: { readonly Office: "office"; readonly CallCenter: "call-center"; readonly CoffeeShop: "coffee-shop"; }; type BackgroundNoise = (typeof BackgroundNoise)[keyof typeof BackgroundNoise]; /** Who or what ended the conversation. */ const EndedBy: { readonly User: "user"; readonly UserCanceled: "user_canceled"; readonly UserValidationFailed: "user_validation_failed"; readonly Assistant: "assistant"; readonly AssistantSilenceLimitReached: "assistant_silence_limit_reached"; readonly ConfigurationEndpointTimedOut: "configuration_endpoint_timed_out"; readonly ConfigurationEndpointError: "configuration_endpoint_error"; readonly ConfigurationEndpointInvalidResponse: "configuration_endpoint_invalid_response"; readonly Error: "error"; }; type EndedBy = (typeof EndedBy)[keyof typeof EndedBy]; type PronunciationDictionary = PronunciationDictionary.Item[]; namespace PronunciationDictionary { interface Item { word: string; pronunciation: string; } } /** 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]; /** * Phone call metadata. `null` for non-phone call conversations. */ interface CallInfo { /** Caller phone number in E.164 format. */ from_phone_number: string; /** Callee phone number in E.164 format. */ to_phone_number: string; /** Twilio Call SID. Only present for user SIP trunking calls. */ twilio_call_sid?: string | undefined; } /** * Information about when transcripts and audio recordings are or were scheduled to be deleted. */ interface DeletionInfo { /** When the transcripts were deleted. `null` if not deleted. */ transcripts_deleted_at: string | null; /** When the audio recordings were deleted. `null` if not deleted. */ audio_recordings_deleted_at: string | null; } }