程序包 top.aoyudi.rag
接口 VectorStore
- 所有已知实现类:
InMemoryVectorStore
public interface VectorStore
向量存储接口,定义向量的添加、查询和删除操作,支持多仓库(key-value形式)
-
方法概要
修饰符和类型方法说明voidaddDocument(String repositoryKey, Document document) 添加文档向量到指定仓库voidaddDocuments(String repositoryKey, List<Document> documents) 将文档添加到指定向量仓库(会自动分割为块)void清空指定仓库的所有文档voidcreateRepository(String repositoryKey) 创建新仓库(如果不存在)voiddeleteRepository(String repositoryKey) 删除指定仓库及其所有文档列出所有现有仓库similaritySearch(String repositoryKey, float[] queryVector) 根据查询向量从指定仓库检索相似文档similaritySearch(String repositoryKey, String queryText) 根据查询文本从指定仓库检索相似文档(内部会自动生成向量)
-
方法详细资料
-
createRepository
创建新仓库(如果不存在)- 参数:
repositoryKey- 仓库标识
-
deleteRepository
删除指定仓库及其所有文档- 参数:
repositoryKey- 仓库标识
-
listRepositories
列出所有现有仓库- 返回:
- 仓库标识列表
-
addDocument
添加文档向量到指定仓库- 参数:
repositoryKey- 仓库标识document- 文档对象
-
addDocuments
将文档添加到指定向量仓库(会自动分割为块)- 参数:
documents- 文档列表repositoryKey- 目标仓库标识
-
similaritySearch
根据查询向量从指定仓库检索相似文档- 参数:
repositoryKey- 仓库标识queryVector- 查询向量- 返回:
- 相似文档列表
-
similaritySearch
根据查询文本从指定仓库检索相似文档(内部会自动生成向量)- 参数:
repositoryKey- 仓库标识queryText- 查询文本- 返回:
- 相似文档列表
-
clear
清空指定仓库的所有文档- 参数:
repositoryKey- 仓库标识
-