Repository navigation
fix(assistantbench): disambiguate thousands-separator commas from decimal commas in fix_number - #414
Conversation
|
Hi @Surya-5555, I've raised this PR to fix #404: AssistantBench's Could you please review it and approve the pending workflow run? Thank you, and have a great day! |
|
Hi @Vijaysrimari, thanks for the PR and for the clear description! The You can run the repo's formatter (see the code-format job / Once that's green, I'll review it. Thanks! |
afae07b to
ccd59ee
Compare
|
Hi @Vijaysrimari, thanks for the clean PR and great tests! One edge case remains before merging: Approach to fix: Once that's added, happy to merge! |
|
Hi @Vijaysrimari, thank you for working on this! The PR cleanly resolves #404 across both the scalar and dictionary evaluation paths, and the test suite additions are very thorough. Before merging, there are a few minor improvements to address:
Thanks again for the great contribution! |
Validate grouped comma formats, preserve malformed values, and treat zero-leading comma values as decimals. Narrow numeric conversion handling and keep evaluation tests generic. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
4d0e580 to
20fb74c
Compare
Surya-5555
left a comment
There was a problem hiding this comment.
Hi @Vijaysrimari, thanks for addressing all the feedback so quickly and thoroughly
The regex validation for grouped commas, leading-zero decimal comma handling, exception narrowing in evaluate_dicts.py, and the clean single squashed commit look great. All test additions pass cleanly
LGTM! Approving for merge
PR Description
Closes #404
What changed and why
fix_number()in bothevaluator.pyandevaluate_dicts.pypreviously called.replace(",", ".")unconditionally, which silently corrupted scores in two directions:"3,080,000"→"3.080.000"→float()raises → correct answer scores 0.0"1,000"→"1.000"=1.0→ matched gold1→ wrong answer scores 1.0The fix extracts the disambiguation logic into a single helper
_fix_comma(number: str) -> strin the sharedevaluate_utils/utils.py, then calls it from bothfix_number()implementations.Disambiguation rules (in priority order):
"3,080,000""3080000""1,000""1000""14,2""14.2""1,0000""1,0000""hello""hello"Files changed
evaluate_utils/utils.py_fix_comma()with full docstring — single source of truthevaluator.py.replace(",","."), imported and called_fix_comma; also narrowed bareexcept:toexcept (ValueError, TypeError)evaluate_utils/evaluate_dicts.pyfix_number()tests/assistantbench/test_evaluation.pyProof of work