text stringlengths 0 59.1k |
|---|
- `voltOpsClient` - VoltOps client instance (if provided) |
- `runtime` - Metadata including `runId`, `startedAt`, `tags` |
**Return format:** |
```ts |
// Full format: |
runner: async ({ item }) => { |
return { |
output: "agent response", |
metadata: { tokens: 150 }, |
traceIds: ["trace-id-1"], // Optional: trace IDs for observability |
}; |
}; |
// Short format (just the output): |
runner: async ({ item }) => { |
return "agent response"; |
}; |
``` |
The runner can return the output directly or wrap it in an object with metadata and trace IDs. |
### Optional Fields |
#### `scorers` |
Array of scoring functions to evaluate outputs. Each scorer compares the runner output against the expected value or applies custom logic. |
**Basic usage with heuristic scorers:** |
```ts |
// These scorers don't require LLM/API keys |
scorers: [scorers.exactMatch, scorers.levenshtein, scorers.numericDiff]; |
``` |
**With thresholds and custom IDs:** |
```ts |
scorers: [ |
{ |
id: "similarity-check", |
scorer: scorers.levenshtein, |
threshold: 0.8, |
}, |
]; |
``` |
**With LLM-based scorers:** |
```ts |
import { createAnswerCorrectnessScorer } from "@voltagent/scorers"; |
import { openai } from "@ai-sdk/openai"; |
scorers: [ |
{ |
scorer: scorers.levenshtein, // Heuristic scorer |
threshold: 0.8, |
}, |
{ |
scorer: createAnswerCorrectnessScorer({ |
model: openai("gpt-4o-mini"), // LLM scorer requires model |
}), |
threshold: 0.9, |
}, |
]; |
``` |
When a threshold is set, the item fails if `score < threshold`. Scorers without thresholds contribute to metrics but don't affect pass/fail status. |
#### `passCriteria` |
Defines overall experiment success. Can be a single criterion or an array. |
**Mean score:** |
```ts |
passCriteria: { |
type: "meanScore", |
min: 0.9, |
scorerId: "exactMatch", // optional - defaults to all scorers |
severity: "error", // optional - "error" or "warn" |
label: "Accuracy check", // optional - for reporting |
} |
``` |
**Pass rate:** |
```ts |
passCriteria: { |
type: "passRate", |
min: 0.95, |
scorerId: "exactMatch", |
} |
``` |
**Multiple criteria:** |
```ts |
passCriteria: [ |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.