Skip to main content
POST
/
evaluate
/
highlight
/
{highlight_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.scoreHighlight('highlight_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_highlight(
    highlight_id="highlight_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.ScoreHighlight(
		context.TODO(),
		"highlight_id",
		hyperspell.EvaluateScoreHighlightParams{},
	)
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", response.Message)
}
hyperspell evaluate score-highlight \
  --api-key 'My API Key' \
  --highlight-id highlight_id
curl --request POST \
  --url https://api.hyperspell.com/evaluate/highlight/{highlight_id} \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "score": 0,
  "comment": "<string>"
}
'
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.hyperspell.com/evaluate/highlight/{highlight_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,
    'comment' => '<string>'
  ]),
  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/highlight/{highlight_id}")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"score\": 0,\n  \"comment\": \"<string>\"\n}")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://api.hyperspell.com/evaluate/highlight/{highlight_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  \"comment\": \"<string>\"\n}"

response = http.request(request)
puts response.read_body
{
  "success": true,
  "message": "<string>"
}
{
  "detail": [
    {
      "loc": [
        "<string>"
      ],
      "msg": "<string>",
      "type": "<string>"
    }
  ]
}

Authorizations

Authorization
string
header
required

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

highlight_id
string
required

Body

application/json
score
number
default:0

Rating of the chunk from -1 (bad) to +1 (good).

Required range: -1 <= x <= 1
comment
string | null

Comment on the chunk

Response

Successful Response

success
boolean
required

Whether the feedback was successfully saved.

message
string
required

A message describing the result.