Skip to main content

Dataset versions

On this page you learn what a dataset version is, when one is made, how to read the items it froze, how to see what changed since, and what happens to a version when an item is removed for good. Text chats and embedding triplets work the same way.

A dataset is live: every edit is saved at once. A version is a frozen, read-only record of which items the dataset held, and at which revision of each, at one moment. Opening a version never changes it, and it never changes the live dataset.

When a version is made​

  • A run starts. The run freezes the items it selected, each on its training or validation side, as the dataset's next version, and trains on that copy. A later run reuses the newest version when nothing changed since it, so two runs over the same data share one version. See Training runs.
  • You save one. Save version freezes the dataset as it is now, read-only, with the items marked excluded from training kept in it and marked. A name is optional. If nothing changed since the newest version, that version is reused and nothing is copied; its name is not changed.

Nothing else makes a version. A version is numbered 1, 2, 3 and so on in the dataset, and the numbers are never reused.

curl -X POST "https://reopenly.com/api/v1/projects/{owner_slug}/{project_number}/datasets/{dataset_number}/versions" \
-H "Authorization: Bearer $REOPENLY_API_KEY" \
-H "Content-Type: application/json" \
--data '{"name": "Before the refund policy change"}'

A new version answers 201. A reused one answers 200 with "reused": true. The name is stripped, may be blank (stored as no name) and is at most 120 characters. Saving needs the data:write scope. An archived dataset answers 409 dataset_archived, and a save that cannot get the dataset's lock in time answers 409 version_not_ready: send it again.

A version reads back as:

FieldMeaning
number, nameThe version's number and its optional name
originrun when a run made it, saved when you did
created_at, created_byWhen, and who: a person or an API key (a key shows its label)
item_count, excluded_countItems in the version, and how many of them were marked excluded when it was frozen
run_numberThe run that made it, or null for a saved version
reused_by_run_numbersThe numbers of the other runs that trained on it
runsEvery run that trained on it, the one that made it included, oldest first: each run's number and training_method (sft or dpo)
membership_recordedfalse for a version made before items were recorded; see Older versions

GET .../datasets/{dataset_number}/versions lists the dataset's versions, newest first, in pages (limit 1 to 100, default 20, and cursor from next_cursor). GET .../versions/{version_number} reads one. A version you cannot see, or that does not exist, answers 404 not_found. Both need data:read.

The live dataset keeps changing​

After a version is made, the dataset goes on changing: items are edited, added, moved to Trash or excluded from training. A run that has started keeps training on its frozen copy; a change reaches the next run. In the app, the Data page says how many changes there are since the newest version, for example 37 changes since Version 4, and opens the list.

Read a version's items​

POST .../datasets/{dataset_number}/versions/{version_number}/items/search
GET .../datasets/{dataset_number}/versions/{version_number}/items/{item_number}

The search lists the version's items by item number, in pages. Send filters in a JSON body; all are optional:

{"since": "edited", "side": "train", "limit": 50}
  • side is train or validation: the side a run gave the item. A saved version has no side, and a row shows null.
  • changed_only: true keeps the items that changed since the version.
  • since keeps the items in one state after the version: edited, trashed, excluded or purged. It wins over changed_only.
  • q keeps the items whose title (a chat's name, a triplet's anchor) contains the text, ignoring case; a whole number also matches the item number. It is at most 200 characters after trimming, and an empty string is no search. Send it in the body, never the URL. A version that does not record which items it holds answers 409 version_search_unavailable.

