Skip to main content
POST
/
metrics
/
generate-config
Generate or complete metric configuration with AI
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",
"actualOutput",
"expectedOutput"
],
"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

Authorization
string
header
required

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

application/json
specificationIds
string[]

Spec mode - IDs of the specifications to generate metrics for. Completion mode - at most one id used as context.

Example:
["spec_123", "spec_456"]
automaticCreation
boolean

Spec mode only - when true, creates metrics from generated config

Example:

false

maxMetricsPerSpecification
integer

Spec mode only - maximum number of metrics to generate per specification

isOnboarding
boolean

Spec mode only - whether this is an onboarding flow

Example:

false

name
string

Completion mode - the user-authored metric name (source of truth)

description
string

Completion mode - the user-authored metric description (the criteria to evaluate)

evaluationType
enum<string>

Completion mode - PARTIAL_PROMPT (binary LLM judge) or HUMAN_EVALUATION (0-100 annotator guidelines)

Available options:
PARTIAL_PROMPT,
HUMAN_EVALUATION
tags
string[]

Completion mode - user-provided tags (source of truth, optional)

productId
string

Completion mode - optional product id for additional context

Response

Metric configuration generated successfully

Generated metric configuration suggestion