Named runtime constraint for Imp predictions.
Assertions are ordinary Elixir predicates over a prediction, or over
{inputs, prediction}. They provide the useful production core of DSPy's
assertion/self-refinement lineage: executable constraints that can produce
feedback for another attempt.
iex> assertion = Imp.Assertion.new(:one_word, fn pred ->
...> pred |> Imp.Prediction.get(:answer, "") |> String.split() |> length() == 1
...> end, message: "Answer with one word.")
iex> assertion.name
:one_word
Summary
Functions
Builds a named assertion from a unary or binary predicate.