Skip to content
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

Added support to get usage for ChatGoogleGenerativeAI #893

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

NeerajG03
Copy link

This PR has been raised to add support to track ChatGoogleGenerativeAI's langchain call usage.
A simple check for usage_metadata attribute and then parsing using the _parse_usage_model

@CLAassistant
Copy link

CLAassistant commented Aug 29, 2024

CLA assistant check
All committers have signed the CLA.

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Disclaimer: Experimental PR review

PR Summary

Added support for tracking usage of ChatGoogleGenerativeAI's langchain calls in the Langfuse Python SDK.

  • Introduced check for 'usage_metadata' attribute in message chunks in langfuse/callback/langchain.py
  • Implemented parsing of 'usage_metadata' using _parse_usage_model function
  • Enhanced usage tracking capabilities for Google's Generative AI in addition to existing LLM providers

1 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings

@maxdeichmann
Copy link
Member

maxdeichmann commented Aug 29, 2024

@NeerajG03 did you test this locally? Thanks a lot for the contribution!

@NeerajG03
Copy link
Author

NeerajG03 commented Aug 29, 2024

@maxdeichmann I'm sorry i'm very new to contributing for projects.
If you are asking if i have run this test poetry run pytest -s -v --log-cli-level=INFO, then thats a yes. 👍
I ran it for test_langchain.py and test_langchain_integration.py

@NeerajG03
Copy link
Author

Here is the screenshot of the run summary
Screenshot 2024-08-29 at 10 27 56 PM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants