File tree Expand file tree Collapse file tree 3 files changed +13
-1
lines changed
Expand file tree Collapse file tree 3 files changed +13
-1
lines changed Original file line number Diff line number Diff line change 1+
2+ ## 3.14.1 - 2025-02-18
3+
4+ 1 . Add support for Bedrock Anthropic Usage
5+
16## 3.13.0 - 2025-02-12
27
381 . Automatically retry connection errors
Original file line number Diff line number Diff line change @@ -597,6 +597,9 @@ def _parse_usage_model(
597597 # Bedrock: https://docs.aws.amazon.com/bedrock/latest/userguide/monitoring-cw.html#runtime-cloudwatch-metrics
598598 ("inputTokenCount" , "input" ),
599599 ("outputTokenCount" , "output" ),
600+ # Bedrock Anthropic
601+ ("prompt_tokens" , "input" ),
602+ ("completion_tokens" , "output" ),
600603 # langchain-ibm https://pypi.org/project/langchain-ibm/
601604 ("input_token_count" , "input" ),
602605 ("generated_token_count" , "output" ),
@@ -627,6 +630,10 @@ def _parse_usage(response: LLMResult):
627630
628631 if hasattr (response , "generations" ):
629632 for generation in response .generations :
633+ if "usage" in generation :
634+ llm_usage = _parse_usage_model (generation ["usage" ])
635+ break
636+
630637 for generation_chunk in generation :
631638 if generation_chunk .generation_info and ("usage_metadata" in generation_chunk .generation_info ):
632639 llm_usage = _parse_usage_model (generation_chunk .generation_info ["usage_metadata" ])
Original file line number Diff line number Diff line change 1- VERSION = "3.14.0 "
1+ VERSION = "3.14.1 "
22
33if __name__ == "__main__" :
44 print (VERSION , end = "" ) # noqa: T201
You can’t perform that action at this time.
0 commit comments