From b137cea2309515db97a13dda2c67c8d202dad811 Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Fri, 17 May 2024 17:45:05 -0700 Subject: [PATCH] fix(proxy_server.py): fix setting model id for db models get model_id and use that as it's id in router, this enables `/model/delete` to work with the given id from `/model/info` --- litellm/proxy/_super_secret_config.yaml | 4 ++-- litellm/proxy/proxy_server.py | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/litellm/proxy/_super_secret_config.yaml b/litellm/proxy/_super_secret_config.yaml index f73c36e49ae..f622fb147a6 100644 --- a/litellm/proxy/_super_secret_config.yaml +++ b/litellm/proxy/_super_secret_config.yaml @@ -14,5 +14,5 @@ model_list: router_settings: enable_pre_call_checks: true -general_settings: - master_key: sk-1234 # [OPTIONAL] Use to enforce auth on proxy. See - https://docs.litellm.ai/docs/proxy/virtual_keys +# general_settings: +# master_key: sk-1234 # [OPTIONAL] Use to enforce auth on proxy. See - https://docs.litellm.ai/docs/proxy/virtual_keys diff --git a/litellm/proxy/proxy_server.py b/litellm/proxy/proxy_server.py index 08dd8c90696..c7fa95c9821 100644 --- a/litellm/proxy/proxy_server.py +++ b/litellm/proxy/proxy_server.py @@ -2597,6 +2597,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