feat(rag): chunk evidence identity, dedup, and search port

Preserve same-document multi-chunk evidence with evidenceKey identity,
per-document caps, retrieve-k/return-n split, and a dense KnowledgeSearchPort.
Archives Delivery 1 OpenSpec change as the foundation for hybrid retrieval.
This commit is contained in:
zhuyongxin
2026-07-27 18:26:15 +08:00
parent 99d4f6f216
commit ac1f831903
34 changed files with 2880 additions and 298 deletions
@@ -0,0 +1,23 @@
package com.superbiz.agent.service.retrieval;
/**
* Portable search request used by the knowledge pipeline.
*/
public record KnowledgeSearchRequest(
String query,
int topK,
String categoryFilter,
KnowledgeSearchMode mode
) {
public KnowledgeSearchRequest {
if (topK <= 0) {
throw new IllegalArgumentException("topK must be positive");
}
mode = mode == null ? KnowledgeSearchMode.DENSE : mode;
query = query == null ? "" : query;
}
public static KnowledgeSearchRequest dense(String query, int topK, String categoryFilter) {
return new KnowledgeSearchRequest(query, topK, categoryFilter, KnowledgeSearchMode.DENSE);
}
}