langchain
8d0fb2d0 - fix(anthropic): correct `input_token` count for streaming (#32591)

Commit
137 days ago
fix(anthropic): correct `input_token` count for streaming (#32591) * Create usage metadata on [`message_delta`](https://docs.anthropic.com/en/docs/build-with-claude/streaming#event-types) instead of at the beginning. Consequently, token counts are not included during streaming but instead at the end. This allows for accurate reporting of server-side tool usage (important for billing) * Add some clarifying comments * Fix some outstanding Pylance warnings * Remove unnecessary `text` popping in thinking blocks * Also now correctly reports `input_cache_read`/`input_cache_creation` as a result
Author
Parents
Loading