text stringlengths 0 59.1k |
|---|
environment: "prod-us-east"; |
environment: "local-dev"; |
``` |
#### `sampling` |
Controls what percentage of interactions are scored. Use sampling to reduce latency and LLM costs on high-volume agents. |
**Ratio-based:** |
```ts |
sampling: { |
type: "ratio", |
rate: 0.1, // score 10% of interactions |
} |
``` |
**Count-based:** |
```ts |
sampling: { |
type: "count", |
rate: 100, // score every 100th interaction |
} |
``` |
**Always sample:** |
```ts |
sampling: { type: "ratio", rate: 1 } // 100% |
``` |
When unspecified, sampling defaults to scoring every interaction (`rate: 1`). |
Sampling decisions are made independently for each scorer. Set sampling at the eval level (applies to all scorers) or per-scorer to override. |
#### `scorers` |
Map of scorer configurations. Each key identifies a scorer instance, and the value defines the scorer function and parameters. |
```ts |
scorers: { |
moderation: { |
scorer: createModerationScorer({ model, threshold: 0.5 }), |
}, |
keyword: { |
scorer: keywordMatchScorer, |
params: { keyword: "refund" }, |
}, |
} |
``` |
#### `redact` |
Function to remove sensitive data from evaluation payloads before storage. Called synchronously before scoring. |
```ts |
redact: (payload) => ({ |
...payload, |
input: payload.input?.replace(/\b\d{4}-\d{4}-\d{4}-\d{4}\b/g, "[CARD]"), |
output: payload.output?.replace(/\b\d{4}-\d{4}-\d{4}-\d{4}\b/g, "[CARD]"), |
}); |
``` |
The redacted payload is stored in observability but scoring uses the original unredacted version. |
## Scorer Configuration |
Each entry in the `scorers` map has this structure: |
```ts |
{ |
scorer: LocalScorerDefinition | (() => Promise<LocalScorerDefinition>), |
params?: Record<string, unknown> | ((payload: AgentEvalContext) => Record<string, unknown>), |
sampling?: SamplingPolicy, |
id?: string, |
onResult?: (result: AgentEvalResult) => void | Promise<void>, |
} |
``` |
### Fields |
#### `scorer` (required) |
The scoring function. Use prebuilt scorers from `@voltagent/scorers` or custom implementations via `buildScorer`. |
**Prebuilt scorer:** |
```ts |
import { createModerationScorer } from "@voltagent/scorers"; |
scorer: createModerationScorer({ model, threshold: 0.5 }); |
``` |
**Custom scorer:** |
```ts |
import { buildScorer } from "@voltagent/core"; |
const customScorer = buildScorer({ |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.