Replace an evaluator definition
curl --request PUT \
--url https://api.dp1.us.honeyhive.ai/v1/projects/{project_id}/evaluators/{evaluator_id_or_slug} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"definition": {
"type": "python",
"python": {
"name": "<string>",
"metadata": {
"description": "<string>"
},
"sampling": {
"sampling_percentage": 50
},
"filters": {
"filterArray": [
{
"field": "<string>",
"value": "<string>"
}
]
},
"score_schema": {},
"code_execution": {
"code_snippet": "<string>"
}
}
},
"message": "<string>",
"publish": false
}
'import requests
url = "https://api.dp1.us.honeyhive.ai/v1/projects/{project_id}/evaluators/{evaluator_id_or_slug}"
payload = {
"definition": {
"type": "python",
"python": {
"name": "<string>",
"metadata": { "description": "<string>" },
"sampling": { "sampling_percentage": 50 },
"filters": { "filterArray": [
{
"field": "<string>",
"value": "<string>"
}
] },
"score_schema": {},
"code_execution": { "code_snippet": "<string>" }
}
},
"message": "<string>",
"publish": False
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
definition: {
type: 'python',
python: {
name: '<string>',
metadata: {description: '<string>'},
sampling: {sampling_percentage: 50},
filters: {filterArray: [{field: '<string>', value: '<string>'}]},
score_schema: {},
code_execution: {code_snippet: '<string>'}
}
},
message: '<string>',
publish: false
})
};
fetch('https://api.dp1.us.honeyhive.ai/v1/projects/{project_id}/evaluators/{evaluator_id_or_slug}', 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.dp1.us.honeyhive.ai/v1/projects/{project_id}/evaluators/{evaluator_id_or_slug}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'definition' => [
'type' => 'python',
'python' => [
'name' => '<string>',
'metadata' => [
'description' => '<string>'
],
'sampling' => [
'sampling_percentage' => 50
],
'filters' => [
'filterArray' => [
[
'field' => '<string>',
'value' => '<string>'
]
]
],
'score_schema' => [
],
'code_execution' => [
'code_snippet' => '<string>'
]
]
],
'message' => '<string>',
'publish' => false
]),
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.dp1.us.honeyhive.ai/v1/projects/{project_id}/evaluators/{evaluator_id_or_slug}"
payload := strings.NewReader("{\n \"definition\": {\n \"type\": \"python\",\n \"python\": {\n \"name\": \"<string>\",\n \"metadata\": {\n \"description\": \"<string>\"\n },\n \"sampling\": {\n \"sampling_percentage\": 50\n },\n \"filters\": {\n \"filterArray\": [\n {\n \"field\": \"<string>\",\n \"value\": \"<string>\"\n }\n ]\n },\n \"score_schema\": {},\n \"code_execution\": {\n \"code_snippet\": \"<string>\"\n }\n }\n },\n \"message\": \"<string>\",\n \"publish\": false\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.dp1.us.honeyhive.ai/v1/projects/{project_id}/evaluators/{evaluator_id_or_slug}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"definition\": {\n \"type\": \"python\",\n \"python\": {\n \"name\": \"<string>\",\n \"metadata\": {\n \"description\": \"<string>\"\n },\n \"sampling\": {\n \"sampling_percentage\": 50\n },\n \"filters\": {\n \"filterArray\": [\n {\n \"field\": \"<string>\",\n \"value\": \"<string>\"\n }\n ]\n },\n \"score_schema\": {},\n \"code_execution\": {\n \"code_snippet\": \"<string>\"\n }\n }\n },\n \"message\": \"<string>\",\n \"publish\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.dp1.us.honeyhive.ai/v1/projects/{project_id}/evaluators/{evaluator_id_or_slug}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"definition\": {\n \"type\": \"python\",\n \"python\": {\n \"name\": \"<string>\",\n \"metadata\": {\n \"description\": \"<string>\"\n },\n \"sampling\": {\n \"sampling_percentage\": 50\n },\n \"filters\": {\n \"filterArray\": [\n {\n \"field\": \"<string>\",\n \"value\": \"<string>\"\n }\n ]\n },\n \"score_schema\": {},\n \"code_execution\": {\n \"code_snippet\": \"<string>\"\n }\n }\n },\n \"message\": \"<string>\",\n \"publish\": false\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"id": "<string>",
"slug": "<string>",
"is_active": true,
"latest_version": 1073741824,
"published_version": 1073741824,
"version": 1073741824,
"definition": {
"type": "python",
"python": {
"name": "<string>",
"metadata": {
"description": "<string>"
},
"sampling": {
"sampling_percentage": 50
},
"filters": {
"filterArray": [
{
"field": "<string>",
"operator": "exists",
"value": "<string>",
"type": "string"
}
]
},
"score_schema": {},
"code_execution": {
"code_snippet": "<string>"
},
"test_criteria": {
"field": "<string>",
"criteria": {
"type": "numeric",
"operator": "gt",
"value": 123
}
}
}
},
"message": "<string>",
"evaluator_created_at": "2023-11-07T05:31:56Z",
"evaluator_updated_at": "2023-11-07T05:31:56Z",
"version_created_at": "2023-11-07T05:31:56Z"
}
}Evaluators
Replace an evaluator definition
Replace the complete definition of an active evaluator. A changed definition creates the next server-assigned version; an identical definition retains its version and message. Requires project.evaluator.update; publish=true additionally requires project.evaluator.publish. Archived evaluators return 409.
PUT
/
v1
/
projects
/
{project_id}
/
evaluators
/
{evaluator_id_or_slug}
Replace an evaluator definition
curl --request PUT \
--url https://api.dp1.us.honeyhive.ai/v1/projects/{project_id}/evaluators/{evaluator_id_or_slug} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"definition": {
"type": "python",
"python": {
"name": "<string>",
"metadata": {
"description": "<string>"
},
"sampling": {
"sampling_percentage": 50
},
"filters": {
"filterArray": [
{
"field": "<string>",
"value": "<string>"
}
]
},
"score_schema": {},
"code_execution": {
"code_snippet": "<string>"
}
}
},
"message": "<string>",
"publish": false
}
'import requests
url = "https://api.dp1.us.honeyhive.ai/v1/projects/{project_id}/evaluators/{evaluator_id_or_slug}"
payload = {
"definition": {
"type": "python",
"python": {
"name": "<string>",
"metadata": { "description": "<string>" },
"sampling": { "sampling_percentage": 50 },
"filters": { "filterArray": [
{
"field": "<string>",
"value": "<string>"
}
] },
"score_schema": {},
"code_execution": { "code_snippet": "<string>" }
}
},
"message": "<string>",
"publish": False
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
definition: {
type: 'python',
python: {
name: '<string>',
metadata: {description: '<string>'},
sampling: {sampling_percentage: 50},
filters: {filterArray: [{field: '<string>', value: '<string>'}]},
score_schema: {},
code_execution: {code_snippet: '<string>'}
}
},
message: '<string>',
publish: false
})
};
fetch('https://api.dp1.us.honeyhive.ai/v1/projects/{project_id}/evaluators/{evaluator_id_or_slug}', 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.dp1.us.honeyhive.ai/v1/projects/{project_id}/evaluators/{evaluator_id_or_slug}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'definition' => [
'type' => 'python',
'python' => [
'name' => '<string>',
'metadata' => [
'description' => '<string>'
],
'sampling' => [
'sampling_percentage' => 50
],
'filters' => [
'filterArray' => [
[
'field' => '<string>',
'value' => '<string>'
]
]
],
'score_schema' => [
],
'code_execution' => [
'code_snippet' => '<string>'
]
]
],
'message' => '<string>',
'publish' => false
]),
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.dp1.us.honeyhive.ai/v1/projects/{project_id}/evaluators/{evaluator_id_or_slug}"
payload := strings.NewReader("{\n \"definition\": {\n \"type\": \"python\",\n \"python\": {\n \"name\": \"<string>\",\n \"metadata\": {\n \"description\": \"<string>\"\n },\n \"sampling\": {\n \"sampling_percentage\": 50\n },\n \"filters\": {\n \"filterArray\": [\n {\n \"field\": \"<string>\",\n \"value\": \"<string>\"\n }\n ]\n },\n \"score_schema\": {},\n \"code_execution\": {\n \"code_snippet\": \"<string>\"\n }\n }\n },\n \"message\": \"<string>\",\n \"publish\": false\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.dp1.us.honeyhive.ai/v1/projects/{project_id}/evaluators/{evaluator_id_or_slug}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"definition\": {\n \"type\": \"python\",\n \"python\": {\n \"name\": \"<string>\",\n \"metadata\": {\n \"description\": \"<string>\"\n },\n \"sampling\": {\n \"sampling_percentage\": 50\n },\n \"filters\": {\n \"filterArray\": [\n {\n \"field\": \"<string>\",\n \"value\": \"<string>\"\n }\n ]\n },\n \"score_schema\": {},\n \"code_execution\": {\n \"code_snippet\": \"<string>\"\n }\n }\n },\n \"message\": \"<string>\",\n \"publish\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.dp1.us.honeyhive.ai/v1/projects/{project_id}/evaluators/{evaluator_id_or_slug}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"definition\": {\n \"type\": \"python\",\n \"python\": {\n \"name\": \"<string>\",\n \"metadata\": {\n \"description\": \"<string>\"\n },\n \"sampling\": {\n \"sampling_percentage\": 50\n },\n \"filters\": {\n \"filterArray\": [\n {\n \"field\": \"<string>\",\n \"value\": \"<string>\"\n }\n ]\n },\n \"score_schema\": {},\n \"code_execution\": {\n \"code_snippet\": \"<string>\"\n }\n }\n },\n \"message\": \"<string>\",\n \"publish\": false\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"id": "<string>",
"slug": "<string>",
"is_active": true,
"latest_version": 1073741824,
"published_version": 1073741824,
"version": 1073741824,
"definition": {
"type": "python",
"python": {
"name": "<string>",
"metadata": {
"description": "<string>"
},
"sampling": {
"sampling_percentage": 50
},
"filters": {
"filterArray": [
{
"field": "<string>",
"operator": "exists",
"value": "<string>",
"type": "string"
}
]
},
"score_schema": {},
"code_execution": {
"code_snippet": "<string>"
},
"test_criteria": {
"field": "<string>",
"criteria": {
"type": "numeric",
"operator": "gt",
"value": 123
}
}
}
},
"message": "<string>",
"evaluator_created_at": "2023-11-07T05:31:56Z",
"evaluator_updated_at": "2023-11-07T05:31:56Z",
"version_created_at": "2023-11-07T05:31:56Z"
}
}Authorizations
A fine-grained data plane API key (values begin with hh_fgdp_). Rooted at an organization, workspace, or project, it carries the permissions chosen when it was created, and only the operations whose paths begin with /v1/projects/{project_id}/ accept it. Create one in the HoneyHive app under the project's, workspace's, or organization's Settings → API Keys, on the Data Plane tab.
Path Parameters
Body
application/json
Was this page helpful?