cURL
curl --request POST \
--url http://studio.premai.io/api/v1/traces \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
[
{
"modelId": "<string>",
"input": "<string>",
"output": "<string>",
"score": 0.5,
"projectId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"feedback": "<string>"
}
]
'import requests
url = "http://studio.premai.io/api/v1/traces"
payload = [
{
"modelId": "<string>",
"input": "<string>",
"output": "<string>",
"score": 0.5,
"projectId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"feedback": "<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([
{
modelId: '<string>',
input: '<string>',
output: '<string>',
score: 0.5,
projectId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
feedback: '<string>'
}
])
};
fetch('http://studio.premai.io/api/v1/traces', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"results": [
{
"traceId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"success": true
}
]
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}Traces API
Create Trace
Use this endpoint to create a trace.
POST
/
api
/
v1
/
traces
cURL
curl --request POST \
--url http://studio.premai.io/api/v1/traces \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
[
{
"modelId": "<string>",
"input": "<string>",
"output": "<string>",
"score": 0.5,
"projectId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"feedback": "<string>"
}
]
'import requests
url = "http://studio.premai.io/api/v1/traces"
payload = [
{
"modelId": "<string>",
"input": "<string>",
"output": "<string>",
"score": 0.5,
"projectId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"feedback": "<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([
{
modelId: '<string>',
input: '<string>',
output: '<string>',
score: 0.5,
projectId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
feedback: '<string>'
}
])
};
fetch('http://studio.premai.io/api/v1/traces', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"results": [
{
"traceId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"success": true
}
]
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
Identifier (or alias) for the model that produced the trace.
Minimum string length:
1Prompt or message provided to the model.
Minimum string length:
1Model response captured for the trace.
Minimum string length:
1Evaluator score used to determine if the trace is positive.
Required range:
0 <= x <= 1Project identifier that groups this trace. Leave empty to keep it unassigned.
Optional feedback explaining the score or providing guidance.
Maximum string length:
2048Response
success response
One entry per trace provided in the request.
Show child attributes
Show child attributes
Was this page helpful?