For the complete documentation index, see llms.txt. This page is also available as Markdown.

Rerank

Rerank documents by relevance to a query.

Rerank documents

post

Rerank documents by relevance to a query.

Authorizations
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
Body
modelstringRequired

Reranking model identifier.

Example: rerank-v3.5
querystringRequired

Query used to rank the documents.

top_ninteger · min: 1Optional

Maximum number of results to return.

return_documentsbooleanOptional

Whether to include document text in the results.

Default: false
max_tokens_per_docinteger · min: 1Optional

Maximum number of tokens per document. Supported by Cohere.

priorityintegerOptional

Provider request-priority hint. Supported by Cohere.

rank_fieldsstring[]Optional

Object fields used for ranking. Supported by Pinecone.

truncationbooleanOptional

Whether to truncate oversized documents. Supported by Voyage.

Responses
200

Represents a reranking response returned by the selected model.

application/json
idstringOptional

Request identifier.

objectstringOptional

Response object type.

Example: list
modelstringOptional

The reranking model used.

providerstringOptional

Provider that handled the request.

post/v1/rerank
POST /v1/rerank HTTP/1.1
Host: api.nexos.ai
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 223

{
  "model": "rerank-v3.5",
  "query": "text",
  "documents": [
    "text"
  ],
  "top_n": 1,
  "return_documents": false,
  "max_tokens_per_doc": 1,
  "priority": 1,
  "rank_fields": [
    "text"
  ],
  "truncation": true,
  "parameters": {
    "ANY_ADDITIONAL_PROPERTY": "anything"
  }
}
{
  "id": "text",
  "object": "list",
  "model": "text",
  "provider": "text",
  "results": [
    {
      "index": 1,
      "relevance_score": 1,
      "document": {
        "text": "text",
        "ANY_ADDITIONAL_PROPERTY": "anything"
      }
    }
  ],
  "meta": {
    "billed_units": {
      "search_units": 1
    },
    "api_version": {
      "ANY_ADDITIONAL_PROPERTY": "anything"
    },
    "ANY_ADDITIONAL_PROPERTY": "anything"
  },
  "usage": {
    "billed_units": {
      "search_units": 1
    },
    "prompt_tokens": 1,
    "completion_tokens": 1,
    "total_tokens": 1,
    "prompt_tokens_details": {
      "cached_tokens": 1,
      "cache_write_tokens": 1
    },
    "nexos_credits_cost": 0.000016,
    "ANY_ADDITIONAL_PROPERTY": "anything"
  }
}

Last updated