Skip to main content
POST
/
v1
/
rerank
Rerank
curl --request POST \
  --url https://api.gravitex.ai/v1/rerank \
  --header 'Authorization: <authorization>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "model": "<string>",
  "query": "<string>",
  "documents": [
    {}
  ],
  "top_n": 123,
  "return_documents": true
}
'

Documentation Index

Fetch the complete documentation index at: https://docs.gravitex.ai/llms.txt

Use this file to discover all available pages before exploring further.

Introduction

Rerank a list of candidate documents by relevance to a query. Commonly used in RAG and knowledge-base search.

Authentication

Authorization
string
required
Bearer Token, e.g. Bearer sk-xxxxxxxxxx

Request parameters

model
string
required
Rerank model, e.g. rerank-english-v2.0
query
string
required
Query text
documents
array
required
Documents to rerank (strings or objects)
top_n
integer
Return top N results
return_documents
boolean
default:"false"
Include document text in results

Request example

curl -X POST "https://api.gravitex.ai/v1/rerank" \
  -H "Authorization: Bearer sk-xxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "rerank-english-v2.0",
    "query": "What is a vector database?",
    "documents": [
      "Vector databases store and search embeddings",
      "Today is sunny",
      "RAG pipelines often use reranking"
    ],
    "top_n": 2,
    "return_documents": true
  }'

Common parameters

  • query: User question or search query
  • documents: Candidate passages
  • top_n: Limit to top N hits
  • return_documents: Include source text when true
The results array contains index and relevance_score, sorted by score.