Creates a summary of the input data using a language model.This function uses a language model to analyze the input data and create a
concise summary that captures the key information and semantic meaning.Args:
data: The input data to summarize. Can be any type.
instructions: Optional additional instructions to guide the summarization.
Used to provide specific guidance about what aspects to focus on or
how to structure the summary.
agent: Optional custom agent to use for summarization. If not provided,
the default agent will be used.
thread: Optional thread for maintaining conversation context. Can be
either a Thread object or a string thread ID.
context: Optional dictionary of additional context to include in the task.
handlers: Optional list of handlers to use for the task.
prompt: Optional prompt to use for the task. If not provided, the default
prompt will be used.Returns:
A string containing the generated summary.Examples:
>>> # Basic summarization>>> summarize("Long article about climate change...")'Key findings on climate impacts...'>>> # Summarize with specific instructions>>> summarize("Technical documentation...", instructions="Focus on API changes")'Major API updates include...'
Asynchronously creates a summary of the input data using a language model.This function uses a language model to analyze the input data and create a
concise summary that captures the key information and semantic meaning.Args:
data: The input data to summarize. Can be any type.
instructions: Optional additional instructions to guide the summarization.
Used to provide specific guidance about what aspects to focus on or
how to structure the summary.
agent: Optional custom agent to use for summarization. If not provided,
the default agent will be used.
thread: Optional thread for maintaining conversation context. Can be
either a Thread object or a string thread ID.
context: Optional dictionary of additional context to include in the task.
handlers: Optional list of handlers to use for the task.
prompt: Optional prompt to use for the task. If not provided, the default
prompt will be used.Returns:
A string containing the generated summary.Examples:
>>> # Basic summarization>>> await summarize_async("Long article about climate change...")'Key findings on climate impacts...'>>> # Summarize with specific instructions>>> await summarize_async("Technical documentation...", instructions="Focus on API changes")'Major API updates include...'