OhMyGPT
Rerank

Rerank documents

POST
/v1/rerank

Orders documents by how relevant each is to a query, in the Cohere and Jina rerank format. model, query and documents are read; every other field (top_n, return_documents, max_tokens_per_doc and so on) is passed to the model unchanged, and the response is the model's own. Billed per query or per token, whichever the model's price in GET /v1/models lists.

Authorization

ApiKeyAuth
headerAuthorization<token>

Request Body

application/json
  1. body

Fields other than these three, such as top_n and return_documents, are passed to the model unchanged.

documents*array<string|>

The documents to order, as strings or as objects with a text field.

Items1 <= items
model*string

A rerank model ID from GET /v1/models

query*string
top_n?integer

Return only the most relevant N documents.

Range1 <= value
[key: string]?any

Response Body

Successful response

application/json
  1. response

The model's rerank response.

id?string
results?array<>

Documents ordered from most to least relevant.

[key: string]?any
Example Request
curl -X POST 'https://api.ohmygpt.com/v1/rerank' \  -H 'Content-Type: application/json' \  -d '{  "documents": [    "string"  ],  "model": "string",  "query": "string"}'
Example Response
{  "id": "string",  "results": [    {      "index": 0,      "relevance_score": 0    }  ]}