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

Support for Gemini Tool Calling and Correct usage metadata in ChatOpenAI #29002

Closed
wants to merge 3 commits into from

Conversation

Gaggi72
Copy link

@Gaggi72 Gaggi72 commented Jan 3, 2025

So, to handle both the conditions, added an OR condition which will check whether the call has any of it.

Thank you for contributing to LangChain!

  • Package: Langchain-openai

  • Description: Support for Gemini Tool Calling and Correct usage metadata in ChatOpenAI

  • Issue: When calling Gemini via ChatOpenAI the tool_calls comes as toolCalls and metadata usage like prompt_tokens comes as promptTokens.

  • Dependencies: N/A

When calling Gemini via `ChatOpenAI` the `tool_calls` comes as `toolCalls` and metadata usage like `prompt_tokens` comes as `promptTokens`. 

So, to handle both the conditions, added an OR condition which will check whether the call has any of it.
@dosubot dosubot bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Jan 3, 2025
Copy link

vercel bot commented Jan 3, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
langchain ⬜️ Ignored (Inspect) Visit Preview Jan 3, 2025 11:13am

@dosubot dosubot bot added the 🤖:nit Small modifications/deletions, fixes, deps or improvements to existing code or docs label Jan 3, 2025
@ccurme ccurme self-assigned this Jan 3, 2025
Copy link
Collaborator

@ccurme ccurme left a comment

Choose a reason for hiding this comment

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

What is the motivation for interacting with these models via ChatOpenAI instead of a google integration, such as langchain-google-vertexai?

@Gaggi72
Copy link
Author

Gaggi72 commented Jan 5, 2025

@ccurme There was a functionality given by google to use openai package for gemini model and if there is support with openai package then why do we need another library such as langchain-google-vertexai.

Please refer to below link provided by google -
https://ai.google.dev/gemini-api/docs/openai

@ccurme
Copy link
Collaborator

ccurme commented Jan 10, 2025

Hi @Gaggi72, this should now be fixed in Google's API. Could you please check? Can re-open if needed.

@ccurme ccurme closed this Jan 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤖:nit Small modifications/deletions, fixes, deps or improvements to existing code or docs size:S This PR changes 10-29 lines, ignoring generated files.
Projects
Status: Closed
Development

Successfully merging this pull request may close these issues.

2 participants