Skip to main content
A base model does well when the question is clear. To do better on your own traffic, give it examples whose answers you know. This page takes the quickstart’s team question through five steps with the Python and TypeScript clients. The TypeScript client has the same calls under camelCase names, such as fineTuning. Its datasets.create takes the file’s text rather than its path, and families.create takes one object with the API’s field names (Python and TypeScript). Each step’s guide shows the HTTP request.

1. Build a dataset

Each row is a decide request, its context and decisions, plus targets. targets is the answer you expect, as a probability for every outcome. Write one row per line of a JSONL file:
tickets.jsonl
A real dataset has many more rows. It needs at least two different contexts, so that some can be held out. Word each decision exactly as your application asks it. Some contexts are held out to measure models, and never train them (choose the evaluation set).
No labels yet? Teacher models can label real queries for you to review (label with teacher models). Build a dataset covers the format, rewards and the split.

2. Measure the base model

metrics has accuracy, log loss and calibration error on the held-out rows. An evaluation is charged as decisions. Compare models covers several models at once, and what each field of metrics means. If the model picks one outcome too often, try weighting the outcomes before you train.

3. Try clearer wording

The free linter checks how a decision is asked, without running a model:
Change the question or the outcome descriptions where it points, measure again as in step 2, and keep the wording that does better (write good decisions).

4. Train a model of your own

A fine-tune trains a model on your rows and starts a family. A family is a named line of models, such as support-router. The new model joins the family only if it passes its gate. The gate checks for regressions against the model it started from, on the held-out rows. A family needs enough training rows, and enough held-out decisions for the gate to judge (what the start checks).
The estimate is the exact training fee. A fine-tune is charged when it succeeds, even if its model fails the quality check; a run that fails or is cancelled is free (pricing). Calls to support-router get the family’s latest model that passed its gate. Fine-tune a model shows how to read the gate.

5. Keep improving

Add newly labelled rows to the dataset as its next version, then continue the family. The next model trains from the latest one. It joins only if it passes its gate too.
To go back, roll the family back to an earlier model. This discards the newer ones:
Switch, roll back and delete covers switching models on and off, and deleting them. Keep a model warm covers keeping one loaded between calls.