curl --request POST \
--url https://dev.api.galtea.ai/metrics/bulk \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"metrics": [
{
"name": "<string>",
"description": "<string>",
"tags": [
"<string>"
],
"evaluatorModelName": "jev-1.13.0",
"specificationIds": [
"<string>"
],
"passThreshold": 0.7,
"applicabilityScope": "PRODUCTION",
"applicabilityThreshold": 0.7
}
]
}
'import requests
url = "https://dev.api.galtea.ai/metrics/bulk"
payload = { "metrics": [
{
"name": "<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>',
description: '<string>',
tags: ['<string>'],
evaluatorModelName: 'jev-1.13.0',
specificationIds: ['<string>'],
passThreshold: 0.7,
applicabilityScope: 'PRODUCTION',
applicabilityThreshold: 0.7
}
]
})
};
fetch('https://dev.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://dev.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>',
'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://dev.api.galtea.ai/metrics/bulk"
payload := strings.NewReader("{\n \"metrics\": [\n {\n \"name\": \"<string>\",\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://dev.api.galtea.ai/metrics/bulk")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"metrics\": [\n {\n \"name\": \"<string>\",\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://dev.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 \"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,
"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"
}{
"error": "NotFound",
"message": "Product not found"
}Create several decision metrics at once
Creates DECISION metrics only. Each item takes a decisionQuestion 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 decision model its item names, or the one selectable decision 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 decision metrics, for a name that is not a selectable decision model, and for an item that names none while several are selectable.
curl --request POST \
--url https://dev.api.galtea.ai/metrics/bulk \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"metrics": [
{
"name": "<string>",
"description": "<string>",
"tags": [
"<string>"
],
"evaluatorModelName": "jev-1.13.0",
"specificationIds": [
"<string>"
],
"passThreshold": 0.7,
"applicabilityScope": "PRODUCTION",
"applicabilityThreshold": 0.7
}
]
}
'import requests
url = "https://dev.api.galtea.ai/metrics/bulk"
payload = { "metrics": [
{
"name": "<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>',
description: '<string>',
tags: ['<string>'],
evaluatorModelName: 'jev-1.13.0',
specificationIds: ['<string>'],
passThreshold: 0.7,
applicabilityScope: 'PRODUCTION',
applicabilityThreshold: 0.7
}
]
})
};
fetch('https://dev.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://dev.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>',
'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://dev.api.galtea.ai/metrics/bulk"
payload := strings.NewReader("{\n \"metrics\": [\n {\n \"name\": \"<string>\",\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://dev.api.galtea.ai/metrics/bulk")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"metrics\": [\n {\n \"name\": \"<string>\",\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://dev.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 \"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,
"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"
}{
"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-....
Body
1 - 10 elementsShow child attributes
Show child attributes
Response
The created metrics, in request order. When the read after the create fails, metrics holds only the created ids ([{ id }]) instead
- Option 1
- Option 2
The created metrics, in request order.
Show child attributes
Show child attributes