Skip to main content

portia.builder.plan_v2

A plan built using the PlanBuilder.

PlanV2 Objects

class PlanV2(BaseModel)

A sequence of steps to be run by Portia.

validate_plan

@model_validator(mode="after")
def validate_plan() -> PlanV2

Validate the plan.

to_legacy_plan

def to_legacy_plan(plan_context: PlanContext) -> Plan

Convert the Portia plan to a legacy plan.

step_output_name

def step_output_name(step: int | str | StepV2) -> str

Get the name of the output of a step in the plan.

idx_by_name

def idx_by_name(name: str) -> int

Get the index of a step by name.