@toloka-platform/sdk 0.19.0 → 0.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/docs/datasets.md DELETED
@@ -1,213 +0,0 @@
1
- # Datasets
2
-
3
- How data enters a pipeline project, which parts of a dataset the platform lets you change, and what the preflight checks catch before anything is written.
4
-
5
- ## The model
6
-
7
- A dataset is rows (items) and typed columns (fields). Each field carries a name and a JSON Schema. Each row is an item.
8
-
9
- A pipeline binds exactly one source dataset. Items flow in through the fields the pipeline reads, and every output field is written back to the same dataset as a column. The dataset is both the input and the result.
10
-
11
- ## Declare columns in source
12
-
13
- The dataset is named in `definePipeline`, and its columns are the fields the pipeline reads and writes:
14
-
15
- ```ts
16
- // pipelines/face-image-collection/pipeline.ts
17
- import { connect, definePipeline } from "@toloka-platform/sdk";
18
- import { imageUrl, draftFaces, faces } from "./fields";
19
-
20
- export const pipeline = definePipeline({
21
- dataset: "face-images",
22
- fields: [imageUrl, draftFaces, faces],
23
- nodes: [collection, annotateFaces, orderFaces],
24
- connections: [
25
- connect(collection.started, annotateFaces.input),
26
- connect(annotateFaces.output, orderFaces.input),
27
- connect(orderFaces.output, collection.completed),
28
- ],
29
- });
30
- ```
31
-
32
- Each field is declared with a name and a JSON Schema by calling `field`:
33
-
34
- ```ts
35
- // pipelines/face-image-collection/fields.ts
36
- import { field } from "@toloka-platform/sdk";
37
-
38
- export const imageUrl = field("image_url", { type: "string", format: "uri" });
39
- export const draftFaces = field("draft_faces", {
40
- type: "array",
41
- items: { type: "object" /* ... */ },
42
- });
43
- export const faces = field("faces", { type: "array", items: { type: "object" /* ... */ } });
44
- ```
45
-
46
- The `dataset` string and `fields` array are the only dataset-related declarations in source. There is no dataset ID, no dataset schema file, and no items file. The dataset name resolves to a platform ID at apply time, and that binding is recorded in `toloka.json`.
47
-
48
- `toloka plan` compares the declaration against live state and reports what is missing:
49
-
50
- ```
51
- Plan: 4 changes
52
- + Dataset added: face-images
53
- + Dataset field added: face-images.image_url
54
- + Dataset field added: face-images.draft_faces
55
- + Dataset field added: face-images.faces
56
- ```
57
-
58
- `toloka apply` creates the dataset and each missing column. It never alters an existing column and never deletes one.
59
-
60
- ## Immutability
61
-
62
- **A dataset field can be added. It can never be altered or removed after creation.** One exception: `dataset split` turning an ordinary column into a split column replaces its JSON Schema with an enum of the part names, which every value the column holds already matches.
63
-
64
- The platform API exposes exactly two field operations:
65
-
66
- | Method | Path | Operation |
67
- | ------ | ------------------------------------------ | -------------- |
68
- | `GET` | `/api/v2-beta/datasets/{datasetId}/fields` | List fields |
69
- | `POST` | `/api/v2-beta/datasets/{datasetId}/fields` | Create a field |
70
-
71
- There is no `PATCH` or `DELETE` for fields. The `POST` endpoint's description states the rule: "Create a field in a dataset. Field names and JSON schemas are immutable after creation."
72
-
73
- The OpenAPI document defines no `DELETE` for the dataset itself either, and no CLI command removes one.
74
-
75
- When source declares a schema that disagrees with a stored field, `plan` reports the conflict and `apply` refuses:
76
-
77
- ```
78
- Dataset field schemas conflict with source: face-images.faces. Existing fields are never rewritten.
79
- ```
80
-
81
- Two legitimate ways forward:
82
-
83
- 1. **Declare a new column.** Pick a name the dataset does not have yet with the schema you want. The old column stays, holding the data it already holds.
84
- 2. **Bind a new dataset.** Change the `dataset` string in `definePipeline`. `apply` creates the new dataset with exactly the declared columns.
85
-
86
- There is no flag to force an in-place change. The schema you declare on first apply is the one you live with.
87
-
88
- ## Catalog vs rows
89
-
90
- `toloka dataset list` and `toloka dataset fields` talk to the catalog: names, ids, and inferred column schemas. They do not write a data file. Rows stay on the platform until you pull them.
91
-
92
- ```sh
93
- toloka dataset list
94
- toloka dataset fields face-images
95
- toloka dataset load face-images --out data/face_images.jsonl
96
- toloka dataset load face-images --fields image_url,faces --limit 100 --out data/face_images.sample.jsonl
97
- toloka dataset upload face-images data/face_images.jsonl
98
- toloka dataset fields add face-images --all
99
- ```
100
-
101
- `load` starts a platform export, waits (default 60s), downloads a JSON array, and writes JSONL to `--out`: one object per row with every visible field, or only the fields `--fields` names. `uploaded` holds each uploaded row whole, as one value. `--limit` slices after that download. `--timeout` raises the wait. Failed downloads leave `--out` untouched.
102
-
103
- A dataset that no pipeline declares keeps each uploaded row whole in its `uploaded` field, so the rows' own fields are not dataset fields yet: `--filter`, `--balance-by` and `dataset split --column` need dataset fields. `toloka dataset fields add <dataset> <field>…` adds top-level fields of the uploaded rows as dataset fields, `--all` every one, and copies their values from the uploaded rows and from every later upload. A dataset field name takes lowercase letters, numbers and underscores, starts with a letter, ends with a letter or number and has at most 128 characters; `--all` skips fields whose names break the rule and says which. A slice or a split waits while a field it reads is still being copied.
104
-
105
- ## Load rows
106
-
107
- Rows are data, not source. They never belong in pipeline source or `toloka.json`.
108
-
109
- ```sh
110
- toloka dataset upload face-images data/face_images.jsonl
111
- ```
112
-
113
- The command takes two positional arguments and has no flags:
114
-
115
- | Argument | Description |
116
- | -------- | ------------------------------------------ |
117
- | `<name>` | Dataset name or id |
118
- | `<file>` | `.json`, `.jsonl`, or `.csv` file to append |
119
-
120
- The CLI infers the format from the filename extension and uploads the original bytes without conversion:
121
-
122
- - `.json` contains an array of row objects.
123
- - `.jsonl` contains one row object per non-empty line and is validated locally before upload.
124
- - `.csv` uses its header row for field names; every value is ingested as a string.
125
-
126
- Upload is additive: it appends items and never rewrites existing ones. If the dataset does not exist yet and a pipeline in source declares it, `dataset upload` creates the dataset with the declared columns automatically. If no pipeline declares the dataset, upload stops and asks you to bind a pipeline to it in source so its columns are known, or to upload to an existing dataset. Duplicate live names must be addressed by id.
127
-
128
- ## Inspect columns
129
-
130
- ```sh
131
- toloka dataset fields face-images
132
- ```
133
-
134
- Prints TypeScript `field(...)` declarations inferred from the first successful upload. The output is ready to paste into a `fields.ts` file:
135
-
136
- ```
137
- import { field } from '@toloka-platform/sdk';
138
-
139
- export const imageUrl = field(
140
- 'image_url',
141
- { type: 'string', format: 'uri' }
142
- );
143
-
144
- export const faces = field(
145
- 'faces',
146
- { type: 'array', items: { type: 'object' /* ... */ } }
147
- );
148
- ```
149
-
150
- Inference runs once, after the first upload attaches rows to the dataset. When no upload has completed, the command prints "Dataset X has no inferred fields yet." Upload a representative file first.
151
-
152
- ## Split a dataset and freeze a slice
153
-
154
- A split column puts each row in a part such as train, validate or test. A slice freezes a set of rows, and it always freezes the split columns.
155
-
156
- ```sh
157
- toloka dataset split banking77 --ratios 80/10/10 --balance-by intent
158
- toloka dataset slice create banking77 --name "intent eval" --freeze text,intent
159
- ```
160
-
161
- `dataset split` fills a split column, `split` unless `--column` names another: every row without a part gets one, sampled by share. Each part has roles. Trainings learn on `train` parts and validate on `validate` parts; `test` parts are held out: no training learns on a row that any split column puts in a test part, and none validates on one unless it sits in a validate + test part of the training's own split column. A part with no roles is for anything else. A part can both validate and test, the usual split when data is scarce (`--ratios 80/0/20 --validate-on-test`); its test score is then not fully held out. A train part has no other role. `--ratios` covers `train`, `validate` and `test`; `--parts train:70,calibration=none:10,validate:10,test:10` names other parts. `toloka dataset columns banking77` shows the split columns with their parts and roles.
162
-
163
- A split only fills empty cells. After an upload, run it again: the new rows join the parts so that the column keeps its shares, balanced by the same column with the same seed, and every row that already had a part keeps it, so no test row moves into training. Rows without a part are never trained on. To adopt a column that already names each row's part, such as a top-level Hugging Face `split` column, pass its name: `toloka dataset split banking77 --column split`. When `split` is a field of the uploaded rows rather than a dataset field, add it first with `toloka dataset fields add banking77 split`; `dataset split` refuses a field of the uploaded rows that is not a dataset field, instead of sampling a new column under that name. The seed ranks rows by their position in the dataset, so the same file uploaded to two datasets splits the same way with the same seed. Roles follow the values `train`, `validation`, `validate`, `val`, `dev` and `test`; `--parts train,dev=validate,test` maps other names.
164
-
165
- A slice takes the rows that match its filters (`--filter intent=card_arrival`, repeated for more fields), or every row, at a cutoff. Its id (`dsl.…`) always selects the same rows, and it reads its frozen columns as they were just before the cutoff, so those values never change either. By default every column is frozen; `--freeze text,intent` picks the columns instead, split columns are always added, and the others read their latest values. Rows uploaded later are never in a slice, and a slice cannot be taken while an upload to the dataset is still running, a split column is still filling, or a column it freezes is still being copied from the uploaded rows. Reading through a slice, the rows and its frozen columns, split parts included, are as of the slice cutoff; extra filters you add, such as field values or excluded parts, match the latest values. `--from <slice-id>` takes a slice again at a new cutoff: rows added since join and rows that no longer match drop out.
166
-
167
- A Training learns on a slice that freezes a split column: pass `--slice <id>` (`sliceId` in the API), or `--dataset <name>` to split the dataset and freeze a slice named after the Training in one step. It learns on the train parts and validates on the validate parts of that column; `--split-column` (`splitFieldId`) picks the column when the slice freezes several, and `--parts` (`trainParts`) picks among the train parts.
168
-
169
- From the SDK:
170
-
171
- ```ts
172
- const column = await client.datasets.split({
173
- datasetId,
174
- parts: [
175
- { name: "train", roles: ["train"], share: 0.7 },
176
- { name: "calibration", roles: [], share: 0.1 },
177
- { name: "validate", roles: ["validate"], share: 0.1 },
178
- { name: "test", roles: ["test"], share: 0.1 },
179
- ],
180
- balanceBy: "intent",
181
- });
182
- const filled = await client.waitFor({ type: "datasetSplit", datasetId, column: column.name });
183
- const slice = await client.datasets.createSlice({ datasetId, name: "intent eval", frozenColumns: ["text", "intent"] });
184
- const ready = await client.waitFor({ type: "datasetSlice", sliceId: slice.id });
185
- ```
186
-
187
- `split` returns the column, a dataset field whose `split` has the parts, the recipe and a `status` of `filling`, `ready` or `failed`. `waitFor({ type: "datasetSplit", datasetId, column })` resolves once the column stops filling, with `split.lastFill` counting the rows it placed, the rows that already had a part, and the rows per part. Pass `slice: sliceId` or an `itemFilter` to place only those rows. To adopt a column, pass its name and parts without shares: `{ datasetId, column: "split", parts: [{ name: "train", roles: ["train"] }, { name: "validation", roles: ["validate"] }, { name: "test", roles: ["test"] }] }`, or omit `parts` to infer the roles from the values. An adoption places no rows, so it refuses `seed`, `balanceBy`, `slice` and `itemFilter`. To take a slice again, pass `{ datasetId, fromSlice: sliceId }` to `createSlice`.
188
-
189
- To add fields of the uploaded rows as dataset fields from code, and wait until their values are copied:
190
-
191
- ```ts
192
- const created = await client.datasets.createFieldsFromUploadedRows({ datasetId, names: ["intent", "split"] });
193
- const fields = await client.waitFor({ type: "datasetFields", datasetId, names: ["intent", "split"] });
194
- ```
195
-
196
- `createFieldsFromUploadedRows` adds a dataset field for each named top-level field of the uploaded rows, with the schema inferred from them, and returns the new fields, each with a `copy` operation in `operations` while the values are copied in the background. `waitFor({ type: "datasetFields", datasetId, names })` polls the dataset's fields until none of the named fields, or none at all when `names` is omitted, has a blocking operation (`copy` or `split_fill`), and resolves with every field. Like the other waits, it gives up after 60 seconds unless `timeoutMs` says otherwise and throws a `PotatoApiError` with code `wait_timeout`; the copy keeps running. `split` and `createSlice` are refused with a conflict (HTTP 409) while a field they read is still being copied.
197
-
198
- Pipeline runs accept `slice: { sliceId }`, `parts: { fieldId, names: ["test"] }` and `excludeParts: [{ fieldId, names }]` in their row filter. `parts` reads the column as it was at the slice's cutoff when the same filter selects a slice that freezes it. A run that selects through a slice reads the slice's frozen columns as they were at the cutoff and every other column as usual.
199
-
200
- ## What plan refuses
201
-
202
- `plan` is read-only and reports everything `apply` will not do. Two dataset-related refusals are safety properties, not obstacles:
203
-
204
- | Refusal message | Why it fires |
205
- | ----------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
206
- | `Refusing to delete datasets absent from source: <names>. Dataset items are never deleted.` | A dataset tracked in `toloka.json` is named by no pipeline in source. Deleting data must never be a side effect of editing a file. |
207
- | `Dataset field schemas conflict with source: <dataset>.<field>. Existing fields are never rewritten.` | A required field exists with a different JSON Schema, and fields are immutable after creation. |
208
-
209
- To fix a schema conflict, either declare a new column name or bind the pipeline to a new dataset (see [Immutability](#immutability)).
210
-
211
- ## See also
212
-
213
- [CLI reference](./cli.md) · [Authoring pipelines](./authoring.md) · [Troubleshooting](./troubleshooting.md)
@@ -1,147 +0,0 @@
1
- # Getting started
2
-
3
- Install the SDK, sign in, and get a pipeline project reconciling from source in one sitting.
4
-
5
- ## Install
6
-
7
- Install the CLI, then add the SDK for pipeline authoring:
8
-
9
- ```sh
10
- curl -fsSL https://platform.toloka.ai/cli/install.sh | sh
11
- bun add @toloka-platform/sdk@latest
12
- toloka --version
13
- ```
14
-
15
- **Bun is the recommended runtime and package manager for SDK development.** In an existing project, run `bun i` instead of adding dependencies again. The standalone CLI includes its runtime; Training-only workflows do not need the SDK.
16
-
17
- The installer prefers compatible Bun and otherwise installs a standalone executable. Add the printed directory to `PATH` if prompted. See [CLI setup](./cli.md#install) for mode overrides and updates, and [Testing](./testing.md) for local test dependencies.
18
-
19
- ## Sign in
20
-
21
- ```sh
22
- toloka login
23
- ```
24
-
25
- `login` asks whether to sign in through the browser or with an API key, opens a page in your browser where you pick the provider, verifies access against the platform, and only then stores the session. Nothing is written when the platform does not accept the account.
26
-
27
- ```
28
- ? How do you want to sign in? Sign in with your browser
29
- Waiting for the sign-in to finish in your browser... If no browser opened, run toloka login --no-browser to get a link.
30
- ✔ Logged in to https://platform.toloka.ai as you@example.com
31
- 12 projects visible · session renews automatically until 2026-09-25T10:00:00Z, then run toloka login again
32
- ```
33
-
34
- The session renews itself for up to 14 days; after that, run `toloka login` again. Check what the CLI will use at any time:
35
-
36
- ```sh
37
- toloka whoami
38
- ```
39
-
40
- CI does not need `login`. Set `TOLOKA_API_KEY` for a long-lived API key or `TOLOKA_SCOPED_TOKEN` for an issued project-scoped token, and the stored login is ignored; an agent without a terminal can pipe a long-lived key to `toloka login --api-key-stdin`. See the precedence table in the [CLI reference](./cli.md).
41
-
42
- ## Start with an agent
43
-
44
- For a guided first run, start a fresh coding-agent session and ask it to follow the [Toloka agent bootstrap](https://platform.toloka.ai/agents/SKILL.md). It routes to the data-labeling, fine-tuning, or gisting runbook and the matching packaged skill.
45
-
46
- Initialize the current directory and install the Agent Bootstrap. No platform project needs to be selected yet.
47
-
48
- ```sh
49
- toloka init
50
- ```
51
-
52
- Open your coding agent in this directory and describe the project you want, for example:
53
-
54
- > Create a Toloka project that collects captions for images. Show me the plan before applying it.
55
-
56
- The bootstrap directs the agent to `toloka --help` and to search and install the matching bundled skill; the `toloka-build` skill then guides the agent through creating and binding the platform project, authoring the TypeScript source, validating it, showing the plan, and applying the approved changes. `project create`, `import`, or explicit project identity on `init` writes `toloka.json`.
57
-
58
- ## Manual project setup
59
-
60
- You are either adopting a project that already exists on the platform, or creating a new one. Adoption is the shorter manual path because it gives you correct source to read.
61
-
62
- ### Adopt an existing project
63
-
64
- ```sh
65
- mkdir my-project && cd my-project
66
- toloka project add cats pp.019ffa5f-29a7-74de-a76c-7ba5ceedf37f
67
- toloka import pp.019ffa5f-29a7-74de-a76c-7ba5ceedf37f
68
- toloka init
69
- ```
70
-
71
- `import` writes a `pipelines/` tree and a `toloka.json` that maps your source to live IDs. If `pipelines/` already exists, pass `--force` to replace it. Read the generated TypeScript: it is the same shape you will edit from now on.
72
-
73
- Prove the round trip before you change anything:
74
-
75
- ```sh
76
- toloka plan
77
- ```
78
-
79
- A freshly imported project prints `No changes.` If it prints anything else, stop and read it — the source and the platform disagree, and you want to know why before you edit.
80
-
81
- ### Author from scratch
82
-
83
- ```sh
84
- toloka project create cats --team-id <teamId>
85
- toloka init
86
- ```
87
-
88
- Then create `pipelines/<name>/pipeline.ts` with a default export and run `plan` / `apply`. The [authoring guide](./authoring.md) covers the graph API; [examples](../examples/) are complete projects you can copy from.
89
-
90
- ## The loop you will live in
91
-
92
- Every change follows the same steps. `toloka check` is credential-free; `validate`, `plan`, and `apply` talk to the platform. Apply reruns the complete local gate before any platform request.
93
-
94
- ```sh
95
- toloka check
96
- toloka validate
97
- toloka plan
98
- toloka apply
99
- toloka plan
100
- ```
101
-
102
- The second `plan` is the part people skip. It is how you learn that apply actually converged instead of leaving a difference behind.
103
-
104
- `plan` output names the resource and the action:
105
-
106
- ```
107
- Plan: 4 changes
108
- + Dataset added: cat-images
109
- + Dataset field added: cat-images.annotations
110
- + Pipeline added: pipelines/cat-labeling
111
- ```
112
-
113
- ## Load data
114
-
115
- Rows never live in pipeline source. Once `apply` has created the dataset, append JSONL:
116
-
117
- ```sh
118
- toloka dataset upload cat-images ./data/cat_images.jsonl
119
- ```
120
-
121
- Column schemas are immutable once created, which makes the order matter: declare the columns you want in source, apply, then upload rows that match. See [datasets](./datasets.md).
122
-
123
- ## Secrets
124
-
125
- Put secret _names_ in node settings and keep values out of source and out of shell history:
126
-
127
- ```sh
128
- toloka secret set OPENAI_API_KEY --from-env OPENAI_API_KEY
129
- ```
130
-
131
- `plan` lists every secret name a node references but the project does not have, and `apply` refuses until they exist.
132
-
133
- ## Run it
134
-
135
- ```sh
136
- toloka pipeline run cat-labeling --wait --timeout 600000
137
- ```
138
-
139
- Exit code `0` means the run reached a successful terminal state, `1` a failed one, and `2` that the timeout closed while the run was still going. Without `--wait`, `0` means only that the platform accepted the run. A queue with no one working it stays in progress indefinitely, so always bound the wait and report what you actually observed.
140
-
141
- ## Next
142
-
143
- - [Authoring](./authoring.md) — the typed graph API
144
- - [Nodes](./nodes.md) — which node to reach for, and the price range you must stay within
145
- - [CLI](./cli.md) — every command and flag
146
- - [Troubleshooting](./troubleshooting.md) — the failures you will hit
147
- - [Limitations](./limitations.md) — current constraints and `0.x` compatibility expectations
@@ -1,58 +0,0 @@
1
- # Limitations
2
-
3
- Current constraints of the stable SDK, stated plainly so you can decide what to depend on.
4
-
5
- Use the latest `@toloka-platform/sdk` release. Because it is a `0.x` release, the authoring API, CLI surface, and generated source layout can change between minor versions.
6
-
7
- ## Native CLI availability
8
-
9
- The standalone CLI supports macOS and glibc Linux on ARM64 and x64. Native Windows and musl Linux executables are not available yet. It includes its runtime, so running the CLI does not require Bun or Node.js. See [CLI installation](./cli.md#install).
10
-
11
- ## Local checks do not certify deployability
12
-
13
- `toloka check` is the required credential-free local gate. It runs project TypeScript, automatic Task UI typechecking, Vitest, and typed node and pipeline-flow coverage. `toloka apply` reruns it before any platform write.
14
-
15
- `toloka check` also reports, as `platform-rules` warnings, the rules the platform enforces on write that it can check offline, including Training structure and block contents and the 150,000-character limit of one node setting; `toloka apply` refuses a pipeline that breaks one. `toloka validate` separately posts each bound graph to the platform and reports spec errors, warnings, and the latest matching Remote Node Check jobs. It does not write the graph. A passing local gate and platform validation are still not proof that the pipeline can launch:
16
-
17
- | gate | where it is enforced | what the CLI tells you |
18
- | ------------------------------------------------- | -------------------- | ---------------------- |
19
- | Training examples run against the task UI | platform validation | nothing |
20
- | labeler UI validation receipt | platform validation | nothing |
21
-
22
- The typed client can list, start, and poll Remote Node Checks. `toloka check` does not start them: it validates the authored source and its local tests. A `not_ran_node_check` or `running_node_check` warning from `toloka validate` describes remote state rather than missing local evidence.
23
-
24
- Python code nodes have executable behavior checks but no useful static Python typecheck yet. Their generated `Inputs` and `Outputs` aliases are currently `dict[str, Any]`; adding Pyright or mypy before those aliases become field-derived `TypedDict` contracts would provide little protection.
25
-
26
- The standalone CLI's runtime does not provide project test dependencies. Executable code-node tests need `python3` and their imported packages. Task UI tests need Playwright and its Chromium binary. See [Test pipelines locally](./testing.md#install-test-dependencies).
27
-
28
- ## Layout is not authored
29
-
30
- Node canvas positions are not part of authored source. Existing nodes keep their canvas position across applies. The server places a new node one column to the right of its rightmost input, below any node already in that spot, and moves End to the right when new nodes reach it. You cannot lay out a graph from code.
31
-
32
- ## One checkout targets one project
33
-
34
- `toloka.json` records exactly one `projectId`. To drive a second project from the same source — a copy for another customer, or a staging instance beside production — use a separate checkout, or pass `--project-id` and keep the state files apart. Overwriting the recorded id silently repoints every later `plan` and `apply`.
35
-
36
- ## Code assets are inline strings
37
-
38
- A `code` node carries its Python as an inline string in `code.code`. There is no helper for loading a sibling `.py` file, so long programs make the node file long.
39
-
40
- ## Authentication is API keys only
41
-
42
- `toloka login` stores a single API key per machine. There is no browser-based sign-in, no key rotation command, and `logout` deletes the local file without revoking the key. Revoke keys in the platform console.
43
-
44
- ## Open platform defects
45
-
46
- These are reproduced platform-side issues that affect the SDK path. They are not SDK bugs and cannot be fixed from this package.
47
-
48
- | defect | effect on you | workaround |
49
- | ----------------------------------------------------------- | ------------------------------------------------------------------------ | ----------------------------------------------------------------- |
50
- | Rows added through the items endpoint skip column inference | `toloka dataset fields` reports no columns for a dataset that holds rows | declare columns in source rather than inferring them |
51
- | Starting a run intermittently returns a bodyless `500` | `toloka pipeline run` fails with nothing to act on | check `toloka pipeline runs <name>` for a created run, then retry |
52
-
53
- ## Not attempted yet
54
-
55
- - No `toloka destroy` or any delete path. Removing live resources is deliberately manual.
56
- - No dry-run apply against a scratch copy of a project.
57
- - No source maps from a platform validation error back to the authoring line that caused it.
58
- - No shell completion.
package/docs/nodes.md DELETED
@@ -1,104 +0,0 @@
1
- # Nodes
2
-
3
- Which node to reach for, what belongs inside a human-work node, and how to price one.
4
-
5
- ## Choose a node
6
-
7
- | The task is | Use | Constructor |
8
- |---|---|---|
9
- | the pipeline's input and output contract | the root | `root` |
10
- | deterministic from its inputs | code | `code` |
11
- | work only a person can do | human work | `generation` |
12
- | the same item judged by several people independently | human work with overlap | `quorum` |
13
- | a decision about where an item goes next | routing | `match` |
14
-
15
- ### root
16
-
17
- The root defines which dataset columns the pipeline reads and which it writes back. `started` lists the fields the pipeline consumes; `completed` lists the fields it produces. Every pipeline has exactly one root. The dataset name belongs in `definePipeline({ dataset: '...' })`, not in the root settings.
18
-
19
- ### code
20
-
21
- Reach for `code` whenever the answer is computable: parsing, filtering, arithmetic, string work, reshaping a payload, calling an HTTP API, or calling an LLM programmatically. An LLM call is still `code` — the node runs a program, and what that program talks to is its business.
22
-
23
- The sandbox has no ambient environment. Credentials come from `envVars`, which name project secrets set with `toloka secret set`.
24
-
25
- ### generation
26
-
27
- Reach for `generation` when the work needs a person: annotating images, video, or audio; writing or rewriting text; rating or comparing; validating a model's output; or collecting original content such as a recording or a photo the expert produces.
28
-
29
- One `generation` node is one task type, and it owns the entire expert journey for that task. See below.
30
-
31
- ### quorum
32
-
33
- Reach for `quorum` when you want the same item labeled by N independent experts and the disagreement to remain visible — typically classification, rating, or short labels where consensus is the deliverable. `overlap` is how many experts see each item.
34
-
35
- ### match
36
-
37
- Reach for `match` to branch. Conditions are predicates over input fields, evaluated in declaration order. Use it for conditional flow, not for fan-out.
38
-
39
- ## What lives inside a human-work node
40
-
41
- This is the part that surprises people who have built DAGs elsewhere: **the review cycle is not a node.**
42
-
43
- A `generation` or `quorum` node owns, as settings on the node itself:
44
-
45
- | Concern | Setting |
46
- |---|---|
47
- | what the expert sees and submits | `entities`, `ui` |
48
- | what "good" means | `qualityCriteria` |
49
- | who judges quality, and how | `qualityAssurance` |
50
- | what the expert must learn first | `onboarding` (the Training course) |
51
- | an optional gate before real work | `exam` |
52
- | who may take the task, and for how much | `audienceAndPricing` |
53
- | written guidance | `instruction` |
54
-
55
- Redo, review, appeal, and payment retry are internal to the node. If you catch yourself drawing an edge backwards to model "send it back for another look", stop: the behavior you want is a setting on the node you are coming from. The graph stays acyclic by construction.
56
-
57
- Post-human work in the graph is either deterministic processing (`code`) or routing (`match`).
58
-
59
- Two defaults worth knowing before you author one:
60
-
61
- - **Quality assurance is on.** A human-work node has quality criteria judged automatically. It is not something you add later as a review step.
62
- - **Training is on.** A new human-work node expects a course, and the platform requires at least three steps with at least one quiz block. The constructor drops a one-step placeholder, which will not deploy. Build a real course.
63
-
64
- ## Pricing and time
65
-
66
- `audienceAndPricing` carries `pricePerTask` (USD) and `timeForTask` (seconds). `timeForTask` is a real duration, not a display hint: a whole number of seconds from 10 to 359,999 (99:59:59). The shipped example uses `pricePerTask: 0.2` with `timeForTask: 60`, the lowest price an ID-verified audience allows.
67
-
68
- You choose `pricePerTask`, and any value inside the audience's range is accepted. The range is set per hour of work and converted to one task as `rate × timeForTask / 3600`:
69
-
70
- | Audience | `pricePerTask` per hour of work | The editor suggests |
71
- |---|---|---|
72
- | ID-verified experts, no specialization | $12–$90 | $21 |
73
- | ID-verified experts with a specialization | from $12; the top follows the specialization's current rates | a rate set by the specialization |
74
- | Broad crowd (`verifiedExperts: false`) | $3–$24 | $6 |
75
-
76
- For a 120-second task with ID-verified experts and no specialization, that is $0.40–$3.00 per task.
77
-
78
- The platform checks the price and the audience on `toloka apply`, `toloka validate`, and every run:
79
-
80
- - A `pricePerTask` outside the range fails with an error that names the exact range for your audience and `timeForTask`.
81
- - The audience must match at least one expert, and every language, specialization, and country code must exist in the audience catalog. Countries are ISO 3166-1 alpha-2 codes such as `US`.
82
-
83
- With Human QA on (`qaMode: 'human_only'` or `'hybrid'`), `qualityAssurance.humanQaTimeForTask` is the time for one review: a whole number of seconds, at least 30 and at least 3 per quality criterion, up to 359,999 (99:59:59).
84
-
85
- ## Quorum data shape
86
-
87
- Every output field on a `quorum` node is a **top-level array**, with one element per labeler — nominally `overlap` of them, one submitted by each expert.
88
-
89
- This propagates. A downstream `code` node reading a quorum output receives the array, not a scalar, and its Python must aggregate: take a majority, a mean, or the disagreement itself. Writing that node as though it reads one label is the most common mistake with quorum, and the symptom is a type error deep in the run rather than at author time.
90
-
91
- ## Match routing
92
-
93
- A `match` node declares conditions; the graph connects their outcomes:
94
-
95
- | Port | Routes |
96
- |---|---|
97
- | `matched(0)`, `matched(1)`, ... | items satisfying the i-th condition, in declaration order |
98
- | `default` | everything that matched nothing |
99
-
100
- Wire `default` to wherever unmatched items should go. An item that matches no condition has no other path through the graph.
101
-
102
- ## See also
103
-
104
- [Authoring](./authoring.md) · [CLI reference](./cli.md) · [Limitations](./limitations.md)