Monitor Single Prompt
Monitor a prompt output
curl --request POST \
--url https://api.getbasalt.ai/monitor/log \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"slug": "qa",
"output": "Paris",
"name": "qa-chatbot",
"version": "1.0.0",
"tag": "production",
"input": "What is the capital of France?",
"idealOutput": "Paris",
"variables": [
{
"label": "question",
"value": "What is the capital of France?"
}
],
"startTime": "2021-01-01T00:00:00Z",
"endTime": "2021-01-01T00:00:00Z",
"inputTokens": 100,
"outputTokens": 100,
"cost": 100,
"organization": {
"id": "123",
"name": "ACME"
},
"user": {
"id": "123",
"name": "John Doe"
},
"metadata": {
"sessionId": "456",
"userType": "admin"
}
}
'import requests
url = "https://api.getbasalt.ai/monitor/log"
payload = {
"slug": "qa",
"output": "Paris",
"name": "qa-chatbot",
"version": "1.0.0",
"tag": "production",
"input": "What is the capital of France?",
"idealOutput": "Paris",
"variables": [
{
"label": "question",
"value": "What is the capital of France?"
}
],
"startTime": "2021-01-01T00:00:00Z",
"endTime": "2021-01-01T00:00:00Z",
"inputTokens": 100,
"outputTokens": 100,
"cost": 100,
"organization": {
"id": "123",
"name": "ACME"
},
"user": {
"id": "123",
"name": "John Doe"
},
"metadata": {
"sessionId": "456",
"userType": "admin"
}
}
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({
slug: 'qa',
output: 'Paris',
name: 'qa-chatbot',
version: '1.0.0',
tag: 'production',
input: 'What is the capital of France?',
idealOutput: 'Paris',
variables: [{label: 'question', value: 'What is the capital of France?'}],
startTime: '2021-01-01T00:00:00Z',
endTime: '2021-01-01T00:00:00Z',
inputTokens: 100,
outputTokens: 100,
cost: 100,
organization: {id: '123', name: 'ACME'},
user: {id: '123', name: 'John Doe'},
metadata: {sessionId: '456', userType: 'admin'}
})
};
fetch('https://api.getbasalt.ai/monitor/log', 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.getbasalt.ai/monitor/log",
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([
'slug' => 'qa',
'output' => 'Paris',
'name' => 'qa-chatbot',
'version' => '1.0.0',
'tag' => 'production',
'input' => 'What is the capital of France?',
'idealOutput' => 'Paris',
'variables' => [
[
'label' => 'question',
'value' => 'What is the capital of France?'
]
],
'startTime' => '2021-01-01T00:00:00Z',
'endTime' => '2021-01-01T00:00:00Z',
'inputTokens' => 100,
'outputTokens' => 100,
'cost' => 100,
'organization' => [
'id' => '123',
'name' => 'ACME'
],
'user' => [
'id' => '123',
'name' => 'John Doe'
],
'metadata' => [
'sessionId' => '456',
'userType' => 'admin'
]
]),
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.getbasalt.ai/monitor/log"
payload := strings.NewReader("{\n \"slug\": \"qa\",\n \"output\": \"Paris\",\n \"name\": \"qa-chatbot\",\n \"version\": \"1.0.0\",\n \"tag\": \"production\",\n \"input\": \"What is the capital of France?\",\n \"idealOutput\": \"Paris\",\n \"variables\": [\n {\n \"label\": \"question\",\n \"value\": \"What is the capital of France?\"\n }\n ],\n \"startTime\": \"2021-01-01T00:00:00Z\",\n \"endTime\": \"2021-01-01T00:00:00Z\",\n \"inputTokens\": 100,\n \"outputTokens\": 100,\n \"cost\": 100,\n \"organization\": {\n \"id\": \"123\",\n \"name\": \"ACME\"\n },\n \"user\": {\n \"id\": \"123\",\n \"name\": \"John Doe\"\n },\n \"metadata\": {\n \"sessionId\": \"456\",\n \"userType\": \"admin\"\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.getbasalt.ai/monitor/log")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"slug\": \"qa\",\n \"output\": \"Paris\",\n \"name\": \"qa-chatbot\",\n \"version\": \"1.0.0\",\n \"tag\": \"production\",\n \"input\": \"What is the capital of France?\",\n \"idealOutput\": \"Paris\",\n \"variables\": [\n {\n \"label\": \"question\",\n \"value\": \"What is the capital of France?\"\n }\n ],\n \"startTime\": \"2021-01-01T00:00:00Z\",\n \"endTime\": \"2021-01-01T00:00:00Z\",\n \"inputTokens\": 100,\n \"outputTokens\": 100,\n \"cost\": 100,\n \"organization\": {\n \"id\": \"123\",\n \"name\": \"ACME\"\n },\n \"user\": {\n \"id\": \"123\",\n \"name\": \"John Doe\"\n },\n \"metadata\": {\n \"sessionId\": \"456\",\n \"userType\": \"admin\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.getbasalt.ai/monitor/log")
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 \"slug\": \"qa\",\n \"output\": \"Paris\",\n \"name\": \"qa-chatbot\",\n \"version\": \"1.0.0\",\n \"tag\": \"production\",\n \"input\": \"What is the capital of France?\",\n \"idealOutput\": \"Paris\",\n \"variables\": [\n {\n \"label\": \"question\",\n \"value\": \"What is the capital of France?\"\n }\n ],\n \"startTime\": \"2021-01-01T00:00:00Z\",\n \"endTime\": \"2021-01-01T00:00:00Z\",\n \"inputTokens\": 100,\n \"outputTokens\": 100,\n \"cost\": 100,\n \"organization\": {\n \"id\": \"123\",\n \"name\": \"ACME\"\n },\n \"user\": {\n \"id\": \"123\",\n \"name\": \"John Doe\"\n },\n \"metadata\": {\n \"sessionId\": \"456\",\n \"userType\": \"admin\"\n }\n}"
response = http.request(request)
puts response.read_body{
"trace": {
"id": "123"
},
"log": {
"id": "123"
},
"warning": "No prompt found with the given slug or no production version found or no prompt found with the given version or tag (production version also missing)"
}{
"error": "<string>"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
The slug of the prompt
"qa"
The output of the prompt.
"Paris"
The name of the trace
"qa-chatbot"
The version of the prompt
"1.0.0"
The tag of the prompt
"production"
The input of the prompt.
"What is the capital of France?"
The ideal output of the prompt.
"Paris"
Variables used in the prompt.
Show child attributes
Show child attributes
[
{
"label": "question",
"value": "What is the capital of France?"
}
]The start time of the prompt.
"2021-01-01T00:00:00Z"
The end time of the prompt.
"2021-01-01T00:00:00Z"
The number of input tokens. If not provided, it will be computed based on the input
100
The number of output tokens. If not provided, it will be computed based on the output
100
The cost of the prompt. If not provided, it will be computed based on the input and output tokens
100
The organization related to the prompt. Used to identify the organization of the user that triggered the prompt.
Show child attributes
Show child attributes
{ "id": "123", "name": "ACME" }The user related to the prompt. Used to identify the user that triggered the prompt.
Show child attributes
Show child attributes
{ "id": "123", "name": "John Doe" }Additional metadata to be associated with the prompt.
Show child attributes
Show child attributes
{ "sessionId": "456", "userType": "admin" }Response
The id of the created trace and log
The ID of the trace
Show child attributes
Show child attributes
{ "id": "123" }The ID of the log
Show child attributes
Show child attributes
{ "id": "123" }The warning message
"No prompt found with the given slug or no production version found or no prompt found with the given version or tag (production version also missing)"
Was this page helpful?
curl --request POST \
--url https://api.getbasalt.ai/monitor/log \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"slug": "qa",
"output": "Paris",
"name": "qa-chatbot",
"version": "1.0.0",
"tag": "production",
"input": "What is the capital of France?",
"idealOutput": "Paris",
"variables": [
{
"label": "question",
"value": "What is the capital of France?"
}
],
"startTime": "2021-01-01T00:00:00Z",
"endTime": "2021-01-01T00:00:00Z",
"inputTokens": 100,
"outputTokens": 100,
"cost": 100,
"organization": {
"id": "123",
"name": "ACME"
},
"user": {
"id": "123",
"name": "John Doe"
},
"metadata": {
"sessionId": "456",
"userType": "admin"
}
}
'import requests
url = "https://api.getbasalt.ai/monitor/log"
payload = {
"slug": "qa",
"output": "Paris",
"name": "qa-chatbot",
"version": "1.0.0",
"tag": "production",
"input": "What is the capital of France?",
"idealOutput": "Paris",
"variables": [
{
"label": "question",
"value": "What is the capital of France?"
}
],
"startTime": "2021-01-01T00:00:00Z",
"endTime": "2021-01-01T00:00:00Z",
"inputTokens": 100,
"outputTokens": 100,
"cost": 100,
"organization": {
"id": "123",
"name": "ACME"
},
"user": {
"id": "123",
"name": "John Doe"
},
"metadata": {
"sessionId": "456",
"userType": "admin"
}
}
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({
slug: 'qa',
output: 'Paris',
name: 'qa-chatbot',
version: '1.0.0',
tag: 'production',
input: 'What is the capital of France?',
idealOutput: 'Paris',
variables: [{label: 'question', value: 'What is the capital of France?'}],
startTime: '2021-01-01T00:00:00Z',
endTime: '2021-01-01T00:00:00Z',
inputTokens: 100,
outputTokens: 100,
cost: 100,
organization: {id: '123', name: 'ACME'},
user: {id: '123', name: 'John Doe'},
metadata: {sessionId: '456', userType: 'admin'}
})
};
fetch('https://api.getbasalt.ai/monitor/log', 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.getbasalt.ai/monitor/log",
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([
'slug' => 'qa',
'output' => 'Paris',
'name' => 'qa-chatbot',
'version' => '1.0.0',
'tag' => 'production',
'input' => 'What is the capital of France?',
'idealOutput' => 'Paris',
'variables' => [
[
'label' => 'question',
'value' => 'What is the capital of France?'
]
],
'startTime' => '2021-01-01T00:00:00Z',
'endTime' => '2021-01-01T00:00:00Z',
'inputTokens' => 100,
'outputTokens' => 100,
'cost' => 100,
'organization' => [
'id' => '123',
'name' => 'ACME'
],
'user' => [
'id' => '123',
'name' => 'John Doe'
],
'metadata' => [
'sessionId' => '456',
'userType' => 'admin'
]
]),
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.getbasalt.ai/monitor/log"
payload := strings.NewReader("{\n \"slug\": \"qa\",\n \"output\": \"Paris\",\n \"name\": \"qa-chatbot\",\n \"version\": \"1.0.0\",\n \"tag\": \"production\",\n \"input\": \"What is the capital of France?\",\n \"idealOutput\": \"Paris\",\n \"variables\": [\n {\n \"label\": \"question\",\n \"value\": \"What is the capital of France?\"\n }\n ],\n \"startTime\": \"2021-01-01T00:00:00Z\",\n \"endTime\": \"2021-01-01T00:00:00Z\",\n \"inputTokens\": 100,\n \"outputTokens\": 100,\n \"cost\": 100,\n \"organization\": {\n \"id\": \"123\",\n \"name\": \"ACME\"\n },\n \"user\": {\n \"id\": \"123\",\n \"name\": \"John Doe\"\n },\n \"metadata\": {\n \"sessionId\": \"456\",\n \"userType\": \"admin\"\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.getbasalt.ai/monitor/log")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"slug\": \"qa\",\n \"output\": \"Paris\",\n \"name\": \"qa-chatbot\",\n \"version\": \"1.0.0\",\n \"tag\": \"production\",\n \"input\": \"What is the capital of France?\",\n \"idealOutput\": \"Paris\",\n \"variables\": [\n {\n \"label\": \"question\",\n \"value\": \"What is the capital of France?\"\n }\n ],\n \"startTime\": \"2021-01-01T00:00:00Z\",\n \"endTime\": \"2021-01-01T00:00:00Z\",\n \"inputTokens\": 100,\n \"outputTokens\": 100,\n \"cost\": 100,\n \"organization\": {\n \"id\": \"123\",\n \"name\": \"ACME\"\n },\n \"user\": {\n \"id\": \"123\",\n \"name\": \"John Doe\"\n },\n \"metadata\": {\n \"sessionId\": \"456\",\n \"userType\": \"admin\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.getbasalt.ai/monitor/log")
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 \"slug\": \"qa\",\n \"output\": \"Paris\",\n \"name\": \"qa-chatbot\",\n \"version\": \"1.0.0\",\n \"tag\": \"production\",\n \"input\": \"What is the capital of France?\",\n \"idealOutput\": \"Paris\",\n \"variables\": [\n {\n \"label\": \"question\",\n \"value\": \"What is the capital of France?\"\n }\n ],\n \"startTime\": \"2021-01-01T00:00:00Z\",\n \"endTime\": \"2021-01-01T00:00:00Z\",\n \"inputTokens\": 100,\n \"outputTokens\": 100,\n \"cost\": 100,\n \"organization\": {\n \"id\": \"123\",\n \"name\": \"ACME\"\n },\n \"user\": {\n \"id\": \"123\",\n \"name\": \"John Doe\"\n },\n \"metadata\": {\n \"sessionId\": \"456\",\n \"userType\": \"admin\"\n }\n}"
response = http.request(request)
puts response.read_body{
"trace": {
"id": "123"
},
"log": {
"id": "123"
},
"warning": "No prompt found with the given slug or no production version found or no prompt found with the given version or tag (production version also missing)"
}{
"error": "<string>"
}