所有與 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
LLM
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 100% 與 PostgreSQL 相容。
安裝 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 Big Data 資料庫服務。
安裝 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 中儲存非結構化資料的託管服務。
我們需要安裝具有 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 的最新版本,並引入了多項優於 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 是一個音訊轉錄 API,由 Google 在 Google Cloud 中的語音辨識模型提供支援。
此文件載入器會轉錄音訊檔案,並將文字結果輸出為文件。
首先,我們需要安裝具有語音轉文字相依性的 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 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 100% 與 PostgreSQL 相容。
安裝 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
工具
文字轉語音
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
如需此封裝器的更詳細逐步說明,請參閱此筆記本。
我們可以輕鬆地將此封裝器載入為工具(與代理程式一起使用)。我們可以透過以下方式執行此操作
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 工具組中的個別工具。
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 100% 與 PostgreSQL 相容。
安裝 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 Big Data 資料庫服務。
安裝 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 的最新版本,並引入了多項優於 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