fix(auto_routing): don't require tools capability when tool_choice is set without tools payload - #106
Open
rdrip wants to merge 1 commit into
Conversation
… set without tools payload required_capabilities adds "tools" to the needed set whenever tool_choice is a non-empty string (like "auto"), even when the request has no tools defined. Per the OpenAI spec, a string tool_choice without a tools payload is a no-op — the provider silently ignores it. This caused auto routing to filter out non-tool-capable models for any request carrying tool_choice="auto" (some SDKs send this on every request by default), unnecessarily narrowing the candidate set. Now string tool_choice only requires tools when a tools payload is actually present. Dict tool_choice (which names a specific function) still requires tools unconditionally.
There was a problem hiding this comment.
🐳 OrcaCode Review
✅ No findings — nothing to flag in this PR. Great work!
OrcaCode Review — Route Smarter. Ship Safer. Spend Less.
Engine-reported: 453 calls · 32.3M tokens · 99% cached
❤️ Share · Install OrcaCode Review
Free on GitHub — the review runs on your own OrcaRouter key. If it helped, a shout-out goes a long way.
Share: X · Reddit · LinkedIn
Follow: X · Discord · LinkedIn · OrcaRouter
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.
Orca-Code-Review — push 1
✅ no blocking findings
required_capabilities adds "tools" to the needed set whenever tool_choice is a non-empty string (like "auto"), even when the request has no tools defined. Per the OpenAI spec, a string tool_choice without a tools payload is a no-op.
This caused auto routing to filter out non-tool-capable models for any request carrying tool_choice="auto" (some SDKs send this on every request by default).
The fix: string tool_choice only requires tools when a tools payload is actually present. Dict tool_choice still requires tools unconditionally.
8 new tests cover the tool_choice x tools-payload interaction matrix. Existing 47 auto_routing tests still pass.