docs: consolidate rag refactor issues
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
# RAG 明确 Spring AI Advisor 与 Agent Tool 的边界
|
||||
|
||||
**状态**:待规划
|
||||
**严重程度**:中
|
||||
**发现时间**:2026-07-05
|
||||
**范围**:Agent 编排、RAG Advisor、工具调用可观测性
|
||||
|
||||
---
|
||||
|
||||
## 背景
|
||||
|
||||
Spring AI 提供 `QuestionAnswerAdvisor`、`RetrievalAugmentationAdvisor` 等 RAG Advisor 能力,可以把检索增强直接挂到模型调用流程中。
|
||||
|
||||
但当前项目是 Agent 工程项目,知识检索不是普通聊天增强,而是 Agent 在诊断流程中显式调用的工具。系统还依赖 `tool_invocation` 记录检索事实,用于 evidence score 和诊断追踪。
|
||||
|
||||
---
|
||||
|
||||
## 问题
|
||||
|
||||
如果直接把 RAG 全部迁到 Advisor,可能会损失当前项目已有的显式工具链路:
|
||||
|
||||
1. Agent 是否调用知识库不够透明。
|
||||
2. `tool_invocation` 记录可能变弱。
|
||||
3. AIOps 诊断步骤和知识证据之间的对应关系不清晰。
|
||||
4. 面试项目中“Agent 如何使用工具”的展示价值下降。
|
||||
|
||||
---
|
||||
|
||||
## 改造方向
|
||||
|
||||
不要把 `lookup_knowledge` 完全替换成隐式 Advisor,而是分层使用:
|
||||
|
||||
```text
|
||||
Agent Tool 层:
|
||||
lookup_knowledge
|
||||
sessionId
|
||||
traceId
|
||||
tool_invocation
|
||||
evidence score
|
||||
|
||||
Spring AI RAG 层:
|
||||
query transformer
|
||||
retriever
|
||||
vector store
|
||||
document post processor
|
||||
```
|
||||
|
||||
也就是说,Advisor / Retriever 可以作为工具内部实现,而不是取代工具本身。
|
||||
|
||||
---
|
||||
|
||||
## 验收标准
|
||||
|
||||
- Agent 仍然通过显式 `lookup_knowledge` 使用知识库。
|
||||
- Spring AI RAG 能力被封装在工具内部或服务内部。
|
||||
- 每次检索仍能落 `tool_invocation`。
|
||||
- Chat / AIOps 两条链路都能追踪检索输入、输出和证据来源。
|
||||
|
||||
---
|
||||
|
||||
## 相关文件
|
||||
|
||||
- `src/main/java/com/superbiz/agent/tool/LookupKnowledgeTool.java`
|
||||
- `src/main/java/com/superbiz/agent/service/ChatService.java`
|
||||
- `src/main/java/com/superbiz/agent/service/AiOpsService.java`
|
||||
- `src/main/java/com/superbiz/agent/service/ToolInvocationRecorder.java`
|
||||
Reference in New Issue
Block a user