Skip to content

Commit

Permalink
Merge pull request #3715 from BerriAI/litellm_model_id_fix
Browse files Browse the repository at this point in the history
fix(proxy_server.py): fix setting model id for db models
  • Loading branch information
krrishdholakia committed May 18, 2024
2 parents 5d3fe52 + 5e5179e commit 8d25a7b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
8 changes: 0 additions & 8 deletions litellm/proxy/_super_secret_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]

5 changes: 5 additions & 0 deletions litellm/proxy/proxy_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -2603,6 +2603,11 @@ def get_model_info_with_id(self, model, db_model=False) -> RouterModelInfo:
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
Expand Down
2 changes: 1 addition & 1 deletion litellm/tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down

0 comments on commit 8d25a7b

Please sign in to comment.