feat: added intelligence_score to the model capabilities schema; a 1-20 number that can be specified to influence the sort order of models presented to the CLI in auto selection mode
fix: model definition re-introduced into the schema but intelligently and only a summary is generated per tool. Required to ensure CLI calls and uses the correct model fix: removed `model` param from some tools where this wasn't needed fix: fixed adherence to `*_ALLOWED_MODELS` by advertising only the allowed models to the CLI fix: removed duplicates across providers when passing canonical names back to the CLI; the first enabled provider wins
This commit is contained in:
@@ -42,6 +42,7 @@ class ModelProvider(ABC):
|
||||
"""Initialize the provider with API key and optional configuration."""
|
||||
self.api_key = api_key
|
||||
self.config = kwargs
|
||||
self._sorted_capabilities_cache: Optional[list[tuple[str, ModelCapabilities]]] = None
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# Provider identity & capability surface
|
||||
@@ -77,6 +78,27 @@ class ModelProvider(ABC):
|
||||
return {k: v for k, v in model_map.items() if isinstance(v, ModelCapabilities)}
|
||||
return {}
|
||||
|
||||
def get_capabilities_by_rank(self) -> list[tuple[str, ModelCapabilities]]:
|
||||
"""Return model capabilities sorted by effective capability rank."""
|
||||
|
||||
if self._sorted_capabilities_cache is not None:
|
||||
return list(self._sorted_capabilities_cache)
|
||||
|
||||
model_configs = self.get_all_model_capabilities()
|
||||
if not model_configs:
|
||||
self._sorted_capabilities_cache = []
|
||||
return []
|
||||
|
||||
items = list(model_configs.items())
|
||||
items.sort(key=lambda item: (-item[1].get_effective_capability_rank(), item[0]))
|
||||
self._sorted_capabilities_cache = items
|
||||
return list(items)
|
||||
|
||||
def _invalidate_capability_cache(self) -> None:
|
||||
"""Clear cached sorted capability data (call after dynamic updates)."""
|
||||
|
||||
self._sorted_capabilities_cache = None
|
||||
|
||||
def list_models(
|
||||
self,
|
||||
*,
|
||||
|
||||
Reference in New Issue
Block a user