Skip to main content

Reranking

This page documents the rerank endpoint and its compatibility notes.

Apifox Coverage Notes

  • Standard rerank
  • Jina AI rerank format
  • Cohere rerank format
  • Xinference rerank format

Model APIs / Rerank

POST Xinference Rerank Format

POST /rerank

Important: Xinference rerank responses are reshaped into the Jina rerank response schema, so usage is the same as Jina rerank. For clients such as Dify, choose Jina AI as the provider type during configuration rather than Xinference, and use a model name supported by Xinference.

Overview: the Xinference rerank API is fully compatible with the Jina AI rerank API. Refer to the Jina AI rerank-format documentation for complete usage instructions, request parameters, and response formats.

Usage: when using the Xinference rerank API, set model to any rerank model supported by Xinference. All other parameters and usage patterns are the same as the Jina AI rerank API.

Body Parameters

{
"model": "jina-reranker-m0",
"query": "什么是美国的首都?",
"documents": [
"内华达州的首府是卡森城。",
"北马里亚纳群岛是太平洋上的一组岛屿,其首都是塞班岛。",
"华盛顿特区(也称为华盛顿或特区,正式名称为哥伦比亚特区)是美国的首都。",
"英语语法中的大写是在单词开头使用大写字母。英语用法与其他语言的大写不同。",
"自美国成为一个国家之前,美国就存在死刑。截至2017年,在50个州中有30个州死刑合法。"
],
"top_n": 3
}

Request Parameters

NameInTypeRequiredDescription
Content-TypeheaderstringYesnone
AcceptheaderstringYesnone
AuthorizationheaderstringNonone
bodybodyobjectNonone
» modelbodystringYesID of the model to use. See the model endpoint compatibility table for which models are compatible with the Chat API.
» messagesbody[object]YesMessages used to generate a chat completion in the chat format.
»» rolebodystringNonone
»» contentbodystringNonone
» temperaturebodyintegerNoSampling temperature between 0 and 2. Higher values such as 0.8 make output more random, while lower values such as 0.2 make it more focused and deterministic. In most cases, adjust this or top_p, but not both.
» top_pbodyintegerNoAlternative to temperature sampling, known as nucleus sampling, where the model considers only tokens that together make up the top_p probability mass. For example, 0.1 means only the top 10% probability mass is considered. In most cases, adjust this or temperature, but not both.
» nbodyintegerNoNumber of chat-completion choices to generate for each input message.
» streambodybooleanNoIf set, partial message deltas are streamed the same way they are in ChatGPT. As tokens become available, they are sent as data-only server-sent events, with the stream terminated by data: [DONE]. See the OpenAI Cookbook example code.
» stopbodystringNoUp to four sequences where the API should stop generating additional tokens.
» max_tokensbodyintegerNoMaximum number of tokens to generate for the chat completion. The combined length of input and generated tokens is still limited by the model context window.
» presence_penaltybodynumberNoA number between -2.0 and 2.0. Positive values penalize new tokens based on whether they have already appeared in the text so far, increasing the chance that the model discusses new topics. Read more about frequency and presence penalties.
» frequency_penaltybodynumberNoA number between -2.0 and 2.0. Positive values penalize tokens based on how often they already appear in the text, reducing the chance that the model repeats the same line verbatim. Read more about frequency and presence penalties.
» logit_biasbodynullNoAdjusts the likelihood that specified tokens appear in the completion. Accepts a JSON object that maps token IDs to bias values from -100 to 100. Mathematically, the bias is added to the logits produced by the model before sampling. The exact effect varies by model, but values between -1 and 1 should slightly decrease or increase selection likelihood, while values like -100 or 100 should effectively ban or force the relevant token.
» userbodystringNoUnique identifier representing your end user. Helps OpenAI monitor and detect abuse. Learn more.

Response Example

200 Response

{
"id": "string",
"object": "string",
"created": 0,
"choices": [
{
"index": 0,
"message": {
"role": "string",
"content": "string"
},
"finish_reason": "string"
}
],
"usage": {
"prompt_tokens": 0,
"completion_tokens": 0,
"total_tokens": 0
}
}

Responses

StatusMeaningDescriptionModel
200OKnoneInline

Response Schema

Status 200

NameTypeRequiredConstraintsChinese NameDescription
» idstringtruenonenone
» objectstringtruenonenone
» createdintegertruenonenone
» choices[object]truenonenone
»» indexintegerfalsenonenone
»» messageobjectfalsenonenone
»»» rolestringtruenonenone
»»» contentstringtruenonenone
»» finish_reasonstringfalsenonenone
» usageobjecttruenonenone
»» prompt_tokensintegertruenonenone
»» completion_tokensintegertruenonenone
»» total_tokensintegertruenonenone