Create several Classifier metrics at once (classifier metrics only)
curl --request POST \
--url https://api.galtea.ai/metrics/bulk \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"metrics": [
{
"name": "<string>",
"classifierQuestion": {
"instructions": "<string>",
"criteria": {
"yes": "<string>",
"no": "<string>"
},
"levels": [
{
"description": "<string>",
"score": 123
}
],
"doesNotApply": "<string>"
},
"description": "<string>",
"tags": [
"<string>"
],
"evaluatorModelName": "jev-1.13.0",
"specificationIds": [
"<string>"
],
"passThreshold": 0.7,
"applicabilityScope": "PRODUCTION",
"applicabilityThreshold": 0.7
}
]
}
'import requests
url = "https://api.galtea.ai/metrics/bulk"
payload = { "metrics": [
{
"name": "<string>",
"classifierQuestion": {
"instructions": "<string>",
"criteria": {
"yes": "<string>",
"no": "<string>"
},
"levels": [
{
"description": "<string>",
"score": 123
}
],
"doesNotApply": "<string>"
},
"description": "<string>",
"tags": ["<string>"],
"evaluatorModelName": "jev-1.13.0",
"specificationIds": ["<string>"],
"passThreshold": 0.7,
"applicabilityScope": "PRODUCTION",
"applicabilityThreshold": 0.7
}
] }
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({
metrics: [
{
name: '<string>',
classifierQuestion: {
instructions: '<string>',
criteria: {yes: '<string>', no: '<string>'},
levels: [{description: '<string>', score: 123}],
doesNotApply: '<string>'
},
description: '<string>',
tags: ['<string>'],
evaluatorModelName: 'jev-1.13.0',
specificationIds: ['<string>'],
passThreshold: 0.7,
applicabilityScope: 'PRODUCTION',
applicabilityThreshold: 0.7
}
]
})
};
fetch('https://api.galtea.ai/metrics/bulk', 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.galtea.ai/metrics/bulk",
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([
'metrics' => [
[
'name' => '<string>',
'classifierQuestion' => [
'instructions' => '<string>',
'criteria' => [
'yes' => '<string>',
'no' => '<string>'
],
'levels' => [
[
'description' => '<string>',
'score' => 123
]
],
'doesNotApply' => '<string>'
],
'description' => '<string>',
'tags' => [
'<string>'
],
'evaluatorModelName' => 'jev-1.13.0',
'specificationIds' => [
'<string>'
],
'passThreshold' => 0.7,
'applicabilityScope' => 'PRODUCTION',
'applicabilityThreshold' => 0.7
]
]
]),
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.galtea.ai/metrics/bulk"
payload := strings.NewReader("{\n \"metrics\": [\n {\n \"name\": \"<string>\",\n \"classifierQuestion\": {\n \"instructions\": \"<string>\",\n \"criteria\": {\n \"yes\": \"<string>\",\n \"no\": \"<string>\"\n },\n \"levels\": [\n {\n \"description\": \"<string>\",\n \"score\": 123\n }\n ],\n \"doesNotApply\": \"<string>\"\n },\n \"description\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"evaluatorModelName\": \"jev-1.13.0\",\n \"specificationIds\": [\n \"<string>\"\n ],\n \"passThreshold\": 0.7,\n \"applicabilityScope\": \"PRODUCTION\",\n \"applicabilityThreshold\": 0.7\n }\n ]\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.galtea.ai/metrics/bulk")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"metrics\": [\n {\n \"name\": \"<string>\",\n \"classifierQuestion\": {\n \"instructions\": \"<string>\",\n \"criteria\": {\n \"yes\": \"<string>\",\n \"no\": \"<string>\"\n },\n \"levels\": [\n {\n \"description\": \"<string>\",\n \"score\": 123\n }\n ],\n \"doesNotApply\": \"<string>\"\n },\n \"description\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"evaluatorModelName\": \"jev-1.13.0\",\n \"specificationIds\": [\n \"<string>\"\n ],\n \"passThreshold\": 0.7,\n \"applicabilityScope\": \"PRODUCTION\",\n \"applicabilityThreshold\": 0.7\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.galtea.ai/metrics/bulk")
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 \"metrics\": [\n {\n \"name\": \"<string>\",\n \"classifierQuestion\": {\n \"instructions\": \"<string>\",\n \"criteria\": {\n \"yes\": \"<string>\",\n \"no\": \"<string>\"\n },\n \"levels\": [\n {\n \"description\": \"<string>\",\n \"score\": 123\n }\n ],\n \"doesNotApply\": \"<string>\"\n },\n \"description\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"evaluatorModelName\": \"jev-1.13.0\",\n \"specificationIds\": [\n \"<string>\"\n ],\n \"passThreshold\": 0.7,\n \"applicabilityScope\": \"PRODUCTION\",\n \"applicabilityThreshold\": 0.7\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"metrics": [
{
"id": "metric_123",
"metricGroupId": "metric_123",
"parentMetricId": "metric_122",
"organizationId": "org_123",
"userId": "user_123",
"name": "Accuracy",
"evaluationParams": [
"input",
"actual_output",
"expected_output"
],
"source": "PARTIAL_PROMPT",
"definition": "<string>",
"judgePrompt": "Evaluate the accuracy of the response",
"tags": [
"accuracy",
"quality"
],
"description": "Measures the accuracy of responses",
"documentationUrl": "https://docs.example.com/metrics/accuracy",
"evaluatorModelName": "gpt-4",
"areEvalParamsTop": true,
"isBeingOptimized": true,
"optimizationStatus": "READY_FOR_REVIEW",
"judgeGenerationSettings": {
"temperature": 0.3,
"topP": 0.9,
"maxOutputTokens": 512,
"reasoningEffort": "low"
},
"passThreshold": 0.7,
"applicabilityScope": "PRODUCTION",
"applicabilityThreshold": 0.7,
"classifierQuestion": {
"type": "yes_no",
"instructions": "<string>",
"goodAnswer": "yes",
"criteria": {
"yes": "<string>",
"no": "<string>"
},
"levels": [
{
"description": "<string>",
"score": 123
}
],
"doesNotApply": "<string>"
},
"optimizationValidation": {
"used": true,
"heldOutEvaluationIds": [
"evaluation_123"
],
"results": {
"optimization": {
"rowsScored": 25,
"rowsTotal": 25,
"source": {
"correct": 20,
"alignment": 0.71
},
"candidate": {
"correct": 20,
"alignment": 0.71
}
},
"validation": {
"rowsScored": 25,
"rowsTotal": 25,
"source": {
"correct": 20,
"alignment": 0.71
},
"candidate": {
"correct": 20,
"alignment": 0.71
}
}
},
"rows": [
{
"evaluationId": "evaluation_123",
"humanScore": 1,
"sourceScore": 0,
"candidateScore": 1
}
]
},
"optimizationRun": {
"strategies": [
"ADD_RUBRIC",
"SIMPLIFY"
],
"maxSteps": 6,
"stepsUsed": 4
},
"specificationIds": [
"spec_123"
],
"userGroupIds": [
"ug_123"
],
"createdAt": "2023-11-07T05:31:56Z",
"legacyAt": "2023-11-07T05:31:56Z",
"disabledAt": "2023-11-07T05:31:56Z",
"excludedFromAnalyticsAt": "2023-11-07T05:31:56Z",
"excludedByUserId": "<string>"
}
]
}{
"error": "Error type",
"message": "Error message description"
}{
"error": "Error type",
"message": "Error message description"
}{
"error": "Error type",
"message": "Error message description"
}{
"error": "Error type",
"message": "Error message description"
}Create several Classifier metrics at once (classifier metrics only)
Creates CLASSIFIER metrics only. Each item takes a classifierQuestion and an optional evaluatorModelName, and no source or judge prompt. To create metrics of any source in one call, use POST /metrics/batch. Each metric gets the classifier model its item names, or the one selectable classifier model when the item names none, and is linked to the specifications it names. All or nothing, so a refused item creates no metric and no link. A name already used in the organization is refused with every taken name quoted in the message. Answers 400 where the deployment does not enable Classifier metrics, for a name that is not a selectable classifier model, and for an item that names none while several are selectable.
POST
/
metrics
/
bulk
Create several Classifier metrics at once (classifier metrics only)
curl --request POST \
--url https://api.galtea.ai/metrics/bulk \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"metrics": [
{
"name": "<string>",
"classifierQuestion": {
"instructions": "<string>",
"criteria": {
"yes": "<string>",
"no": "<string>"
},
"levels": [
{
"description": "<string>",
"score": 123
}
],
"doesNotApply": "<string>"
},
"description": "<string>",
"tags": [
"<string>"
],
"evaluatorModelName": "jev-1.13.0",
"specificationIds": [
"<string>"
],
"passThreshold": 0.7,
"applicabilityScope": "PRODUCTION",
"applicabilityThreshold": 0.7
}
]
}
'import requests
url = "https://api.galtea.ai/metrics/bulk"
payload = { "metrics": [
{
"name": "<string>",
"classifierQuestion": {
"instructions": "<string>",
"criteria": {
"yes": "<string>",
"no": "<string>"
},
"levels": [
{
"description": "<string>",
"score": 123
}
],
"doesNotApply": "<string>"
},
"description": "<string>",
"tags": ["<string>"],
"evaluatorModelName": "jev-1.13.0",
"specificationIds": ["<string>"],
"passThreshold": 0.7,
"applicabilityScope": "PRODUCTION",
"applicabilityThreshold": 0.7
}
] }
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({
metrics: [
{
name: '<string>',
classifierQuestion: {
instructions: '<string>',
criteria: {yes: '<string>', no: '<string>'},
levels: [{description: '<string>', score: 123}],
doesNotApply: '<string>'
},
description: '<string>',
tags: ['<string>'],
evaluatorModelName: 'jev-1.13.0',
specificationIds: ['<string>'],
passThreshold: 0.7,
applicabilityScope: 'PRODUCTION',
applicabilityThreshold: 0.7
}
]
})
};
fetch('https://api.galtea.ai/metrics/bulk', 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.galtea.ai/metrics/bulk",
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([
'metrics' => [
[
'name' => '<string>',
'classifierQuestion' => [
'instructions' => '<string>',
'criteria' => [
'yes' => '<string>',
'no' => '<string>'
],
'levels' => [
[
'description' => '<string>',
'score' => 123
]
],
'doesNotApply' => '<string>'
],
'description' => '<string>',
'tags' => [
'<string>'
],
'evaluatorModelName' => 'jev-1.13.0',
'specificationIds' => [
'<string>'
],
'passThreshold' => 0.7,
'applicabilityScope' => 'PRODUCTION',
'applicabilityThreshold' => 0.7
]
]
]),
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.galtea.ai/metrics/bulk"
payload := strings.NewReader("{\n \"metrics\": [\n {\n \"name\": \"<string>\",\n \"classifierQuestion\": {\n \"instructions\": \"<string>\",\n \"criteria\": {\n \"yes\": \"<string>\",\n \"no\": \"<string>\"\n },\n \"levels\": [\n {\n \"description\": \"<string>\",\n \"score\": 123\n }\n ],\n \"doesNotApply\": \"<string>\"\n },\n \"description\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"evaluatorModelName\": \"jev-1.13.0\",\n \"specificationIds\": [\n \"<string>\"\n ],\n \"passThreshold\": 0.7,\n \"applicabilityScope\": \"PRODUCTION\",\n \"applicabilityThreshold\": 0.7\n }\n ]\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.galtea.ai/metrics/bulk")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"metrics\": [\n {\n \"name\": \"<string>\",\n \"classifierQuestion\": {\n \"instructions\": \"<string>\",\n \"criteria\": {\n \"yes\": \"<string>\",\n \"no\": \"<string>\"\n },\n \"levels\": [\n {\n \"description\": \"<string>\",\n \"score\": 123\n }\n ],\n \"doesNotApply\": \"<string>\"\n },\n \"description\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"evaluatorModelName\": \"jev-1.13.0\",\n \"specificationIds\": [\n \"<string>\"\n ],\n \"passThreshold\": 0.7,\n \"applicabilityScope\": \"PRODUCTION\",\n \"applicabilityThreshold\": 0.7\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.galtea.ai/metrics/bulk")
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 \"metrics\": [\n {\n \"name\": \"<string>\",\n \"classifierQuestion\": {\n \"instructions\": \"<string>\",\n \"criteria\": {\n \"yes\": \"<string>\",\n \"no\": \"<string>\"\n },\n \"levels\": [\n {\n \"description\": \"<string>\",\n \"score\": 123\n }\n ],\n \"doesNotApply\": \"<string>\"\n },\n \"description\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"evaluatorModelName\": \"jev-1.13.0\",\n \"specificationIds\": [\n \"<string>\"\n ],\n \"passThreshold\": 0.7,\n \"applicabilityScope\": \"PRODUCTION\",\n \"applicabilityThreshold\": 0.7\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"metrics": [
{
"id": "metric_123",
"metricGroupId": "metric_123",
"parentMetricId": "metric_122",
"organizationId": "org_123",
"userId": "user_123",
"name": "Accuracy",
"evaluationParams": [
"input",
"actual_output",
"expected_output"
],
"source": "PARTIAL_PROMPT",
"definition": "<string>",
"judgePrompt": "Evaluate the accuracy of the response",
"tags": [
"accuracy",
"quality"
],
"description": "Measures the accuracy of responses",
"documentationUrl": "https://docs.example.com/metrics/accuracy",
"evaluatorModelName": "gpt-4",
"areEvalParamsTop": true,
"isBeingOptimized": true,
"optimizationStatus": "READY_FOR_REVIEW",
"judgeGenerationSettings": {
"temperature": 0.3,
"topP": 0.9,
"maxOutputTokens": 512,
"reasoningEffort": "low"
},
"passThreshold": 0.7,
"applicabilityScope": "PRODUCTION",
"applicabilityThreshold": 0.7,
"classifierQuestion": {
"type": "yes_no",
"instructions": "<string>",
"goodAnswer": "yes",
"criteria": {
"yes": "<string>",
"no": "<string>"
},
"levels": [
{
"description": "<string>",
"score": 123
}
],
"doesNotApply": "<string>"
},
"optimizationValidation": {
"used": true,
"heldOutEvaluationIds": [
"evaluation_123"
],
"results": {
"optimization": {
"rowsScored": 25,
"rowsTotal": 25,
"source": {
"correct": 20,
"alignment": 0.71
},
"candidate": {
"correct": 20,
"alignment": 0.71
}
},
"validation": {
"rowsScored": 25,
"rowsTotal": 25,
"source": {
"correct": 20,
"alignment": 0.71
},
"candidate": {
"correct": 20,
"alignment": 0.71
}
}
},
"rows": [
{
"evaluationId": "evaluation_123",
"humanScore": 1,
"sourceScore": 0,
"candidateScore": 1
}
]
},
"optimizationRun": {
"strategies": [
"ADD_RUBRIC",
"SIMPLIFY"
],
"maxSteps": 6,
"stepsUsed": 4
},
"specificationIds": [
"spec_123"
],
"userGroupIds": [
"ug_123"
],
"createdAt": "2023-11-07T05:31:56Z",
"legacyAt": "2023-11-07T05:31:56Z",
"disabledAt": "2023-11-07T05:31:56Z",
"excludedFromAnalyticsAt": "2023-11-07T05:31:56Z",
"excludedByUserId": "<string>"
}
]
}{
"error": "Error type",
"message": "Error message description"
}{
"error": "Error type",
"message": "Error message description"
}{
"error": "Error type",
"message": "Error message description"
}{
"error": "Error type",
"message": "Error message description"
}You are reading the docs of Galtea 5.16. Read this page in the latest version.
Authorizations
Body
application/json