From f0434350f152fe74f441dd38473c48aee1396089 Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Mon, 18 Mar 2024 12:11:14 -0700 Subject: [PATCH] fix(proxy_server.py): don't override cache params on proxy config if set --- litellm/proxy/proxy_server.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/litellm/proxy/proxy_server.py b/litellm/proxy/proxy_server.py index 6074d744beb..94f487963dc 100644 --- a/litellm/proxy/proxy_server.py +++ b/litellm/proxy/proxy_server.py @@ -1686,19 +1686,25 @@ class ProxyConfig: verbose_proxy_logger.debug(f"passed cache type={cache_type}") - if cache_type == "redis" or cache_type == "redis-semantic": + if ( + cache_type == "redis" or cache_type == "redis-semantic" + ) and len(cache_params.keys()) == 0: cache_host = litellm.get_secret("REDIS_HOST", None) cache_port = litellm.get_secret("REDIS_PORT", None) - cache_password = litellm.get_secret("REDIS_PASSWORD", None) - cache_params.update( { "type": cache_type, "host": cache_host, "port": cache_port, - "password": cache_password, } ) + if litellm.get_secret("REDIS_PASSWORD", None) is not None: + cache_password = litellm.get_secret("REDIS_PASSWORD", None) + cache_params.update( + { + "password": cache_password, + } + ) # Assuming cache_type, cache_host, cache_port, and cache_password are strings print( # noqa f"{blue_color_code}Cache Type:{reset_color_code} {cache_type}"