{
"results": [
{
"index": 1,
"relevance_score": 0.91
},
{
"index": 0,
"relevance_score": 0.12
}
]
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<unknown>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<unknown>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<unknown>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<unknown>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<unknown>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<unknown>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<unknown>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<unknown>"
}
}Rerank documents
Request parameters, responses, and channel compatibility.
{
"results": [
{
"index": 1,
"relevance_score": 0.91
},
{
"index": 0,
"relevance_score": 0.12
}
]
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<unknown>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<unknown>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<unknown>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<unknown>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<unknown>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<unknown>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<unknown>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<unknown>"
}
}POST /v1/rerank
Send JSON with model, a nonempty query, and candidate documents. Explicitly set top_n and return_documents and consult the guide for channel differences; unchanged forwarding is not guaranteed.
results[].index points to the original input array, and relevance_score is a model-dependent ranking score. The shape and availability of document and usage depend on the channel. Allow extra fields and do not depend on returned source text. This endpoint only ranks supplied candidates; it does not generate vectors or answers.
Guide and runnable example
简体中文Authorizations
模型调用 API Key,不是控制台登录凭据 / Model API key, not console login credentials
Body
支持此接口且当前密钥可用的模型 / Model available to this key and supporting this endpoint
"YOUR_MODEL_ID"
非空查询文本 / Nonempty query text
1非空候选列表;优先字符串,对象字段由渠道决定 / Nonempty candidates; prefer strings, object fields depend on channel
11建议正整数且不超过候选数;Cohere 省略或非正数时转为 1,其他渠道默认不同 / Use a positive count no larger than candidates; Cohere maps omitted/nonpositive to 1, other defaults differ
x >= 1请求回传原文;Cohere 强制 true,Ali 省略时默认 true;不能作为通用不回传保证 / Request source text; Cohere forces true, Ali defaults to true when omitted; not a universal suppression guarantee
可选渠道参数;注意单数拼写,部分适配器不转发 / Optional channel parameter; singular spelling, not forwarded by all adaptors
可选分块重叠参数;支持情况由渠道决定 / Optional chunk overlap; support depends on channel