-
Notifications
You must be signed in to change notification settings - Fork 227
VertexAI usage metadata parsing #1171
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
1 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
1 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
1 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile
|
Hi @hassiebp , could you please look at this when you get a chance? |
|
Thanks a lot for your contribution! Closing this in favor of #1181 |
Some ChatVertexAI responses contain empty
usage_metadataingeneration_infowhilemessagecontains valid one. Breaking here does not allow for processing of the valid one and results in returning None.Added processing of tokens details for ChatVertexAI as they have different name and different format than the currently processed details.
Keeping the details unprocessed leads to Pydantic validation error further down the line -> langfuse/langfuse#5468
Important
Improves
usage_metadataparsing in ChatVertexAI responses by handling empty metadata and processing token details inlangfuse/callback/langchain.py._parse_usageinlangfuse/callback/langchain.pyto use.get('usage_metadata', None)for safer access.usage_metadatais empty in ChatVertexAI responses.messagefield whengeneration_infometadata is empty._parse_usage_modelto handleprompt_tokens_detailsandcandidates_tokens_detailsfor ChatVertexAI.This description was created by
for 10ceef6. You can customize this summary. It will automatically update as commits are pushed.
Greptile Summary
Disclaimer: Experimental PR review
Enhanced ChatVertexAI usage metadata parsing to handle empty metadata cases and properly process token details in different formats.
_parse_usageinlangfuse/callback/langchain.pyto safely handle empty usage_metadata using.get()methodprompt_tokens_detailsandcandidates_tokens_details💡 (1/5) You can manually trigger the bot by mentioning @greptileai in a comment!