Add multi-format tool call parser (bracket, raw JSON)#15
Merged
waybarrios merged 4 commits intowaybarrios:mainfrom Jan 22, 2026
Merged
Add multi-format tool call parser (bracket, raw JSON)#15waybarrios merged 4 commits intowaybarrios:mainfrom
waybarrios merged 4 commits intowaybarrios:mainfrom
Conversation
Support for Qwen3's bracket format: [Calling tool: name({...})]
This format is used by Qwen3 models with Hermes-style tool prompting.
Added as highest priority parser before Nemotron/Qwen XML/Llama patterns.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Some models (like Qwen3 MLX) output tool calls as raw JSON objects without wrapper tags. This adds a fallback parser that handles single objects, multiple comma-separated objects, and JSON arrays. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Owner
|
Thanks for the contribution! Added a small fix for black formatting. |
waybarrios
pushed a commit
that referenced
this pull request
Jan 26, 2026
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
7 tasks
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.
Summary
Add support for multiple tool calling formats that models output:
[Calling tool: function_name({"arg": "value"})]{"name": "...", "arguments": {...}}- single or multipleChanges
_parse_raw_json_tool_calls()helper for raw JSON parsing (lowest priority fallback)Why Raw JSON Fallback?
Some models (including Qwen3) may output plain JSON tool calls without wrapper tags. The raw JSON parser activates only when no other format matches, preventing false positives.
Testing
Tested with Qwen3-30B-A3B-Instruct-2507-MLX-6bit model:
🤖 Generated with Claude Code