Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions switchyard/lib/processors/reasoning_hint.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,21 @@

from __future__ import annotations

# Anthropic-served (Claude) ids reject the vLLM ``chat_template_kwargs`` field;
# vLLM-served reasoning models that need the hint never carry these tokens.
_NO_REASONING_HINT_TAGS = ("anthropic", "bedrock", "claude")
# Anthropic-served (Claude) ids reject the vLLM ``chat_template_kwargs``
# field, and Fireworks AI's OpenAI-compatible API validates request bodies
# strictly and 400s on it as well ("Extra inputs are not permitted");
# Fireworks ids always carry the provider namespace
# (``accounts/fireworks/models/...``). vLLM-served reasoning models that
# need the hint never carry these tokens.
_NO_REASONING_HINT_TAGS = ("anthropic", "bedrock", "claude", "fireworks")


def model_accepts_reasoning_hint(model: str) -> bool:
"""Whether ``model`` tolerates the vLLM ``enable_thinking=False`` hint.

``False`` for Anthropic/Bedrock/Claude ids (they 400 on it), else ``True``
— usable directly as a classifier ``disable_reasoning`` default.
``False`` for Anthropic/Bedrock/Claude and Fireworks-served ids (they
400 on it), else ``True`` — usable directly as a classifier
``disable_reasoning`` default.
"""
lowered = model.lower()
return not any(tag in lowered for tag in _NO_REASONING_HINT_TAGS)
Expand Down
3 changes: 3 additions & 0 deletions tests/test_reasoning_hint.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
"azure/anthropic/claude-opus-4-6",
"anthropic/claude-3-5-sonnet",
"Bedrock-Claude-Whatever", # case-insensitive
"accounts/fireworks/models/deepseek-v4-flash",
"accounts/fireworks/models/deepseek-v4-pro",
"accounts/fireworks/models/glm-5p2",
],
)
def test_claude_family_rejects_hint(model: str) -> None:
Expand Down