Python
import os
from scale_gp import SGPClient
client = SGPClient(
api_key=os.environ.get("SGP_API_KEY"), # This is the default and can be omitted
)
reranking_response = client.models.rerankings.create(
model_deployment_id="model_deployment_id",
chunks=["string"],
query="query",
)
print(reranking_response.chunk_scores)package main
import (
"context"
"fmt"
"github.com/stainless-sdks/sgp-go"
"github.com/stainless-sdks/sgp-go/option"
)
func main() {
client := sgp.NewClient(
option.WithAPIKey("My API Key"),
)
rerankingResponse, err := client.Models.Rerankings.New(
context.TODO(),
"model_deployment_id",
sgp.ModelRerankingNewParams{
Chunks: sgp.F([]string{"string"}),
Query: sgp.F("query"),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", rerankingResponse.ChunkScores)
}curl --request POST \
--url https://api.egp.scale.com/v4/models/{model_deployment_id}/rerankings \
--header 'Content-Type: application/json' \
--data '
{
"query": "<string>",
"chunks": [
"<string>"
],
"instruction": "<string>"
}
'const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({query: '<string>', chunks: ['<string>'], instruction: '<string>'})
};
fetch('https://api.egp.scale.com/v4/models/{model_deployment_id}/rerankings', 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.egp.scale.com/v4/models/{model_deployment_id}/rerankings",
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([
'query' => '<string>',
'chunks' => [
'<string>'
],
'instruction' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.post("https://api.egp.scale.com/v4/models/{model_deployment_id}/rerankings")
.header("Content-Type", "application/json")
.body("{\n \"query\": \"<string>\",\n \"chunks\": [\n \"<string>\"\n ],\n \"instruction\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.egp.scale.com/v4/models/{model_deployment_id}/rerankings")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"query\": \"<string>\",\n \"chunks\": [\n \"<string>\"\n ],\n \"instruction\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"chunk_scores": [
123
],
"tokens_used": 0
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Models
Generate reranking
Description
TODO: Documentation
POST
/
v4
/
models
/
{model_deployment_id}
/
rerankings
Python
import os
from scale_gp import SGPClient
client = SGPClient(
api_key=os.environ.get("SGP_API_KEY"), # This is the default and can be omitted
)
reranking_response = client.models.rerankings.create(
model_deployment_id="model_deployment_id",
chunks=["string"],
query="query",
)
print(reranking_response.chunk_scores)package main
import (
"context"
"fmt"
"github.com/stainless-sdks/sgp-go"
"github.com/stainless-sdks/sgp-go/option"
)
func main() {
client := sgp.NewClient(
option.WithAPIKey("My API Key"),
)
rerankingResponse, err := client.Models.Rerankings.New(
context.TODO(),
"model_deployment_id",
sgp.ModelRerankingNewParams{
Chunks: sgp.F([]string{"string"}),
Query: sgp.F("query"),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", rerankingResponse.ChunkScores)
}curl --request POST \
--url https://api.egp.scale.com/v4/models/{model_deployment_id}/rerankings \
--header 'Content-Type: application/json' \
--data '
{
"query": "<string>",
"chunks": [
"<string>"
],
"instruction": "<string>"
}
'const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({query: '<string>', chunks: ['<string>'], instruction: '<string>'})
};
fetch('https://api.egp.scale.com/v4/models/{model_deployment_id}/rerankings', 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.egp.scale.com/v4/models/{model_deployment_id}/rerankings",
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([
'query' => '<string>',
'chunks' => [
'<string>'
],
'instruction' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.post("https://api.egp.scale.com/v4/models/{model_deployment_id}/rerankings")
.header("Content-Type", "application/json")
.body("{\n \"query\": \"<string>\",\n \"chunks\": [\n \"<string>\"\n ],\n \"instruction\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.egp.scale.com/v4/models/{model_deployment_id}/rerankings")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"query\": \"<string>\",\n \"chunks\": [\n \"<string>\"\n ],\n \"instruction\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"chunk_scores": [
123
],
"tokens_used": 0
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}⌘I

