Skip to main content
This page provides a quick overview for getting started with VertexAI chat models. For detailed documentation of all ChatVertexAI features and configurations head to the API reference. ChatVertexAI exposes all foundational models available in Google Cloud, like gemini-2.5-pro, gemini-2.5-flash, etc. For a full and updated list of available models visit VertexAI documentation.
Google Cloud VertexAI vs Google PaLMThe Google Cloud VertexAI integration is separate from the Google PaLM integration. Google has chosen to offer an enterprise version of PaLM through GCP, and this supports the models made available through there.

Overview

Integration details

Model features

Setup

To access VertexAI models you’ll need to create a Google Cloud Platform account, set up credentials, and install the langchain-google-vertexai integration package.

Credentials

To use the integration you must either:
  • Have credentials configured for your environment (gcloud, workload identity, etc…)
  • Store the path to a service account JSON file as the GOOGLE_APPLICATION_CREDENTIALS environment variable
This codebase uses the google.auth library which first looks for the application credentials variable mentioned above, and then looks for system-level auth. For more information, see: To enable automated tracing of your model calls, set your LangSmith API key:

Installation

The LangChain VertexAI integration lives in the langchain-google-vertexai package:

Instantiation

Now we can instantiate our model object and generate chat completions:

Invocation

Built-in tools

Gemini supports a range of tools that are executed server-side.
Requires langchain-google-vertexai>=2.0.11
Gemini can execute a Google search and use the results to ground its responses:

Code execution

Requires langchain-google-vertexai>=2.0.25
Gemini can generate and execute Python code:

Chaining

We can chain our model with a prompt template like so:

API reference

For detailed documentation of all ChatVertexAI features and configurations, like how to send multimodal inputs and configure safety settings, head to the API reference: python.langchain.com/api_reference/google_vertexai/chat_models/langchain_google_vertexai.chat_models.ChatVertexAI.html