mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 11:14:04 +00:00
test_prompt_caching
This commit is contained in:
parent
49c5e7811e
commit
d94cff55ff
1 changed files with 6 additions and 1 deletions
|
@ -6,6 +6,7 @@ from typing import Any, Dict, List
|
|||
from unittest.mock import MagicMock, Mock, patch
|
||||
import os
|
||||
import uuid
|
||||
import time
|
||||
|
||||
sys.path.insert(
|
||||
0, os.path.abspath("../..")
|
||||
|
@ -600,6 +601,8 @@ class BaseLLMChatTest(ABC):
|
|||
max_tokens=10,
|
||||
)
|
||||
|
||||
time.sleep(1)
|
||||
|
||||
cached_cost = response._hidden_params["response_cost"]
|
||||
|
||||
assert (
|
||||
|
@ -616,7 +619,9 @@ class BaseLLMChatTest(ABC):
|
|||
_usage_format_tests(response.usage)
|
||||
|
||||
assert "prompt_tokens_details" in response.usage
|
||||
assert response.usage.prompt_tokens_details.cached_tokens > 0
|
||||
assert (
|
||||
response.usage.prompt_tokens_details.cached_tokens > 0
|
||||
), f"cached_tokens={response.usage.prompt_tokens_details.cached_tokens} should be greater than 0. Got usage={response.usage}"
|
||||
except litellm.InternalServerError:
|
||||
pass
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue