fix: restrict thinking/reasoning_effort parameters to models with extended thinking support

Only models in the 4 family and 3-7 family support extended thinking features.
Previously all models would incorrectly receive these parameters.

Now uses supports_reasoning() to check model registry for actual capability.
This commit is contained in:
Tim Elfrink 2025-08-19 08:15:50 +02:00
parent 0febdf8c1c
commit 8b66b50c31

View File

@ -81,14 +81,19 @@ class GithubCopilotConfig(OpenAIConfig):
"""
Get supported OpenAI parameters for GitHub Copilot.
For Anthropic models (like claude-sonnet-4), includes thinking and reasoning parameters.
For Claude models that support extended thinking (Claude 4 family and Claude 3-7), includes thinking and reasoning_effort parameters.
For other models, returns standard OpenAI parameters (which may include reasoning_effort for o-series models).
"""
from litellm.utils import supports_reasoning
# Get base OpenAI parameters
base_params = super().get_supported_openai_params(model)
# Add Claude-specific parameters for Anthropic models
if "claude" in model.lower():
# Add Claude-specific parameters for models that support extended thinking
if "claude" in model.lower() and supports_reasoning(
model=model,
custom_llm_provider="github_copilot",
):
if "thinking" not in base_params:
base_params.append("thinking")
# reasoning_effort is not included by parent for Claude models, so add it