fix: pass Vertex project explicitly to ChatGoogle; drop setup-time ping call#1
Closed
ppsplus-bradh wants to merge 1 commit into
Closed
Conversation
Addresses the review on PR langchain-ai#36 (Gemini / Vertex support). - Pass the GCP project to ChatGoogle explicitly via googleAuthOptions.projectId in the gemini-enterprise branch of createModel(), instead of relying on ambient process.env resolution. - Import ChatGoogle from @langchain/google/node, whose params expose googleAuthOptions (the default @langchain/google entrypoint types authOptions as never and is API-key oriented). Same package, no new dependency; the /node client still supports the gai/apiKey path. - Remove the setup-time credential validation in credentials.tsx that mutated process.env.GOOGLE_CLOUD_PROJECT and issued a live testModel.invoke(["ping"]) network call during onboarding. It was the source of the flagged process.env mutation and added a round-trip, cost, and potential hang no other provider performs. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Owner
|
Thanks for the suggestion @ppsplus-bradh I unfortunately left for vacation but saw that things got caught up and implemented nonetheless! Glad to see this going through! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi @ernani — this is a small helper PR targeting your
gemini-supportbranch to address @rajpratham1's review on langchain-ai#36. Merge it into your branch and it will roll into that PR. Feel free to cherry-pick instead if you prefer.What the review asked
Changes
createModel()'sgemini-enterprisebranch now readsGOOGLE_CLOUD_PROJECTand passes it asgoogleAuthOptions: { projectId }toChatGoogle, rather than relying on ambientprocess.envresolution.ChatGooglefrom@langchain/google/node. The default@langchain/googleentrypoint typesauthOptionsasneverand is API-key oriented, sogoogleAuthOptionsisn't available there. It's the same package (no new dependency), and the/nodeclient still supports the AI Studiogai/apiKeypath used by thegeminiprovider.credentials.tsxthat mutatedprocess.env.GOOGLE_CLOUD_PROJECTand issued a livetestModel.invoke([{ role: "user", content: "ping" }], { timeout: 5000 })during onboarding. That was the source of the flaggedprocess.envmutation, and it also added a network round-trip, cost, and a potential hang that no other provider performs at setup.Verified:
pnpm run build,pnpm run lint:check, andprettier --checkon the changed files all pass; runtime construction ofChatGooglesucceeds for thegcp+projectId,gcp(ambient ADC), andgaipaths.🤖 Generated with Claude Code