feat(rag): 检索质量评测 —— 单路检索能力 + recall@k/MRR 评测台

- 引擎抽 searchPaths(三路召回) + SearchByMode(vector/fulltext/graph/hybrid,
  纯检索不 rerank,公平对比);kb_search 加 mode 参数(空=生产含rerank),
  gateway KbSearch 透传 mode
- scripts/rageval.py:标注语料+查询 → 四模式 recall@k/MRR 对比表(可复用)
- live 量化:纯语义改写让全文0.88/图谱0.75 漏召回,混合 1.00 兜回,
  混合=各路上界的稳健组合

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Blizzard
2026-06-30 13:56:39 +08:00
parent 4f52b30f95
commit a17e25b6ba
4 changed files with 157 additions and 11 deletions
+4
View File
@@ -517,6 +517,7 @@ func (h *Handler) KbSearch(c *gin.Context) {
KB string `json:"kb"`
Q string `json:"q"`
TopK int `json:"topK"`
Mode string `json:"mode"` // 空=生产混合(含rerank)vector/fulltext/graph/hybrid=评测单路/纯融合
}
if err := c.ShouldBindJSON(&body); err != nil || body.Q == "" {
c.JSON(http.StatusBadRequest, gin.H{"error": "q required"})
@@ -526,6 +527,9 @@ func (h *Handler) KbSearch(c *gin.Context) {
if body.TopK > 0 {
args["topK"] = body.TopK
}
if body.Mode != "" {
args["mode"] = body.Mode
}
res, err := h.bus.CallTool(c.Request.Context(), contract.ToolSubjectGo("kb_search"),
&contract.ToolCall{Tool: "kb_search", Args: args})
if err != nil {