Open as Markdown

Data format

This data is for custom projects: datasets, evaluations and training calls. A continuous model needs none: it learns from its decisions.

Decision row

A row is a TypeSafe decision request with labels:

{
  "id": "t-1",
  "state": {"body": "I was billed two times for my March invoice."},
  "questions": {
    "department": {"type": "choice", "instructions": "Which team must handle `body`?",
                   "criteria": {"billing": "Payments, refunds", "technical": "Bugs, outages"}},
    "urgent": {"type": "noul", "instructions": "Does the customer need an answer today?"}
  },
  "labels": {"department": "billing", "urgent": true},
  "weight": 1.0
}
FieldTypeRequiredDescription
statestring, object or arrayyesThe input. All questions use the same state.
questionsobjectyesOne or more questions, by name.
labelsobjectnoThe correct answer for each question name. Training skips questions without a label. An evaluation scores the labeled questions of a row, and answers every question of a row without labels.
idstringnoYour row id.
weightnumber ≥ 0noThe weight of the row in training. Default: 1.

Question types

typecriteriaOption ids
noul (yes/no)optional: {"true": ..., "false": ...}"false", "true"
choice{"option_id": description or null}, 1 to 255 optionsthe keys, in order
scorea list of level descriptions of one scale, lowest level first, 2 to 10 levels (not a list of things to check)"0" to "n-1"

Each question can also have instructions (text or JSON). Labels, training targets and answers use the option ids. Some base models have stricter rules (see Base models).

Labels

A hard label gives one correct option. A soft label gives a probability for each option.

TypeHard labelSoft label
noultrue or "true" (false or "false")0.8 (probability of yes) or {"true": 0.8, "false": 0.2}
choice"billing"{"billing": 0.7, "technical": 0.3}
score2 (level index) or "2" (its option id)[0.1, 0.6, 0.3] or {"0": 0.1, "1": 0.6, "2": 0.3}

A soft label must include all options. The values must be 0 or more, and their sum must be 1 (± 0.02).

Files

endor.data.load_rows(path) reads .jsonl (one row on each line) or .json (an array). It also accepts rows with one question. The SDK names that question decision:

{"state": "I was charged twice", "question": {"type": "noul", "instructions": "Is this a billing issue?"}, "label": true}
import endor

client = endor.EndorClient()
info = client.datasets.upload("train", endor.data.load_rows("train.jsonl"))
print(info.n_rows, info.question_types)

The upload checks all rows first. If a row is not valid, the upload fails with 422 invalid_row, param gives the row (rows[12]), and the message gives the field and what fits there, for example rows[12]: labels.anger: '5' is not an option of this question (options: 0, 1, 2) or rows[3]: questions.urgent: a question needs a type: noul, choice or score. A body that isn't valid JSON fails with 400 invalid_input. Endor keeps no rows from a failed upload. Rows sent with an evaluation are checked the same way.

Datum

Training calls use datums. A datum is one state, one question, one target and a weight:

{"state": "I was charged twice",
 "question": {"type": "noul", "instructions": "Is this a billing issue?"},
 "target": {"label": "true"},
 "weight": 1.0}

The target is {"label": "<option id>"} or {"probs": {"<option id>": p}}. It is not the same shape as a row's label: a soft label is the probability map itself, and a soft target puts that map in probs.

A row's labels valueA datum's target
Hard"billing"{"label": "billing"}
Soft{"billing": 0.7, "technical": 0.3}{"probs": {"billing": 0.7, "technical": 0.3}}

endor.data.rows_to_datums(rows) makes one datum from each labeled question, with the target made from the label.

Limits

ItemMaximum
Rows in a dataset50,000
Datasets in an organization1,000
Dataset storage in an organization200 GB
Questions in a decision request64
Options in a choice255, or less on some base models
Levels in a score10 (minimum 2)
Datums in a training call1,024 (the SDK splits larger batches)
Request body64 MB for a dataset upload, 32 MB for an evaluation or a training call (gzip accepted)