Skip to content

Commit 120da10

Browse files
committed
formatting
1 parent 7168d1f commit 120da10

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

sentry_sdk/integrations/anthropic.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,11 @@ def new_iterator() -> "Iterator[MessageStreamEvent]":
473473

474474
# Anthropic's input_tokens excludes cached/cache_write tokens.
475475
# Normalize to total input tokens for correct cost calculations.
476-
total_input = usage.input_tokens + (usage.cache_read_input_tokens or 0) + (usage.cache_write_input_tokens or 0)
476+
total_input = (
477+
usage.input_tokens
478+
+ (usage.cache_read_input_tokens or 0)
479+
+ (usage.cache_write_input_tokens or 0)
480+
)
477481

478482
_set_output_data(
479483
span=span,
@@ -507,7 +511,11 @@ async def new_iterator_async() -> "AsyncIterator[MessageStreamEvent]":
507511

508512
# Anthropic's input_tokens excludes cached/cache_write tokens.
509513
# Normalize to total input tokens for correct cost calculations.
510-
total_input = usage.input_tokens + (usage.cache_read_input_tokens or 0) + (usage.cache_write_input_tokens or 0)
514+
total_input = (
515+
usage.input_tokens
516+
+ (usage.cache_read_input_tokens or 0)
517+
+ (usage.cache_write_input_tokens or 0)
518+
)
511519

512520
_set_output_data(
513521
span=span,

0 commit comments

Comments
 (0)