统一 SDK 与软件包整合从
langchain-google-genai 4.0.0 开始,此软件包使用整合后的 google-genai SDK,并且现在同时支持 Gemini Developer API 和 Vertex AI 后端。langchain-google-vertexai 软件包仍然支持 Vertex AI 平台特定功能(Model Garden、Vector Search、评估服务等)。阅读完整公告和迁移指南。Google Generative AI (Gemini API & Vertex AI)
Google Generative AI (Gemini API & Vertex AI)
通过 Gemini Developer API 或 Vertex AI 访问 Google Gemini 模型。后端会根据你的配置自动选择。
- Gemini Developer API:使用 API 密钥即可快速设置,非常适合个人开发者和快速原型开发
- Vertex AI:提供与 Google Cloud 集成的企业级功能(需要 GCP 项目)
langchain-google-genai 软件包来处理聊天模型、LLM 和嵌入。查看集成。Google Cloud (Vertex AI Platform Services)
Google Cloud (Vertex AI Platform Services)
访问 Gemini 模型之外的 Vertex AI 平台特定服务:Model Garden(Llama、Mistral、Anthropic)、评估服务以及专用视觉模型。使用
langchain-google-vertexai 软件包来访问平台服务,并使用特定软件包(例如 langchain-google-community、langchain-google-cloud-sql-pg)来访问数据库和存储等其他云服务。查看集成。Google 生成式 AI
使用统一的langchain-google-genai 软件包,通过 Gemini Developer API 或 Vertex AI 访问 Google Gemini 模型。
聊天模型
ChatGoogleGenerativeAI
通过 Gemini Developer API 或 Vertex AI 使用 Google Gemini 聊天模型。
LLM
GoogleGenerativeAI
使用(旧版)LLM 文本补全接口的 Gemini 模型。
嵌入模型
GoogleGenerativeAIEmbeddings
通过 Gemini Developer API 或 Vertex AI 使用 Gemini 嵌入模型。
Google Cloud
访问 Vertex AI 平台特定服务,包括 Model Garden(Llama、Mistral、Anthropic)、Vector Search、评估服务和专用视觉模型。对于 Gemini 模型,请使用
langchain-google-genai 中的 ChatGoogleGenerativeAI。下面的类专注于整合后的 SDK 中不可用的 Vertex AI 平台服务。聊天模型
ChatAnthropicVertex
Vertex AI Model Garden 上的 Anthropic
ChatVertexAI (deprecated)
ChatVertexAI (deprecated)
已弃用——对于 Gemini 模型,请改用
ChatGoogleGenerativeAI。VertexModelGardenLlama
VertexModelGardenLlama
Vertex AI Model Garden 上的 Llama
VertexModelGardenMistral
VertexModelGardenMistral
Vertex AI Model Garden 上的 Mistral
GemmaChatLocalHF
GemmaChatLocalHF
从 HuggingFace 加载的本地 Gemma 模型。
GemmaChatLocalKaggle
GemmaChatLocalKaggle
从 Kaggle 加载的本地 Gemma 模型。
GemmaChatVertexAIModelGarden
GemmaChatVertexAIModelGarden
Vertex AI Model Garden 上的 Gemma
VertexAIImageCaptioningChat
VertexAIImageCaptioningChat
作为聊天接口的图像描述生成模型。
VertexAIImageEditorChat
VertexAIImageEditorChat
根据提示词编辑图像。目前仅支持无蒙版编辑。
VertexAIImageGeneratorChat
VertexAIImageGeneratorChat
根据提示词生成图像。
VertexAIVisualQnAChat
VertexAIVisualQnAChat
作为聊天接口的视觉问答模型。
LLM
(旧版)字符串输入、字符串输出的 LLM 接口。VertexAIModelGarden
通过 Vertex AI Model Garden 使用数百个 OSS 模型。
VertexAI (deprecated)
VertexAI (deprecated)
已弃用——对于 Gemini 模型,请改用
GoogleGenerativeAI。Gemma local from Hugging Face
Gemma local from Hugging Face
从 HuggingFace 加载的本地 Gemma 模型。
Gemma local from Kaggle
Gemma local from Kaggle
从 Kaggle 加载的本地 Gemma 模型。
Gemma on Vertex AI Model Garden
Gemma on Vertex AI Model Garden
Vertex AI image captioning
Vertex AI image captioning
作为 LLM 接口的图像描述生成模型。
嵌入模型
VertexAIEmbeddings (deprecated)
VertexAIEmbeddings (deprecated)
已弃用——请改用
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 (directory)
从 GCS 存储桶目录加载文档。
Cloud Storage (file)
从 GCS 加载单个文档。
El Carro for Oracle Workloads
通过 El Carro 在 Kubernetes 上运行 Oracle 数据库。
Firestore (Native Mode)
NoSQL 文档数据库。
Firestore (Datastore Mode)
Datastore 模式下的 Firestore。
Memorystore for Redis
托管式 Redis 服务。
Spanner
全球分布式关系型数据库。
Speech-to-Text
转录音频文件。
Cloud Vision loader
Cloud Vision loader
使用 Google Cloud Vision API 加载数据。
文档转换器
Document AI
从非结构化文档中提取结构化数据。
Google Translate
通过 Cloud Translation API 翻译文本和 HTML。
向量存储
使用 Google Cloud 数据库和 Vertex AI Vector Search 存储并搜索向量。AlloyDB for PostgreSQL
AlloyDB 上兼容 PostgreSQL 的向量存储。
BigQuery Vector Search
使用带有向量索引的 GoogleSQL 进行语义搜索。
Memorystore for Redis
Memorystore for Redis 上的向量存储。
Spanner
Cloud Spanner 上的向量存储。
Bigtable
Cloud Bigtable 上的向量存储。
Firestore (Native Mode)
Firestore 上的向量存储。
Cloud SQL for MySQL
Cloud SQL for MySQL 上的向量存储。
Cloud SQL for PostgreSQL
Cloud SQL for PostgreSQL 上的向量存储。
Vertex AI Vector Search
以前称为 Vertex AI Matching Engine,提供低延迟向量数据库。这类向量数据库通常被称为向量相似度匹配或近似最近邻(ANN)服务。
Vertex AI Vector Search + Datastore
结合 Datastore 进行文档存储的向量搜索。
检索器
Vertex AI Search
通过 Vertex AI Search 使用生成式 AI 驱动的搜索。
Document AI Warehouse
使用 Document AI Warehouse 搜索、存储和管理文档。
Other retrievers
工具
将智能体与各种 Google Cloud 服务集成。Text-to-Speech
使用 100 多种语音合成自然流畅的语音。
回调
跟踪 LLM/聊天模型的使用情况。Vertex AI callback handler
Vertex AI callback handler
跟踪
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。
检索器
Google Drive
从 Google Drive 检索文档。
工具
Google Search
通过 Google Custom Search Engine(CSE)进行网页搜索。
Google Drive
与 Google Drive 交互。
MCP
MCP Toolbox
连接到包括 Cloud SQL 和 AlloyDB 在内的数据库。
工具包
Gmail
通过 Gmail API 创建、搜索和发送电子邮件。
第三方集成
通过非官方第三方 API 访问 Google 服务。搜索
cloro
支持 AI Overview 的 Google 搜索结果。
Connect these docs to Claude, VSCode, and more via MCP for real-time answers.

