ExuluReranker wraps the backend’s reranking infrastructure. It sends a query and a list of chunks to a LiteLLM-proxied reranker model (following the Cohere-compatible /v1/rerank shape), then returns the items reordered descending by relevance with a rerank_score field added to each.
Because reranking goes through the LiteLLM proxy, you switch providers (Cohere, Vertex AI, Together AI, …) by editing config.litellm.yaml rather than by changing code. Cost attribution via spend tags is built in.
API surface
ExuluReranker.rerank
The user query or search string to score items against.
The chunks to rerank. Each item must have
item_name and chunk_content fields (the shape shared by VectorSearchChunkResult and the retrieval pipeline’s ChunkWithScore). All other fields are preserved on the returned objects.LiteLLM
model_name declared in config.litellm.yaml with model_info.type: reranker (e.g. "rerank-v4.0-pro").Return only the top N items. When omitted, all items are returned reordered.
Emitted as a
context_id_ spend tag in LiteLLM.Emitted as a
context_name_ spend tag.Full user record — used for tag-based budget attribution.
Numeric user ID when only the ID is available (background ingestion jobs).
Role ID emitted as a spend tag.
Project record — emitted as a
project_id_ spend tag.Agent record — emitted as an
agent_id_ spend tag.Routine info — emitted as a
routine_id_ spend tag.The input items reordered descending by relevance, each extended with
rerank_score: number. Returns an empty array when items is empty.Example
Notes
- Each document sent to the reranker is built as
item_name + ": " + chunk_content. This is the standard retrieval convention; keep that shape consistent across your chunkers. - The function returns an empty array immediately when
itemsis empty — no network call is made. - Reranking requires
EXULU_USE_LITELLM=trueand a running LiteLLM proxy.
Related
- ExuluDefaultTools: the agentic retrieval pipeline uses
ExuluRerankerinternally. - Self-hosting / LiteLLM: configure the proxy and add reranker models.