The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
(bug fix) - Fix Cache Health Check for Redis when redis_version is float (#8979)
Ishaan Jaff42931638dfc7
diff --git a/litellm/types/caching.py b/litellm/types/caching.pyindex 743c2c09373..c15d4d15909 100644--- a/litellm/types/caching.py+++ b/litellm/types/caching.py@@ -75,4 +75,4 @@ class HealthCheckCacheParams(BaseModel):port: Optional[Union[str, int]] = Noneredis_kwargs: Optional[Dict[str, Any]] = Nonenamespace: Optional[str] = None- redis_version: Optional[str] = None+ redis_version: Optional[Union[str, int, float]] = Nonediff --git a/tests/litellm/proxy/test_caching_routes.py b/tests/litellm/proxy/test_caching_routes.pyindex 291cb0b87c8..6f22f665011 100644--- a/tests/litellm/proxy/test_caching_routes.py+++ b/tests/litellm/proxy/test_caching_routes.py@@ -184,3 +184,21 @@ def test_cache_ping_health_check_includes_only_cache_attributes(mock_redis_succe"host": "localhost","port": 6379,}+++def test_cache_ping_with_redis_version_float(mock_redis_success):+ """Test cache ping works when redis_version is a float"""+ # Set redis_version as a float+ mock_redis_success.cache.redis_version = 7.2++ response = client.get("/cache/ping", headers={"Authorization": "Bearer sk-1234"})+ assert response.status_code == 200++ data = response.json()+ print("data=", json.dumps(data, indent=4))+ assert data["status"] == "healthy"+ assert data["cache_type"] == "redis"++ cache_params = data["health_check_cache_params"]+ assert isinstance(cache_params, dict)+ assert isinstance(cache_params.get("redis_version"), float)