GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • zembed-1
  • ZeroEntropy home page
  • Community
  • Dashboard
  • Documentation
  • API Reference
  • Home page
  • Discord Community
  • Blog
  • POSTEmbed
  • POSTGet Status
  • POSTAdd Collection
  • POSTGet Collection List
  • POSTDelete Collection

This view

  • Original page
  • New address

GeezerVison is showing docs.zeroentropy.dev — Rerank - ZeroEntropy

Rerank
curl --request POST \
  --url https://api.zeroentropy.dev/v1/models/rerank \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "model": "<string>",
  "query": "<string>",
  "documents": [
    "<string>"
  ],
  "top_n": 123
}
'
import requests

url = "https://api.zeroentropy.dev/v1/models/rerank"

payload = {
    "model": "<string>",
    "query": "<string>",
    "documents": ["<string>"],
    "top_n": 123
}
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: '<string>', query: '<string>', documents: ['<string>'], top_n: 123})
};

fetch('https://api.zeroentropy.dev/v1/models/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.zeroentropy.dev/v1/models/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' => '<string>',
    'query' => '<string>',
    'documents' => [
        '<string>'
    ],
    'top_n' => 123
  ]),
  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.zeroentropy.dev/v1/models/rerank"

	payload := strings.NewReader("{\n  \"model\": \"<string>\",\n  \"query\": \"<string>\",\n  \"documents\": [\n    \"<string>\"\n  ],\n  \"top_n\": 123\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.zeroentropy.dev/v1/models/rerank")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"model\": \"<string>\",\n  \"query\": \"<string>\",\n  \"documents\": [\n    \"<string>\"\n  ],\n  \"top_n\": 123\n}")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://api.zeroentropy.dev/v1/models/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\": \"<string>\",\n  \"query\": \"<string>\",\n  \"documents\": [\n    \"<string>\"\n  ],\n  \"top_n\": 123\n}"

response = http.request(request)
puts response.read_body
{
  "results": [
    {
      "index": 123,
      "relevance_score": 123
    }
  ],
  "total_bytes": 123,
  "total_tokens": 123,
  "actual_latency_mode": "fast",
  "e2e_latency": 123,
  "inference_latency": 123
}
{
  "detail": "Description of Error"
}
{
  "detail": [
    {
      "loc": [
        "<string>"
      ],
      "msg": "<string>",
      "type": "<string>"
    }
  ]
}
POST
/
models
/
rerank
Rerank
curl --request POST \
  --url https://api.zeroentropy.dev/v1/models/rerank \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "model": "<string>",
  "query": "<string>",
  "documents": [
    "<string>"
  ],
  "top_n": 123
}
'
import requests

url = "https://api.zeroentropy.dev/v1/models/rerank"

payload = {
    "model": "<string>",
    "query": "<string>",
    "documents": ["<string>"],
    "top_n": 123
}
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: '<string>', query: '<string>', documents: ['<string>'], top_n: 123})
};

fetch('https://api.zeroentropy.dev/v1/models/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.zeroentropy.dev/v1/models/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' => '<string>',
    'query' => '<string>',
    'documents' => [
        '<string>'
    ],
    'top_n' => 123
  ]),
  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.zeroentropy.dev/v1/models/rerank"

	payload := strings.NewReader("{\n  \"model\": \"<string>\",\n  \"query\": \"<string>\",\n  \"documents\": [\n    \"<string>\"\n  ],\n  \"top_n\": 123\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.zeroentropy.dev/v1/models/rerank")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"model\": \"<string>\",\n  \"query\": \"<string>\",\n  \"documents\": [\n    \"<string>\"\n  ],\n  \"top_n\": 123\n}")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://api.zeroentropy.dev/v1/models/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\": \"<string>\",\n  \"query\": \"<string>\",\n  \"documents\": [\n    \"<string>\"\n  ],\n  \"top_n\": 123\n}"

response = http.request(request)
puts response.read_body
{
  "results": [
    {
      "index": 123,
      "relevance_score": 123
    }
  ],
  "total_bytes": 123,
  "total_tokens": 123,
  "actual_latency_mode": "fast",
  "e2e_latency": 123,
  "inference_latency": 123
}
{
  "detail": "Description of Error"
}
{
  "detail": [
    {
      "loc": [
        "<string>"
      ],
      "msg": "<string>",
      "type": "<string>"
    }
  ]
}

Authorizations

​
Authorization
string
header
required

The Authorization header must be provided in the format Bearer <your-api-key>.

You can get your API Key at the Dashboard!

Body

application/json
​
model
string
required

The model ID to use for reranking. Options are: ["zerank-2", "zerank-1", "zerank-1-small"]

​
query
string
required

The query to rerank the documents by.

​
documents
string[]
required

The list of documents to rerank. Each document is a string.

​
top_n
integer | null

If provided, then only the top n documents will be returned in the results array. Otherwise, n will be the length of the provided documents array.

​
latency
enum<string> | null

Whether the call will be inferenced "fast" or "slow". RateLimits for slow API calls are orders of magnitude higher, but you can expect >10 second latency. Fast inferences are guaranteed subsecond, but rate limits are lower. If not specified, first a "fast" call will be attempted, but if you have exceeded your fast rate limit, then a slow call will be executed. If explicitly set to "fast", then 429 will be returned if it cannot be executed fast.

Available options:
fast,
slow

Response

Successful Response

​
results
RerankResult · object[]
required

The results, ordered by descending order of relevance to the query.

Show child attributes

​
total_bytes
integer
required

The total number of bytes in the request. This is used for ratelimiting.

​
total_tokens
integer
required

The total number of tokens in the request. This is used for billing.

​
actual_latency_mode
enum<string>
required

The type of inference actually used. If auto is requested, then fast will be used by default, with slow as a fallback if your ratelimit is exceeded. Else, this field will be identical to the requested latency mode.

Available options:
fast,
slow
​
e2e_latency
number
required

The total time, in seconds, between rerank request received and rerank response returned. Client latency should equal e2e_latency + your ping to ZeroEntropy's API.

​
inference_latency
number
required

The time, in seconds, to actually inference the request. If this is significantly lower than e2e_latency, this is likely due to ratelimiting. Please request a higher ratelimit at [email protected] or message us on Discord or Slack!

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.