rerankers
Lightweight, low-dependency unified Python API to run any cross-encoder, ColBERT, or LLM reranker to sharpen RAG retrieval.
rerankers
A small, focused library from Answer.AI that gives you a single, consistent Python interface over every common reranking approach. Swap a SentenceTransformers cross-encoder for a Cohere/Jina API reranker, a T5-based model, ColBERT late-interaction scoring, RankGPT-style LLM reranking, or FlashRank ONNX models by changing one string — the calling code stays identical. This solves the classic RAG second-stage problem: a fast bi-encoder retrieves a broad candidate set, and a reranker re-scores the top-k so the most relevant passages land in the prompt.
Key features
- One
RerankerAPI across cross-encoders, ColBERT, T5, LLM, API, and FlashRank backends - Deliberately minimal dependencies — install only the backend you actually use
- Returns ranked, scored results ready to feed a generator
- Trivial to A/B different rerankers without rewriting retrieval code
- Framework-agnostic; drops into LangChain, LlamaIndex, or bespoke pipelines
Curated mirror of the open-source rerankers (Apache-2.0). Get it from the source.
Compromise signals — malicious or tampered code (leaked secrets, backdoors, a dropped executable) — reduce the score, and known dependency CVEs carry a bounded penalty (they warrant review but never QUARANTINE — update the dependency to clear). Other dangerous-by-capability traits are risk surface, expected for some capabilities. Every finding is mapped to its OWASP control below.
Findings mapped to the OWASP Top 10 for LLM Applications (2025) and the OWASP Machine Learning Security Top 10. Expand any flagged control for the exact findings — compromise reduces the score; expected/risk-surface do not, except a known CVE, which carries a small bounded penalty (high/critical → Review).
The same gate an agent runs before installing (POST /api/v1/trust/rerankers-unified-reranking-api/check). Click a policy:
Consume rerankers programmatically. Authenticate with an API key or session — see Authorize an agent.
# Agents: CHECK BEFORE YOU INSTALL (no auth) — score, grade, level, capability manifest
curl https://ai-supply.store/api/v1/trust/rerankers-unified-reranking-api
# Gate against your org policy (returns { pass, violations })
curl -X POST https://ai-supply.store/api/v1/trust/rerankers-unified-reranking-api/check \
-H "Content-Type: application/json" \
-d '{"minGrade":"B","denyPermissions":["shell"],"denyUnknownEgress":true}'
# CLI
npx ai-supply add rerankers-unified-reranking-api
# REST (install → download)
curl -X POST https://ai-supply.store/api/v1/listings/rerankers-unified-reranking-api/install \
-H "Authorization: Bearer $AIM_KEY"
# MCP tool
install_listing({ "slug": "rerankers-unified-reranking-api" })OpenAPI spec →Curated mirror — latest upstream source. See the repository for tagged releases.