@toloka-platform/sdk 0.12.2 → 0.13.1
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/dist/cli/toloka.js +153 -151
- package/dist/cli/toloka.js.jsc +0 -0
- package/dist/cli/toloka.js.jsc.sha256 +1 -1
- package/dist/cli/toloka.js.sha256 +1 -1
- package/docs/authoring.md +2 -2
- package/docs/cli.md +19 -0
- package/docs/getting-started.md +1 -1
- package/docs/nodes.md +18 -1
- package/examples/product-moderation/nodes/moderate-product/node.ts +1 -1
- package/examples/video-pair-rating/nodes/adjudicate/node.ts +1 -1
- package/examples/video-pair-rating/nodes/adjudicate_op/node.ts +1 -1
- package/examples/video-pair-rating/nodes/overall_preference_pick/node.ts +1 -1
- package/examples/video-pair-rating/nodes/rate_pair/node.ts +1 -1
- package/openapi/gen/api.ts +142 -0
- package/openapi/gen/models/batchInferenceMode.ts +3 -0
- package/openapi/gen/models/batchInferenceModeOneOf.ts +4 -0
- package/openapi/gen/models/batchInferenceModel.ts +4 -0
- package/openapi/gen/models/batchInferenceModelOneOf.ts +6 -0
- package/openapi/gen/models/batchInferenceModelOneOfBaseModelId.ts +2 -0
- package/openapi/gen/models/batchInferenceModelOneOfThree.ts +5 -0
- package/openapi/gen/models/batchInferenceRun.ts +35 -0
- package/openapi/gen/models/batchInferenceRunBlockedReason.ts +2 -0
- package/openapi/gen/models/batchInferenceRunChargedAmount.ts +2 -0
- package/openapi/gen/models/batchInferenceRunError.ts +3 -0
- package/openapi/gen/models/batchInferenceRunErrorAnyOf.ts +6 -0
- package/openapi/gen/models/batchInferenceRunErrorAnyOfCode.ts +2 -0
- package/openapi/gen/models/batchInferenceRunId.ts +2 -0
- package/openapi/gen/models/batchInferenceRunMessage.ts +2 -0
- package/openapi/gen/models/batchInferenceRunOutput.ts +9 -0
- package/openapi/gen/models/batchInferenceRunOutputType.ts +2 -0
- package/openapi/gen/models/batchInferenceRunProgress.ts +3 -0
- package/openapi/gen/models/batchInferenceRunProgressAnyOf.ts +7 -0
- package/openapi/gen/models/batchInferenceRunProgressAnyOfPhase.ts +2 -0
- package/openapi/gen/models/batchInferenceRunProgressAnyOfRequests.ts +5 -0
- package/openapi/gen/models/batchInferenceRunQuote.ts +3 -0
- package/openapi/gen/models/batchInferenceRunQuoteAnyOf.ts +9 -0
- package/openapi/gen/models/batchInferenceRunQuoteAnyOfConfirmBefore.ts +2 -0
- package/openapi/gen/models/batchInferenceRunResult.ts +3 -0
- package/openapi/gen/models/batchInferenceRunResultAnyOf.ts +12 -0
- package/openapi/gen/models/batchInferenceRunResultAnyOfErrorCounts.ts +2 -0
- package/openapi/gen/models/batchInferenceRunResultAnyOfErrorSamplesItem.ts +6 -0
- package/openapi/gen/models/batchInferenceRunSampling.ts +9 -0
- package/openapi/gen/models/batchInferenceRunStatus.ts +2 -0
- package/openapi/gen/models/createBatchInferenceRunBody.ts +14 -0
- package/openapi/gen/models/createBatchInferenceRunBodyItemFilter.ts +14 -0
- package/openapi/gen/models/createBatchInferenceRunBodyItemFilterExcludePartsItem.ts +5 -0
- package/openapi/gen/models/createBatchInferenceRunBodyItemFilterFieldSourcesItem.ts +6 -0
- package/openapi/gen/models/createBatchInferenceRunBodyItemFilterFieldSourcesItemSourcesItem.ts +4 -0
- package/openapi/gen/models/createBatchInferenceRunBodyItemFilterFieldSourcesItemSourcesItemOneOf.ts +5 -0
- package/openapi/gen/models/createBatchInferenceRunBodyItemFilterFieldSourcesItemSourcesItemOneOfTwo.ts +5 -0
- package/openapi/gen/models/createBatchInferenceRunBodyItemFilterFieldValuesItem.ts +12 -0
- package/openapi/gen/models/createBatchInferenceRunBodyItemFilterFieldValuesItemOperator.ts +2 -0
- package/openapi/gen/models/createBatchInferenceRunBodyItemFilterFieldValuesItemSourcesItem.ts +4 -0
- package/openapi/gen/models/createBatchInferenceRunBodyItemFilterFieldValuesItemSourcesItemOneOf.ts +5 -0
- package/openapi/gen/models/createBatchInferenceRunBodyItemFilterFieldValuesItemSourcesItemOneOfTwo.ts +5 -0
- package/openapi/gen/models/createBatchInferenceRunBodyItemFilterFieldValuesItemValue.ts +2 -0
- package/openapi/gen/models/createBatchInferenceRunBodyItemFilterParts.ts +5 -0
- package/openapi/gen/models/createBatchInferenceRunBodyItemFilterSlice.ts +4 -0
- package/openapi/gen/models/createBatchInferenceRunBodyOutput.ts +4 -0
- package/openapi/gen/models/createBatchInferenceRunBodyOutputOneOf.ts +5 -0
- package/openapi/gen/models/createBatchInferenceRunBodyOutputOneOfTwo.ts +5 -0
- package/openapi/gen/models/createBatchInferenceRunBodySampling.ts +9 -0
- package/openapi/gen/models/datasetFieldOperation.ts +2 -1
- package/openapi/gen/models/datasetFieldWriteOperation.ts +8 -0
- package/openapi/gen/models/datasetFieldWriteOperationProgress.ts +3 -0
- package/openapi/gen/models/datasetFieldWriteOperationProgressAnyOf.ts +5 -0
- package/openapi/gen/models/index.ts +53 -0
- package/openapi/gen/models/listBatchInferenceRuns200.ts +7 -0
- package/openapi/gen/models/listBatchInferenceRunsParams.ts +5 -0
- package/package.json +2 -2
- package/skills/catalog.json +6 -6
- package/skills/toloka-build/references/human-work.md +5 -5
- package/skills/toloka-build/references/workflow-and-cli.md +6 -2
- package/src/cli/analytics.ts +8 -0
- package/src/cli/batch-inference.ts +267 -0
- package/src/cli/commands/batch-inference.ts +116 -0
- package/src/cli/context.ts +14 -0
- package/src/cli/models.ts +1 -1
- package/src/cli/program.ts +2 -0
- package/src/cli/splits.ts +40 -0
- package/src/cli/trainings.ts +1 -19
- package/src/client.ts +49 -0
- package/src/pipeline-graph-v1.contract.json +2 -2
package/dist/cli/toloka.js.jsc
CHANGED
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
279a8411c9d81b84cedaf92105db4990e733707701c0f78ef7a40b08787a7d71 toloka.js.jsc
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
9dede722e09fc4a46a7e7efcc968508799b374e50ea2b75731c6c3817a13b24c toloka.js
|
package/docs/authoring.md
CHANGED
|
@@ -311,10 +311,10 @@ toloka validate
|
|
|
311
311
|
|
|
312
312
|
A pipeline that is not on the platform yet is skipped until `toloka apply` creates it. The published JSON contract is still available as `validate(graph)` for importer and fixture tests; that helper also runs the local entity checks described under [generation](#generation) and makes no network call.
|
|
313
313
|
|
|
314
|
-
A successful validate is necessary, not sufficient for launch. Gates outside the graph contract —
|
|
314
|
+
A successful validate is necessary, not sufficient for launch. Gates outside the graph contract — a Training course that is enabled but unbuilt, a task UI that was never validated — can still block deployment. See [limitations](./limitations.md).
|
|
315
315
|
|
|
316
316
|
## Next
|
|
317
317
|
|
|
318
|
-
- [Nodes](./nodes.md) — choosing a node, and the
|
|
318
|
+
- [Nodes](./nodes.md) — choosing a node, and the price range it must stay within
|
|
319
319
|
- [Datasets](./datasets.md) — columns and immutability
|
|
320
320
|
- [CLI](./cli.md) — the reconcile loop
|
package/docs/cli.md
CHANGED
|
@@ -350,6 +350,8 @@ toloka pipeline results <runId> [--limit <n>] [--failed]
|
|
|
350
350
|
|
|
351
351
|
`pipeline run` without `--wait` prints `Started run <id> is <status> for <name>.` and a follow-up that uses the pipeline id. Exit code `0` means only that the run was accepted. With `--wait`, it prints `Run <id> succeeded.` or `Run <id> failed.` and sets the exit code accordingly; see [Exit codes](#exit-codes).
|
|
352
352
|
|
|
353
|
+
A run needs at least one dataset item that matches the root node's dataset and filter. Otherwise `pipeline run` fails with `No dataset items match, so a run would have nothing to process.` and starts nothing. `apply` and `validate` still succeed over an empty dataset, so upload items or widen the filter, then run again.
|
|
354
|
+
|
|
353
355
|
`pipeline status` reports the latest run of that pipeline. `pipeline runs` lists recent runs (default 10). `pipeline cost` forecasts what a run would bill. `pipeline cancel` and `pipeline results` take a run id.
|
|
354
356
|
|
|
355
357
|
## base-model
|
|
@@ -400,6 +402,23 @@ Hyperparameters are optional flags on `training create` and `training update`: `
|
|
|
400
402
|
|
|
401
403
|
A Training learns on a ready dataset slice that freezes a split column, and `training create` needs `--dataset` or `--slice`. `--dataset <name-or-id>` fills the empty cells of the dataset's split column (a new `split` column, 80/10/10, when it has none), freezes a slice named after the Training, and trains on it; it waits up to 10 minutes for each step and prints one line per step before `Created training`. A split column adopted from an ordinary column has no shares, so `--dataset` does not fill it; give it shares first with `toloka dataset split <dataset> --column <name> --parts <name>=<roles>:<percent>,...`. `--slice <id>` takes a slice frozen with `toloka dataset slice create`. With several split columns, `--split-column` picks the one to train with. The Training learns on the column's train parts, or the ones `--parts` names, and validates on its validate parts, including a part that both validates and tests; without validation rows, the run holds out 10% of the training rows. Rows without a part are never trained on. `training update` keeps the slice, split column and train parts. A new `--dataset` or `--slice` resets the split column and train parts unless you pass them too; `--dataset` splits again and freezes a new slice named after the Training. `training get` prints the slice, split column and train parts. `training cost` leaves out rows that any split column now puts in a test part, a validate + test part of the Training's own column apart, and, when there are any, prints how many as `Left out as test`. The test parts of the Training's own column are outside the train parts to begin with, so they are not counted there. A Training saved before split slices were required is refused by `training cost` until `training update` gives it one.
|
|
402
404
|
|
|
405
|
+
## batch-inference
|
|
406
|
+
|
|
407
|
+
Answer a dataset's chat rows with a catalog Base Model or a Model Version of the project.
|
|
408
|
+
|
|
409
|
+
```sh
|
|
410
|
+
toloka batch-inference run --dataset <id> [--filter field=value] [--slice <slice-id>] [--parts <names> [--split-column <name>]] (--base-model <id> | --model-version <mdv.id|Model@name>) (--output-field <name> | --output-dataset <name>) --max-output-tokens <n> [--temperature 0..2] [--top-p <p>] [--stop <text>]... [--seed <n>] [--samples-per-row <n>] [--idempotency-key <key>] [--yes] [--json]
|
|
411
|
+
toloka batch-inference list [--json]
|
|
412
|
+
toloka batch-inference status <batch-inference-run-id> [--wait] [--json]
|
|
413
|
+
toloka batch-inference confirm <batch-inference-run-id> [--json]
|
|
414
|
+
toloka batch-inference resume <batch-inference-run-id> [--json]
|
|
415
|
+
toloka batch-inference cancel <batch-inference-run-id> [--json]
|
|
416
|
+
```
|
|
417
|
+
|
|
418
|
+
Each selected row sends its `messages` (and `tools`, if any) as the prompt; a trailing assistant turn and the label column are ignored, so a training or holdout dataset works as-is. Rows with no user turn to answer, and prompts over about 16,384 tokens (estimated the way training estimates examples: each character counts by its script, about 5 Latin letters or 2.5 Cyrillic letters to a token and every digit one, plus the chat template's markup per turn and tool), are skipped and counted in the quote; when no row is left, the run fails with `no_requests` before anything is held. `--slice` answers only the rows of a ready slice, with the prompts it froze; `--parts test` answers only the rows in those parts of the dataset's split column, and `--split-column` picks the column when there are several. With both, a split column the slice froze keeps the parts it had when the slice was taken. `run` freezes the selection, waits for the quote and prints the number of rows and the maximum charge; nothing is held or spent until you confirm, either with `--yes` on `run` or later with `confirm` within 24 hours. `--output-field` writes each answer as a new value of a text column on the same dataset, creating the column if it does not exist. An existing column must allow strings, including a string column limited to an enum, a pattern or a length; a column whose schema allows no string (a number, a boolean, an object, or an enum, const, anyOf, oneOf or allOf with no string option) is refused with "does not accept text" before anything is quoted, and an answer that breaks a column's constraint fails that row. `--output-dataset` creates a new chat-sft dataset and adds a row for each answer as it arrives, keeping the prompt, the answer and the source row; `--samples-per-row` asks for several answers to each row (with a temperature above 0), one dataset row per answer with its `sample` number. A sample that fails adds no row. Answers appear in the dataset as they are generated, and while the run writes, the column shows "Updating · done/total", and the field's `operations` in the API list the write, so a slice, a split or another run that reads the column waits until it ends. Each answer is a new value of the column; rows the run left without one are found with the column filter for rows missing a value from the run, and `status` counts the failures by reason. The run is charged for the GPU time it used, at most the quoted maximum; a cancel keeps the answers already generated and charges the time used, and a platform failure charges nothing. `status --wait` follows a run until it finishes or needs you.
|
|
419
|
+
|
|
420
|
+
Batch inference runs on qwen3-4b and qwen3-8b: a catalog Base Model, or a Model Version trained from one of them (LoRA, full weights or gisting). `run` refuses other models before anything is quoted. The charge is the GPU time used at the quoted price per GPU-hour: at least $0.50 per GPU once the job has used any GPU time, and never more than the quoted maximum. A cancel pays for the time used so far. A run that fails on the platform's side, times out, or whose results cannot be read at all charges nothing; when only some answers cannot be read, the run completes, charges the GPU time used and counts those rows as failed. A `blocked` run says why in `status`: `funds` when the balance cannot cover the hold (add funds, then `resume`); `payment` when the charge could not be collected (add funds and `resume` within seven days, after which the run fails with `payment_window_expired`; the answers already written stay); `billing_review` when support has to reconcile the charge. With a scoped API token, `list` and `status` need `inference:read`, and `run`, `confirm`, `resume` and `cancel` need `inference:deploy`: the `deploy` preset grants both, `read` and `write` grant only `inference:read`, and the labeling presets grant neither.
|
|
421
|
+
|
|
403
422
|
## dataset
|
|
404
423
|
|
|
405
424
|
Catalog and row commands for datasets in the selected project. Name or id is accepted; duplicate names must be addressed by id.
|
package/docs/getting-started.md
CHANGED
|
@@ -141,7 +141,7 @@ Exit code `0` means the run reached a successful terminal state, `1` a failed on
|
|
|
141
141
|
## Next
|
|
142
142
|
|
|
143
143
|
- [Authoring](./authoring.md) — the typed graph API
|
|
144
|
-
- [Nodes](./nodes.md) — which node to reach for, and the
|
|
144
|
+
- [Nodes](./nodes.md) — which node to reach for, and the price range you must stay within
|
|
145
145
|
- [CLI](./cli.md) — every command and flag
|
|
146
146
|
- [Troubleshooting](./troubleshooting.md) — the failures you will hit
|
|
147
147
|
- [Limitations](./limitations.md) — current constraints and `0.x` compatibility expectations
|
package/docs/nodes.md
CHANGED
|
@@ -63,7 +63,24 @@ Two defaults worth knowing before you author one:
|
|
|
63
63
|
|
|
64
64
|
## Pricing and time
|
|
65
65
|
|
|
66
|
-
`audienceAndPricing` carries `pricePerTask` (USD) and `timeForTask` (seconds). `timeForTask` is a real duration, not a display hint. The shipped example uses `pricePerTask: 0.2` with `timeForTask: 60
|
|
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).
|
|
67
84
|
|
|
68
85
|
## Quorum data shape
|
|
69
86
|
|
|
@@ -46,7 +46,7 @@ export const moderateProduct = generation("moderate_product", {
|
|
|
46
46
|
specializations: { type: "and", values: [] },
|
|
47
47
|
countries: { type: "or", values: [] },
|
|
48
48
|
},
|
|
49
|
-
pricePerTask: 0.
|
|
49
|
+
pricePerTask: 0.4,
|
|
50
50
|
timeForTask: 120,
|
|
51
51
|
perExpertCapEnabled: false,
|
|
52
52
|
perExpertCapValue: 1,
|
|
@@ -227,7 +227,7 @@ export const adjudicate = generation("adjudicate", {
|
|
|
227
227
|
specializations: { type: "and", values: [] },
|
|
228
228
|
countries: { type: "or", values: [] },
|
|
229
229
|
},
|
|
230
|
-
pricePerTask: 0.
|
|
230
|
+
pricePerTask: 0.6,
|
|
231
231
|
timeForTask: 180,
|
|
232
232
|
perExpertCapEnabled: false,
|
|
233
233
|
perExpertCapValue: 1,
|
|
@@ -167,7 +167,7 @@ export const adjudicateOp = generation("adjudicate_op", {
|
|
|
167
167
|
specializations: { type: "and", values: [] },
|
|
168
168
|
countries: { type: "or", values: [] },
|
|
169
169
|
},
|
|
170
|
-
pricePerTask: 0.
|
|
170
|
+
pricePerTask: 0.6,
|
|
171
171
|
timeForTask: 180,
|
|
172
172
|
perExpertCapEnabled: false,
|
|
173
173
|
perExpertCapValue: 1,
|
|
@@ -160,7 +160,7 @@ export const overallPreferencePick = quorum("overall_preference_pick", {
|
|
|
160
160
|
specializations: { type: "and", values: [] },
|
|
161
161
|
countries: { type: "or", values: [] },
|
|
162
162
|
},
|
|
163
|
-
pricePerTask: 0.
|
|
163
|
+
pricePerTask: 0.4,
|
|
164
164
|
timeForTask: 120,
|
|
165
165
|
perExpertCapEnabled: false,
|
|
166
166
|
perExpertCapValue: 1,
|
|
@@ -243,7 +243,7 @@ export const ratePair = quorum("rate_pair", {
|
|
|
243
243
|
specializations: { type: "and", values: [] },
|
|
244
244
|
countries: { type: "or", values: [] },
|
|
245
245
|
},
|
|
246
|
-
pricePerTask: 0.
|
|
246
|
+
pricePerTask: 0.4,
|
|
247
247
|
timeForTask: 120,
|
|
248
248
|
perExpertCapEnabled: false,
|
|
249
249
|
perExpertCapValue: 1,
|
package/openapi/gen/api.ts
CHANGED
|
@@ -4,9 +4,12 @@ import type {
|
|
|
4
4
|
AttachPipelineDatasetBody,
|
|
5
5
|
BaseModel,
|
|
6
6
|
BaseModelId,
|
|
7
|
+
BatchInferenceRun,
|
|
8
|
+
BatchInferenceRunId,
|
|
7
9
|
CheckJob,
|
|
8
10
|
CheckRunId,
|
|
9
11
|
CopyPipelineBody,
|
|
12
|
+
CreateBatchInferenceRunBody,
|
|
10
13
|
CreateDatasetBody,
|
|
11
14
|
CreateDatasetExportBody,
|
|
12
15
|
CreateDatasetField200,
|
|
@@ -41,6 +44,8 @@ import type {
|
|
|
41
44
|
ListAudienceSpecializations200,
|
|
42
45
|
ListAudienceSpecializationsParams,
|
|
43
46
|
ListBaseModels200,
|
|
47
|
+
ListBatchInferenceRuns200,
|
|
48
|
+
ListBatchInferenceRunsParams,
|
|
44
49
|
ListDatasetFields200,
|
|
45
50
|
ListDatasetFieldsParams,
|
|
46
51
|
ListDatasetItems200,
|
|
@@ -2144,3 +2149,140 @@ export const getPipelineCheck = async (checkRunId: CheckRunId, options?: Request
|
|
|
2144
2149
|
|
|
2145
2150
|
}
|
|
2146
2151
|
);}
|
|
2152
|
+
|
|
2153
|
+
|
|
2154
|
+
|
|
2155
|
+
export const getCreateBatchInferenceRunUrl = (projectId: ProjectId,) => {
|
|
2156
|
+
|
|
2157
|
+
|
|
2158
|
+
|
|
2159
|
+
|
|
2160
|
+
return `/api/v2-beta/projects/${projectId}/batch-inference-runs`
|
|
2161
|
+
}
|
|
2162
|
+
|
|
2163
|
+
export const createBatchInferenceRun = async (projectId: ProjectId,
|
|
2164
|
+
createBatchInferenceRunBody: CreateBatchInferenceRunBody, options?: RequestInit): Promise<BatchInferenceRun> => {
|
|
2165
|
+
|
|
2166
|
+
return potatoFetch<BatchInferenceRun>(getCreateBatchInferenceRunUrl(projectId),
|
|
2167
|
+
{
|
|
2168
|
+
...options,
|
|
2169
|
+
method: 'POST',
|
|
2170
|
+
headers: { 'Content-Type': 'application/json', ...options?.headers },
|
|
2171
|
+
body: JSON.stringify(
|
|
2172
|
+
createBatchInferenceRunBody,)
|
|
2173
|
+
}
|
|
2174
|
+
);}
|
|
2175
|
+
|
|
2176
|
+
|
|
2177
|
+
|
|
2178
|
+
export const getListBatchInferenceRunsUrl = (projectId: ProjectId,
|
|
2179
|
+
params?: ListBatchInferenceRunsParams,) => {
|
|
2180
|
+
const normalizedParams = new URLSearchParams();
|
|
2181
|
+
|
|
2182
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
2183
|
+
|
|
2184
|
+
if (value !== undefined) {
|
|
2185
|
+
normalizedParams.append(key, value === null ? 'null' : value.toString())
|
|
2186
|
+
}
|
|
2187
|
+
});
|
|
2188
|
+
|
|
2189
|
+
const stringifiedParams = normalizedParams.toString();
|
|
2190
|
+
|
|
2191
|
+
return stringifiedParams.length > 0 ? `/api/v2-beta/projects/${projectId}/batch-inference-runs?${stringifiedParams}` : `/api/v2-beta/projects/${projectId}/batch-inference-runs`
|
|
2192
|
+
}
|
|
2193
|
+
|
|
2194
|
+
export const listBatchInferenceRuns = async (projectId: ProjectId,
|
|
2195
|
+
params?: ListBatchInferenceRunsParams, options?: RequestInit): Promise<ListBatchInferenceRuns200> => {
|
|
2196
|
+
|
|
2197
|
+
return potatoFetch<ListBatchInferenceRuns200>(getListBatchInferenceRunsUrl(projectId,params),
|
|
2198
|
+
{
|
|
2199
|
+
...options,
|
|
2200
|
+
method: 'GET'
|
|
2201
|
+
|
|
2202
|
+
|
|
2203
|
+
}
|
|
2204
|
+
);}
|
|
2205
|
+
|
|
2206
|
+
|
|
2207
|
+
|
|
2208
|
+
export const getGetBatchInferenceRunUrl = (batchInferenceRunId: BatchInferenceRunId,) => {
|
|
2209
|
+
|
|
2210
|
+
|
|
2211
|
+
|
|
2212
|
+
|
|
2213
|
+
return `/api/v2-beta/batch-inference-runs/${batchInferenceRunId}`
|
|
2214
|
+
}
|
|
2215
|
+
|
|
2216
|
+
export const getBatchInferenceRun = async (batchInferenceRunId: BatchInferenceRunId, options?: RequestInit): Promise<BatchInferenceRun> => {
|
|
2217
|
+
|
|
2218
|
+
return potatoFetch<BatchInferenceRun>(getGetBatchInferenceRunUrl(batchInferenceRunId),
|
|
2219
|
+
{
|
|
2220
|
+
...options,
|
|
2221
|
+
method: 'GET'
|
|
2222
|
+
|
|
2223
|
+
|
|
2224
|
+
}
|
|
2225
|
+
);}
|
|
2226
|
+
|
|
2227
|
+
|
|
2228
|
+
|
|
2229
|
+
export const getConfirmBatchInferenceRunUrl = (batchInferenceRunId: BatchInferenceRunId,) => {
|
|
2230
|
+
|
|
2231
|
+
|
|
2232
|
+
|
|
2233
|
+
|
|
2234
|
+
return `/api/v2-beta/batch-inference-runs/${batchInferenceRunId}/confirm`
|
|
2235
|
+
}
|
|
2236
|
+
|
|
2237
|
+
export const confirmBatchInferenceRun = async (batchInferenceRunId: BatchInferenceRunId, options?: RequestInit): Promise<BatchInferenceRun> => {
|
|
2238
|
+
|
|
2239
|
+
return potatoFetch<BatchInferenceRun>(getConfirmBatchInferenceRunUrl(batchInferenceRunId),
|
|
2240
|
+
{
|
|
2241
|
+
...options,
|
|
2242
|
+
method: 'POST'
|
|
2243
|
+
|
|
2244
|
+
|
|
2245
|
+
}
|
|
2246
|
+
);}
|
|
2247
|
+
|
|
2248
|
+
|
|
2249
|
+
|
|
2250
|
+
export const getResumeBatchInferenceRunUrl = (batchInferenceRunId: BatchInferenceRunId,) => {
|
|
2251
|
+
|
|
2252
|
+
|
|
2253
|
+
|
|
2254
|
+
|
|
2255
|
+
return `/api/v2-beta/batch-inference-runs/${batchInferenceRunId}/resume`
|
|
2256
|
+
}
|
|
2257
|
+
|
|
2258
|
+
export const resumeBatchInferenceRun = async (batchInferenceRunId: BatchInferenceRunId, options?: RequestInit): Promise<BatchInferenceRun> => {
|
|
2259
|
+
|
|
2260
|
+
return potatoFetch<BatchInferenceRun>(getResumeBatchInferenceRunUrl(batchInferenceRunId),
|
|
2261
|
+
{
|
|
2262
|
+
...options,
|
|
2263
|
+
method: 'POST'
|
|
2264
|
+
|
|
2265
|
+
|
|
2266
|
+
}
|
|
2267
|
+
);}
|
|
2268
|
+
|
|
2269
|
+
|
|
2270
|
+
|
|
2271
|
+
export const getCancelBatchInferenceRunUrl = (batchInferenceRunId: BatchInferenceRunId,) => {
|
|
2272
|
+
|
|
2273
|
+
|
|
2274
|
+
|
|
2275
|
+
|
|
2276
|
+
return `/api/v2-beta/batch-inference-runs/${batchInferenceRunId}/cancel`
|
|
2277
|
+
}
|
|
2278
|
+
|
|
2279
|
+
export const cancelBatchInferenceRun = async (batchInferenceRunId: BatchInferenceRunId, options?: RequestInit): Promise<BatchInferenceRun> => {
|
|
2280
|
+
|
|
2281
|
+
return potatoFetch<BatchInferenceRun>(getCancelBatchInferenceRunUrl(batchInferenceRunId),
|
|
2282
|
+
{
|
|
2283
|
+
...options,
|
|
2284
|
+
method: 'POST'
|
|
2285
|
+
|
|
2286
|
+
|
|
2287
|
+
}
|
|
2288
|
+
);}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { BatchInferenceRunId } from './batchInferenceRunId';
|
|
2
|
+
import type { ProjectId } from './projectId';
|
|
3
|
+
import type { DatasetId } from './datasetId';
|
|
4
|
+
import type { BatchInferenceModel } from './batchInferenceModel';
|
|
5
|
+
import type { BatchInferenceMode } from './batchInferenceMode';
|
|
6
|
+
import type { BatchInferenceRunSampling } from './batchInferenceRunSampling';
|
|
7
|
+
import type { BatchInferenceRunOutput } from './batchInferenceRunOutput';
|
|
8
|
+
import type { BatchInferenceRunStatus } from './batchInferenceRunStatus';
|
|
9
|
+
import type { BatchInferenceRunProgress } from './batchInferenceRunProgress';
|
|
10
|
+
import type { BatchInferenceRunBlockedReason } from './batchInferenceRunBlockedReason';
|
|
11
|
+
import type { BatchInferenceRunMessage } from './batchInferenceRunMessage';
|
|
12
|
+
import type { BatchInferenceRunError } from './batchInferenceRunError';
|
|
13
|
+
import type { BatchInferenceRunQuote } from './batchInferenceRunQuote';
|
|
14
|
+
import type { BatchInferenceRunChargedAmount } from './batchInferenceRunChargedAmount';
|
|
15
|
+
import type { BatchInferenceRunResult } from './batchInferenceRunResult';
|
|
16
|
+
|
|
17
|
+
export interface BatchInferenceRun {
|
|
18
|
+
id: BatchInferenceRunId;
|
|
19
|
+
projectId: ProjectId;
|
|
20
|
+
datasetId: DatasetId;
|
|
21
|
+
model: BatchInferenceModel;
|
|
22
|
+
mode: BatchInferenceMode;
|
|
23
|
+
sampling: BatchInferenceRunSampling;
|
|
24
|
+
output: BatchInferenceRunOutput;
|
|
25
|
+
status: BatchInferenceRunStatus;
|
|
26
|
+
progress: BatchInferenceRunProgress;
|
|
27
|
+
blockedReason: BatchInferenceRunBlockedReason;
|
|
28
|
+
message: BatchInferenceRunMessage;
|
|
29
|
+
error: BatchInferenceRunError;
|
|
30
|
+
quote: BatchInferenceRunQuote;
|
|
31
|
+
chargedAmount: BatchInferenceRunChargedAmount;
|
|
32
|
+
result: BatchInferenceRunResult;
|
|
33
|
+
createdAt: string;
|
|
34
|
+
updatedAt: string;
|
|
35
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { BatchInferenceRunOutputType } from './batchInferenceRunOutputType';
|
|
2
|
+
import type { DatasetId } from './datasetId';
|
|
3
|
+
import type { DatasetFieldId } from './datasetFieldId';
|
|
4
|
+
|
|
5
|
+
export type BatchInferenceRunOutput = {
|
|
6
|
+
type: BatchInferenceRunOutputType;
|
|
7
|
+
datasetId: DatasetId;
|
|
8
|
+
fieldId: DatasetFieldId;
|
|
9
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { BatchInferenceRunProgressAnyOfPhase } from './batchInferenceRunProgressAnyOfPhase';
|
|
2
|
+
import type { BatchInferenceRunProgressAnyOfRequests } from './batchInferenceRunProgressAnyOfRequests';
|
|
3
|
+
|
|
4
|
+
export type BatchInferenceRunProgressAnyOf = {
|
|
5
|
+
phase: BatchInferenceRunProgressAnyOfPhase;
|
|
6
|
+
requests?: BatchInferenceRunProgressAnyOfRequests;
|
|
7
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { BatchInferenceRunQuoteAnyOfConfirmBefore } from './batchInferenceRunQuoteAnyOfConfirmBefore';
|
|
2
|
+
|
|
3
|
+
export type BatchInferenceRunQuoteAnyOf = {
|
|
4
|
+
requests: number;
|
|
5
|
+
skippedRows: number;
|
|
6
|
+
maximumCharge: string;
|
|
7
|
+
currency: 'USD';
|
|
8
|
+
confirmBefore: BatchInferenceRunQuoteAnyOfConfirmBefore;
|
|
9
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { BatchInferenceRunResultAnyOfErrorCounts } from './batchInferenceRunResultAnyOfErrorCounts';
|
|
2
|
+
import type { BatchInferenceRunResultAnyOfErrorSamplesItem } from './batchInferenceRunResultAnyOfErrorSamplesItem';
|
|
3
|
+
|
|
4
|
+
export type BatchInferenceRunResultAnyOf = {
|
|
5
|
+
written: number;
|
|
6
|
+
failed: number;
|
|
7
|
+
truncated: number;
|
|
8
|
+
inputTokens: number;
|
|
9
|
+
outputTokens: number;
|
|
10
|
+
errorCounts: BatchInferenceRunResultAnyOfErrorCounts;
|
|
11
|
+
errorSamples: BatchInferenceRunResultAnyOfErrorSamplesItem[];
|
|
12
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { CreateBatchInferenceRunBodyItemFilter } from './createBatchInferenceRunBodyItemFilter';
|
|
2
|
+
import type { BatchInferenceModel } from './batchInferenceModel';
|
|
3
|
+
import type { BatchInferenceMode } from './batchInferenceMode';
|
|
4
|
+
import type { CreateBatchInferenceRunBodySampling } from './createBatchInferenceRunBodySampling';
|
|
5
|
+
import type { CreateBatchInferenceRunBodyOutput } from './createBatchInferenceRunBodyOutput';
|
|
6
|
+
|
|
7
|
+
export type CreateBatchInferenceRunBody = {
|
|
8
|
+
datasetId: string;
|
|
9
|
+
itemFilter?: CreateBatchInferenceRunBodyItemFilter;
|
|
10
|
+
model: BatchInferenceModel;
|
|
11
|
+
mode?: BatchInferenceMode;
|
|
12
|
+
sampling: CreateBatchInferenceRunBodySampling;
|
|
13
|
+
output: CreateBatchInferenceRunBodyOutput;
|
|
14
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { CreateBatchInferenceRunBodyItemFilterFieldValuesItem } from './createBatchInferenceRunBodyItemFilterFieldValuesItem';
|
|
2
|
+
import type { CreateBatchInferenceRunBodyItemFilterFieldSourcesItem } from './createBatchInferenceRunBodyItemFilterFieldSourcesItem';
|
|
3
|
+
import type { CreateBatchInferenceRunBodyItemFilterSlice } from './createBatchInferenceRunBodyItemFilterSlice';
|
|
4
|
+
import type { CreateBatchInferenceRunBodyItemFilterParts } from './createBatchInferenceRunBodyItemFilterParts';
|
|
5
|
+
import type { CreateBatchInferenceRunBodyItemFilterExcludePartsItem } from './createBatchInferenceRunBodyItemFilterExcludePartsItem';
|
|
6
|
+
|
|
7
|
+
export type CreateBatchInferenceRunBodyItemFilter = {
|
|
8
|
+
fieldValues?: CreateBatchInferenceRunBodyItemFilterFieldValuesItem[];
|
|
9
|
+
fieldSources?: CreateBatchInferenceRunBodyItemFilterFieldSourcesItem[];
|
|
10
|
+
missingRevisionFields?: string[];
|
|
11
|
+
slice?: CreateBatchInferenceRunBodyItemFilterSlice;
|
|
12
|
+
parts?: CreateBatchInferenceRunBodyItemFilterParts;
|
|
13
|
+
excludeParts?: CreateBatchInferenceRunBodyItemFilterExcludePartsItem[];
|
|
14
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { CreateBatchInferenceRunBodyItemFilterFieldSourcesItemSourcesItem } from './createBatchInferenceRunBodyItemFilterFieldSourcesItemSourcesItem';
|
|
2
|
+
|
|
3
|
+
export type CreateBatchInferenceRunBodyItemFilterFieldSourcesItem = {
|
|
4
|
+
fieldId: string;
|
|
5
|
+
sources: CreateBatchInferenceRunBodyItemFilterFieldSourcesItemSourcesItem[];
|
|
6
|
+
};
|
package/openapi/gen/models/createBatchInferenceRunBodyItemFilterFieldSourcesItemSourcesItem.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { CreateBatchInferenceRunBodyItemFilterFieldSourcesItemSourcesItemOneOf } from './createBatchInferenceRunBodyItemFilterFieldSourcesItemSourcesItemOneOf';
|
|
2
|
+
import type { CreateBatchInferenceRunBodyItemFilterFieldSourcesItemSourcesItemOneOfTwo } from './createBatchInferenceRunBodyItemFilterFieldSourcesItemSourcesItemOneOfTwo';
|
|
3
|
+
|
|
4
|
+
export type CreateBatchInferenceRunBodyItemFilterFieldSourcesItemSourcesItem = CreateBatchInferenceRunBodyItemFilterFieldSourcesItemSourcesItemOneOf | CreateBatchInferenceRunBodyItemFilterFieldSourcesItemSourcesItemOneOfTwo;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { CreateBatchInferenceRunBodyItemFilterFieldValuesItemOperator } from './createBatchInferenceRunBodyItemFilterFieldValuesItemOperator';
|
|
2
|
+
import type { CreateBatchInferenceRunBodyItemFilterFieldValuesItemValue } from './createBatchInferenceRunBodyItemFilterFieldValuesItemValue';
|
|
3
|
+
import type { CreateBatchInferenceRunBodyItemFilterFieldValuesItemSourcesItem } from './createBatchInferenceRunBodyItemFilterFieldValuesItemSourcesItem';
|
|
4
|
+
|
|
5
|
+
export type CreateBatchInferenceRunBodyItemFilterFieldValuesItem = {
|
|
6
|
+
jsonPath: string;
|
|
7
|
+
operator: CreateBatchInferenceRunBodyItemFilterFieldValuesItemOperator;
|
|
8
|
+
value: CreateBatchInferenceRunBodyItemFilterFieldValuesItemValue;
|
|
9
|
+
fieldId: string;
|
|
10
|
+
latestOnly?: boolean;
|
|
11
|
+
sources?: CreateBatchInferenceRunBodyItemFilterFieldValuesItemSourcesItem[];
|
|
12
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { CreateBatchInferenceRunBodyItemFilterFieldValuesItemSourcesItemOneOf } from './createBatchInferenceRunBodyItemFilterFieldValuesItemSourcesItemOneOf';
|
|
2
|
+
import type { CreateBatchInferenceRunBodyItemFilterFieldValuesItemSourcesItemOneOfTwo } from './createBatchInferenceRunBodyItemFilterFieldValuesItemSourcesItemOneOfTwo';
|
|
3
|
+
|
|
4
|
+
export type CreateBatchInferenceRunBodyItemFilterFieldValuesItemSourcesItem = CreateBatchInferenceRunBodyItemFilterFieldValuesItemSourcesItemOneOf | CreateBatchInferenceRunBodyItemFilterFieldValuesItemSourcesItemOneOfTwo;
|