From 61576fa6a9cc24d3c054f5b2251f87ee6b398a22 Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Fri, 2 Feb 2024 08:31:17 -0800 Subject: [PATCH] fix(utils.py): logging fixes --- litellm/proxy/proxy_server.py | 3 +-- litellm/utils.py | 11 ++++++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/litellm/proxy/proxy_server.py b/litellm/proxy/proxy_server.py index a55ba5e8767..a6b64c5f36b 100644 --- a/litellm/proxy/proxy_server.py +++ b/litellm/proxy/proxy_server.py @@ -566,7 +566,6 @@ async def user_api_key_auth( and (not general_settings.get("allow_user_auth", False)) ): # enters this block when allow_user_auth is set to False - assert not general_settings.get("allow_user_auth", False) if route == "/key/info": # check if user can access this route query_params = request.query_params @@ -3931,7 +3930,7 @@ def _has_user_setup_sso(): """ microsoft_client_id = os.getenv("MICROSOFT_CLIENT_ID", None) google_client_id = os.getenv("GOOGLE_CLIENT_ID", None) - ui_username = os.getenv("UI_USERNAME") + ui_username = os.getenv("UI_USERNAME", None) sso_setup = ( (microsoft_client_id is not None) diff --git a/litellm/utils.py b/litellm/utils.py index c087f98a240..e5bdcacdb00 100644 --- a/litellm/utils.py +++ b/litellm/utils.py @@ -1982,8 +1982,8 @@ def client(original_function): for index in reversed(removed_async_items): litellm.failure_callback.pop(index) ### DYNAMIC CALLBACKS ### - dynamic_success_callbacks = [] - dynamic_async_success_callbacks = [] + dynamic_success_callbacks = None + dynamic_async_success_callbacks = None if kwargs.get("success_callback", None) is not None and isinstance( kwargs["success_callback"], list ): @@ -1994,7 +1994,12 @@ def client(original_function): or callback == "dynamodb" or callback == "s3" ): - dynamic_async_success_callbacks.append(callback) + if dynamic_async_success_callbacks is not None and isinstance( + dynamic_async_success_callbacks, list + ): + dynamic_async_success_callbacks.append(callback) + else: + dynamic_async_success_callbacks = [callback] removed_async_items.append(index) # Pop the async items from success_callback in reverse order to avoid index issues for index in reversed(removed_async_items):