Skip to main content
POST
/
monitor
/
trace
Create a trace
curl --request POST \
  --url https://api.getbasalt.ai/monitor/trace \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "name": "qa-chatbot",
  "featureSlug": "qa-chatbot",
  "chainSlug": "qa-chatbot",
  "input": "What is the capital of France?",
  "output": "Paris",
  "idealOutput": "<string>",
  "metadata": {
    "sessionId": "456",
    "userType": "admin"
  },
  "organization": {
    "id": "123",
    "name": "ACME"
  },
  "user": {
    "id": "123",
    "name": "John Doe"
  },
  "startTime": "2021-01-01T00:00:00Z",
  "endTime": "2021-01-01T00:00:00Z",
  "experiment": {
    "id": "123"
  },
  "logs": [
    {
      "id": "123",
      "type": "generation",
      "name": "qa-chatbot",
      "startTime": "2021-01-01T00:00:00Z",
      "endTime": "2021-01-01T00:00:00Z",
      "metadata": {
        "sessionId": "456",
        "userType": "admin"
      }
    }
  ],
  "evaluators": [
    {
      "slug": "hallucination"
    }
  ],
  "evaluationConfig": {
    "sampleRate": 0.5
  }
}'
{
  "trace": {
    "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
name
string | null

The name of the trace

Example:

"qa-chatbot"

featureSlug
string

The slug of the feature in Basalt.

Example:

"qa-chatbot"

chainSlug
string
deprecated

Deprecated: Use featureSlug instead. The slug of the feature in Basalt.

Example:

"qa-chatbot"

input
string | null

The input of the trace

Example:

"What is the capital of France?"

output
string | null

The output of the trace

Example:

"Paris"

idealOutput
string | null

The ideal output of the trace. Used in some evaluators.

metadata
object | null

Additional metadata to be associated with the trace.

Example:
{ "sessionId": "456", "userType": "admin" }
organization
object | null

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

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

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

Example:
{ "id": "123", "name": "John Doe" }
startTime

The start time of the trace

Example:

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

endTime

The end time of the trace

Example:

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

experiment
object | null

The experiment to append the trace to. You must create an experiment before.

Example:
{ "id": "123" }
logs
object[] | null

The logs to append to the trace.

Example:
[
{
"id": "123",
"type": "generation",
"name": "qa-chatbot",
"startTime": "2021-01-01T00:00:00Z",
"endTime": "2021-01-01T00:00:00Z",
"metadata": { "sessionId": "456", "userType": "admin" }
}
]
evaluators
object[] | null

The evaluators used to generate the trace.

Example:
[{ "slug": "hallucination" }]
evaluationConfig
object | null

The evaluation configuration of the trace.

Example:
{ "sampleRate": 0.5 }

Response

The trace created

trace
object
required

The trace created

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