Skip to main content

portia.execution_agents.utils.final_output_summarizer

Utility class for final output summarizer.

FinalOutputSummarizer Objects

class FinalOutputSummarizer()

Utility class responsible for summarizing the run outputs for final output's summary.

Attributes:

  • config Config - The configuration for the llm.
  • agent_memory AgentMemory - The agent memory to use for the summarizer.

__init__

def __init__(config: Config, agent_memory: AgentMemory) -> None

Initialize the summarizer agent.

Arguments:

  • config Config - The configuration for the llm.
  • agent_memory AgentMemory - The agent memory to use for the summarizer.

get_output_value

def get_output_value(output: Output) -> str | None

Get the value to use for the specified output.

This ensures that introspection outputs and outputs that are too large for the LLM context window are handled correctly.

create_summary

def create_summary(plan: Plan, plan_run: PlanRun) -> str | BaseModel | None

Execute the summarizer llm and return the summary as a string.

Arguments:

  • plan Plan - The plan containing the steps.
  • plan_run PlanRun - The run to summarize.

Returns:

str | BaseModel | None: The generated summary or None if generation fails.