> 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 an AI summary of a conversation on demand. [ref-aichatclient]: /docs/server-sdks/reference/python/agents/ai-chat-client [post-prompt]: /docs/swml/reference/calling/ai Generate a summary of the conversation. The service rate limits this to one call per minute per conversation. ## **Parameters** **`conversation_id`** `str` — required The conversation to summarize. --- **`summary_prompt`** `str | None` — default: None How to summarize. Overrides the [`post_prompt`][post-prompt] text in your SWML for this call only. --- **`**sampling`** `Any` Sampling controls passed through to the service: `temperature` (0.3), `top_p` (0.3), `frequency_penalty` (1.0), `presence_penalty` (1.0), and `max_tokens` (512). The list is closed, so any other key is rejected. --- ## **Returns** `str` — the generated summary. ## **Raises** `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 one call per minute. ## **Example** ```python {9} import asyncio from signalwire.ai_chat import AIChatClient, SummaryError async def main(): async with AIChatClient(space="your-space") as client: try: summary = await client.summarize( "chat-8f21", summary_prompt="List the pickup address, the destination, and the quoted fare.", ) except SummaryError as err: print("no summary:", err.message) return print(summary) asyncio.run(main()) ``` > Generate an AI summary of a conversation on demand.