Skip to content

Graphorin API reference v0.1.0


Graphorin API reference / @graphorin/memory / / RRFReranker

Class: RRFReranker

Defined in: packages/memory/src/search/rrf.ts:30

Built-in Reciprocal Rank Fusion reranker. Combines multiple ranked lists (vector hits, FTS5 hits, optional entity boost) into a single fused ranking by summing 1 / (k + rank) per list each item appears in.

Properties (verified by the property-based test suite):

  • Deterministic. Identical input lists yield identical output.
  • Stable under permutation of input lists. The fusion is independent of the order in which the input lists are passed in.
  • Tie-broken by stable record id. Records with equal RRF scores keep their first-seen order.

Stable

Implements

Constructors

Constructor

ts
new RRFReranker(k?): RRFReranker;

Defined in: packages/memory/src/search/rrf.ts:34

Parameters

ParameterTypeDefault value
knumberRRF_DEFAULT_K

Returns

RRFReranker

Properties

PropertyModifierTypeDescriptionDefined in
idreadonly"rrf"Stable lowercase identifier surfaced on every span.packages/memory/src/search/rrf.ts:31
kreadonlynumber-packages/memory/src/search/rrf.ts:32

Methods

rerank()

ts
rerank<TRecord>(
   query, 
   lists, 
options?): Promise<readonly MemoryHit<TRecord>[]>;

Defined in: packages/memory/src/search/rrf.ts:43

Rerank one or more parallel ranked lists and return the fused top-K (default topK = 10). Each input list must already be sorted by score descending.

Type Parameters

Type Parameter
TRecord extends MemoryRecord

Parameters

ParameterType
querystring
listsreadonly readonly MemoryHit&lt;TRecord&gt;[][]
optionsReRankOptions

Returns

Promise<readonly MemoryHit&lt;TRecord&gt;[]>

Implementation of

ReRanker.rerank