import { APIResource } from "../core/resource.js"; import { APIPromise } from "../core/api-promise.js"; import { RequestOptions } from "../internal/request-options.js"; export declare class Playground extends APIResource { /** * Stateless playground completion. Send the full conversation history (same shape * as chat completion messages) and receive only the newly generated messages. * Nothing is persisted server-side — the caller manages conversation state. * * @example * ```ts * const response = await client.playground.completion( * 'agent_id', * { * messages: [ * { * content: "Hi, I'd like to check my appointment.", * role: 'user', * }, * { * content: * 'Sure! Could you please provide your name?', * role: 'agent', * }, * { content: 'My name is John Smith.', role: 'user' }, * ], * }, * ); * ``` */ completion(agentID: string, params: PlaygroundCompletionParams, options?: RequestOptions): APIPromise; } export interface PlaygroundCompletionResponse { /** * New messages generated by the agent. Same shape as chat completion response * messages. Does not include the input messages. */ messages: Array; /** * Whether the agent ended the conversation. */ call_ended?: boolean; /** * Current node id (conversation-flow agents). */ current_node_id?: string; /** * Current state name (retell-llm agents). */ current_state?: string; /** * Updated dynamic variables after this turn. */ dynamic_variables?: { [key: string]: string; }; /** * Knowledge base chunks retrieved for this turn. */ knowledge_base_retrieved_contents?: Array; } export declare namespace PlaygroundCompletionResponse { interface MessageBase { /** * Content of the message */ content: string; /** * Documents whether this message is sent by agent or user. */ role: 'agent' | 'user'; /** * Create timestamp of the message */ created_timestamp?: number; /** * 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; } namespace MessageBase { interface Multimedia { /** * URL of the multimedia attachment. */ url: string; /** * Optional textual summary of the attachment. */ summary?: string; } } interface ToolCallInvocationMessageBase { /** * Arguments for this tool call, it's a stringified JSON object. */ arguments: string; /** * Name of the function in this tool call. */ 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; } 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; } 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'; } 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; } 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; } 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; } namespace SMSMessageBase { interface Multimedia { /** * URL of the multimedia attachment. */ url: string; /** * Optional textual summary of the attachment. */ summary?: string; } } } export interface PlaygroundCompletionParams { /** * Body param: Full conversation history, same shape as chat completion messages. * message_id and created_timestamp are optional — server generates them if * omitted. */ messages: Array; /** * Query param: Agent version to use. Defaults to latest. */ version?: string | number; /** * Body param: Conversation flow component id. Required when current_node_id refers * to a node within a component. */ component_id?: string; /** * Body param: Current node id for conversation-flow agents. Used to resume from a * specific node. Must be provided together with component_id when testing * components. */ current_node_id?: string; /** * Body param: Current state name for retell-llm agents. Used to resume from a * specific state. */ current_state?: string; /** * Body param: Key-value pairs for dynamic variable substitution. */ dynamic_variables?: { [key: string]: string; }; /** * Body param: Optional mock responses for tools. When provided, the agent uses * these instead of executing real tool calls. */ tool_mocks?: Array; } export declare namespace PlaygroundCompletionParams { interface MessageBase { /** * Content of the message */ content: string; /** * Documents whether this message is sent by agent or user. */ role: 'agent' | 'user'; /** * Create timestamp of the message */ created_timestamp?: number; /** * 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; } namespace MessageBase { interface Multimedia { /** * URL of the multimedia attachment. */ url: string; /** * Optional textual summary of the attachment. */ summary?: string; } } interface ToolCallInvocationMessageBase { /** * Arguments for this tool call, it's a stringified JSON object. */ arguments: string; /** * Name of the function in this tool call. */ 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; } 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; } 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'; } 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; } 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; } 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; } namespace SMSMessageBase { interface Multimedia { /** * URL of the multimedia attachment. */ url: string; /** * Optional textual summary of the attachment. */ summary?: string; } } /** * A fake response for one tool. During a simulation, when the LLM calls a tool * whose name matches `tool_name` and whose arguments satisfy `input_match_rule`, * the real tool is not run; `output` is returned to the LLM instead. This keeps * runs deterministic and avoids calling live integrations. A tool call that * matches no mock falls through to the real tool. */ interface ToolMock { /** * Decides which calls to this tool the mock applies to. */ input_match_rule: ToolMock.Type | ToolMock.UnionMember1; /** * The tool result fed back to the LLM in place of the real tool's output. Should * be a JSON string, the same shape the real tool would return. */ output: string; /** * The tool's function name, not the tool ID, i.e. the name the LLM uses when it * calls the tool (for example `check_availability_cal`, `book_appointment_cal`, or * the name you gave a custom function). */ tool_name: string; /** * For tool calls like transfer_call that require a boolean result. Optional for * most tools. */ result?: boolean | null; } namespace ToolMock { interface Type { /** * Match every call to the tool, no matter what arguments were passed. Use this for * a catch-all mock. */ type: 'any'; } interface UnionMember1 { /** * Argument values the call must have to match. Only the fields you list here are * checked, and each must equal the value in the actual call. Extra fields in the * call are ignored, so this is a subset match. */ args: unknown; /** * Match only calls whose arguments contain the values listed in `args`. */ type: 'partial_match'; } } } export declare namespace Playground { export { type PlaygroundCompletionResponse as PlaygroundCompletionResponse, type PlaygroundCompletionParams as PlaygroundCompletionParams, }; } //# sourceMappingURL=playground.d.ts.map