POST
https://api.wylon.cn/v1/rerank
Rerank
Given a query and a list of candidate documents, the rerank model rescores and reorders them by relevance. Often used as the second-stage refiner in RAG retrieval to boost recall quality.
Authorization
Authorizationstring · headerrequired
Bearer token.
Request body
modelstringrequired
Rerank model ID, e.g.
BAAI/bge-reranker-v2-m3.querystringrequired
Query text.
documentsstring[]required
Candidate documents to rerank; up to 1000 per request is recommended.
top_nintegeroptional
Return only the top N results; if unset, returns all sorted by score descending.
return_documentsbooleanfalse
When
true, each result includes the original document text for easy consumption.Response
modelstring
The rerank model ID that actually served this request.
resultsarray
Results sorted by relevance, descending.
indexinteger
Index of the document in the original
documents array.relevance_scorenumber
Relevance score in
[0, 1]; higher means more relevant.documentstringoptional
Returned only when
return_documents=true.usageobject
Token usage for this request.
Example response
{
"model": "BAAI/bge-reranker-v2-m3",
"results": [
{ "index": 2, "relevance_score": 0.94 },
{ "index": 0, "relevance_score": 0.78 },
{ "index": 1, "relevance_score": 0.32 }
],
"usage": { "total_tokens": 156 }
}
Example — 400
{
"error": {
"type": "invalid_request_error",
"message": "`documents` must contain at least 1 item."
}
}