Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions src/core/direct_model_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ def __init__(self, cache_duration_seconds: int = 300):
cache_duration_seconds: Cache TTL in seconds (default: 300 = 5 minutes)
"""
self.cache_duration = cache_duration_seconds
self._model_mapping: Dict[str, str] = {} # name -> blockchain_id
self._model_mapping: Dict[str, str] = {} # lowercase name -> blockchain_id
self._id_to_name: Dict[str, str] = {} # blockchain_id -> name
self._model_mapping_type: Dict[str, str] = {} # name -> type
self._model_mapping_type: Dict[str, str] = {} # lowercase name -> type
self._blockchain_ids: set = set()
self._cache_expiry: Optional[datetime] = None
self._last_etag: Optional[str] = None
Expand Down Expand Up @@ -102,8 +102,7 @@ async def resolve_model_id(self, model_identifier: str) -> Optional[str]:
if model_identifier in self._blockchain_ids:
return model_identifier

# Check if it's a model name
return self._model_mapping.get(model_identifier)
return self._model_mapping.get(model_identifier.lower())

async def get_model_name_from_id(self, blockchain_id: str) -> Optional[str]:
"""
Expand Down Expand Up @@ -214,9 +213,9 @@ def _update_cache(self, models: List[Dict], content_hash: str, etag: Optional[st
model_type = model.get("ModelType")

if model_name and blockchain_id:
new_mapping[model_name] = blockchain_id
new_mapping[model_name.lower()] = blockchain_id
new_id_to_name[blockchain_id] = model_name
new_mapping_type[model_name] = model_type
new_mapping_type[model_name.lower()] = model_type
new_blockchain_ids.add(blockchain_id)

self._model_mapping = new_mapping
Expand Down
2 changes: 1 addition & 1 deletion src/core/model_routing.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ async def _get_default_model_id(self, type: Optional[str] = "LLM") -> str:
if default_model in model_mapping:
logger.info("Using configured default model",
default_model=default_model,
blockchain_id=model_mapping[default_model],
blockchain_id=model_mapping[default_model.lower()],
event_type="default_model_resolved")
return model_mapping[default_model]

Expand Down