// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../core/resource'; import * as ChatAPI from './chat'; import { APIPromise } from '../core/api-promise'; import { buildHeaders } from '../internal/headers'; import { RequestOptions } from '../internal/request-options'; import { path } from '../internal/utils/path'; export class Chat extends APIResource { /** * Create a chat session * * @example * ```ts * const chatResponse = await client.chat.create({ * agent_id: 'oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD', * }); * ``` */ create(body: ChatCreateParams, options?: RequestOptions): APIPromise { return this._client.post('/create-chat', { body, ...options }); } /** * Retrieve details of a specific chat * * @example * ```ts * const chatResponse = await client.chat.retrieve( * '16b980523634a6dc504898cda492e939', * ); * ``` */ retrieve(chatID: string, options?: RequestOptions): APIPromise { return this._client.get(path`/get-chat/${chatID}`, options); } /** * Update metadata and sensitive data storage settings for an existing chat. * * @example * ```ts * const chatResponse = await client.chat.update( * 'chat_98c1a2157aa0559144d67bb0729', * { * data_storage_setting: 'everything', * metadata: { * customer_id: 'cust_123', * notes: 'Follow-up required', * }, * override_dynamic_variables: { * additional_discount: '15%', * }, * }, * ); * ``` */ update(chatID: string, body: ChatUpdateParams, options?: RequestOptions): APIPromise { return this._client.patch(path`/update-chat/${chatID}`, { body, ...options }); } /** * List chats with unified cursor pagination response. * * @example * ```ts * const chats = await client.chat.list(); * ``` */ list(body: ChatListParams | null | undefined = {}, options?: RequestOptions): APIPromise { return this._client.post('/v3/list-chats', { body, timeout: (this._client as any)._options.timeout ?? 300000, ...options, }); } /** * Delete an existing chat * * @example * ```ts * await client.chat.delete( * '16b980523634a6dc504898cda492e939', * ); * ``` */ delete(chatID: string, options?: RequestOptions): APIPromise { return this._client.delete(path`/delete-chat/${chatID}`, { ...options, headers: buildHeaders([{ Accept: '*/*' }, options?.headers]), }); } /** * Create a chat completion message * * @example * ```ts * const response = await client.chat.createChatCompletion({ * chat_id: 'oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD', * content: 'hi how are you doing?', * }); * ``` */ createChatCompletion( body: ChatCreateChatCompletionParams, options?: RequestOptions, ): APIPromise { return this._client.post('/create-chat-completion', { body, timeout: (this._client as any)._options.timeout ?? 300000, ...options, }); } /** * Start an outbound SMS chat conversation with a phone number using the specified * agent. The agent must be configured for chat mode. The initial SMS message will * be automatically generated and sent based on the agent's configuration. * * @example * ```ts * const chatResponse = await client.chat.createSMSChat({ * from_number: '+12137771234', * to_number: '+14155551234', * }); * ``` */ createSMSChat(body: ChatCreateSMSChatParams, options?: RequestOptions): APIPromise { return this._client.post('/create-sms-chat', { body, maxRetries: 0, ...options }); } /** * End an ongoing chat * * @example * ```ts * await client.chat.end('16b980523634a6dc504898cda492e939'); * ``` */ end(chatID: string, options?: RequestOptions): APIPromise { return this._client.patch(path`/end-chat/${chatID}`, { ...options, headers: buildHeaders([{ Accept: '*/*' }, options?.headers]), }); } /** * Record a user or human transfer-target message in an ongoing escalated chat. SMS * chats accept only transfer_target and send SMS before recording. API chats only * record; delivery is the customer's responsibility. Idempotency keys are scoped * to the organization. Successful results are retained for 24 hours. Concurrent * requests with the same key wait for the lock. Reusing a key after success * returns 200 with the original message_id and created_timestamp, without sending * again. No duplicate-key error is raised. Failures are not cached and release the * lock so the same key can be retried. Each execution makes one SMS send attempt. * If delivery is uncertain or processing fails after sending, a retried request * can send the SMS again and cause duplicates. * * @example * ```ts * const response = await client.chat.recordMessage( * 'chat_id', * { * idempotency_key: 'x', * message: 'x', * role: 'user', * }, * ); * ``` */ recordMessage( chatID: string, body: ChatRecordMessageParams, options?: RequestOptions, ): APIPromise { return this._client.post(path`/record-chat-message/${chatID}`, { body, ...options }); } /** * Rerun post-chat analysis for a specific chat. This operation incurs charges. * * @example * ```ts * const chatResponse = await client.chat.rerunAnalysis( * 'chat_16b980523634a6dc504898cda492e939', * ); * ``` */ rerunAnalysis(chatID: string, options?: RequestOptions): APIPromise { return this._client.put(path`/rerun-chat-analysis/${chatID}`, options); } } export interface ChatResponse { /** * Corresponding chat agent id of this chat. */ agent_id: string; /** * Unique id of the chat. */ chat_id: string; /** * Status of chat. * * - `ongoing`: Chat session is ongoing, chat agent can receive new message and * generate response. * - `ended`: Chat session has ended, and no longer can generate new response. * - `error`: Chat encountered error. */ chat_status: 'ongoing' | 'ended' | 'error'; /** * Tag pointing at the agent version used for this chat */ agent_tag?: string | null; /** * Post chat analysis that includes information such as sentiment, status, summary, * and custom defined data to extract. Available after chat ends. Subscribe to * `chat_analyzed` webhook event type to receive it once ready. */ chat_analysis?: ChatResponse.ChatAnalysis; chat_cost?: ChatResponse.ChatCost; /** * Type of the chat */ chat_type?: 'api_chat' | 'sms_chat'; /** * Dynamic variables collected from the chat. Only available after the chat ends. */ collected_dynamic_variables?: { [key: string]: string }; /** * Custom attributes for the chat */ custom_attributes?: { [key: string]: string | number | boolean }; /** * End timestamp (milliseconds since epoch) of the chat. Available after chat ends. */ end_timestamp?: number | null; /** * Whether this chat has been handed to a human. */ is_escalated?: boolean; /** * Transcript of the chat weaved with tool call invocation and results. */ message_with_tool_calls?: Array< | ChatResponse.MessageBase | ChatResponse.ToolCallInvocationMessageBase | ChatResponse.ToolCallResultMessageBase | ChatResponse.NodeTransitionMessageBase | ChatResponse.StateTransitionMessageBase | ChatResponse.InjectedMessageBase | ChatResponse.SMSMessageBase >; /** * An arbitrary object for storage purpose only. You can put anything here like * your internal customer id associated with the chat. Not used for processing. You * can later get this field from the chat object. */ metadata?: unknown; /** * Tool call invocations and results of integration tools run after post-chat * analysis (post-session). Stored separately from the main transcript. Available * after chat ends if post-session integration tools ran. */ post_session_message_with_tool_calls?: Array< | ChatResponse.MessageBase | ChatResponse.ToolCallInvocationMessageBase | ChatResponse.ToolCallResultMessageBase | ChatResponse.NodeTransitionMessageBase | ChatResponse.StateTransitionMessageBase | ChatResponse.InjectedMessageBase | ChatResponse.SMSMessageBase >; /** * Tool call invocations and results of integration tools run before the chat's * first message (pre-session). Stored separately from the main transcript. * Available once pre-session integration tools have run (from the chat's first * turn). */ pre_session_message_with_tool_calls?: Array< | ChatResponse.MessageBase | ChatResponse.ToolCallInvocationMessageBase | ChatResponse.ToolCallResultMessageBase | ChatResponse.NodeTransitionMessageBase | ChatResponse.StateTransitionMessageBase | ChatResponse.InjectedMessageBase | ChatResponse.SMSMessageBase >; /** * Add optional dynamic variables in key value pairs of string that injects into * your Response Engine prompt and tool description. Only applicable for Response * Engine. */ retell_llm_dynamic_variables?: { [key: string]: string }; /** * Post-session integration tool call invocations and results, without PII. * Available after chat ends if post-session integration tools ran and PII * scrubbing is enabled. */ scrubbed_post_session_message_with_tool_calls?: Array< | ChatResponse.MessageBase | ChatResponse.ToolCallInvocationMessageBase | ChatResponse.ToolCallResultMessageBase | ChatResponse.NodeTransitionMessageBase | ChatResponse.StateTransitionMessageBase | ChatResponse.InjectedMessageBase | ChatResponse.SMSMessageBase >; /** * Pre-session integration tool call invocations and results, without PII. * Available after chat ends if pre-session integration tools ran and PII scrubbing * is enabled. */ scrubbed_pre_session_message_with_tool_calls?: Array< | ChatResponse.MessageBase | ChatResponse.ToolCallInvocationMessageBase | ChatResponse.ToolCallResultMessageBase | ChatResponse.NodeTransitionMessageBase | ChatResponse.StateTransitionMessageBase | ChatResponse.InjectedMessageBase | ChatResponse.SMSMessageBase >; /** * Begin timestamp (milliseconds since epoch) of the chat. Available after chat * starts. */ start_timestamp?: number; /** * Transcription of the chat, including human replies labeled "Transfer Target". */ transcript?: string; /** * The version of the agent */ version?: number | null; } export namespace ChatResponse { /** * Post chat analysis that includes information such as sentiment, status, summary, * and custom defined data to extract. Available after chat ends. Subscribe to * `chat_analyzed` webhook event type to receive it once ready. */ export interface ChatAnalysis { /** * Whether the agent seems to have a successful chat with the user, where the agent * finishes the task, and the call was complete without being cutoff. */ chat_successful?: boolean; /** * A high level summary of the chat. */ chat_summary?: string; /** * Custom analysis data that was extracted based on the schema defined in chat * agent post chat analysis data. Can be empty if nothing is specified. */ custom_analysis_data?: unknown; /** * Sentiment of the user in the chat. */ user_sentiment?: 'Negative' | 'Positive' | 'Neutral' | 'Unknown'; } export interface ChatCost { /** * Combined cost of all individual costs in cents */ combined_cost?: number; /** * List of products with their unit prices and costs in cents */ product_costs?: Array; } export namespace ChatCost { export interface ProductCost { /** * Cost for the product in cents for the duration of the call. */ cost: number; /** * Product name that has a cost associated with it. */ product: string; /** * True if this cost item is for a transfer segment. */ is_transfer_leg_cost?: boolean; /** * Unit price of the product in cents per second. */ unit_price?: number; } } export interface MessageBase { /** * Content of the message */ content: string; /** * Whether this message is sent by the AI agent, user, or human transfer target. */ role: 'agent' | 'user' | 'transfer_target'; /** * Create timestamp of the message */ created_timestamp?: number; customer_defined_metadata?: MessageBase.CustomerDefinedMetadata; /** * Unique id of the message */ message_id?: string; /** * Multimedia attachments received with this message (MMS). Display only; a textual * summary of each attachment is already included in content. Response only — * supplying it in a request has no effect and is silently ignored. Omitted from * PII-scrubbed messages. */ multimedia?: Array; } export namespace MessageBase { export interface CustomerDefinedMetadata { transfer_target_name?: string; } export interface Multimedia { /** * URL of the multimedia attachment. */ url: string; /** * Optional textual summary of the attachment. */ summary?: string; } } export interface ToolCallInvocationMessageBase { /** * Arguments for this tool call, it's a stringified JSON object. */ arguments: string; /** * Name of the tool. This is the configured tool name, or the node name for a * built-in conversation flow node, so it can contain spaces and non-ASCII * characters. To identify the kind of tool, use `type`. */ name: string; /** * This is a tool call invocation. */ role: 'tool_call_invocation'; /** * Tool call id, globally unique. */ tool_call_id: string; /** * Create timestamp of the message */ created_timestamp?: number; /** * Unique id of the message */ message_id?: string; /** * Optional thought signature from Google Gemini thinking models. This is used * internally to maintain reasoning chain in multi-turn function calling. */ thought_signature?: string; /** * Kind of tool. Known values are `custom`, `code`, `mcp`, `integration_app`, * `end_call`, `transfer_call`, `bridge_transfer`, `cancel_transfer`, `agent_swap`, * `press_digit`, `send_sms`, `extract_dynamic_variable`, `adjust_voice_speed`, * `book_appointment_cal`, and `check_availability_cal`. New values can be added. * Absent on tool calls sent by a custom LLM, and on some older calls and chats. */ type?: string; } export interface ToolCallResultMessageBase { /** * Result of the tool call, can be a string, a stringified json, etc. */ content: string; /** * This is the result of a tool call. */ role: 'tool_call_result'; /** * Tool call id, globally unique. */ tool_call_id: string; /** * Create timestamp of the message */ created_timestamp?: number; /** * Unique id of the message */ message_id?: string; /** * Whether the tool call was successful. */ successful?: boolean; } export interface NodeTransitionMessageBase { /** * This is a node transition. */ role: 'node_transition'; /** * Create timestamp of the message */ created_timestamp?: number; /** * Former node id */ former_node_id?: string; /** * Former node name */ former_node_name?: string; /** * Unique id of the message */ message_id?: string; /** * New node id */ new_node_id?: string; /** * New node name */ new_node_name?: string; /** * How this node was reached. "global" means a global node transition, * "global_go_back" means returning from a global node, "interrupt_go_back" means * going back due to user interruption, and "normal" means a regular edge * transition. */ transition_type?: 'global' | 'global_go_back' | 'interrupt_go_back' | 'normal'; } export interface StateTransitionMessageBase { /** * This is a state transition. */ role: 'state_transition'; /** * Create timestamp of the message */ created_timestamp?: number; /** * Former state name */ former_state_name?: string; /** * Unique id of the message */ message_id?: string; /** * New state name */ new_state_name?: string; } export interface InjectedMessageBase { /** * The injected context text. */ content: string; /** * External context injected into the conversation via the update-live-call API. * Not spoken by either party. */ role: 'injected'; /** * Create timestamp of the message */ created_timestamp?: number; /** * Unique id of the message */ message_id?: string; } export interface SMSMessageBase { /** * Text content of the SMS message. */ content: string; /** * SMS message exchanged during the call (for example received from the user). * Woven into the transcript and shown to the agent, but not part of the spoken * conversation. */ role: 'sms'; /** * Create timestamp of the message */ created_timestamp?: number; /** * Unique id of the message */ message_id?: string; /** * Multimedia attachments (MMS). Display only; not relayed into the spoken * conversation. */ multimedia?: Array; } export namespace SMSMessageBase { export interface Multimedia { /** * URL of the multimedia attachment. */ url: string; /** * Optional textual summary of the attachment. */ summary?: string; } } export interface MessageBase { /** * Content of the message */ content: string; /** * Whether this message is sent by the AI agent, user, or human transfer target. */ role: 'agent' | 'user' | 'transfer_target'; /** * Create timestamp of the message */ created_timestamp?: number; customer_defined_metadata?: MessageBase.CustomerDefinedMetadata; /** * Unique id of the message */ message_id?: string; /** * Multimedia attachments received with this message (MMS). Display only; a textual * summary of each attachment is already included in content. Response only — * supplying it in a request has no effect and is silently ignored. Omitted from * PII-scrubbed messages. */ multimedia?: Array; } export namespace MessageBase { export interface CustomerDefinedMetadata { transfer_target_name?: string; } export interface Multimedia { /** * URL of the multimedia attachment. */ url: string; /** * Optional textual summary of the attachment. */ summary?: string; } } export interface ToolCallInvocationMessageBase { /** * Arguments for this tool call, it's a stringified JSON object. */ arguments: string; /** * Name of the tool. This is the configured tool name, or the node name for a * built-in conversation flow node, so it can contain spaces and non-ASCII * characters. To identify the kind of tool, use `type`. */ name: string; /** * This is a tool call invocation. */ role: 'tool_call_invocation'; /** * Tool call id, globally unique. */ tool_call_id: string; /** * Create timestamp of the message */ created_timestamp?: number; /** * Unique id of the message */ message_id?: string; /** * Optional thought signature from Google Gemini thinking models. This is used * internally to maintain reasoning chain in multi-turn function calling. */ thought_signature?: string; /** * Kind of tool. Known values are `custom`, `code`, `mcp`, `integration_app`, * `end_call`, `transfer_call`, `bridge_transfer`, `cancel_transfer`, `agent_swap`, * `press_digit`, `send_sms`, `extract_dynamic_variable`, `adjust_voice_speed`, * `book_appointment_cal`, and `check_availability_cal`. New values can be added. * Absent on tool calls sent by a custom LLM, and on some older calls and chats. */ type?: string; } export interface ToolCallResultMessageBase { /** * Result of the tool call, can be a string, a stringified json, etc. */ content: string; /** * This is the result of a tool call. */ role: 'tool_call_result'; /** * Tool call id, globally unique. */ tool_call_id: string; /** * Create timestamp of the message */ created_timestamp?: number; /** * Unique id of the message */ message_id?: string; /** * Whether the tool call was successful. */ successful?: boolean; } export interface NodeTransitionMessageBase { /** * This is a node transition. */ role: 'node_transition'; /** * Create timestamp of the message */ created_timestamp?: number; /** * Former node id */ former_node_id?: string; /** * Former node name */ former_node_name?: string; /** * Unique id of the message */ message_id?: string; /** * New node id */ new_node_id?: string; /** * New node name */ new_node_name?: string; /** * How this node was reached. "global" means a global node transition, * "global_go_back" means returning from a global node, "interrupt_go_back" means * going back due to user interruption, and "normal" means a regular edge * transition. */ transition_type?: 'global' | 'global_go_back' | 'interrupt_go_back' | 'normal'; } export interface StateTransitionMessageBase { /** * This is a state transition. */ role: 'state_transition'; /** * Create timestamp of the message */ created_timestamp?: number; /** * Former state name */ former_state_name?: string; /** * Unique id of the message */ message_id?: string; /** * New state name */ new_state_name?: string; } export interface InjectedMessageBase { /** * The injected context text. */ content: string; /** * External context injected into the conversation via the update-live-call API. * Not spoken by either party. */ role: 'injected'; /** * Create timestamp of the message */ created_timestamp?: number; /** * Unique id of the message */ message_id?: string; } export interface SMSMessageBase { /** * Text content of the SMS message. */ content: string; /** * SMS message exchanged during the call (for example received from the user). * Woven into the transcript and shown to the agent, but not part of the spoken * conversation. */ role: 'sms'; /** * Create timestamp of the message */ created_timestamp?: number; /** * Unique id of the message */ message_id?: string; /** * Multimedia attachments (MMS). Display only; not relayed into the spoken * conversation. */ multimedia?: Array; } export namespace SMSMessageBase { export interface Multimedia { /** * URL of the multimedia attachment. */ url: string; /** * Optional textual summary of the attachment. */ summary?: string; } } export interface MessageBase { /** * Content of the message */ content: string; /** * Whether this message is sent by the AI agent, user, or human transfer target. */ role: 'agent' | 'user' | 'transfer_target'; /** * Create timestamp of the message */ created_timestamp?: number; customer_defined_metadata?: MessageBase.CustomerDefinedMetadata; /** * Unique id of the message */ message_id?: string; /** * Multimedia attachments received with this message (MMS). Display only; a textual * summary of each attachment is already included in content. Response only — * supplying it in a request has no effect and is silently ignored. Omitted from * PII-scrubbed messages. */ multimedia?: Array; } export namespace MessageBase { export interface CustomerDefinedMetadata { transfer_target_name?: string; } export interface Multimedia { /** * URL of the multimedia attachment. */ url: string; /** * Optional textual summary of the attachment. */ summary?: string; } } export interface ToolCallInvocationMessageBase { /** * Arguments for this tool call, it's a stringified JSON object. */ arguments: string; /** * Name of the tool. This is the configured tool name, or the node name for a * built-in conversation flow node, so it can contain spaces and non-ASCII * characters. To identify the kind of tool, use `type`. */ name: string; /** * This is a tool call invocation. */ role: 'tool_call_invocation'; /** * Tool call id, globally unique. */ tool_call_id: string; /** * Create timestamp of the message */ created_timestamp?: number; /** * Unique id of the message */ message_id?: string; /** * Optional thought signature from Google Gemini thinking models. This is used * internally to maintain reasoning chain in multi-turn function calling. */ thought_signature?: string; /** * Kind of tool. Known values are `custom`, `code`, `mcp`, `integration_app`, * `end_call`, `transfer_call`, `bridge_transfer`, `cancel_transfer`, `agent_swap`, * `press_digit`, `send_sms`, `extract_dynamic_variable`, `adjust_voice_speed`, * `book_appointment_cal`, and `check_availability_cal`. New values can be added. * Absent on tool calls sent by a custom LLM, and on some older calls and chats. */ type?: string; } export interface ToolCallResultMessageBase { /** * Result of the tool call, can be a string, a stringified json, etc. */ content: string; /** * This is the result of a tool call. */ role: 'tool_call_result'; /** * Tool call id, globally unique. */ tool_call_id: string; /** * Create timestamp of the message */ created_timestamp?: number; /** * Unique id of the message */ message_id?: string; /** * Whether the tool call was successful. */ successful?: boolean; } export interface NodeTransitionMessageBase { /** * This is a node transition. */ role: 'node_transition'; /** * Create timestamp of the message */ created_timestamp?: number; /** * Former node id */ former_node_id?: string; /** * Former node name */ former_node_name?: string; /** * Unique id of the message */ message_id?: string; /** * New node id */ new_node_id?: string; /** * New node name */ new_node_name?: string; /** * How this node was reached. "global" means a global node transition, * "global_go_back" means returning from a global node, "interrupt_go_back" means * going back due to user interruption, and "normal" means a regular edge * transition. */ transition_type?: 'global' | 'global_go_back' | 'interrupt_go_back' | 'normal'; } export interface StateTransitionMessageBase { /** * This is a state transition. */ role: 'state_transition'; /** * Create timestamp of the message */ created_timestamp?: number; /** * Former state name */ former_state_name?: string; /** * Unique id of the message */ message_id?: string; /** * New state name */ new_state_name?: string; } export interface InjectedMessageBase { /** * The injected context text. */ content: string; /** * External context injected into the conversation via the update-live-call API. * Not spoken by either party. */ role: 'injected'; /** * Create timestamp of the message */ created_timestamp?: number; /** * Unique id of the message */ message_id?: string; } export interface SMSMessageBase { /** * Text content of the SMS message. */ content: string; /** * SMS message exchanged during the call (for example received from the user). * Woven into the transcript and shown to the agent, but not part of the spoken * conversation. */ role: 'sms'; /** * Create timestamp of the message */ created_timestamp?: number; /** * Unique id of the message */ message_id?: string; /** * Multimedia attachments (MMS). Display only; not relayed into the spoken * conversation. */ multimedia?: Array; } export namespace SMSMessageBase { export interface Multimedia { /** * URL of the multimedia attachment. */ url: string; /** * Optional textual summary of the attachment. */ summary?: string; } } export interface MessageBase { /** * Content of the message */ content: string; /** * Whether this message is sent by the AI agent, user, or human transfer target. */ role: 'agent' | 'user' | 'transfer_target'; /** * Create timestamp of the message */ created_timestamp?: number; customer_defined_metadata?: MessageBase.CustomerDefinedMetadata; /** * Unique id of the message */ message_id?: string; /** * Multimedia attachments received with this message (MMS). Display only; a textual * summary of each attachment is already included in content. Response only — * supplying it in a request has no effect and is silently ignored. Omitted from * PII-scrubbed messages. */ multimedia?: Array; } export namespace MessageBase { export interface CustomerDefinedMetadata { transfer_target_name?: string; } export interface Multimedia { /** * URL of the multimedia attachment. */ url: string; /** * Optional textual summary of the attachment. */ summary?: string; } } export interface ToolCallInvocationMessageBase { /** * Arguments for this tool call, it's a stringified JSON object. */ arguments: string; /** * Name of the tool. This is the configured tool name, or the node name for a * built-in conversation flow node, so it can contain spaces and non-ASCII * characters. To identify the kind of tool, use `type`. */ name: string; /** * This is a tool call invocation. */ role: 'tool_call_invocation'; /** * Tool call id, globally unique. */ tool_call_id: string; /** * Create timestamp of the message */ created_timestamp?: number; /** * Unique id of the message */ message_id?: string; /** * Optional thought signature from Google Gemini thinking models. This is used * internally to maintain reasoning chain in multi-turn function calling. */ thought_signature?: string; /** * Kind of tool. Known values are `custom`, `code`, `mcp`, `integration_app`, * `end_call`, `transfer_call`, `bridge_transfer`, `cancel_transfer`, `agent_swap`, * `press_digit`, `send_sms`, `extract_dynamic_variable`, `adjust_voice_speed`, * `book_appointment_cal`, and `check_availability_cal`. New values can be added. * Absent on tool calls sent by a custom LLM, and on some older calls and chats. */ type?: string; } export interface ToolCallResultMessageBase { /** * Result of the tool call, can be a string, a stringified json, etc. */ content: string; /** * This is the result of a tool call. */ role: 'tool_call_result'; /** * Tool call id, globally unique. */ tool_call_id: string; /** * Create timestamp of the message */ created_timestamp?: number; /** * Unique id of the message */ message_id?: string; /** * Whether the tool call was successful. */ successful?: boolean; } export interface NodeTransitionMessageBase { /** * This is a node transition. */ role: 'node_transition'; /** * Create timestamp of the message */ created_timestamp?: number; /** * Former node id */ former_node_id?: string; /** * Former node name */ former_node_name?: string; /** * Unique id of the message */ message_id?: string; /** * New node id */ new_node_id?: string; /** * New node name */ new_node_name?: string; /** * How this node was reached. "global" means a global node transition, * "global_go_back" means returning from a global node, "interrupt_go_back" means * going back due to user interruption, and "normal" means a regular edge * transition. */ transition_type?: 'global' | 'global_go_back' | 'interrupt_go_back' | 'normal'; } export interface StateTransitionMessageBase { /** * This is a state transition. */ role: 'state_transition'; /** * Create timestamp of the message */ created_timestamp?: number; /** * Former state name */ former_state_name?: string; /** * Unique id of the message */ message_id?: string; /** * New state name */ new_state_name?: string; } export interface InjectedMessageBase { /** * The injected context text. */ content: string; /** * External context injected into the conversation via the update-live-call API. * Not spoken by either party. */ role: 'injected'; /** * Create timestamp of the message */ created_timestamp?: number; /** * Unique id of the message */ message_id?: string; } export interface SMSMessageBase { /** * Text content of the SMS message. */ content: string; /** * SMS message exchanged during the call (for example received from the user). * Woven into the transcript and shown to the agent, but not part of the spoken * conversation. */ role: 'sms'; /** * Create timestamp of the message */ created_timestamp?: number; /** * Unique id of the message */ message_id?: string; /** * Multimedia attachments (MMS). Display only; not relayed into the spoken * conversation. */ multimedia?: Array; } export namespace SMSMessageBase { export interface Multimedia { /** * URL of the multimedia attachment. */ url: string; /** * Optional textual summary of the attachment. */ summary?: string; } } export interface MessageBase { /** * Content of the message */ content: string; /** * Whether this message is sent by the AI agent, user, or human transfer target. */ role: 'agent' | 'user' | 'transfer_target'; /** * Create timestamp of the message */ created_timestamp?: number; customer_defined_metadata?: MessageBase.CustomerDefinedMetadata; /** * Unique id of the message */ message_id?: string; /** * Multimedia attachments received with this message (MMS). Display only; a textual * summary of each attachment is already included in content. Response only — * supplying it in a request has no effect and is silently ignored. Omitted from * PII-scrubbed messages. */ multimedia?: Array; } export namespace MessageBase { export interface CustomerDefinedMetadata { transfer_target_name?: string; } export interface Multimedia { /** * URL of the multimedia attachment. */ url: string; /** * Optional textual summary of the attachment. */ summary?: string; } } export interface ToolCallInvocationMessageBase { /** * Arguments for this tool call, it's a stringified JSON object. */ arguments: string; /** * Name of the tool. This is the configured tool name, or the node name for a * built-in conversation flow node, so it can contain spaces and non-ASCII * characters. To identify the kind of tool, use `type`. */ name: string; /** * This is a tool call invocation. */ role: 'tool_call_invocation'; /** * Tool call id, globally unique. */ tool_call_id: string; /** * Create timestamp of the message */ created_timestamp?: number; /** * Unique id of the message */ message_id?: string; /** * Optional thought signature from Google Gemini thinking models. This is used * internally to maintain reasoning chain in multi-turn function calling. */ thought_signature?: string; /** * Kind of tool. Known values are `custom`, `code`, `mcp`, `integration_app`, * `end_call`, `transfer_call`, `bridge_transfer`, `cancel_transfer`, `agent_swap`, * `press_digit`, `send_sms`, `extract_dynamic_variable`, `adjust_voice_speed`, * `book_appointment_cal`, and `check_availability_cal`. New values can be added. * Absent on tool calls sent by a custom LLM, and on some older calls and chats. */ type?: string; } export interface ToolCallResultMessageBase { /** * Result of the tool call, can be a string, a stringified json, etc. */ content: string; /** * This is the result of a tool call. */ role: 'tool_call_result'; /** * Tool call id, globally unique. */ tool_call_id: string; /** * Create timestamp of the message */ created_timestamp?: number; /** * Unique id of the message */ message_id?: string; /** * Whether the tool call was successful. */ successful?: boolean; } export interface NodeTransitionMessageBase { /** * This is a node transition. */ role: 'node_transition'; /** * Create timestamp of the message */ created_timestamp?: number; /** * Former node id */ former_node_id?: string; /** * Former node name */ former_node_name?: string; /** * Unique id of the message */ message_id?: string; /** * New node id */ new_node_id?: string; /** * New node name */ new_node_name?: string; /** * How this node was reached. "global" means a global node transition, * "global_go_back" means returning from a global node, "interrupt_go_back" means * going back due to user interruption, and "normal" means a regular edge * transition. */ transition_type?: 'global' | 'global_go_back' | 'interrupt_go_back' | 'normal'; } export interface StateTransitionMessageBase { /** * This is a state transition. */ role: 'state_transition'; /** * Create timestamp of the message */ created_timestamp?: number; /** * Former state name */ former_state_name?: string; /** * Unique id of the message */ message_id?: string; /** * New state name */ new_state_name?: string; } export interface InjectedMessageBase { /** * The injected context text. */ content: string; /** * External context injected into the conversation via the update-live-call API. * Not spoken by either party. */ role: 'injected'; /** * Create timestamp of the message */ created_timestamp?: number; /** * Unique id of the message */ message_id?: string; } export interface SMSMessageBase { /** * Text content of the SMS message. */ content: string; /** * SMS message exchanged during the call (for example received from the user). * Woven into the transcript and shown to the agent, but not part of the spoken * conversation. */ role: 'sms'; /** * Create timestamp of the message */ created_timestamp?: number; /** * Unique id of the message */ message_id?: string; /** * Multimedia attachments (MMS). Display only; not relayed into the spoken * conversation. */ multimedia?: Array; } export namespace SMSMessageBase { export interface Multimedia { /** * URL of the multimedia attachment. */ url: string; /** * Optional textual summary of the attachment. */ summary?: string; } } } export interface ChatListResponse { /** * Whether more results are available. */ has_more: boolean; items: Array; /** * Pagination key for the next page. */ pagination_key?: string; /** * Total number of chats matching `filter_criteria`. Only present when * `include_total` is true. */ total?: number; } export namespace ChatListResponse { /** * V3 list chats response. Transcript fields are intentionally omitted. */ export interface Item extends ChatAPI.ChatResponse {} } export interface ChatCreateChatCompletionResponse { /** * New messages generated by the agent during this completion, including any tool * call invocations and their results. Does not include the original input * messages. */ messages: Array< | ChatCreateChatCompletionResponse.MessageBase | ChatCreateChatCompletionResponse.ToolCallInvocationMessageBase | ChatCreateChatCompletionResponse.ToolCallResultMessageBase | ChatCreateChatCompletionResponse.NodeTransitionMessageBase | ChatCreateChatCompletionResponse.StateTransitionMessageBase | ChatCreateChatCompletionResponse.InjectedMessageBase | ChatCreateChatCompletionResponse.SMSMessageBase >; } export namespace ChatCreateChatCompletionResponse { export interface MessageBase { /** * Content of the message */ content: string; /** * Whether this message is sent by the AI agent, user, or human transfer target. */ role: 'agent' | 'user' | 'transfer_target'; /** * Create timestamp of the message */ created_timestamp?: number; customer_defined_metadata?: MessageBase.CustomerDefinedMetadata; /** * Unique id of the message */ message_id?: string; /** * Multimedia attachments received with this message (MMS). Display only; a textual * summary of each attachment is already included in content. Response only — * supplying it in a request has no effect and is silently ignored. Omitted from * PII-scrubbed messages. */ multimedia?: Array; } export namespace MessageBase { export interface CustomerDefinedMetadata { transfer_target_name?: string; } export interface Multimedia { /** * URL of the multimedia attachment. */ url: string; /** * Optional textual summary of the attachment. */ summary?: string; } } export interface ToolCallInvocationMessageBase { /** * Arguments for this tool call, it's a stringified JSON object. */ arguments: string; /** * Name of the tool. This is the configured tool name, or the node name for a * built-in conversation flow node, so it can contain spaces and non-ASCII * characters. To identify the kind of tool, use `type`. */ name: string; /** * This is a tool call invocation. */ role: 'tool_call_invocation'; /** * Tool call id, globally unique. */ tool_call_id: string; /** * Create timestamp of the message */ created_timestamp?: number; /** * Unique id of the message */ message_id?: string; /** * Optional thought signature from Google Gemini thinking models. This is used * internally to maintain reasoning chain in multi-turn function calling. */ thought_signature?: string; /** * Kind of tool. Known values are `custom`, `code`, `mcp`, `integration_app`, * `end_call`, `transfer_call`, `bridge_transfer`, `cancel_transfer`, `agent_swap`, * `press_digit`, `send_sms`, `extract_dynamic_variable`, `adjust_voice_speed`, * `book_appointment_cal`, and `check_availability_cal`. New values can be added. * Absent on tool calls sent by a custom LLM, and on some older calls and chats. */ type?: string; } export interface ToolCallResultMessageBase { /** * Result of the tool call, can be a string, a stringified json, etc. */ content: string; /** * This is the result of a tool call. */ role: 'tool_call_result'; /** * Tool call id, globally unique. */ tool_call_id: string; /** * Create timestamp of the message */ created_timestamp?: number; /** * Unique id of the message */ message_id?: string; /** * Whether the tool call was successful. */ successful?: boolean; } export interface NodeTransitionMessageBase { /** * This is a node transition. */ role: 'node_transition'; /** * Create timestamp of the message */ created_timestamp?: number; /** * Former node id */ former_node_id?: string; /** * Former node name */ former_node_name?: string; /** * Unique id of the message */ message_id?: string; /** * New node id */ new_node_id?: string; /** * New node name */ new_node_name?: string; /** * How this node was reached. "global" means a global node transition, * "global_go_back" means returning from a global node, "interrupt_go_back" means * going back due to user interruption, and "normal" means a regular edge * transition. */ transition_type?: 'global' | 'global_go_back' | 'interrupt_go_back' | 'normal'; } export interface StateTransitionMessageBase { /** * This is a state transition. */ role: 'state_transition'; /** * Create timestamp of the message */ created_timestamp?: number; /** * Former state name */ former_state_name?: string; /** * Unique id of the message */ message_id?: string; /** * New state name */ new_state_name?: string; } export interface InjectedMessageBase { /** * The injected context text. */ content: string; /** * External context injected into the conversation via the update-live-call API. * Not spoken by either party. */ role: 'injected'; /** * Create timestamp of the message */ created_timestamp?: number; /** * Unique id of the message */ message_id?: string; } export interface SMSMessageBase { /** * Text content of the SMS message. */ content: string; /** * SMS message exchanged during the call (for example received from the user). * Woven into the transcript and shown to the agent, but not part of the spoken * conversation. */ role: 'sms'; /** * Create timestamp of the message */ created_timestamp?: number; /** * Unique id of the message */ message_id?: string; /** * Multimedia attachments (MMS). Display only; not relayed into the spoken * conversation. */ multimedia?: Array; } export namespace SMSMessageBase { export interface Multimedia { /** * URL of the multimedia attachment. */ url: string; /** * Optional textual summary of the attachment. */ summary?: string; } } } export interface ChatRecordMessageResponse { created_timestamp: number; message_id: string; } export interface ChatCreateParams { /** * The chat agent to use for the chat. */ agent_id: string; /** * The version of the chat agent to use for the chat. If not provided, will default * to latest version. */ agent_version?: string | number; /** * An arbitrary object for storage purpose only. You can put anything here like * your internal customer id associated with the chat. Not used for processing. You * can later get this field from the chat object. */ metadata?: unknown; /** * Add optional dynamic variables in key value pairs of string that injects into * your Response Engine prompt and tool description. Only applicable for Response * Engine. */ retell_llm_dynamic_variables?: { [key: string]: string }; } export interface ChatUpdateParams { /** * Custom attributes for the chat, as key-value pairs. Each attribute must first be * defined for your organization in the Retell dashboard (Chat History → Actions → * Custom attributes) before it can be set here. The object key must match the id * of an existing organization-level custom attribute; keys that do not match a * defined attribute are ignored and will not be saved. Values must be a string, * number, or boolean. */ custom_attributes?: { [key: string]: string | number | boolean }; /** * Data storage setting for this chat. Overrides the agent's default setting. * "everything" stores all data, "basic_attributes_only" stores only metadata. * Cannot be downgraded from more restrictive to less restrictive settings. */ data_storage_setting?: 'everything' | 'basic_attributes_only'; /** * An arbitrary object for storage purpose only. You can put anything here like * your internal customer id associated with the chat. Not used for processing. You * can later get this field from the chat object. Size limited to 50kB max. */ metadata?: unknown; /** * Override dynamic variables represented as key-value pairs of strings. Setting * this will override or add the dynamic variables set in the agent during the * call. Only need to set the delta where you want to override, no need to set the * entire dynamic variables object. Setting this to null will remove any existing * override. */ override_dynamic_variables?: { [key: string]: string } | null; } export interface ChatListParams { /** * Filter criteria for chats to retrieve. */ filter_criteria?: ChatListParams.FilterCriteria; /** * Whether to include `total` (count of all chats matching `filter_criteria`, * ignoring `limit`/`skip`/`pagination_key`) in the response. Defaults to false. * Each enabled request triggers an additional aggregate query, so opt in only when * the total is needed. */ include_total?: boolean; /** * Maximum number of chats to return. */ limit?: number; /** * Opaque pagination cursor from a previous response. */ pagination_key?: string; /** * Number of records to skip for pagination. */ skip?: number; /** * Sort chats by `start_timestamp` in ascending or descending order. */ sort_order?: 'ascending' | 'descending'; } export namespace ChatListParams { /** * Filter criteria for chats to retrieve. */ export interface FilterCriteria { /** * Filter by agent(s). Agent filters are connected by OR. */ agent?: Array; /** * Filter by the agent's phone number for SMS chats. */ agent_number?: FilterCriteria.AgentNumber; /** * Filter by agent environment tag(s) (e.g. "prod", "staging"). */ agent_tag?: FilterCriteria.AgentTag; /** * Filter by chat ID. */ chat_id?: FilterCriteria.StringFilter | FilterCriteria.EnumFilter; chat_status?: FilterCriteria.ChatStatus; /** * Filter by whether the chat was successful. */ chat_successful?: FilterCriteria.ChatSuccessful; chat_type?: FilterCriteria.ChatType; /** * Filter by total chat cost in cents. */ combined_cost?: FilterCriteria.NumberFilter | FilterCriteria.RangeFilter; /** * Filter by custom post-chat analysis outputs. Each filter `key` matches the * configured output's `name`. */ custom_analysis_data?: Array< | FilterCriteria.StringFilter | FilterCriteria.NumberFilter | FilterCriteria.BooleanFilter | FilterCriteria.RangeFilter | FilterCriteria.EnumFilter | FilterCriteria.PresentFilter >; /** * Filter by organization-level attributes that attach business context to chats, * such as customer tier or campaign, so chats can be organized and filtered * consistently in Chat History. Use the attribute ID as `key` and the chat's * attribute value as `value`. */ custom_attributes?: Array< | FilterCriteria.StringFilter | FilterCriteria.NumberFilter | FilterCriteria.BooleanFilter | FilterCriteria.RangeFilter | FilterCriteria.EnumFilter | FilterCriteria.PresentFilter >; data_storage_setting?: FilterCriteria.DataStorageSetting; direction?: FilterCriteria.Direction; disconnection_reason?: FilterCriteria.DisconnectionReason; /** * Filter by chat duration in milliseconds. */ duration_ms?: FilterCriteria.NumberFilter | FilterCriteria.RangeFilter; /** * Filter by chat end timestamp (epoch ms). */ end_timestamp?: FilterCriteria.NumberFilter | FilterCriteria.RangeFilter; is_escalated?: FilterCriteria.IsEscalated; /** * Filter by chat start timestamp (epoch ms). */ start_timestamp?: FilterCriteria.NumberFilter | FilterCriteria.RangeFilter; /** * Filter by the user's phone number for SMS chats. */ user_number?: FilterCriteria.UserNumber; user_sentiment?: FilterCriteria.UserSentiment; } export namespace FilterCriteria { export interface Agent { /** * The agent ID to filter on. */ agent_id: string; /** * Specific versions to filter on. If omitted or empty, all versions are included. */ version?: Array; } /** * Filter by the agent's phone number for SMS chats. */ export interface AgentNumber { /** * eq: equal, ne: not equal, sw: starts with, ew: ends with, co: contains */ op: 'eq' | 'ne' | 'sw' | 'ew' | 'co'; type: 'string'; value: string; } /** * Filter by agent environment tag(s) (e.g. "prod", "staging"). */ export interface AgentTag { /** * in: value is one of the listed values */ op: 'in'; type: 'enum'; value: Array; } export interface StringFilter { /** * eq: equal, ne: not equal, sw: starts with, ew: ends with, co: contains */ op: 'eq' | 'ne' | 'sw' | 'ew' | 'co'; type: 'string'; value: string; } export interface EnumFilter { /** * in: value is one of the listed values */ op: 'in'; type: 'enum'; value: Array; } export interface ChatStatus { /** * in: value is one of the listed values */ op: 'in'; type: 'enum'; value: Array<'ongoing' | 'ended' | 'error'>; } /** * Filter by whether the chat was successful. */ export interface ChatSuccessful { op: 'eq'; type: 'boolean'; value: boolean; } export interface ChatType { /** * in: value is one of the listed values */ op: 'in'; type: 'enum'; value: Array<'api_chat' | 'sms_chat'>; } export interface NumberFilter { /** * eq: equal, ne: not equal, gt: greater than, ge: greater than or equal, lt: less * than, le: less than or equal */ op: 'eq' | 'ne' | 'gt' | 'ge' | 'lt' | 'le'; type: 'number'; value: number; } export interface RangeFilter { /** * bt: between */ op: 'bt'; type: 'range'; /** * [lower_bound, upper_bound] */ value: Array; } export interface StringFilter { /** * eq: equal, ne: not equal, sw: starts with, ew: ends with, co: contains */ op: 'eq' | 'ne' | 'sw' | 'ew' | 'co'; type: 'string'; value: string; /** * The field name to filter on. */ key?: string; } export interface NumberFilter { /** * eq: equal, ne: not equal, gt: greater than, ge: greater than or equal, lt: less * than, le: less than or equal */ op: 'eq' | 'ne' | 'gt' | 'ge' | 'lt' | 'le'; type: 'number'; value: number; /** * The field name to filter on. */ key?: string; } export interface BooleanFilter { op: 'eq'; type: 'boolean'; value: boolean; /** * The field name to filter on. */ key?: string; } export interface RangeFilter { /** * bt: between */ op: 'bt'; type: 'range'; /** * [lower_bound, upper_bound] */ value: Array; /** * The field name to filter on. */ key?: string; } export interface EnumFilter { /** * in: value is one of the listed values */ op: 'in'; type: 'enum'; value: Array; /** * The field name to filter on. */ key?: string; } export interface PresentFilter { /** * pr: present (has value), np: not present */ op: 'pr' | 'np'; type: 'present'; /** * The field name to filter on. */ key?: string; } export interface StringFilter { /** * eq: equal, ne: not equal, sw: starts with, ew: ends with, co: contains */ op: 'eq' | 'ne' | 'sw' | 'ew' | 'co'; type: 'string'; value: string; /** * The field name to filter on. */ key?: string; } export interface NumberFilter { /** * eq: equal, ne: not equal, gt: greater than, ge: greater than or equal, lt: less * than, le: less than or equal */ op: 'eq' | 'ne' | 'gt' | 'ge' | 'lt' | 'le'; type: 'number'; value: number; /** * The field name to filter on. */ key?: string; } export interface BooleanFilter { op: 'eq'; type: 'boolean'; value: boolean; /** * The field name to filter on. */ key?: string; } export interface RangeFilter { /** * bt: between */ op: 'bt'; type: 'range'; /** * [lower_bound, upper_bound] */ value: Array; /** * The field name to filter on. */ key?: string; } export interface EnumFilter { /** * in: value is one of the listed values */ op: 'in'; type: 'enum'; value: Array; /** * The field name to filter on. */ key?: string; } export interface PresentFilter { /** * pr: present (has value), np: not present */ op: 'pr' | 'np'; type: 'present'; /** * The field name to filter on. */ key?: string; } export interface DataStorageSetting { /** * in: value is one of the listed values */ op: 'in'; type: 'enum'; value: Array<'everything' | 'everything_except_pii' | 'basic_attributes_only'>; } export interface Direction { /** * in: value is one of the listed values */ op: 'in'; type: 'enum'; value: Array<'inbound' | 'outbound'>; } export interface DisconnectionReason { /** * in: value is one of the listed values */ op: 'in'; type: 'enum'; value: Array< | 'user_hangup' | 'agent_hangup' | 'user_requested_dnc' | 'user_requested_callback' | 'call_transfer' | 'voicemail_reached' | 'ivr_reached' | 'inactivity' | 'max_duration_reached' | 'concurrency_limit_reached' | 'no_concurrency_fallback' | 'no_valid_payment' | 'credit_exhausted' | 'budget_reached' | 'scam_detected' | 'dial_busy' | 'dial_failed' | 'dial_no_answer' | 'invalid_destination' | 'telephony_provider_permission_denied' | 'telephony_provider_unavailable' | 'sip_routing_error' | 'marked_as_spam' | 'network_blocked' | 'user_declined' | 'error_llm_websocket_open' | 'error_llm_websocket_lost_connection' | 'error_llm_websocket_runtime' | 'error_llm_websocket_corrupt_payload' | 'error_no_audio_received' | 'error_asr' | 'error_retell' | 'error_unknown' | 'error_user_not_joined' | 'registered_call_timeout' | 'transfer_bridged' | 'transfer_cancelled' | 'manual_stopped' | 'call_take_over' >; } export interface NumberFilter { /** * eq: equal, ne: not equal, gt: greater than, ge: greater than or equal, lt: less * than, le: less than or equal */ op: 'eq' | 'ne' | 'gt' | 'ge' | 'lt' | 'le'; type: 'number'; value: number; } export interface RangeFilter { /** * bt: between */ op: 'bt'; type: 'range'; /** * [lower_bound, upper_bound] */ value: Array; } export interface NumberFilter { /** * eq: equal, ne: not equal, gt: greater than, ge: greater than or equal, lt: less * than, le: less than or equal */ op: 'eq' | 'ne' | 'gt' | 'ge' | 'lt' | 'le'; type: 'number'; value: number; } export interface RangeFilter { /** * bt: between */ op: 'bt'; type: 'range'; /** * [lower_bound, upper_bound] */ value: Array; } export interface IsEscalated { op: 'eq'; type: 'boolean'; value: boolean; } export interface NumberFilter { /** * eq: equal, ne: not equal, gt: greater than, ge: greater than or equal, lt: less * than, le: less than or equal */ op: 'eq' | 'ne' | 'gt' | 'ge' | 'lt' | 'le'; type: 'number'; value: number; } export interface RangeFilter { /** * bt: between */ op: 'bt'; type: 'range'; /** * [lower_bound, upper_bound] */ value: Array; } /** * Filter by the user's phone number for SMS chats. */ export interface UserNumber { /** * eq: equal, ne: not equal, sw: starts with, ew: ends with, co: contains */ op: 'eq' | 'ne' | 'sw' | 'ew' | 'co'; type: 'string'; value: string; } export interface UserSentiment { /** * in: value is one of the listed values */ op: 'in'; type: 'enum'; value: Array<'Negative' | 'Positive' | 'Neutral' | 'Unknown'>; } } } export interface ChatCreateChatCompletionParams { /** * Unique id of the chat to create completion. */ chat_id: string; /** * user message to generate agent chat completion. */ content: string; } export interface ChatCreateSMSChatParams { /** * The phone number to send SMS from in E.164 format. Must be a number purchased * from Retell or imported to Retell with SMS capability. */ from_number: string; /** * The phone number to send SMS to in E.164 format */ to_number: string; /** * If true, the chat is rejected with a 400 error when the contact for to_number is * marked do_not_call. If omitted, the default value is false. */ honor_internal_dnc?: boolean; /** * An arbitrary object for storage purpose only. You can put anything here like * your internal customer id associated with the chat. Not used for processing. You * can later get this field from the chat object. */ metadata?: unknown; /** * For this particular chat, override the agent used with this agent id. This does * not bind the agent to this number, this is for one time override. */ override_agent_id?: string; /** * For this particular chat, override the agent version used with this version. * This does not bind the agent version to this number, this is for one time * override. */ override_agent_version?: string | number; /** * Add optional dynamic variables in key value pairs of string that injects into * your Response Engine prompt and tool description. Only applicable for Response * Engine. */ retell_llm_dynamic_variables?: { [key: string]: string }; } export type ChatRecordMessageParams = ChatRecordMessageParams.Variant0 | ChatRecordMessageParams.Variant1; export declare namespace ChatRecordMessageParams { export interface Variant0 { idempotency_key: string; message: string; role: 'user'; } export interface Variant1 { idempotency_key: string; message: string; role: 'transfer_target'; metadata?: Variant1.Metadata; } export namespace Variant1 { export interface Metadata { transfer_target_name?: string; } } } export declare namespace Chat { export { type ChatResponse as ChatResponse, type ChatListResponse as ChatListResponse, type ChatCreateChatCompletionResponse as ChatCreateChatCompletionResponse, type ChatRecordMessageResponse as ChatRecordMessageResponse, type ChatCreateParams as ChatCreateParams, type ChatUpdateParams as ChatUpdateParams, type ChatListParams as ChatListParams, type ChatCreateChatCompletionParams as ChatCreateChatCompletionParams, type ChatCreateSMSChatParams as ChatCreateSMSChatParams, type ChatRecordMessageParams as ChatRecordMessageParams, }; }