Skip to content

Commit 868c882

Browse files
authored
Adds weight parameter type definition for RRF retrievers. (#5502)
* Added weight to the documentation * Resolved PR comments * Update Retriever.ts * Update Retriever.ts
1 parent c887822 commit 868c882

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

specification/_types/Retriever.ts

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,25 @@ export class KnnRetriever extends RetrieverBase {
138138
rescore_vector?: RescoreVector
139139
}
140140

141+
/**
142+
* Wraps a retriever with an optional weight for RRF scoring.
143+
*/
144+
export class RRFRetrieverComponent {
145+
/** The nested retriever configuration. */
146+
retriever: RetrieverContainer
147+
/** Weight multiplier for this retriever's contribution to the RRF score. Higher values increase influence. Defaults to 1.0 if not specified. Must be non-negative. @server_default 1.0 */
148+
weight?: float
149+
}
150+
151+
/**
152+
* Either a direct RetrieverContainer (backward compatible) or an RRFRetrieverComponent with weight.
153+
* @codegen_names retriever, weighted
154+
*/
155+
export type RRFRetrieverEntry = RetrieverContainer | RRFRetrieverComponent
156+
141157
export class RRFRetriever extends RetrieverBase {
142-
/** A list of child retrievers to specify which sets of returned top documents will have the RRF formula applied to them. */
143-
retrievers: RetrieverContainer[]
158+
/** A list of child retrievers to specify which sets of returned top documents will have the RRF formula applied to them. Each retriever can optionally include a weight parameter. */
159+
retrievers: RRFRetrieverEntry[]
144160
/** This value determines how much influence documents in individual result sets per query have over the final ranked result set. */
145161
rank_constant?: integer
146162
/** This value determines the size of the individual result sets per query. */

0 commit comments

Comments
 (0)