curl --request POST \
--url https://dev.api.galtea.ai/v2/revisions/{id}/activate \
--header 'Authorization: Bearer <token>'import requests
url = "https://dev.api.galtea.ai/v2/revisions/{id}/activate"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://dev.api.galtea.ai/v2/revisions/{id}/activate', 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/v2/revisions/{id}/activate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://dev.api.galtea.ai/v2/revisions/{id}/activate"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
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/v2/revisions/{id}/activate")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://dev.api.galtea.ai/v2/revisions/{id}/activate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"id": "revision_123",
"metricId": "metric_123",
"number": 3,
"parentRevisionId": "revision_122",
"name": "Accuracy (strict judge)",
"isActive": true,
"legacyAt": "2023-11-07T05:31:56Z",
"disabledAt": "2023-11-07T05:31:56Z",
"availability": {
"state": "AVAILABLE",
"at": "2023-11-07T05:31:56Z",
"cause": null,
"reason": null
},
"definition": "<string>",
"judgePrompt": "Evaluate the accuracy of the response",
"evaluatorModelName": "gpt-4",
"evaluationParams": [
"input",
"actual_output",
"expected_output"
],
"areEvalParamsTop": true,
"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>"
},
"isBeingOptimized": true,
"optimizationStatus": "READY_FOR_REVIEW",
"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"
],
"excludedFromAnalyticsAt": "2023-11-07T05:31:56Z",
"excludedByUserId": "<string>",
"unavailableReason": null,
"activatedAt": "2023-11-07T05:31:56Z",
"activatedByUserId": "user_123",
"createdAt": "2023-11-07T05:31:56Z"
}{
"error": "NotFound",
"message": "Product not found"
}{
"error": "NotFound",
"message": "Product not found"
}{
"error": "NotFound",
"message": "Product not found"
}{
"error": "NotFound",
"message": "Product not found"
}Mark a revision as active
Make this legacy revision the active one of its metric, and the current active revision legacy, in one step. The specifications linked to the former active revision link this one instead. Its evaluations, history and name stay. Activating the active revision changes nothing. It answers 400 for four refusals. The revision belongs to a Galtea metric. The revision is being optimized. The revision is an optimization candidate that nobody applied (failed, declined, waiting for review or with no improvement). The judge model of the revision is retired. It also answers 400 when the metric or the revision changed during the call: reload it and retry. The id is a revision id. A metric id answers 404.
curl --request POST \
--url https://dev.api.galtea.ai/v2/revisions/{id}/activate \
--header 'Authorization: Bearer <token>'import requests
url = "https://dev.api.galtea.ai/v2/revisions/{id}/activate"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://dev.api.galtea.ai/v2/revisions/{id}/activate', 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/v2/revisions/{id}/activate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://dev.api.galtea.ai/v2/revisions/{id}/activate"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
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/v2/revisions/{id}/activate")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://dev.api.galtea.ai/v2/revisions/{id}/activate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"id": "revision_123",
"metricId": "metric_123",
"number": 3,
"parentRevisionId": "revision_122",
"name": "Accuracy (strict judge)",
"isActive": true,
"legacyAt": "2023-11-07T05:31:56Z",
"disabledAt": "2023-11-07T05:31:56Z",
"availability": {
"state": "AVAILABLE",
"at": "2023-11-07T05:31:56Z",
"cause": null,
"reason": null
},
"definition": "<string>",
"judgePrompt": "Evaluate the accuracy of the response",
"evaluatorModelName": "gpt-4",
"evaluationParams": [
"input",
"actual_output",
"expected_output"
],
"areEvalParamsTop": true,
"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>"
},
"isBeingOptimized": true,
"optimizationStatus": "READY_FOR_REVIEW",
"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"
],
"excludedFromAnalyticsAt": "2023-11-07T05:31:56Z",
"excludedByUserId": "<string>",
"unavailableReason": null,
"activatedAt": "2023-11-07T05:31:56Z",
"activatedByUserId": "user_123",
"createdAt": "2023-11-07T05:31:56Z"
}{
"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-....
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"
Path Parameters
Revision ID. A metric ID answers 404; read a metric under /v2/metrics.
1"revision_123"
Response
The activated revision. The body is the resource as its GET answers it.
Revision ID.
"revision_123"
The metric this revision belongs to.
"metric_123"
The revision number within its metric, allocated once when the revision is created and never reused. The revision shows as "R" followed by this number, so 3 is "R3".
x > 03
The revision this one was revised from. Null for the first revision of a metric.
"revision_122"
The name this revision was saved under, when it differs from its metric's name. Null otherwise: read the metric for its name.
"Accuracy (strict judge)"
Whether this is the active revision of its metric: the metric selects it, its own legacy date is unset, it is not deleted and it is not being optimized.
Earliest non-null of this revision's own legacy date and its evaluator model's unselectableAt, once that date has passed.
Earliest non-null of the metric's disabled date and this revision's evaluator model's disabledAt.
Show child attributes
Show child attributes
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"
"gpt-4"
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"]
Whether the parameters block precedes the judge prompt. Unset reads as true.
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
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"
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 revision. A MEMBER caller sees only the specifications of the products it can read.
["spec_123"]
User groups of the caller's organization linked to this revision.
["ug_123"]
When this revision was excluded from analytics. Null when its results still count. The other revisions of the metric are unaffected.
User who excluded this revision from analytics. A repeated exclusion keeps the first user.
Why the caller's organization cannot run this revision, or null when it can. Set only for an organization whose data region is EU and a revision whose judge, or, for a decision metric, whose decision model, has no healthy EU deployment.
null
When this revision last became the active one: at creation, by "Mark as active", or by applying an optimization. Null when unknown, for example for a revision activated before this was recorded. A revision copied from another organization keeps the time of the original.
User who last made this revision the active one, at activatedAt. Null when unknown: activated before this was recorded, by no signed-in user, by a deleted user, or copied from another organization.
"user_123"