Merge pull request #3715 from BerriAI/litellm_model_id_fix

fix(proxy_server.py): fix setting model id for db models
This commit is contained in:
Krish Dholakia 2024-05-17 22:36:23 -07:00 committed by GitHub
commit 8d25a7b9dc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 6 additions and 9 deletions

View file

@ -18,11 +18,3 @@ model_list:
router_settings:
enable_pre_call_checks: true
litellm_settings:
success_callback: ["langfuse"]
failure_callback: ["langfuse"]
general_settings:
alerting: ["slack"]

View file

@ -2603,6 +2603,11 @@ class ProxyConfig:
Return model info w/ id
"""
_id: Optional[str] = getattr(model, "model_id", None)
if _id is not None:
model.model_info["id"] = _id
model.model_info["db_model"] = True
if model.model_info is not None and isinstance(model.model_info, dict):
if "id" not in model.model_info:
model.model_info["id"] = model.model_id

View file

@ -102,7 +102,7 @@ async def test_delete_deployment():
pc = ProxyConfig()
db_model = DBModel(
model_id="12340523",
model_id=deployment.model_info.id,
model_name="gpt-3.5-turbo",
litellm_params=encrypted_litellm_params,
model_info={"id": deployment.model_info.id},