Each row has the item's number, kind, revision (the frozen one), title, message_count for a chat, source, side, excluded (when it was frozen), and what happened to it since: since is unchanged, edited, trashed, excluded or purged, with since_at, the time it happened. When an item matches more than one, the first of purged, trashed, edited, excluded is the one shown, so an item edited and then moved to Trash reads as trashed. A row also has token_counts, the frozen revision's length in tokens (the fields of the item list's rows, with characters always null); its numbers are null when that revision was not counted, for example an item edited after the version, and the whole field is null for a purged item. Send run_number to read the rows as that run trained on them (the run page's dataset table does): limit is then the sequence length the run froze, so cut says whether that run shortened the item, and a chat's trained_tokens is given only when it holds at that length (when the run's length is the default, or the chat fits both), else null. The answer then carries max_seq_length, the length used (null without run_number, or for a run that recorded none, whose rows use the default). A run that did not freeze this version answers 404 training_job_not_found. The answer carries total_count and next_cursor. A cursor belongs to its version: another version's cursor answers 400 invalid_cursor.

The one-item read returns the item as it was frozen: a chat's messages, or a triplet's anchor, positive, negative and metadata, with revision, content_sha256, side, since, and live_revision, the revision the live item is at now (null when the item was purged). A chat that has a rejected reply keeps it in the version, as rejected_reply. Name, description, category, tags and dates are the item's current ones; they are null for a purged item. An item the version does not hold answers 404 not_found.

What changed since a version​

GET .../datasets/{dataset_number}/versions/{version_number}/changes

returns counts and a short sample:

{
"version_number": 4,
"total": 37,
"added": 20,
"edited": 9,
"trashed": 4,
"purged": 1,
"excluded": 3,
"sample": []
}

added counts live items the version does not hold. The other four count items it holds, each once, by the same first-match order as above, so total is the sum of the five and equals what the item search finds with changed_only plus added. sample lists up to 20 of the most recent changes, each with the item's number, kind and title, a change of added, edited, trashed, purged or excluded, and the time at. It says that an item changed, not what changed in it. To see what an edit changed, read the item's history and change view.

This is not an activity log: an item edited twice counts once, as it is now.

Purged items​

Moving an item to Trash does not touch any version: a trashed item can still be restored, and a version that holds it still shows it. Emptying Trash, or the end of the Trash period, removes the item for good. That is the one thing that changes what a version holds:

  • The version keeps a numbered row for the item, marked purged with purged_at, so its counts, the item's number and a run's training and validation split stay the same.
  • The item's text is removed from the version. A purged item reads with no title, no message count and no content: a chat's messages is [] and a triplet's anchor, positive and negative are null. This holds for every key and every person.
  • So a version that held a purged item is no longer an exact copy of the data it froze.
  • A purged item counts as purged in the changes, not as trashed: a trashed item can be restored, a purged one cannot.
  • A model that already trained on the text is not changed. To train without it, start a new run.

The text of a purged item may remain in files a run wrote when it started and in its stored snapshot; the reads above withhold it, but those files are not rewritten.

Older versions​

A version made before the dataset recorded its items has membership_recorded: false. Its items are read from the file the run trained on, in that file's order, and a row's number is null when the item no longer exists. The side, changed_only and since filters are not applied to it, a row's since is null (not recorded, never unchanged), and its changes answer null counts and no sample. The version's own item_count is its total. The Data page says so for such a version.

Reference​

GET /api/v1/projects/{owner_slug}/{project_number}/datasets/{dataset_number}/versions
POST /api/v1/projects/{owner_slug}/{project_number}/datasets/{dataset_number}/versions
GET /api/v1/projects/{owner_slug}/{project_number}/datasets/{dataset_number}/versions/{version_number}
GET /api/v1/projects/{owner_slug}/{project_number}/datasets/{dataset_number}/versions/{version_number}/changes
POST /api/v1/projects/{owner_slug}/{project_number}/datasets/{dataset_number}/versions/{version_number}/items/search
GET /api/v1/projects/{owner_slug}/{project_number}/datasets/{dataset_number}/versions/{version_number}/items/{item_number}

Reads need data:read and a save needs data:write. A version number is 1 to 2,147,483,647 and an item number 1 to 9,223,372,036,854,775,807; a value outside that range answers 422. Every refusal is {"detail": {"code", "message"}}; see Errors. There is no route to delete or rename a version. A run's own frozen copy is read at the run's dataset routes.