(feat) show semantic-cache on health/readiness

This commit is contained in:
ishaan-jaff 2024-02-06 13:35:25 -08:00
parent fa5f4b9774
commit 3d0ece828a
2 changed files with 13 additions and 0 deletions

View file

@ -531,6 +531,9 @@ class RedisSemanticCache(BaseCache):
return None
pass
async def _index_info(self):
return await self.index.ainfo()
class S3Cache(BaseCache):
def __init__(

View file

@ -4051,8 +4051,18 @@ async def health_readiness():
cache_type = None
if litellm.cache is not None:
from litellm.caching import RedisSemanticCache
cache_type = litellm.cache.type
if isinstance(litellm.cache.cache, RedisSemanticCache):
# ping the cache
try:
index_info = await litellm.cache.cache._index_info()
except Exception as e:
index_info = "index does not exist - error: " + str(e)
cache_type = {"type": cache_type, "index_info": index_info}
if prisma_client is not None: # if db passed in, check if it's connected
if prisma_client.db.is_connected() == True:
response_object = {"db": "connected"}