Skip to main content
POST
/
v3
/
evals
/
datasets
/
{dataset_id}
/
items
/
from-spans
Bulk add spans to dataset
curl --request POST \
  --url https://api.example.com/v3/evals/datasets/{dataset_id}/items/from-spans \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "application_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "start_time": "2023-11-07T05:31:56Z",
  "end_time": "2023-11-07T05:31:56Z",
  "spans": [
    {
      "trace_id": "<string>",
      "span_id": "<string>"
    }
  ],
  "mapping": {
    "inputs": {
      "question": "gen_ai.request.user_message"
    },
    "expected_outputs": {
      "answer": "gen_ai.completion.content"
    },
    "metadata": {
      "trace_id": "trace.id",
      "model": "gen_ai.request.model"
    },
    "extras": {
      "context": "gen_ai.contents.context"
    }
  }
}
'
{
  "api_version": "3.0",
  "kind": "NORMAL",
  "data": {
    "items": [
      {
        "trace_id": "<string>",
        "span_id": "<string>",
        "item_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
      }
    ]
  }
}

Authorizations

Authorization
string
header
required

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

Path Parameters

dataset_id
string<uuid>
required

Dataset UUID

Body

application/json
application_id
string<uuid>
required

UUID of the GenAI application to query spans from

start_time
string<date-time>
required

Start of the time range (inclusive, UTC). Used to bound the ClickHouse partition scan to the relevant monthly partitions. Should match the time range of the spans being exported.

end_time
string<date-time>
required

End of the time range (exclusive, UTC). Used to bound the ClickHouse partition scan to the relevant monthly partitions. Should match the time range of the spans being exported.

spans
object[]
required

Explicit span references to resolve and write as dataset items. Maximum 200 per request.

Required array length: 1 - 200 elements
mapping
object
required

Maps dataset field keys to source span attribute paths. Each bucket contains { field_key: source_attr_path } pairs where source_attr_path is an OTel-convention key from the span's attributes.

Response

Dataset items created from spans

Response object for standard API responses.

api_version
enum<string>
default:3.0

API version.

Available options:
2.0,
3.0
kind
enum<string>
default:NORMAL

Type of response, indicating a normal response.

Available options:
NORMAL
data
object