Nous.Eval.Fingerprint (nous v0.21.1)

Copy Markdown View Source

Identifies the configuration an eval run tested.

Two runs with equal fingerprint "id"s ran the same model, prompt, tools, guard configuration, data and scorers with the same sampling settings, so their results are comparable. build/5 returns a JSON-native map (string keys, no atoms) that is stored on Nous.Eval.Run as is:

  • "model" - "provider:model"; "model_settings" - the agent's settings merged over the model's defaults
  • "instructions" - hash of the effective instructions (instructions, else system_prompt). A function is resolved once with empty deps and its text hashed when that succeeds; it is also identified as %{"module", "name", "arity"} for a named capture (&Mod.fun/1), or "anonymous" with a Logger warning, because an edit inside an anonymous function does not change its identity
  • "tools" - hash of the model-visible tool schemas (name, description, parameters), sorted by name, plus the names
  • "guards" - the plugin list and the guard configurations found in deps (:input_guard_config, :decision_guard_config, :loop_guard_config)
  • "profile_id" - the Nous.Profile the agent applies (Nous.Profile.applied_id/1; nil without one). The instruction and tool hashes above are of the applied text
  • "dataset" - the dataset content hash (Nous.Eval.Dataset)
  • "scorers" - each task scorer's module, options, composition and its Nous.Eval.Scorer.describe/1 output; "prompt_hash" lifts a judge's prompt hash out of describe/1
  • "k", "seed", "seed_forwarded" - samples per case, base seed, and whether the agent's provider sends the seed on the wire (see Nous.Provider's seed_param/0); without a seed it is false
  • "nous_version", "schema_version" - the Nous release and the run record format (Nous.Eval.Run.schema_version/0)
  • "task" - the task module
  • "simulator" - only for a run with simulated cases: the simulated user's model, settings and prompt template version (Nous.Eval.Simulator)
  • "id" - Nous.Eval.CanonicalJSON.hash/1 of all of the above

Model credentials and base URLs are never part of the fingerprint.

Summary

Functions

Builds the fingerprint of a run.

Whether model's provider sends model_settings[:seed] to the API.

Functions

build(task, agent, dataset, scorers, opts \\ [])

@spec build(
  module(),
  Nous.Agent.t(),
  Nous.Eval.Dataset.t(),
  [Nous.Eval.Scorer.Spec.t()],
  keyword()
) ::
  {:ok, map()} | {:error, term()}

Builds the fingerprint of a run.

Options

  • :k - samples per case (default 1)
  • :seed - the run's base seed (default nil)
  • :deps - the deps the agent runs with; guard configurations are read from them (default %{})
  • :simulator - the "simulator" entry (nil, the default, adds none)

Scorers that export describe/1 are initialized with their options to describe them; an init/1 error is returned as {:error, _}.

seed_forwarded?(model)

@spec seed_forwarded?(Nous.Model.t()) :: boolean()

Whether model's provider sends model_settings[:seed] to the API.

Read from the provider module's seed_param/0 (use Nous.Provider, seed_param: ...). A provider without it, or one that is not loaded, counts as not forwarding.