Skip to content

Commit 864588e

Browse files
authored
fix: treat usage_metadata.total_token_count of vertex ai as total (#1208)
fix(langchain): treat `usage_metadata.total token count` of vertex ai as total
1 parent acaea58 commit 864588e

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

langfuse/langchain/CallbackHandler.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -793,6 +793,7 @@ def _parse_usage_model(usage: typing.Union[pydantic.BaseModel, dict]):
793793
# https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/get-token-count
794794
("prompt_token_count", "input"),
795795
("candidates_token_count", "output"),
796+
("total_token_count", "total"),
796797
# Bedrock: https://docs.aws.amazon.com/bedrock/latest/userguide/monitoring-cw.html#runtime-cloudwatch-metrics
797798
("inputTokenCount", "input"),
798799
("outputTokenCount", "output"),

0 commit comments

Comments
 (0)