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{}[
{
"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,
"specificationIds": [
"spec_123"
],
"userGroupIds": [
"ug_123"
],
"createdAt": "2023-11-07T05:31:56Z",
"legacyAt": "2023-11-07T05:31:56Z",
"disabledAt": "2023-11-07T05:31:56Z"
}
]{
"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, evaluation params, and evaluator model are generated.specificationIdsmay carry at most one id as optional context.
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{}[
{
"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,
"specificationIds": [
"spec_123"
],
"userGroupIds": [
"ug_123"
],
"createdAt": "2023-11-07T05:31:56Z",
"legacyAt": "2023-11-07T05:31:56Z",
"disabledAt": "2023-11-07T05:31:56Z"
}
]{
"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)
Completion mode - PARTIAL_PROMPT (binary LLM judge) or HUMAN_EVALUATION (0-100 annotator guidelines)
PARTIAL_PROMPT, HUMAN_EVALUATION Completion mode - user-provided tags (source of truth, optional)
Completion mode - optional product id for additional context
Response
Metric configuration generated successfully
Generated metric configuration suggestion