summarize

View as MarkdownOpen in Claude

Generate a summary of the conversation. The service rate limits this per conversation.

Parameters

conversationId
stringRequired

The conversation to summarize.

options
SummarizeOptions

Prompt and sampling controls.

options.summaryPrompt
string

How to summarize. Overrides the post-prompt text in your SWML for this call only.

options.temperature
number

Sampling temperature.

options.topP
number

Nucleus-sampling top-p.

options.frequencyPenalty
number

Frequency penalty.

options.presencePenalty
number

Presence penalty.

options.maxTokens
number

Maximum tokens for the summary.

Returns

Promise<string> — the generated summary.

Throws

SummaryError when the service reports that generation failed. The service returns exactly one of summary or error, both on the success envelope, so a failed summary surfaces as an exception rather than reaching you as an empty string. RateLimitError when you exceed the per-conversation limit.

Example

import { AIChatClient } from '@signalwire/sdk';
const client = new AIChatClient({ space: 'your-space' });
const summary = await client.summarize('chat-8f21', {
summaryPrompt: 'Summarize the ride request in two sentences.',
});
console.log(summary);