Class AgentVectorStoreManager
java.lang.Object
com.alibaba.cloud.ai.service.simple.AgentVectorStoreManager
智能体向量存储管理器 为每个智能体提供独立的向量存储实例,确保数据隔离
-
Constructor Summary
ConstructorsConstructorDescriptionAgentVectorStoreManager(org.springframework.ai.embedding.EmbeddingModel embeddingModel) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddDocuments(String agentId, List<org.springframework.ai.document.Document> documents) 为指定智能体添加文档voiddeleteAgentData(String agentId) 删除指定智能体的所有数据voiddeleteDocuments(String agentId, List<String> documentIds) 删除指定智能体的特定文档voiddeleteDocumentsByType(String agentId, String vectorType) 删除指定智能体的特定类型文档获取所有有数据的智能体IDintgetDocumentCount(String agentId) 获取智能体的文档数量(估算)org.springframework.ai.vectorstore.SimpleVectorStoregetOrCreateVectorStore(String agentId) 获取或创建智能体专用的向量存储获取向量存储统计信息booleanhasAgentData(String agentId) 检查智能体是否有向量数据List<org.springframework.ai.document.Document>similaritySearch(String agentId, String query, int topK) 为指定智能体搜索相似文档List<org.springframework.ai.document.Document>similaritySearchWithFilter(String agentId, String query, int topK, String vectorType) 为指定智能体搜索相似文档(带过滤条件)
-
Constructor Details
-
AgentVectorStoreManager
public AgentVectorStoreManager(org.springframework.ai.embedding.EmbeddingModel embeddingModel)
-
-
Method Details
-
getOrCreateVectorStore
获取或创建智能体专用的向量存储- Parameters:
agentId- 智能体ID- Returns:
- 智能体专用的SimpleVectorStore实例
-
addDocuments
为指定智能体添加文档- Parameters:
agentId- 智能体IDdocuments- 要添加的文档列表
-
similaritySearch
public List<org.springframework.ai.document.Document> similaritySearch(String agentId, String query, int topK) 为指定智能体搜索相似文档- Parameters:
agentId- 智能体IDquery- 查询文本topK- 返回结果数量- Returns:
- 相似文档列表
-
similaritySearchWithFilter
public List<org.springframework.ai.document.Document> similaritySearchWithFilter(String agentId, String query, int topK, String vectorType) 为指定智能体搜索相似文档(带过滤条件)- Parameters:
agentId- 智能体IDquery- 查询文本topK- 返回结果数量vectorType- 向量类型过滤- Returns:
- 相似文档列表
-
deleteAgentData
删除指定智能体的所有数据- Parameters:
agentId- 智能体ID
-
deleteDocuments
删除指定智能体的特定文档- Parameters:
agentId- 智能体IDdocumentIds- 要删除的文档ID列表
-
deleteDocumentsByType
删除指定智能体的特定类型文档- Parameters:
agentId- 智能体IDvectorType- 向量类型
-
hasAgentData
检查智能体是否有向量数据- Parameters:
agentId- 智能体ID- Returns:
- 是否有数据
-
getDocumentCount
获取智能体的文档数量(估算)- Parameters:
agentId- 智能体ID- Returns:
- 文档数量
-
getAllAgentIds
获取所有有数据的智能体ID- Returns:
- 智能体ID集合
-
getStatistics
获取向量存储统计信息- Returns:
- 统计信息
-