Repository navigation
Commit 73f41ba
fix: normalize list score dicts in remote evals (#595)
## Context
Valid multi-score remote scorer results from remote eval scorers are
rejected. Remote eval scorers can return `list[Score]`, but that result
crosses an HTTP/JSON boundary and the caller receives `list[dict]`
rather than real `Score` objects. `await_or_run_scorer` normalizes a
single score dict with `Score.from_dict()`, but is missing normalization
for `list[dict]` responses.
## Changes
- Normalize dict entries inside scorer result lists with
`Score.from_dict()`.
- Keep existing validation for malformed score entries.
- Add regression coverage for a scorer returning a list of score dicts.
- Verify both per-result scores and summary scores are populated
correctly.
## Testing
* Added `test_run_evaluator_normalizes_list_of_dict_scores`
- creates an evaluator with two data rows
- uses a scorer that returns a list of two score dicts:
- `{"name": "per_result", "score": 1.0}`
- `"name": "summary_only", "score": 1.0}`
- runs the evaluator locally with `run_evaluator(...)`
- asserts each eval result contains both scores
- asserts the final summary contains both score names with score 1.0
* Ran the focused core regression test
* Ran a local smoke test where a scorer returns multiple score dicts,
confirming the eval completes and emits both expected scores.
---------
Co-authored-by: Abhijeet Prasad <abhijeet@braintrustdata.com>1 parent a095270 commit 73f41ba
2 files changed
Lines changed: 61 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1324 | 1324 | | |
1325 | 1325 | | |
1326 | 1326 | | |
| 1327 | + | |
| 1328 | + | |
| 1329 | + | |
| 1330 | + | |
| 1331 | + | |
| 1332 | + | |
| 1333 | + | |
| 1334 | + | |
| 1335 | + | |
| 1336 | + | |
| 1337 | + | |
| 1338 | + | |
| 1339 | + | |
1327 | 1340 | | |
1328 | 1341 | | |
1329 | 1342 | | |
| |||
1455 | 1468 | | |
1456 | 1469 | | |
1457 | 1470 | | |
1458 | | - | |
1459 | | - | |
1460 | | - | |
1461 | | - | |
| 1471 | + | |
1462 | 1472 | | |
1463 | 1473 | | |
1464 | | - | |
1465 | | - | |
1466 | | - | |
1467 | | - | |
1468 | | - | |
1469 | | - | |
| 1474 | + | |
| 1475 | + | |
| 1476 | + | |
| 1477 | + | |
| 1478 | + | |
| 1479 | + | |
| 1480 | + | |
1470 | 1481 | | |
1471 | 1482 | | |
1472 | 1483 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
296 | 296 | | |
297 | 297 | | |
298 | 298 | | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
299 | 339 | | |
300 | 340 | | |
301 | 341 | | |
| |||
0 commit comments