From 8b66b50c31809eae4f5efe80d3dddaab94951841 Mon Sep 17 00:00:00 2001 From: Tim Elfrink Date: Tue, 19 Aug 2025 08:15:50 +0200 Subject: [PATCH] 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. --- litellm/llms/github_copilot/chat/transformation.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/litellm/llms/github_copilot/chat/transformation.py b/litellm/llms/github_copilot/chat/transformation.py index e71e9b610b..2aab0207ca 100644 --- a/litellm/llms/github_copilot/chat/transformation.py +++ b/litellm/llms/github_copilot/chat/transformation.py @@ -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