Export a set of evals from one file
Put the samples in an array, usemap to generate a defineEval for each row, and default-export the whole array. The check logic is written once, and changing it applies to every sample:
Confirm each eval’s ID
When you export an array, NiceEval numbers each eval by position. If the file isevals/sql.eval.ts, the generated IDs are:
evals/swelancer.eval.ts and the key is 15193, the ID is swelancer/15193. A key must be one non-empty path segment: it cannot be . or .., and cannot contain /, \\, or control characters. NiceEval sorts keys lexicographically, so when the data source returns them in a different order, the run order and IDs stay the same.
Before running, use pnpm exec niceeval exp local sql --dry to confirm which IDs were generated and how many there are.
Read a dataset from YAML or JSON
As samples grow, a separate data file is easier to maintain. Read it withloadYaml or loadJson, passing a validation function:
loadYaml and loadJson require a validation function (decoder). The file content only appears as an unknown type inside the validation function; once validation passes, the return value is typed data you can use directly. When the data file has the wrong format, the validation function throws, and this eval file fails to load.
Run only part of the dataset
Write an eval ID prefix after the Experiment to run only some of them:pnpm exec niceeval show, or in the browser with pnpm exec niceeval view. Each sample is an independent eval, and the failing ones are listed separately.
Choose a dataset or separate files
- Use a dataset
- Use separate files
Every sample follows exactly the same flow; only the input and expected output differ.