
Security News
CVE Volume Surges Past 48,000 in 2025 as WordPress Plugin Ecosystem Drives Growth
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.
@langchain/google-vertexai
Advanced tools
This package contains resources to access Google AI/ML models and other Google services via Vertex AI. Authorization to these services use service account credentials stored on the local file system or provided through the Google Cloud Platform environment it is running on.
If you are running this on a platform where the credentials cannot be provided this way, consider using the @langchain/google-vertexai-web package instead. You do not need to use both packages. See the section on Authorization below.
$ pnpm install @langchain/google-vertexai
Authorization is done through a Google Cloud Service Account.
To handle service accounts, this package uses the google-auth-library
package, and you may wish to consult the documentation for that library
about how it does so. But in short, classes in this package will use
credentials from the first of the following that apply:
apiKey attributeauthInfo attributeAPI_KEYGOOGLE_APPLICATION_CREDENTIALS environment
variable.gcloud auth application-default login, then the
default credentials.When using tools with Gemini models through Vertex AI, be aware of the following Zod schema limitations:
Discriminated Unions - .discriminatedUnion() is not supported
// ❌ This will throw an error
z.discriminatedUnion("type", [
z.object({ type: z.literal("a"), value: z.string() }),
z.object({ type: z.literal("b"), value: z.number() }),
]);
// ✅ Use a flat object with optional fields instead
z.object({
type: z.enum(["a", "b"]),
stringValue: z.string().optional(),
numberValue: z.number().optional(),
});
Union Types - z.union() is not supported
// ❌ This will throw an error
z.union([z.string(), z.number()]);
// ✅ Consider using separate optional fields
z.object({
stringValue: z.string().optional(),
numberValue: z.number().optional(),
});
Positive Refinement - .positive() is automatically converted
// ⚠️ This is automatically converted to .min(0.01)
z.number().positive();
// ✅ Prefer using .min() directly
z.number().min(0.01);
If you use unsupported schema features, you'll receive descriptive error messages:
"Gemini cannot handle union types (discriminatedUnion, anyOf, oneOf)""Failed to convert tool '[toolName]' schema for Gemini".min() instead of .positive() for number constraintsFAQs
LangChain.js support for Google Vertex AI
We found that @langchain/google-vertexai demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.

Security News
Socket CEO Feross Aboukhadijeh joins Insecure Agents to discuss CVE remediation and why supply chain attacks require a different security approach.

Security News
Tailwind Labs laid off 75% of its engineering team after revenue dropped 80%, as LLMs redirect traffic away from documentation where developers discover paid products.