curl --request POST \
--url https://flow.seekr.com/v1/inference/rerank \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "BAAI/bge-reranker-v2-m3",
"query": "What is the capital of France?",
"documents": [
"Paris is the capital and most populous city of France.",
"Berlin is the capital of Germany."
],
"top_n": 2
}
'import requests
url = "https://flow.seekr.com/v1/inference/rerank"
payload = {
"model": "BAAI/bge-reranker-v2-m3",
"query": "What is the capital of France?",
"documents": ["Paris is the capital and most populous city of France.", "Berlin is the capital of Germany."],
"top_n": 2
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'BAAI/bge-reranker-v2-m3',
query: 'What is the capital of France?',
documents: [
'Paris is the capital and most populous city of France.',
'Berlin is the capital of Germany.'
],
top_n: 2
})
};
fetch('https://flow.seekr.com/v1/inference/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://flow.seekr.com/v1/inference/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' => 'BAAI/bge-reranker-v2-m3',
'query' => 'What is the capital of France?',
'documents' => [
'Paris is the capital and most populous city of France.',
'Berlin is the capital of Germany.'
],
'top_n' => 2
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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://flow.seekr.com/v1/inference/rerank"
payload := strings.NewReader("{\n \"model\": \"BAAI/bge-reranker-v2-m3\",\n \"query\": \"What is the capital of France?\",\n \"documents\": [\n \"Paris is the capital and most populous city of France.\",\n \"Berlin is the capital of Germany.\"\n ],\n \"top_n\": 2\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
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://flow.seekr.com/v1/inference/rerank")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"BAAI/bge-reranker-v2-m3\",\n \"query\": \"What is the capital of France?\",\n \"documents\": [\n \"Paris is the capital and most populous city of France.\",\n \"Berlin is the capital of Germany.\"\n ],\n \"top_n\": 2\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://flow.seekr.com/v1/inference/rerank")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"BAAI/bge-reranker-v2-m3\",\n \"query\": \"What is the capital of France?\",\n \"documents\": [\n \"Paris is the capital and most populous city of France.\",\n \"Berlin is the capital of Germany.\"\n ],\n \"top_n\": 2\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"model": "<string>",
"usage": {
"prompt_tokens": 123,
"total_tokens": 123
},
"results": [
{
"index": 123,
"document": {
"text": "<string>",
"multi_modal": [
{
"text": "<string>",
"type": "text"
}
]
},
"relevance_score": 123
}
]
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": 123,
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": 123,
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": 123,
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": 123,
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": 123,
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": 123,
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": 123,
"param": "<string>"
}
}Rerank documents
Rerank a list of documents by relevance to a query.
curl --request POST \
--url https://flow.seekr.com/v1/inference/rerank \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "BAAI/bge-reranker-v2-m3",
"query": "What is the capital of France?",
"documents": [
"Paris is the capital and most populous city of France.",
"Berlin is the capital of Germany."
],
"top_n": 2
}
'import requests
url = "https://flow.seekr.com/v1/inference/rerank"
payload = {
"model": "BAAI/bge-reranker-v2-m3",
"query": "What is the capital of France?",
"documents": ["Paris is the capital and most populous city of France.", "Berlin is the capital of Germany."],
"top_n": 2
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'BAAI/bge-reranker-v2-m3',
query: 'What is the capital of France?',
documents: [
'Paris is the capital and most populous city of France.',
'Berlin is the capital of Germany.'
],
top_n: 2
})
};
fetch('https://flow.seekr.com/v1/inference/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://flow.seekr.com/v1/inference/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' => 'BAAI/bge-reranker-v2-m3',
'query' => 'What is the capital of France?',
'documents' => [
'Paris is the capital and most populous city of France.',
'Berlin is the capital of Germany.'
],
'top_n' => 2
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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://flow.seekr.com/v1/inference/rerank"
payload := strings.NewReader("{\n \"model\": \"BAAI/bge-reranker-v2-m3\",\n \"query\": \"What is the capital of France?\",\n \"documents\": [\n \"Paris is the capital and most populous city of France.\",\n \"Berlin is the capital of Germany.\"\n ],\n \"top_n\": 2\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
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://flow.seekr.com/v1/inference/rerank")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"BAAI/bge-reranker-v2-m3\",\n \"query\": \"What is the capital of France?\",\n \"documents\": [\n \"Paris is the capital and most populous city of France.\",\n \"Berlin is the capital of Germany.\"\n ],\n \"top_n\": 2\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://flow.seekr.com/v1/inference/rerank")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"BAAI/bge-reranker-v2-m3\",\n \"query\": \"What is the capital of France?\",\n \"documents\": [\n \"Paris is the capital and most populous city of France.\",\n \"Berlin is the capital of Germany.\"\n ],\n \"top_n\": 2\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"model": "<string>",
"usage": {
"prompt_tokens": 123,
"total_tokens": 123
},
"results": [
{
"index": 123,
"document": {
"text": "<string>",
"multi_modal": [
{
"text": "<string>",
"type": "text"
}
]
},
"relevance_score": 123
}
]
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": 123,
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": 123,
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": 123,
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": 123,
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": 123,
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": 123,
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": 123,
"param": "<string>"
}
}Authorizations
Your Seekr API key, sent in the Authorization header with no 'Bearer' prefix.
Body
x >= -1Which side to truncate from when truncate_prompt_tokens is active. 'right' keeps the first N tokens. 'left' keeps the last N tokens.
left, right The request_id related to this request. If the caller does not set it, a random uuid will be generated.
The priority of the request (lower means earlier handling; default: 0). Any priority other than 0 will raise an error if the served model does not use priority scheduling.
Additional kwargs to pass to the HF processor.
If specified, the prefix cache will be salted with the provided string to prevent an attacker from guessing prompts in multi-user environments.
Whether to use activation for the pooler outputs. null uses the pooler's default, which is true in most cases.
Maximum number of tokens per query. Queries longer than this will be truncated. 0 means no query-level truncation is applied.
Maximum number of tokens per document. Documents longer than this will be truncated. 0 means no document-level truncation is applied (only truncate_prompt_tokens applies to the combined query+document).
Task instruction prepended to each scored pair via the chat template. Equivalent to passing chat_template_kwargs={'instruction': ...}.
Additional keyword args to pass to the chat template renderer. Will be accessible by the score/rerank chat template.
x >= 0Was this page helpful?