Skip to main content

Documentation Index

Fetch the complete documentation index at: https://langchain-5e9cc07a-preview-naomid-1779801766-572e290.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

LangChain provides integrations with Google AI Studio and Google Cloud Vertex AI through the @langchain/google package.
Looking for the older @langchain/google-genai or @langchain/google-vertexai packages? They are maintained under long-term support but are no longer recommended for new projects.

Chat models

The ChatGoogle class is the recommended way to access Gemini models (such as gemini-2.5-pro, gemini-2.5-flash, and gemini-3.1-pro-preview) and open models like Gemma. It supports both Google AI Studio and Vertex AI in a single interface
npm install @langchain/google @langchain/core
Configure your API key:
export GOOGLE_API_KEY=your-api-key
import { ChatGoogle } from "@langchain/google";

const model = new ChatGoogle("gemini-2.5-flash");

const res = await model.invoke([
  ["human", "What would be a good company name for a company that makes colorful socks?"],
]);
ChatGoogle supports tool calling, structured output, multimodal inputs (images, audio, video), reasoning/thinking, image generation, text-to-speech, and Gemini-specific native tools like Google Search grounding and code execution.

ChatGoogle

Full chat model documentation, including setup, invocation, streaming, structured output, and more.

Gemini native tools

Google Search, Code Execution, URL Context, Google Maps, File Search, Computer Use, and MCP servers.

Third-party models on Vertex AI

Anthropic Claude models are also available through the Vertex AI platform. See using Claude on Vertex AI for more information about enabling access to the models and the model names to use.

Postgres vector store (Cloud SQL)

The PostgresVectorStore module from the @langchain/google-cloud-sql-pg package provides a way to use CloudSQL for PostgreSQL to store vector embeddings.
npm install @langchain/google-cloud-sql-pg @langchain/core

Legacy packages

The following packages are maintained under long-term support for existing users. New projects should use @langchain/google instead.

@langchain/google-genai

The @langchain/google-genai package provides ChatGoogleGenerativeAI and GoogleGenerativeAIEmbeddings for accessing Gemini models through Google AI Studio. This package is built on a deprecated Google SDK and will not receive new features.
npm install @langchain/google-genai @langchain/core

@langchain/google-vertexai

The @langchain/google-vertexai package provides ChatVertexAI, VertexAIEmbeddings, and VertexAI for Vertex AI on Node.js. It depends on @langchain/google-gauth for authentication. This package is superseded by the Vertex AI support built into @langchain/google for chat.
npm install @langchain/google-vertexai @langchain/core

@langchain/google-vertexai-web

The @langchain/google-vertexai-web package provides the same Vertex AI chat, embedding, and LLM classes for browser and Edge runtimes. Install this package (not @langchain/google-vertexai) when running in web environments. It depends on @langchain/google-webauth.
npm install @langchain/google-vertexai-web @langchain/core
See the Vertex AI chat page for GOOGLE_WEB_CREDENTIALS and web import paths.

@langchain/google-webauth

The @langchain/google-webauth package provides browser and Edge authentication for legacy Vertex AI integrations. It is installed automatically with @langchain/google-vertexai-web—do not install it alongside @langchain/google-gauth. Set service account JSON in GOOGLE_WEB_CREDENTIALS (or the deprecated GOOGLE_VERTEX_AI_WEB_CREDENTIALS). You can also pass apiKey or authOptions to the model constructor, or set the API_KEY environment variable.

@langchain/google-gauth

The @langchain/google-gauth package provides Node.js authentication for legacy Google integrations built on @langchain/google-common. It is installed automatically when you add @langchain/google-vertexai—you typically do not install or import @langchain/google-gauth directly. On Node.js, credentials are resolved in this order:
  1. apiKey passed to the model constructor
  2. authOptions passed to the model constructor
  3. The API_KEY environment variable
  4. Service account JSON at the path in GOOGLE_APPLICATION_CREDENTIALS
  5. Application Default Credentials (for example after gcloud auth application-default login, or on Google Cloud)
Do not use @langchain/google-gauth and @langchain/google-webauth in the same project. The unified @langchain/google package uses google-auth-library directly and does not require @langchain/google-gauth or @langchain/google-webauth.

@langchain/google-cloud-sql-pg

The @langchain/google-cloud-sql-pg package provides PostgresVectorStore and PostgresLoader for Cloud SQL for PostgreSQL. It is separate from the Gemini chat packages above.

@langchain/google-common

The @langchain/google-common package provides shared Gemini client abstractions for legacy integrations such as @langchain/google-vertexai. It does not include authorization code and is not a stand-alone package—do not install or import it directly.
To migrate from @langchain/google-genai or @langchain/google-vertexai to @langchain/google, see the ChatGoogle page for setup instructions. The ChatGoogle class provides equivalent functionality with unified access to both Google AI Studio and Vertex AI.