Skip to content

Supabase 向量存储节点#

¥Supabase Vector Store node

使用 Supabase 向量存储节点以向量存储身份与 Supabase 数据库交互。你可以将文档插入向量数据库,从向量数据库获取多个文档,并检索文档并将其提供给连接到链的检索器。

¥Use the Supabase Vector Store to interact with your Supabase database as vector store. You can insert documents into a vector database, get many documents from a vector database, and retrieve documents to provide them to a retriever connected to a chain.

使用 Supabase 向量存储节点以 矢量商店 身份与 Supabase 数据库交互。你可以将文档插入向量数据库,从向量数据库获取文档,检索文档并将其提供给连接到 chain 的检索器,或者直接将其连接到 agent 以用作 tool。你还可以通过 ID 更新矢量存储中的项目。

¥Use the Supabase Vector Store to interact with your Supabase database as vector store. You can insert documents into a vector database, get documents from a vector database, retrieve documents to provide them to a retriever connected to a chain, or connect it directly to an agent to use as a tool. You can also update an item in a vector store by its ID.

本页包含 Supabase 节点的节点参数以及更多资源的链接。

¥On this page, you'll find the node parameters for the Supabase node, and links to more resources.

Credentials

你可以在 此处 中找到此节点的身份验证信息。

¥You can find authentication information for this node here.

Parameter resolution in sub-nodes

Sub-nodes behave differently to other nodes when processing multiple items using an expression.

Most nodes, including root nodes, take any number of items as input, process these items, and output the results. You can use expressions to refer to input items, and the node resolves the expression for each item in turn. For example, given an input of five name values, the expression {{ $json.name }} resolves to each name in turn.

In sub-nodes, the expression always resolves to the first item. For example, given an input of five name values, the expression {{ $json.name }} always resolves to the first name.

Supabase 提供 设置矢量存储的快速入门。如果你使用快速入门指南中的默认设置以外的设置,这可能会影响 n8n 中的参数设置。确保你理解自己正在执行的操作。

¥Supabase provides a quickstart for setting up your vector store. If you use settings other than the defaults in the quickstart, this may affect parameter settings in n8n. Make sure you understand what you're doing.

节点使用模式#

¥Node usage patterns

你可以在以下模式下使用 Supabase 向量存储节点。

¥You can use the Supabase Vector Store node in the following patterns.

用作常规节点,用于插入、更新和检索文档#

¥Use as a regular node to insert, update, and retrieve documents

你可以将 Supabase 向量存储节点作为常规节点用于插入、更新或获取文档。此模式将 Supabase 向量存储置于常规连接流程中,无需使用代理。

¥You can use the Supabase Vector Store as a regular node to insert, update, or get documents. This pattern places the Supabase Vector Store in the regular connection flow without using an agent.

你可以在 此模板 的场景 1 中找到示例。

¥You can see an example of this in scenario 1 of this template.

直接连接到 AI 代理作为工具#

¥Connect directly to an AI agent as a tool

你可以将 Supabase 矢量存储节点直接连接到 AI 代理 的工具连接器,以便在回答查询时使用矢量存储作为资源。

¥You can connect the Supabase Vector Store node directly to the tool connector of an AI agent to use a vector store as a resource when answering queries.

在这里,连接方式如下:AI 代理(工具连接器)-> Supabase 向量存储节点。

¥Here, the connection would be: AI agent (tools connector) -> Supabase Vector Store node.

使用检索器获取文档#

¥Use a retriever to fetch documents

你可以将 Vector Store 检索器 节点与 Supabase Vector Store 节点配合使用,从 Supabase Vector Store 节点获取文档。这通常与 Question and Answer 链 节点一起使用,用于从向量存储中获取与给定聊天输入匹配的文档。

¥You can use the Vector Store Retriever node with the Supabase Vector Store node to fetch documents from the Supabase Vector Store node. This is often used with the Question and Answer Chain node to fetch documents from the vector store that match the given chat input.

连接流程示例(示例使用 Pinecone,但模式相同)如下所示:问答链(检索器连接器)-> 向量存储检索器(向量存储连接器)-> Supabase 向量存储。

¥An example of the connection flow (the example uses Pinecone, but the pattern in the same) would be: Question and Answer Chain (Retriever connector) -> Vector Store Retriever (Vector Store connector) -> Supabase Vector Store.

使用 Vector Store 问答工具回答问题#

¥Use the Vector Store Question Answer Tool to answer questions

另一种模式使用 Vector Store 问答工具 来汇总来自 Supabase 向量存储节点的结果并回答问题。此模式并非直接连接 Supabase 向量存储作为工具,而是使用专门用于汇总向量存储中数据的工具。

