[inkling] Let Anthropic thinking=disabled map to reasoning effort "none" (#33913)

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Eric Zhang
2026-08-08 21:59:32 +08:00
committed by GitHub
co-authored by Claude Opus 5
parent 548ff545c5
commit f3ed82b3a8
2 changed files with 26 additions and 0 deletions
@@ -2220,6 +2220,12 @@ class OpenAIServingChat(OpenAIServingBase):
request.reasoning_effort = "medium" if enabled else "no_think"
return
if self.reasoning_parser == "inkling":
# Effort-conditioned, not toggled: "none" (0.0) is the off switch.
if not enabled:
request.reasoning_effort = "none"
return
config = self.template_manager.reasoning_config
is_mistral = (config is not None and config.special_case == "mistral") or (
config is None and self._reasoning_default_mode() == "mistral"
@@ -3054,6 +3054,26 @@ class InklingReasoningEffortTest(unittest.TestCase):
finally:
env.clear()
def test_thinking_disabled_maps_to_no_thinking_effort(self):
"""Bug regression: Inkling is an always-on parser, so Anthropic
thinking={"type": "disabled"} was rejected outright even though effort
"none" (0.0) expresses exactly that."""
serving = object.__new__(OpenAIServingChat)
serving.reasoning_parser = "inkling"
serving.template_manager = Mock(reasoning_config=None)
serving._reasoning_detector = Mock(reasoning_default="always")
request = ChatCompletionRequest(
model="test-model", messages=[{"role": "user", "content": "hi"}]
)
serving.apply_reasoning_enabled(request, False)
self.assertEqual(request.reasoning_effort, "none")
# Enabling leaves an effort set via output_config.effort alone.
request.reasoning_effort = "low"
serving.apply_reasoning_enabled(request, True)
self.assertEqual(request.reasoning_effort, "low")
def test_serving_does_not_prefill_model_message(self):
from sglang.srt.parser.inkling_tokenizer import INKLING_SPECIAL_TOKEN_IDS