curl --request POST \
--url https://dev.api.galtea.ai/metrics \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Accuracy",
"source": "PARTIAL_PROMPT",
"evaluationParams": [
"input",
"actual_output"
],
"judgePrompt": "<string>",
"evaluatorModelName": "gpt-4.1",
"definition": "<string>",
"description": "<string>",
"documentationUrl": "<string>",
"tags": [
"<string>"
],
"areEvalParamsTop": true,
"organizationId": "org_123",
"parentMetricId": "metric_122",
"userGroupIds": [
"ug_123"
],
"specificationIds": [
"spec_123"
],
"judgeGenerationSettings": {
"temperature": 0.3,
"topP": 0.9,
"maxOutputTokens": 512,
"reasoningEffort": "low"
},
"passThreshold": 0.7,
"applicabilityScope": "PRODUCTION",
"applicabilityThreshold": 0.7,
"decisionQuestion": {
"instructions": "<string>",
"criteria": {
"yes": "<string>",
"no": "<string>"
},
"levels": [
{
"description": "<string>",
"score": 123
}
],
"doesNotApply": "<string>"
},
"classifierQuestion": {
"instructions": "<string>",
"criteria": {
"yes": "<string>",
"no": "<string>"
},
"levels": [
{
"description": "<string>",
"score": 123
}
],
"doesNotApply": "<string>"
}
}
'import requests
url = "https://dev.api.galtea.ai/metrics"
payload = {
"name": "Accuracy",
"source": "PARTIAL_PROMPT",
"evaluationParams": ["input", "actual_output"],
"judgePrompt": "<string>",
"evaluatorModelName": "gpt-4.1",
"definition": "<string>",
"description": "<string>",
"documentationUrl": "<string>",
"tags": ["<string>"],
"areEvalParamsTop": True,
"organizationId": "org_123",
"parentMetricId": "metric_122",
"userGroupIds": ["ug_123"],
"specificationIds": ["spec_123"],
"judgeGenerationSettings": {
"temperature": 0.3,
"topP": 0.9,
"maxOutputTokens": 512,
"reasoningEffort": "low"
},
"passThreshold": 0.7,
"applicabilityScope": "PRODUCTION",
"applicabilityThreshold": 0.7,
"decisionQuestion": {
"instructions": "<string>",
"criteria": {
"yes": "<string>",
"no": "<string>"
},
"levels": [
{
"description": "<string>",
"score": 123
}
],
"doesNotApply": "<string>"
},
"classifierQuestion": {
"instructions": "<string>",
"criteria": {
"yes": "<string>",
"no": "<string>"
},
"levels": [
{
"description": "<string>",
"score": 123
}
],
"doesNotApply": "<string>"
}
}
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({
name: 'Accuracy',
source: 'PARTIAL_PROMPT',
evaluationParams: ['input', 'actual_output'],
judgePrompt: '<string>',
evaluatorModelName: 'gpt-4.1',
definition: '<string>',
description: '<string>',
documentationUrl: '<string>',
tags: ['<string>'],
areEvalParamsTop: true,
organizationId: 'org_123',
parentMetricId: 'metric_122',
userGroupIds: ['ug_123'],
specificationIds: ['spec_123'],
judgeGenerationSettings: {temperature: 0.3, topP: 0.9, maxOutputTokens: 512, reasoningEffort: 'low'},
passThreshold: 0.7,
applicabilityScope: 'PRODUCTION',
applicabilityThreshold: 0.7,
decisionQuestion: {
instructions: '<string>',
criteria: {yes: '<string>', no: '<string>'},
levels: [{description: '<string>', score: 123}],
doesNotApply: '<string>'
},
classifierQuestion: {
instructions: '<string>',
criteria: {yes: '<string>', no: '<string>'},
levels: [{description: '<string>', score: 123}],
doesNotApply: '<string>'
}
})
};
fetch('https://dev.api.galtea.ai/metrics', 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://dev.api.galtea.ai/metrics",
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([
'name' => 'Accuracy',
'source' => 'PARTIAL_PROMPT',
'evaluationParams' => [
'input',
'actual_output'
],
'judgePrompt' => '<string>',
'evaluatorModelName' => 'gpt-4.1',
'definition' => '<string>',
'description' => '<string>',
'documentationUrl' => '<string>',
'tags' => [
'<string>'
],
'areEvalParamsTop' => true,
'organizationId' => 'org_123',
'parentMetricId' => 'metric_122',
'userGroupIds' => [
'ug_123'
],
'specificationIds' => [
'spec_123'
],
'judgeGenerationSettings' => [
'temperature' => 0.3,
'topP' => 0.9,
'maxOutputTokens' => 512,
'reasoningEffort' => 'low'
],
'passThreshold' => 0.7,
'applicabilityScope' => 'PRODUCTION',
'applicabilityThreshold' => 0.7,
'decisionQuestion' => [
'instructions' => '<string>',
'criteria' => [
'yes' => '<string>',
'no' => '<string>'
],
'levels' => [
[
'description' => '<string>',
'score' => 123
]
],
'doesNotApply' => '<string>'
],
'classifierQuestion' => [
'instructions' => '<string>',
'criteria' => [
'yes' => '<string>',
'no' => '<string>'
],
'levels' => [
[
'description' => '<string>',
'score' => 123
]
],
'doesNotApply' => '<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;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://dev.api.galtea.ai/metrics"
payload := strings.NewReader("{\n \"name\": \"Accuracy\",\n \"source\": \"PARTIAL_PROMPT\",\n \"evaluationParams\": [\n \"input\",\n \"actual_output\"\n ],\n \"judgePrompt\": \"<string>\",\n \"evaluatorModelName\": \"gpt-4.1\",\n \"definition\": \"<string>\",\n \"description\": \"<string>\",\n \"documentationUrl\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"areEvalParamsTop\": true,\n \"organizationId\": \"org_123\",\n \"parentMetricId\": \"metric_122\",\n \"userGroupIds\": [\n \"ug_123\"\n ],\n \"specificationIds\": [\n \"spec_123\"\n ],\n \"judgeGenerationSettings\": {\n \"temperature\": 0.3,\n \"topP\": 0.9,\n \"maxOutputTokens\": 512,\n \"reasoningEffort\": \"low\"\n },\n \"passThreshold\": 0.7,\n \"applicabilityScope\": \"PRODUCTION\",\n \"applicabilityThreshold\": 0.7,\n \"decisionQuestion\": {\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 \"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}")
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://dev.api.galtea.ai/metrics")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Accuracy\",\n \"source\": \"PARTIAL_PROMPT\",\n \"evaluationParams\": [\n \"input\",\n \"actual_output\"\n ],\n \"judgePrompt\": \"<string>\",\n \"evaluatorModelName\": \"gpt-4.1\",\n \"definition\": \"<string>\",\n \"description\": \"<string>\",\n \"documentationUrl\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"areEvalParamsTop\": true,\n \"organizationId\": \"org_123\",\n \"parentMetricId\": \"metric_122\",\n \"userGroupIds\": [\n \"ug_123\"\n ],\n \"specificationIds\": [\n \"spec_123\"\n ],\n \"judgeGenerationSettings\": {\n \"temperature\": 0.3,\n \"topP\": 0.9,\n \"maxOutputTokens\": 512,\n \"reasoningEffort\": \"low\"\n },\n \"passThreshold\": 0.7,\n \"applicabilityScope\": \"PRODUCTION\",\n \"applicabilityThreshold\": 0.7,\n \"decisionQuestion\": {\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 \"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}")
.asString();require 'uri'
require 'net/http'
url = URI("https://dev.api.galtea.ai/metrics")
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 \"name\": \"Accuracy\",\n \"source\": \"PARTIAL_PROMPT\",\n \"evaluationParams\": [\n \"input\",\n \"actual_output\"\n ],\n \"judgePrompt\": \"<string>\",\n \"evaluatorModelName\": \"gpt-4.1\",\n \"definition\": \"<string>\",\n \"description\": \"<string>\",\n \"documentationUrl\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"areEvalParamsTop\": true,\n \"organizationId\": \"org_123\",\n \"parentMetricId\": \"metric_122\",\n \"userGroupIds\": [\n \"ug_123\"\n ],\n \"specificationIds\": [\n \"spec_123\"\n ],\n \"judgeGenerationSettings\": {\n \"temperature\": 0.3,\n \"topP\": 0.9,\n \"maxOutputTokens\": 512,\n \"reasoningEffort\": \"low\"\n },\n \"passThreshold\": 0.7,\n \"applicabilityScope\": \"PRODUCTION\",\n \"applicabilityThreshold\": 0.7,\n \"decisionQuestion\": {\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 \"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}"
response = http.request(request)
puts response.read_body{
"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,
"decisionQuestion": {
"type": "yes_no",
"instructions": "<string>",
"goodAnswer": "yes",
"criteria": {
"yes": "<string>",
"no": "<string>"
},
"levels": [
{
"description": "<string>",
"score": 123
}
],
"doesNotApply": "<string>"
},
"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",
"isActive": true,
"disabledAt": "2023-11-07T05:31:56Z",
"excludedFromAnalyticsAt": "2023-11-07T05:31:56Z",
"excludedByUserId": "<string>",
"number": 3,
"revisionName": "Stricter rubric",
"unavailableReason": null
}{
"error": "NotFound",
"message": "Product not found"
}{
"error": "NotFound",
"message": "Product not found"
}{
"error": "NotFound",
"message": "Product not found"
}Create metric
Create a new metric. See Metrics.
Accepted values for source on new metrics are SELF_HOSTED, PARTIAL_PROMPT, HUMAN_EVALUATION, and DECISION (the decision model; 400 where the deployment does not enable it). FULL_PROMPT is deprecated for creation — requests with source=FULL_PROMPT (or that omit source and supply a judgePrompt without evaluationParams, which previously inferred FULL_PROMPT) are rejected with 400. Use PARTIAL_PROMPT instead — it offers the same capabilities with user-configurable evaluation parameters. Existing FULL_PROMPT metrics continue to be listed, read, filtered, and evaluated.
curl --request POST \
--url https://dev.api.galtea.ai/metrics \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Accuracy",
"source": "PARTIAL_PROMPT",
"evaluationParams": [
"input",
"actual_output"
],
"judgePrompt": "<string>",
"evaluatorModelName": "gpt-4.1",
"definition": "<string>",
"description": "<string>",
"documentationUrl": "<string>",
"tags": [
"<string>"
],
"areEvalParamsTop": true,
"organizationId": "org_123",
"parentMetricId": "metric_122",
"userGroupIds": [
"ug_123"
],
"specificationIds": [
"spec_123"
],
"judgeGenerationSettings": {
"temperature": 0.3,
"topP": 0.9,
"maxOutputTokens": 512,
"reasoningEffort": "low"
},
"passThreshold": 0.7,
"applicabilityScope": "PRODUCTION",
"applicabilityThreshold": 0.7,
"decisionQuestion": {
"instructions": "<string>",
"criteria": {
"yes": "<string>",
"no": "<string>"
},
"levels": [
{
"description": "<string>",
"score": 123
}
],
"doesNotApply": "<string>"
},
"classifierQuestion": {
"instructions": "<string>",
"criteria": {
"yes": "<string>",
"no": "<string>"
},
"levels": [
{
"description": "<string>",
"score": 123
}
],
"doesNotApply": "<string>"
}
}
'import requests
url = "https://dev.api.galtea.ai/metrics"
payload = {
"name": "Accuracy",
"source": "PARTIAL_PROMPT",
"evaluationParams": ["input", "actual_output"],
"judgePrompt": "<string>",
"evaluatorModelName": "gpt-4.1",
"definition": "<string>",
"description": "<string>",
"documentationUrl": "<string>",
"tags": ["<string>"],
"areEvalParamsTop": True,
"organizationId": "org_123",
"parentMetricId": "metric_122",
"userGroupIds": ["ug_123"],
"specificationIds": ["spec_123"],
"judgeGenerationSettings": {
"temperature": 0.3,
"topP": 0.9,
"maxOutputTokens": 512,
"reasoningEffort": "low"
},
"passThreshold": 0.7,
"applicabilityScope": "PRODUCTION",
"applicabilityThreshold": 0.7,
"decisionQuestion": {
"instructions": "<string>",
"criteria": {
"yes": "<string>",
"no": "<string>"
},
"levels": [
{
"description": "<string>",
"score": 123
}
],
"doesNotApply": "<string>"
},
"classifierQuestion": {
"instructions": "<string>",
"criteria": {
"yes": "<string>",
"no": "<string>"
},
"levels": [
{
"description": "<string>",
"score": 123
}
],
"doesNotApply": "<string>"
}
}
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({
name: 'Accuracy',
source: 'PARTIAL_PROMPT',
evaluationParams: ['input', 'actual_output'],
judgePrompt: '<string>',
evaluatorModelName: 'gpt-4.1',
definition: '<string>',
description: '<string>',
documentationUrl: '<string>',
tags: ['<string>'],
areEvalParamsTop: true,
organizationId: 'org_123',
parentMetricId: 'metric_122',
userGroupIds: ['ug_123'],
specificationIds: ['spec_123'],
judgeGenerationSettings: {temperature: 0.3, topP: 0.9, maxOutputTokens: 512, reasoningEffort: 'low'},
passThreshold: 0.7,
applicabilityScope: 'PRODUCTION',
applicabilityThreshold: 0.7,
decisionQuestion: {
instructions: '<string>',
criteria: {yes: '<string>', no: '<string>'},
levels: [{description: '<string>', score: 123}],
doesNotApply: '<string>'
},
classifierQuestion: {
instructions: '<string>',
criteria: {yes: '<string>', no: '<string>'},
levels: [{description: '<string>', score: 123}],
doesNotApply: '<string>'
}
})
};
fetch('https://dev.api.galtea.ai/metrics', 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://dev.api.galtea.ai/metrics",
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([
'name' => 'Accuracy',
'source' => 'PARTIAL_PROMPT',
'evaluationParams' => [
'input',
'actual_output'
],
'judgePrompt' => '<string>',
'evaluatorModelName' => 'gpt-4.1',
'definition' => '<string>',
'description' => '<string>',
'documentationUrl' => '<string>',
'tags' => [
'<string>'
],
'areEvalParamsTop' => true,
'organizationId' => 'org_123',
'parentMetricId' => 'metric_122',
'userGroupIds' => [
'ug_123'
],
'specificationIds' => [
'spec_123'
],
'judgeGenerationSettings' => [
'temperature' => 0.3,
'topP' => 0.9,
'maxOutputTokens' => 512,
'reasoningEffort' => 'low'
],
'passThreshold' => 0.7,
'applicabilityScope' => 'PRODUCTION',
'applicabilityThreshold' => 0.7,
'decisionQuestion' => [
'instructions' => '<string>',
'criteria' => [
'yes' => '<string>',
'no' => '<string>'
],
'levels' => [
[
'description' => '<string>',
'score' => 123
]
],
'doesNotApply' => '<string>'
],
'classifierQuestion' => [
'instructions' => '<string>',
'criteria' => [
'yes' => '<string>',
'no' => '<string>'
],
'levels' => [
[
'description' => '<string>',
'score' => 123
]
],
'doesNotApply' => '<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;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://dev.api.galtea.ai/metrics"
payload := strings.NewReader("{\n \"name\": \"Accuracy\",\n \"source\": \"PARTIAL_PROMPT\",\n \"evaluationParams\": [\n \"input\",\n \"actual_output\"\n ],\n \"judgePrompt\": \"<string>\",\n \"evaluatorModelName\": \"gpt-4.1\",\n \"definition\": \"<string>\",\n \"description\": \"<string>\",\n \"documentationUrl\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"areEvalParamsTop\": true,\n \"organizationId\": \"org_123\",\n \"parentMetricId\": \"metric_122\",\n \"userGroupIds\": [\n \"ug_123\"\n ],\n \"specificationIds\": [\n \"spec_123\"\n ],\n \"judgeGenerationSettings\": {\n \"temperature\": 0.3,\n \"topP\": 0.9,\n \"maxOutputTokens\": 512,\n \"reasoningEffort\": \"low\"\n },\n \"passThreshold\": 0.7,\n \"applicabilityScope\": \"PRODUCTION\",\n \"applicabilityThreshold\": 0.7,\n \"decisionQuestion\": {\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 \"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}")
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://dev.api.galtea.ai/metrics")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Accuracy\",\n \"source\": \"PARTIAL_PROMPT\",\n \"evaluationParams\": [\n \"input\",\n \"actual_output\"\n ],\n \"judgePrompt\": \"<string>\",\n \"evaluatorModelName\": \"gpt-4.1\",\n \"definition\": \"<string>\",\n \"description\": \"<string>\",\n \"documentationUrl\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"areEvalParamsTop\": true,\n \"organizationId\": \"org_123\",\n \"parentMetricId\": \"metric_122\",\n \"userGroupIds\": [\n \"ug_123\"\n ],\n \"specificationIds\": [\n \"spec_123\"\n ],\n \"judgeGenerationSettings\": {\n \"temperature\": 0.3,\n \"topP\": 0.9,\n \"maxOutputTokens\": 512,\n \"reasoningEffort\": \"low\"\n },\n \"passThreshold\": 0.7,\n \"applicabilityScope\": \"PRODUCTION\",\n \"applicabilityThreshold\": 0.7,\n \"decisionQuestion\": {\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 \"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}")
.asString();require 'uri'
require 'net/http'
url = URI("https://dev.api.galtea.ai/metrics")
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 \"name\": \"Accuracy\",\n \"source\": \"PARTIAL_PROMPT\",\n \"evaluationParams\": [\n \"input\",\n \"actual_output\"\n ],\n \"judgePrompt\": \"<string>\",\n \"evaluatorModelName\": \"gpt-4.1\",\n \"definition\": \"<string>\",\n \"description\": \"<string>\",\n \"documentationUrl\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"areEvalParamsTop\": true,\n \"organizationId\": \"org_123\",\n \"parentMetricId\": \"metric_122\",\n \"userGroupIds\": [\n \"ug_123\"\n ],\n \"specificationIds\": [\n \"spec_123\"\n ],\n \"judgeGenerationSettings\": {\n \"temperature\": 0.3,\n \"topP\": 0.9,\n \"maxOutputTokens\": 512,\n \"reasoningEffort\": \"low\"\n },\n \"passThreshold\": 0.7,\n \"applicabilityScope\": \"PRODUCTION\",\n \"applicabilityThreshold\": 0.7,\n \"decisionQuestion\": {\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 \"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}"
response = http.request(request)
puts response.read_body{
"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,
"decisionQuestion": {
"type": "yes_no",
"instructions": "<string>",
"goodAnswer": "yes",
"criteria": {
"yes": "<string>",
"no": "<string>"
},
"levels": [
{
"description": "<string>",
"score": 123
}
],
"doesNotApply": "<string>"
},
"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",
"isActive": true,
"disabledAt": "2023-11-07T05:31:56Z",
"excludedFromAnalyticsAt": "2023-11-07T05:31:56Z",
"excludedByUserId": "<string>",
"number": 3,
"revisionName": "Stricter rubric",
"unavailableReason": null
}{
"error": "NotFound",
"message": "Product not found"
}{
"error": "NotFound",
"message": "Product not found"
}{
"error": "NotFound",
"message": "Product not found"
}Authorizations
API key authorization. Pass your API key in the Authorization header as a Bearer token. Both new (gsk_*) and legacy (gsk-) API keys are accepted, e.g. Authorization: Bearer gsk_... or Authorization: Bearer gsk-....
Headers
Send return=minimal to get no body back from a write and skip reading the resource: a create answers 201 with only Location, and an update answers 204.
"return=minimal"
Body
1 - 200"Accuracy"
CLASSIFIER is the deprecated name of DECISION, accepted until 2028-01-17.
SELF_HOSTED, FULL_PROMPT, PARTIAL_PROMPT, HUMAN_EVALUATION, GEVAL, DEEPEVAL, DETERMINISTIC, DECISION, CLASSIFIER "PARTIAL_PROMPT"
A PARTIAL_PROMPT (AI Evaluation) metric must include input and actual_output.
201 - 64["input", "actual_output"]
20000Required for PARTIAL_PROMPT. For DECISION: The selectable decision model to run the question under, as listed by GET /evaluatorModels with kind=DECISION and selectable=true. Omitted or null, the one selectable decision model is used. When several are selectable, the request is refused with 400 and this field must be sent.
"gpt-4.1"
5000201 - 64"org_123"
The revision this metric is revised from. The new metric joins its family and becomes the family's only active revision: the family's current active revision becomes legacy, whether it is this one or not. The parent must not be under optimization or waiting for review, and the revision must be in the parent's organization. Omit it or send null to start a new family.
"metric_122"
1["ug_123"]
1["spec_123"]
The generation settings this metric's judge runs with. Immutable: changing one creates a revision. Only the settings GET /evaluatorModels reports as configurable for the chosen model take effect; a value the provider rejects ends that evaluation as SKIPPED carrying the provider's own message.
Show child attributes
Show child attributes
Score from 0 to 1 at or above which an evaluation of this metric passes. Omitted or null, it defaults to 0.5, or to the parent metric's threshold for a revision.
0 <= x <= 10.7
Which sessions get the applicability check before this metric is judged: PRODUCTION, DEVELOPMENT, ALL or NONE (no check). A session the check finds the metric does not apply to is skipped and no judge call is made. Omitted or null, it defaults to PRODUCTION for a metric the platform scores and NONE for any other. A revision keeps the parent metric's value when the check runs for both. Fixed at create: a change creates a revision. Any value but NONE is refused with a 400 for a metric the platform does not score. A metric that scores only traces is never checked, so it takes NONE and refuses any other value. A metric that also scores another field is checked without traces: on each turn's input and actual output and its other fields. A FULL_PROMPT metric with empty evaluationParams whose judge prompt reads only traces is stored as checked, yet the evaluator judges it without the check. A FULL_PROMPT metric whose evaluationParams list only traces takes NONE even when its judge prompt reads another field: list that field in evaluationParams to get the check. The check runs only where the deployment enables it.
NONE, DEVELOPMENT, PRODUCTION, ALL "PRODUCTION"
The lowest probability, from 0 to 1, that the metric applies to a session at which it is judged. Below it, the session is skipped. Omitted or null, it defaults to 0.5, or to the parent metric's value for a revision when the check runs for both. Fixed at create: a change creates a revision. Refused with a 400 for a metric the platform does not score, and for a metric that scores only traces. The check runs only where the deployment enables it.
0 <= x <= 10.7
DECISION only, and required there: the one question the decision model answers. evaluationParams is derived from its {{ param }} placeholders.
Show child attributes
Show child attributes
Deprecated, send decisionQuestion. Read as decisionQuestion; sending both answers 400 unless they are equal.
Show child attributes
Show child attributes
Response
Metric created successfully. On Prefer: return=minimal, or when the read after the write fails, the answer has no body.
"metric_123"
Identifier shared by every metric in the same revision family. Server-managed — derived from parentMetricId on create (or generated for roots). Cannot be set by the caller.
"metric_123"
Id of the direct parent metric. On create, providing this value turns the new metric into a revision: it joins the parent's family and becomes its only active revision: the family's current active revision becomes legacy, whether it is the parent or not. Omit or null to create a root metric in a fresh group. On responses, this is the recorded parent edge (null for roots).
"metric_122"
"org_123"
"user_123"
The revision's own name when it has one, else its metric's name. A lookup by a metric's name can answer a revision with its own name.
"Accuracy"
Ordered list of trace fields the evaluator needs, written in snake_case (e.g. input, actual_output, expected_output, retrieval_context). Determines which data the evaluation engine extracts from each trace. Full list of accepted values: https://docs.galtea.ai/concepts/metric/evaluation-parameters
["input", "actual_output", "expected_output"]
Evaluation method for the metric. FULL_PROMPT is deprecated for creation — POST /metrics rejects it with a 400. Use PARTIAL_PROMPT for new AI Evaluation metrics. The value remains in the enum because existing FULL_PROMPT metrics are still returned by reads and filters. DECISION is the decision model, accepted only where the deployment enables it.
SELF_HOSTED, FULL_PROMPT, PARTIAL_PROMPT, HUMAN_EVALUATION, GEVAL, DEEPEVAL, DETERMINISTIC, DECISION, CODE "PARTIAL_PROMPT"
Name of the built-in evaluator the metric runs, for example json_field_match. Null when the metric names none.
"Evaluate the accuracy of the response"
["accuracy", "quality"]
"Measures the accuracy of responses"
"https://docs.example.com/metrics/accuracy"
"gpt-4"
Whether the parameters block precedes the judge prompt. Unset reads as true.
Whether the metric is currently being optimized.
Where an optimization attempt stands. Null for a metric that did not come from an optimization. A candidate waiting for review is legacy until it is activated.
OPTIMIZING, READY_FOR_REVIEW, FAILED, NO_IMPROVEMENT, DECLINED, ACTIVATED "READY_FOR_REVIEW"
The generation settings this metric's judge runs with. Null runs the platform defaults. Immutable: changing one creates a revision.
Show child attributes
Show child attributes
Score from 0 to 1 at or above which an evaluation of this metric passes. Immutable: changing it creates a revision.
0 <= x <= 10.7
Which sessions get the applicability check before this metric is judged. NONE for a metric the platform does not score. A metric that scores only traces is never checked, so it takes NONE and refuses any other value. A metric that also scores another field is checked without traces: on each turn's input and actual output and its other fields. A FULL_PROMPT metric with empty evaluationParams whose judge prompt reads only traces is stored as checked, yet the evaluator judges it without the check. A FULL_PROMPT metric whose evaluationParams list only traces takes NONE even when its judge prompt reads another field: list that field in evaluationParams to get the check. Immutable: changing it creates a revision. The check runs only where the deployment enables it.
NONE, DEVELOPMENT, PRODUCTION, ALL "PRODUCTION"
The lowest probability that the metric applies to a session at which it is judged. Null means the platform default, 0.5. Immutable: changing it creates a revision.
0 <= x <= 10.7
The one question of a DECISION metric; null for every other source.
Show child attributes
Show child attributes
Deprecated, read decisionQuestion. The same value.
Show child attributes
Show child attributes
How an optimization attempt was validated: the held-out evaluations and, once the optimizer reported, both prompts scored on the search rows and on the held-out rows. Set on an optimization attempt only, and null for any other metric, for an attempt that predates it, and for an attempt copied from another organization.
Show child attributes
Show child attributes
What an optimization attempt ran: the strategies, the step budget and the steps used. Null while the attempt runs, and when it was not reported: an attempt from before the report existed, one run by an older optimizer, a failed run, an attempt copied from another organization, or a metric that is not an optimization attempt. Null never means a run of 0 steps.
Show child attributes
Show child attributes
Specifications linked to this metric. A MEMBER caller sees only the specifications of the products it can read.
["spec_123"]
["ug_123"]
Earliest non-null of this metric's own legacy date and its evaluator model's unselectableAt, so a model no longer selectable makes every metric linked to it report as legacy even though the metric row itself is untouched. Present only once that date has passed: a scheduled future cutoff reports null, because the metric is still active until then. Unlike disabledAt, this field never carries a future date.
Whether this is the active revision of its metric: its own legacy date is unset, it is not deleted and it is not being optimized. Unlike a null legacyAt, it ignores the evaluator model, so a revision on a model that is no longer selectable is still active.
Earliest non-null of this metric's own disabled date and its evaluator model's disabledAt — a disabled model makes every metric linked to it report as disabled even though the metric row itself is untouched.
When set, results produced by this metric revision do not feed analytics.
User who last excluded this metric revision from analytics.
The revision's number within its metric (R1, R2, R3): fixed once saved and never reused.
3
The revision's own name, or null when it has none. name reports this value when it is set, else the metric's name.
"Stricter rubric"
Why the caller's organization cannot run this metric, or null when it can. Set only for an organization whose data region is EU and a metric whose judge, or, for a decision metric, whose decision model, has no healthy EU deployment: the metric cannot run there until it runs on another one. For a metric of your organization, create a revision. For a Galtea metric, create a metric of your own. Reported by the metric list and read endpoints. An endpoint that returns a metric and does not read the organization's data region, such as the metrics of a specification, leaves the field out: absent means not reported, never that the metric can run.
null