text stringlengths 0 59.1k |
|---|
::: |
## When to Use Viteval |
Consider using Viteval if: |
- Your team already uses Viteval for other projects |
- You need Viteval-specific features not yet available in VoltAgent |
- You're migrating from a Viteval-based evaluation system |
## Prerequisites |
Before starting, make sure you have: |
- A VoltAgent project set up with `@voltagent/core` |
- Node.js 22+ installed |
- An AI provider configured (OpenAI, Anthropic, etc.) |
## Installation |
Install Viteval as a development dependency: |
<Tabs> |
<TabItem value="npm" label="npm"> |
```bash |
npm install viteval --save-dev |
``` |
</TabItem> |
<TabItem value="yarn" label="yarn"> |
```bash |
yarn add viteval --dev |
``` |
</TabItem> |
<TabItem value="pnpm" label="pnpm"> |
```bash |
pnpm add viteval --save-dev |
``` |
</TabItem> |
</Tabs> |
## Quick Setup |
### 1. Initialize Viteval |
```bash |
viteval init |
``` |
This will create a `viteval.config.ts` and `viteval.setup.ts` file in your project root. |
### 2. Viteval Setup File |
Uncomment the setup file content to use env variables or remove it if you don't need it: |
```typescript |
// viteval.setup.ts |
import dotenv from "dotenv"; |
dotenv.config({ path: "./.env", quiet: true }); |
``` |
### 3. Configure Viteval (Optional) |
Update the Viteval configuration file: |
```typescript |
// viteval.config.ts |
import { defineConfig } from "viteval/config"; |
export default defineConfig({ |
reporter: "console", |
eval: { |
include: ["src/**/*.eval.ts"], |
setupFiles: ["./viteval.setup.ts"], |
}, |
}); |
``` |
### 4. Create Your Agent |
First, create your VoltAgent agent: |
```typescript |
// src/agents/support.ts |
import { Agent } from "@voltagent/core"; |
import { openai } from "@ai-sdk/openai"; |
export const supportAgent = new Agent({ |
name: "Customer Support", |
instructions: |
"You are a helpful customer support agent. Provide accurate and friendly assistance.", |
model: openai("gpt-4o-mini"), |
}); |
``` |
### 5. Create Test Dataset |
Define your test cases in a dataset file: |
```typescript |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.