nat.experimental.test_time_compute.editing.iterative_plan_refinement_editor#

Attributes#

Classes#

IterativePlanRefinementEditor

A planner that generates an initial plan, then refines it multiple times

Functions#

register_iterative_plan_refinement_editor(config, builder)

Register the IterativePlanRefinementEditor strategy.

Module Contents#

logger#
class IterativePlanRefinementEditor(
config: nat.data_models.ttc_strategy.TTCStrategyBaseConfig,
)#

Bases: nat.experimental.test_time_compute.models.strategy_base.StrategyBase

A planner that generates an initial plan, then refines it multiple times using the same LLM. Each iteration updates the plan to (hopefully) be better.

llm_bound = None#
supported_pipeline_types() [nat.experimental.test_time_compute.models.stage_enums.PipelineTypeEnum]#

Return the stage types supported by this selector.

stage_type() nat.experimental.test_time_compute.models.stage_enums.StageTypeEnum#

Return the stage type of this strategy.

async build_components(builder: nat.builder.builder.Builder) None#

Build the components required for the iterative planner.

async refine_single(
prompt: str,
context: str,
ttc_item: nat.experimental.test_time_compute.models.ttc_item.TTCItem,
prompt_idx: int,
) nat.experimental.test_time_compute.models.ttc_item.TTCItem#
async ainvoke(
items: list[nat.experimental.test_time_compute.models.ttc_item.TTCItem],
original_prompt: str | None = None,
agent_context: str | None = None,
**kwargs,
) list[nat.experimental.test_time_compute.models.ttc_item.TTCItem]#

Runs the iterative plan refinement process on the provided planning items.

Each planning item is refined in parallel the configured number of times. Default is 3.

Args:

items (list[TTCItem]): The planning items to refine. original_prompt (str): The original prompt used to generate the plans. agent_context (str): The context for the agent.

Returns:

list[TTCItem]: The refined planning items.

async register_iterative_plan_refinement_editor(
config: nat.experimental.test_time_compute.models.editor_config.IterativePlanRefinementConfig,
builder: nat.builder.builder.Builder,
)#

Register the IterativePlanRefinementEditor strategy.

Args:

config (IterativePlanRefinementConfig): The configuration for the strategy.

Returns:

IterativePlanRefinementEditor: The registered strategy instance.