curl --request POST \
--url https://api.galtea.ai/inferenceResults/batch \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"conversationTurns": [
{}
],
"sessionId": "session_123",
"sessionCustomId": "my-conversation-42",
"versionId": "ver_123",
"productId": "prod_123"
}
'import requests
url = "https://api.galtea.ai/inferenceResults/batch"
payload = {
"conversationTurns": [{}],
"sessionId": "session_123",
"sessionCustomId": "my-conversation-42",
"versionId": "ver_123",
"productId": "prod_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({
conversationTurns: [{}],
sessionId: 'session_123',
sessionCustomId: 'my-conversation-42',
versionId: 'ver_123',
productId: 'prod_123'
})
};
fetch('https://api.galtea.ai/inferenceResults/batch', 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/inferenceResults/batch",
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([
'conversationTurns' => [
[
]
],
'sessionId' => 'session_123',
'sessionCustomId' => 'my-conversation-42',
'versionId' => 'ver_123',
'productId' => 'prod_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://api.galtea.ai/inferenceResults/batch"
payload := strings.NewReader("{\n \"conversationTurns\": [\n {}\n ],\n \"sessionId\": \"session_123\",\n \"sessionCustomId\": \"my-conversation-42\",\n \"versionId\": \"ver_123\",\n \"productId\": \"prod_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://api.galtea.ai/inferenceResults/batch")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"conversationTurns\": [\n {}\n ],\n \"sessionId\": \"session_123\",\n \"sessionCustomId\": \"my-conversation-42\",\n \"versionId\": \"ver_123\",\n \"productId\": \"prod_123\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.galtea.ai/inferenceResults/batch")
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 \"conversationTurns\": [\n {}\n ],\n \"sessionId\": \"session_123\",\n \"sessionCustomId\": \"my-conversation-42\",\n \"versionId\": \"ver_123\",\n \"productId\": \"prod_123\"\n}"
response = http.request(request)
puts response.read_body[
{
"id": "ir_123",
"sessionId": "session_123",
"userId": "user_123",
"index": 0,
"status": "PENDING",
"error": null,
"input": {
"user_message": "User input text"
},
"actualOutput": "Model response",
"latency": 150,
"inputTokens": 100,
"outputTokens": 50,
"cacheReadInputTokens": 20,
"tokens": 150,
"costPerInputToken": 0.00001,
"costPerOutputToken": 0.00003,
"costPerCacheReadInputToken": 0.000005,
"cost": 0.001,
"creditsUsed": 1,
"droppedSpanCount": 2,
"endUser": "customer_42",
"conversationSimulatorVersion": "1.0.0",
"traceId": "a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4",
"createdAt": "2023-11-07T05:31:56Z",
"deletedAt": "2023-11-07T05:31:56Z",
"comments": [
{
"id": "comment_123",
"inferenceResultId": "inferenceResult_123",
"text": "Agent hallucinated the price.",
"tags": [
"hallucination",
"tone"
],
"userId": "user_123",
"userName": "John Doe",
"userEmail": "user@example.com",
"createdAt": "2023-11-07T05:31:56Z"
}
]
}
]{
"error": "Error type",
"message": "Error message description"
}Create traces batch
Create multiple traces from conversation turns. Identify the session with exactly one of sessionId or sessionCustomId (same find-existing semantics as POST /inferenceResults). See Traces. The REST path /inferenceResults and the inferenceResult* JSON fields keep the old name of this entity.
curl --request POST \
--url https://api.galtea.ai/inferenceResults/batch \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"conversationTurns": [
{}
],
"sessionId": "session_123",
"sessionCustomId": "my-conversation-42",
"versionId": "ver_123",
"productId": "prod_123"
}
'import requests
url = "https://api.galtea.ai/inferenceResults/batch"
payload = {
"conversationTurns": [{}],
"sessionId": "session_123",
"sessionCustomId": "my-conversation-42",
"versionId": "ver_123",
"productId": "prod_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({
conversationTurns: [{}],
sessionId: 'session_123',
sessionCustomId: 'my-conversation-42',
versionId: 'ver_123',
productId: 'prod_123'
})
};
fetch('https://api.galtea.ai/inferenceResults/batch', 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/inferenceResults/batch",
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([
'conversationTurns' => [
[
]
],
'sessionId' => 'session_123',
'sessionCustomId' => 'my-conversation-42',
'versionId' => 'ver_123',
'productId' => 'prod_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://api.galtea.ai/inferenceResults/batch"
payload := strings.NewReader("{\n \"conversationTurns\": [\n {}\n ],\n \"sessionId\": \"session_123\",\n \"sessionCustomId\": \"my-conversation-42\",\n \"versionId\": \"ver_123\",\n \"productId\": \"prod_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://api.galtea.ai/inferenceResults/batch")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"conversationTurns\": [\n {}\n ],\n \"sessionId\": \"session_123\",\n \"sessionCustomId\": \"my-conversation-42\",\n \"versionId\": \"ver_123\",\n \"productId\": \"prod_123\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.galtea.ai/inferenceResults/batch")
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 \"conversationTurns\": [\n {}\n ],\n \"sessionId\": \"session_123\",\n \"sessionCustomId\": \"my-conversation-42\",\n \"versionId\": \"ver_123\",\n \"productId\": \"prod_123\"\n}"
response = http.request(request)
puts response.read_body[
{
"id": "ir_123",
"sessionId": "session_123",
"userId": "user_123",
"index": 0,
"status": "PENDING",
"error": null,
"input": {
"user_message": "User input text"
},
"actualOutput": "Model response",
"latency": 150,
"inputTokens": 100,
"outputTokens": 50,
"cacheReadInputTokens": 20,
"tokens": 150,
"costPerInputToken": 0.00001,
"costPerOutputToken": 0.00003,
"costPerCacheReadInputToken": 0.000005,
"cost": 0.001,
"creditsUsed": 1,
"droppedSpanCount": 2,
"endUser": "customer_42",
"conversationSimulatorVersion": "1.0.0",
"traceId": "a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4",
"createdAt": "2023-11-07T05:31:56Z",
"deletedAt": "2023-11-07T05:31:56Z",
"comments": [
{
"id": "comment_123",
"inferenceResultId": "inferenceResult_123",
"text": "Agent hallucinated the price.",
"tags": [
"hallucination",
"tone"
],
"userId": "user_123",
"userName": "John Doe",
"userEmail": "user@example.com",
"createdAt": "2023-11-07T05:31:56Z"
}
]
}
]{
"error": "Error type",
"message": "Error message description"
}Authorizations
Body
Response
Traces created successfully
Structured input data. For plain text input, format is { user_message: "..." }. A content array of parts (audio or file) can sit beside an optional user_message. Each element of a content array is read on its own. A file part is a Galtea file when its uri names a Galtea storage key (files/<organization>/<32 hex>.<extension>, on any host): it is stored signature-free and checked as on a test case input (at most 20 files and 20 MB, an accepted file type, a file of this organization), otherwise 400. A Galtea file missing from storage is stored signature-free without its sizeBytes, and every other element as sent. With INLINE_MEDIA_COPY_ENABLED on, a binary file of 1,024 base64 characters or more, held in a data URI or in the byte field of a provider object, is stored as a Galtea file token instead. A metric scores a Galtea file only when its judge model reads that kind of file (PNG, JPEG, WebP, GIF or PDF); any other metric that reads this side is skipped, except a human evaluation or self-hosted one, and the reason names the file.
{ "user_message": "User input text" }
The agent turn output. Plain text by default (the scored scalar). An envelope { assistant_message, content: [...] } carries a content array of parts (audio or file) beside an optional assistant_message — the scored scalar stays the canonical transcript, and an answer that is only a file carries no scalar at all. A metric scores a Galtea file only when its judge model reads that kind of file (PNG, JPEG, WebP, GIF or PDF); any other metric that reads this side is skipped, except a human evaluation or self-hosted one, and the reason names the file.
"Model response"