类 ReRankingContentAggregator
java.lang.Object
dev.langchain4j.rag.content.aggregator.ReRankingContentAggregator
- 所有已实现的接口:
ContentAggregator
A
The
Before the use of a
Configurable parameters (optional):
-
ContentAggregator that performs re-ranking using a ScoringModel, such as Cohere.
The
ScoringModel scores Contents against a (single) Query.
If multiple Querys are input to this aggregator
(for example, when using ExpandingQueryTransformer),
a querySelector must be provided to select a Query for ranking all Contents.
Alternatively, a custom implementation can be created to score Contents against the Querys
that were used for their retrieval (instead of a single Query), and then re-rank based on those scores.
Although potentially more costly, this method may yield better results
when the Querys are significantly different.
Before the use of a
ScoringModel, all Contents are fused in the same way
as by the DefaultContentAggregator. For detailed information, please refer to its Javadoc.
Configurable parameters (optional):
-
minScore: the minimum score for Contents to be returned.
Contents scoring below this threshold (as determined by the ScoringModel)
are excluded from the results.- 另请参阅:
-
字段概要
字段修饰符和类型字段说明 -
构造器概要
构造器构造器说明ReRankingContentAggregator(ScoringModel scoringModel) ReRankingContentAggregator(ScoringModel scoringModel, Function<Map<Query, Collection<List<Content>>>, Query> querySelector, Double minScore) -
方法概要
-
字段详细资料
-
DEFAULT_QUERY_SELECTOR
-
-
构造器详细资料
-
ReRankingContentAggregator
-
ReRankingContentAggregator
public ReRankingContentAggregator(ScoringModel scoringModel, Function<Map<Query, Collection<List<Content>>>, Query> querySelector, Double minScore)
-
-
方法详细资料
-
aggregate
从接口复制的说明:ContentAggregatorAggregates allContents retrieved by allContentRetrievers using allQuerys. TheContents, both on input and output, are sorted by relevance, with the most relevantContents appearing at the beginning ofList<Content>.- 指定者:
aggregate在接口中ContentAggregator- 参数:
queryToContents- A map from aQueryto allList<Content>retrieved with thatQuery. Given that eachQuerycan be routed to multipleContentRetrievers, the value of this map is aCollection<List<Content>>rather than a simpleList<Content>.- 返回:
- A list of aggregated
Contents.
-
fuse
-
reRankAndFilter
-