类 DefaultContentAggregator
java.lang.Object
dev.langchain4j.rag.content.aggregator.DefaultContentAggregator
- 所有已实现的接口:
ContentAggregator
Default implementation of
It's important to note that while efforts will be made to avoid breaking changes, the default behavior of this class may be updated in the future if it's found that the current behavior does not adequately serve the majority of use cases. Such changes would be made to benefit both current and future users.
This implementation employs Reciprocal Rank Fusion (see
Stage 1: For each
Stage 2: All
Example:
Input (query -> multiple lists with ranked contents):
ContentAggregator intended to be suitable for the majority of use cases.
It's important to note that while efforts will be made to avoid breaking changes, the default behavior of this class may be updated in the future if it's found that the current behavior does not adequately serve the majority of use cases. Such changes would be made to benefit both current and future users.
This implementation employs Reciprocal Rank Fusion (see
ReciprocalRankFuser) in two stages
to aggregate all Collection<List<Content>> into a single List<Content>.
The Contents in both the input and output lists are expected to be sorted by relevance,
with the most relevant Contents at the beginning of the List<Content>.
Stage 1: For each
Query, all List<Content> retrieved with that Query
are merged into a single List<Content>.
Stage 2: All
List<Content> (results from stage 1) are merged into a single List<Content>.
Example:
Input (query -> multiple lists with ranked contents):
home animals -> [cat, dog, hamster], [cat, parrot] domestic animals -> [dog, horse], [cat]After stage 1 (query -> single list with ranked contents):
home animals -> [cat, dog, parrot, hamster] domestic animals -> [dog, cat, horse]After stage 2 (single list with ranked contents):
[cat, dog, parrot, horse, hamster]
-
构造器概要
构造器 -
方法概要
-
构造器详细资料
-
DefaultContentAggregator
public DefaultContentAggregator()
-
-
方法详细资料
-
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
-