Skip to content

fix(sglang,vllm): forward enable_thinking=false to chat templates - #1

Closed
gokay-ai wants to merge 1 commit into
masterfrom
cursor/enable-thinking-false-forward-3e42
Closed

fix(sglang,vllm): forward enable_thinking=false to chat templates#1
gokay-ai wants to merge 1 commit into
masterfrom
cursor/enable-thinking-false-forward-3e42

Conversation

@gokay-ai

Copy link
Copy Markdown
Owner

Description

Fixes finding 1 of mudler#11674: enable_thinking=false was dropped in the Python sglang and vllm backends.

Go (core/backend/options.go) already forwards both "true" and "false" in gRPC metadata. The Python backends only set template_kwargs["enable_thinking"] when the value was "true", so "false" took the same path as "key absent" and Qwen3-style templates kept thinking on.

Both backends now coerce "true"/"false" to a bool via a shared helper. Absent or unrecognized values still leave the template default alone.

Finding 2 (force_reasoning / empty reasoning_content) is intentionally untouched.

Notes for Reviewers

  • Shared helper: apply_enable_thinking in backend/python/common/python_utils.py
  • Unit tests mock request.Metadata and do not need a GPU
  • Run: make test-python-helpers (and the new _build_prompt cases in backend/python/sglang/test.py / backend/python/vllm/test.py)

Signed commits

  • Yes, I signed my commits.
  • Documentation updated (docs/content/) for user-facing changes, or not applicable
Open in Web Open in Cursor 

Go already emits both "true" and "false" in gRPC metadata, but the Python
sglang and vllm backends only set template_kwargs when the value is "true".
"false" then takes the same path as "key absent", so Qwen3-style templates
keep thinking on.

Coerce both directions to a bool so thinking-off reaches apply_chat_template.

Assisted-by: Cursor:Cursor Grok 4.6

Co-authored-by: GokayAI <gokay-ai@users.noreply.github.com>
@gokay-ai

Copy link
Copy Markdown
Owner Author

Upstream mudler#11715 landed first.

@gokay-ai gokay-ai closed this Aug 25, 2026
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.

2 participants