@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
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import type { Command } from "commander";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
changeBatchInferenceRun,
|
|
5
|
+
getBatchInferenceRun,
|
|
6
|
+
listBatchInferenceRuns,
|
|
7
|
+
startBatchInferenceRun,
|
|
8
|
+
type StartBatchInferenceRunInput,
|
|
9
|
+
} from "../batch-inference";
|
|
10
|
+
import {
|
|
11
|
+
collectValues,
|
|
12
|
+
nonNegativeInteger,
|
|
13
|
+
partNames,
|
|
14
|
+
positiveInteger,
|
|
15
|
+
resolveContext,
|
|
16
|
+
samplingTemperature,
|
|
17
|
+
samplingTopP,
|
|
18
|
+
type CommandHost,
|
|
19
|
+
} from "../context";
|
|
20
|
+
import { parseBaseModelId } from "../models";
|
|
21
|
+
import { assertProjectSelected } from "../project-context";
|
|
22
|
+
|
|
23
|
+
type RunOptions = Omit<StartBatchInferenceRunInput, "projectId" | "datasetId"> & {
|
|
24
|
+
dataset: string;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export const registerBatchInferenceCommands = (program: Command, host: CommandHost): void => {
|
|
28
|
+
const { context, globals } = host;
|
|
29
|
+
const batchInference = program
|
|
30
|
+
.command("batch-inference")
|
|
31
|
+
.description("answer dataset rows with a base model or Model Version");
|
|
32
|
+
batchInference
|
|
33
|
+
.command("run")
|
|
34
|
+
.requiredOption("--dataset <id>", "Dataset whose chat messages are the prompts")
|
|
35
|
+
.option("--filter <field=value>", "only rows whose field equals the value")
|
|
36
|
+
.option("--slice <id>", "only rows of this ready Dataset Slice, with the prompts it froze")
|
|
37
|
+
.option(
|
|
38
|
+
"--parts <names>",
|
|
39
|
+
"only rows in these split parts, comma-separated, for example test",
|
|
40
|
+
partNames,
|
|
41
|
+
)
|
|
42
|
+
.option(
|
|
43
|
+
"--split-column <name-or-id>",
|
|
44
|
+
"split column that --parts names, when the dataset has more than one",
|
|
45
|
+
)
|
|
46
|
+
.option("--base-model <id>", "catalog Base Model that answers", parseBaseModelId)
|
|
47
|
+
.option("--model-version <id>", "Model Version that answers: mdv.<id> or Model@name")
|
|
48
|
+
.option("--output-field <name>", "text column on the dataset that receives the answers")
|
|
49
|
+
.option("--output-dataset <name>", "new dataset that receives the prompts and answers")
|
|
50
|
+
.requiredOption(
|
|
51
|
+
"--max-output-tokens <count>",
|
|
52
|
+
"token limit per answer, at most 8192",
|
|
53
|
+
positiveInteger,
|
|
54
|
+
)
|
|
55
|
+
.option(
|
|
56
|
+
"--temperature <value>",
|
|
57
|
+
"sampling temperature from 0 to 2 (default 0)",
|
|
58
|
+
samplingTemperature,
|
|
59
|
+
)
|
|
60
|
+
.option("--top-p <value>", "nucleus sampling threshold above 0 and at most 1", samplingTopP)
|
|
61
|
+
.option("--stop <text>", "stop sequence; repeat for up to four", collectValues, [])
|
|
62
|
+
.option("--seed <number>", "sampling seed", nonNegativeInteger)
|
|
63
|
+
.option(
|
|
64
|
+
"--samples-per-row <count>",
|
|
65
|
+
"answers per row, at most 16; above 1 needs --output-dataset and a temperature above 0",
|
|
66
|
+
positiveInteger,
|
|
67
|
+
)
|
|
68
|
+
.option("--idempotency-key <key>", "reuse the run of an earlier identical request")
|
|
69
|
+
.option("--yes", "confirm the quoted maximum charge and start right away", false)
|
|
70
|
+
.option("--json", "print JSON", false)
|
|
71
|
+
.description("quote a Batch Inference Run, then confirm it to start")
|
|
72
|
+
.action(async (options: RunOptions) => {
|
|
73
|
+
const { client, projectId } = await resolveContext(globals(), context);
|
|
74
|
+
assertProjectSelected(projectId);
|
|
75
|
+
const { dataset, ...rest } = options;
|
|
76
|
+
await startBatchInferenceRun(client, { ...rest, projectId, datasetId: dataset }, context.io);
|
|
77
|
+
});
|
|
78
|
+
batchInference
|
|
79
|
+
.command("list")
|
|
80
|
+
.option("--json", "print JSON", false)
|
|
81
|
+
.description("list the selected project's Batch Inference Runs")
|
|
82
|
+
.action(async (options: { json: boolean }) => {
|
|
83
|
+
const { client, projectId } = await resolveContext(globals(), context);
|
|
84
|
+
assertProjectSelected(projectId);
|
|
85
|
+
await listBatchInferenceRuns(client, { projectId, json: options.json }, context.io);
|
|
86
|
+
});
|
|
87
|
+
batchInference
|
|
88
|
+
.command("status")
|
|
89
|
+
.argument("<batch-inference-run-id>", "Batch Inference Run ID")
|
|
90
|
+
.option("--wait", "wait until the run finishes or needs you", false)
|
|
91
|
+
.option("--json", "print JSON", false)
|
|
92
|
+
.description("show one Batch Inference Run")
|
|
93
|
+
.action(async (batchInferenceRunId: string, options: { wait: boolean; json: boolean }) => {
|
|
94
|
+
const { client } = await resolveContext(globals(), context);
|
|
95
|
+
await getBatchInferenceRun(client, { batchInferenceRunId, ...options }, context.io);
|
|
96
|
+
});
|
|
97
|
+
for (const [action, description] of [
|
|
98
|
+
["confirm", "accept the quoted maximum charge and start the run"],
|
|
99
|
+
["resume", "resume a run blocked on funds or payment"],
|
|
100
|
+
["cancel", "cancel a run; answers already generated are kept and the GPU time used is charged"],
|
|
101
|
+
] as const) {
|
|
102
|
+
batchInference
|
|
103
|
+
.command(action)
|
|
104
|
+
.argument("<batch-inference-run-id>", "Batch Inference Run ID")
|
|
105
|
+
.option("--json", "print JSON", false)
|
|
106
|
+
.description(description)
|
|
107
|
+
.action(async (batchInferenceRunId: string, options: { json: boolean }) => {
|
|
108
|
+
const { client } = await resolveContext(globals(), context);
|
|
109
|
+
await changeBatchInferenceRun(
|
|
110
|
+
client,
|
|
111
|
+
{ batchInferenceRunId, action, json: options.json },
|
|
112
|
+
context.io,
|
|
113
|
+
);
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
};
|
package/src/cli/context.ts
CHANGED
|
@@ -97,6 +97,20 @@ export const nonNegativeInteger = (raw: string): number => {
|
|
|
97
97
|
return value;
|
|
98
98
|
};
|
|
99
99
|
|
|
100
|
+
export const samplingTemperature = (raw: string): number => {
|
|
101
|
+
const value = Number(raw);
|
|
102
|
+
if (raw.trim() === "" || !Number.isFinite(value) || value < 0 || value > 2)
|
|
103
|
+
throw new InvalidArgumentError("Expected a temperature from 0 to 2.");
|
|
104
|
+
return value;
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
export const samplingTopP = (raw: string): number => {
|
|
108
|
+
const value = Number(raw);
|
|
109
|
+
if (raw.trim() === "" || !Number.isFinite(value) || value <= 0 || value > 1)
|
|
110
|
+
throw new InvalidArgumentError("Expected a top-p above 0 and at most 1.");
|
|
111
|
+
return value;
|
|
112
|
+
};
|
|
113
|
+
|
|
100
114
|
export const trainingMethod = (raw: string): "sft" | "gisting" => {
|
|
101
115
|
if (raw !== "sft" && raw !== "gisting") {
|
|
102
116
|
throw new InvalidArgumentError('Expected training method "sft" or "gisting".');
|
package/src/cli/models.ts
CHANGED
package/src/cli/program.ts
CHANGED
|
@@ -23,6 +23,7 @@ import { registerSourceCommands } from "./commands/source";
|
|
|
23
23
|
import { registerStatusCommand } from "./commands/status";
|
|
24
24
|
import { registerTrainingCommands } from "./commands/training";
|
|
25
25
|
import { registerUiCommands } from "./commands/ui";
|
|
26
|
+
import { registerBatchInferenceCommands } from "./commands/batch-inference";
|
|
26
27
|
import { registerVersionCommand } from "./commands/version";
|
|
27
28
|
import type { TolokaEnvironment } from "./config";
|
|
28
29
|
import {
|
|
@@ -102,6 +103,7 @@ export function createProgram(context: ProgramContext): CreatedProgram {
|
|
|
102
103
|
registerSecretCommands(program, host);
|
|
103
104
|
registerModelCommands(program, host);
|
|
104
105
|
registerTrainingCommands(program, host);
|
|
106
|
+
registerBatchInferenceCommands(program, host);
|
|
105
107
|
registerDatasetCommands(program, host);
|
|
106
108
|
registerPipelineCommands(program, host);
|
|
107
109
|
registerStatusCommand(program, host);
|
package/src/cli/splits.ts
CHANGED
|
@@ -111,6 +111,46 @@ export const formatSplitColumn = (field: DatasetField, fieldNames: ReadonlyMap<s
|
|
|
111
111
|
return formatTable(rows);
|
|
112
112
|
};
|
|
113
113
|
|
|
114
|
+
export const splitColumnId = async (
|
|
115
|
+
client: Pick<PotatoClient, "datasets">,
|
|
116
|
+
datasetId: string,
|
|
117
|
+
column: string,
|
|
118
|
+
): Promise<string> => {
|
|
119
|
+
for await (const field of client.datasets.listAllFields({ datasetId })) {
|
|
120
|
+
if (field.id === column || field.name === column) {
|
|
121
|
+
assertCli(field.split !== null, `Column ${field.name} is not a split column.`, {
|
|
122
|
+
hint: { description: `Make it one with toloka dataset split ${datasetId} --column ${field.name}.` },
|
|
123
|
+
});
|
|
124
|
+
return field.id;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
assertCli(false, `Dataset ${datasetId} has no column ${column}.`, {
|
|
128
|
+
hint: { description: `List its columns with toloka dataset columns ${datasetId}.` },
|
|
129
|
+
});
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
export const resolveSplitParts = async (
|
|
133
|
+
client: Pick<PotatoClient, "datasets">,
|
|
134
|
+
datasetId: string,
|
|
135
|
+
{ splitColumn, parts }: { splitColumn: string | undefined; parts: string[] },
|
|
136
|
+
): Promise<{ fieldId: string; names: string[] }> => {
|
|
137
|
+
if (splitColumn !== undefined) return { fieldId: await splitColumnId(client, datasetId, splitColumn), names: parts };
|
|
138
|
+
const splitColumns: DatasetField[] = [];
|
|
139
|
+
for await (const field of client.datasets.listAllFields({ datasetId })) {
|
|
140
|
+
if (field.split !== null) splitColumns.push(field);
|
|
141
|
+
}
|
|
142
|
+
const [only, ...others] = splitColumns;
|
|
143
|
+
assertCli(only !== undefined, `Dataset ${datasetId} has no split column.`, {
|
|
144
|
+
hint: { description: `Make one with toloka dataset split ${datasetId}.` },
|
|
145
|
+
});
|
|
146
|
+
assertCli(
|
|
147
|
+
others.length === 0,
|
|
148
|
+
`Dataset ${datasetId} has the split columns ${splitColumns.map((field) => field.name).join(", ")}.`,
|
|
149
|
+
{ hint: { description: "Pass --split-column <name> to choose one." } },
|
|
150
|
+
);
|
|
151
|
+
return { fieldId: only.id, names: parts };
|
|
152
|
+
};
|
|
153
|
+
|
|
114
154
|
export const waitForSplitColumn = async (
|
|
115
155
|
client: SplitApi,
|
|
116
156
|
{ datasetId, field, waitFor }: { datasetId: string; field: DatasetField; waitFor?: WaitForOptions },
|
package/src/cli/trainings.ts
CHANGED
|
@@ -19,7 +19,7 @@ import { assertCli, RETRY_OR_REPORT_HINT, TolokaCliError } from "./cli-error";
|
|
|
19
19
|
import type { CliErrorHint } from "./cli-error";
|
|
20
20
|
import { resolveLiveDataset } from "./data";
|
|
21
21
|
import { formatCount, waitForFilledFields, waitUntilDone } from "./slices";
|
|
22
|
-
import { DEFAULT_SPLIT_COLUMN, waitForSplitColumn } from "./splits";
|
|
22
|
+
import { DEFAULT_SPLIT_COLUMN, splitColumnId, waitForSplitColumn } from "./splits";
|
|
23
23
|
import { uploadedFieldHint } from "./uploaded-fields";
|
|
24
24
|
import { formatTable, type TableIo as TrainingIo, writeOutput } from "./table";
|
|
25
25
|
|
|
@@ -280,24 +280,6 @@ const AUTO_WAIT = { timeoutMs: 10 * 60_000 };
|
|
|
280
280
|
|
|
281
281
|
type ResolvedRows = ResolvedSelections & { readonly notes: readonly string[] };
|
|
282
282
|
|
|
283
|
-
const splitColumnId = async (
|
|
284
|
-
client: TrainingDraftApi,
|
|
285
|
-
datasetId: string,
|
|
286
|
-
column: string,
|
|
287
|
-
): Promise<string> => {
|
|
288
|
-
for await (const field of client.datasets.listAllFields({ datasetId })) {
|
|
289
|
-
if (field.id === column || field.name === column) {
|
|
290
|
-
assertCli(field.split !== null, `Column ${field.name} is not a split column.`, {
|
|
291
|
-
hint: { description: `Make it one with toloka dataset split ${datasetId} --column ${field.name}.` },
|
|
292
|
-
});
|
|
293
|
-
return field.id;
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
assertCli(false, `Dataset ${datasetId} has no column ${column}.`, {
|
|
297
|
-
hint: { description: `List its columns with toloka dataset columns ${datasetId}.` },
|
|
298
|
-
});
|
|
299
|
-
};
|
|
300
|
-
|
|
301
283
|
const fillTrainingSplitColumn = async (
|
|
302
284
|
client: TrainingDraftApi,
|
|
303
285
|
{
|
package/src/client.ts
CHANGED
|
@@ -4,8 +4,10 @@ import * as wire from "../openapi/gen/api";
|
|
|
4
4
|
import type {
|
|
5
5
|
AddDatasetItemsBody,
|
|
6
6
|
AttachPipelineDatasetBody,
|
|
7
|
+
BatchInferenceRun as GeneratedBatchInferenceRun,
|
|
7
8
|
CheckJob as GeneratedCheckJob,
|
|
8
9
|
CopyPipelineBody,
|
|
10
|
+
CreateBatchInferenceRunBody,
|
|
9
11
|
CreateDatasetBody,
|
|
10
12
|
CreateDatasetExportBody,
|
|
11
13
|
CreateDatasetFieldsFromUploadedRowsBody,
|
|
@@ -39,6 +41,7 @@ import type {
|
|
|
39
41
|
ListProjectDatasetsParams,
|
|
40
42
|
ListProjectPipelinesParams,
|
|
41
43
|
ListAudienceSpecializationsParams,
|
|
44
|
+
ListBatchInferenceRunsParams,
|
|
42
45
|
ListProjectModelsParams,
|
|
43
46
|
ListProjectsParams,
|
|
44
47
|
ListProjectTokensParams,
|
|
@@ -85,6 +88,7 @@ declare const __brand: unique symbol;
|
|
|
85
88
|
type Brand<B> = { [__brand]: B };
|
|
86
89
|
export type Branded<T extends string, B> = T & Brand<B>;
|
|
87
90
|
|
|
91
|
+
export type BatchInferenceRunId = Branded<string, "BatchInferenceRunId">;
|
|
88
92
|
export type CheckRunId = Branded<string, "CheckRunId">;
|
|
89
93
|
export type DatasetFieldId = Branded<string, "DatasetFieldId">;
|
|
90
94
|
export type DatasetId = Branded<string, "DatasetId">;
|
|
@@ -108,6 +112,7 @@ type ResourceIdInput<T extends Branded<string, unknown>> = string & {
|
|
|
108
112
|
};
|
|
109
113
|
|
|
110
114
|
type ResourceIdsByProperty = {
|
|
115
|
+
batchInferenceRunId: BatchInferenceRunId;
|
|
111
116
|
checkRunId: CheckRunId;
|
|
112
117
|
datasetFieldId: DatasetFieldId;
|
|
113
118
|
datasetId: DatasetId;
|
|
@@ -164,6 +169,7 @@ type PublicInput<T> = T extends readonly unknown[]
|
|
|
164
169
|
|
|
165
170
|
type BrandResourceUnion<T> = T extends object ? BrandResourceReferences<T> : T;
|
|
166
171
|
|
|
172
|
+
export type BatchInferenceRun = BrandedResource<GeneratedBatchInferenceRun, BatchInferenceRunId>;
|
|
167
173
|
export type CheckJob = BrandedResource<GeneratedCheckJob, CheckRunId>;
|
|
168
174
|
export type Dataset = BrandedResource<GeneratedDataset, DatasetId>;
|
|
169
175
|
export type DatasetField = BrandedResource<GeneratedDatasetField, DatasetFieldId>;
|
|
@@ -592,6 +598,46 @@ const createClientImplementation = (config: ClientConfig) => {
|
|
|
592
598
|
wire.getTrainingRunMetricHistory(trainingRunId, metricKey, params, requestOptions),
|
|
593
599
|
};
|
|
594
600
|
|
|
601
|
+
const batchInference = {
|
|
602
|
+
createRun: ({
|
|
603
|
+
projectId,
|
|
604
|
+
idempotencyKey,
|
|
605
|
+
...body
|
|
606
|
+
}: { projectId: ProjectId; idempotencyKey: string } & CreateBatchInferenceRunBody) => {
|
|
607
|
+
const headers = new Headers(requestOptions.headers);
|
|
608
|
+
headers.set("Idempotency-Key", idempotencyKey);
|
|
609
|
+
return wire.createBatchInferenceRun(projectId, body, {
|
|
610
|
+
...requestOptions,
|
|
611
|
+
headers: Object.fromEntries(headers.entries()),
|
|
612
|
+
});
|
|
613
|
+
},
|
|
614
|
+
listRunsPage: ({
|
|
615
|
+
projectId,
|
|
616
|
+
...params
|
|
617
|
+
}: { projectId: ProjectId } & ListBatchInferenceRunsParams) =>
|
|
618
|
+
wire.listBatchInferenceRuns(projectId, params, requestOptions),
|
|
619
|
+
listAllRuns: ({
|
|
620
|
+
projectId,
|
|
621
|
+
...params
|
|
622
|
+
}: { projectId: ProjectId } & ListBatchInferenceRunsParams) =>
|
|
623
|
+
listAllPages(async (pageOptions) => {
|
|
624
|
+
const page = await wire.listBatchInferenceRuns(
|
|
625
|
+
projectId,
|
|
626
|
+
{ ...params, ...pageOptions },
|
|
627
|
+
requestOptions,
|
|
628
|
+
);
|
|
629
|
+
return { items: page.batchInferenceRuns, pagination: page.pagination };
|
|
630
|
+
}, params),
|
|
631
|
+
getRun: ({ batchInferenceRunId }: { batchInferenceRunId: BatchInferenceRunId }) =>
|
|
632
|
+
wire.getBatchInferenceRun(batchInferenceRunId, requestOptions),
|
|
633
|
+
confirmRun: ({ batchInferenceRunId }: { batchInferenceRunId: BatchInferenceRunId }) =>
|
|
634
|
+
wire.confirmBatchInferenceRun(batchInferenceRunId, requestOptions),
|
|
635
|
+
resumeRun: ({ batchInferenceRunId }: { batchInferenceRunId: BatchInferenceRunId }) =>
|
|
636
|
+
wire.resumeBatchInferenceRun(batchInferenceRunId, requestOptions),
|
|
637
|
+
cancelRun: ({ batchInferenceRunId }: { batchInferenceRunId: BatchInferenceRunId }) =>
|
|
638
|
+
wire.cancelBatchInferenceRun(batchInferenceRunId, requestOptions),
|
|
639
|
+
};
|
|
640
|
+
|
|
595
641
|
const datasets = {
|
|
596
642
|
create: ({ projectId, ...body }: { projectId: ProjectId } & CreateDatasetBody) =>
|
|
597
643
|
wire.createDataset(projectId, body, requestOptions),
|
|
@@ -778,6 +824,7 @@ const createClientImplementation = (config: ClientConfig) => {
|
|
|
778
824
|
generationModels,
|
|
779
825
|
models,
|
|
780
826
|
trainings,
|
|
827
|
+
batchInference,
|
|
781
828
|
runs,
|
|
782
829
|
secrets,
|
|
783
830
|
files,
|
|
@@ -807,6 +854,8 @@ type PublicOutput<T> = T extends GeneratedCheckJob
|
|
|
807
854
|
? TrainingCostEstimate
|
|
808
855
|
: T extends GeneratedTrainingRun
|
|
809
856
|
? TrainingRun
|
|
857
|
+
: T extends GeneratedBatchInferenceRun
|
|
858
|
+
? BatchInferenceRun
|
|
810
859
|
: T extends GeneratedProject
|
|
811
860
|
? Project
|
|
812
861
|
: T extends GeneratedPipeline
|
|
@@ -1535,7 +1535,7 @@
|
|
|
1535
1535
|
"values": []
|
|
1536
1536
|
}
|
|
1537
1537
|
},
|
|
1538
|
-
"pricePerTask":
|
|
1538
|
+
"pricePerTask": 6,
|
|
1539
1539
|
"timeForTask": 1800,
|
|
1540
1540
|
"perExpertCapEnabled": false,
|
|
1541
1541
|
"perExpertCapValue": 1
|
|
@@ -2663,7 +2663,7 @@
|
|
|
2663
2663
|
"values": []
|
|
2664
2664
|
}
|
|
2665
2665
|
},
|
|
2666
|
-
"pricePerTask":
|
|
2666
|
+
"pricePerTask": 6,
|
|
2667
2667
|
"timeForTask": 1800,
|
|
2668
2668
|
"perExpertCapEnabled": false,
|
|
2669
2669
|
"perExpertCapValue": 1
|