agentv 1.3.1 → 1.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +460 -441
- package/dist/{chunk-6R2YRXCQ.js → chunk-HU4B6ODF.js} +1859 -641
- package/dist/chunk-HU4B6ODF.js.map +1 -0
- package/dist/cli.js +1 -1
- package/dist/index.js +1 -1
- package/dist/templates/.agentv/.env.template +23 -23
- package/dist/templates/.agentv/config.yaml +15 -15
- package/dist/templates/.agentv/targets.yaml +71 -73
- package/dist/templates/.claude/skills/agentv-eval-builder/SKILL.md +211 -211
- package/dist/templates/.claude/skills/agentv-eval-builder/references/batch-cli-evaluator.md +316 -288
- package/dist/templates/.claude/skills/agentv-eval-builder/references/compare-command.md +115 -0
- package/dist/templates/.claude/skills/agentv-eval-builder/references/composite-evaluator.md +215 -215
- package/dist/templates/.claude/skills/agentv-eval-builder/references/custom-evaluators.md +241 -213
- package/dist/templates/.claude/skills/agentv-eval-builder/references/example-evals.md +333 -333
- package/dist/templates/.claude/skills/agentv-eval-builder/references/rubric-evaluator.md +137 -139
- package/dist/templates/.claude/skills/agentv-eval-builder/references/tool-trajectory-evaluator.md +224 -179
- package/dist/templates/.claude/skills/agentv-prompt-optimizer/SKILL.md +77 -77
- package/dist/templates/.github/prompts/agentv-eval-build.prompt.md +4 -4
- package/dist/templates/.github/prompts/agentv-optimize.prompt.md +3 -3
- package/package.json +1 -1
- package/dist/chunk-6R2YRXCQ.js.map +0 -1
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
# Compare Command
|
|
2
|
+
|
|
3
|
+
Compare evaluation results between two runs to measure performance differences.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
agentv compare <baseline.jsonl> <candidate.jsonl> [--threshold <value>]
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Arguments
|
|
12
|
+
|
|
13
|
+
| Argument | Description |
|
|
14
|
+
|----------|-------------|
|
|
15
|
+
| `result1` | Path to baseline JSONL result file |
|
|
16
|
+
| `result2` | Path to candidate JSONL result file |
|
|
17
|
+
| `--threshold`, `-t` | Score delta threshold for win/loss classification (default: 0.1) |
|
|
18
|
+
|
|
19
|
+
## How It Works
|
|
20
|
+
|
|
21
|
+
1. **Load Results**: Reads both JSONL files containing evaluation results
|
|
22
|
+
2. **Match by eval_id**: Pairs results with matching `eval_id` fields
|
|
23
|
+
3. **Compute Deltas**: Calculates `delta = score2 - score1` for each pair
|
|
24
|
+
4. **Classify Outcomes**:
|
|
25
|
+
- `win`: delta >= threshold (candidate better)
|
|
26
|
+
- `loss`: delta <= -threshold (baseline better)
|
|
27
|
+
- `tie`: |delta| < threshold (no significant difference)
|
|
28
|
+
5. **Output Summary**: JSON with matched results, unmatched counts, and statistics
|
|
29
|
+
|
|
30
|
+
## Output Format
|
|
31
|
+
|
|
32
|
+
```json
|
|
33
|
+
{
|
|
34
|
+
"matched": [
|
|
35
|
+
{
|
|
36
|
+
"eval_id": "case-1",
|
|
37
|
+
"score1": 0.7,
|
|
38
|
+
"score2": 0.9,
|
|
39
|
+
"delta": 0.2,
|
|
40
|
+
"outcome": "win"
|
|
41
|
+
}
|
|
42
|
+
],
|
|
43
|
+
"unmatched": {
|
|
44
|
+
"file1": 0,
|
|
45
|
+
"file2": 0
|
|
46
|
+
},
|
|
47
|
+
"summary": {
|
|
48
|
+
"total": 2,
|
|
49
|
+
"matched": 1,
|
|
50
|
+
"wins": 1,
|
|
51
|
+
"losses": 0,
|
|
52
|
+
"ties": 0,
|
|
53
|
+
"meanDelta": 0.2
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Exit Codes
|
|
59
|
+
|
|
60
|
+
| Code | Meaning |
|
|
61
|
+
|------|---------|
|
|
62
|
+
| `0` | Candidate is equal or better (meanDelta >= 0) |
|
|
63
|
+
| `1` | Baseline is better (regression detected) |
|
|
64
|
+
|
|
65
|
+
## Workflow Examples
|
|
66
|
+
|
|
67
|
+
### Model Comparison
|
|
68
|
+
|
|
69
|
+
Compare different model versions:
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
# Run baseline evaluation
|
|
73
|
+
agentv eval evals/*.yaml --target gpt-4 --out baseline.jsonl
|
|
74
|
+
|
|
75
|
+
# Run candidate evaluation
|
|
76
|
+
agentv eval evals/*.yaml --target gpt-4o --out candidate.jsonl
|
|
77
|
+
|
|
78
|
+
# Compare results
|
|
79
|
+
agentv compare baseline.jsonl candidate.jsonl
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Prompt Optimization
|
|
83
|
+
|
|
84
|
+
Compare before/after prompt changes:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
# Run with original prompt
|
|
88
|
+
agentv eval evals/*.yaml --out before.jsonl
|
|
89
|
+
|
|
90
|
+
# Modify prompt, then run again
|
|
91
|
+
agentv eval evals/*.yaml --out after.jsonl
|
|
92
|
+
|
|
93
|
+
# Compare with strict threshold
|
|
94
|
+
agentv compare before.jsonl after.jsonl --threshold 0.05
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### CI Quality Gate
|
|
98
|
+
|
|
99
|
+
Fail CI if candidate regresses:
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
#!/bin/bash
|
|
103
|
+
agentv compare baseline.jsonl candidate.jsonl
|
|
104
|
+
if [ $? -eq 1 ]; then
|
|
105
|
+
echo "Regression detected! Candidate performs worse than baseline."
|
|
106
|
+
exit 1
|
|
107
|
+
fi
|
|
108
|
+
echo "Candidate is equal or better than baseline."
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## Tips
|
|
112
|
+
|
|
113
|
+
- **Threshold Selection**: Default 0.1 means 10% difference required. Use stricter thresholds (0.05) for critical evaluations.
|
|
114
|
+
- **Unmatched Results**: Check `unmatched` counts to identify eval cases that only exist in one file.
|
|
115
|
+
- **Multiple Comparisons**: Compare against multiple baselines by running the command multiple times.
|
|
@@ -1,215 +1,215 @@
|
|
|
1
|
-
# Composite Evaluator Guide
|
|
2
|
-
|
|
3
|
-
Composite evaluators combine multiple evaluators and aggregate their results. This enables sophisticated evaluation patterns like safety gates, weighted scoring, and conflict resolution.
|
|
4
|
-
|
|
5
|
-
## Basic Structure
|
|
6
|
-
|
|
7
|
-
```yaml
|
|
8
|
-
execution:
|
|
9
|
-
evaluators:
|
|
10
|
-
- name: my_composite
|
|
11
|
-
type: composite
|
|
12
|
-
evaluators:
|
|
13
|
-
- name: evaluator_1
|
|
14
|
-
type: llm_judge
|
|
15
|
-
prompt: ./prompts/check1.md
|
|
16
|
-
- name: evaluator_2
|
|
17
|
-
type: code_judge
|
|
18
|
-
script: uv run check2.py
|
|
19
|
-
aggregator:
|
|
20
|
-
type: weighted_average
|
|
21
|
-
weights:
|
|
22
|
-
evaluator_1: 0.6
|
|
23
|
-
evaluator_2: 0.4
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
## Aggregator Types
|
|
27
|
-
|
|
28
|
-
### 1. Weighted Average (Default)
|
|
29
|
-
|
|
30
|
-
Combines scores using weighted arithmetic mean:
|
|
31
|
-
|
|
32
|
-
```yaml
|
|
33
|
-
aggregator:
|
|
34
|
-
type: weighted_average
|
|
35
|
-
weights:
|
|
36
|
-
safety: 0.3 # 30% weight
|
|
37
|
-
quality: 0.7 # 70% weight
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
If weights are omitted, all evaluators have equal weight (1.0).
|
|
41
|
-
|
|
42
|
-
**Score calculation:**
|
|
43
|
-
```
|
|
44
|
-
final_score = Σ(score_i × weight_i) / Σ(weight_i)
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
### 2. Code Judge Aggregator
|
|
48
|
-
|
|
49
|
-
Run custom code to decide final score based on all evaluator results:
|
|
50
|
-
|
|
51
|
-
```yaml
|
|
52
|
-
aggregator:
|
|
53
|
-
type: code_judge
|
|
54
|
-
path: node ./scripts/safety-gate.js
|
|
55
|
-
cwd: ./evaluators # optional working directory
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
**Input (stdin):**
|
|
59
|
-
```json
|
|
60
|
-
{
|
|
61
|
-
"results": {
|
|
62
|
-
"safety": { "score": 0.9, "hits": [...], "misses": [...] },
|
|
63
|
-
"quality": { "score": 0.85, "hits": [...], "misses": [...] }
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
**Output (stdout):**
|
|
69
|
-
```json
|
|
70
|
-
{
|
|
71
|
-
"score": 0.87,
|
|
72
|
-
"verdict": "pass",
|
|
73
|
-
"hits": ["Combined check passed"],
|
|
74
|
-
"misses": [],
|
|
75
|
-
"reasoning": "Safety gate passed, quality acceptable"
|
|
76
|
-
}
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
### 3. LLM Judge Aggregator
|
|
80
|
-
|
|
81
|
-
Use an LLM to resolve conflicts or make nuanced decisions:
|
|
82
|
-
|
|
83
|
-
```yaml
|
|
84
|
-
aggregator:
|
|
85
|
-
type: llm_judge
|
|
86
|
-
prompt: ./prompts/conflict-resolution.md
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
The `{{EVALUATOR_RESULTS_JSON}}` variable is replaced with the JSON results from all child evaluators.
|
|
90
|
-
|
|
91
|
-
## Example Patterns
|
|
92
|
-
|
|
93
|
-
### Safety Gate Pattern
|
|
94
|
-
|
|
95
|
-
Block outputs that fail safety even if quality is high:
|
|
96
|
-
|
|
97
|
-
```yaml
|
|
98
|
-
evalcases:
|
|
99
|
-
- id: safety-gated-response
|
|
100
|
-
expected_outcome: Safe and accurate response
|
|
101
|
-
|
|
102
|
-
input_messages:
|
|
103
|
-
- role: user
|
|
104
|
-
content: Explain quantum computing
|
|
105
|
-
|
|
106
|
-
execution:
|
|
107
|
-
evaluators:
|
|
108
|
-
- name: safety_gate
|
|
109
|
-
type: composite
|
|
110
|
-
evaluators:
|
|
111
|
-
- name: safety
|
|
112
|
-
type: llm_judge
|
|
113
|
-
prompt: ./prompts/safety-check.md
|
|
114
|
-
- name: quality
|
|
115
|
-
type: llm_judge
|
|
116
|
-
prompt: ./prompts/quality-check.md
|
|
117
|
-
aggregator:
|
|
118
|
-
type: code_judge
|
|
119
|
-
path: ./scripts/safety-gate.js
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
### Multi-Criteria Weighted Evaluation
|
|
123
|
-
|
|
124
|
-
```yaml
|
|
125
|
-
- name: release_readiness
|
|
126
|
-
type: composite
|
|
127
|
-
evaluators:
|
|
128
|
-
- name: correctness
|
|
129
|
-
type: llm_judge
|
|
130
|
-
prompt: ./prompts/correctness.md
|
|
131
|
-
- name: style
|
|
132
|
-
type: code_judge
|
|
133
|
-
script: uv run style_checker.py
|
|
134
|
-
- name: security
|
|
135
|
-
type: llm_judge
|
|
136
|
-
prompt: ./prompts/security.md
|
|
137
|
-
aggregator:
|
|
138
|
-
type: weighted_average
|
|
139
|
-
weights:
|
|
140
|
-
correctness: 0.5
|
|
141
|
-
style: 0.2
|
|
142
|
-
security: 0.3
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
### Nested Composites
|
|
146
|
-
|
|
147
|
-
Composites can contain other composites for complex hierarchies:
|
|
148
|
-
|
|
149
|
-
```yaml
|
|
150
|
-
- name: comprehensive_eval
|
|
151
|
-
type: composite
|
|
152
|
-
evaluators:
|
|
153
|
-
- name: content_quality
|
|
154
|
-
type: composite
|
|
155
|
-
evaluators:
|
|
156
|
-
- name: accuracy
|
|
157
|
-
type: llm_judge
|
|
158
|
-
prompt: ./prompts/accuracy.md
|
|
159
|
-
- name: clarity
|
|
160
|
-
type: llm_judge
|
|
161
|
-
prompt: ./prompts/clarity.md
|
|
162
|
-
aggregator:
|
|
163
|
-
type: weighted_average
|
|
164
|
-
weights:
|
|
165
|
-
accuracy: 0.6
|
|
166
|
-
clarity: 0.4
|
|
167
|
-
- name: safety
|
|
168
|
-
type: llm_judge
|
|
169
|
-
prompt: ./prompts/safety.md
|
|
170
|
-
aggregator:
|
|
171
|
-
type: weighted_average
|
|
172
|
-
weights:
|
|
173
|
-
content_quality: 0.7
|
|
174
|
-
safety: 0.3
|
|
175
|
-
```
|
|
176
|
-
|
|
177
|
-
## Result Structure
|
|
178
|
-
|
|
179
|
-
Composite evaluators return nested `evaluator_results`:
|
|
180
|
-
|
|
181
|
-
```json
|
|
182
|
-
{
|
|
183
|
-
"score": 0.85,
|
|
184
|
-
"verdict": "pass",
|
|
185
|
-
"hits": ["[safety] No harmful content", "[quality] Clear explanation"],
|
|
186
|
-
"misses": ["[quality] Could use more examples"],
|
|
187
|
-
"reasoning": "safety: Passed all checks; quality: Good but could improve",
|
|
188
|
-
"evaluator_results": [
|
|
189
|
-
{
|
|
190
|
-
"name": "safety",
|
|
191
|
-
"type": "llm_judge",
|
|
192
|
-
"score": 0.95,
|
|
193
|
-
"verdict": "pass",
|
|
194
|
-
"hits": ["No harmful content"],
|
|
195
|
-
"misses": []
|
|
196
|
-
},
|
|
197
|
-
{
|
|
198
|
-
"name": "quality",
|
|
199
|
-
"type": "llm_judge",
|
|
200
|
-
"score": 0.8,
|
|
201
|
-
"verdict": "pass",
|
|
202
|
-
"hits": ["Clear explanation"],
|
|
203
|
-
"misses": ["Could use more examples"]
|
|
204
|
-
}
|
|
205
|
-
]
|
|
206
|
-
}
|
|
207
|
-
```
|
|
208
|
-
|
|
209
|
-
## Best Practices
|
|
210
|
-
|
|
211
|
-
1. **Name evaluators clearly** - Names appear in results and debugging output
|
|
212
|
-
2. **Use safety gates for critical checks** - Don't let high quality override safety failures
|
|
213
|
-
3. **Balance weights thoughtfully** - Consider which aspects matter most for your use case
|
|
214
|
-
4. **Keep nesting shallow** - Deep nesting makes debugging harder
|
|
215
|
-
5. **Test aggregators independently** - Verify your custom aggregation logic with unit tests
|
|
1
|
+
# Composite Evaluator Guide
|
|
2
|
+
|
|
3
|
+
Composite evaluators combine multiple evaluators and aggregate their results. This enables sophisticated evaluation patterns like safety gates, weighted scoring, and conflict resolution.
|
|
4
|
+
|
|
5
|
+
## Basic Structure
|
|
6
|
+
|
|
7
|
+
```yaml
|
|
8
|
+
execution:
|
|
9
|
+
evaluators:
|
|
10
|
+
- name: my_composite
|
|
11
|
+
type: composite
|
|
12
|
+
evaluators:
|
|
13
|
+
- name: evaluator_1
|
|
14
|
+
type: llm_judge
|
|
15
|
+
prompt: ./prompts/check1.md
|
|
16
|
+
- name: evaluator_2
|
|
17
|
+
type: code_judge
|
|
18
|
+
script: uv run check2.py
|
|
19
|
+
aggregator:
|
|
20
|
+
type: weighted_average
|
|
21
|
+
weights:
|
|
22
|
+
evaluator_1: 0.6
|
|
23
|
+
evaluator_2: 0.4
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Aggregator Types
|
|
27
|
+
|
|
28
|
+
### 1. Weighted Average (Default)
|
|
29
|
+
|
|
30
|
+
Combines scores using weighted arithmetic mean:
|
|
31
|
+
|
|
32
|
+
```yaml
|
|
33
|
+
aggregator:
|
|
34
|
+
type: weighted_average
|
|
35
|
+
weights:
|
|
36
|
+
safety: 0.3 # 30% weight
|
|
37
|
+
quality: 0.7 # 70% weight
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
If weights are omitted, all evaluators have equal weight (1.0).
|
|
41
|
+
|
|
42
|
+
**Score calculation:**
|
|
43
|
+
```
|
|
44
|
+
final_score = Σ(score_i × weight_i) / Σ(weight_i)
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### 2. Code Judge Aggregator
|
|
48
|
+
|
|
49
|
+
Run custom code to decide final score based on all evaluator results:
|
|
50
|
+
|
|
51
|
+
```yaml
|
|
52
|
+
aggregator:
|
|
53
|
+
type: code_judge
|
|
54
|
+
path: node ./scripts/safety-gate.js
|
|
55
|
+
cwd: ./evaluators # optional working directory
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
**Input (stdin):**
|
|
59
|
+
```json
|
|
60
|
+
{
|
|
61
|
+
"results": {
|
|
62
|
+
"safety": { "score": 0.9, "hits": [...], "misses": [...] },
|
|
63
|
+
"quality": { "score": 0.85, "hits": [...], "misses": [...] }
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
**Output (stdout):**
|
|
69
|
+
```json
|
|
70
|
+
{
|
|
71
|
+
"score": 0.87,
|
|
72
|
+
"verdict": "pass",
|
|
73
|
+
"hits": ["Combined check passed"],
|
|
74
|
+
"misses": [],
|
|
75
|
+
"reasoning": "Safety gate passed, quality acceptable"
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### 3. LLM Judge Aggregator
|
|
80
|
+
|
|
81
|
+
Use an LLM to resolve conflicts or make nuanced decisions:
|
|
82
|
+
|
|
83
|
+
```yaml
|
|
84
|
+
aggregator:
|
|
85
|
+
type: llm_judge
|
|
86
|
+
prompt: ./prompts/conflict-resolution.md
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
The `{{EVALUATOR_RESULTS_JSON}}` variable is replaced with the JSON results from all child evaluators.
|
|
90
|
+
|
|
91
|
+
## Example Patterns
|
|
92
|
+
|
|
93
|
+
### Safety Gate Pattern
|
|
94
|
+
|
|
95
|
+
Block outputs that fail safety even if quality is high:
|
|
96
|
+
|
|
97
|
+
```yaml
|
|
98
|
+
evalcases:
|
|
99
|
+
- id: safety-gated-response
|
|
100
|
+
expected_outcome: Safe and accurate response
|
|
101
|
+
|
|
102
|
+
input_messages:
|
|
103
|
+
- role: user
|
|
104
|
+
content: Explain quantum computing
|
|
105
|
+
|
|
106
|
+
execution:
|
|
107
|
+
evaluators:
|
|
108
|
+
- name: safety_gate
|
|
109
|
+
type: composite
|
|
110
|
+
evaluators:
|
|
111
|
+
- name: safety
|
|
112
|
+
type: llm_judge
|
|
113
|
+
prompt: ./prompts/safety-check.md
|
|
114
|
+
- name: quality
|
|
115
|
+
type: llm_judge
|
|
116
|
+
prompt: ./prompts/quality-check.md
|
|
117
|
+
aggregator:
|
|
118
|
+
type: code_judge
|
|
119
|
+
path: ./scripts/safety-gate.js
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### Multi-Criteria Weighted Evaluation
|
|
123
|
+
|
|
124
|
+
```yaml
|
|
125
|
+
- name: release_readiness
|
|
126
|
+
type: composite
|
|
127
|
+
evaluators:
|
|
128
|
+
- name: correctness
|
|
129
|
+
type: llm_judge
|
|
130
|
+
prompt: ./prompts/correctness.md
|
|
131
|
+
- name: style
|
|
132
|
+
type: code_judge
|
|
133
|
+
script: uv run style_checker.py
|
|
134
|
+
- name: security
|
|
135
|
+
type: llm_judge
|
|
136
|
+
prompt: ./prompts/security.md
|
|
137
|
+
aggregator:
|
|
138
|
+
type: weighted_average
|
|
139
|
+
weights:
|
|
140
|
+
correctness: 0.5
|
|
141
|
+
style: 0.2
|
|
142
|
+
security: 0.3
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### Nested Composites
|
|
146
|
+
|
|
147
|
+
Composites can contain other composites for complex hierarchies:
|
|
148
|
+
|
|
149
|
+
```yaml
|
|
150
|
+
- name: comprehensive_eval
|
|
151
|
+
type: composite
|
|
152
|
+
evaluators:
|
|
153
|
+
- name: content_quality
|
|
154
|
+
type: composite
|
|
155
|
+
evaluators:
|
|
156
|
+
- name: accuracy
|
|
157
|
+
type: llm_judge
|
|
158
|
+
prompt: ./prompts/accuracy.md
|
|
159
|
+
- name: clarity
|
|
160
|
+
type: llm_judge
|
|
161
|
+
prompt: ./prompts/clarity.md
|
|
162
|
+
aggregator:
|
|
163
|
+
type: weighted_average
|
|
164
|
+
weights:
|
|
165
|
+
accuracy: 0.6
|
|
166
|
+
clarity: 0.4
|
|
167
|
+
- name: safety
|
|
168
|
+
type: llm_judge
|
|
169
|
+
prompt: ./prompts/safety.md
|
|
170
|
+
aggregator:
|
|
171
|
+
type: weighted_average
|
|
172
|
+
weights:
|
|
173
|
+
content_quality: 0.7
|
|
174
|
+
safety: 0.3
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
## Result Structure
|
|
178
|
+
|
|
179
|
+
Composite evaluators return nested `evaluator_results`:
|
|
180
|
+
|
|
181
|
+
```json
|
|
182
|
+
{
|
|
183
|
+
"score": 0.85,
|
|
184
|
+
"verdict": "pass",
|
|
185
|
+
"hits": ["[safety] No harmful content", "[quality] Clear explanation"],
|
|
186
|
+
"misses": ["[quality] Could use more examples"],
|
|
187
|
+
"reasoning": "safety: Passed all checks; quality: Good but could improve",
|
|
188
|
+
"evaluator_results": [
|
|
189
|
+
{
|
|
190
|
+
"name": "safety",
|
|
191
|
+
"type": "llm_judge",
|
|
192
|
+
"score": 0.95,
|
|
193
|
+
"verdict": "pass",
|
|
194
|
+
"hits": ["No harmful content"],
|
|
195
|
+
"misses": []
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
"name": "quality",
|
|
199
|
+
"type": "llm_judge",
|
|
200
|
+
"score": 0.8,
|
|
201
|
+
"verdict": "pass",
|
|
202
|
+
"hits": ["Clear explanation"],
|
|
203
|
+
"misses": ["Could use more examples"]
|
|
204
|
+
}
|
|
205
|
+
]
|
|
206
|
+
}
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
## Best Practices
|
|
210
|
+
|
|
211
|
+
1. **Name evaluators clearly** - Names appear in results and debugging output
|
|
212
|
+
2. **Use safety gates for critical checks** - Don't let high quality override safety failures
|
|
213
|
+
3. **Balance weights thoughtfully** - Consider which aspects matter most for your use case
|
|
214
|
+
4. **Keep nesting shallow** - Deep nesting makes debugging harder
|
|
215
|
+
5. **Test aggregators independently** - Verify your custom aggregation logic with unit tests
|