Skip to main content

Module rerank

Module rerank 

Source
Expand description

Shared reranking vocabulary for the VoyageAI reranking design.

Used identically by the server’s inline rerank stage and by clients reranking locally (BYOK), so the same search reranks the same way regardless of placement.

Enums§

RerankParam
The rerank request parameter: which Voyage model to rerank with, or none.

Constants§

MAX_INSTRUCTION_CHARS
Hard cap on agent-supplied rerank instructions, in characters.
RERANK_REASONS
The closed set of search_metadata.rerank.reason values the server emits.

Functions§

compose_rerank_query
Compose the query text sent to Voyage /v1/rerank.
default_instruction
Derive the default rerank instruction from request shape (spec §3).
known_reason
Map a raw search_metadata.rerank.reason string from a server response to a known reason wire value, returning None for anything outside the closed RERANK_REASONS set.
validate_instruction
Validate an agent-supplied instruction against MAX_INSTRUCTION_CHARS.