LangChain Google Gen AI integration.
As of langchain-google-genai 4.0.0, this package uses the consolidated
google-genai SDK
instead of the legacy google-ai-generativelanguage
SDK.
This migration brings support for Gemini models both via the Gemini API and Gemini
API in Vertex AI, superseding certain classes in langchain-google-vertexai, such
as ChatVertexAI. Certain Vertex AI features are not yet supported in the
consolidated SDK (and subsequently this package) Refer to the docs
for more information.
This module provides an interface to Google's Generative AI models, specifically the Gemini series, with the LangChain framework. It provides classes for interacting with chat models, generating embeddings, and more.
Chat Models
The ChatGoogleGenerativeAI class is
the primary interface for interacting with Google's Gemini chat models. It allows users
to send and receive messages using a specified Gemini model, suitable for various
conversational AI applications.
Embeddings
The
GoogleGenerativeAIEmbeddings
class provides functionalities to generate embeddings using Google's models. These
embeddings can be used for a range of NLP tasks, including semantic analysis, similarity
comparisons, and more.
See the docs for more information on usage of this package.
Google GenAI chat model integration.
Google Generative AI Embeddings.
Google GenerativeAI text completion large language models (legacy LLMs).
from langchain_google_genai import GoogleGenerativeAI
llm = GoogleGenerativeAI(model="gemini-2.5-pro")