谷歌
所有与 Google Cloud Platform 和其他 Google
产品相关的功能。
聊天模型
我们建议个人开发者从 Gemini API(langchain-google-genai
)开始,并在需要访问商业支持和更高速率限制时迁移到 Vertex AI(langchain-google-vertexai
)。如果您已经熟悉或使用云原生,那么您可以直接从 Vertex AI 开始。有关更多信息,请参阅 此处。
Google 生成式 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 模型花园上的聊天 Anthropic
查看 使用示例。
from langchain_google_vertexai.model_garden import ChatAnthropicVertex
Vertex AI 模型花园上的聊天 Llama
from langchain_google_vertexai.model_garden_maas.llama import VertexModelGardenLlama
Vertex AI 模型花园上的聊天 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 模型花园上的聊天 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
LLM
Google 生成式 AI
通过 GoogleGenerativeAI
类访问 GoogleAI Gemini
模型,例如 gemini-pro
和 gemini-pro-vision
。
安装 python 包。
pip install langchain-google-genai
查看 使用示例。
from langchain_google_genai import GoogleGenerativeAI
Vertex AI 模型花园
通过 Vertex AI 模型花园
服务访问 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 模型花园上的 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 生成式 AI 嵌入
查看 使用示例。
pip install -U langchain-google-genai
配置您的 API 密钥。
export GOOGLE_API_KEY=your-api-key
from langchain_google_genai import GoogleGenerativeAIEmbeddings
Google 生成式 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 中的数据一起扩展。
我们需要安装具有 Big Query 依赖项的 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
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 上存储非结构化数据的托管服务。
我们需要安装 langchain-google-community
,其中包含 Google Cloud Storage 依赖项。
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 工作负载
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
。
我们需要安装 langchain-google-community
,其中包含 Google Drive 依赖项。
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 在 Datastore 模式下 是一款专为自动扩展、高性能和简化应用程序开发而构建的 NoSQL 文档数据库。Firestore 是 Datastore 的最新版本,与 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
语音转文本
Google Cloud 语音转文本 是由 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 的 处理器详细信息
选项卡的 预测端点
部分复制它。
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 翻译 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 向量搜索
Google Cloud BigQuery,BigQuery 是 Google Cloud 中一个无服务器且经济高效的企业数据仓库。
Google Cloud BigQuery 向量搜索 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 向量搜索
Google Cloud Vertex AI 向量搜索 来自 Google Cloud,以前称为
Vertex AI Matching Engine
,提供业界领先的高规模低延迟向量数据库。这些向量数据库通常被称为向量相似度匹配或近似最近邻 (ANN) 服务。
安装 python 包
pip install langchain-google-vertexai
请参阅 使用示例。
from langchain_google_vertexai import VectorSearchVectorStore
Vertex AI 向量搜索(使用 DataStore)
使用 DatasTore 文档存储进行向量搜索。
安装 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 生成式 AI 向量存储
目前,它在服务器端计算嵌入向量。有关更多信息,请访问 指南。
安装 python 包
pip install langchain-google-genai
from langchain_google_genai.google_vector_store import GoogleVectorStore
ScaNN
Google ScaNN(可扩展最近邻)是一个 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 搜索
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 仓库
Document AI 仓库 来自 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
工具
文字转语音
Google Cloud 文字转语音 是一项 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
有关此包装器更详细的演练,请参见 此笔记本。
我们可以轻松地将此包装器加载为工具(与代理一起使用)。我们可以使用
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 在 Datastore 模式下 是一款专为自动扩展、高性能和简化应用程序开发而构建的 NoSQL 文档数据库。Firestore 是 Datastore 的最新版本,与 Datastore 相比,它引入了多项改进。
安装 python 包
pip install langchain-google-datastore
查看 使用示例。
from langchain_google_datastore import DatastoreChatMessageHistory
El Carro:Kubernetes 的 Oracle 运算符
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 搜索 包在不使用其严重限速的 API 的情况下搜索
YouTube
视频。它使用 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