From c2a7453cda5bbc7189874c1cfe16dcdbdba63a7f Mon Sep 17 00:00:00 2001 From: fcenedes Date: Thu, 4 Dec 2025 20:25:30 +0100 Subject: [PATCH] minor fix - bump redisvl version - default embedding cache namespace --- docs/my-website/docs/caching/all_caches.md | 8 +++++++- litellm/caching/redis_semantic_cache.py | 6 +++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/docs/my-website/docs/caching/all_caches.md b/docs/my-website/docs/caching/all_caches.md index 0548c331f80..3889e7369da 100644 --- a/docs/my-website/docs/caching/all_caches.md +++ b/docs/my-website/docs/caching/all_caches.md @@ -211,7 +211,7 @@ response2 = completion( Install redisvl client ```shell -pip install redisvl==0.4.1 +pip install redisvl==0.12.1 ``` For the hosted version you can setup your own Redis DB here: https://redis.io/try-free/ @@ -234,6 +234,9 @@ litellm.cache = Cache( similarity_threshold=0.8, # similarity threshold for cache hits, 0 == no similarity, 1 = exact matches, 0.5 == 50% similarity ttl=120, redis_semantic_cache_embedding_model="text-embedding-ada-002", # this model is passed to litellm.embedding(), any litellm.embedding() model is supported here + embedding_cache_enabled=True, # enable caching of embeddings + embedding_cache_ttl=120, # ttl for embeddings cache + embedding_cache_name="litellm-embeddings-cache", # name for embeddings cache default is litellm_redis_semantic_embeddings_cache ) response1 = completion( model="gpt-3.5-turbo", @@ -603,6 +606,9 @@ def __init__( similarity_threshold: Optional[float] = None, redis_semantic_cache_embedding_model: str = "text-embedding-ada-002", redis_semantic_cache_index_name: Optional[str] = None, + embedding_cache_enabled: bool = False, + embedding_cache_ttl: Optional[int] = None, + embedding_cache_name: Optional[str] = None, # s3 Bucket, boto3 configuration s3_bucket_name: Optional[str] = None, diff --git a/litellm/caching/redis_semantic_cache.py b/litellm/caching/redis_semantic_cache.py index def28586551..9cefd156294 100644 --- a/litellm/caching/redis_semantic_cache.py +++ b/litellm/caching/redis_semantic_cache.py @@ -35,6 +35,7 @@ class RedisSemanticCache(BaseCache): """ DEFAULT_REDIS_INDEX_NAME: str = "litellm_semantic_cache_index" + DEFAULT_REDIS_EMBEDDINGS_CACHE_NAME: str = "litellm_redis_semantic_embeddings_cache" def __init__( self, @@ -98,9 +99,8 @@ class RedisSemanticCache(BaseCache): # Embeddings cache configuration self.embedding_cache_enabled: bool = embedding_cache_enabled self.embedding_cache_ttl: Optional[int] = embedding_cache_ttl - self.embedding_cache_name: str = ( - embedding_cache_name or "litellm_redis_semantic_embeddings_cache" - ) + if embedding_cache_name is None: + self.embedding_cache_name = self.DEFAULT_REDIS_EMBEDDINGS_CACHE_NAME self._embeddings_cache: Optional[EmbeddingsCache] = None # Set up Redis connection