-
Notifications
You must be signed in to change notification settings - Fork 184
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
base: main
Are you sure you want to change the base?
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.14% 80.11% -0.03%
+ Complexity 10172 10165 -7
============================================
Files 854 854
Lines 44219 44219
Branches 5113 5113
============================================
- Hits 35440 35427 -13
- Misses 6630 6639 +9
- Partials 2149 2153 +4
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
Signed-off-by: Nathalie Jonathan <[email protected]>
f5bfd98
to
453fbab
Compare
Description
There's an issue when executing
ReadFromScratchPadTool
orWriteToScratchPadTool
with 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.