text stringlengths 0 59.1k |
|---|
- `--concurrency <count>` - Maximum concurrent items (default: 1) |
- `--dataset <name>` - Dataset name override applied at runtime |
- `--experiment-name <name>` - VoltOps experiment name override |
- `--tag <trigger>` - VoltOps trigger source tag (default: "cli-experiment") |
- `--dry-run` - Skip VoltOps submission (local scoring only) |
Example with concurrency: |
```bash |
pnpm volt eval run \ |
--experiment ./src/experiments/offline.experiment.ts \ |
--concurrency 4 |
``` |
The CLI automatically resolves TypeScript imports, streams progress to stdout, and links the run to VoltOps when credentials are present in environment variables (`VOLTAGENT_PUBLIC_KEY` and `VOLTAGENT_SECRET_KEY`). |
## Step 6: Use a Custom Dataset Resolver |
Instead of inline items, you can provide a custom `resolve` function to fetch data from external sources, databases, or APIs. |
```ts |
import { createExperiment } from "@voltagent/evals"; |
export default createExperiment({ |
id: "custom-dataset-example", |
dataset: { |
name: "custom-source", |
resolve: async ({ limit, signal }) => { |
// Fetch from your API, database, or any source |
const response = await fetch("https://api.example.com/test-data", { signal }); |
const data = await response.json(); |
// Apply limit if provided |
const items = limit ? data.slice(0, limit) : data; |
return { |
items, // Can be an array or async iterable |
total: data.length, // Optional: total count for progress tracking |
dataset: { |
name: "custom-source", |
metadata: { source: "api", fetchedAt: new Date().toISOString() }, |
}, |
}; |
}, |
}, |
runner: async ({ item }) => { |
// Your runner logic |
return { output: processItem(item.input) }; |
}, |
}); |
``` |
**Resolver function:** |
- Receives `{ limit?, signal? }` as arguments |
- Can return an iterable, async iterable, or object with `{ items, total?, dataset? }` |
- Supports streaming large datasets with async iterables |
- `signal` enables cancellation handling |
Example with async iterable for streaming: |
```ts |
dataset: { |
resolve: async function* ({ signal }) { |
for await (const item of fetchItemsStream()) { |
if (signal?.aborted) break; |
yield item; |
} |
}, |
} |
``` |
## Step 7: Use Named Datasets from VoltOps |
For production workflows, store datasets in VoltOps and reference them by name. This enables version control, collaboration, and reusable test suites. |
```ts |
import { createExperiment } from "@voltagent/evals"; |
export default createExperiment({ |
id: "voltops-dataset-example", |
dataset: { |
name: "support-qa-v1", |
versionId: "abc123", // Optional - defaults to latest version |
limit: 100, // Optional - limit items processed |
}, |
runner: async ({ item }) => { |
// Your runner logic |
return { output: processItem(item.input) }; |
}, |
}); |
``` |
**Dataset configuration:** |
- `name` - Dataset name in VoltOps (required) |
- `versionId` - Specific version ID (optional, defaults to latest) |
- `limit` - Maximum number of items to process (optional) |
When you run the experiment with a `voltOpsClient`, the dataset is automatically fetched from VoltOps. If no client is provided, the experiment fails with a clear error message. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.