JavaScript
import Hyperspell from '@hyperspell/hyperspell';
const client = new Hyperspell({
apiKey: process.env['HYPERSPELL_API_KEY'], // This is the default and can be omitted
});
const response = await client.evaluate.scoreQuery('query_id');
console.log(response.message);import os
from hyperspell import Hyperspell
client = Hyperspell(
api_key=os.environ.get("HYPERSPELL_API_KEY"), # This is the default and can be omitted
)
response = client.evaluate.score_query(
query_id="query_id",
)
print(response.message)package main
import (
"context"
"fmt"
"github.com/hyperspell/hyperspell-go"
"github.com/hyperspell/hyperspell-go/option"
)
func main() {
client := hyperspell.NewClient(
option.WithAPIKey("My API Key"),
)
response, err := client.Evaluate.ScoreQuery(
context.TODO(),
"query_id",
hyperspell.EvaluateScoreQueryParams{},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Message)
}hyperspell evaluate score-query \
--api-key 'My API Key' \
--query-id query_idcurl --request POST \
--url https://api.hyperspell.com/evaluate/query/{query_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"score": 0
}'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.hyperspell.com/evaluate/query/{query_id}",
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([
'score' => 0
]),
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;
}HttpResponse<String> response = Unirest.post("https://api.hyperspell.com/evaluate/query/{query_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"score\": 0\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.hyperspell.com/evaluate/query/{query_id}")
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 \"score\": 0\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Evaluation
Score a query result
Score the result of a query.
POST
/
evaluate
/
query
/
{query_id}
JavaScript
import Hyperspell from '@hyperspell/hyperspell';
const client = new Hyperspell({
apiKey: process.env['HYPERSPELL_API_KEY'], // This is the default and can be omitted
});
const response = await client.evaluate.scoreQuery('query_id');
console.log(response.message);import os
from hyperspell import Hyperspell
client = Hyperspell(
api_key=os.environ.get("HYPERSPELL_API_KEY"), # This is the default and can be omitted
)
response = client.evaluate.score_query(
query_id="query_id",
)
print(response.message)package main
import (
"context"
"fmt"
"github.com/hyperspell/hyperspell-go"
"github.com/hyperspell/hyperspell-go/option"
)
func main() {
client := hyperspell.NewClient(
option.WithAPIKey("My API Key"),
)
response, err := client.Evaluate.ScoreQuery(
context.TODO(),
"query_id",
hyperspell.EvaluateScoreQueryParams{},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Message)
}hyperspell evaluate score-query \
--api-key 'My API Key' \
--query-id query_idcurl --request POST \
--url https://api.hyperspell.com/evaluate/query/{query_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"score": 0
}'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.hyperspell.com/evaluate/query/{query_id}",
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([
'score' => 0
]),
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;
}HttpResponse<String> response = Unirest.post("https://api.hyperspell.com/evaluate/query/{query_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"score\": 0\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.hyperspell.com/evaluate/query/{query_id}")
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 \"score\": 0\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Authorizations
APIKeyAsUser
API Key or JWT User Token. If using an API Key, set the X-As-User header to act as a specific user. A JWT User Token is always scoped to a specific user.
Path Parameters
Body
application/json
Rating of the query result from -1 (bad) to +1 (good).
Required range:
-1 <= x <= 1Was this page helpful?
⌘I