(fix) router - only init cache when its none

This commit is contained in:
ishaan-jaff 2023-12-09 15:20:08 -08:00
parent a9f103995d
commit 0b7f8265d6

View file

@ -131,7 +131,9 @@ class Router:
cache_config.update(cache_kwargs)
redis_cache = RedisCache(**cache_config)
if cache_responses:
litellm.cache = litellm.Cache(type=cache_type, **cache_config)
if litellm.cache is None:
# the cache can be initialized on the proxy server. We should not overwrite it
litellm.cache = litellm.Cache(type=cache_type, **cache_config)
self.cache_responses = cache_responses
self.cache = DualCache(redis_cache=redis_cache, in_memory_cache=InMemoryCache()) # use a dual cache (Redis+In-Memory) for tracking cooldowns, usage, etc.
### ROUTING SETUP ###