Skip to content
Open
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions specification/_types/Retriever.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,25 @@ export class KnnRetriever extends RetrieverBase {
rescore_vector?: RescoreVector
}

/**
* Wraps a retriever with an optional weight for RRF scoring.
*/
export class RRFRetrieverComponent {
/** The nested retriever configuration. */
retriever: RetrieverContainer
/** 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. */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/nit: we should also add the @server_default tag as a machine readable alternative to mentioning the default value in the doc string.

weight?: float
}

/**
* Either a direct RetrieverContainer (backward compatible) or an RRFRetrieverComponent with weight.
* @codegen_names retriever, weighted
*/
export type RRFRetrieverEntry = RetrieverContainer | RRFRetrieverComponent
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 that name fits better


export class RRFRetriever extends RetrieverBase {
/** A list of child retrievers to specify which sets of returned top documents will have the RRF formula applied to them. */
retrievers: RetrieverContainer[]
/** 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. */
retrievers: RRFRetrieverEntry[]
/** This value determines how much influence documents in individual result sets per query have over the final ranked result set. */
rank_constant?: integer
/** This value determines the size of the individual result sets per query. */
Expand All @@ -144,6 +160,8 @@ export class RRFRetriever extends RetrieverBase {
fields?: string[]
}



export class TextSimilarityReranker extends RetrieverBase {
/** The nested retriever which will produce the first-level results, that will later be used for reranking. */
retriever: RetrieverContainer
Expand Down
Loading