-
Notifications
You must be signed in to change notification settings - Fork 13.4k
qwen3-coder tool call parser #16755
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
qwen3-coder tool call parser #16755
Conversation
…r_edit Fix grammar, hide tool_call from output
Add missing closing brace to terminate test_template_output_parsers() function. This resolves compilation errors that prevented successful build of the test-chat target.
Co-authored-by: Kashyap Jois <[email protected]>
Co-authored-by: Kashyap Jois <[email protected]>
Co-authored-by: Marcel de Vries <[email protected]>
Co-authored-by: Marcel de Vries <[email protected]>
…d84/llama.cpp into qwen3-coder_tool_call_parser
…ranches; add tests
- chat-parser: support schema.type as array (e.g. ["number","null"]) in convert_qwen3_param_value()
- chat: resolve $refs; allow unions including "string" as freeform; sanitize empty {"not":{}} in anyOf/oneOf before add_schema
- tests: add Qwen3-Coder regression ensuring grammar builds with unions and ignores {"not":{}}
|
Anecdotally, I observed that the previous PR (and presumably this PR too) essentially fixed tool calling for qwen3-coder. Although when trying to use it with It would be nice to get this PR merged in. |
I guess you could test it through openrouter or something and check if you see the same behavior there as well. My guess would be that it's a model thing and not so much this PR. Or maybe even a codex thing since it's probably heavily optimized for GPT models in terms of system prompt and tool descriptions. |
|
Hey, just to confirm that running this branch fixes the integration with Qwen3-Coder-30B-A3B. Reproduction steps: PS: I opened too many tabs to figure it out, and I can’t find the sources any more to properly source them. I invented nothing here, credits goes to whoever wrote the pieces first. |
Note
Original work and PR by bold84 @ #15019
This pull request resolves #15012 and introduces comprehensive support for the Qwen3-Coder model family's XML-based tool-calling format. It includes a new, robust XML parser and updated chat template detection logic to ensure reliable function calling.
Key Changes:
New XML Parser (
common/chat-parser.cpp):Chat Template Detection (
common/chat.h,common/chat.cpp):QWEN3_CODER_XMLformat is applied consistently, even when no tools are explicitly provided in the request.Comprehensive tests (
tests/test-chat.cpp):Known issues:
<tool_call>. This seems to be an issue with the model itself(?).