Imp.GEPA.Acceptance (Imp v0.5.0)

Copy Markdown View Source

Public constructors and evaluators for GEPA candidate acceptance policies.

The built-in policies compare aggregate candidate scores. Custom callbacks receive the complete before/after result context and must return a documented accept or reject decision.

Summary

Functions

Returns whether the policy accepts the proposed result.

Builds a custom acceptance policy.

Evaluates a policy and returns its normalized decision and detail.

Returns the built-in policy for a mutation or merge.

Types

callback()

@type callback() :: (map() -> callback_decision())

callback_decision()

@type callback_decision() :: boolean() | decision() | {decision(), term()}

decision()

@type decision() :: :accept | :reject

policy()

@type policy() :: :strict_improvement | :equal_or_better | {:callback, callback()}

Functions

accept?(policy, before_result, after_result, context \\ %{})

@spec accept?(policy(), struct(), struct(), map()) :: boolean()

Returns whether the policy accepts the proposed result.

callback(fun)

@spec callback(callback()) :: policy()

Builds a custom acceptance policy.

decide(policy, before_result, after_result, context \\ %{})

@spec decide(policy(), struct(), struct(), map()) :: {decision(), term()}

Evaluates a policy and returns its normalized decision and detail.

default(operation)

@spec default(:mutation | :merge) :: policy()

Returns the built-in policy for a mutation or merge.