LLM Gateway

Rerank documents

>-

POST
/v1/rerank

Reranks a list of documents against a query using a reranking model. Returns documents ordered by relevance score. Compatible with the Cohere rerank API format.

Authorization

bearerAuth
AuthorizationBearer <token>

Bearer token authentication using API keys

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/v1/rerank" \  -H "Content-Type: application/json" \  -d '{    "model": "cohere-rerank-v3-5",    "query": "What is the capital of the United States?",    "documents": [      "Carson City is the capital of Nevada.",      "Washington, D.C. is the capital of the United States."    ]  }'
{
  "object": "list",
  "results": [
    {
      "index": 0,
      "relevance_score": 0,
      "document": {
        "text": "string"
      }
    }
  ],
  "model": "string",
  "usage": {
    "total_tokens": 0
  }
}
{
  "error": {
    "message": "string",
    "type": "string",
    "param": "string",
    "code": "string"
  }
}
{
  "error": {
    "message": "string",
    "type": "string",
    "param": "string",
    "code": "string"
  }
}
{
  "error": {
    "message": "string",
    "type": "string",
    "param": "string",
    "code": "string"
  }
}

How is this guide?

Last updated on