These are the docs for the beta version of Evalite. Install with
pnpm add evalite@beta Quickstart
We’re going to walk through setting up Evalite in an existing project.
-
Install
evaliteandvitest.Terminal window pnpm add -D evalite vitest -
Add an
eval:devscript to your package.json:{"scripts": {"eval:dev": "evalite watch"}} -
Create your first eval:
my-eval.eval.ts import { evalite } from "evalite";import { exactMatch } from "evalite/scorers";evalite("My Eval", {// An array of test data// - TODO: Replace with your test datadata: [{ input: "Hello", expected: "Hello World!" }],// The task to perform// - TODO: Replace with your LLM calltask: async (input) => {return input + " World!";},// The scoring methods for the evalscorers: [{scorer: ({ output, expected }) =>exactMatch({ actual: output, expected }),},],}); -
Run
pnpm run eval:dev.Terminal window pnpm run eval:devThis runs
evalite, which runs the evals:- Runs the
datafunction to get the test data - Runs the
taskfunction on each test data - Scores the output of the
taskfunction using thescorers - Saves the results to a sqlite database in
node_modules/.evalite
It then:
- Shows a UI for viewing the traces, scores, inputs and outputs at http://localhost:3006.
- If you only ran one eval, it also shows a table summarizing the eval in the terminal.
- Runs the
-
Open http://localhost:3006 in your browser to view the results of the eval.