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:
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user