Package com.alibaba.cloud.ai.service
Class AgentVectorService
java.lang.Object
com.alibaba.cloud.ai.service.AgentVectorService
智能体向量存储服务 专门处理智能体相关的向量存储操作,确保数据隔离
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddKnowledgeListToVector(Long agentId, List<AgentKnowledge> knowledgeList) 为智能体批量添加知识文档到向量库voidaddKnowledgeToVector(Long agentId, AgentKnowledge knowledge) 为智能体添加知识文档到向量库chatWithAgent(Long agentId, String query) 智能体聊天功能voiddeleteAllVectorDataForAgent(Long agentId) 删除智能体的所有向量数据voiddeleteKnowledgeFromVector(Long agentId, Integer knowledgeId) 删除智能体的特定知识文档getAgentDatasources(Long agentId) 获取智能体配置的数据源列表 从数据库中查询智能体关联的数据源信息getDatasourceTables(Integer datasourceId) 获取数据源的表列表getVectorStatistics(Long agentId) 获取智能体向量存储统计信息initializeSchemaForAgent(Long agentId, com.alibaba.cloud.ai.request.SchemaInitRequest schemaInitRequest) 为智能体初始化数据库SchemainitializeSchemaForAgentWithDatasource(Long agentId, Integer datasourceId, List<String> tables) 使用数据源ID为智能体初始化数据库SchemaList<org.springframework.ai.document.Document>searchKnowledge(Long agentId, String query, int topK) 从向量库中搜索相关知识List<org.springframework.ai.document.Document>searchKnowledgeByType(Long agentId, String query, int topK, String knowledgeType) 从向量库中搜索特定类型的知识
-
Constructor Details
-
AgentVectorService
public AgentVectorService()
-
-
Method Details
-
initializeSchemaForAgent
public Boolean initializeSchemaForAgent(Long agentId, com.alibaba.cloud.ai.request.SchemaInitRequest schemaInitRequest) 为智能体初始化数据库Schema- Parameters:
agentId- 智能体IDschemaInitRequest- Schema初始化请求- Returns:
- 是否成功
-
addKnowledgeToVector
为智能体添加知识文档到向量库- Parameters:
agentId- 智能体IDknowledge- 知识内容
-
addKnowledgeListToVector
为智能体批量添加知识文档到向量库- Parameters:
agentId- 智能体IDknowledgeList- 知识列表
-
searchKnowledge
public List<org.springframework.ai.document.Document> searchKnowledge(Long agentId, String query, int topK) 从向量库中搜索相关知识- Parameters:
agentId- 智能体IDquery- 查询文本topK- 返回结果数量- Returns:
- 相关文档列表
-
searchKnowledgeByType
public List<org.springframework.ai.document.Document> searchKnowledgeByType(Long agentId, String query, int topK, String knowledgeType) 从向量库中搜索特定类型的知识- Parameters:
agentId- 智能体IDquery- 查询文本topK- 返回结果数量knowledgeType- 知识类型- Returns:
- 相关文档列表
-
deleteKnowledgeFromVector
删除智能体的特定知识文档- Parameters:
agentId- 智能体IDknowledgeId- 知识ID
-
deleteAllVectorDataForAgent
删除智能体的所有向量数据- Parameters:
agentId- 智能体ID
-
getVectorStatistics
获取智能体向量存储统计信息- Parameters:
agentId- 智能体ID- Returns:
- 统计信息
-
getAgentDatasources
获取智能体配置的数据源列表 从数据库中查询智能体关联的数据源信息 -
getDatasourceTables
获取数据源的表列表- Parameters:
datasourceId- 数据源ID- Returns:
- 表名列表
-
initializeSchemaForAgentWithDatasource
public Boolean initializeSchemaForAgentWithDatasource(Long agentId, Integer datasourceId, List<String> tables) 使用数据源ID为智能体初始化数据库Schema- Parameters:
agentId- 智能体IDdatasourceId- 数据源IDtables- 表列表- Returns:
- 是否成功
-
chatWithAgent
智能体聊天功能- Parameters:
agentId- 智能体IDquery- 用户查询- Returns:
- 智能体回答
-