Trainings
The five steps of a training, what each one needs next, and how lists come in pages.
A training is a dataset being prepared (steps 1 to 3) or, once it runs, a model (steps 4 and 5). Each one carries step
(1 to 5) and next_action, the same two fields the dashboard, the CLI and the assistants read, so any of them can drive
the flow.
{
"kind": "dataset",
"id": "0199f0c4-…",
"name": "support tickets",
"status": "ready",
"step": 2,
"next_action": "structure"
}Next actions
next_action | What it means | What to call |
|---|---|---|
upload_files | Files still to send. | PUT each file to its URL, then POST /v1/datasets/{id}/files/{file}/complete |
wait | We are working on it. | Read it again in a few seconds: GET /v1/datasets/{id} or GET /v1/models/{id} |
start_over | The data could not be read. | Create a new dataset with the files fixed |
structure | The data is read and masked. | POST /v1/datasets/{id}/structure, or POST /v1/datasets/{id}/suggest to see decisions first |
pick_decisions | The agent suggested decisions. | POST /v1/datasets/{id}/structure with { "questions": [...] } |
label_examples | The held-out examples need answers. | GET /v1/datasets/{id}/labels/next, then POST /v1/datasets/{id}/labels/{task} with { "label": "..." } |
start_training | Ready to train. | GET /v1/encoders, then POST /v1/datasets/{id}/models with { "encoder": "ts-moberto-150m" } (1 credit). Add "options": { "keep_if_loses": true } only if the user chose to keep the model even if it does not beat Jev (no refund then) |
retry | The training failed; the credit came back. | POST /v1/datasets/{dataset}/models again |
download | The model is ready. | GET /v1/models/{id}/download returns a link valid for 15 minutes, until files_expire_at |
none | The model's files went (expired, refunded or on your Hugging Face). | Nothing: the record and the audit stay (Retention) |
expired | The dataset's data expired. | Upload it again to train (Retention) |
Starting a training without credits answers 402 with "error": "no_credits".
When a training fails
Something on our side can fail during a training: the GPU, our storage, the trainer. We try again on our own (up to 3
attempts) and the run page says so in its activity. If it still fails, the training stops, the credit comes back to your
balance at once, and the model carries an error_code with what happened, in words the page shows:
error_code | What it means |
|---|---|
gpu_provider | Our GPU provider refused our access. The problem is on our side, not in your data. |
gpu_unavailable | We could not get a GPU in good shape, even after trying other machines. |
storage | Our file storage did not answer while the training was being prepared. |
trainer | The training hit an error on the GPU. |
data | We could not prepare the dataset for training. Reviewing the data step may help. |
internal | Something else failed on our side. |
None of them costs you a credit. Start the training again whenever you want (next_action is retry).
Emails
We email the account owner when a training needs them or ends, once per event, in the dataset's language:
- the agent's proposal is ready to review, or the held-out examples are waiting for labels;
- the model beat Jev, with both scores;
- the model did not beat Jev, or the training failed, and the credit came back;
- the model did not beat Jev and you had chosen to keep it: it is delivered, with no refund.
Verdict
A finished model carries verdict: beats (it beat Jev, delivered), refund (it did not, the credit came back and the
files were deleted) or kept (it did not, and you had chosen to keep it when starting: delivered like beats, files
until files_expire_at, no refund). See Refund calculation. A model
started with that choice has "keep_if_loses": true in its options.
Publish a model
From a finished model's page, Publish opens its page to everyone and puts the model in a public Hugging Face repository, in your account or in an organization where you can create repositories (grant it when you connect Hugging Face; to add one later, see Settings → Security). Type the confirmation word: the page, the training data and the test examples become public.
The public page lives at typestrict.ai/models/<id>; Share opens your device's share sheet (or copies the link)
with the model's name, what it decides and its banner. A link to a training (/trainings/runs/<id>) opened by someone
who is not signed in takes them to that page.
The repository gets the package (decision_ai.json, tokenizer.json, onnx/model_8bit.onnx), the test examples the
playground reads (holdout.json; up to 100 per question for a model of several questions) and a card in the typestrict
identity: the banner, the result against Jev question by question with the gain and its 95% interval, the questions and
their options, how to run it and where the data came from. List the data's sources and licenses in the publish window:
they go into the card as you write them, and CC BY licenses ask for that attribution. The card's figures come from
GET /v1/models/{id}/figures/{banner.png|results.png}.
The repository is named after the model (TS-PRGuard, -v2 from the second version on); publishing again uploads to
the same one. Once published, the model's files leave our storage and the repository is where it is downloaded from
(Retention). Making the page private again leaves the repository as it is.
Pages
Lists come newest first, a page at a time:
{ "data": [ ... ], "next": "6b3f…" }Pass limit (1 to 100, 25 by default) and, for the following page, cursor with the last next. A page stays the same
while new trainings arrive at the top. GET /v1/models and GET /v1/datasets also take status (done for finished
models, ready for structured datasets).
curl "https://api.typestrict.ai/v1/models?status=done&limit=10" \
-H "Authorization: Bearer $TYPESTRICT_API_KEY"