Closed
Conversation
Co-authored-by: bchen <bchen@fireworks.ai>
|
Cursor Agent can help with this pull request. Just |
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.
name: Pull Request
about: Propose changes to the codebase
title: "Fix: Resolve Pyright type errors in reward modules"
labels: ''
assignees: ''
Description
This PR addresses a batch of Pyright type errors, primarily related to the
Message.contentfield, which can be either astror alistof content parts.A new utility module,
eval_protocol/rewards/_content_utils.py, has been introduced withto_textandto_text_anyhelpers. These functions normalizeMessage.contentinto a plain string, preventing type checker errors when string operations are performed.These helpers have been integrated across various reward modules, including
accuracy.py,apps_coding_reward.py,json_schema.py,language_consistency.py,length.py,list_comparison_math_reward.py,math.py,multiple_choice_math_reward.py,reasoning_steps.py, andtag_count.py.Additionally, specific type issues such as unbound variables in
apps_coding_reward.py, list type invariance inmath.py, and import/call signature issues injson_schema.pyhave been resolved.This change resolves approximately 30+ type errors, improving the codebase's type safety and maintainability.
Fixes # (issue)
Implements # (issue)
Type of change
How Has This Been Tested?
The changes were verified by running the
basedpyrighttype checker locally before and after the modifications.Spot checks confirmed zero errors in
accuracy.py,language_consistency.py,tag_count.py,reasoning_steps.py,multiple_choice_math_reward.py,apps_coding_reward.py,length.py, andmath.py.Test Configuration:
basedpyright(via pre-commit hook)Checklist:
black .,isort .,flake8 .)Screenshots (if applicable)
Additional context
This PR addresses the first batch of Pyright errors as requested. Remaining errors, largely related to missing optional dependencies and other modules, can be tackled in subsequent PRs.