fix(proxy_server.py): don't override cache params on proxy config if set

This commit is contained in:
Krrish Dholakia 2024-03-18 12:11:14 -07:00
parent ebf17d99e5
commit f0434350f1

View file

@ -1686,16 +1686,22 @@ class ProxyConfig:
verbose_proxy_logger.debug(f"passed cache type={cache_type}") 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_host = litellm.get_secret("REDIS_HOST", None)
cache_port = litellm.get_secret("REDIS_PORT", None) cache_port = litellm.get_secret("REDIS_PORT", None)
cache_password = litellm.get_secret("REDIS_PASSWORD", None)
cache_params.update( cache_params.update(
{ {
"type": cache_type, "type": cache_type,
"host": cache_host, "host": cache_host,
"port": cache_port, "port": cache_port,
}
)
if litellm.get_secret("REDIS_PASSWORD", None) is not None:
cache_password = litellm.get_secret("REDIS_PASSWORD", None)
cache_params.update(
{
"password": cache_password, "password": cache_password,
} }
) )