所有与 Google Cloud Platform 及其他 Google 产品相关的功能。
Gemini 模型和 VertexAI 平台的集成包在 langchain-google 仓库中维护。您可以在 googleapis Github 组织中找到大量 LangChain 与其他 Google API 的集成。
聊天模型
我们建议个人开发者从 Gemini API (langchain-google-genai) 开始,并在需要商业支持和更高速率限制时迁移到 Vertex AI (langchain-google-vertexai)。如果您已经熟悉或原生于云环境,那么您可以直接开始使用 Vertex AI。请参阅此处了解更多信息。
Google Generative AI
通过 ChatGoogleGenerativeAI 类访问 GoogleAI Gemini 模型,例如 gemini-pro 和 gemini-pro-vision。
pip install -U langchain-google-genai
配置您的 API 密钥。
export GOOGLE_API_KEY=your-api-key
from langchain_google_genai import ChatGoogleGenerativeAI
llm = ChatGoogleGenerativeAI(model="gemini-pro")
llm.invoke("Sing a ballad of LangChain.")
Gemini 视觉模型在提供单条聊天消息时支持图像输入。
from langchain_core.messages import HumanMessage
from langchain_google_genai import ChatGoogleGenerativeAI
llm = ChatGoogleGenerativeAI(model="gemini-pro-vision")
message = HumanMessage(
content=[
{
"type": "text",
"text": "What's in this image?",
}, # You can optionally provide text parts
{"type": "image_url", "image_url": "https://picsum.photos/seed/picsum/200/300"},
]
)
llm.invoke([message])
image_url 的值可以是以下任何一种
- 一个公共图像 URL
- 一个 gcs 文件(例如,“gcs://path/to/file.png”)
- 一个本地文件路径
- 一个 base64 编码的图像(例如,data:image/png;base64,abcd124)
- 一个 PIL 图像
Vertex AI
通过 Google Cloud 访问 Gemini 等聊天模型。
我们需要安装 langchain-google-vertexai python 包。
pip install langchain-google-vertexai
请参阅使用示例。
from langchain_google_vertexai import ChatVertexAI
Vertex AI Model Garden 上的 Anthropic
请参阅使用示例。
from langchain_google_vertexai.model_garden import ChatAnthropicVertex
Vertex AI Model Garden 上的 Llama
from langchain_google_vertexai.model_garden_maas.llama import VertexModelGardenLlama
Vertex AI Model Garden 上的 Mistral
from langchain_google_vertexai.model_garden_maas.mistral import VertexModelGardenMistral
来自 Hugging Face 的本地 Gemma
从 HuggingFace 加载的本地 Gemma 模型。
我们需要安装 langchain-google-vertexai python 包。
pip install langchain-google-vertexai
from langchain_google_vertexai.gemma import GemmaChatLocalHF
来自 Kaggle 的本地 Gemma
从 Kaggle 加载的本地 Gemma 模型。
我们需要安装 langchain-google-vertexai python 包。
pip install langchain-google-vertexai
from langchain_google_vertexai.gemma import GemmaChatLocalKaggle
Vertex AI Model Garden 上的 Gemma
我们需要安装 langchain-google-vertexai python 包。
pip install langchain-google-vertexai
from langchain_google_vertexai.gemma import GemmaChatVertexAIModelGarden
Vertex AI 图像描述
将图像描述模型作为聊天模型的实现。
我们需要安装 langchain-google-vertexai python 包。
pip install langchain-google-vertexai
from langchain_google_vertexai.vision_models import VertexAIImageCaptioningChat
Vertex AI 图像编辑器
给定图像和提示,编辑图像。目前仅支持无掩码编辑。
我们需要安装 langchain-google-vertexai python 包。
pip install langchain-google-vertexai
from langchain_google_vertexai.vision_models import VertexAIImageEditorChat
Vertex AI 图像生成器
根据提示生成图像。
我们需要安装 langchain-google-vertexai python 包。
pip install langchain-google-vertexai
from langchain_google_vertexai.vision_models import VertexAIImageGeneratorChat
Vertex AI 视觉问答
视觉问答模型的聊天实现
我们需要安装 langchain-google-vertexai python 包。
pip install langchain-google-vertexai
from langchain_google_vertexai.vision_models import VertexAIVisualQnAChat
LLMs
Google Generative AI
通过 GoogleGenerativeAI 类访问 GoogleAI Gemini 模型,例如 gemini-pro 和 gemini-pro-vision。
安装 python 包。
pip install langchain-google-genai
请参阅使用示例。
from langchain_google_genai import GoogleGenerativeAI
Vertex AI Model Garden
通过 Vertex AI Model Garden 服务访问 PaLM 和数百个 OSS 模型。
我们需要安装 langchain-google-vertexai python 包。
pip install langchain-google-vertexai
请参阅使用示例。
from langchain_google_vertexai import VertexAIModelGarden
来自 Hugging Face 的本地 Gemma
从 HuggingFace 加载的本地 Gemma 模型。
我们需要安装 langchain-google-vertexai python 包。
pip install langchain-google-vertexai
from langchain_google_vertexai.gemma import GemmaLocalHF
来自 Kaggle 的本地 Gemma
从 Kaggle 加载的本地 Gemma 模型。
我们需要安装 langchain-google-vertexai python 包。
pip install langchain-google-vertexai
from langchain_google_vertexai.gemma import GemmaLocalKaggle
Vertex AI Model Garden 上的 Gemma
我们需要安装 langchain-google-vertexai python 包。
pip install langchain-google-vertexai
from langchain_google_vertexai.gemma import GemmaVertexAIModelGarden
Vertex AI 图像描述
将图像描述模型作为 LLM 的实现。
我们需要安装 langchain-google-vertexai python 包。
pip install langchain-google-vertexai
from langchain_google_vertexai.vision_models import VertexAIImageCaptioning
嵌入模型
Google Generative AI 嵌入
请参阅使用示例。
pip install -U langchain-google-genai
配置您的 API 密钥。
export GOOGLE_API_KEY=your-api-key
from langchain_google_genai import GoogleGenerativeAIEmbeddings
Google Generative AI 服务器端嵌入
安装 python 包
pip install langchain-google-genai
from langchain_google_genai.google_vector_store import ServerSideEmbedding
Vertex AI
我们需要安装 langchain-google-vertexai python 包。
pip install langchain-google-vertexai
请参阅使用示例。
from langchain_google_vertexai import VertexAIEmbeddings
Palm 嵌入
我们需要安装 langchain-community python 包。
pip install langchain-community
from langchain_community.embeddings.google_palm import GooglePalmEmbeddings
文档加载器
AlloyDB for PostgreSQL
Google Cloud AlloyDB 是一种完全托管的关系数据库服务,在 Google Cloud 上提供高性能、无缝集成和出色的可扩展性。AlloyDB 与 PostgreSQL 100% 兼容。
安装 python 包
pip install langchain-google-alloydb-pg
请参阅使用示例。
from langchain_google_alloydb_pg import AlloyDBEngine, AlloyDBLoader
BigQuery
Google Cloud BigQuery 是一种无服务器且经济高效的企业数据仓库,可在云端运行,并可在 Google Cloud 中随着您的数据扩展。
我们需要安装带有 BigQuery 依赖项的 langchain-google-community
pip install langchain-google-community[bigquery]
请参阅使用示例。
from langchain_google_community import BigQueryLoader
Bigtable
Google Cloud Bigtable 是 Google 在 Google Cloud 中完全托管的 NoSQL 大数据数据库服务。
安装 python 包
pip install langchain-google-bigtable
请参阅 Google Cloud 使用示例。
from langchain_google_bigtable import BigtableLoader
Cloud SQL for MySQL
Google Cloud SQL for MySQL 是一种完全托管的数据库服务,可帮助您在 Google Cloud 上设置、维护、管理和管理 MySQL 关系数据库。
安装 python 包
pip install langchain-google-cloud-sql-mysql
请参阅使用示例。
from langchain_google_cloud_sql_mysql import MySQLEngine, MySQLLoader
Cloud SQL for SQL Server
Google Cloud SQL for SQL Server 是一种完全托管的数据库服务,可帮助您在 Google Cloud 上设置、维护、管理和管理 SQL Server 数据库。
安装 python 包
pip install langchain-google-cloud-sql-mssql
请参阅使用示例。
from langchain_google_cloud_sql_mssql import MSSQLEngine, MSSQLLoader
Cloud SQL for PostgreSQL
Google Cloud SQL for PostgreSQL 是一种完全托管的数据库服务,可帮助您在 Google Cloud 上设置、维护、管理和管理 PostgreSQL 关系数据库。
安装 python 包
pip install langchain-google-cloud-sql-pg
请参阅使用示例。
from langchain_google_cloud_sql_pg import PostgresEngine, PostgresLoader
Cloud Storage
Cloud Storage 是一种用于在 Google Cloud 中存储非结构化数据的托管服务。
我们需要安装带有 Google Cloud Storage 依赖项的 langchain-google-community。
pip install langchain-google-community[gcs]
Google Cloud Storage 有两个加载器:Directory 和 File 加载器。
请参阅使用示例。
from langchain_google_community import GCSDirectoryLoader
请参阅使用示例。
from langchain_google_community import GCSFileLoader
Cloud Vision 加载器
安装 python 包
pip install langchain-google-community[vision]
from langchain_google_community.vision import CloudVisionLoader
El Carro for Oracle Workloads
Google El Carro Oracle Operator 提供了一种在 Kubernetes 中运行 Oracle 数据库的方法,作为一个可移植、开源、社区驱动、无厂商锁定的容器编排系统。
pip install langchain-google-el-carro
请参阅使用示例。
from langchain_google_el_carro import ElCarroLoader
Google Drive
Google Drive 是 Google 开发的文件存储和同步服务。
目前,仅支持 Google Docs
。
我们需要安装带有 Google Drive 依赖项的 langchain-google-community
。
pip install langchain-google-community[drive]
请参阅使用示例和授权说明。
from langchain_google_community import GoogleDriveLoader
Firestore (原生模式)
Google Cloud Firestore 是一个 NoSQL 文档数据库,专为自动扩展、高性能和易于应用程序开发而构建。
安装 python 包
pip install langchain-google-firestore
请参阅使用示例。
from langchain_google_firestore import FirestoreLoader
Firestore (Datastore 模式)
Google Cloud Firestore in Datastore mode 是一个 NoSQL 文档数据库,专为自动扩展、高性能和易于应用程序开发而构建。Firestore 是 Datastore 的最新版本,并引入了多项改进。
安装 python 包
pip install langchain-google-datastore
请参阅使用示例。
from langchain_google_datastore import DatastoreLoader
Memorystore for Redis
Google Cloud Memorystore for Redis 是 Google Cloud 的完全托管的 Redis 服务。在 Google Cloud 上运行的应用程序可以通过利用高度可扩展、可用、安全的 Redis 服务来实现极致性能,而无需承担管理复杂 Redis 部署的负担。
安装 python 包
pip install langchain-google-memorystore-redis
请参阅使用示例。
from langchain_google_memorystore_redis import MemorystoreDocumentLoader
Spanner
Google Cloud Spanner 是 Google Cloud 上完全托管的关键任务关系数据库服务,可在全球范围内提供事务一致性、自动同步复制以实现高可用性,并支持两种 SQL 方言:GoogleSQL(带有扩展的 ANSI 2011)和 PostgreSQL。
安装 python 包
pip install langchain-google-spanner
请参阅使用示例。
from langchain_google_spanner import SpannerLoader
Speech-to-Text
Google Cloud Speech-to-Text 是由 Google Cloud 中 Google 语音识别模型驱动的音频转录 API。
此文档加载器转录音频文件并将文本结果输出为文档。
首先,我们需要安装带有语音转文本依赖项的 langchain-google-community
。
pip install langchain-google-community[speech]
请参阅使用示例和授权说明。
from langchain_google_community import SpeechToTextLoader
文档转换器
Document AI
Google Cloud Document AI 是一项 Google Cloud 服务,可将文档中的非结构化数据转换为结构化数据,从而更易于理解、分析和使用。
我们需要设置一个 GCS
存储桶并创建您自己的 OCR 处理器。GCS_OUTPUT_PATH
应该是一个 GCS 上的文件夹路径(以 gs://
开头),处理器名称应类似于 projects/PROJECT_NUMBER/locations/LOCATION/processors/PROCESSOR_ID
。我们可以通过编程方式获取它,也可以从 Google Cloud Console 中“处理器详细信息”选项卡的“Prediction endpoint
”部分复制它。
pip install langchain-google-community[docai]
请参阅使用示例。
from langchain_core.document_loaders.blob_loaders import Blob
from langchain_google_community import DocAIParser
Google 翻译
Google 翻译 是 Google 开发的一种多语言神经机器翻译服务,用于将文本、文档和网站从一种语言翻译成另一种语言。
GoogleTranslateTransformer
允许您使用 Google Cloud Translation API 翻译文本和 HTML。
首先,我们需要安装带有翻译依赖项的 langchain-google-community
。
pip install langchain-google-community[translate]
请参阅使用示例和授权说明。
from langchain_google_community import GoogleTranslateTransformer
向量存储
AlloyDB for PostgreSQL
Google Cloud AlloyDB 是一种完全托管的关系数据库服务,在 Google Cloud 上提供高性能、无缝集成和出色的可扩展性。AlloyDB 与 PostgreSQL 100% 兼容。
安装 python 包
pip install langchain-google-alloydb-pg
请参阅使用示例。
from langchain_google_alloydb_pg import AlloyDBEngine, AlloyDBVectorStore
BigQuery Vector Search
Google Cloud BigQuery,BigQuery 是 Google Cloud 中一种无服务器且经济高效的企业数据仓库。
Google Cloud BigQuery Vector Search BigQuery 向量搜索允许您使用 GoogleSQL 进行语义搜索,使用向量索引以获得快速但近似的结果,或使用暴力搜索以获得精确的结果。
它可以计算欧几里得距离或余弦距离。在 LangChain 中,我们默认使用欧几里得距离。
我们需要安装几个 python 包。
pip install google-cloud-bigquery
请参阅使用示例。
from langchain.vectorstores import BigQueryVectorSearch
Memorystore for Redis
Google Cloud Memorystore for Redis 是 Google Cloud 的完全托管的 Redis 服务。在 Google Cloud 上运行的应用程序可以通过利用高度可扩展、可用、安全的 Redis 服务来实现极致性能,而无需承担管理复杂 Redis 部署的负担。
安装 python 包
pip install langchain-google-memorystore-redis
请参阅使用示例。
from langchain_google_memorystore_redis import RedisVectorStore
Spanner
Google Cloud Spanner 是 Google Cloud 上完全托管的关键任务关系数据库服务,可在全球范围内提供事务一致性、自动同步复制以实现高可用性,并支持两种 SQL 方言:GoogleSQL(带有扩展的 ANSI 2011)和 PostgreSQL。
安装 python 包
pip install langchain-google-spanner
请参阅使用示例。
from langchain_google_spanner import SpannerVectorStore
Firestore (原生模式)
Google Cloud Firestore 是一个 NoSQL 文档数据库,专为自动扩展、高性能和易于应用程序开发而构建。
安装 python 包
pip install langchain-google-firestore
请参阅使用示例。
from langchain_google_firestore import FirestoreVectorStore
Cloud SQL for MySQL
Google Cloud SQL for MySQL 是一种完全托管的数据库服务,可帮助您在 Google Cloud 上设置、维护、管理和管理 MySQL 关系数据库。
安装 python 包
pip install langchain-google-cloud-sql-mysql
请参阅使用示例。
from langchain_google_cloud_sql_mysql import MySQLEngine, MySQLVectorStore
Cloud SQL for PostgreSQL
Google Cloud SQL for PostgreSQL 是一种完全托管的数据库服务,可帮助您在 Google Cloud 上设置、维护、管理和管理 PostgreSQL 关系数据库。
安装 python 包
pip install langchain-google-cloud-sql-pg
请参阅使用示例。
from langchain_google_cloud_sql_pg import PostgresEngine, PostgresVectorStore
Vertex AI Vector Search
Google Cloud Vertex AI Vector Search 来自 Google Cloud,以前称为
Vertex AI Matching Engine
,提供业界领先的高规模低延迟向量数据库。这些向量数据库通常被称为向量相似度匹配或近似最近邻 (ANN) 服务。
安装 python 包
pip install langchain-google-vertexai
请参阅使用示例。
from langchain_google_vertexai import VectorSearchVectorStore
Vertex AI Vector Search with DataStore
带有 DatasTore 文档存储的 VectorSearch。
安装 python 包
pip install langchain-google-vertexai
请参阅使用示例。
from langchain_google_vertexai import VectorSearchVectorStoreDatastore
VectorSearchVectorStoreGCS
VectorSearchVectorStore
的别名,与具有不同文档存储后端的其余向量存储保持一致。
安装 python 包
pip install langchain-google-vertexai
from langchain_google_vertexai import VectorSearchVectorStoreGCS
Google Generative AI Vector Store
目前,它在服务器端计算嵌入向量。有关更多信息,请访问 指南。
安装 python 包
pip install langchain-google-genai
from langchain_google_genai.google_vector_store import GoogleVectorStore
ScaNN
Google ScaNN (Scalable Nearest Neighbors) 是一个 python 包。
ScaNN
是一种用于大规模高效向量相似性搜索的方法。
ScaNN
包括用于最大内积搜索的搜索空间剪枝和量化,并且还支持其他距离函数,例如欧几里得距离。该实现针对具有 AVX2 支持的 x86 处理器进行了优化。有关更多详细信息,请参阅其 Google Research github。
我们需要安装 scann
python 包。
pip install scann
请参阅使用示例。
from langchain_community.vectorstores import ScaNN
检索器
Google Drive
我们需要安装几个 python 包。
pip install google-api-python-client google-auth-httplib2 google-auth-oauthlib langchain-googledrive
请参阅使用示例和授权说明。
from langchain_googledrive.retrievers import GoogleDriveRetriever
Vertex AI Search
Vertex AI Search 来自 Google Cloud,允许开发人员为客户和员工快速构建由生成式 AI 驱动的搜索引擎。
请参阅使用示例。
注意:GoogleVertexAISearchRetriever
已弃用,请使用 VertexAIMultiTurnSearchRetriever
、VertexAISearchSummaryTool
和 VertexAISearchRetriever
(见下文)。
GoogleVertexAISearchRetriever
我们需要安装 google-cloud-discoveryengine
python 包。
pip install google-cloud-discoveryengine
from langchain_community.retrievers import GoogleVertexAISearchRetriever
VertexAIMultiTurnSearchRetriever
from langchain_google_community import VertexAIMultiTurnSearchRetriever
VertexAISearchRetriever
from langchain_google_community import VertexAIMultiTurnSearchRetriever
VertexAISearchSummaryTool
from langchain_google_community import VertexAISearchSummaryTool
Document AI Warehouse
Document AI Warehouse 来自 Google Cloud,允许企业在单个平台上搜索、存储、管理和治理文档及其 AI 提取的数据和元数据。
注意:GoogleDocumentAIWarehouseRetriever
已弃用,请使用 DocumentAIWarehouseRetriever
(见下文)。
from langchain.retrievers import GoogleDocumentAIWarehouseRetriever
docai_wh_retriever = GoogleDocumentAIWarehouseRetriever(
project_number=...
)
query = ...
documents = docai_wh_retriever.invoke(
query, user_ldap=...
)
from langchain_google_community.documentai_warehouse import DocumentAIWarehouseRetriever
工具
Text-to-Speech
Google Cloud Text-to-Speech 是一项 Google Cloud 服务,使开发人员能够合成自然发音的语音,具有 100 多种声音,并提供多种语言和变体。它应用了 DeepMind 在 WaveNet 中的突破性研究和 Google 强大的神经网络,以提供尽可能高的保真度。
我们需要安装 python 包。
pip install google-cloud-text-to-speech langchain-google-community
请参阅使用示例和授权说明。
from langchain_google_community import TextToSpeechTool
Google Drive
我们需要安装几个 python 包。
pip install google-api-python-client google-auth-httplib2 google-auth-oauthlib
pip install langchain-googledrive
请参阅使用示例和授权说明。
from langchain_googledrive.utilities.google_drive import GoogleDriveAPIWrapper
from langchain_googledrive.tools.google_drive.tool import GoogleDriveSearchTool
Google Finance
我们需要安装一个 python 包。
pip install google-search-results
请参阅使用示例和授权说明。
from langchain_community.tools.google_finance import GoogleFinanceQueryRun
from langchain_community.utilities.google_finance import GoogleFinanceAPIWrapper
Google Jobs
我们需要安装一个 python 包。
pip install google-search-results
请参阅使用示例和授权说明。
from langchain_community.tools.google_jobs import GoogleJobsQueryRun
from langchain_community.utilities.google_finance import GoogleFinanceAPIWrapper
Google Lens
请参阅使用示例和授权说明。
from langchain_community.tools.google_lens import GoogleLensQueryRun
from langchain_community.utilities.google_lens import GoogleLensAPIWrapper
Google Places
我们需要安装一个 python 包。
pip install googlemaps
请参阅使用示例和授权说明。
from langchain.tools import GooglePlacesTool
Google Scholar
我们需要安装一个 python 包。
pip install google-search-results
请参阅使用示例和授权说明。
from langchain_community.tools.google_scholar import GoogleScholarQueryRun
from langchain_community.utilities.google_scholar import GoogleScholarAPIWrapper
Google Search
- 按照这些说明设置自定义搜索引擎
- 从上一步获取 API 密钥和自定义搜索引擎 ID,并将它们分别设置为环境变量
GOOGLE_API_KEY
和GOOGLE_CSE_ID
。
from langchain_google_community import GoogleSearchAPIWrapper
有关此包装器的更详细演练,请参阅此 notebook。
我们可以轻松地将此包装器加载为工具(与 Agent 一起使用)。我们可以通过以下方式执行此操作
from langchain.agents import load_tools
tools = load_tools(["google-search"])
GoogleSearchResults
查询 Google Search
API(通过 GoogleSearchAPIWrapper
)并取回 JSON 的工具。
from langchain_community.tools import GoogleSearchResults
GoogleSearchRun
查询 Google Search
API(通过 GoogleSearchAPIWrapper
)的工具。
from langchain_community.tools import GoogleSearchRun
Google Trends
我们需要安装一个 python 包。
pip install google-search-results
请参阅使用示例和授权说明。
from langchain_community.tools.google_trends import GoogleTrendsQueryRun
from langchain_community.utilities.google_trends import GoogleTrendsAPIWrapper
工具包
GMail
Google Gmail 是 Google 提供的免费电子邮件服务。此工具包通过
Gmail API
处理电子邮件。
我们需要安装带有必需依赖项的 langchain-google-community
pip install langchain-google-community[gmail]
请参阅使用示例和授权说明。
from langchain_google_community import GmailToolkit
GMail 单独工具
您可以使用 GMail Toolkit 中的单独工具。
from langchain_google_community.gmail.create_draft import GmailCreateDraft
from langchain_google_community.gmail.get_message import GmailGetMessage
from langchain_google_community.gmail.get_thread import GmailGetThread
from langchain_google_community.gmail.search import GmailSearch
from langchain_google_community.gmail.send_message import GmailSendMessage
内存
AlloyDB for PostgreSQL
AlloyDB for PostgreSQL 是一种完全托管的关系数据库服务,可在 Google Cloud 上提供高性能、无缝集成和令人印象深刻的可扩展性。AlloyDB 与 PostgreSQL 100% 兼容。
安装 python 包
pip install langchain-google-alloydb-pg
请参阅使用示例。
from langchain_google_alloydb_pg import AlloyDBEngine, AlloyDBChatMessageHistory
Cloud SQL for PostgreSQL
Cloud SQL for PostgreSQL 是一项完全托管的数据库服务,可帮助您在 Google Cloud 上设置、维护、管理和管理 PostgreSQL 关系数据库。
安装 python 包
pip install langchain-google-cloud-sql-pg
请参阅使用示例。
from langchain_google_cloud_sql_pg import PostgresEngine, PostgresChatMessageHistory
Cloud SQL for MySQL
Cloud SQL for MySQL 是一项完全托管的数据库服务,可帮助您在 Google Cloud 上设置、维护、管理和管理 MySQL 关系数据库。
安装 python 包
pip install langchain-google-cloud-sql-mysql
请参阅使用示例。
from langchain_google_cloud_sql_mysql import MySQLEngine, MySQLChatMessageHistory
Cloud SQL for SQL Server
Cloud SQL for SQL Server 是一项完全托管的数据库服务,可帮助您在 Google Cloud 上设置、维护、管理和管理 SQL Server 数据库。
安装 python 包
pip install langchain-google-cloud-sql-mssql
请参阅使用示例。
from langchain_google_cloud_sql_mssql import MSSQLEngine, MSSQLChatMessageHistory
Spanner
Google Cloud Spanner 是 Google Cloud 上完全托管的关键任务关系数据库服务,可在全球范围内提供事务一致性、自动同步复制以实现高可用性,并支持两种 SQL 方言:GoogleSQL(带有扩展的 ANSI 2011)和 PostgreSQL。
安装 python 包
pip install langchain-google-spanner
请参阅使用示例。
from langchain_google_spanner import SpannerChatMessageHistory
Memorystore for Redis
Google Cloud Memorystore for Redis 是 Google Cloud 的完全托管的 Redis 服务。在 Google Cloud 上运行的应用程序可以通过利用高度可扩展、可用、安全的 Redis 服务来实现极致性能,而无需承担管理复杂 Redis 部署的负担。
安装 python 包
pip install langchain-google-memorystore-redis
请参阅使用示例。
from langchain_google_memorystore_redis import MemorystoreChatMessageHistory
Bigtable
Google Cloud Bigtable 是 Google 在 Google Cloud 中完全托管的 NoSQL 大数据数据库服务。
安装 python 包
pip install langchain-google-bigtable
请参阅使用示例。
from langchain_google_bigtable import BigtableChatMessageHistory
Firestore (原生模式)
Google Cloud Firestore 是一个 NoSQL 文档数据库,专为自动扩展、高性能和易于应用程序开发而构建。
安装 python 包
pip install langchain-google-firestore
请参阅使用示例。
from langchain_google_firestore import FirestoreChatMessageHistory
Firestore (Datastore 模式)
Google Cloud Firestore in Datastore mode 是一个 NoSQL 文档数据库,专为自动扩展、高性能和易于应用程序开发而构建。Firestore 是 Datastore 的最新版本,并引入了多项改进。
安装 python 包
pip install langchain-google-datastore
请参阅使用示例。
from langchain_google_datastore import DatastoreChatMessageHistory
El Carro:Kubernetes 的 Oracle Operator
Google El Carro Oracle Operator for Kubernetes 提供了一种在
Kubernetes
中运行Oracle
数据库的方法,作为一个可移植、开源、社区驱动、无厂商锁定的容器编排系统。
pip install langchain-google-el-carro
请参阅使用示例。
from langchain_google_el_carro import ElCarroChatMessageHistory
回调
Vertex AI 回调处理程序
跟踪
VertexAI
信息的回调处理程序。
我们需要安装 langchain-google-vertexai python 包。
pip install langchain-google-vertexai
from langchain_google_vertexai.callbacks import VertexAICallbackHandler
聊天加载器
GMail
Gmail 是 Google 提供的免费电子邮件服务。此加载器通过
Gmail API
处理电子邮件。
我们需要安装带有底层依赖项的 langchain-google-community
。
pip install langchain-google-community[gmail]
请参阅使用示例和授权说明。
from langchain_google_community import GMailLoader
评估器
我们需要安装 langchain-google-vertexai python 包。
pip install langchain-google-vertexai
VertexPairWiseStringEvaluator
预测字符串困惑度的成对评估。
from langchain_google_vertexai.evaluators.evaluation import VertexPairWiseStringEvaluator
VertexStringEvaluator
评估预测字符串的困惑度。
from langchain_google_vertexai.evaluators.evaluation import VertexPairWiseStringEvaluator
第三方集成
SearchApi
SearchApi 提供第三方 API 以访问 Google 搜索结果、YouTube 搜索和转录以及其他 Google 相关引擎。
请参阅使用示例和授权说明。
from langchain_community.utilities import SearchApiAPIWrapper
SerpApi
SerpApi 提供第三方 API 以访问 Google 搜索结果。
请参阅使用示例和授权说明。
from langchain_community.utilities import SerpAPIWrapper
Serper.dev
请参阅使用示例和授权说明。
from langchain_community.utilities import GoogleSerperAPIWrapper
YouTube
YouTube Search 包搜索
YouTube
视频,避免使用其高度限速的 API。它使用 YouTube 主页上的表单并抓取结果页面。
我们需要安装一个 python 包。
pip install youtube_search
请参阅使用示例。
from langchain.tools import YouTubeSearchTool
YouTube 音频
YouTube 是由
使用 YoutubeAudioLoader
获取/下载音频文件。
然后,使用 OpenAIWhisperParser
将它们转录为文本。
我们需要安装几个 python 包。
pip install yt_dlp pydub librosa
请参阅使用示例和授权说明。
from langchain_community.document_loaders.blob_loaders.youtube_audio import YoutubeAudioLoader
from langchain_community.document_loaders.parsers import OpenAIWhisperParser, OpenAIWhisperParserLocal
YouTube 字幕
YouTube 是由
我们需要安装 youtube-transcript-api
python 包。
pip install youtube-transcript-api
请参阅使用示例。
from langchain_community.document_loaders import YoutubeLoader