MCPcopy Create free account
hub / github.com/astercloud/aster / rerankWithCrossEncoder

Method rerankWithCrossEncoder

pkg/knowledge/rag.go:436–443  ·  view source on GitHub ↗

rerankWithCrossEncoder 使用交叉编码器重排序

(_ context.Context, _ string, items []*RetrievalItem)

Source from the content-addressed store, hash-verified

434
435// rerankWithCrossEncoder 使用交叉编码器重排序
436func (r *RAG) rerankWithCrossEncoder(_ context.Context, _ string, items []*RetrievalItem) []*RetrievalItem {
437 // TODO: 实现交叉编码器重排序
438 // 现在只是按原始分数排序
439 sort.Slice(items, func(i, j int) bool {
440 return items[i].Score > items[j].Score
441 })
442 return items
443}
444
445// rerankWithBM25 使用BM25重排序
446func (r *RAG) rerankWithBM25(_ context.Context, _ string, items []*RetrievalItem) []*RetrievalItem {

Callers 2

rerankMethod · 0.95
rerankHybridMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected