feat: Add comprehensive GPT-5 series model support
- Add GPT-5, GPT-5-mini, and GPT-5-nano models to unified configuration - Implement proper thinking mode support via dynamic capability checking - Add OpenAI provider model enumeration methods for registry integration - Update tests to cover all GPT-5 models and their aliases - Fix critical bug where thinking mode was hardcoded instead of using model capabilities Breaking Changes: - None (backward compatible) New Models Available: - gpt-5 (400K context, 128K output, reasoning support) - gpt-5-mini (400K context, 128K output, efficient variant) - gpt-5-nano (400K context, fastest/cheapest variant) Aliases: - gpt5, gpt5-mini, gpt5mini, gpt5-nano, gpt5nano, nano All models support: - Extended thinking mode (reasoning tokens) - Vision capabilities - JSON mode - Function calling 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -259,12 +259,10 @@ class OpenAIModelProvider(OpenAICompatibleProvider):
|
||||
|
||||
def supports_thinking_mode(self, model_name: str) -> bool:
|
||||
"""Check if the model supports extended thinking mode."""
|
||||
# GPT-5 models support reasoning tokens (extended thinking)
|
||||
resolved_name = self._resolve_model_name(model_name)
|
||||
if resolved_name in ["gpt-5", "gpt-5-mini"]:
|
||||
return True
|
||||
# O3 models don't support extended thinking yet
|
||||
return False
|
||||
try:
|
||||
return self.get_capabilities(model_name).supports_extended_thinking
|
||||
except ValueError:
|
||||
return False
|
||||
|
||||
def get_preferred_model(self, category: "ToolModelCategory", allowed_models: list[str]) -> Optional[str]:
|
||||
"""Get OpenAI's preferred model for a given category from allowed models.
|
||||
@@ -303,3 +301,19 @@ class OpenAIModelProvider(OpenAICompatibleProvider):
|
||||
# Prefer balanced performance/cost models
|
||||
preferred = find_first(["gpt-5", "gpt-5-mini", "o4-mini", "o3-mini"])
|
||||
return preferred if preferred else allowed_models[0]
|
||||
|
||||
def get_model_configurations(self) -> dict[str, ModelCapabilities]:
|
||||
"""Get model configurations supported by this provider.
|
||||
|
||||
Returns:
|
||||
Dict mapping model names to their ModelCapabilities
|
||||
"""
|
||||
return self.SUPPORTED_MODELS.copy()
|
||||
|
||||
def get_all_model_aliases(self) -> dict[str, list[str]]:
|
||||
"""Get all model aliases supported by this provider.
|
||||
|
||||
Returns:
|
||||
Dict mapping model names to their alias lists
|
||||
"""
|
||||
return {model_name: caps.aliases for model_name, caps in self.SUPPORTED_MODELS.items()}
|
||||
|
||||
Reference in New Issue
Block a user