Skip to content

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]

refactor(caching): spell out the key collections batch_get_counts accepts

yucheng49d49b70508a
diff --git a/litellm/caching/redis_cache.py b/litellm/caching/redis_cache.py
index f37ca8a23a1..f1b723de625 100644
--- a/litellm/caching/redis_cache.py
+++ b/litellm/caching/redis_cache.py
@@ -791,7 +791,7 @@ class RedisCache(BaseCache):
return _LUA_COUNT.validate_python(count)
@_redis_circuit_breaker_guard_sync
- def batch_get_counts(self, key_list: Sequence[str]) -> tuple[int | None, ...]:
+ def batch_get_counts(self, key_list: list[str] | tuple[str, ...]) -> tuple[int | None, ...]:
"""Read integer counters for ``key_list``, in order, raising when Redis cannot answer.
``batch_get_cache`` swallows every failure and returns an empty dict, which the caller
@@ -802,7 +802,7 @@ class RedisCache(BaseCache):
return _decoded_counts(self._run_redis_mget_operation(keys=namespaced_keys))
@_redis_circuit_breaker_guard
- async def async_batch_get_counts(self, key_list: Sequence[str]) -> tuple[int | None, ...]:
+ async def async_batch_get_counts(self, key_list: list[str] | tuple[str, ...]) -> tuple[int | None, ...]:
"""Async twin of ``batch_get_counts``, raising on failure the same way."""
namespaced_keys: Final = [self.check_and_fix_namespace(key=key) for key in key_list]
return _decoded_counts(await self._async_run_redis_mget_operation(keys=namespaced_keys))