You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -31,20 +32,27 @@ Runs multiple text retrievers in parallel and combines their deduplicated result
31
32
32
33
## Overview
33
34
34
-
`MultiRetriever` composes any number of text retrievers into a single component. All retrievers are queried in parallel using a thread pool, and their results are deduplicated before being returned.
35
+
`MultiRetriever` composes any number of text retrievers into a single component. All retrievers are queried in parallel using a thread pool, and their results are merged before being returned.
35
36
36
37
The component:
37
38
- Queries all retrievers concurrently for better performance
38
-
-Automatically deduplicates results across retrievers
39
+
-Merges results across retrievers using the configured `join_mode`
39
40
- Supports selectively enabling retrievers at runtime via `active_retrievers`
40
41
41
42
All retrievers passed to `MultiRetriever` must implement the `TextRetriever` protocol — their `run` method must accept a text `query`, `filters`, and `top_k`. Use [`TextEmbeddingRetriever`](textembeddingretriever.mdx) to wrap an embedding-based retriever so it can be used with this component.
42
43
44
+
### Join modes
45
+
46
+
The `join_mode` parameter controls how results from multiple retrievers are merged:
47
+
48
+
-**`reciprocal_rank_fusion`** (default): Assigns scores based on each document's rank across retrieval lists using the [Reciprocal Rank Fusion](https://plg.uwaterloo.ca/~gvcormac/cormacksigir09-rrf.pdf) algorithm. Documents appearing highly ranked in multiple lists receive higher scores. Results are deduplicated and returned in descending score order. This is the recommended mode when combining retrievers with incomparable scores, such as BM25 and embedding retrievers.
49
+
-**`concatenate`**: Combines all results into a single list and deduplicates.
50
+
43
51
## Usage
44
52
45
53
### On its own
46
54
47
-
This example sets up a `MultiRetriever` combining a BM25 retriever and an embedding-based retriever (wrapped with `TextEmbeddingRetriever`). Both are queried in parallel and the deduplicated results are returned.
55
+
This example sets up a `MultiRetriever` combining a BM25 retriever and an embedding-based retriever (wrapped with `TextEmbeddingRetriever`). Both are queried in parallel and the results are merged using reciprocal rank fusion.
0 commit comments