Skip to main content
POST
/
cohere
/
v2
/
rerank
Error
A valid request URL is required to generate request examples
{
  "id": "<string>",
  "results": [
    {
      "index": 123,
      "relevance_score": 123,
      "document": {}
    }
  ],
  "meta": {}
}

Authorizations

Authorization
string
header
required

Bearer token authentication. Use your provider API key or Bifrost authentication token. Virtual keys (prefixed with sk-bf-) can also be passed here.

Body

application/json
model
string
required

Cohere rerank model identifier (e.g. rerank-english-v3.0).

query
string
required

Query string to rank documents against.

documents
(string | object)[]
required

Documents to rerank. Strings or objects with a text field.

top_n
integer

Return only the top N reranked results.

return_documents
boolean

Include the original document text in the response.

max_tokens_per_doc
integer

Truncate each document to this token limit before ranking.

Response

Successful response

id
string
results
object[]
meta
object