Class ReciprocalRankFuser
java.lang.Object
dev.langchain4j.rag.content.aggregator.ReciprocalRankFuser
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfuse(Collection<List<Content>> listsOfContents) Fuses multipleList<Content>into a singleList<Content>using the Reciprocal Rank Fusion (RRF) algorithm with k=60.fuse(Collection<List<Content>> listsOfContents, int k) Fuses multipleList<Content>into a singleList<Content>using the Reciprocal Rank Fusion (RRF) algorithm.
-
Constructor Details
-
ReciprocalRankFuser
public ReciprocalRankFuser()
-
-
Method Details
-
fuse
Fuses multipleList<Content>into a singleList<Content>using the Reciprocal Rank Fusion (RRF) algorithm with k=60.- Parameters:
listsOfContents- ACollectionofList<Content>to be fused together.- Returns:
- A single
List<Content>, the result of the fusion.
-
fuse
Fuses multipleList<Content>into a singleList<Content>using the Reciprocal Rank Fusion (RRF) algorithm.- Parameters:
listsOfContents- ACollectionofList<Content>to be fused together.k- A ranking constant used to control the influence of individual ranks from different ranked lists being combined. A common value used is 60, based on empirical studies. However, the optimal value may vary depending on the specific application and the characteristics of the data. A larger value diminishes the differences between the ranks, leading to a more uniform distribution of fusion scores. A smaller value amplifies the importance of the top-ranked items in each list. K must be greater than or equal to 1.- Returns:
- A single
List<Content>, the result of the fusion.
-