You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
exact-match always collapses internal whitespace, and trim: false does not turn it off #9
The trim option only controls the leading and trailing trim. The final replace(/\s+/g, " ") always runs, so every run of whitespace, including newlines and tabs, becomes a single space no matter what the caller passes.
exactMatchScorer in src/scorers/exact-match.ts documents itself as:
Passes when the output equals the expected value. Supports case-insensitive and whitespace-normalized comparison via options.
trim: default true
That reads as if whitespace normalization is opt-out, and caseSensitive: true, trim: false looks like the way to get a byte-exact comparison. It is not. A scorer checking that a model emitted a specific multi-line block, indented code, or a two-space separator will pass on output whose formatting is completely different. For a scorer literally named exact-match, that is a surprising silent pass, and silent passes are the failure mode an eval gate exists to prevent.
The same applies to contains and not-contains in src/scorers/contains.ts, which normalize both haystack and needles, so a banned-phrase check cannot be written against exact spacing.
Steps
Add a collapseWhitespace option to normalize() (default true, preserving today's behaviour) and apply the replace only when it is set.
Thread it through exactMatchScorer from spec.collapseWhitespace, so { caseSensitive: true, trim: false, collapseWhitespace: false } is a true byte comparison.
Update the doc comments on normalize and exactMatchScorer, and the scorer table in README.md, to say plainly that whitespace is collapsed by default.
Add tests in tests/scorers.test.ts for output differing from expected only in internal whitespace, once with the option on and once off.
Claiming this
Comment below to claim it. A reply usually comes within a day.
Activity
github-actions commentedon Sep 5, 2026
The linked pull request #25 was closed without being merged, so this issue is open again.
The work is still needed. Anyone is welcome to pick it up, just comment here and it's yours.
github-actions commentedon Sep 5, 2026
The linked pull request #25 was closed without being merged, so this issue is open again.
The work is still needed. Anyone is welcome to pick it up, just comment here and it's yours.
github-actions commentedon Sep 5, 2026
The linked pull request #25 was closed without being merged, so this issue is open again.
The work is still needed. Anyone is welcome to pick it up, just comment here and it's yours.
github-actions commentedon Sep 5, 2026
The linked pull request #25 was closed without being merged, so this issue is open again.
The work is still needed. Anyone is welcome to pick it up, just comment here and it's yours.
fix: Honor trim:false in exact-match normalize (#25)