程序包 top.aoyudi.rag

接口 VectorStore

所有已知实现类:
InMemoryVectorStore

public interface VectorStore
向量存储接口,定义向量的添加、查询和删除操作,支持多仓库(key-value形式)
  • 方法详细资料

    • createRepository

      void createRepository(String repositoryKey)
      创建新仓库(如果不存在)
      参数:
      repositoryKey - 仓库标识
    • deleteRepository

      void deleteRepository(String repositoryKey)
      删除指定仓库及其所有文档
      参数:
      repositoryKey - 仓库标识
    • listRepositories

      List<String> listRepositories()
      列出所有现有仓库
      返回:
      仓库标识列表
    • addDocument

      void addDocument(String repositoryKey, Document document)
      添加文档向量到指定仓库
      参数:
      repositoryKey - 仓库标识
      document - 文档对象
    • addDocuments

      void addDocuments(String repositoryKey, List<Document> documents)
      将文档添加到指定向量仓库(会自动分割为块)
      参数:
      documents - 文档列表
      repositoryKey - 目标仓库标识
    • similaritySearch

      List<Document> similaritySearch(String repositoryKey, float[] queryVector)
      根据查询向量从指定仓库检索相似文档
      参数:
      repositoryKey - 仓库标识
      queryVector - 查询向量
      返回:
      相似文档列表
    • similaritySearch

      List<Document> similaritySearch(String repositoryKey, String queryText)
      根据查询文本从指定仓库检索相似文档(内部会自动生成向量)
      参数:
      repositoryKey - 仓库标识
      queryText - 查询文本
      返回:
      相似文档列表
    • clear

      void clear(String repositoryKey)
      清空指定仓库的所有文档
      参数:
      repositoryKey - 仓库标识