Open in the interactive docs · markdown for agents: https://neuraldeep.tech/docs/rerank.md

Reranking · Rerank

Re-sorts candidates by relevance to the query. Returns a relevance_score for each document. Used after vector search for fine-grained top-k ranking.

curl https://api.neuraldeep.tech/v1/rerank \
  -H "Authorization: Bearer $YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "bge-reranker",
    "query": "What is an LLM?",
    "documents": [
      "Large language models are trained on large corpora.",
      "It is sunny in Moscow today.",
      "GPT-4 is OpenAI's transformer architecture."
    ]
  }'
import httpx
# topk_docs: list[str] returned by vector search (top 50)
r = httpx.post(
    "https://api.neuraldeep.tech/v1/rerank",
    headers={"Authorization": f"Bearer $YOUR_KEY"},
    json={"model": "bge-reranker", "query": query, "documents": topk_docs},
    timeout=15.0,
).json()
# results sorted by relevance desc
top3 = [topk_docs[x["index"]] for x in r["results"][:3]]

Pipeline: first embeddings → ANN (Qdrant/FAISS) → top 50 → rerank → top 3-5 for the LLM.

Input limits. query plus all documents together up to 105,600 characters, otherwise 400 with X-Window: vector-payload. The qwen3-reranker-8b window is 8192 tokens per query + document pair. The response has to fit into 30 seconds, so send the top 20-100 candidates to rerank, not the whole result list. Concurrency and quota are shared with embeddings.

Reference sections (markdown for agents)