fix: normalize provider tool choice handling and harden tool call dec…#598
Merged
mikehostetler merged 1 commit intoagentjido:mainfrom Apr 12, 2026
Merged
Conversation
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.
This PR tightens ReqLLM's tool-calling contract handling across OpenAI-compatible providers and hardens response decoding for malformed tool arguments.
The main changes are:
tool_choicehandling for OpenAI-compatible providers so ReqLLM inputs like:auto,:none,:required, and%{type: "tool", name: ...}are encoded consistently for provider APIs.CerebrasGroqZenmuxGoogle Vertex OpenAI-compatibleAmazon Bedrock OpenAItool_choiceobjects for Cerebras instead of collapsing them back to"auto".parallel_tool_callsfor Cerebras.This came out of a broader provider-contract pass rather than only fixing the original crash case. In particular, the PR addresses:
tool_choicevalues flowing into OpenAI-compatible providersI also added regression coverage for these provider and decoding paths, including live manual verification against real Groq and Cerebras APIs in local IEx.
Type of Change
Breaking Changes
N/A.
Testing
mix test)mix quality)Additional validation performed:
groq:llama-3.1-8b-instantcerebras:gpt-oss-120bObserved live behavior:
tool_choice: :auto%{type: "tool", name: ...}tool_choice: :auto%{type: "function", function: %{name: ...}}finish_reason == :tool_callsChecklist
CHANGELOG.md(it is auto-generated by git_ops)Related Issues
Closes #597