¥Another pattern uses the Vector Store Question Answer Tool to summarize results and answer questions from the Supabase Vector Store node. Rather than connecting the Supabase Vector Store directly as a tool, this pattern uses a tool specifically designed to summarizes data in the vector store.

在这种情况下,连接流程 如下所示:AI 代理(工具连接器)-> Vector Store 问答工具(Vector Store 连接器)-> Supabase Vector Store。

¥The connections flow in this case would look like this: AI agent (tools connector) -> Vector Store Question Answer Tool (Vector Store connector) -> Supabase Vector store.

节点参数#

¥Node parameters

操作模式#

¥Operation Mode

This Vector Store node has five modes: Get Many, Insert Documents, Retrieve Documents (As Vector Store for Chain/Tool), Retrieve Documents (As Tool for AI Agent), and Update Documents. The mode you select determines the operations you can perform with the node and what inputs and outputs are available.

Get Many#

In this mode, you can retrieve multiple documents from your vector database by providing a prompt. The prompt will be embedded and used for similarity search. The node will return the documents that are most similar to the prompt with their similarity score. This is useful if you want to retrieve a list of similar documents and pass them to an agent as additional context.

Insert Documents#

Use Insert Documents mode to insert new documents into your vector database.

Retrieve Documents (As Vector Store for Chain/Tool)#

Use Retrieve Documents (As Vector Store for Chain/Tool) mode with a vector-store retriever to retrieve documents from a vector database and provide them to the retriever connected to a chain. In this mode you must connect the node to a retriever node or root node.

Retrieve Documents (As Tool for AI Agent)#

Use Retrieve Documents (As Tool for AI Agent) mode to use the vector store as a tool resource when answering queries. When formulating responses, the agent uses the vector store when the vector store name and description match the question details.

Update Documents#

Use Update Documents mode to update documents in a vector database by ID. Fill in the ID with the ID of the embedding entry to update.

重新排序结果#

¥Rerank Results

Enables reranking. If you enable this option, you must connect a reranking node to the vector store. That node will then rerank the results for queries. You can use this option with the Get Many, Retrieve Documents (As Vector Store for Chain/Tool) and Retrieve Documents (As Tool for AI Agent) modes.

获取多个参数#

¥Get Many parameters

  • 表名:输入要使用的数据库表。

¥Table Name: Enter the Supabase table to use.

  • 提示:输入搜索查询。

¥Prompt: Enter the search query.

  • 限制:输入要从向量存储中检索的结果数量。例如,将其设置为 10 以获取十个最佳结果。

¥Limit: Enter how many results to retrieve from the vector store. For example, set this to 10 to get the ten best results.

插入文档参数#

¥Insert Documents parameters

  • 表名:输入要使用的数据库表。

¥Table Name: Enter the Supabase table to use.

检索文档(作为链/工具的向量存储)参数#

¥Retrieve Documents (As Vector Store for Chain/Tool) parameters

  • 表名:输入要使用的数据库表。

¥Table Name: Enter the Supabase table to use.

检索文档(作为工具) (适用于 AI 代理)参数#

¥Retrieve Documents (As Tool for AI Agent) parameters

  • 名称:向量存储的名称。

¥Name: The name of the vector store.

  • 描述:向 LLM 解释此工具的功能。良好的、具体的描述有助于 LLM 更频繁地生成预期结果。

¥Description: Explain to the LLM what this tool does. A good, specific description allows LLMs to produce expected results more often.

  • 表名:输入要使用的数据库表。

¥Table Name: Enter the Supabase table to use.

  • 限制:输入要从向量存储中检索的结果数量。例如,将其设置为 10 以获取十个最佳结果。

¥Limit: Enter how many results to retrieve from the vector store. For example, set this to 10 to get the ten best results.

更新文档#

¥Update Documents

  • 表名:输入要使用的数据库表。

¥Table Name: Enter the Supabase table to use.

  • ID:嵌入条目的 ID。

¥ID: The ID of an embedding entry.

更新文档的参数

¥Parameters for Update Documents

  • ID

节点选项#

¥Node options

查询名称#

¥Query Name

你在 Supabase 中设置的匹配函数的名称。如果你按照 Supabase 快速入门 指南操作,则此目录将变为 match_documents

¥The name of the matching function you set up in Supabase. If you follow the Supabase quickstart, this will be match_documents.

元数据筛选器#

¥Metadata Filter

Available in Get Many mode. When searching for data, use this to match with metadata associated with the document.

This is an AND query. If you specify more than one metadata filter field, all of them must match.

When inserting data, the metadata is set using the document loader. Refer to Default Data Loader for more information on loading documents.

模板和示例#

¥Templates and examples

Template widget placeholder.

相关资源#

¥Related resources

有关服务的更多信息,请参阅 LangChain 的 Supabase 文档

¥Refer to LangChain's Supabase documentation for more information about the service.

View n8n's Advanced AI documentation.