A validated, content-hashed list of Nous.Eval.Cases.
Build one from Elixir with new/2, or load YAML/JSONL files with load/2.
Both go through the same validation, so a dataset that loads is one the
runner can execute.
Elixir
Nous.Eval.Dataset.new([
%{id: "refund-1", input: "Refund order 42", tags: ["refund"],
scorers: [{MyApp.Eval.RefundIssued, required: true}]},
[id: "greet-1", input: "Hi!"]
])Cases are %Nous.Eval.Case{} structs, maps or keyword lists with atom
keys. A scorer is a module, {module, opts} (opts may carry :required,
:weight and :skippable) or a Nous.Eval.Scorer.Spec.
Files (schema nous.case/1)
YAML holds one document with a schema marker and the case list:
schema: nous.case/1
name: refunds # optional; defaults to the file name
cases:
- id: refund-1
input: Refund order 42
expected: {tool: refund_order}
tags: [refund]
scorers:
- no_tool_errors
- scorer: contains
values: [refund issued]
required: false
- id: refund-2
input:
- {role: system, content: You are terse.}
- {role: user, content: Refund order 43}
group: refund-2 # paraphrases share a group, and so a split
split: testJSONL holds one case object per line, with the same keys; a line may carry
"schema": "nous.case/1". Blank lines are skipped and errors name the line.
Case keys: id (required, non-empty string), input (required: a string
or a list of {role, content} messages, roles system, user,
assistant), expected (object), scorers, threshold (number in
0..1), tags (strings), split (train, val, test), group
(string), metadata (object). A scorer entry is a scorer name or an object
whose scorer key names it and whose other keys are its options, resolved
with Nous.Eval.Scorer.resolve/2.
Loading is strict and fails closed: an unknown key, a duplicate id, a
non-string object key, an unknown role, split or scorer, or an unknown
scorer option is an {:error, message}. Nothing in a file becomes an atom.
Simulated cases
A YAML document with schema: nous.sim_case/1, or a JSONL line with
"schema": "nous.sim_case/1", holds simulated multi-turn cases: a user
description and max_turns instead of an input. They load into the same
dataset as any case (their input is a Nous.Eval.Simulator.Scenario);
see Nous.Eval.Simulator for the keys.
Splits
A case without a split gets one from its group (default: its id):
sha256("nous.split/1:" <> group) picks a uniform bucket, cut by the split
ratios (default train: 0.6, val: 0.2, test: 0.2, option
:split_ratios). The assignment depends only on the group, so adding or
removing cases never moves the others, and paraphrases sharing a group
never straddle splits. When one case of a group declares a split, the
group's other cases follow it; two different declared splits in one group
are an error.
Content hash
:hash is Nous.Eval.CanonicalJSON.hash/1 of the cases sorted by id (with
their assigned splits). It ignores key order, file format, case order, the
dataset name and the source path: the same cases in YAML and JSONL hash the
same. Run records store it to tell which data a run saw.
Summary
Functions
Keeps the cases matching every given criterion and recomputes the hash.
Loads a dataset file: .yaml/.yml or .jsonl.
Builds a dataset from Elixir cases.
The schema id of the case format ("nous.case/1").
Types
@type t() :: %Nous.Eval.Dataset{ cases: [Nous.Eval.Case.t()], hash: String.t(), name: String.t() | nil, source: Path.t() | nil }
Functions
Keeps the cases matching every given criterion and recomputes the hash.
Options
:splits- split names; a case must be in one of them:tags- tag strings; a case must carry at least one of them
Raises ArgumentError for an unknown split or a non-string tag.
Loads a dataset file: .yaml/.yml or .jsonl.
Takes the options of new/2. :name defaults to the YAML name key,
then to the file name without extension.
Builds a dataset from Elixir cases.
cases is a list of %Nous.Eval.Case{}, maps or keyword lists with atom
keys.
Options
:name- the dataset name:split_ratios- keyword or map with:train,:val,:testratios (missing keys are 0; they must sum to 1)
@spec schema() :: String.t()
The schema id of the case format ("nous.case/1").