Skip to main content
POST
/
monitor
/
log
Monitor a prompt output
curl --request POST \
  --url https://api.getbasalt.ai/monitor/log \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "name": "qa-chatbot",
  "slug": "qa",
  "version": "1.0.0",
  "tag": "production",
  "input": "What is the capital of France?",
  "output": "Paris",
  "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"
  }
}'
{
  "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)"
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
slug
string
required

The slug of the prompt

Example:

"qa"

output
string
required

The output of the prompt.

Example:

"Paris"

name
string | null

The name of the trace

Example:

"qa-chatbot"

version
string | null

The version of the prompt

Example:

"1.0.0"

tag
string | null

The tag of the prompt

Example:

"production"

input
string | null

The input of the prompt.

Example:

"What is the capital of France?"

idealOutput
string | null

The ideal output of the prompt.

Example:

"Paris"

variables
object[] | null

Variables used in the prompt.

Example:
[
{
"label": "question",
"value": "What is the capital of France?"
}
]
startTime

The start time of the prompt.

Example:

"2021-01-01T00:00:00Z"

endTime

The end time of the prompt.

Example:

"2021-01-01T00:00:00Z"

inputTokens
number | null

The number of input tokens. If not provided, it will be computed based on the input

Example:

100

outputTokens
number | null

The number of output tokens. If not provided, it will be computed based on the output

Example:

100

cost
number | null

The cost of the prompt. If not provided, it will be computed based on the input and output tokens

Example:

100

organization
object | null

The organization related to the prompt. Used to identify the organization of the user that triggered the prompt.

Example:
{ "id": "123", "name": "ACME" }
user
object | null

The user related to the prompt. Used to identify the user that triggered the prompt.

Example:
{ "id": "123", "name": "John Doe" }
metadata
object | null

Additional metadata to be associated with the prompt.

Example:
{ "sessionId": "456", "userType": "admin" }

Response

The id of the created trace and log

trace
object
required

The ID of the trace

Example:
{ "id": "123" }
log
object
required

The ID of the log

Example:
{ "id": "123" }
warning
string | null

The warning message

Example:

"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)"

I