feat(rag): dense+BM25 hybrid on MilvusClientV2, drop SDK path

Replace legacy MilvusServiceClient knowledge search/write with a single
MilvusClientV2 hybrid store (BM25 function + dense ANN + RRFRanker).
Use collection biz_hybrid and require knowledge reindex.
This commit is contained in:
zhuyongxin
2026-07-27 18:49:20 +08:00
parent 376ad0c241
commit f035538531
22 changed files with 813 additions and 936 deletions
+14 -4
View File
@@ -25,6 +25,8 @@ milvus:
token: ${MILVUS_TOKEN}
secure: true
vector-dim: 1024 # BGE-M3 = 1024,换模型时同步改
# dense+BM25 hybrid collection (requires reindex; legacy "biz" is not used by knowledge path)
collection: biz_hybrid
# =====================================================
# 模型路由配置
@@ -162,16 +164,24 @@ rag:
enabled: false
content-preview-limit: 300
# 检索归一化配置
# 检索配置(单一 Milvus V2 后端;已移除 sdk/spring/auto 路由)
retrieval:
kb-scope: "" # empty means search all legacy documents; use rag-eval for eval seed docs
vector-store:
mode: auto # auto | spring-ai | sdk
kb-scope: "" # empty means search all documents in hybrid collection
search:
mode: hybrid # dense | hybrid (dense + BM25 RRF)
hybrid:
rrf-k: 60
normalization:
max-l2-distance: 2.0 # L2 距离上界(BGE-M3 单位向量 = 2.0)
highly-relevant-threshold: 0.75 # similarity >= 0.75 → HIGHLY_RELEVANT
reference-threshold: 0.5 # similarity >= 0.5 → REFERENCE
# RAG 召回宽度(Delivery 1)
rag:
retrieve-k: 20
return-n: 5
max-chunks-per-document: 2
# Prometheus 配置
prometheus:
base-url: http://localhost:9090