- Google Generative AI (Gemini API & AI Studio): Access Google Gemini models directly via the Gemini API. Use Google AI Studio for rapid prototyping and get started quickly with the
langchain-google-genai
package. This is often the best starting point for individual developers. - Google Cloud (Vertex AI & other services): Access Gemini models, Vertex AI Model Garden and a wide range of cloud services (databases, storage, document AI, etc.) via the Google Cloud Platform. Use the
langchain-google-vertexai
package for Vertex AI models and specific packages (e.g.,langchain-google-cloud-sql-pg
,langchain-google-community
) for other cloud services. This is ideal for developers already using Google Cloud or needing enterprise features like MLOps, specific model tuning or enterprise support.
langchain-google-community
package.
Google Generative AI (Gemini API & AI Studio)
Access Google Gemini models directly using the Gemini API, best suited for rapid development and experimentation. Gemini models are available in Google AI Studio.Chat Models
Use theChatGoogleGenerativeAI
class to interact with Gemini models. See
details in this guide.
image_url
can be a public URL, a GCS URI (gs://...
), a local file path, a base64 encoded image string (data:image/png;base64,...
), or a PIL Image object.
Embedding Models
Generate text embeddings using models likegemini-embedding-001
with the GoogleGenerativeAIEmbeddings
class.
See a usage example.
LLMs
Access the same Gemini models using the (legacy) LLM interface with theGoogleGenerativeAI
class.
See a usage example.
Google Cloud
Access Gemini models, Vertex AI Model Garden and other Google Cloud services via Vertex AI and specific cloud integrations. Vertex AI models require thelangchain-google-vertexai
package. Other services might require additional packages like langchain-google-community
, langchain-google-cloud-sql-pg
, etc.
gcloud auth application-default login
).
Chat Models
Vertex AI
Access chat models like Gemini via the Vertex AI platform. See a usage example.Anthropic on Vertex AI Model Garden
See a usage example.Llama on Vertex AI Model Garden
Mistral on Vertex AI Model Garden
Gemma local from Hugging Face
Local Gemma model loaded from HuggingFace. Requires langchain-google-vertexai
.
Gemma local from Kaggle
Local Gemma model loaded from Kaggle. Requires langchain-google-vertexai
.
Gemma on Vertex AI Model Garden
Requires langchain-google-vertexai
.
Vertex AI image captioning
Implementation of the Image Captioning model as a chat. Requires langchain-google-vertexai
.
Vertex AI image editor
Given an image and a prompt, edit the image. Currently only supports mask-free editing. Requires langchain-google-vertexai
.
Vertex AI image generator
Generates an image from a prompt. Requires langchain-google-vertexai
.
Vertex AI visual QnA
Chat implementation of a visual QnA model. Requires langchain-google-vertexai
.
LLMs
You can also use the (legacy) string-in, string-out LLM interface.Vertex AI Model Garden
Access Gemini, and hundreds of OSS models via Vertex AI Model Garden service. Requireslangchain-google-vertexai
.
See a usage example.
Gemma local from Hugging Face
Local Gemma model loaded from HuggingFace. Requires langchain-google-vertexai
.
Gemma local from Kaggle
Local Gemma model loaded from Kaggle. Requires langchain-google-vertexai
.
Gemma on Vertex AI Model Garden
Requires langchain-google-vertexai
.
Vertex AI image captioning
Implementation of the Image Captioning model as an LLM. Requires langchain-google-vertexai
.
Embedding Models
Vertex AI
Generate embeddings using models deployed on Vertex AI. Requireslangchain-google-vertexai
.
See a usage example.
Document Loaders
Load documents from various Google Cloud sources.AlloyDB for PostgreSQL
Google Cloud AlloyDB is a fully managed PostgreSQL-compatible database service.Install the python package:
BigQuery
Google Cloud BigQuery is a serverless data warehouse.Install with BigQuery dependencies:
Bigtable
Google Cloud Bigtable is a fully managed NoSQL Big Data database service.Install the python package:
Cloud SQL for MySQL
Google Cloud SQL for MySQL is a fully-managed MySQL database service.Install the python package:
Cloud SQL for SQL Server
Google Cloud SQL for SQL Server is a fully-managed SQL Server database service.Install the python package:
Cloud SQL for PostgreSQL
Google Cloud SQL for PostgreSQL is a fully-managed PostgreSQL database service.Install the python package:
Cloud Storage
Cloud Storage is a managed service for storing unstructured data.Install with GCS dependencies:
Cloud Vision loader
Load data using Google Cloud Vision API. Install with Vision dependencies:El Carro for Oracle Workloads
Google El Carro Oracle Operator runs Oracle databases in Kubernetes.Install the python package:
Firestore (Native Mode)
Google Cloud Firestore is a NoSQL document database.Install the python package:
Firestore (Datastore Mode)
Google Cloud Firestore in Datastore mode.Install the python package:
Memorystore for Redis
Google Cloud Memorystore for Redis is a fully managed Redis service.Install the python package:
Spanner
Google Cloud Spanner is a fully managed, globally distributed relational database service.Install the python package:
Speech-to-Text
Google Cloud Speech-to-Text transcribes audio files.Install with Speech-to-Text dependencies:
Document Transformers
Transform documents using Google Cloud services.Document AI
Google Cloud Document AI is a Google Cloud service that transforms unstructured data from documents into structured data, making it easier to understand, analyze, and consume.We need to set up a
GCS
bucket and create your own OCR processor
The GCS_OUTPUT_PATH
should be a path to a folder on GCS (starting with gs://
)
and a processor name should look like projects/PROJECT_NUMBER/locations/LOCATION/processors/PROCESSOR_ID
.
We can get it either programmatically or copy from the Prediction endpoint
section of the Processor details
tab in the Google Cloud Console.
Google Translate
Google Translate is a multilingual neural machine translation service developed by Google to translate text, documents and websites from one language into another.The
GoogleTranslateTransformer
allows you to translate text and HTML with the Google Cloud Translation API.
First, we need to install the langchain-google-community
with translate dependencies.
Vector Stores
Store and search vectors using Google Cloud databases and Vertex AI Vector Search.AlloyDB for PostgreSQL
Google Cloud AlloyDB is a fully managed relational database service that offers high performance, seamless integration, and impressive scalability on Google Cloud. AlloyDB is 100% compatible with PostgreSQL.Install the python package:
BigQuery Vector Search
Google Cloud BigQuery, BigQuery is a serverless and cost-effective enterprise data warehouse in Google Cloud. Google Cloud BigQuery Vector Search BigQuery vector search lets you use GoogleSQL to do semantic search, using vector indexes for fast but approximate results, or using brute force for exact results.
It can calculate Euclidean or Cosine distance. With LangChain, we default to use Euclidean distance.We need to install several python packages.
Memorystore for Redis
Vector store using Memorystore for Redis.Install the python package:
Spanner
Vector store using Cloud Spanner.Install the python package:
Firestore (Native Mode)
Vector store using Firestore.Install the python package:
Cloud SQL for MySQL
Vector store using Cloud SQL for MySQL.Install the python package:
Cloud SQL for PostgreSQL
Vector store using Cloud SQL for PostgreSQL.Install the python package:
Vertex AI Vector Search
Google Cloud Vertex AI Vector Search from Google Cloud,
formerly known as Vertex AI Matching Engine
, provides the industry’s leading high-scale
low latency vector database. These vector databases are commonly
referred to as vector similarity-matching or an approximate nearest neighbor (ANN) service.
Install the python package:
With DataStore Backend
Vector search using Datastore for document storage.See usage example.
With GCS Backend
Alias for VectorSearchVectorStore
storing documents/index in GCS.
Retrievers
Retrieve information using Google Cloud services.Vertex AI Search
Build generative AI powered search engines using Vertex AI Search. from Google Cloud allows developers to quickly build generative AI powered search engines for customers and employees.See a usage example. Note:
GoogleVertexAISearchRetriever
is deprecated. Use the components below from langchain-google-community
.
Install the google-cloud-discoveryengine
package for underlying access.
VertexAIMultiTurnSearchRetriever
VertexAISearchRetriever
VertexAISearchSummaryTool
Document AI Warehouse
Search, store, and manage documents using Document AI Warehouse.Note:
GoogleDocumentAIWarehouseRetriever
(from langchain
) is deprecated. Use DocumentAIWarehouseRetriever
from langchain-google-community
.
Requires installation of relevant Document AI packages (check specific docs).
Tools
Integrate agents with various Google services.Text-to-Speech
Google Cloud Text-to-Speech is a Google Cloud service that enables developers to synthesize natural-sounding speech with 100+ voices, available in multiple languages and variants. It applies DeepMind’s groundbreaking research in WaveNet and Google’s powerful neural networks to deliver the highest fidelity possible.Install required packages:
Google Drive
Tools for interacting with Google Drive. Install required packages:Google Finance
Query financial data. Requiresgoogle-search-results
package and SerpApi key.
Google Jobs
Query job listings. Requiresgoogle-search-results
package and SerpApi key.
Google Lens
Perform visual searches. Requiresgoogle-search-results
package and SerpApi key.
Google Places
Search for places information. Requiresgooglemaps
package and a Google Maps API key.
Google Scholar
Search academic papers. Requiresgoogle-search-results
package and SerpApi key.
Google Search
Perform web searches using Google Custom Search Engine (CSE). RequiresGOOGLE_API_KEY
and GOOGLE_CSE_ID
.
Install langchain-google-community
:
Google Trends
Query Google Trends data. Requiresgoogle-search-results
package and SerpApi key.
Toolkits
Collections of tools for specific Google services.Gmail
Google Gmail is a free email service provided by Google.
This toolkit works with emails through the Gmail API
.
MCP Toolbox
MCP Toolbox provides a simple and efficient way to connect to your databases, including those on Google Cloud like Cloud SQL and AlloyDB. With MCP Toolbox, you can seamlessly integrate your database with LangChain to build powerful, data-driven applications.Installation
To get started, install the Toolbox server and client. Configure atools.yaml
to define your tools, and then execute toolbox to start the server:
Getting Started
Here is a quick example of how to use MCP Toolbox to connect to your database:Memory
Store conversation history using Google Cloud databases.AlloyDB for PostgreSQL
Chat memory using AlloyDB.Install the python package:
Cloud SQL for PostgreSQL
Chat memory using Cloud SQL for PostgreSQL.Install the python package:
Cloud SQL for MySQL
Chat memory using Cloud SQL for MySQL.Install the python package:
Cloud SQL for SQL Server
Chat memory using Cloud SQL for SQL Server.Install the python package:
Spanner
Chat memory using Cloud Spanner.Install the python package:
Memorystore for Redis
Chat memory using Memorystore for Redis.Install the python package:
Bigtable
Chat memory using Cloud Bigtable.Install the python package:
Firestore (Native Mode)
Chat memory using Firestore.Install the python package:
Firestore (Datastore Mode)
Chat memory using Firestore in Datastore mode.Install the python package:
El Carro: The Oracle Operator for Kubernetes
Chat memory using Oracle databases run via El Carro.Install the python package:
Callbacks
Track LLM/Chat model usage.Vertex AI callback handler
Callback Handler that tracks VertexAI
usage info.
Requires langchain-google-vertexai
.
Evaluators
Evaluate model outputs using Vertex AI. Requireslangchain-google-vertexai
.
VertexPairWiseStringEvaluator
Pair-wise evaluation using Vertex AI models.
VertexStringEvaluator
Evaluate a single prediction string using Vertex AI models.
Other Google Products
Integrations with various Google services beyond the core Cloud Platform.Document Loaders
Google Drive
Google Drive file storage. Currently supports Google Docs.Install with Drive dependencies:
Vector Stores
ScaNN (Local Index)
Google ScaNN
(Scalable Nearest Neighbors) is a python package.
ScaNN
is a method for efficient vector similarity search at scale.
ScaNN
includes search space pruning and quantization for Maximum Inner
Product Search and also supports other distance functions such as
Euclidean distance. The implementation is optimized for x86 processors
with AVX2 support. See its Google Research github
for more details.
Install the scann
package:
Retrievers
Google Drive
Retrieve documents from Google Drive. Install required packages:Tools
Google Drive
Tools for interacting with Google Drive. Install required packages:Google Finance
Query financial data. Requiresgoogle-search-results
package and SerpApi key.
Google Jobs
Query job listings. Requiresgoogle-search-results
package and SerpApi key.
Google Lens
Perform visual searches. Requiresgoogle-search-results
package and SerpApi key.
Google Places
Search for places information. Requiresgooglemaps
package and a Google Maps API key.
Google Scholar
Search academic papers. Requiresgoogle-search-results
package and SerpApi key.
Google Search
Perform web searches using Google Custom Search Engine (CSE). RequiresGOOGLE_API_KEY
and GOOGLE_CSE_ID
.
Install langchain-google-community
:
Google Trends
Query Google Trends data. Requiresgoogle-search-results
package and SerpApi key.
Toolkits
Gmail
Google Gmail is a free email service provided by Google.
This toolkit works with emails through the Gmail API
.
Chat Loaders
Gmail
Load chat history from Gmail threads.Install with Gmail dependencies:
3rd Party Integrations
Access Google services via third-party APIs.SearchApi
SearchApi provides API access to Google search, YouTube, etc. Requires langchain-community
.
See usage examples and authorization instructions.
SerpApi
SerpApi provides API access to Google search results. Requires langchain-community
.
See a usage example and authorization instructions.
Serper.dev
Google Serper provides API access to Google search results. Requires langchain-community
.
See a usage example and authorization instructions.
YouTube
YouTube Search Tool
Search YouTube videos without the official API. Requires youtube_search
package.
YouTube Audio Loader
Download audio from YouTube videos. Requiresyt_dlp
, pydub
, librosa
.
YouTube Transcripts Loader
Load video transcripts. Requiresyoutube-transcript-api
.