Use consistent terminology

Remove test folder from .gitignore for live simulation test to pass
This commit is contained in:
Fahad
2025-06-13 09:28:33 +04:00
parent b16f85979b
commit a641159a67
8 changed files with 36 additions and 25 deletions

View File

@@ -5,7 +5,7 @@ from unittest.mock import Mock
from providers.base import ModelCapabilities, ProviderType, RangeTemperatureConstraint
def create_mock_provider(model_name="gemini-2.5-flash-preview-05-20", max_tokens=1_048_576):
def create_mock_provider(model_name="gemini-2.5-flash-preview-05-20", context_window=1_048_576):
"""Create a properly configured mock provider."""
mock_provider = Mock()
@@ -14,7 +14,7 @@ def create_mock_provider(model_name="gemini-2.5-flash-preview-05-20", max_tokens
provider=ProviderType.GOOGLE,
model_name=model_name,
friendly_name="Gemini",
max_tokens=max_tokens,
context_window=context_window,
supports_extended_thinking=False,
supports_system_prompts=True,
supports_streaming=True,

View File

@@ -77,7 +77,7 @@ async def test_conversation_history_field_mapping():
provider=ProviderType.GOOGLE,
model_name="gemini-2.5-flash-preview-05-20",
friendly_name="Gemini",
max_tokens=200000,
context_window=200000,
supports_extended_thinking=True,
)
mock_get_provider.return_value = mock_provider

View File

@@ -61,7 +61,7 @@ class TestOpenRouterProvider:
caps = provider.get_capabilities("unknown-model")
assert caps.provider == ProviderType.OPENROUTER
assert caps.model_name == "unknown-model"
assert caps.max_tokens == 32_768 # Safe default
assert caps.context_window == 32_768 # Safe default
assert hasattr(caps, "_is_generic") and caps._is_generic is True
def test_model_alias_resolution(self):
@@ -139,7 +139,7 @@ class TestOpenRouterRegistry:
caps = registry.get_capabilities("opus")
assert caps is not None
assert caps.model_name == "anthropic/claude-3-opus"
assert caps.max_tokens == 200000 # Claude's context window
assert caps.context_window == 200000 # Claude's context window
# Test using full model name
caps = registry.get_capabilities("anthropic/claude-3-opus")

View File

@@ -120,7 +120,7 @@ class TestOpenRouterModelRegistry:
assert caps.provider == ProviderType.OPENROUTER
assert caps.model_name == "anthropic/claude-3-opus"
assert caps.friendly_name == "OpenRouter"
assert caps.max_tokens == 200000
assert caps.context_window == 200000
assert not caps.supports_extended_thinking
def test_duplicate_alias_detection(self):
@@ -147,13 +147,13 @@ class TestOpenRouterModelRegistry:
os.unlink(temp_path)
def test_backwards_compatibility_max_tokens(self):
"""Test backwards compatibility with old max_tokens field."""
"""Test that old max_tokens field is no longer supported (should result in empty registry)."""
config_data = {
"models": [
{
"model_name": "test/old-model",
"aliases": ["old"],
"max_tokens": 16384, # Old field name
"max_tokens": 16384, # Old field name should cause error
"supports_extended_thinking": False,
}
]
@@ -164,15 +164,12 @@ class TestOpenRouterModelRegistry:
temp_path = f.name
try:
# Should gracefully handle the error and result in empty registry
registry = OpenRouterModelRegistry(config_path=temp_path)
config = registry.resolve("old")
assert config is not None
assert config.context_window == 16384 # Should be converted
# Check capabilities still work
caps = config.to_capabilities()
assert caps.max_tokens == 16384
# Registry should be empty due to config error
assert len(registry.list_models()) == 0
assert len(registry.list_aliases()) == 0
assert registry.resolve("old") is None
finally:
os.unlink(temp_path)
@@ -215,7 +212,7 @@ class TestOpenRouterModelRegistry:
)
caps = config.to_capabilities()
assert caps.max_tokens == 128000
assert caps.context_window == 128000
assert caps.supports_extended_thinking
assert caps.supports_system_prompts
assert caps.supports_streaming

View File

@@ -84,7 +84,7 @@ class TestGeminiProvider:
assert capabilities.provider == ProviderType.GOOGLE
assert capabilities.model_name == "gemini-2.5-flash-preview-05-20"
assert capabilities.max_tokens == 1_048_576
assert capabilities.context_window == 1_048_576
assert capabilities.supports_extended_thinking
def test_get_capabilities_pro_model(self):
@@ -165,7 +165,7 @@ class TestOpenAIProvider:
assert capabilities.provider == ProviderType.OPENAI
assert capabilities.model_name == "o3-mini"
assert capabilities.max_tokens == 200_000
assert capabilities.context_window == 200_000
assert not capabilities.supports_extended_thinking
def test_validate_model_names(self):