Skip to content

feat: allow scorer functions to return arrays of scores (#304)#385

Open
Sigmabrogz wants to merge 2 commits intomattpocock:mainfrom
Sigmabrogz:fix-scorer-array-return
Open

feat: allow scorer functions to return arrays of scores (#304)#385
Sigmabrogz wants to merge 2 commits intomattpocock:mainfrom
Sigmabrogz:fix-scorer-array-return

Conversation

@Sigmabrogz
Copy link

This PR addresses issue #304.

It allows Scorer functions and ScorerOpts scorer functions to return an array of scores instead of just a single score. The results are flattened when collecting the scores so that LLM graders (or other scorers evaluating multiple criteria in a single pass) can return multiple independent scores at once.

Changes:

  • Updated Scorer and ScorerOpts in packages/evalite/src/types.ts.
  • Updated createScorer.ts to handle arrays of scores and map them correctly.
  • Added a .flat() call when awaiting scores in packages/evalite/src/evalite.ts.
  • Added tests in custom-scorer.test.ts and custom-scorer-array fixture verifying array return from custom scorers.

All tests are passing.

…cock#304)

Allows  (and  scorer) functions to return an array of scores . If an array is returned, it is flattened where scores are collected. Added tests to verify that both array return types and individual score returns are supported correctly.

Signed-off-by: Sigmabrogz <bnb1000bnb@gmail.com>
@changeset-bot
Copy link

changeset-bot bot commented Mar 12, 2026

🦋 Changeset detected

Latest commit: fa7fb3e

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented Mar 12, 2026

@Sigmabrogz is attempting to deploy a commit to the Skill Recordings Team on Vercel.

A member of the Team first needs to authorize it.

@Sigmabrogz
Copy link
Author

I've added the changeset as requested.

@Sigmabrogz
Copy link
Author

Hi @mattpocock, I've added the changeset as requested. The PR is ready for review. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant