Repository navigation
api: Qwen3.6 tool calling (#1723 on current dev, keeps #1767) - #1794
Merged
Merged
Conversation
Implements the checkpoint's native tool declaration/call/response protocol and translates it to OpenAI tool_calls. Rebased onto dev after #1767 and #1777: render_chat_qwen keeps the template's preserve_thinking, its last_query_index rule and its reading of a past turn (reasoning_content, or the raw reply split at </think>), so KV prefix reuse still engages on follow-up turns; the tool-call parser dispatch goes through chat_flavor(), so a qwen36 engine running a Qwen3.8 template keeps the qwen38 renderer. Native tool calling replaces the COLI_TOOL_FALLBACK path for qwen36 (OLMoE keeps it). The conformance test renders every case with and without tools and preserve_thinking against chat_template.jinja (sha256 e84f32a2).
This was referenced Oct 13, 2026
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.
Qwen3.6 tool calling, the work of @GenericRikka in #1723, carried onto the current dev. The commit keeps its author.
#1723 started from a base older than #1767 and replaced the whole of
render_chat_qwen. Taking its side of the conflict would have removedpreserve_thinking, thelast_queryrule and the reading of past turns that #1767 added, and every qwen36 chat request would then fail with aTypeError(7 positional arguments passed, 6 accepted). This branch keeps them.What changed in the rebase
render_chat_qwenis kept (the qwen36: render the template's preserve_thinking so standard clients get KV prefix reuse #1767 logic and the continuation branch). The PR's tool block, system folding, grouped<tool_response>turns and<tool_call>rendering are added on top.chat_flavor() in ("qwen36", "qwen38"), so the CHAT_FLAVOR of qwen36: run dense checkpoints of the family (Qwen3.8-27B) #1777 still holds: qwen36 renders with the qwen36 template, qwen36 with the qwen38 flavor and qwen38 render with the qwen38 one, and all three parse<tool_call>.reasoning_content: nullcounts as absent; a non-string is a 400 (the PR's own test).preserve_thinkingand thinking on/off. It adds an agent loop (parallel calls, non-string arguments, two tool results, a new query) and an empty system turn, which the template emits and the PR head dropped._parse_arch_tool_callsreturns the two span maps as None for qwen. That is safe with api: logprobs, top_logprobs and echo on the OpenAI endpoints, aligned by raw-stream span #1353: the numeric logprobs channel is glm only, so no qwen reply ever has spans to align.Checked
test_openai_server,test_openai_tools_fallback_e2e, both chat template tests,test_anthropic_messages,test_qwen_image_gateway,test_family_registry: 519 passed.chat_template.jinjaof Qwen3.6 (40 cases plus continuation) and of Qwen3.8: byte-identical.finish_reason: tool_calls;tool_callsdeltas;/v1/messagesanswers with twotool_useblocks;tool_choice: nonerenders no tool block;On the #1723 head, turn 3 after a tool loop matched neither the template nor the prefix.
Behaviour to know
requiredtool_choiceis accepted but not enforced, the same as qwen38.COLI_TOOL_FALLBACKno longer applies to qwen36, which now has native tool calls.Supersedes #1723.