Rerank documents
curl --request POST \
--url https://api.gately.ai/v1/rerank \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "mixr-v1",
"query": "What are the health benefits of exercise?",
"documents": [
"Exercise improves cardiovascular health and reduces stress.",
"Proper nutrition is essential for overall well-being.",
"Sleep quality affects mental and physical performance."
],
"top_n": 2
}
'import requests
url = "https://api.gately.ai/v1/rerank"
payload = {
"model": "mixr-v1",
"query": "What are the health benefits of exercise?",
"documents": ["Exercise improves cardiovascular health and reduces stress.", "Proper nutrition is essential for overall well-being.", "Sleep quality affects mental and physical performance."],
"top_n": 2
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'mixr-v1',
query: 'What are the health benefits of exercise?',
documents: [
'Exercise improves cardiovascular health and reduces stress.',
'Proper nutrition is essential for overall well-being.',
'Sleep quality affects mental and physical performance.'
],
top_n: 2
})
};
fetch('https://api.gately.ai/v1/rerank', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.gately.ai/v1/rerank",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => 'mixr-v1',
'query' => 'What are the health benefits of exercise?',
'documents' => [
'Exercise improves cardiovascular health and reduces stress.',
'Proper nutrition is essential for overall well-being.',
'Sleep quality affects mental and physical performance.'
],
'top_n' => 2
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.gately.ai/v1/rerank"
payload := strings.NewReader("{\n \"model\": \"mixr-v1\",\n \"query\": \"What are the health benefits of exercise?\",\n \"documents\": [\n \"Exercise improves cardiovascular health and reduces stress.\",\n \"Proper nutrition is essential for overall well-being.\",\n \"Sleep quality affects mental and physical performance.\"\n ],\n \"top_n\": 2\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.gately.ai/v1/rerank")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"mixr-v1\",\n \"query\": \"What are the health benefits of exercise?\",\n \"documents\": [\n \"Exercise improves cardiovascular health and reduces stress.\",\n \"Proper nutrition is essential for overall well-being.\",\n \"Sleep quality affects mental and physical performance.\"\n ],\n \"top_n\": 2\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gately.ai/v1/rerank")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"mixr-v1\",\n \"query\": \"What are the health benefits of exercise?\",\n \"documents\": [\n \"Exercise improves cardiovascular health and reduces stress.\",\n \"Proper nutrition is essential for overall well-being.\",\n \"Sleep quality affects mental and physical performance.\"\n ],\n \"top_n\": 2\n}"
response = http.request(request)
puts response.read_bodyAI Models API
Rerank
Rerank documents based on relevance to a query
POST
/
v1
/
rerank
Rerank documents
curl --request POST \
--url https://api.gately.ai/v1/rerank \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "mixr-v1",
"query": "What are the health benefits of exercise?",
"documents": [
"Exercise improves cardiovascular health and reduces stress.",
"Proper nutrition is essential for overall well-being.",
"Sleep quality affects mental and physical performance."
],
"top_n": 2
}
'import requests
url = "https://api.gately.ai/v1/rerank"
payload = {
"model": "mixr-v1",
"query": "What are the health benefits of exercise?",
"documents": ["Exercise improves cardiovascular health and reduces stress.", "Proper nutrition is essential for overall well-being.", "Sleep quality affects mental and physical performance."],
"top_n": 2
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'mixr-v1',
query: 'What are the health benefits of exercise?',
documents: [
'Exercise improves cardiovascular health and reduces stress.',
'Proper nutrition is essential for overall well-being.',
'Sleep quality affects mental and physical performance.'
],
top_n: 2
})
};
fetch('https://api.gately.ai/v1/rerank', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.gately.ai/v1/rerank",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => 'mixr-v1',
'query' => 'What are the health benefits of exercise?',
'documents' => [
'Exercise improves cardiovascular health and reduces stress.',
'Proper nutrition is essential for overall well-being.',
'Sleep quality affects mental and physical performance.'
],
'top_n' => 2
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.gately.ai/v1/rerank"
payload := strings.NewReader("{\n \"model\": \"mixr-v1\",\n \"query\": \"What are the health benefits of exercise?\",\n \"documents\": [\n \"Exercise improves cardiovascular health and reduces stress.\",\n \"Proper nutrition is essential for overall well-being.\",\n \"Sleep quality affects mental and physical performance.\"\n ],\n \"top_n\": 2\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.gately.ai/v1/rerank")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"mixr-v1\",\n \"query\": \"What are the health benefits of exercise?\",\n \"documents\": [\n \"Exercise improves cardiovascular health and reduces stress.\",\n \"Proper nutrition is essential for overall well-being.\",\n \"Sleep quality affects mental and physical performance.\"\n ],\n \"top_n\": 2\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gately.ai/v1/rerank")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"mixr-v1\",\n \"query\": \"What are the health benefits of exercise?\",\n \"documents\": [\n \"Exercise improves cardiovascular health and reduces stress.\",\n \"Proper nutrition is essential for overall well-being.\",\n \"Sleep quality affects mental and physical performance.\"\n ],\n \"top_n\": 2\n}"
response = http.request(request)
puts response.read_bodyThe Rerank endpoint helps improve search quality by reordering documents based on their relevance to a query.
Authentication Required
Learn how to get your API key to use this endpoint
Models
Available models for reranking:rerank-english-v2.0rerank-english-v3.0rerank-multilingual-v2.0rerank-multilingual-v3.0
Example Request
{
"model": "jina-reranker-v2-base-multilingual",
"query": "Organic skincare products for sensitive skin",
"top_n": 3,
"documents": [
"Organic skincare for sensitive skin with aloe vera and chamomile",
"New makeup trends focus on bold colors and innovative techniques",
"Natural remedies for skin inflammation and redness"
]
}
Was this page helpful?
⌘I

