(feat) show semantic-cache on health/readiness

This commit is contained in:
ishaan-jaff
2024-02-06 15:17:40 -08:00
committed by Krrish Dholakia
parent 0d03b28a3b
commit 325ca43946
2 changed files with 13 additions and 0 deletions
+3
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__(
+10
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"}