Revert "Handle cache token counts being none"
This reverts commit 87934be342e438cc270ba04150d0189a870164f1.
This commit is contained in:
committed by
Aleix Conchillo Flaqué
parent
efcbe51a85
commit
6d6bffcabd
@@ -250,24 +250,14 @@ class AnthropicLLMService(LLMService):
|
|||||||
if hasattr(event.message.usage, "output_tokens")
|
if hasattr(event.message.usage, "output_tokens")
|
||||||
else 0
|
else 0
|
||||||
)
|
)
|
||||||
cache_creation_input_tokens += (
|
if hasattr(event.message.usage, "cache_creation_input_tokens"):
|
||||||
event.message.usage.cache_creation_input_tokens
|
cache_creation_input_tokens += (
|
||||||
if (
|
event.message.usage.cache_creation_input_tokens
|
||||||
hasattr(event.message.usage, "cache_creation_input_tokens")
|
|
||||||
and event.message.usage.cache_creation_input_tokens is not None
|
|
||||||
)
|
)
|
||||||
else 0
|
logger.debug(f"Cache creation input tokens: {cache_creation_input_tokens}")
|
||||||
)
|
if hasattr(event.message.usage, "cache_read_input_tokens"):
|
||||||
logger.debug(f"Cache creation input tokens: {cache_creation_input_tokens}")
|
cache_read_input_tokens += event.message.usage.cache_read_input_tokens
|
||||||
cache_read_input_tokens += (
|
logger.debug(f"Cache read input tokens: {cache_read_input_tokens}")
|
||||||
event.message.usage.cache_read_input_tokens
|
|
||||||
if (
|
|
||||||
hasattr(event.message.usage, "cache_read_input_tokens")
|
|
||||||
and event.message.usage.cache_read_input_tokens is not None
|
|
||||||
)
|
|
||||||
else 0
|
|
||||||
)
|
|
||||||
logger.debug(f"Cache read input tokens: {cache_read_input_tokens}")
|
|
||||||
total_input_tokens = (
|
total_input_tokens = (
|
||||||
prompt_tokens + cache_creation_input_tokens + cache_read_input_tokens
|
prompt_tokens + cache_creation_input_tokens + cache_read_input_tokens
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user