text
stringlengths
0
59.1k
// src/agents/support.dataset.ts
import { defineDataset } from "viteval/dataset";
export default defineDataset({
name: "support",
data: async () => [
{
input: "What is your refund policy?",
expected: "Our refund policy allows returns within 30 days of purchase with a valid receipt.",
},
{
input: "How long does shipping take?",
expected: "Standard shipping takes 3-5 business days, express shipping takes 1-2 days.",
},
{
input: "Hello, I need help with my order",
expected:
"Hello! I'd be happy to help you with your order. What specific assistance do you need?",
},
],
});
```
:::tip
You can also use an LLM to generate the dataset dynamically. See an example in [Viteval Example](https://github.com/voltagent/voltagent/tree/main/examples/with-viteval)
:::
### 6. Create Evaluation File
Create the evaluation logic:
```typescript
// src/agents/support.eval.ts
import { evaluate, scorers } from "viteval";
import { supportAgent } from "./support";
import supportDataset from "./support.dataset";
evaluate("Customer Support Agent", {
description: "Evaluates customer support agent capabilities",
data: supportDataset,
task: async ({ input }) => {
const result = await supportAgent.generateText(input);
return result.text;
},
scorers: [scorers.answerCorrectness, scorers.answerRelevancy, scorers.moderation],
threshold: 0.7,
});
```
:::tip
You can learn more about Viteval scorers by visiting the [Viteval Scorers](https://viteval.dev/guide/concepts#scorers?ref=voltagent) documentation.
:::
### 7. Add NPM Script
Add a script to your `package.json`:
```json
{
"scripts": {
"eval:viteval": "viteval"
}
}
```
### 8. Run Your Evaluation
```bash
npm run eval:viteval
```
You'll see output like:
```
✓ Customer Support Agent (3/3 passed)
✓ answerCorrectness: 0.85
✓ answerRelevancy: 0.82
✓ moderation: 0.98
Overall: 0.883 (threshold: 0.7) ✓
```
## Limitations
When using Viteval with VoltAgent, be aware of these limitations:
1. **No VoltOps Integration**: Results won't appear in your VoltOps dashboard
2. **Limited Scorer Support**: Not all VoltAgent scorers are available in Viteval
3. **No Live Evaluations**: Viteval only supports offline evaluations
4. **Dataset Format Differences**: Viteval datasets use a different format than VoltAgent datasets
## Migration to Native VoltAgent Evals
To migrate from Viteval to VoltAgent's native evaluation system:
1. Convert your Viteval datasets to VoltAgent format (see [Datasets Guide](/evaluation-docs/datasets))
2. Replace `viteval` commands with `volt eval` commands
3. Use `runExperiment` instead of `evaluate()` function
4. Update scorers to use VoltAgent's scorer definitions
## Next Steps