Skip to main content
rerank is gated by rerank. It takes a query and a list of candidate passages and returns a relevance score for each — the precise, expensive second stage of a recall → rerank funnel.

Params

string
required
The query to score passages against.
string[]
required
The candidate passages to rescore.
"cross-encoder" | "colbert" | "llm"
The reranking strategy. MUST be one of the server’s advertised rerank.methods.
integer
Truncate to the best topN results (reflected in order).

Result

float[]
scores[i] corresponds to passages[i]; higher is more relevant. Scores are server-defined and only comparable within this one response.
integer[]
Optional. The passage indices sorted best-first — convenient when topN truncates.

Reranking methods

cross-encoder

Jointly encodes each (query, passage) pair for one relevance score. Most accurate, one forward pass per candidate.

colbert

Late interaction (MaxSim) over multi-vector representations — near cross-encoder accuracy at bi-encoder speed.

llm

An LLM judge scores or orders passages — flexible, slowest, best for small N.
You rarely need rerank directly: retrieve can rerank inside a single call via its rerank option when the server advertises retrieve.rerankBuiltin. Reach for standalone rerank when you run your own recall stage or rerank a fused federation candidate set.