向量存储节点

概述
Vector Store节点接收向量嵌入并将其存储在向量存储中。该向量存储随后可用于执行相似性搜索。
Vector Store节点用于在向量数据库中存储向量。它接收一个向量及与之关联的数据进行存储。这些数据会被存入配置好的向量数据库集成中,以便后续检索。
Vector Store节点属于输入/输出节点组的一部分。
- 输入
- 输出
- 编辑器设置
输入项
| 标题 | 数据类型 | 描述 | 默认值 | 备注 |
|---|---|---|---|---|
| Vector | vector | The vector to be stored. | (required) | |
| Data | any | The data to be stored with the vector. | (required) | |
| ID | string | The ID to be used for the vector. If not provided, a unique ID will be generated automatically. | (optional) | |
| Integration | string | The name of the vector database integration to use. | (optional) | Only required if Use Integration Input is enabled in the Editor Settings. |
| Collection ID | string | The ID of the collection in the vector database where the vector will be stored. | (optional) | Only required if Use Collection ID Input is enabled in the Editor Settings. |
输出
| 标题 | 数据类型 | 描述 | 备注 |
|---|---|---|---|
| Complete | boolean | Indicates whether the vector has been successfully stored. Returns true if storage is successful. |
编辑器设置
| 设置 | 描述 | 默认值 | 使用输入切换 | 输入数据类型 |
|---|---|---|---|---|
| Integration | The name of the vector database integration to use. | pinecone | Yes | string |
| Collection ID | The ID of the collection in the vector database where the vector will be stored. | (empty) | Yes | string |
示例1:在向量数据库中存储向量
- 创建一个向量存储节点。将
Integration设置为您的向量数据库集成名称,并将Collection ID设置为要存储向量的集合ID。 - 创建一个文本节点或任何其他输出数据的节点,并连接一个获取嵌入节点来生成数据的向量。
- 将Get Embedding节点的
Embedding输出连接到Vector Store节点的Vector输入。 - 将Text Node的
Output连接到Vector Store Node的Data输入。 - 创建一个文本节点并将其文本更新为向量的唯一ID。将文本节点的
Output连接到向量存储节点的ID输入。 - 运行图形。Vector Store Node的
Complete输出应返回true,表示向量已成功存储。

错误处理
如果Vector Store节点在尝试存储向量时遇到错误,它将抛出错误并停止图的执行。常见的错误原因包括:
- 向量数据库集成不可用或未正确配置。
- 向量数据库中不存在该集合ID。
- 向量或数据输入格式不正确。
常见问题
问:我可以使用Vector Store节点将向量存储在任何向量数据库中吗?
A: Vector Store节点可用于在Rivet支持且已在宿主应用中正确配置的任何向量数据库中存储向量。
问:我可以一次性存储多个向量吗?
A: 不,Vector Store节点一次只能存储一个向量。如果需要存储多个向量,可以使用循环或映射操作逐个存储每个向量。
问:我可以更新已经存储的向量吗?
A: 是的,您可以通过存储具有相同ID的新向量来更新已存储的向量。新向量将替换向量数据库中的现有向量。