GEPA.EvaluationBatch (GEPA v0.3.0)

Copy Markdown View Source

Container for per-example evaluation results returned by an adapter.

GEPA treats outputs and trajectories as opaque user data, but it relies on a strict one-to-one alignment between outputs, scores, optional trajectories, and optional objective_scores. This mirrors the Python reference contract and keeps bugs in adapters from leaking into optimizer state.

Summary

Functions

Return a copy whose scores are floats.

Validate that a batch satisfies the official GEPA adapter invariants.

Return :ok for a valid batch or a precise error tuple otherwise.

Raise unless a batch is valid; otherwise return the batch unchanged.

Types

t()

@type t() :: %GEPA.EvaluationBatch{
  num_metric_calls: non_neg_integer() | nil,
  objective_scores: [%{required(String.t()) => number()}] | nil,
  outputs: [term()],
  scores: [float()],
  trajectories: [term()] | nil
}

Functions

normalize_scores(batch)

@spec normalize_scores(t()) :: t()

Return a copy whose scores are floats.

valid?(batch, opts \\ [])

@spec valid?(
  term(),
  keyword()
) :: boolean()

Validate that a batch satisfies the official GEPA adapter invariants.

validate(batch, opts \\ [])

@spec validate(
  term(),
  keyword()
) :: :ok | {:error, term()}

Return :ok for a valid batch or a precise error tuple otherwise.

validate!(batch, opts \\ [])

@spec validate!(
  t(),
  keyword()
) :: t()

Raise unless a batch is valid; otherwise return the batch unchanged.