Repository navigation
fix(officeqa): keep the tool loop going on malformed tool arguments - #511
Open
Lanre Shittu (Shizoqua) wants to merge 1 commit into
Open
Lanre Shittu (Shizoqua) wants to merge 1 commit into
Lanre Shittu (Shizoqua) wants to merge 1 commit into
Conversation
process_one parsed each tool call's arguments with json.loads and had no local error handling. Malformed JSON raised JSONDecodeError. Valid JSON that is not an object reached run_tool, where .get raised AttributeError. Either exception left the loop and was recorded as the attempt's error, so the model's next reply, which could contain the right answer, was never read. Use an empty dict for unparsable arguments and for any parsed value that is not an object. Object arguments are passed to the tool unchanged.
This branch has not been deployed
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.
Summary
process_oneinskillopt/envs/officeqa/rollout.pyparsed each tool call's arguments withjson.loadsand had no local error handling. Two kinds of model output ended the attempt:null) reachedrun_tool, where.getraised AttributeError.In both cases the model's next reply was never read, so an attempt could score 0 even when that reply had the right answer.
This change uses an empty dict for unparsable arguments and for any parsed value that is not an object. Object arguments are passed to the tool unchanged. This matches
_react_loopinskillopt/envs/spreadsheetbench/react_agent.py.Changes
skillopt/envs/officeqa/rollout.py: the argument parse catches JSONDecodeError and checks for a dict. Object arguments are unchanged.tests/test_officeqa_tool_arguments.py: new tests (see below).CHANGELOG.md: entry under Fixed.Tests
{}, and the answer42is scored correct. Fails on upstream main.["*.txt"],"*.txt",null,42): each one fails on upstream main with AttributeError from the tool and passes with this change.ruff checkpasses onrollout.pyand on the new test file. The new test file passesruff format --check.Fixes #510