-
Notifications
You must be signed in to change notification settings - Fork 186
Fix unsupported operation exception in execute tool API #4325
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix unsupported operation exception in execute tool API #4325
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the fix makes sense, because scratch pad string is updated through multiple tool use in one agent execution, so it should be mutable parameters in toolExecution.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4325 +/- ##
============================================
- Coverage 80.09% 80.08% -0.01%
+ Complexity 10199 10198 -1
============================================
Files 855 855
Lines 44373 44374 +1
Branches 5135 5135
============================================
Hits 35539 35539
Misses 6670 6670
- Partials 2164 2165 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
00e8f44 to
f5bfd98
Compare
f5bfd98 to
453fbab
Compare
453fbab to
795c69d
Compare
795c69d to
58963f6
Compare
Signed-off-by: Nathalie Jonathan <nathhjo@amazon.com>
58963f6 to
d9f8644
Compare
Signed-off-by: Nathalie Jonathan <nathhjo@amazon.com> (cherry picked from commit 7b43d61)
Description
There's an issue when executing
ReadFromScratchPadToolorWriteToScratchPadToolwith empty parameters through the execute tool API. While these tools should support empty parameter execution, they currently throw an exception:The issue is due to the immutable map implementations being passed to these tools. These tools expect to modify the parameters map during execution (reference). When they attempt to call parameters.put() on an immutable map, an UnsupportedOperationException is thrown.
To fix this issue, we need to ensure these tools always receive a mutable map by creating a mutable copy of the parameters before passing them to the tools. This will allow the tools to modify the parameters as needed during execution, even when starting with empty parameters.
Test with current fix:
Related Issues
Resolves #[Issue number to be closed when this PR is merged]
Check List
--signoff.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.