Fusion utilities for hybrid retrieval, implementing RRF and weighted score fusion.
# Source: https://github.com/bojieli/ai-agent-book | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works # Provided via justclaw.it.com; keep this notice with the code. """Result fusion for hybrid retrieval. This module implements the *fusion* stage of the hybrid retrieval pipeline — the step that merges the separately-ranked dense and sparse candidate lists into a single, unified candidate pool before neural reranking. Two production-grade fusion strategies are provided, matching the two approaches discussed in the book (第3章「混合检索流水线」): 1. Reciprocal Rank Fusion (RRF) score(d) = Σ_r 1 / (k + rank_r(d)) Only ranks are used, original scores are discarded. Robust and scale-free, because it never has to compare a cosine similarity against a ... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key