From a6fb2ce07159dca9b4ddae9e19f5d6c0695e04b6 Mon Sep 17 00:00:00 2001 From: Erick Aleman Date: Tue, 21 Apr 2026 21:45:57 -0400 Subject: [PATCH] fix(cost_calculator): robust handling of server_tool_use and fix linting --- litellm/tests/test_cost_calculator_attributeerror.py | 4 ---- litellm/types/utils.py | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/litellm/tests/test_cost_calculator_attributeerror.py b/litellm/tests/test_cost_calculator_attributeerror.py index ecde75e76a5..c4dcb574f84 100644 --- a/litellm/tests/test_cost_calculator_attributeerror.py +++ b/litellm/tests/test_cost_calculator_attributeerror.py @@ -1,7 +1,5 @@ import sys import os -from unittest.mock import MagicMock -import pytest # Add the project root to the path sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "../.."))) @@ -40,9 +38,7 @@ def test_completion_cost_with_dict_usage(): # This should not raise AttributeError cost = completion_cost(completion_response=response, model="gpt-3.5-turbo") assert cost is not None - print(f"Cost calculated: {cost}") if __name__ == "__main__": test_usage_coercion_from_dict() test_completion_cost_with_dict_usage() - print("Tests passed!") diff --git a/litellm/types/utils.py b/litellm/types/utils.py index 7e57ff5cab4..aa0477d8751 100644 --- a/litellm/types/utils.py +++ b/litellm/types/utils.py @@ -1264,7 +1264,7 @@ class Delta(SafeAttributeModel, OpenAIObject): reasoning_items: Optional[List[ChatCompletionReasoningItem]] = None provider_specific_fields: Optional[Dict[str, Any]] = Field(default=None) - def __init__( + def __init__( # noqa: PLR0915 self, content=None, role=None,