langfuse-python icon indicating copy to clipboard operation
langfuse-python copied to clipboard

Added support to get usage for ChatGoogleGenerativeAI

Open NeerajG03 opened this issue 1 year ago • 5 comments

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

NeerajG03 avatar Aug 29 '24 16:08 NeerajG03

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Aug 29 '24 16:08 CLAassistant

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

maxdeichmann avatar Aug 29 '24 16:08 maxdeichmann

@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 avatar Aug 29 '24 16:08 NeerajG03

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

NeerajG03 avatar Aug 29 '24 16:08 NeerajG03

This also worked for me for ChatVertexAI.

It appears to fix my issues which appear to be those mentioned in https://github.com/langfuse/langfuse/issues/5468

aunitt avatar Apr 22 '25 13:04 aunitt

Thanks again for raising this! Closing this as stale / no longer relevant in Python SDK v3. If you continue to see issues, please open a Github issue 👍🏾

hassiebp avatar Jul 15 '25 08:07 hassiebp