text stringlengths 0 59.1k |
|---|
### Combine Multiple Scorers |
Use complementary scorers to catch different failure modes: |
```ts |
scorers: [ |
scorers.exactMatch, // strict match |
scorers.embeddingSimilarity, // semantic similarity |
scorers.moderation, // safety check |
]; |
``` |
### Set Realistic Thresholds |
Start with loose thresholds and tighten over time: |
```ts |
scorers: [ |
{ scorer: scorers.answerCorrectness, threshold: 0.7 }, // initial baseline |
]; |
``` |
Monitor false positives and adjust based on production data. |
### Tag Runs for Filtering |
Use tags to organize runs by context: |
```ts |
tags: [`branch:${process.env.GIT_BRANCH}`, `commit:${process.env.GIT_SHA}`, "ci"]; |
``` |
This enables filtering in VoltOps dashboards and APIs. |
### Handle Long-Running Items |
Set timeouts in your runner to prevent hangs: |
```ts |
runner: async ({ item, signal }) => { |
const timeout = setTimeout(() => controller.abort(), 30000); |
try { |
return await agent.generateText(item.input, { signal }); |
} finally { |
clearTimeout(timeout); |
} |
}; |
``` |
Or use the provided `signal` for coordinated cancellation. |
### Validate Experiment Configuration |
Test your experiment with a small dataset before running the full suite: |
```ts |
const result = await runExperiment(experiment, { |
voltOpsClient, |
onProgress: ({ completed, total }) => { |
if (completed === 1) { |
console.log("First item processed successfully"); |
} |
}, |
}); |
``` |
Check the first result to verify runner output format and scorer compatibility. |
## Examples |
### Basic Regression Test |
```ts |
import { createExperiment } from "@voltagent/evals"; |
import { scorers } from "@voltagent/scorers"; |
export default createExperiment({ |
id: "greeting-smoke", |
dataset: { |
items: [ |
{ id: "1", input: "hello", expected: "hello" }, |
{ id: "2", input: "goodbye", expected: "goodbye" }, |
], |
}, |
runner: async ({ item }) => item.input.toLowerCase(), |
scorers: [scorers.exactMatch], |
passCriteria: { type: "passRate", min: 1.0 }, |
}); |
``` |
### RAG Evaluation |
```ts |
import { createExperiment } from "@voltagent/evals"; |
import { scorers } from "@voltagent/scorers"; |
export default createExperiment({ |
id: "rag-quality", |
dataset: { name: "knowledge-base-qa" }, |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.