curl --request PATCH \
--url https://dev.api.galtea.ai/inferenceResults/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"actualOutput": "Model response text",
"retrievalContext": "Retrieved context document",
"error": "<string>",
"latency": 123,
"input": "<string>",
"inputTokens": 123,
"outputTokens": 123,
"cacheReadInputTokens": 123,
"tokens": 123,
"cost": 123,
"costPerInputToken": 123,
"costPerOutputToken": 123,
"costPerCacheReadInputToken": 123,
"conversationSimulatorVersion": "<string>"
}
'import requests
url = "https://dev.api.galtea.ai/inferenceResults/{id}"
payload = {
"actualOutput": "Model response text",
"retrievalContext": "Retrieved context document",
"error": "<string>",
"latency": 123,
"input": "<string>",
"inputTokens": 123,
"outputTokens": 123,
"cacheReadInputTokens": 123,
"tokens": 123,
"cost": 123,
"costPerInputToken": 123,
"costPerOutputToken": 123,
"costPerCacheReadInputToken": 123,
"conversationSimulatorVersion": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
actualOutput: 'Model response text',
retrievalContext: 'Retrieved context document',
error: '<string>',
latency: 123,
input: '<string>',
inputTokens: 123,
outputTokens: 123,
cacheReadInputTokens: 123,
tokens: 123,
cost: 123,
costPerInputToken: 123,
costPerOutputToken: 123,
costPerCacheReadInputToken: 123,
conversationSimulatorVersion: '<string>'
})
};
fetch('https://dev.api.galtea.ai/inferenceResults/{id}', 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/inferenceResults/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'actualOutput' => 'Model response text',
'retrievalContext' => 'Retrieved context document',
'error' => '<string>',
'latency' => 123,
'input' => '<string>',
'inputTokens' => 123,
'outputTokens' => 123,
'cacheReadInputTokens' => 123,
'tokens' => 123,
'cost' => 123,
'costPerInputToken' => 123,
'costPerOutputToken' => 123,
'costPerCacheReadInputToken' => 123,
'conversationSimulatorVersion' => '<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://dev.api.galtea.ai/inferenceResults/{id}"
payload := strings.NewReader("{\n \"actualOutput\": \"Model response text\",\n \"retrievalContext\": \"Retrieved context document\",\n \"error\": \"<string>\",\n \"latency\": 123,\n \"input\": \"<string>\",\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}")
req, _ := http.NewRequest("PATCH", 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.patch("https://dev.api.galtea.ai/inferenceResults/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"actualOutput\": \"Model response text\",\n \"retrievalContext\": \"Retrieved context document\",\n \"error\": \"<string>\",\n \"latency\": 123,\n \"input\": \"<string>\",\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}")
.asString();require 'uri'
require 'net/http'
url = URI("https://dev.api.galtea.ai/inferenceResults/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"actualOutput\": \"Model response text\",\n \"retrievalContext\": \"Retrieved context document\",\n \"error\": \"<string>\",\n \"latency\": 123,\n \"input\": \"<string>\",\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}"
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",
"streamTruncated": false,
"timeToFirstToken": 412.5,
"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": "NotFound",
"message": "Product not found"
}{
"error": "NotFound",
"message": "Product not found"
}{
"error": "NotFound",
"message": "Product not found"
}Update trace
Update an existing trace. See Traces. The REST path /inferenceResults and the inferenceResult* JSON fields keep the old name of this entity.
curl --request PATCH \
--url https://dev.api.galtea.ai/inferenceResults/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"actualOutput": "Model response text",
"retrievalContext": "Retrieved context document",
"error": "<string>",
"latency": 123,
"input": "<string>",
"inputTokens": 123,
"outputTokens": 123,
"cacheReadInputTokens": 123,
"tokens": 123,
"cost": 123,
"costPerInputToken": 123,
"costPerOutputToken": 123,
"costPerCacheReadInputToken": 123,
"conversationSimulatorVersion": "<string>"
}
'import requests
url = "https://dev.api.galtea.ai/inferenceResults/{id}"
payload = {
"actualOutput": "Model response text",
"retrievalContext": "Retrieved context document",
"error": "<string>",
"latency": 123,
"input": "<string>",
"inputTokens": 123,
"outputTokens": 123,
"cacheReadInputTokens": 123,
"tokens": 123,
"cost": 123,
"costPerInputToken": 123,
"costPerOutputToken": 123,
"costPerCacheReadInputToken": 123,
"conversationSimulatorVersion": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
actualOutput: 'Model response text',
retrievalContext: 'Retrieved context document',
error: '<string>',
latency: 123,
input: '<string>',
inputTokens: 123,
outputTokens: 123,
cacheReadInputTokens: 123,
tokens: 123,
cost: 123,
costPerInputToken: 123,
costPerOutputToken: 123,
costPerCacheReadInputToken: 123,
conversationSimulatorVersion: '<string>'
})
};
fetch('https://dev.api.galtea.ai/inferenceResults/{id}', 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/inferenceResults/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'actualOutput' => 'Model response text',
'retrievalContext' => 'Retrieved context document',
'error' => '<string>',
'latency' => 123,
'input' => '<string>',
'inputTokens' => 123,
'outputTokens' => 123,
'cacheReadInputTokens' => 123,
'tokens' => 123,
'cost' => 123,
'costPerInputToken' => 123,
'costPerOutputToken' => 123,
'costPerCacheReadInputToken' => 123,
'conversationSimulatorVersion' => '<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://dev.api.galtea.ai/inferenceResults/{id}"
payload := strings.NewReader("{\n \"actualOutput\": \"Model response text\",\n \"retrievalContext\": \"Retrieved context document\",\n \"error\": \"<string>\",\n \"latency\": 123,\n \"input\": \"<string>\",\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}")
req, _ := http.NewRequest("PATCH", 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.patch("https://dev.api.galtea.ai/inferenceResults/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"actualOutput\": \"Model response text\",\n \"retrievalContext\": \"Retrieved context document\",\n \"error\": \"<string>\",\n \"latency\": 123,\n \"input\": \"<string>\",\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}")
.asString();require 'uri'
require 'net/http'
url = URI("https://dev.api.galtea.ai/inferenceResults/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"actualOutput\": \"Model response text\",\n \"retrievalContext\": \"Retrieved context document\",\n \"error\": \"<string>\",\n \"latency\": 123,\n \"input\": \"<string>\",\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}"
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",
"streamTruncated": false,
"timeToFirstToken": 412.5,
"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": "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-....
Path Parameters
Trace ID
Body
Agent output. Plain text by default (the scored scalar); an envelope { assistant_message, content: [{ type, uri, transcript }] } carries audio or file parts. A file part with a non-empty uri is a file, and an answer that is only files needs no scalar. A file element with no uri belongs to the customer: it is stored as sent beside a scalar, and refused without one. 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.
"Model response text"
"Retrieved context document"
Error message explaining why this trace failed or was skipped
Latency in milliseconds
Agent input for this turn. Plain text by default; for voice, an envelope carrying audio content parts. 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 by default, 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.
Trace lifecycle status. Becomes GENERATED automatically when actualOutput is written and no status is given.
PENDING, GENERATED, FAILED, SKIPPED Input tokens sent to the model, the cache read included. Recounted from the input when the request carries an input and omits this, unless the row keeps its cost (see cost). At most 2147483647, else 400.
Output tokens generated by the model. Recounted from the output when the request carries an output and omits this, unless the row keeps its cost (see cost) or is a PENDING turn that already holds a reported count and has no output yet. At most 2147483647, else 400.
Input tokens read from the model cache, a part of inputTokens. A count above inputTokens is taken as counted apart from it. At most 2147483647, else 400.
Total tokens. A value you send here is stored as sent. Omitted, it is re-derived as the input plus the output, plus the cache read when it was counted apart from the input, when the request sends a count, or sends an input or an output and the row does not keep its cost (see cost). A request that sends only a rate or the cost keeps the stored total, unless the turn held no count and the Version Model estimates one. At most 2147483647, else 400.
Total cost. A value you send here is stored as sent. Omitted, it is re-derived from the token counts and the per-token rates when the request sends a count or a rate. A request that sends an input or an output and no count or rate re-derives it at the stored rates, but keeps a cost those counts and rates do not produce, such as a stated cost or a cost summed over spans on several models. A request that sends only tokens keeps the cost.
Price of one input token. Replaced by the span rates when the turn's spans report usage; null when they use different rates. A cost you state is kept.
Price of one output token. Replaced by the span rates when the turn's spans report usage; null when they use different rates. A cost you state is kept.
Price of one cache-read token. Replaced by the span rates when the turn's spans report usage; null when they use different rates. A cost you state is kept.
Version of Galtea's conversation simulator that produced the user message
Response
Trace updated successfully
A trace: one conversation turn, holding the input and the agent output. The schema name, the /inferenceResults path and every inferenceResult* field still carry the old name of this entity, "inference result". Only the wording changed so far; the wire contract is renamed in a later API release.
"ir_123"
"session_123"
"user_123"
Order index within the session
0
PENDING, GENERATED, FAILED, SKIPPED "PENDING"
Error message explaining why this trace failed or was skipped
null
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 by default, 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, or a text file (TXT, CSV, Markdown, JSON, XML or HTML), read as its text); 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, or a text file (TXT, CSV, Markdown, JSON, XML or HTML), read as its text); 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"
150
100
50
20
Total tokens
150
0.00001
0.00003
0.000005
0.001
1
How many spans sent with this trace were refused, for example a span with an empty name or a negative latency. Null means none were refused.
2
The end user of this trace, set by OTel ingest from its own spans. Read-only. The session holds the first end user of all its traces.
"customer_42"
True when the agent's streamed reply closed before the terminal event of its endpoint connection, so the output is partial. Read-only.
false
Milliseconds from the start of the request to the agent to the first chunk of its streamed reply that carried text. Null when the reply did not stream or carried no text, and for a user without the evaluation.readInference permission. Read-only.
412.5
"1.0.0"
W3C trace ID Galtea sends in the traceparent header on this Direct Inference turn. Stored when the turn starts. This is the OpenTelemetry trace id, not the id of this Galtea trace, which is id.
"a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4"
Free-form reviewer annotations on this turn, oldest first.
Show child attributes
Show child attributes