Registry / llm-agents / evalite

evalite

JSON →
library0.19.0jsnpmunverified

Evalite is a TypeScript-native evaluation runner designed for testing Large Language Model (LLM)-powered applications, leveraging the popular Vitest testing framework. Currently at version 0.19.0, the library maintains a rapid release cadence with frequent minor and patch updates, introducing new features and improvements. It differentiates itself by offering a local, API-key-free evaluation environment, making it suitable for development without external service dependencies. Key features include the ability to define evaluations with custom columns that access scores and traces, support for custom base paths for static UI exports, flexible configuration through `evalite.config.ts` for global settings like `testTimeout` and `maxConcurrency`, and a `trialCount` option for assessing variance in non-deterministic LLM outputs. It has also improved its testing pipeline by migrating to Vitest's Annotations API and removing serialization requirements for eval datasets, enhancing flexibility for complex input types.

npm install evalite
INSTALL
IMPORT
SIG · EVALITE
E
evalite
llm-agentsjavascriptv0.19.0
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18–226 runs
build_error
glibc
node 18–226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

evalite
✓ import { evalite } from 'evalite';
✗ const evalite = require('evalite');
Evalite is primarily designed for ESM usage with TypeScript. CommonJS require() may lead to `TypeError: evalite is not a function` in certain setups.
defineConfig
✓ import { defineConfig } from 'evalite/config';
✗ import { defineConfig } from 'evalite';
The `defineConfig` utility for `evalite.config.ts` is imported from a specific subpath to avoid bundling issues and clearly separate configuration from runtime eval definition.
CLI
✓ evalite run
✗ vitest run --evalite
Evalite provides its own CLI for running evaluations (`evalite run`, `evalite watch`), which orchestrates Vitest internally. Direct `vitest` commands typically won't trigger Evalite's specific evaluation logic or UI.

This quickstart demonstrates how to set up `evalite.config.ts`, define an evaluation suite with input data, integrate a mock LLM call, assert expected outputs using Vitest's `expect`, and utilize custom scorers and columns for detailed results. It covers the core `evalite` function and its integration into a project to test LLM-powered applications.

