fix(cost_calculator): robust handling of server_tool_use and fix linting

This commit is contained in:
Erick Aleman 2026-04-21 21:45:57 -04:00
parent 4fb3f74b92
commit a6fb2ce071
No known key found for this signature in database
2 changed files with 1 additions and 5 deletions

View file

@ -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!")

View file

@ -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,