Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
enyst committed Feb 22, 2025
1 parent 5b063cc commit 801b134
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions tests/unit/test_llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from unittest.mock import MagicMock, patch

import pytest
from litellm import PromptTokensDetails
from litellm.exceptions import (
RateLimitError,
)
Expand Down Expand Up @@ -441,7 +442,7 @@ def test_llm_token_usage(mock_litellm_completion, default_config):
'usage': {
'prompt_tokens': 12,
'completion_tokens': 3,
'prompt_tokens_details': {'cached_tokens': 2},
'prompt_tokens_details': PromptTokensDetails(cached_tokens=2),
'model_extra': {'cache_creation_input_tokens': 5},
},
}
Expand All @@ -453,7 +454,7 @@ def test_llm_token_usage(mock_litellm_completion, default_config):
'usage': {
'prompt_tokens': 7,
'completion_tokens': 2,
'prompt_tokens_details': {'cached_tokens': 1},
'prompt_tokens_details': PromptTokensDetails(cached_tokens=1),
'model_extra': {'cache_creation_input_tokens': 3},
},
}
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_message_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ def test_get_single_tokens_usage_for_event():
assert found.response_id == 'test-response-id'

# If we change the event's response ID, we won't find anything
mock_tool_call_metadata.model_response['id'] = 'some-other-id'
mock_tool_call_metadata.model_response.id = 'some-other-id'
found2 = get_single_tokens_usage_for_event(event, metrics)
assert found2 is None

Expand Down

0 comments on commit 801b134

Please sign in to comment.