Imp.Predict.ProgramOfThought (Imp v0.5.0)

Copy Markdown View Source

Generates and executes a small BEAM-safe program, regenerating failed code.

Program execution uses Imp.Sandbox; generated source is never passed to Code.eval_string/3 or an external runtime. When execution fails, the next planner call receives the previous program and its error. If the sandbox value cannot directly satisfy the declared outputs, a final LM call extracts those outputs from the program, value, and execution trajectory.

Summary

Functions

Builds a ProgramOfThought predictor.

Types

t()

@type t() :: %Imp.Predict.ProgramOfThought{
  max_iters: pos_integer(),
  output_field: atom() | String.t(),
  predict: struct(),
  signature: Imp.Signature.t()
}

Functions

new(signature, opts \\ [])

@spec new(term(), keyword()) :: t()

Builds a ProgramOfThought predictor.

:max_iters is the total number of generation and regeneration attempts and defaults to 3. The retry budget is retained by portable save/load.