Use ModelCapabilities for Grok thinking mode support check

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
This commit is contained in:
Raymond Lucke
2025-07-10 18:21:44 -07:00
committed by GitHub
parent 39e2bc61b6
commit 346410e34e

View File

@@ -148,6 +148,10 @@ class XAIModelProvider(OpenAICompatibleProvider):
def supports_thinking_mode(self, model_name: str) -> bool:
"""Check if the model supports extended thinking mode."""
# Grok-4 supports extended thinking/reasoning mode
resolved_name = self._resolve_model_name(model_name)
return resolved_name == "grok-4-0709"
# Check capabilities to determine thinking mode support
try:
capabilities = self.get_capabilities(model_name)
return capabilities.supports_extended_thinking
except ValueError:
# If the model is not supported, it doesn't support thinking mode.
return False