Fix unreachable response_format default in JudgeLM#1303
Open
oraziooztas wants to merge 1 commit into
Open
Conversation
The conditional tested the constant expression `not None` (always True), so DEFAULT_FORMAT was dead code and response_format=None was forwarded as-is to the backend request kwargs instead of the documented default. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0158ZooCCJEy6xtme9c8iksT
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.
What does this PR do?
Fixes a conditional in
JudgeLM.__init__that never applies the intended default:The condition evaluates the constant expression
not None(alwaysTrue), so:DEFAULT_FORMAT = {"type": "text"}(line 46) is unreachable dead code;response_formatis not provided,Noneis stored and forwarded as-is to the backend request kwargs (litellm kwargs and the OpenAI/TGIchat.completionscalls), instead of the documented text-format default.The fix tests the variable, as intended:
Tests
Added
tests/unit/metrics/test_llm_as_judge_response_format.py:test_response_format_defaults_when_not_provided— fails onmain(response_formatstaysNone), passes with this fix;test_explicit_response_format_is_preserved— guards against regressing the explicit-format path.No network, no external dependencies (pure
__init__behavior).ruff checkandruff format --checkpass on both changed files.🤖 Generated with Claude Code
https://claude.ai/code/session_0158ZooCCJEy6xtme9c8iksT