diff --git a/litellm/caching/redis_cache.py b/litellm/caching/redis_cache.py index b2e52b20eac..55ae47fe461 100644 --- a/litellm/caching/redis_cache.py +++ b/litellm/caching/redis_cache.py @@ -1071,9 +1071,9 @@ class RedisCache(BaseCache): # Test the connection ping_result = await redis_client.ping() - + # Close the connection - await redis_client.aclose() + await redis_client.aclose() # type: ignore[attr-defined] if ping_result: return { diff --git a/litellm/caching/redis_cluster_cache.py b/litellm/caching/redis_cluster_cache.py index 69bdb500de4..91fcf1d7288 100644 --- a/litellm/caching/redis_cluster_cache.py +++ b/litellm/caching/redis_cluster_cache.py @@ -83,10 +83,10 @@ class RedisClusterCache(RedisCache): ) # Test the connection - ping_result = await redis_client.ping() - + ping_result = await redis_client.ping() # type: ignore[attr-defined] + # Close the connection - await redis_client.aclose() + await redis_client.aclose() # type: ignore[attr-defined] if ping_result: return { diff --git a/litellm/completion_extras/litellm_responses_transformation/transformation.py b/litellm/completion_extras/litellm_responses_transformation/transformation.py index cb358498968..3ba75666b81 100644 --- a/litellm/completion_extras/litellm_responses_transformation/transformation.py +++ b/litellm/completion_extras/litellm_responses_transformation/transformation.py @@ -541,7 +541,7 @@ class LiteLLMResponsesTransformationHandler(CompletionTransformationBridge): def _map_reasoning_effort(self, reasoning_effort: Union[str, Dict[str, Any]]) -> Optional[Reasoning]: # If dict is passed, convert it directly to Reasoning object if isinstance(reasoning_effort, dict): - return Reasoning(**reasoning_effort) + return Reasoning(**reasoning_effort) # type: ignore[typeddict-item] # If string is passed, map without summary (default) if reasoning_effort == "high": diff --git a/litellm/responses/utils.py b/litellm/responses/utils.py index 64db4d3e020..63c15e21a88 100644 --- a/litellm/responses/utils.py +++ b/litellm/responses/utils.py @@ -361,17 +361,19 @@ class ResponseAPILoggingUtils: @staticmethod def _transform_response_api_usage_to_chat_usage( - usage: Optional[Union[dict, ResponseAPIUsage]], + usage_input: Optional[Union[dict, ResponseAPIUsage]], ) -> Usage: """Tranforms the ResponseAPIUsage object to a Usage object""" - if usage is None: + if usage_input is None: return Usage( prompt_tokens=0, completion_tokens=0, total_tokens=0, ) response_api_usage: ResponseAPIUsage = ( - ResponseAPIUsage(**usage) if isinstance(usage, dict) else usage + ResponseAPIUsage(**usage_input) + if isinstance(usage_input, dict) + else usage_input ) prompt_tokens: int = response_api_usage.input_tokens or 0 completion_tokens: int = response_api_usage.output_tokens or 0 @@ -381,7 +383,7 @@ class ResponseAPILoggingUtils: cached_tokens=response_api_usage.input_tokens_details.cached_tokens, audio_tokens=response_api_usage.input_tokens_details.audio_tokens, ) - usage = Usage( + chat_usage = Usage( prompt_tokens=prompt_tokens, completion_tokens=completion_tokens, total_tokens=prompt_tokens + completion_tokens, @@ -390,6 +392,6 @@ class ResponseAPILoggingUtils: # Preserve cost attribute if it exists on ResponseAPIUsage if hasattr(response_api_usage, "cost") and response_api_usage.cost is not None: - setattr(usage, "cost", response_api_usage.cost) + setattr(chat_usage, "cost", response_api_usage.cost) - return usage + return chat_usage diff --git a/litellm/secret_managers/aws_secret_manager_v2.py b/litellm/secret_managers/aws_secret_manager_v2.py index 0e7a61d0370..8f3547fd082 100644 --- a/litellm/secret_managers/aws_secret_manager_v2.py +++ b/litellm/secret_managers/aws_secret_manager_v2.py @@ -238,7 +238,7 @@ class AWSSecretsManagerV2(BaseAWSLLM, BaseSecretManager): tags_list = tags else: raise ValueError("Tags must be a dict or list of {Key, Value} pairs") - data["Tags"] = tags_list + data["Tags"] = tags_list # type: ignore[assignment] endpoint_url, headers, body = self._prepare_request( action="CreateSecret",