fix(evals): infer task input types from eval data#281
Merged
Conversation
commit: |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
lukasmalkmus
approved these changes
Mar 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Eval()was letting scorer inference drive the eval input type, which meant a scorer that only usedoutputandexpectedcould collapsetaskinput tounknown.This change makes
Eval()deriveinputandexpectedfrom the evaldatasource instead, then validatestaskandscorersagainst those types. It also adds type-level regression tests that cover the scorer-without-input case, a structured data example, and negative cases for mismatched task/scorer input.We use the
NoInferutility type which was added in TS 5.4 (March 2024), so I've added TypeScript as a peer dep. I could also see not adding it and just assuming our users are not on 2 year old versions of TS.Example
Before this change, the scorer could influence
Eval()'s generic inference enough thattaskwould lose the dataset's input shape:Testing
pnpm -C packages/ai typecheckpnpm -C packages/ai exec vitest run test/evals/eval.types.test.tsNote
Medium Risk
Type-level changes to
Eval()’s public API and a newtypescript>=5.4peer dependency can affect downstream consumers’ compilation/inference, though runtime behavior is unchanged.Overview
Fixes
Eval()’s type inference soTInput/TExpectedare derived from the evaldatasource (usingNoInferonscorers) instead of being driven by scorer parameter types, preventingtaskinputs from collapsing tounknownwhen scorers omitinput.Adds compile-time regression tests covering scorer-without-input cases, structured inputs, and negative cases for mismatched
task/scorer input types, and updates the eval builder to callEval()without explicit generics. Declarestypescript>=5.4as an (optional) peer dependency to supportNoInfer.Written by Cursor Bugbot for commit ee92aa6. This will update automatically on new commits. Configure here.