Nous.Eval.Examples.Basic (nous v0.21.1)

Copy Markdown View Source

A complete eval task that runs offline, for trying the eval workflow without an API key:

mix nous.eval --task Nous.Eval.Examples.Basic --k 3 --set-baseline example
mix nous.eval --task Nous.Eval.Examples.Basic --k 3 --baseline example

The agent answers weather questions with a get_weather tool and arithmetic directly. Five cases cover a string prompt, a message-list input, a tool call with expected arguments and a no-tool answer; every case is scored by Nous.Eval.Scorers.NoToolErrors plus its own Nous.Eval.Scorers.Trajectory and Nous.Eval.Scorers.Contains.

The scripted model

Unless NOUS_EVAL_EXAMPLE_MODEL is set, Nous.Eval.setup/1 installs a scripted model (the internal ScriptedModel module) as the process-scoped model dispatcher (Nous.ModelDispatcher.put_dispatcher/1) of the process running the eval, and Nous.Eval.teardown/1 removes it; the eval's sample processes find it through $callers. When a dispatcher is already installed (a test's stub) it is left alone. The scripted model is deterministic and, like a real model, decides from the tool descriptions it is offered: it calls the weather tool only when a tool's description mentions the weather. Edit the description in weather_tool/0 and re-run with --baseline to watch a regression appear in the comparison.

Set NOUS_EVAL_EXAMPLE_MODEL=openai:gpt-4o-mini (any provider:model) to run the same task against a real model.

Summary

Functions

The example's get_weather tool.

Functions

weather_tool()

@spec weather_tool() :: Nous.Tool.t()

The example's get_weather tool.