adapters
LLM adapter for conversation-summary generation and formatting.
This module provides the LLMAdapter class used by the flow manager to:
Format a generated summary as a context message
Generate a summary via out-of-band LLM inference
- class pipecat.flows.adapters.LLMAdapter[source]
Bases:
objectHelpers for generating and formatting conversation summaries.
- format_summary_message(summary: str) dict[source]
Format a summary as a developer message.
Summary messages use the LLMContextMessage format (OpenAI-style), as summarization triggers an LLMMessagesUpdateFrame.
- Parameters:
summary – The generated summary text.
- Returns:
A developer message containing the summary.
- async generate_summary(llm: Any, summary_prompt: str, context: LLMContext) str | None[source]
Generate a summary by running a direct one-shot, out-of-band inference with the LLM.
- Parameters:
llm – LLM service instance containing client/credentials.
summary_prompt – Prompt text to guide summary generation.
context – Context object containing conversation history for the summary.
- Returns:
Generated summary text, or None if generation fails.