Skip to content

Add Qwen tool calling support#2

Draft
andreaborio wants to merge 2 commits into
mainfrom
codex/qwen-tool-dialect
Draft

Add Qwen tool calling support#2
andreaborio wants to merge 2 commits into
mainfrom
codex/qwen-tool-dialect

Conversation

@andreaborio

Copy link
Copy Markdown
Owner

What changed

  • accepts OpenAI Chat Completions tools, tool_choice=auto|none, assistant tool_calls, and role: tool history for Qwen3.6
  • renders the native Qwen tool dialect and normalizes generated calls back to OpenAI tool_calls
  • validates tool names, parameters, JSON Schema types, nullable values, duplicate fields, multiple calls, and call IDs
  • streams normal Qwen reasoning/text live while keeping native tool markup hidden until authoritative parsing at EOS
  • fails closed on malformed Qwen tool output without regressing the existing DeepSeek DSML path

Why

DSBox needs one canonical agent loop for Qwen3.6 35B-A3B and DeepSeek V4 Flash. DS4 previously advertised the Qwen chat path but did not accept or parse tool-bearing turns.

Impact

Qwen can now participate in multi-step OpenAI-style tool loops. DeepSeek behavior remains on its existing DSML implementation. Qwen Responses and Anthropic tool protocols remain out of scope for this tranche.

Root cause

The Qwen renderer and server parser were tool-free at the API boundary even though the model has a native <tool_call> dialect. Streaming also needed dialect-aware suppression so raw protocol markup could not leak or become an empty successful response.

Validation

  • make model-free-test
  • ASan + UBSan ds4_test --server
  • real Qwen3.6 35B-A3B tool call, tool-result continuation, normal text streaming, and structured tool streaming
  • real DeepSeek V4 Flash tool call and continuation regression smoke

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant