Skip to main content
This is the full TypeScript API. It works the same way as the Python SDK. Only names change to camelCase.
Requires Node 22.18 or later. Node runs TypeScript directly, so there’s no build step. Eval files are named *.eval.ts (or .mts, .js, .mjs) and run with npx ezvals run or npx ezvals serve.

evaluate()

Registers an eval. fn receives an EvalContext and may be async. Return nothing (the context becomes the result), a result object, or an array of result objects for several results. Anything else is an error. Assertions become failing scores when the thrown error is named AssertionError, which covers node:assert and chai.

Evaluate options

A misspelled option, such as datset, throws an error that suggests the closest valid name. File defaults. export const ezvalsDefaults = { ... } sets any option except cases and inputLoader for every eval in the file. See File defaults.
A timeout can’t interrupt code that blocks the event loop. Such an eval is still reported as timed out, but only when the blocking code finishes.

EvalContext

ctx.store({...})

Sets every field passed and returns the context. A score with an existing key replaces it, and metadata and traceData merge.

Types

The package also exports the Target, Evaluator and EvalFn function types.
The TypeScript package has no equivalent of Python’s run() or run_evals(). Use npx ezvals run --json from scripts.