v4

OpenAPI 3.1.02026-08-01166346466.7 KB

Rerank different kind of documents for a given query

Rerank different kind of documents for a given query.

Args: params: RerankParams: The parameters for reranking.

Returns: RerankResponse: The reranked documents for the input query.

post/v1/reranking

Request body

modelstring

The model to use for reranking documents.

querystring required

The query to rerank the documents.

rank_fieldsstring[] nullable

The fields of the documents to rank.

top_kinteger

The number of documents to return.

return_inputboolean

Whether to return the documents.

rewrite_queryboolean

Wether or not to rewrite the query before passing it to the reranking model

Example request

{
  "model": "mixedbread-ai/mxbai-rerank-large-v2",
  "query": "What are the key features of the Mixedbread embedding model?",
  "input": [
    "Document 1",
    "Document 2"
  ],
  "rank_fields": [
    "content",
    "title"
  ],
  "top_k": 10
}

Response

The reranked documents for the input query

modelstring required

The model used

object'list'

The object type of the response

top_kinteger required

The number of documents to return.

return_inputboolean required

Whether to return the documents.

Example response

{
  "data": [
    {
      "index": 0,
      "input": {
        "field1": "value1",
        "field2": "value2"
      },
      "object": "rank_result",
      "score": 0.95
    },
    {
      "index": 1,
      "input": "Hello, world!",
      "object": "rank_result",
      "score": 0.94
    }
  ],
  "top_k": 10
}