fix: gate reasoning_effort by LiteLLM model registry (closes #517) (#523)

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Ahmed Allam
2026-06-07 12:24:48 -07:00
committed by GitHub
co-authored by Claude Opus 4.7
parent 1aad460f6e
commit 13046cc74a
3 changed files with 26 additions and 3 deletions
+14
View File
@@ -99,3 +99,17 @@ def uses_chat_completions_tool_schema(model_name: str, settings: Settings) -> bo
if model.startswith(("litellm/", "any-llm/")):
return True
return bool(settings.llm.api_base)
def model_supports_reasoning(model_name: str) -> bool:
import litellm
name = model_name.strip().lower()
for prefix in ("litellm/", "any-llm/"):
if name.startswith(prefix):
name = name[len(prefix) :]
break
entry = litellm.model_cost.get(name)
if entry is None and "/" in name:
entry = litellm.model_cost.get(name.rsplit("/", 1)[1])
return bool(entry and entry.get("supports_reasoning"))