Imp.Predict.Assertions (Imp v0.5.0)

Copy Markdown View Source

Wraps an Imp program with assertion-guided self-refinement.

Each attempt calls the wrapped program, evaluates named assertions, and stops once all assertions pass. Failed attempts produce a textual :hint_ for the next attempt so ordinary signatures can opt into self-repair without a special provider API.

If attempts are exhausted, the best prediction by assertion pass rate is returned with :assertion_score, :assertion_failures, and :assertion_history fields. Pass strict: true to return an error instead when no attempt satisfies every assertion. When no attempt returned a prediction at all, the error is the last attempt's reason, or :no_attempts with max_attempts: 0.

Summary

Functions

call(wrapper, inputs)

new(program, assertions, opts \\ [])