refactor: removed method from provider, should use model capabilities instead
refactor: cleanup temperature factory method
This commit is contained in:
@@ -109,11 +109,6 @@ class ModelProvider(ABC):
|
||||
constraint_desc = capabilities.temperature_constraint.get_description()
|
||||
raise ValueError(f"Temperature {temperature} is invalid for model {model_name}. {constraint_desc}")
|
||||
|
||||
@abstractmethod
|
||||
def supports_thinking_mode(self, model_name: str) -> bool:
|
||||
"""Check if the model supports extended thinking mode."""
|
||||
pass
|
||||
|
||||
def get_model_configurations(self) -> dict[str, ModelCapabilities]:
|
||||
"""Get model configurations for this provider.
|
||||
|
||||
|
||||
@@ -284,24 +284,6 @@ class CustomProvider(OpenAICompatibleProvider):
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
def supports_thinking_mode(self, model_name: str) -> bool:
|
||||
"""Check if the model supports extended thinking mode.
|
||||
|
||||
Args:
|
||||
model_name: Model to check
|
||||
|
||||
Returns:
|
||||
True if model supports thinking mode, False otherwise
|
||||
"""
|
||||
# Check if model is in registry
|
||||
config = self._registry.resolve(model_name) if self._registry else None
|
||||
if config and config.is_custom:
|
||||
# Trust the config from custom_models.json
|
||||
return config.supports_extended_thinking
|
||||
|
||||
# Default to False for unknown models
|
||||
return False
|
||||
|
||||
def get_model_configurations(self) -> dict[str, ModelCapabilities]:
|
||||
"""Get model configurations from the registry.
|
||||
|
||||
|
||||
@@ -7,12 +7,7 @@ import time
|
||||
from typing import Optional
|
||||
|
||||
from .openai_compatible import OpenAICompatibleProvider
|
||||
from .shared import (
|
||||
ModelCapabilities,
|
||||
ModelResponse,
|
||||
ProviderType,
|
||||
create_temperature_constraint,
|
||||
)
|
||||
from .shared import ModelCapabilities, ModelResponse, ProviderType, TemperatureConstraint
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -48,7 +43,7 @@ class DIALModelProvider(OpenAICompatibleProvider):
|
||||
supports_images=True,
|
||||
max_image_size_mb=20.0,
|
||||
supports_temperature=False, # O3 models don't accept temperature
|
||||
temperature_constraint=create_temperature_constraint("fixed"),
|
||||
temperature_constraint=TemperatureConstraint.create("fixed"),
|
||||
description="OpenAI O3 via DIAL - Strong reasoning model",
|
||||
aliases=["o3"],
|
||||
),
|
||||
@@ -66,7 +61,7 @@ class DIALModelProvider(OpenAICompatibleProvider):
|
||||
supports_images=True,
|
||||
max_image_size_mb=20.0,
|
||||
supports_temperature=False, # O4 models don't accept temperature
|
||||
temperature_constraint=create_temperature_constraint("fixed"),
|
||||
temperature_constraint=TemperatureConstraint.create("fixed"),
|
||||
description="OpenAI O4-mini via DIAL - Fast reasoning model",
|
||||
aliases=["o4-mini"],
|
||||
),
|
||||
@@ -84,7 +79,7 @@ class DIALModelProvider(OpenAICompatibleProvider):
|
||||
supports_images=True,
|
||||
max_image_size_mb=5.0,
|
||||
supports_temperature=True,
|
||||
temperature_constraint=create_temperature_constraint("range"),
|
||||
temperature_constraint=TemperatureConstraint.create("range"),
|
||||
description="Claude Sonnet 4.1 via DIAL - Balanced performance",
|
||||
aliases=["sonnet-4.1", "sonnet-4"],
|
||||
),
|
||||
@@ -102,7 +97,7 @@ class DIALModelProvider(OpenAICompatibleProvider):
|
||||
supports_images=True,
|
||||
max_image_size_mb=5.0,
|
||||
supports_temperature=True,
|
||||
temperature_constraint=create_temperature_constraint("range"),
|
||||
temperature_constraint=TemperatureConstraint.create("range"),
|
||||
description="Claude Sonnet 4.1 with thinking mode via DIAL",
|
||||
aliases=["sonnet-4.1-thinking", "sonnet-4-thinking"],
|
||||
),
|
||||
@@ -120,7 +115,7 @@ class DIALModelProvider(OpenAICompatibleProvider):
|
||||
supports_images=True,
|
||||
max_image_size_mb=5.0,
|
||||
supports_temperature=True,
|
||||
temperature_constraint=create_temperature_constraint("range"),
|
||||
temperature_constraint=TemperatureConstraint.create("range"),
|
||||
description="Claude Opus 4.1 via DIAL - Most capable Claude model",
|
||||
aliases=["opus-4.1", "opus-4"],
|
||||
),
|
||||
@@ -138,7 +133,7 @@ class DIALModelProvider(OpenAICompatibleProvider):
|
||||
supports_images=True,
|
||||
max_image_size_mb=5.0,
|
||||
supports_temperature=True,
|
||||
temperature_constraint=create_temperature_constraint("range"),
|
||||
temperature_constraint=TemperatureConstraint.create("range"),
|
||||
description="Claude Opus 4.1 with thinking mode via DIAL",
|
||||
aliases=["opus-4.1-thinking", "opus-4-thinking"],
|
||||
),
|
||||
@@ -156,7 +151,7 @@ class DIALModelProvider(OpenAICompatibleProvider):
|
||||
supports_images=True,
|
||||
max_image_size_mb=20.0,
|
||||
supports_temperature=True,
|
||||
temperature_constraint=create_temperature_constraint("range"),
|
||||
temperature_constraint=TemperatureConstraint.create("range"),
|
||||
description="Gemini 2.5 Pro with Google Search via DIAL",
|
||||
aliases=["gemini-2.5-pro-search"],
|
||||
),
|
||||
@@ -174,7 +169,7 @@ class DIALModelProvider(OpenAICompatibleProvider):
|
||||
supports_images=True,
|
||||
max_image_size_mb=20.0,
|
||||
supports_temperature=True,
|
||||
temperature_constraint=create_temperature_constraint("range"),
|
||||
temperature_constraint=TemperatureConstraint.create("range"),
|
||||
description="Gemini 2.5 Pro via DIAL - Deep reasoning",
|
||||
aliases=["gemini-2.5-pro"],
|
||||
),
|
||||
@@ -192,7 +187,7 @@ class DIALModelProvider(OpenAICompatibleProvider):
|
||||
supports_images=True,
|
||||
max_image_size_mb=20.0,
|
||||
supports_temperature=True,
|
||||
temperature_constraint=create_temperature_constraint("range"),
|
||||
temperature_constraint=TemperatureConstraint.create("range"),
|
||||
description="Gemini 2.5 Flash via DIAL - Ultra-fast",
|
||||
aliases=["gemini-2.5-flash"],
|
||||
),
|
||||
|
||||
@@ -12,12 +12,7 @@ from google import genai
|
||||
from google.genai import types
|
||||
|
||||
from .base import ModelProvider
|
||||
from .shared import (
|
||||
ModelCapabilities,
|
||||
ModelResponse,
|
||||
ProviderType,
|
||||
create_temperature_constraint,
|
||||
)
|
||||
from .shared import ModelCapabilities, ModelResponse, ProviderType, TemperatureConstraint
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -46,7 +41,7 @@ class GeminiModelProvider(ModelProvider):
|
||||
supports_images=True, # Vision capability
|
||||
max_image_size_mb=32.0, # Higher limit for Pro model
|
||||
supports_temperature=True,
|
||||
temperature_constraint=create_temperature_constraint("range"),
|
||||
temperature_constraint=TemperatureConstraint.create("range"),
|
||||
max_thinking_tokens=32768, # Max thinking tokens for Pro model
|
||||
description="Deep reasoning + thinking mode (1M context) - Complex problems, architecture, deep analysis",
|
||||
aliases=["pro", "gemini pro", "gemini-pro"],
|
||||
@@ -65,7 +60,7 @@ class GeminiModelProvider(ModelProvider):
|
||||
supports_images=True, # Vision capability
|
||||
max_image_size_mb=20.0, # Conservative 20MB limit for reliability
|
||||
supports_temperature=True,
|
||||
temperature_constraint=create_temperature_constraint("range"),
|
||||
temperature_constraint=TemperatureConstraint.create("range"),
|
||||
max_thinking_tokens=24576, # Same as 2.5 flash for consistency
|
||||
description="Gemini 2.0 Flash (1M context) - Latest fast model with experimental thinking, supports audio/video input",
|
||||
aliases=["flash-2.0", "flash2"],
|
||||
@@ -84,7 +79,7 @@ class GeminiModelProvider(ModelProvider):
|
||||
supports_images=False, # Does not support images
|
||||
max_image_size_mb=0.0, # No image support
|
||||
supports_temperature=True,
|
||||
temperature_constraint=create_temperature_constraint("range"),
|
||||
temperature_constraint=TemperatureConstraint.create("range"),
|
||||
description="Gemini 2.0 Flash Lite (1M context) - Lightweight fast model, text-only",
|
||||
aliases=["flashlite", "flash-lite"],
|
||||
),
|
||||
@@ -102,7 +97,7 @@ class GeminiModelProvider(ModelProvider):
|
||||
supports_images=True, # Vision capability
|
||||
max_image_size_mb=20.0, # Conservative 20MB limit for reliability
|
||||
supports_temperature=True,
|
||||
temperature_constraint=create_temperature_constraint("range"),
|
||||
temperature_constraint=TemperatureConstraint.create("range"),
|
||||
max_thinking_tokens=24576, # Flash 2.5 thinking budget limit
|
||||
description="Ultra-fast (1M context) - Quick analysis, simple queries, rapid iterations",
|
||||
aliases=["flash", "flash2.5"],
|
||||
@@ -397,11 +392,6 @@ class GeminiModelProvider(ModelProvider):
|
||||
|
||||
return True
|
||||
|
||||
def supports_thinking_mode(self, model_name: str) -> bool:
|
||||
"""Check if the model supports extended thinking mode."""
|
||||
capabilities = self.get_capabilities(model_name)
|
||||
return capabilities.supports_extended_thinking
|
||||
|
||||
def get_thinking_budget(self, model_name: str, thinking_mode: str) -> int:
|
||||
"""Get actual thinking token budget for a model and thinking mode."""
|
||||
resolved_name = self._resolve_model_name(model_name)
|
||||
|
||||
@@ -734,13 +734,6 @@ class OpenAICompatibleProvider(ModelProvider):
|
||||
"""
|
||||
pass
|
||||
|
||||
def supports_thinking_mode(self, model_name: str) -> bool:
|
||||
"""Check if the model supports extended thinking mode.
|
||||
|
||||
Default is False for OpenAI-compatible providers.
|
||||
"""
|
||||
return False
|
||||
|
||||
def _is_error_retryable(self, error: Exception) -> bool:
|
||||
"""Determine if an error should be retried based on structured error codes.
|
||||
|
||||
|
||||
@@ -7,12 +7,7 @@ if TYPE_CHECKING:
|
||||
from tools.models import ToolModelCategory
|
||||
|
||||
from .openai_compatible import OpenAICompatibleProvider
|
||||
from .shared import (
|
||||
ModelCapabilities,
|
||||
ModelResponse,
|
||||
ProviderType,
|
||||
create_temperature_constraint,
|
||||
)
|
||||
from .shared import ModelCapabilities, ModelResponse, ProviderType, TemperatureConstraint
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -41,7 +36,7 @@ class OpenAIModelProvider(OpenAICompatibleProvider):
|
||||
supports_images=True, # GPT-5 supports vision
|
||||
max_image_size_mb=20.0, # 20MB per OpenAI docs
|
||||
supports_temperature=True, # Regular models accept temperature parameter
|
||||
temperature_constraint=create_temperature_constraint("fixed"),
|
||||
temperature_constraint=TemperatureConstraint.create("fixed"),
|
||||
description="GPT-5 (400K context, 128K output) - Advanced model with reasoning support",
|
||||
aliases=["gpt5"],
|
||||
),
|
||||
@@ -59,7 +54,7 @@ class OpenAIModelProvider(OpenAICompatibleProvider):
|
||||
supports_images=True, # GPT-5-mini supports vision
|
||||
max_image_size_mb=20.0, # 20MB per OpenAI docs
|
||||
supports_temperature=True,
|
||||
temperature_constraint=create_temperature_constraint("fixed"),
|
||||
temperature_constraint=TemperatureConstraint.create("fixed"),
|
||||
description="GPT-5-mini (400K context, 128K output) - Efficient variant with reasoning support",
|
||||
aliases=["gpt5-mini", "gpt5mini", "mini"],
|
||||
),
|
||||
@@ -77,7 +72,7 @@ class OpenAIModelProvider(OpenAICompatibleProvider):
|
||||
supports_images=True,
|
||||
max_image_size_mb=20.0,
|
||||
supports_temperature=True,
|
||||
temperature_constraint=create_temperature_constraint("fixed"),
|
||||
temperature_constraint=TemperatureConstraint.create("fixed"),
|
||||
description="GPT-5 nano (400K context) - Fastest, cheapest version of GPT-5 for summarization and classification tasks",
|
||||
aliases=["gpt5nano", "gpt5-nano", "nano"],
|
||||
),
|
||||
@@ -95,7 +90,7 @@ class OpenAIModelProvider(OpenAICompatibleProvider):
|
||||
supports_images=True, # O3 models support vision
|
||||
max_image_size_mb=20.0, # 20MB per OpenAI docs
|
||||
supports_temperature=False, # O3 models don't accept temperature parameter
|
||||
temperature_constraint=create_temperature_constraint("fixed"),
|
||||
temperature_constraint=TemperatureConstraint.create("fixed"),
|
||||
description="Strong reasoning (200K context) - Logical problems, code generation, systematic analysis",
|
||||
aliases=[],
|
||||
),
|
||||
@@ -113,7 +108,7 @@ class OpenAIModelProvider(OpenAICompatibleProvider):
|
||||
supports_images=True, # O3 models support vision
|
||||
max_image_size_mb=20.0, # 20MB per OpenAI docs
|
||||
supports_temperature=False, # O3 models don't accept temperature parameter
|
||||
temperature_constraint=create_temperature_constraint("fixed"),
|
||||
temperature_constraint=TemperatureConstraint.create("fixed"),
|
||||
description="Fast O3 variant (200K context) - Balanced performance/speed, moderate complexity",
|
||||
aliases=["o3mini"],
|
||||
),
|
||||
@@ -131,7 +126,7 @@ class OpenAIModelProvider(OpenAICompatibleProvider):
|
||||
supports_images=True, # O3 models support vision
|
||||
max_image_size_mb=20.0, # 20MB per OpenAI docs
|
||||
supports_temperature=False, # O3 models don't accept temperature parameter
|
||||
temperature_constraint=create_temperature_constraint("fixed"),
|
||||
temperature_constraint=TemperatureConstraint.create("fixed"),
|
||||
description="Professional-grade reasoning (200K context) - EXTREMELY EXPENSIVE: Only for the most complex problems requiring universe-scale complexity analysis OR when the user explicitly asks for this model. Use sparingly for critical architectural decisions or exceptionally complex debugging that other models cannot handle.",
|
||||
aliases=["o3pro"],
|
||||
),
|
||||
@@ -149,7 +144,7 @@ class OpenAIModelProvider(OpenAICompatibleProvider):
|
||||
supports_images=True, # O4 models support vision
|
||||
max_image_size_mb=20.0, # 20MB per OpenAI docs
|
||||
supports_temperature=False, # O4 models don't accept temperature parameter
|
||||
temperature_constraint=create_temperature_constraint("fixed"),
|
||||
temperature_constraint=TemperatureConstraint.create("fixed"),
|
||||
description="Latest reasoning model (200K context) - Optimized for shorter contexts, rapid reasoning",
|
||||
aliases=["o4mini"],
|
||||
),
|
||||
@@ -167,7 +162,7 @@ class OpenAIModelProvider(OpenAICompatibleProvider):
|
||||
supports_images=True, # GPT-4.1 supports vision
|
||||
max_image_size_mb=20.0, # 20MB per OpenAI docs
|
||||
supports_temperature=True, # Regular models accept temperature parameter
|
||||
temperature_constraint=create_temperature_constraint("range"),
|
||||
temperature_constraint=TemperatureConstraint.create("range"),
|
||||
description="GPT-4.1 (1M context) - Advanced reasoning model with large context window",
|
||||
aliases=["gpt4.1"],
|
||||
),
|
||||
@@ -303,13 +298,6 @@ class OpenAIModelProvider(OpenAICompatibleProvider):
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
def supports_thinking_mode(self, model_name: str) -> bool:
|
||||
"""Check if the model supports extended thinking mode."""
|
||||
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.
|
||||
|
||||
|
||||
@@ -204,20 +204,6 @@ class OpenRouterProvider(OpenAICompatibleProvider):
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
def supports_thinking_mode(self, model_name: str) -> bool:
|
||||
"""Check if the model supports extended thinking mode.
|
||||
|
||||
Currently, no models via OpenRouter support extended thinking.
|
||||
This may change as new models become available.
|
||||
|
||||
Args:
|
||||
model_name: Model to check
|
||||
|
||||
Returns:
|
||||
False (no OpenRouter models currently support thinking mode)
|
||||
"""
|
||||
return False
|
||||
|
||||
def list_models(
|
||||
self,
|
||||
*,
|
||||
|
||||
@@ -12,7 +12,7 @@ from utils.file_utils import read_json_file
|
||||
from .shared import (
|
||||
ModelCapabilities,
|
||||
ProviderType,
|
||||
create_temperature_constraint,
|
||||
TemperatureConstraint,
|
||||
)
|
||||
|
||||
|
||||
@@ -178,7 +178,7 @@ class OpenRouterModelRegistry:
|
||||
# Create ModelCapabilities directly from JSON data
|
||||
# Handle temperature_constraint conversion
|
||||
temp_constraint_str = model_data.get("temperature_constraint")
|
||||
temp_constraint = create_temperature_constraint(temp_constraint_str or "range")
|
||||
temp_constraint = TemperatureConstraint.create(temp_constraint_str or "range")
|
||||
|
||||
# Set provider-specific defaults based on is_custom flag
|
||||
is_custom = model_data.get("is_custom", False)
|
||||
|
||||
@@ -8,7 +8,6 @@ from .temperature import (
|
||||
FixedTemperatureConstraint,
|
||||
RangeTemperatureConstraint,
|
||||
TemperatureConstraint,
|
||||
create_temperature_constraint,
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
@@ -19,5 +18,4 @@ __all__ = [
|
||||
"FixedTemperatureConstraint",
|
||||
"RangeTemperatureConstraint",
|
||||
"DiscreteTemperatureConstraint",
|
||||
"create_temperature_constraint",
|
||||
]
|
||||
|
||||
@@ -8,7 +8,6 @@ __all__ = [
|
||||
"FixedTemperatureConstraint",
|
||||
"RangeTemperatureConstraint",
|
||||
"DiscreteTemperatureConstraint",
|
||||
"create_temperature_constraint",
|
||||
]
|
||||
|
||||
# Common heuristics for determining temperature support when explicit
|
||||
@@ -102,7 +101,7 @@ class TemperatureConstraint(ABC):
|
||||
"""
|
||||
|
||||
if constraint_hint:
|
||||
constraint = create_temperature_constraint(constraint_hint)
|
||||
constraint = TemperatureConstraint.create(constraint_hint)
|
||||
supports_temperature = constraint_hint != "fixed"
|
||||
reason = f"constraint hint '{constraint_hint}'"
|
||||
return supports_temperature, constraint, reason
|
||||
@@ -115,6 +114,19 @@ class TemperatureConstraint(ABC):
|
||||
|
||||
return supports_temperature, constraint, reason
|
||||
|
||||
@staticmethod
|
||||
def create(constraint_type: str) -> "TemperatureConstraint":
|
||||
"""Factory that yields the appropriate constraint for a configuration hint."""
|
||||
|
||||
if constraint_type == "fixed":
|
||||
# Fixed temperature models (O3/O4) only support temperature=1.0
|
||||
return FixedTemperatureConstraint(1.0)
|
||||
if constraint_type == "discrete":
|
||||
# For models with specific allowed values - using common OpenAI values as default
|
||||
return DiscreteTemperatureConstraint([0.0, 0.3, 0.7, 1.0, 1.5, 2.0], 0.3)
|
||||
# Default range constraint (for "range" or None)
|
||||
return RangeTemperatureConstraint(0.0, 2.0, 0.3)
|
||||
|
||||
|
||||
class FixedTemperatureConstraint(TemperatureConstraint):
|
||||
"""Constraint for models that enforce an exact temperature (for example O3)."""
|
||||
@@ -174,22 +186,3 @@ class DiscreteTemperatureConstraint(TemperatureConstraint):
|
||||
|
||||
def get_default(self) -> float:
|
||||
return self.default_temp
|
||||
|
||||
|
||||
def create_temperature_constraint(constraint_type: str) -> TemperatureConstraint:
|
||||
"""Factory that yields the appropriate constraint for a model configuration.
|
||||
|
||||
The JSON configuration stored in ``conf/custom_models.json`` references this
|
||||
helper via human-readable strings. Providers feed those values into this
|
||||
function so that runtime logic can rely on strongly typed constraint
|
||||
objects.
|
||||
"""
|
||||
|
||||
if constraint_type == "fixed":
|
||||
# Fixed temperature models (O3/O4) only support temperature=1.0
|
||||
return FixedTemperatureConstraint(1.0)
|
||||
if constraint_type == "discrete":
|
||||
# For models with specific allowed values - using common OpenAI values as default
|
||||
return DiscreteTemperatureConstraint([0.0, 0.3, 0.7, 1.0, 1.5, 2.0], 0.3)
|
||||
# Default range constraint (for "range" or None)
|
||||
return RangeTemperatureConstraint(0.0, 2.0, 0.3)
|
||||
|
||||
@@ -7,12 +7,7 @@ if TYPE_CHECKING:
|
||||
from tools.models import ToolModelCategory
|
||||
|
||||
from .openai_compatible import OpenAICompatibleProvider
|
||||
from .shared import (
|
||||
ModelCapabilities,
|
||||
ModelResponse,
|
||||
ProviderType,
|
||||
create_temperature_constraint,
|
||||
)
|
||||
from .shared import ModelCapabilities, ModelResponse, ProviderType, TemperatureConstraint
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -42,7 +37,7 @@ class XAIModelProvider(OpenAICompatibleProvider):
|
||||
supports_images=True, # Multimodal capabilities
|
||||
max_image_size_mb=20.0, # Standard image size limit
|
||||
supports_temperature=True,
|
||||
temperature_constraint=create_temperature_constraint("range"),
|
||||
temperature_constraint=TemperatureConstraint.create("range"),
|
||||
description="GROK-4 (256K context) - Frontier multimodal reasoning model with advanced capabilities",
|
||||
aliases=["grok", "grok4", "grok-4"],
|
||||
),
|
||||
@@ -60,7 +55,7 @@ class XAIModelProvider(OpenAICompatibleProvider):
|
||||
supports_images=False, # Assuming GROK is text-only for now
|
||||
max_image_size_mb=0.0,
|
||||
supports_temperature=True,
|
||||
temperature_constraint=create_temperature_constraint("range"),
|
||||
temperature_constraint=TemperatureConstraint.create("range"),
|
||||
description="GROK-3 (131K context) - Advanced reasoning model from X.AI, excellent for complex analysis",
|
||||
aliases=["grok3"],
|
||||
),
|
||||
@@ -78,7 +73,7 @@ class XAIModelProvider(OpenAICompatibleProvider):
|
||||
supports_images=False, # Assuming GROK is text-only for now
|
||||
max_image_size_mb=0.0,
|
||||
supports_temperature=True,
|
||||
temperature_constraint=create_temperature_constraint("range"),
|
||||
temperature_constraint=TemperatureConstraint.create("range"),
|
||||
description="GROK-3 Fast (131K context) - Higher performance variant, faster processing but more expensive",
|
||||
aliases=["grok3fast", "grokfast", "grok3-fast"],
|
||||
),
|
||||
@@ -153,14 +148,6 @@ class XAIModelProvider(OpenAICompatibleProvider):
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
def supports_thinking_mode(self, model_name: str) -> bool:
|
||||
"""Check if the model supports extended thinking mode."""
|
||||
resolved_name = self._resolve_model_name(model_name)
|
||||
capabilities = self.MODEL_CAPABILITIES.get(resolved_name)
|
||||
if capabilities:
|
||||
return capabilities.supports_extended_thinking
|
||||
return False
|
||||
|
||||
def get_preferred_model(self, category: "ToolModelCategory", allowed_models: list[str]) -> Optional[str]:
|
||||
"""Get XAI's preferred model for a given category from allowed models.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user