Built on Vitest
Import your application functions into evaluations. Use Vitest configuration, watch mode, retries, and CI exit codes.
Test extraction, routing, and generated answers against reference cases. Score each output, inspect failures locally, and fail CI when a case falls below your threshold. Built on Vitest.
Why Viteval
Keep your application code, TypeScript, and Vitest workflow. Viteval adds the evaluation pieces.
Import your application functions into evaluations. Use Vitest configuration, watch mode, retries, and CI exit codes.
Check exact answers and structured output, or use embeddings and LLM judges. Set a per-case threshold to fail regressions.
Run evaluations and inspect results on your machine. Connect a hosted provider only when you choose.
The same evaluations on your laptop, in CI, or on a runner you control. You choose where the data lives.
Evaluation workflow
Check normalization and missing values without an API key.
import { evaluate, scorers } from 'viteval';
import { orderMessages } from './order-extraction.dataset';
evaluate('Order extraction', {
data: orderMessages,
task: ({ input }) => input.match(/\bORD-\d+\b/i)?.[0].toUpperCase() ?? '',
scorers: [scorers.exactMatch()],
});import { defineDataset } from 'viteval/dataset';
export const orderMessages = defineDataset({
name: 'order-extraction',
data: async () => [
{ input: 'Where is order ORD-1042?', expected: 'ORD-1042' },
{ input: 'Please cancel ord-2087.', expected: 'ORD-2087' },
{ input: 'How do I update my address?', expected: '' },
],
});import { defineConfig } from 'viteval/config';
import { JsonReporter } from 'viteval/reporters';
export default defineConfig({
test: {
include: ['src/**/*.eval.ts'],
setupFiles: ['./viteval.setup.ts'],
reporters: [
'default',
new JsonReporter({ outputFile: '.viteval/results/<run>.json' }),
],
},
});❯ pnpm exec viteval run
RUN v5.0.3
src/order-extraction.eval.ts (3 cases)
2 passed1 failed3 cases
Input
Please cancel ord-2087.
The case-sensitive pattern misses ord-2087 and returns an empty string. Restore the regular expression’s i flag to match both cases. This case-detail diagram summarizes the captured failure.
Integrations
Keep results in local JSON, or connect your preferred storage and evaluation tools.