POST
/
rerank
curl --request POST \
  --url https://api.siliconflow.cn/v1/rerank \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "model": "BAAI/bge-reranker-v2-m3",
  "query": "Apple",
  "documents": [
    "苹果",
    "香蕉",
    "水果",
    "蔬菜"
  ],
  "top_n": 4,
  "return_documents": false,
  "max_chunks_per_doc": 1024,
  "overlap_tokens": 80
}'
{
  "id": "<string>",
  "results": [
    {
      "document": {
        "text": "<string>"
      },
      "index": 123,
      "relevance_score": 123
    }
  ],
  "tokens": {
    "input_tokens": 123,
    "output_tokens": 123
  }
}

Authorizations

Authorization
string
header
required

Use the following format for authentication: Bearer <your api key>

Body

application/json
model
enum<string>
required

对应的模型名称。为更好的提升服务质量,我们将不定期对本服务提供的模型做相关变更,包括但不限于模型上下线,模型服务能力调整,我们会在可行的情况下以公告、消息推送等适当的方式进行通知。

Available options:
BAAI/bge-reranker-v2-m3,
netease-youdao/bce-reranker-base_v1
query
string
default:
Apple
required

Required. The search query.

documents
string[]
required

暂时仅支持字符串列表形式,后续会支持文档对象.

top_n
integer

Number of most relevant documents or indices to return.

return_documents
boolean
default:
false

If false, the response does not include document text; if true, it includes the input document text.

max_chunks_per_doc
integer
default:
1024

Maximum number of chunks generated from within a document. Long documents are divided into multiple chunks for calculation, and the highest score among the chunks is taken as the document's score.

overlap_tokens
integer
default:
80

Number of token overlaps between adjacent chunks when documents are chunked.

Required range: x < 80

Response

200
application/json
200
id
string
required
results
object[]
required
tokens
object
required