OpenAI Reranks
During the retrieval stage, search systems prioritize efficiency, which may result in candidate documents that are not sufficiently precise. Reranking models perform a second-stage ranking on the retrieved documents, placing the most relevant results at the top to significantly improve retrieval accuracy.
Endpoint
| Method | Endpoint |
|---|---|
| POST | https://neolink.com/api/v1/rerank |
Authentication
| Method | Description |
|---|---|
| Bearer Token | Include Authorization: Bearer <API_key> in the request header for account verification. |
Request Headers
| Parameter | Type | Required | Description |
|---|---|---|---|
Content-Type | string | Yes | Media type of the request body, set to application/json |
Authorization | string | Yes | Bearer API_key for account verification |
Request Body
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
model | string | Yes | - | Model ID to use |
query | string | Yes | - | User's query text for relevance matching with documents |
documents | array | Yes | - | List of documents to be ranked, each element is a string document |
top_n | int | No | - | Return the top N most relevant documents after ranking. If not specified, returns all documents in ranked order |
instruct | string | No | - | Task instruction to guide the model on how to understand the relationship between query and documents |
return_documents | bool | No | true | Whether to return original document content in the results |
Request Example
bash
curl --location 'https://neolink.com/api/v1/rerank' \
--header 'Authorization: Bearer <API Key>' \
--header 'Content-Type: application/json' \
--data '{
"model": "<Model ID>",
"documents": [
"Text reranking models are widely used in search engines and recommendation systems to rank candidate texts based on their relevance.",
"Quantum computing is a cutting-edge field in computer science.",
"The development of pretrained language models has led to significant advances in text reranking models."
],
"query": "What is a text reranking model?",
"top_n": 2,
"instruct": "Given a web search query, retrieve relevant passages that answer the query."
}'python
import requests
url = "https://neolink.com/api/v1/rerank"
headers = {
"Authorization": "Bearer <API Key>",
"Content-Type": "application/json",
}
payload = {
"model": "<Model ID>",
"documents": [
"Text reranking models are widely used in search engines and recommendation systems to rank candidate texts based on their relevance.",
"Quantum computing is a cutting-edge field in computer science.",
"The development of pretrained language models has led to significant advances in text reranking models.",
],
"query": "What is a text reranking model?",
"top_n": 2,
"instruct": (
"Given a web search query, retrieve relevant passages "
"that answer the query."
),
}
response = requests.post(
url,
headers=headers,
json=payload,
timeout=60,
)
response.raise_for_status()
print(response.status_code)
print(response.json())Supported Model IDs:
- qwen3-rerank
