Fix manual tool calling regression in v0.1.14#266
Open
harijay wants to merge 1 commit intoandrewyng:mainfrom
Open
Fix manual tool calling regression in v0.1.14#266harijay wants to merge 1 commit intoandrewyng:mainfrom
harijay wants to merge 1 commit intoandrewyng:mainfrom
Conversation
When using manual tool calling (without max_turns parameter), tool schemas
were not being passed to the provider, causing LLMs to not see available tools.
## Problem
In v0.1.14, line 330 uses kwargs.pop("tools") which removes tools from kwargs.
When max_turns is None, execution reaches line 355 which calls the provider
without tools, breaking manual tool calling.
## Solution
- Changed line 330 from kwargs.pop() to kwargs.get() to preserve tools in kwargs
- Added explicit kwargs.pop("tools") at line 345 when using max_turns
- Added comprehensive tests to prevent future regressions
## Impact
- Manual tool calling now works correctly without max_turns
- Automatic tool execution with max_turns continues to work as expected
- No breaking changes to existing functionality
Fixes manual tool calling for users following the documented approach at:
https://github.com/andrewyng/aisuite#manual-tool-calling-no-max_turns
Co-Authored-By: Warp <[email protected]>
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.
Problem
Manual tool calling broke in v0.1.14. When passing tool schemas without
max_turns, the LLM doesn't see the available tools and responds normally instead of making tool calls.Root Cause
In
client.pyline 330, the code useskwargs.pop("tools")which removes tools from kwargs. Whenmax_turnsis None (manual tool calling mode), execution reaches line 355 which calls the provider without tools in kwargs, causing the LLM to not see the tool schemas.Reproduction
Solution
kwargs.pop("tools")tokwargs.get("tools")to preserve tools in kwargskwargs.pop("tools")when using max_turns, since_tool_runnerhandles them separatelyChanges
aisuite/client.py: 3 lines changedtests/client/test_manual_tool_calling.py: New test fileImpact
✅ Manual tool calling (no max_turns): Now works correctly
✅ Automatic tool execution (with max_turns): Continues to work as expected
✅ No breaking changes to existing functionality
Testing
Added unit tests that verify:
All tests pass:
Related
Co-Authored-By: Warp [email protected]