curl --request POST \
--url https://api.galtea.ai/evaluations/fromInferenceResult \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"inferenceResultId": "ir_123",
"metrics": [
{
"id": "id_123",
"name": "Example Name",
"score": 0.95
}
],
"specificationIds": [
"<string>"
]
}
'import requests
url = "https://api.galtea.ai/evaluations/fromInferenceResult"
payload = {
"inferenceResultId": "ir_123",
"metrics": [
{
"id": "id_123",
"name": "Example Name",
"score": 0.95
}
],
"specificationIds": ["<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({
inferenceResultId: 'ir_123',
metrics: [{id: 'id_123', name: 'Example Name', score: 0.95}],
specificationIds: ['<string>']
})
};
fetch('https://api.galtea.ai/evaluations/fromInferenceResult', 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/evaluations/fromInferenceResult",
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([
'inferenceResultId' => 'ir_123',
'metrics' => [
[
'id' => 'id_123',
'name' => 'Example Name',
'score' => 0.95
]
],
'specificationIds' => [
'<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/evaluations/fromInferenceResult"
payload := strings.NewReader("{\n \"inferenceResultId\": \"ir_123\",\n \"metrics\": [\n {\n \"id\": \"id_123\",\n \"name\": \"Example Name\",\n \"score\": 0.95\n }\n ],\n \"specificationIds\": [\n \"<string>\"\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://api.galtea.ai/evaluations/fromInferenceResult")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"inferenceResultId\": \"ir_123\",\n \"metrics\": [\n {\n \"id\": \"id_123\",\n \"name\": \"Example Name\",\n \"score\": 0.95\n }\n ],\n \"specificationIds\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.galtea.ai/evaluations/fromInferenceResult")
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 \"inferenceResultId\": \"ir_123\",\n \"metrics\": [\n {\n \"id\": \"id_123\",\n \"name\": \"Example Name\",\n \"score\": 0.95\n }\n ],\n \"specificationIds\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body[
{
"id": "eval_123",
"metricId": "metric_123",
"sessionId": "session_123",
"userId": "user_123",
"status": "SUCCESS",
"inferenceResultId": "ir_123",
"score": 0.95,
"reason": "High quality response",
"error": "<string>",
"canRetry": false,
"creditsUsed": 1,
"conversationSimulatorVersion": "1.0.0",
"humanEvaluatorId": "<string>",
"humanEvaluatorStartedAt": "2023-11-07T05:31:56Z",
"humanScore": 123,
"humanReason": "<string>",
"humanEvaluatorFinishedAt": "2023-11-07T05:31:56Z",
"failedTurns": [
"<string>"
],
"monitorId": "<string>",
"monitorSettledAtTurn": 123,
"monitorSamplingPercentage": 123,
"deletedAt": "2023-11-07T05:31:56Z",
"evaluatedAt": "2023-11-07T05:31:56Z",
"metricLegacyAt": "2023-11-07T05:31:56Z",
"metricDisabledAt": "2023-11-07T05:31:56Z",
"testCaseLegacyAt": "2023-11-07T05:31:56Z",
"createdAt": "2023-11-07T05:31:56Z"
}
]{
"error": "Error type",
"message": "Error message description"
}{
"error": "Error type",
"message": "Error message description"
}Create evaluations for a single trace
Create evaluations for a specific turn in a conversation. This is useful for production monitoring where you want to evaluate turn-by-turn performance. See Evaluations.
curl --request POST \
--url https://api.galtea.ai/evaluations/fromInferenceResult \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"inferenceResultId": "ir_123",
"metrics": [
{
"id": "id_123",
"name": "Example Name",
"score": 0.95
}
],
"specificationIds": [
"<string>"
]
}
'import requests
url = "https://api.galtea.ai/evaluations/fromInferenceResult"
payload = {
"inferenceResultId": "ir_123",
"metrics": [
{
"id": "id_123",
"name": "Example Name",
"score": 0.95
}
],
"specificationIds": ["<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({
inferenceResultId: 'ir_123',
metrics: [{id: 'id_123', name: 'Example Name', score: 0.95}],
specificationIds: ['<string>']
})
};
fetch('https://api.galtea.ai/evaluations/fromInferenceResult', 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/evaluations/fromInferenceResult",
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([
'inferenceResultId' => 'ir_123',
'metrics' => [
[
'id' => 'id_123',
'name' => 'Example Name',
'score' => 0.95
]
],
'specificationIds' => [
'<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/evaluations/fromInferenceResult"
payload := strings.NewReader("{\n \"inferenceResultId\": \"ir_123\",\n \"metrics\": [\n {\n \"id\": \"id_123\",\n \"name\": \"Example Name\",\n \"score\": 0.95\n }\n ],\n \"specificationIds\": [\n \"<string>\"\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://api.galtea.ai/evaluations/fromInferenceResult")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"inferenceResultId\": \"ir_123\",\n \"metrics\": [\n {\n \"id\": \"id_123\",\n \"name\": \"Example Name\",\n \"score\": 0.95\n }\n ],\n \"specificationIds\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.galtea.ai/evaluations/fromInferenceResult")
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 \"inferenceResultId\": \"ir_123\",\n \"metrics\": [\n {\n \"id\": \"id_123\",\n \"name\": \"Example Name\",\n \"score\": 0.95\n }\n ],\n \"specificationIds\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body[
{
"id": "eval_123",
"metricId": "metric_123",
"sessionId": "session_123",
"userId": "user_123",
"status": "SUCCESS",
"inferenceResultId": "ir_123",
"score": 0.95,
"reason": "High quality response",
"error": "<string>",
"canRetry": false,
"creditsUsed": 1,
"conversationSimulatorVersion": "1.0.0",
"humanEvaluatorId": "<string>",
"humanEvaluatorStartedAt": "2023-11-07T05:31:56Z",
"humanScore": 123,
"humanReason": "<string>",
"humanEvaluatorFinishedAt": "2023-11-07T05:31:56Z",
"failedTurns": [
"<string>"
],
"monitorId": "<string>",
"monitorSettledAtTurn": 123,
"monitorSamplingPercentage": 123,
"deletedAt": "2023-11-07T05:31:56Z",
"evaluatedAt": "2023-11-07T05:31:56Z",
"metricLegacyAt": "2023-11-07T05:31:56Z",
"metricDisabledAt": "2023-11-07T05:31:56Z",
"testCaseLegacyAt": "2023-11-07T05:31:56Z",
"createdAt": "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
The ID of the trace (one conversation turn) to evaluate
"ir_123"
Metrics to evaluate. Optional if specificationIds is provided or the product has specifications with linked metrics.
Show child attributes
Show child attributes
Specification IDs whose linked metrics will be evaluated. Can be combined with metrics; the API merges and deduplicates.
Response
Evaluations created successfully
"eval_123"
"metric_123"
"session_123"
"user_123"
PENDING, PENDING_HUMAN, SUCCESS, FAILED, SKIPPED, CANCELLED, OUTDATED "SUCCESS"
"ir_123"
0.95
"High quality response"
false
1
"1.0.0"
User ID of the human evaluator
Human-provided annotation score
Human-provided annotation reason
Timestamp when human evaluation was submitted
Conversation turns that failed
ID of the monitor that dispatched this evaluation
Session turn count when the monitor scored it
Sampling percentage in effect when the monitor scored this session