Forward choice: and calls: from Agent tools macro to with_tools#806
Open
juanmanuelramallo wants to merge 1 commit into
Open
Forward choice: and calls: from Agent tools macro to with_tools#806juanmanuelramallo wants to merge 1 commit into
juanmanuelramallo wants to merge 1 commit into
Conversation
The Agent tools class macro previously accepted only positional tools and ignored tool-call controls. Passing choice:/calls: either crashed (the hash was treated as a tool) or was silently dropped in the block form. Accept choice: and calls: on the macro, store them, and forward them in apply_tools so both the positional and block forms set tool preferences on the underlying chat, matching with_tools.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #806 +/- ##
==========================================
- Coverage 88.47% 82.85% -5.62%
==========================================
Files 122 122
Lines 5898 5903 +5
Branches 1405 1405
==========================================
- Hits 5218 4891 -327
+ Misses 680 679 -1
- Partials 0 333 +333 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
What this does
The
RubyLLM::Agenttoolsclass macro accepted only positional tools and ignored the tool-call controls (choice:,calls:) thatChat#with_toolshas supported since 1.13.0. The docs state "tools maps to with_tools", but passing the options either crashed or was silently dropped:This PR makes
toolsacceptchoice:andcalls:, store them, and forward them inapply_tools, so both the positional and block forms set the tool preferences on the underlying chat, equivalent towith_tools(*tools, choice:, calls:).toolswith no args/options still returns the configured tool list.inherited.**{}is safe sincewith_tools/update_tool_optionsalready skipniloptions.Type of change
Scope check
Required for new features
PRs for new features or enhancements without a prior approved issue will be closed.
Quality check
overcommit --installand all hooks passbundle exec rake vcr:record[provider_name]bundle exec rspecmodels.json,aliases.json)AI-generated code
API changes