diff --git a/litellm/caching/redis_cache.py b/litellm/caching/redis_cache.py index f1c80eaacbe..a54bd7f517f 100644 --- a/litellm/caching/redis_cache.py +++ b/litellm/caching/redis_cache.py @@ -246,7 +246,9 @@ async def _run_under_circuit_breaker( return result -def _redis_circuit_breaker_guard(method): +def _redis_circuit_breaker_guard( + method: Callable[..., Awaitable[_RedisCallResult]], +) -> Callable[..., Awaitable[_RedisCallResult]]: """ Decorator for RedisCache async methods. Checks the circuit breaker before each call; records success/failure after. @@ -260,7 +262,7 @@ def _redis_circuit_breaker_guard(method): """ @functools.wraps(method) - async def wrapper(self, *args, **kwargs): + async def wrapper(self: "RedisCache", *args: object, **kwargs: object) -> _RedisCallResult: return await _run_under_circuit_breaker( self._circuit_breaker, method.__name__, lambda: method(self, *args, **kwargs) ) diff --git a/litellm/proxy/common_utils/user_api_key_cache.py b/litellm/proxy/common_utils/user_api_key_cache.py index b8df0105b7b..eadcf74c792 100644 --- a/litellm/proxy/common_utils/user_api_key_cache.py +++ b/litellm/proxy/common_utils/user_api_key_cache.py @@ -129,17 +129,17 @@ class UserApiKeyCache(DualCache): return None return decoded - def set_cache(self, key, value, local_only: bool = False, **kwargs): + def set_cache(self, key, value, local_only: bool = False, **kwargs: object): model_type: Final = cast(type[BaseModel] | None, kwargs.pop("model_type", None)) payload: Final = CacheCodec.serialize(value, model_type=model_type) return super().set_cache(key=key, value=payload, local_only=local_only, **kwargs) - async def async_set_cache(self, key, value, local_only: bool = False, **kwargs): + async def async_set_cache(self, key, value, local_only: bool = False, **kwargs: object): model_type: Final = cast(type[BaseModel] | None, kwargs.pop("model_type", None)) payload: Final = CacheCodec.serialize(value, model_type=model_type) return await super().async_set_cache(key=key, value=payload, local_only=local_only, **kwargs) - async def async_set_cache_pipeline(self, cache_list: list, local_only: bool = False, **kwargs) -> None: + async def async_set_cache_pipeline(self, cache_list: list, local_only: bool = False, **kwargs: object) -> None: """ Batch writes with the same Codec boundary as ``async_set_cache`` without ``model_type``: ``BaseModel`` values become JSON-safe dicts; dicts/scalars unchanged.