Imp.Optimize.Anything.Result (Imp v0.5.0)

Copy Markdown View Source

Immutable Optimize Anything result projected from the GEPA engine.

The result keeps the complete named candidate population, lineage, validation scores, Pareto winners, observed budget, and a JSON-safe engine checkpoint. Binary candidates are wrapped internally and unwrapped only by best_candidate/1; structured candidates remain native maps at every public result boundary.

Summary

Functions

Returns the best named/structured candidate, or a binary for string-candidate runs.

Returns the first candidate with the maximum aggregate validation score.

Returns the winning co-evolved refiner prompt when present.

Restores a version-2 Optimize Anything result.

Builds an immutable public result from a completed GEPA engine state.

Converts the result to a JSON-safe schema-versioned map.

Types

t()

@type t() :: %Imp.Optimize.Anything.Result{
  best_outputs_valset: term(),
  candidate_side_information: term(),
  candidates: term(),
  checkpoint: term(),
  discovery_evaluation_counts: term(),
  full_evaluations: term(),
  history: term(),
  instance_frontier: term(),
  mode: term(),
  objective_frontier: term(),
  objective_scores: term(),
  parents: term(),
  reflection_calls: term(),
  rejected: term(),
  run_dir: term(),
  seed: term(),
  stop_reason: term(),
  string_candidate_key: term(),
  total_metric_calls: term(),
  validation_scores: term(),
  validation_subscores: term()
}

Functions

best_candidate(result)

@spec best_candidate(t()) :: map() | String.t()

Returns the best named/structured candidate, or a binary for string-candidate runs.

best_index(result)

@spec best_index(t()) :: non_neg_integer()

Returns the first candidate with the maximum aggregate validation score.

best_refiner_prompt(result)

@spec best_refiner_prompt(t()) :: String.t() | nil

Returns the winning co-evolved refiner prompt when present.

from_map(map)

@spec from_map(map()) :: t()

Restores a version-2 Optimize Anything result.

from_state(state, opts \\ [])

@spec from_state(struct(), keyword()) :: t()

Builds an immutable public result from a completed GEPA engine state.

to_map(result)

@spec to_map(t()) :: map()

Converts the result to a JSON-safe schema-versioned map.