> Fetch clean Markdown by appending `.md` to any page URL under https://signalwire.com/docs or requesting it with the HTTP header `Accept: text/markdown`. The root index at https://signalwire.com/docs/llms.txt lists the available documentation indexes.

# summarize

> Generate a summary of a conversation.

[ref-aichatclient]: /docs/server-sdks/reference/typescript/agents/ai-chat-client

[post-prompt]: /docs/server-sdks/reference/typescript/agents/agent-base/set-post-prompt

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

## **Parameters**

**`conversationId`** `string` — required

The conversation to summarize.

---

**`options`** `SummarizeOptions`

Prompt and sampling controls.

---

**`options.summaryPrompt`** `string`

How to summarize. Overrides the [post-prompt][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**

```typescript {5-7}
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);
```