curl --request POST \
--url https://api.galtea.ai/metrics/generate-config \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"specificationIds": [
"spec_123",
"spec_456"
],
"automaticCreation": false,
"maxMetricsPerSpecification": 123,
"isOnboarding": false,
"name": "<string>",
"description": "<string>",
"tags": [
"<string>"
],
"productId": "<string>"
}
'import requests
url = "https://api.galtea.ai/metrics/generate-config"
payload = {
"specificationIds": ["spec_123", "spec_456"],
"automaticCreation": False,
"maxMetricsPerSpecification": 123,
"isOnboarding": False,
"name": "<string>",
"description": "<string>",
"tags": ["<string>"],
"productId": "<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({
specificationIds: ['spec_123', 'spec_456'],
automaticCreation: false,
maxMetricsPerSpecification: 123,
isOnboarding: false,
name: '<string>',
description: '<string>',
tags: ['<string>'],
productId: '<string>'
})
};
fetch('https://api.galtea.ai/metrics/generate-config', 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/generate-config",
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([
'specificationIds' => [
'spec_123',
'spec_456'
],
'automaticCreation' => false,
'maxMetricsPerSpecification' => 123,
'isOnboarding' => false,
'name' => '<string>',
'description' => '<string>',
'tags' => [
'<string>'
],
'productId' => '<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://api.galtea.ai/metrics/generate-config"
payload := strings.NewReader("{\n \"specificationIds\": [\n \"spec_123\",\n \"spec_456\"\n ],\n \"automaticCreation\": false,\n \"maxMetricsPerSpecification\": 123,\n \"isOnboarding\": false,\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"productId\": \"<string>\"\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/generate-config")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"specificationIds\": [\n \"spec_123\",\n \"spec_456\"\n ],\n \"automaticCreation\": false,\n \"maxMetricsPerSpecification\": 123,\n \"isOnboarding\": false,\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"productId\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.galtea.ai/metrics/generate-config")
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 \"specificationIds\": [\n \"spec_123\",\n \"spec_456\"\n ],\n \"automaticCreation\": false,\n \"maxMetricsPerSpecification\": 123,\n \"isOnboarding\": false,\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"productId\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{}{
"config": [
{}
],
"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",
"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,
"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"
}Generate or complete metric configuration with AI
Two modes, selected by the request body:
- Spec mode (provide
specificationIds): generates 1-3 metric configurations per specification, optionally creating the metrics automatically. - Completion mode (“Complete With AI”, provide
name+description+evaluationType): completes a single metric the user is authoring. The name/description/evaluationType/tags are the source of truth; only the judge prompt and evaluation params are generated (for CLASSIFIER, config[0] is instead).specificationIdsmay carry at most one id as optional context.
The evaluator model of every generated AI-evaluated metric is the deployment’s setting for generated metrics, not a choice of the generator. It answers 500 when that model is not selectable in the environment. A CLASSIFIER result carries no model.
See Metrics.
curl --request POST \
--url https://api.galtea.ai/metrics/generate-config \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"specificationIds": [
"spec_123",
"spec_456"
],
"automaticCreation": false,
"maxMetricsPerSpecification": 123,
"isOnboarding": false,
"name": "<string>",
"description": "<string>",
"tags": [
"<string>"
],
"productId": "<string>"
}
'import requests
url = "https://api.galtea.ai/metrics/generate-config"
payload = {
"specificationIds": ["spec_123", "spec_456"],
"automaticCreation": False,
"maxMetricsPerSpecification": 123,
"isOnboarding": False,
"name": "<string>",
"description": "<string>",
"tags": ["<string>"],
"productId": "<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({
specificationIds: ['spec_123', 'spec_456'],
automaticCreation: false,
maxMetricsPerSpecification: 123,
isOnboarding: false,
name: '<string>',
description: '<string>',
tags: ['<string>'],
productId: '<string>'
})
};
fetch('https://api.galtea.ai/metrics/generate-config', 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/generate-config",
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([
'specificationIds' => [
'spec_123',
'spec_456'
],
'automaticCreation' => false,
'maxMetricsPerSpecification' => 123,
'isOnboarding' => false,
'name' => '<string>',
'description' => '<string>',
'tags' => [
'<string>'
],
'productId' => '<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://api.galtea.ai/metrics/generate-config"
payload := strings.NewReader("{\n \"specificationIds\": [\n \"spec_123\",\n \"spec_456\"\n ],\n \"automaticCreation\": false,\n \"maxMetricsPerSpecification\": 123,\n \"isOnboarding\": false,\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"productId\": \"<string>\"\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/generate-config")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"specificationIds\": [\n \"spec_123\",\n \"spec_456\"\n ],\n \"automaticCreation\": false,\n \"maxMetricsPerSpecification\": 123,\n \"isOnboarding\": false,\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"productId\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.galtea.ai/metrics/generate-config")
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 \"specificationIds\": [\n \"spec_123\",\n \"spec_456\"\n ],\n \"automaticCreation\": false,\n \"maxMetricsPerSpecification\": 123,\n \"isOnboarding\": false,\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"productId\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{}{
"config": [
{}
],
"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",
"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,
"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"
}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-....
Body
Spec mode - IDs of the specifications to generate metrics for. Completion mode - at most one id used as context.
["spec_123", "spec_456"]
Spec mode only - when true, creates metrics from generated config
false
Spec mode only - maximum number of metrics to generate per specification
Spec mode only - whether this is an onboarding flow
false
Completion mode - the user-authored metric name (source of truth)
Completion mode - the user-authored metric description (the criteria to evaluate). Required
Completion mode - PARTIAL_PROMPT (binary LLM judge), HUMAN_EVALUATION (0-100 annotator guidelines) or CLASSIFIER (one Classifier (Jev) question; 400 where not enabled)
PARTIAL_PROMPT, HUMAN_EVALUATION, CLASSIFIER Completion mode - user-provided tags (source of truth, optional)
Completion mode - optional product id for additional context
Response
Metric configuration generated successfully. For CLASSIFIER, config[0] is { classifierQuestion, evaluationParams, conditions, refused }; classifierQuestion is null when one question cannot cover every condition.
Generated metric configuration suggestion