Nous.Eval.Scorers.Function (nous v0.21.1)

Copy Markdown View Source

Wraps a one-argument function as a scorer, for Elixir-defined datasets and tasks. It cannot be referenced from YAML/JSONL files.

{Nous.Eval.Scorers.Function,
 name: "mentions_order", fun: fn input -> input.output =~ "order" end}

The function receives the Nous.Eval.ScoreInput and returns:

  • true / false - a :pass / :fail score
  • a number in 0.0..1.0 - a float score, passed? when at least :threshold
  • a Nous.Eval.Score or a list of them, or any Nous.Eval.Scorer.result/0 ({:ok, _}, {:skip, reason}, {:error, %Nous.Eval.ScorerError{}}), passed through

Anything else, and any number outside 0.0..1.0, is rejected by Nous.Eval.Scoring as a scorer error.

Options

  • :fun - the function (required)
  • :name - the score name (default "function")
  • :threshold - for numeric returns (default 0.5)