We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9bd032a commit fbd1a62Copy full SHA for fbd1a62
posthog/ai/langchain/callbacks.py
@@ -756,7 +756,8 @@ def _parse_usage_model(
756
for mapped_key, dataclass_key in field_mapping.items()
757
},
758
)
759
- # input_tokens is the sum of input and cache read tokens.
+ # In LangChain, input_tokens is the sum of input and cache read tokens.
760
+ # Our cost calculation expects them to be separate, for Anthropic.
761
if normalized_usage.input_tokens and normalized_usage.cache_read_tokens:
762
normalized_usage.input_tokens = max(
763
normalized_usage.input_tokens - normalized_usage.cache_read_tokens, 0
0 commit comments