Skip to content

Commit c4e297f

Browse files
committed
feat(model-info): ✨ add provider priority system and enhanced model metadata
This commit significantly improves the model lookup and metadata capabilities of the ModelInfoService: - Introduces a provider priority system that prefers native/authoritative providers (anthropic, openai, google) over proxy/aggregator providers (openrouter, azure, requesty) when multiple sources exist for the same model - Adds provider alias mapping to support custom provider names (e.g., nvidia_nim -> nvidia, gemini_cli -> google) for direct model ID resolution - Extends ModelMetadata with new ModelInfo dataclass containing family, description, knowledge_cutoff, release_date, open_weights, status, tokenizer, and huggingface_id fields - Adds extended capabilities support: structured_output, temperature, attachments, and interleaved content - Implements version pattern normalization to handle different version formats (e.g., claude-opus-4-5 matches claude-opus-4.5) - Refactors data merger to use best-source selection instead of averaging multiple sources, preserving queried model identity while inheriting technical specs from best matching native provider - Restructures API response format with clear separation between core OpenAI fields, extended fields, legacy compatibility fields, and debug metadata - Adds parent model tracking in origin field for transparency when fuzzy matching occurs - Exports ModelMetadata in __all__ for public API access The provider priority system ensures that when looking up custom provider models (e.g., antigravity/claude-opus-4-5), the service intelligently inherits accurate pricing and capabilities from the native provider source (anthropic/claude-opus-4.5) while preserving the queried model's provider identity.
1 parent ed4dd55 commit c4e297f

File tree

2 files changed

+709
-289
lines changed

2 files changed

+709
-289
lines changed

src/rotator_library/__init__.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,33 @@
77
if TYPE_CHECKING:
88
from .providers import PROVIDER_PLUGINS
99
from .providers.provider_interface import ProviderInterface
10-
from .model_info_service import ModelInfoService, ModelInfo
10+
from .model_info_service import ModelInfoService, ModelInfo, ModelMetadata
11+
12+
__all__ = [
13+
"RotatingClient",
14+
"PROVIDER_PLUGINS",
15+
"ModelInfoService",
16+
"ModelInfo",
17+
"ModelMetadata",
18+
]
1119

12-
__all__ = ["RotatingClient", "PROVIDER_PLUGINS", "ModelInfoService", "ModelInfo"]
1320

1421
def __getattr__(name):
1522
"""Lazy-load PROVIDER_PLUGINS and ModelInfoService to speed up module import."""
1623
if name == "PROVIDER_PLUGINS":
1724
from .providers import PROVIDER_PLUGINS
25+
1826
return PROVIDER_PLUGINS
1927
if name == "ModelInfoService":
2028
from .model_info_service import ModelInfoService
29+
2130
return ModelInfoService
2231
if name == "ModelInfo":
2332
from .model_info_service import ModelInfo
33+
2434
return ModelInfo
35+
if name == "ModelMetadata":
36+
from .model_info_service import ModelMetadata
37+
38+
return ModelMetadata
2539
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")

0 commit comments

Comments
 (0)