/* package.json excerpt */ /* { "name": "my-llm-app", "version": "0.1.0", "description": "My LLM powered application", "type": "module", "devDependencies": { "evalite": "^0.19.0", "vitest": "^4.0.0" /* Ensure compatible Vitest version */ }, "scripts": { "eval": "evalite run", "eval:watch": "evalite watch" } } */ // evalite.config.ts (create this file at your project root) import { defineConfig } from 'evalite/config'; export default defineConfig({ testTimeout: 60000, // LLM calls can be slow, increase timeout if needed maxConcurrency: 5, // Optional: Specify files to run before tests, e.g., for environment variables // setupFiles: ['./evalite.setup.ts'], columns: { 'Input Length': ({ input }) => input.query.length, 'LLM Output Starts With': ({ output }) => output?.startsWith('Processed:'), }, }); // my-llm-app.eval.ts (your evaluation file) import { evalite } from 'evalite'; import { describe, expect } from 'vitest'; // Vitest utilities are still available // A dummy LLM function to simulate an actual LLM call const mockLLM = async (input: string): Promise<string> => { // Simulate network delay and LLM processing await new Promise(resolve => setTimeout(resolve, Math.random() * 200 + 100)); return `Processed: ${input.toUpperCase()}`; }; interface MyEvalInput { query: string; expectedOutput: string; } evalite<MyEvalInput>('My LLM Application Evaluation Suite', ({ test, evalSuite }) => { // Define the dataset for your evaluations evalSuite.data([ { query: 'hello world', expectedOutput: 'PROCESSED: HELLO WORLD' }, { query: 'how are you', expectedOutput: 'PROCESSED: HOW ARE YOU' }, { query: 'evalite rocks', expectedOutput: 'PROCESSED: EVALITE ROCKS' }, { query: 'quick brown fox', expectedOutput: 'PROCESSED: QUICK BROWN FOX' }, ]); // Define a test for each data point test('LLM output should match expected format and content', async ({ input, expect: evalExpect }) => { const llmResponse = await mockLLM(input.query); evalExpect(llmResponse).toBe(input.expectedOutput); return { output: llmResponse }; // The output will be available to scorers and columns }); // Optional: Define custom scorers to evaluate LLM outputs quantitatively evalSuite.scorer('ExactMatchScorer', ({ output, expected }) => { const score = output === expected ? 1 : 0; return { score, verdict: score === 1 ? 'Perfect Match' : 'Mismatch' }; }); // Optional: Add custom columns to display scorer results or other data in the UI evalSuite.column('Match Score', ({ scores }) => scores.ExactMatchScorer?.score); }); // To run: // 1. Install dependencies: npm install evalite vitest // 2. Run the evals: npm run eval // (or npm run eval:watch for watch mode and UI at http://localhost:3006)
evalite --version
Debug
Known issues
breakingEvalite upgraded to Vitest v4 in version 0.17.0. Projects using older Vitest versions might encounter compatibility issues or require an upgrade of their Vitest dependency.
fix
Upgrade Vitest to version 4.x or later: `npm install vitest@latest`.
affects: >=0.17.0
breakingVersion 0.15.0 migrated to Vitest's Annotations API, requiring Vitest 3.2.4 or later. Earlier Vitest versions will cause runtime errors.
fix
Ensure your project's Vitest dependency is `3.2.4` or newer: `npm install vitest@latest`.
affects: >=0.15.0
gotchaIntroduced `evalite.config.ts` in version 0.16.0 for centralized configuration. If upgrading from an earlier version, global options (like `testTimeout`, `maxConcurrency`) previously configured via CLI arguments might need to be migrated to this new configuration file.
fix
Create an `evalite.config.ts` file at your project root and use `defineConfig` from `evalite/config` to set global options.
affects: >=0.16.0
gotchaWhen exporting static UI for hosting on non-root URLs (e.g., S3/CloudFront subpaths), the `evalite export` command now requires a `--basePath` option (since 0.19.0) to correctly resolve assets.
fix
Use `evalite export --basePath=/your-path` to ensure correct asset resolution for static UI deployments.
affects: >=0.19.0
gotchaEvalite is an experimental project and its author actively pushes breaking changes. Unexpected behavior might occur between minor versions.
fix
If issues arise, delete `node_modules/.evalite` folder, update `evalite` to the latest version, and rerun evals. Report issues if they persist.
affects: >=0.1.0
Errors
Common errors & fixes
Error: evalite requires Vitest version X.Y.Z or higher.
Your installed `vitest` package is older than the minimum version required by `evalite`.
fix
Upgrade your `vitest` dependency: `npm install vitest@latest`.
Error: evalite.config.ts not found. Please create one...
After `evalite` v0.16.0, a configuration file (`evalite.config.ts`) is expected at the project root for global settings.
fix
Create `evalite.config.ts` in your project root with content like `import { defineConfig } from 'evalite/config'; export default defineConfig({});`.
TypeError: (0 , evalite_1.evalite) is not a function
This usually indicates an incorrect import, often trying to use CommonJS `require()` syntax or an incorrect named import in an ESM context.
fix
Ensure you are using `import { evalite } from 'evalite';` and that your project is configured for ESM (e.g., `"type": "module"` in `package.json`).
Command failed, Error: Could not locate the bindings file.
This error is related to the `better-sqlite3` dependency that Evalite uses for local data storage, often seen with certain package managers or build environments.
fix
Try rebuilding `better-sqlite3`: `npm rebuild better-sqlite3` (or `pnpm rebuild better-sqlite3`). You might also need to approve the build: `pnpm approve-builds`.
Upgrade
Version history
0.19.0latest on npm
Audit
Dependencies
vitestrequiredEvalite is built on top of Vitest and requires it as a peer dependency for running evaluations.
autoevalsoptionalOften used for scoring LLM outputs, as shown in quickstart examples. Not strictly required, but common.
Agent activity
36 hits · last 30 days
node
34
Amazon
1
OpenAI (training)
1
Resources
evalite — npm install evalite · libregistry