mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 03:04:13 +00:00
(Redis Cluster) - Fixes for using redis cluster + pipeline (#8442)
* update RedisCluster creation * update RedisClusterCache * add redis ClusterCache * update async_set_cache_pipeline * cleanup redis cluster usage * fix redis pipeline * test_init_async_client_returns_same_instance * fix redis cluster * update mypy_path * fix init_redis_cluster * remove stub * test redis commit * ClusterPipeline * fix import * RedisCluster import * fix redis cluster * Potential fix for code scanning alert no. 2129: Clear-text logging of sensitive information Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> * fix naming of redis cluster integration * test_redis_caching_ttl_pipeline * fix async_set_cache_pipeline --------- Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
This commit is contained in:
parent
b710407763
commit
40e3af0428
7 changed files with 112 additions and 27 deletions
|
@ -21,7 +21,8 @@ import pytest
|
|||
import litellm
|
||||
from litellm import aembedding, completion, embedding
|
||||
from litellm.caching.caching import Cache
|
||||
|
||||
from redis.asyncio import RedisCluster
|
||||
from litellm.caching.redis_cluster_cache import RedisClusterCache
|
||||
from unittest.mock import AsyncMock, patch, MagicMock, call
|
||||
import datetime
|
||||
from datetime import timedelta
|
||||
|
@ -2328,8 +2329,12 @@ async def test_redis_caching_ttl_pipeline():
|
|||
# Verify that the set method was called on the mock Redis instance
|
||||
mock_set.assert_has_calls(
|
||||
[
|
||||
call.set("test_key1", '"test_value1"', ex=expected_timedelta),
|
||||
call.set("test_key2", '"test_value2"', ex=expected_timedelta),
|
||||
call.set(
|
||||
name="test_key1", value='"test_value1"', ex=expected_timedelta
|
||||
),
|
||||
call.set(
|
||||
name="test_key2", value='"test_value2"', ex=expected_timedelta
|
||||
),
|
||||
]
|
||||
)
|
||||
|
||||
|
@ -2388,6 +2393,7 @@ async def test_redis_increment_pipeline():
|
|||
from litellm.caching.redis_cache import RedisCache
|
||||
|
||||
litellm.set_verbose = True
|
||||
litellm._turn_on_debug()
|
||||
redis_cache = RedisCache(
|
||||
host=os.environ["REDIS_HOST"],
|
||||
port=os.environ["REDIS_PORT"],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue