统一 SDK 与包整合自
langchain-google-genai 4.0.0 起,此包使用整合后的 google-genai SDK,现在同时支持 Gemini 开发者 API 和 Vertex AI 后端。langchain-google-vertexai 包仍然支持 Vertex AI 平台特定功能(模型花园、向量搜索、评估服务等)。阅读完整公告和迁移指南。Google Generative AI (Gemini API & Vertex AI)
Google Generative AI (Gemini API & Vertex AI)
通过 Gemini 开发者 API 或 Vertex AI 访问 Google Gemini 模型。后端会根据您的配置自动选择。
- Gemini 开发者 API:使用 API 密钥快速设置,适合个人开发者和快速原型开发
- Vertex AI:具有 Google Cloud 集成的企业功能(需要 GCP 项目)
langchain-google-genai 包进行聊天模型、LLM 和嵌入。查看集成。Google Cloud (Vertex AI 平台服务)
Google Cloud (Vertex AI 平台服务)
访问 Gemini 模型之外的 Vertex AI 平台特定服务:模型花园(Llama、Mistral、Anthropic)、评估服务和专用视觉模型。使用
langchain-google-vertexai 包进行平台服务,使用特定包(例如 langchain-google-community、langchain-google-cloud-sql-pg)进行其他云服务(如数据库和存储)。查看集成。Google Generative AI
使用统一的langchain-google-genai 包,通过 Gemini 开发者 API 或 Vertex AI 访问 Google Gemini 模型。
聊天模型
ChatGoogleGenerativeAI
通过 Gemini 开发者 API 或 Vertex AI 的 Google Gemini 聊天模型。
LLM
GoogleGenerativeAI
使用(旧版)LLM 文本补全接口的 Gemini 模型。
嵌入模型
GoogleGenerativeAIEmbeddings
通过 Gemini 开发者 API 或 Vertex AI 的 Gemini 嵌入模型。
Google Cloud
访问 Vertex AI 平台特定服务,包括模型花园(Llama、Mistral、Anthropic)、向量搜索、评估服务和专用视觉模型。对于 Gemini 模型,请使用
langchain-google-genai 中的 ChatGoogleGenerativeAI。以下类专注于统一 SDK 中不可用的 Vertex AI 平台服务。聊天模型
ChatAnthropicVertex
Vertex AI 模型花园上的 Anthropic
ChatVertexAI (已弃用)
ChatVertexAI (已弃用)
已弃用—请改用
ChatGoogleGenerativeAI 处理 Gemini 模型。VertexModelGardenLlama
VertexModelGardenLlama
Vertex AI 模型花园上的 Llama
VertexModelGardenMistral
VertexModelGardenMistral
Vertex AI 模型花园上的 Mistral
GemmaChatLocalHF
GemmaChatLocalHF
从 HuggingFace 加载的本地 Gemma 模型。
GemmaChatLocalKaggle
GemmaChatLocalKaggle
从 Kaggle 加载的本地 Gemma 模型。
GemmaChatVertexAIModelGarden
GemmaChatVertexAIModelGarden
Vertex AI 模型花园上的 Gemma
VertexAIImageCaptioningChat
VertexAIImageCaptioningChat
作为聊天接口的图像描述模型。
VertexAIImageEditorChat
VertexAIImageEditorChat
根据提示编辑图像。目前仅支持无遮罩编辑。
VertexAIImageGeneratorChat
VertexAIImageGeneratorChat
根据提示生成图像。
VertexAIVisualQnAChat
VertexAIVisualQnAChat
作为聊天接口的视觉问答模型。
LLM
(旧版)字符串输入、字符串输出的 LLM 接口。VertexAIModelGarden
通过 Vertex AI 模型花园访问数百个开源模型。
VertexAI (已弃用)
VertexAI (已弃用)
已弃用—请改用
GoogleGenerativeAI 处理 Gemini 模型。Gemma 本地版(来自 Hugging Face)
Gemma 本地版(来自 Hugging Face)
从 HuggingFace 加载的本地 Gemma 模型。
Gemma 本地版(来自 Kaggle)
Gemma 本地版(来自 Kaggle)
从 Kaggle 加载的本地 Gemma 模型。
Vertex AI 模型花园上的 Gemma
Vertex AI 模型花园上的 Gemma
Vertex AI 图像描述
Vertex AI 图像描述
作为 LLM 接口的图像描述模型。
嵌入模型
VertexAIEmbeddings (已弃用)
VertexAIEmbeddings (已弃用)
已弃用—请改用
GoogleGenerativeAIEmbeddings。文档加载器
AlloyDB for PostgreSQL
Google Cloud 上的 PostgreSQL 兼容数据库。
BigQuery
无服务器数据仓库。
Bigtable
用于结构化和半结构化数据的键值和宽列存储。
Cloud SQL for MySQL
托管 MySQL 数据库。
Cloud SQL for SQL Server
托管 SQL Server 数据库。
Cloud SQL for PostgreSQL
托管 PostgreSQL 数据库。
Cloud Storage (目录)
从 GCS 存储桶目录加载文档。
Cloud Storage (文件)
从 GCS 加载单个文档。
El Carro for Oracle Workloads
通过 El Carro 在 Kubernetes 上运行 Oracle 数据库。
Firestore (原生模式)
NoSQL 文档数据库。
Firestore (Datastore 模式)
Datastore 模式下的 Firestore。
Memorystore for Redis
托管 Redis 服务。
Spanner
全球分布式的关系型数据库。
Speech-to-Text
转录音频文件。
Cloud Vision 加载器
Cloud Vision 加载器
使用 Google Cloud Vision API 加载数据。
文档转换器
Document AI
从非结构化文档中提取结构化数据。
Google Translate
通过 Cloud Translation API 翻译文本和 HTML。
向量存储
使用 Google Cloud 数据库和 Vertex AI 向量搜索存储和搜索向量。AlloyDB for PostgreSQL
AlloyDB 上的 PostgreSQL 兼容向量存储。
BigQuery 向量搜索
使用带有向量索引的 GoogleSQL 进行语义搜索。
Memorystore for Redis
Memorystore for Redis 上的向量存储。
Spanner
Cloud Spanner 上的向量存储。
Bigtable
Cloud Bigtable 上的向量存储。
Firestore (原生模式)
Firestore 上的向量存储。
Cloud SQL for MySQL
Cloud SQL for MySQL 上的向量存储。
Cloud SQL for PostgreSQL
Cloud SQL for PostgreSQL 上的向量存储。
Vertex AI 向量搜索
前身为 Vertex AI Matching Engine,提供低延迟向量数据库。这些向量数据库通常被称为向量相似性匹配或近似最近邻 (ANN) 服务。
Vertex AI 向量搜索 + Datastore
使用 Datastore 进行文档存储的向量搜索。
检索器
Vertex AI Search
通过 Vertex AI Search 进行生成式 AI 搜索。
Document AI Warehouse
使用 Document AI Warehouse 搜索、存储和管理文档。
其他检索器
工具
将代理与各种 Google Cloud 服务集成。Text-to-Speech
使用 100 多种声音合成自然语音。
回调
跟踪 LLM/聊天模型使用情况。Vertex AI 回调处理器
Vertex AI 回调处理器
跟踪
VertexAI 使用信息。Google BigQuery
Google BigQuery
有关更多详情,请参阅文档。
评估器
使用 Vertex AI 评估模型输出。VertexPairWiseStringEvaluator
VertexPairWiseStringEvaluator
使用 Vertex AI 模型进行成对评估。
VertexStringEvaluator
VertexStringEvaluator
使用 Vertex AI 模型进行单次预测评估。
其他 Google 产品
与核心 Cloud Platform 之外的各种 Google 服务的集成。文档加载器
Google Drive
从 Google Drive 加载文件。目前支持 Google Docs。
向量存储
ScaNN (本地索引)
大规模高效本地向量相似性搜索。
检索器
Google Drive
从 Google Drive 检索文档。
工具
Google Search
通过 Google 自定义搜索引擎 (CSE) 进行网络搜索。
Google Drive
与 Google Drive 交互。
Google Finance
查询财务数据。
Google Jobs
查询职位列表。
Google Lens
视觉搜索。
Google Places
搜索地点。
Google Scholar
搜索学术论文。
Google Trends
查询 Google Trends 数据。
MCP
MCP Toolbox
连接到包括 Cloud SQL 和 AlloyDB 在内的数据库。
工具包
Gmail
通过 Gmail API 创建、搜索和发送电子邮件。
聊天加载器
Gmail
从 Gmail 线程加载聊天历史记录。
第三方集成
通过非官方第三方 API 访问 Google 服务。搜索
SearchApi
API 访问 Google 搜索结果、YouTube 等。
SerpApi
API 访问 Google 搜索结果。
Serper.dev
API 访问 Google 搜索结果。
cloro
支持 AI 概览的 Google 搜索结果。
YouTube
搜索工具
无需官方 API 即可搜索 YouTube 视频。
音频加载器
从 YouTube 视频下载音频。
字幕加载器
加载视频字幕。
将这些文档 通过 MCP 连接到 Claude、VSCode 等,以获取实时答案。

