rerankWithCrossEncoder 使用交叉编码器重排序
(_ context.Context, _ string, items []*RetrievalItem)
| 434 | |
| 435 | // rerankWithCrossEncoder 使用交叉编码器重排序 |
| 436 | func (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重排序 |
| 446 | func (r *RAG) rerankWithBM25(_ context.Context, _ string, items []*RetrievalItem) []*RetrievalItem { |
no outgoing calls
no test coverage detected