curl --request POST \
--url https://dev.api.galtea.ai/evaluations/singleTurn \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"metrics": [
{
"id": "id_123",
"name": "Example Name",
"score": 0.95
}
],
"actualOutput": "Model response text",
"versionId": "ver_123",
"productId": "prod_123",
"testCaseId": "tc_123",
"input": "What is the capital of France?",
"retrievalContext": "Retrieved context document",
"inputTokens": 123,
"outputTokens": 123,
"cacheReadInputTokens": 123,
"tokens": 123,
"cost": 123,
"costPerInputToken": 123,
"costPerOutputToken": 123,
"costPerCacheReadInputToken": 123,
"conversationSimulatorVersion": "<string>",
"isProduction": true,
"runId": "run_123"
}
'import requests
url = "https://dev.api.galtea.ai/evaluations/singleTurn"
payload = {
"metrics": [
{
"id": "id_123",
"name": "Example Name",
"score": 0.95
}
],
"actualOutput": "Model response text",
"versionId": "ver_123",
"productId": "prod_123",
"testCaseId": "tc_123",
"input": "What is the capital of France?",
"retrievalContext": "Retrieved context document",
"inputTokens": 123,
"outputTokens": 123,
"cacheReadInputTokens": 123,
"tokens": 123,
"cost": 123,
"costPerInputToken": 123,
"costPerOutputToken": 123,
"costPerCacheReadInputToken": 123,
"conversationSimulatorVersion": "<string>",
"isProduction": True,
"runId": "run_123"
}
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: [{id: 'id_123', name: 'Example Name', score: 0.95}],
actualOutput: 'Model response text',
versionId: 'ver_123',
productId: 'prod_123',
testCaseId: 'tc_123',
input: 'What is the capital of France?',
retrievalContext: 'Retrieved context document',
inputTokens: 123,
outputTokens: 123,
cacheReadInputTokens: 123,
tokens: 123,
cost: 123,
costPerInputToken: 123,
costPerOutputToken: 123,
costPerCacheReadInputToken: 123,
conversationSimulatorVersion: '<string>',
isProduction: true,
runId: 'run_123'
})
};
fetch('https://dev.api.galtea.ai/evaluations/singleTurn', 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/evaluations/singleTurn",
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' => [
[
'id' => 'id_123',
'name' => 'Example Name',
'score' => 0.95
]
],
'actualOutput' => 'Model response text',
'versionId' => 'ver_123',
'productId' => 'prod_123',
'testCaseId' => 'tc_123',
'input' => 'What is the capital of France?',
'retrievalContext' => 'Retrieved context document',
'inputTokens' => 123,
'outputTokens' => 123,
'cacheReadInputTokens' => 123,
'tokens' => 123,
'cost' => 123,
'costPerInputToken' => 123,
'costPerOutputToken' => 123,
'costPerCacheReadInputToken' => 123,
'conversationSimulatorVersion' => '<string>',
'isProduction' => true,
'runId' => 'run_123'
]),
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/evaluations/singleTurn"
payload := strings.NewReader("{\n \"metrics\": [\n {\n \"id\": \"id_123\",\n \"name\": \"Example Name\",\n \"score\": 0.95\n }\n ],\n \"actualOutput\": \"Model response text\",\n \"versionId\": \"ver_123\",\n \"productId\": \"prod_123\",\n \"testCaseId\": \"tc_123\",\n \"input\": \"What is the capital of France?\",\n \"retrievalContext\": \"Retrieved context document\",\n \"inputTokens\": 123,\n \"outputTokens\": 123,\n \"cacheReadInputTokens\": 123,\n \"tokens\": 123,\n \"cost\": 123,\n \"costPerInputToken\": 123,\n \"costPerOutputToken\": 123,\n \"costPerCacheReadInputToken\": 123,\n \"conversationSimulatorVersion\": \"<string>\",\n \"isProduction\": true,\n \"runId\": \"run_123\"\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/evaluations/singleTurn")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"metrics\": [\n {\n \"id\": \"id_123\",\n \"name\": \"Example Name\",\n \"score\": 0.95\n }\n ],\n \"actualOutput\": \"Model response text\",\n \"versionId\": \"ver_123\",\n \"productId\": \"prod_123\",\n \"testCaseId\": \"tc_123\",\n \"input\": \"What is the capital of France?\",\n \"retrievalContext\": \"Retrieved context document\",\n \"inputTokens\": 123,\n \"outputTokens\": 123,\n \"cacheReadInputTokens\": 123,\n \"tokens\": 123,\n \"cost\": 123,\n \"costPerInputToken\": 123,\n \"costPerOutputToken\": 123,\n \"costPerCacheReadInputToken\": 123,\n \"conversationSimulatorVersion\": \"<string>\",\n \"isProduction\": true,\n \"runId\": \"run_123\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://dev.api.galtea.ai/evaluations/singleTurn")
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 \"id\": \"id_123\",\n \"name\": \"Example Name\",\n \"score\": 0.95\n }\n ],\n \"actualOutput\": \"Model response text\",\n \"versionId\": \"ver_123\",\n \"productId\": \"prod_123\",\n \"testCaseId\": \"tc_123\",\n \"input\": \"What is the capital of France?\",\n \"retrievalContext\": \"Retrieved context document\",\n \"inputTokens\": 123,\n \"outputTokens\": 123,\n \"cacheReadInputTokens\": 123,\n \"tokens\": 123,\n \"cost\": 123,\n \"costPerInputToken\": 123,\n \"costPerOutputToken\": 123,\n \"costPerCacheReadInputToken\": 123,\n \"conversationSimulatorVersion\": \"<string>\",\n \"isProduction\": true,\n \"runId\": \"run_123\"\n}"
response = http.request(request)
puts response.read_body[
{
"id": "eval_123",
"metricId": "metric_123",
"sessionId": "session_123",
"productId": "product_123",
"userId": "user_123",
"status": "SUCCESS",
"inferenceResultId": "ir_123",
"score": 0.95,
"reason": "<string>",
"error": "<string>",
"canRetry": true,
"creditsUsed": 123,
"conversationSimulatorVersion": "<string>",
"humanEvaluatorId": "<string>",
"humanEvaluatorStartedAt": "2023-11-07T05:31:56Z",
"humanScore": 123,
"humanReason": "<string>",
"humanEvaluatorFinishedAt": "2023-11-07T05:31:56Z",
"failedTurns": [
"<string>"
],
"deletedAt": "2023-11-07T05:31:56Z",
"evaluatedAt": "2023-11-07T05:31:56Z",
"metricLegacyAt": "2023-11-07T05:31:56Z",
"passed": true,
"metricPassThreshold": 0.5,
"metricDisabledAt": "2023-11-07T05:31:56Z",
"runId": "<string>",
"metricExcludedFromAnalyticsAt": "2023-11-07T05:31:56Z",
"metricExcludedByUserId": "<string>",
"createdAt": "2023-11-07T05:31:56Z"
}
]{
"error": "NotFound",
"message": "Product not found"
}{
"error": "NotFound",
"message": "Product not found"
}{
"error": "NotFound",
"message": "Product not found"
}Create single-turn evaluations
Create evaluations for single-turn interactions. See Evaluations.
curl --request POST \
--url https://dev.api.galtea.ai/evaluations/singleTurn \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"metrics": [
{
"id": "id_123",
"name": "Example Name",
"score": 0.95
}
],
"actualOutput": "Model response text",
"versionId": "ver_123",
"productId": "prod_123",
"testCaseId": "tc_123",
"input": "What is the capital of France?",
"retrievalContext": "Retrieved context document",
"inputTokens": 123,
"outputTokens": 123,
"cacheReadInputTokens": 123,
"tokens": 123,
"cost": 123,
"costPerInputToken": 123,
"costPerOutputToken": 123,
"costPerCacheReadInputToken": 123,
"conversationSimulatorVersion": "<string>",
"isProduction": true,
"runId": "run_123"
}
'import requests
url = "https://dev.api.galtea.ai/evaluations/singleTurn"
payload = {
"metrics": [
{
"id": "id_123",
"name": "Example Name",
"score": 0.95
}
],
"actualOutput": "Model response text",
"versionId": "ver_123",
"productId": "prod_123",
"testCaseId": "tc_123",
"input": "What is the capital of France?",
"retrievalContext": "Retrieved context document",
"inputTokens": 123,
"outputTokens": 123,
"cacheReadInputTokens": 123,
"tokens": 123,
"cost": 123,
"costPerInputToken": 123,
"costPerOutputToken": 123,
"costPerCacheReadInputToken": 123,
"conversationSimulatorVersion": "<string>",
"isProduction": True,
"runId": "run_123"
}
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: [{id: 'id_123', name: 'Example Name', score: 0.95}],
actualOutput: 'Model response text',
versionId: 'ver_123',
productId: 'prod_123',
testCaseId: 'tc_123',
input: 'What is the capital of France?',
retrievalContext: 'Retrieved context document',
inputTokens: 123,
outputTokens: 123,
cacheReadInputTokens: 123,
tokens: 123,
cost: 123,
costPerInputToken: 123,
costPerOutputToken: 123,
costPerCacheReadInputToken: 123,
conversationSimulatorVersion: '<string>',
isProduction: true,
runId: 'run_123'
})
};
fetch('https://dev.api.galtea.ai/evaluations/singleTurn', 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/evaluations/singleTurn",
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' => [
[
'id' => 'id_123',
'name' => 'Example Name',
'score' => 0.95
]
],
'actualOutput' => 'Model response text',
'versionId' => 'ver_123',
'productId' => 'prod_123',
'testCaseId' => 'tc_123',
'input' => 'What is the capital of France?',
'retrievalContext' => 'Retrieved context document',
'inputTokens' => 123,
'outputTokens' => 123,
'cacheReadInputTokens' => 123,
'tokens' => 123,
'cost' => 123,
'costPerInputToken' => 123,
'costPerOutputToken' => 123,
'costPerCacheReadInputToken' => 123,
'conversationSimulatorVersion' => '<string>',
'isProduction' => true,
'runId' => 'run_123'
]),
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/evaluations/singleTurn"
payload := strings.NewReader("{\n \"metrics\": [\n {\n \"id\": \"id_123\",\n \"name\": \"Example Name\",\n \"score\": 0.95\n }\n ],\n \"actualOutput\": \"Model response text\",\n \"versionId\": \"ver_123\",\n \"productId\": \"prod_123\",\n \"testCaseId\": \"tc_123\",\n \"input\": \"What is the capital of France?\",\n \"retrievalContext\": \"Retrieved context document\",\n \"inputTokens\": 123,\n \"outputTokens\": 123,\n \"cacheReadInputTokens\": 123,\n \"tokens\": 123,\n \"cost\": 123,\n \"costPerInputToken\": 123,\n \"costPerOutputToken\": 123,\n \"costPerCacheReadInputToken\": 123,\n \"conversationSimulatorVersion\": \"<string>\",\n \"isProduction\": true,\n \"runId\": \"run_123\"\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/evaluations/singleTurn")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"metrics\": [\n {\n \"id\": \"id_123\",\n \"name\": \"Example Name\",\n \"score\": 0.95\n }\n ],\n \"actualOutput\": \"Model response text\",\n \"versionId\": \"ver_123\",\n \"productId\": \"prod_123\",\n \"testCaseId\": \"tc_123\",\n \"input\": \"What is the capital of France?\",\n \"retrievalContext\": \"Retrieved context document\",\n \"inputTokens\": 123,\n \"outputTokens\": 123,\n \"cacheReadInputTokens\": 123,\n \"tokens\": 123,\n \"cost\": 123,\n \"costPerInputToken\": 123,\n \"costPerOutputToken\": 123,\n \"costPerCacheReadInputToken\": 123,\n \"conversationSimulatorVersion\": \"<string>\",\n \"isProduction\": true,\n \"runId\": \"run_123\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://dev.api.galtea.ai/evaluations/singleTurn")
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 \"id\": \"id_123\",\n \"name\": \"Example Name\",\n \"score\": 0.95\n }\n ],\n \"actualOutput\": \"Model response text\",\n \"versionId\": \"ver_123\",\n \"productId\": \"prod_123\",\n \"testCaseId\": \"tc_123\",\n \"input\": \"What is the capital of France?\",\n \"retrievalContext\": \"Retrieved context document\",\n \"inputTokens\": 123,\n \"outputTokens\": 123,\n \"cacheReadInputTokens\": 123,\n \"tokens\": 123,\n \"cost\": 123,\n \"costPerInputToken\": 123,\n \"costPerOutputToken\": 123,\n \"costPerCacheReadInputToken\": 123,\n \"conversationSimulatorVersion\": \"<string>\",\n \"isProduction\": true,\n \"runId\": \"run_123\"\n}"
response = http.request(request)
puts response.read_body[
{
"id": "eval_123",
"metricId": "metric_123",
"sessionId": "session_123",
"productId": "product_123",
"userId": "user_123",
"status": "SUCCESS",
"inferenceResultId": "ir_123",
"score": 0.95,
"reason": "<string>",
"error": "<string>",
"canRetry": true,
"creditsUsed": 123,
"conversationSimulatorVersion": "<string>",
"humanEvaluatorId": "<string>",
"humanEvaluatorStartedAt": "2023-11-07T05:31:56Z",
"humanScore": 123,
"humanReason": "<string>",
"humanEvaluatorFinishedAt": "2023-11-07T05:31:56Z",
"failedTurns": [
"<string>"
],
"deletedAt": "2023-11-07T05:31:56Z",
"evaluatedAt": "2023-11-07T05:31:56Z",
"metricLegacyAt": "2023-11-07T05:31:56Z",
"passed": true,
"metricPassThreshold": 0.5,
"metricDisabledAt": "2023-11-07T05:31:56Z",
"runId": "<string>",
"metricExcludedFromAnalyticsAt": "2023-11-07T05:31:56Z",
"metricExcludedByUserId": "<string>",
"createdAt": "2023-11-07T05:31:56Z"
}
]{
"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
Show child attributes
Show child attributes
"Model response text"
Version to attach the evaluation to. Optional: when omitted, provide productId and the API reuses the product's latest version (creating a default first version if the product has none). One of versionId or productId is required.
"ver_123"
Product to anchor the evaluation when versionId is omitted. Ignored when versionId is provided.
"prod_123"
Required when isProduction is false. Must be omitted when isProduction is true.
"tc_123"
User input/prompt. Required when isProduction is true. Must be omitted when isProduction is false.
"What is the capital of France?"
RAG retrieval context used to generate the actual output
"Retrieved context document"
Input token count for the LLM call, cached input included
Output token count for the LLM call
Input tokens served from a prompt cache, a part of inputTokens. A count above inputTokens is taken as counted apart from it.
Total token count, when the caller has no breakdown
Total cost of the LLM call
Price per input token
Price per output token
Price per cache-read input token
Version of the conversation simulator that produced this turn, if simulated
When true, creates a production evaluation (input required, testCaseId must be omitted). When false (default), testCaseId is required and input must be omitted.
Attribute this evaluation to a run you opened with POST /runs, and close that run yourself. Without it the API opens its own run and closes it when the launch finishes. A run the platform opened is refused.
"run_123"
Response
Evaluations created successfully
"eval_123"
"metric_123"
"session_123"
"product_123"
"user_123"
PENDING, PENDING_HUMAN, SUCCESS, FAILED, SKIPPED, CANCELLED, OUTDATED "SUCCESS"
"ir_123"
0.95
The human evaluator of a HUMAN_EVALUATION metric. On an AI-judged metric, the annotator of the case annotation, or null when the case has none.
When the human evaluator claimed this HUMAN_EVALUATION evaluation. Always null on an AI-judged metric, because annotating needs no claim.
When the human evaluator submitted this HUMAN_EVALUATION evaluation. On an AI-judged metric, when the case annotation was last written.
Whether the reported score (the reviewer's when set, else the judge's) reaches the metric's pass threshold. Null when the evaluation has no reported score, is outdated or deleted, is a long decision input, or its metric is not loaded.
The pass threshold that decides passed: the metric's, copied onto the evaluation when it was created.
0 <= x <= 1