Skip to content

Conversation

emhagman
Copy link

@emhagman emhagman commented Aug 6, 2025

Additional guidelines

  • PR title and description are appropriate
  • Necessary tests and documentation have been added
  • Lint and tests pass successfully
  • The following additional guidelines are adhered to:
    • Optional dependencies are imported within functions
    • No unnecessary dependencies added to pyproject.toml files (except those required for unit tests)
    • PR doesn't touch more than one package
    • Changes are backwards compatible

PR Description

Switches the client for libs/genai over to https://github.com/googleapis/python-genai. This is probably 95% done but I'd love a contributor's help to make sure I didn't miss anything. I am not sure of the best way to handle keeping both old and new clients in the code and supporting old/new features or if we should remove support for the old embeddings.py and switch to the new ones? I know ideally we don't have breaking changes but this seems large enough to warrant a 3.x potentially?

The motivation behind this was to add base_url and support for REST in async environments so that this library can be used behind proxies (such as litellm, custom coded ones, etc) for tracking and rate-limiting purposes. However, in general, it seems like this is the library that will be supported by Google moving forward anyways.

All unit tests and integration tests passed for me locally.

Relevant issues

None

Type

🆕 New Feature

Changes

Switched client over to https://github.com/googleapis/python-genai but had to keep the old client for embeddings.py since not everything is supported yet. That may not be an issue though if this is true #1032

Note

  • The new client DOES NOT SUPPORT grpc, but Google (and the LLM world) seem to agree on REST for this
  • The new client DOES NOT SUPPORT embeddings the same way so the old client is still in here for now
  • This seems like a breaking change since I didn't convert the responses, etc into the GAPIC format (protobufs, etc) in case anyone relied on Google proprietary things in the metadata or additional_kwargs etc of langchain Pydantic models where things are just passed through directly

@emhagman
Copy link
Author

Google just announced the deprecation of the old libraries
https://ai.google.dev/gemini-api/docs/libraries#previous-sdks

November 30th, 2025

@lkuligin
Copy link
Collaborator

thanks for the contribution!

we're not using the deprecated SDK, so we're good without this change.

if you could work on switchingVertexAIEmbeddings to the new SDK that would be awesome, since afaik it's the only place where deprecation would hurt us

@pzhao1799
Copy link

pzhao1799 commented Sep 4, 2025

Thanks for all the hard work! My organization also has a model proxy and has been struggling to use langgraph with gemini for this exact issue. Would love to see this merged in soon - and wouldn't mind helping out if necessary. Wondering if getting the new client codepath flagged would be the easiest way.

@mdrxy mdrxy added the genai label Sep 17, 2025
@lkuligin
Copy link
Collaborator

Thanks for all the hard work! My organization also has a model proxy and has been struggling to use langgraph with gemini for this exact issue. Would love to see this merged in soon - and wouldn't mind helping out if necessary. Wondering if getting the new client codepath flagged would be the easiest way.

ChatVertexAI allows you to use a custom proxy, have you considered using it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants