Fix: coerce numeric arguments in ToolManager#277
Fix: coerce numeric arguments in ToolManager#277BhoomiAgrawal12 wants to merge 4 commits intomesa:mainfrom
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #277 +/- ##
==========================================
+ Coverage 91.20% 91.31% +0.10%
==========================================
Files 19 19
Lines 1592 1612 +20
==========================================
+ Hits 1452 1472 +20
Misses 140 140 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
d288bd3 to
da462f8
Compare
0f4616a to
0bb7e09
Compare
1048e10 to
d337a8a
Compare
for more information, see https://pre-commit.ci
Pre-PR Checklist
Summary
Fixes a bug where
ToolManagerpassed numeric arguments as strings, causing tools annotated withint/floatto fail. This impacted tool execution for LLMs that return numbers as JSON strings (e.g., Ollama).ToolManagerpromises automatic type coercion in its docstring, but_process_tool_call()only filtered args by name. When an LLM returned"35.0"(string) for afloatparameter, the tool received a string and raised an error. Expected behavior is to coerce to numeric types before invocation.Bug / Issue
Fixes #276
Implementation
_process_tool_call()forfloatandintparameters.tests/test_tools/test_tool_manager.py:"35.0"->35.0)"5"->5)Testing
pytest tests/test_tools/test_tool_manager.py -vAdditional Notes
intandfloatto avoid unintended conversions.