Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
minor fix
- bump redisvl version
- default embedding cache namespace
  • Loading branch information
fcenedes committed Dec 4, 2025
commit c2a7453cda5bbc7189874c1cfe16dcdbdba63a7f
8 changes: 7 additions & 1 deletion docs/my-website/docs/caching/all_caches.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand All @@ -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",
Expand Down Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions litellm/caching/redis_semantic_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -98,9 +99,8 @@ def __init__(
# 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
Expand Down