@toloka-platform/sdk 0.26.2 → 0.27.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/README.md +2 -2
- package/dist/cli/toloka.js +180 -191
- 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/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 +5 -1
- package/examples/video-pair-rating/nodes/rate_pair/node.ts +5 -1
- package/openapi/gen/api.schemas.ts +52 -756
- package/openapi/gen/api.ts +0 -860
- package/package.json +2 -2
- package/skills/catalog.json +6 -40
- package/skills/toloka-build/references/human-work.md +42 -7
- package/skills/toloka-build/references/local-setup.md +2 -2
- package/skills/toloka-build/references/workflow-and-cli.md +3 -22
- package/skills/toloka-get-started/SKILL.md +9 -13
- package/src/authoring/index.ts +34 -3
- package/src/cli/analytics.ts +0 -31
- package/src/cli/context.ts +0 -109
- package/src/cli/init.ts +1 -1
- package/src/cli/program.ts +0 -6
- package/src/cli/project.ts +9 -1
- package/src/client.ts +0 -259
- package/src/importer.ts +88 -6
- package/src/index.ts +2 -2
- package/src/pipeline-graph-v1.contract.json +130 -101
- package/skills/toloka-fine-tuning/SKILL.md +0 -177
- package/skills/toloka-gisting/SKILL.md +0 -186
- package/src/cli/batch-inference.ts +0 -267
- package/src/cli/commands/batch-inference.ts +0 -116
- package/src/cli/commands/models.ts +0 -121
- package/src/cli/commands/training.ts +0 -275
- package/src/cli/models.ts +0 -304
- package/src/cli/trainings.ts +0 -880
package/src/cli/context.ts
CHANGED
|
@@ -22,7 +22,6 @@ import { findCommandCredentials } from "./credentials";
|
|
|
22
22
|
import type { StoredCredentials } from "./credentials";
|
|
23
23
|
import { resolveProjectContext } from "./project-context";
|
|
24
24
|
import { findSourceRoot } from "./source";
|
|
25
|
-
import type { TrainingDraftOptions } from "./trainings";
|
|
26
25
|
import type { RunOutcome } from "./runs";
|
|
27
26
|
|
|
28
27
|
export type CliIo = {
|
|
@@ -97,48 +96,6 @@ export const nonNegativeInteger = (raw: string): number => {
|
|
|
97
96
|
return value;
|
|
98
97
|
};
|
|
99
98
|
|
|
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
|
-
|
|
114
|
-
export const trainingMethod = (raw: string): "sft" | "gisting" => {
|
|
115
|
-
if (raw !== "sft" && raw !== "gisting") {
|
|
116
|
-
throw new InvalidArgumentError('Expected training method "sft" or "gisting".');
|
|
117
|
-
}
|
|
118
|
-
return raw;
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
export const trainingLoraRank = (raw: string): 8 | 16 | 32 => {
|
|
122
|
-
const value = Number(raw);
|
|
123
|
-
if (value !== 8 && value !== 16 && value !== 32) {
|
|
124
|
-
throw new InvalidArgumentError("Expected a LoRA rank of 8, 16, or 32.");
|
|
125
|
-
}
|
|
126
|
-
return value;
|
|
127
|
-
};
|
|
128
|
-
|
|
129
|
-
export const trainingGistTokens = (raw: string): 8 | 32 | 64 | "1/4" | "1/8" | "1/16" | "1/32" => {
|
|
130
|
-
if (raw === "1/4" || raw === "1/8" || raw === "1/16" || raw === "1/32") {
|
|
131
|
-
return raw;
|
|
132
|
-
}
|
|
133
|
-
const value = Number(raw);
|
|
134
|
-
if (value !== 8 && value !== 32 && value !== 64) {
|
|
135
|
-
throw new InvalidArgumentError(
|
|
136
|
-
'Expected 8, 32, or 64 gist tokens, or a fraction of the prompt: "1/4", "1/8", "1/16", or "1/32".',
|
|
137
|
-
);
|
|
138
|
-
}
|
|
139
|
-
return value;
|
|
140
|
-
};
|
|
141
|
-
|
|
142
99
|
export const splitRatios = (raw: string): { train: number; validate: number; test: number } => {
|
|
143
100
|
const parts = raw.split("/").map(Number);
|
|
144
101
|
const [train, validate, test] = parts;
|
|
@@ -221,72 +178,6 @@ export const splitSeed = (raw: string): number => {
|
|
|
221
178
|
return value;
|
|
222
179
|
};
|
|
223
180
|
|
|
224
|
-
export const trainingEpochs = (raw: string): number => {
|
|
225
|
-
const value = Number(raw);
|
|
226
|
-
if (!Number.isInteger(value) || value < 1 || value > 5) {
|
|
227
|
-
throw new InvalidArgumentError("Expected epochs from 1 through 5.");
|
|
228
|
-
}
|
|
229
|
-
return value;
|
|
230
|
-
};
|
|
231
|
-
|
|
232
|
-
export const trainingLearningRate = (raw: string): number => {
|
|
233
|
-
const value = Number(raw);
|
|
234
|
-
if (!Number.isFinite(value) || value <= 0) {
|
|
235
|
-
throw new InvalidArgumentError("Expected a positive learning rate, for example 0.00015.");
|
|
236
|
-
}
|
|
237
|
-
return value;
|
|
238
|
-
};
|
|
239
|
-
|
|
240
|
-
export const trainingBatchSize = (raw: string): 8 | 16 | 32 | 64 => {
|
|
241
|
-
const value = Number(raw);
|
|
242
|
-
if (value !== 8 && value !== 16 && value !== 32 && value !== 64) {
|
|
243
|
-
throw new InvalidArgumentError("Expected a batch size of 8, 16, 32, or 64.");
|
|
244
|
-
}
|
|
245
|
-
return value;
|
|
246
|
-
};
|
|
247
|
-
|
|
248
|
-
export const trainingMaxSequenceLength = (raw: string): number => {
|
|
249
|
-
const value = Number(raw);
|
|
250
|
-
if (!Number.isInteger(value) || value < 64 || value > 16384) {
|
|
251
|
-
throw new InvalidArgumentError("Expected a maximum sequence length from 64 through 16384 tokens.");
|
|
252
|
-
}
|
|
253
|
-
return value;
|
|
254
|
-
};
|
|
255
|
-
|
|
256
|
-
export type RawTrainingDraftOptions = {
|
|
257
|
-
method?: TrainingDraftOptions["method"];
|
|
258
|
-
baseModel?: TrainingDraftOptions["baseModelId"];
|
|
259
|
-
modelVersion?: string;
|
|
260
|
-
dataset?: string;
|
|
261
|
-
slice?: string;
|
|
262
|
-
splitColumn?: string;
|
|
263
|
-
parts?: string[];
|
|
264
|
-
loraRank?: TrainingDraftOptions["loraRank"];
|
|
265
|
-
gistTokens?: TrainingDraftOptions["gistTokens"];
|
|
266
|
-
epochs?: number;
|
|
267
|
-
learningRate?: number;
|
|
268
|
-
batchSize?: TrainingDraftOptions["batchSize"];
|
|
269
|
-
maxSequenceLength?: number;
|
|
270
|
-
promptFile?: string;
|
|
271
|
-
};
|
|
272
|
-
|
|
273
|
-
export const trainingDraftOptions = (options: RawTrainingDraftOptions): TrainingDraftOptions => ({
|
|
274
|
-
method: options.method,
|
|
275
|
-
baseModelId: options.baseModel,
|
|
276
|
-
modelVersionId: options.modelVersion,
|
|
277
|
-
datasetName: options.dataset,
|
|
278
|
-
sliceId: options.slice,
|
|
279
|
-
splitColumn: options.splitColumn,
|
|
280
|
-
trainParts: options.parts,
|
|
281
|
-
loraRank: options.loraRank,
|
|
282
|
-
gistTokens: options.gistTokens,
|
|
283
|
-
epochs: options.epochs,
|
|
284
|
-
learningRate: options.learningRate,
|
|
285
|
-
batchSize: options.batchSize,
|
|
286
|
-
maxSequenceLength: options.maxSequenceLength,
|
|
287
|
-
promptFilePath: options.promptFile,
|
|
288
|
-
});
|
|
289
|
-
|
|
290
181
|
export const exitCodeForOutcome = (outcome: RunOutcome): number => {
|
|
291
182
|
if (outcome === "failed") return 1;
|
|
292
183
|
if (outcome === "timedOut") return 2;
|
package/src/cli/init.ts
CHANGED
|
@@ -280,7 +280,7 @@ export async function initProject(
|
|
|
280
280
|
];
|
|
281
281
|
const warning = dependencyReady
|
|
282
282
|
? undefined
|
|
283
|
-
: `Warning: ${SDK_PACKAGE_NAME} is not listed in dependencies or devDependencies in ${join(targetRoot, "package.json")}. Install it with npm or Bun before authoring pipelines, then re-run \`toloka init
|
|
283
|
+
: `Warning: ${SDK_PACKAGE_NAME} is not listed in dependencies or devDependencies in ${join(targetRoot, "package.json")}. Install it with npm or Bun before authoring pipelines, then re-run \`toloka init\`.`;
|
|
284
284
|
return {
|
|
285
285
|
targetDirectory: targetRoot,
|
|
286
286
|
files,
|
package/src/cli/program.ts
CHANGED
|
@@ -13,7 +13,6 @@ import { registerConfigCommands } from "./commands/config";
|
|
|
13
13
|
import { registerDatasetCommands } from "./commands/dataset";
|
|
14
14
|
import { registerGenerationModelCommands } from "./commands/generation-model";
|
|
15
15
|
import { registerDeliveryOrderCommands } from "./commands/delivery-order";
|
|
16
|
-
import { registerModelCommands } from "./commands/models";
|
|
17
16
|
import { registerPipelineCommands } from "./commands/pipeline";
|
|
18
17
|
import { registerProjectCommands } from "./commands/project";
|
|
19
18
|
import { registerReportCommand } from "./commands/report";
|
|
@@ -25,9 +24,7 @@ import { registerSecretCommands } from "./commands/secret";
|
|
|
25
24
|
import { registerSkillCommands } from "./commands/skill";
|
|
26
25
|
import { registerSourceCommands } from "./commands/source";
|
|
27
26
|
import { registerStatusCommand } from "./commands/status";
|
|
28
|
-
import { registerTrainingCommands } from "./commands/training";
|
|
29
27
|
import { registerUiCommands } from "./commands/ui";
|
|
30
|
-
import { registerBatchInferenceCommands } from "./commands/batch-inference";
|
|
31
28
|
import { registerVersionCommand } from "./commands/version";
|
|
32
29
|
import type { TolokaEnvironment } from "./config";
|
|
33
30
|
import {
|
|
@@ -110,9 +107,6 @@ export function createProgram(context: ProgramContext): CreatedProgram {
|
|
|
110
107
|
registerSecretCommands(program, host);
|
|
111
108
|
registerExpertListCommands(program, host);
|
|
112
109
|
registerExpertBanListCommands(program, host);
|
|
113
|
-
registerModelCommands(program, host);
|
|
114
|
-
registerTrainingCommands(program, host);
|
|
115
|
-
registerBatchInferenceCommands(program, host);
|
|
116
110
|
registerDatasetCommands(program, host);
|
|
117
111
|
registerPipelineCommands(program, host);
|
|
118
112
|
registerReviewCommands(program, host);
|
package/src/cli/project.ts
CHANGED
|
@@ -247,6 +247,14 @@ const withoutEmptyEntityRelations = (node: unknown): unknown => {
|
|
|
247
247
|
};
|
|
248
248
|
};
|
|
249
249
|
|
|
250
|
+
const withoutIgnoredSettings = (node: PipelineGraphV1["nodes"][number]): unknown => {
|
|
251
|
+
if (node.type !== "generation" && node.type !== "quorum") return node;
|
|
252
|
+
|
|
253
|
+
const { reuseAudienceWithNodeId: _reuseAudienceWithNodeId, smartSearch: _smartSearch, ...settings } = node.settings;
|
|
254
|
+
|
|
255
|
+
return { ...node, settings };
|
|
256
|
+
};
|
|
257
|
+
|
|
250
258
|
const withAudienceSourcingDefaults = (node: PipelineGraphV1["nodes"][number]): unknown => {
|
|
251
259
|
if (node.type !== "generation" && node.type !== "quorum") return node;
|
|
252
260
|
|
|
@@ -357,7 +365,7 @@ export function diffPipelineGraphs(
|
|
|
357
365
|
liveNodes,
|
|
358
366
|
(authored, live) =>
|
|
359
367
|
matchesAuthored(
|
|
360
|
-
withoutEmptyEntityRelations(withCanonicalExpertListConditions(authored)),
|
|
368
|
+
withoutEmptyEntityRelations(withCanonicalExpertListConditions(withoutIgnoredSettings(authored))),
|
|
361
369
|
withoutEmptyEntityRelations(
|
|
362
370
|
withCanonicalExpertListConditions(withAudienceSourcingDefaults(live)),
|
|
363
371
|
),
|
package/src/client.ts
CHANGED
|
@@ -13,19 +13,14 @@ import type {
|
|
|
13
13
|
RemoveExpertBanListExpertsBody,
|
|
14
14
|
UpdateExpertListBody,
|
|
15
15
|
AttachPipelineDatasetBody,
|
|
16
|
-
BatchInferenceRun as GeneratedBatchInferenceRun,
|
|
17
16
|
CancelPipelineRunBody,
|
|
18
17
|
CheckJob as GeneratedCheckJob,
|
|
19
18
|
CopyPipelineBody,
|
|
20
|
-
CreateBatchInferenceRunBody,
|
|
21
19
|
CreateDatasetBody,
|
|
22
20
|
CreateDatasetExportBody,
|
|
23
21
|
CreateDatasetFieldsFromUploadedRowsBody,
|
|
24
22
|
CreateDatasetSliceBody,
|
|
25
|
-
CreateTrainingRunBody,
|
|
26
|
-
CreateProjectModelBody,
|
|
27
23
|
CreateDatasetFieldBody,
|
|
28
|
-
CreateProjectTrainingBody,
|
|
29
24
|
CreateDatasetUploadBody,
|
|
30
25
|
CreatePipelineCheckBody,
|
|
31
26
|
CreateProjectBody,
|
|
@@ -36,15 +31,11 @@ import type {
|
|
|
36
31
|
DatasetItem as GeneratedDatasetItem,
|
|
37
32
|
DatasetSlice as GeneratedDatasetSlice,
|
|
38
33
|
ExportJob as GeneratedExportJob,
|
|
39
|
-
EstimateTrainingCostBody,
|
|
40
34
|
EstimatePipelineCostBody,
|
|
41
35
|
ImportPipelineBody,
|
|
42
36
|
InferredField as GeneratedInferredField,
|
|
43
|
-
GetTrainingRunLogsParams,
|
|
44
|
-
GetTrainingRunMetricHistoryParams,
|
|
45
37
|
ListDatasetFieldsParams,
|
|
46
38
|
ListDatasetSlicesParams,
|
|
47
|
-
ListModelVersionsParams,
|
|
48
39
|
ListDatasetItemsParams,
|
|
49
40
|
ListPipelineRunItemsParams,
|
|
50
41
|
ListPipelineRunReviewsParams,
|
|
@@ -52,27 +43,11 @@ import type {
|
|
|
52
43
|
ListProjectDatasetsParams,
|
|
53
44
|
ListProjectPipelinesParams,
|
|
54
45
|
ListAudienceSpecializationsParams,
|
|
55
|
-
ListBatchInferenceRunsParams,
|
|
56
|
-
ListProjectModelsParams,
|
|
57
46
|
ListProjectsParams,
|
|
58
47
|
ListProjectTokensParams,
|
|
59
|
-
ListTrainingRunsParams,
|
|
60
|
-
ListProjectTrainingsParams,
|
|
61
48
|
Pipeline as GeneratedPipeline,
|
|
62
|
-
Model as GeneratedModel,
|
|
63
|
-
ModelVersion as GeneratedModelVersion,
|
|
64
|
-
PrepareTrainingCostEstimateInputsBody,
|
|
65
49
|
PatchPipelineNodeBody,
|
|
66
50
|
SplitDatasetBody,
|
|
67
|
-
Training as GeneratedTraining,
|
|
68
|
-
TrainingCostEstimate as GeneratedTrainingCostEstimate,
|
|
69
|
-
TrainingCostEstimateInputSet as GeneratedTrainingCostEstimateInputSet,
|
|
70
|
-
TrainingRun as GeneratedTrainingRun,
|
|
71
|
-
TrainingRunMetricHistory as GeneratedTrainingRunMetricHistory,
|
|
72
|
-
TrainingRunMetrics as GeneratedTrainingRunMetrics,
|
|
73
|
-
TrainingRunLogs as GeneratedTrainingRunLogs,
|
|
74
|
-
ReplaceTrainingConfigurationBody,
|
|
75
|
-
UpdateTrainingMetadataBody,
|
|
76
51
|
PipelineGraphSnapshot,
|
|
77
52
|
Project as GeneratedProject,
|
|
78
53
|
ProjectFile as GeneratedProjectFile,
|
|
@@ -85,8 +60,6 @@ import type {
|
|
|
85
60
|
RunJob as GeneratedRunJob,
|
|
86
61
|
RunSummary as GeneratedRunSummary,
|
|
87
62
|
SetProjectSecretBody,
|
|
88
|
-
BaseModel as GeneratedBaseModel,
|
|
89
|
-
BaseModelId as GeneratedBaseModelId,
|
|
90
63
|
UpdatePipelineBody,
|
|
91
64
|
UpdateProjectBody,
|
|
92
65
|
JsonValue as GeneratedJsonValue,
|
|
@@ -104,18 +77,12 @@ type Brand<B> = { [__brand]: B };
|
|
|
104
77
|
type CreateDatasetFieldInput = Exclude<CreateDatasetFieldBody, { fields: unknown }>;
|
|
105
78
|
export type Branded<T extends string, B> = T & Brand<B>;
|
|
106
79
|
|
|
107
|
-
export type BatchInferenceRunId = Branded<string, "BatchInferenceRunId">;
|
|
108
80
|
export type CheckRunId = Branded<string, "CheckRunId">;
|
|
109
81
|
export type DatasetFieldId = Branded<string, "DatasetFieldId">;
|
|
110
82
|
export type DatasetId = Branded<string, "DatasetId">;
|
|
111
83
|
export type DatasetItemId = Branded<string, "DatasetItemId">;
|
|
112
84
|
export type DatasetSliceId = Branded<string, "DatasetSliceId">;
|
|
113
85
|
export type ExportId = Branded<string, "ExportId">;
|
|
114
|
-
export type ModelId = Branded<string, "ModelId">;
|
|
115
|
-
export type ModelVersionId = Branded<string, "ModelVersionId">;
|
|
116
|
-
export type TrainingId = Branded<string, "TrainingId">;
|
|
117
|
-
export type TrainingCostEstimateInputSetId = Branded<string, "TrainingCostEstimateInputSetId">;
|
|
118
|
-
export type TrainingRunId = Branded<string, "TrainingRunId">;
|
|
119
86
|
export type PipelineId = Branded<string, "PipelineId">;
|
|
120
87
|
export type ProjectFileId = Branded<string, "ProjectFileId">;
|
|
121
88
|
export type ProjectId = Branded<string, "ProjectId">;
|
|
@@ -129,7 +96,6 @@ type ResourceIdInput<T extends Branded<string, unknown>> = string & {
|
|
|
129
96
|
};
|
|
130
97
|
|
|
131
98
|
type ResourceIdsByProperty = {
|
|
132
|
-
batchInferenceRunId: BatchInferenceRunId;
|
|
133
99
|
checkRunId: CheckRunId;
|
|
134
100
|
datasetFieldId: DatasetFieldId;
|
|
135
101
|
datasetId: DatasetId;
|
|
@@ -137,11 +103,6 @@ type ResourceIdsByProperty = {
|
|
|
137
103
|
exportId: ExportId;
|
|
138
104
|
fieldId: DatasetFieldId;
|
|
139
105
|
fileId: ProjectFileId;
|
|
140
|
-
modelId: ModelId;
|
|
141
|
-
modelVersionId: ModelVersionId;
|
|
142
|
-
trainingId: TrainingId;
|
|
143
|
-
inputSetId: TrainingCostEstimateInputSetId;
|
|
144
|
-
trainingRunId: TrainingRunId;
|
|
145
106
|
goldenDatasetId: DatasetId;
|
|
146
107
|
itemId: RunItemId;
|
|
147
108
|
fromSliceId: DatasetSliceId;
|
|
@@ -189,9 +150,6 @@ type PublicInput<T> = IsJsonValue<T> extends true
|
|
|
189
150
|
}
|
|
190
151
|
: T;
|
|
191
152
|
|
|
192
|
-
type BrandResourceUnion<T> = T extends object ? BrandResourceReferences<T> : T;
|
|
193
|
-
|
|
194
|
-
export type BatchInferenceRun = BrandedResource<GeneratedBatchInferenceRun, BatchInferenceRunId>;
|
|
195
153
|
export type CheckJob = BrandedResource<GeneratedCheckJob, CheckRunId>;
|
|
196
154
|
export type Dataset = BrandedResource<GeneratedDataset, DatasetId>;
|
|
197
155
|
export type DatasetField = BrandedResource<GeneratedDatasetField, DatasetFieldId>;
|
|
@@ -199,20 +157,6 @@ export type DatasetItem = BrandedResource<GeneratedDatasetItem, DatasetItemId>;
|
|
|
199
157
|
export type DatasetSlice = BrandedResource<GeneratedDatasetSlice, DatasetSliceId>;
|
|
200
158
|
export type ExportJob = BrandedResource<GeneratedExportJob, ExportId>;
|
|
201
159
|
export type InferredField = GeneratedInferredField;
|
|
202
|
-
export type Model = BrandedResource<GeneratedModel, ModelId>;
|
|
203
|
-
export type ModelVersion = BrandedResource<GeneratedModelVersion, ModelVersionId>;
|
|
204
|
-
export type Training = BrandedResource<GeneratedTraining, TrainingId>;
|
|
205
|
-
export type TrainingCostEstimateInputSet = BrandedResource<
|
|
206
|
-
GeneratedTrainingCostEstimateInputSet,
|
|
207
|
-
TrainingCostEstimateInputSetId
|
|
208
|
-
>;
|
|
209
|
-
export type TrainingCostEstimate = BrandResourceUnion<GeneratedTrainingCostEstimate>;
|
|
210
|
-
export type TrainingRun = BrandedResource<GeneratedTrainingRun, TrainingRunId>;
|
|
211
|
-
export type TrainingRunLogs = GeneratedTrainingRunLogs;
|
|
212
|
-
export type TrainingRunMetrics = GeneratedTrainingRunMetrics;
|
|
213
|
-
export type TrainingRunMetricHistory = GeneratedTrainingRunMetricHistory;
|
|
214
|
-
export type BaseModel = GeneratedBaseModel;
|
|
215
|
-
export type BaseModelId = GeneratedBaseModelId;
|
|
216
160
|
export type Pipeline = BrandedResource<GeneratedPipeline, PipelineId>;
|
|
217
161
|
export type Project = BrandedResource<GeneratedProject, ProjectId>;
|
|
218
162
|
export type ProjectFile = BrandedResource<GeneratedProjectFile, ProjectFileId>;
|
|
@@ -477,191 +421,6 @@ const createClientImplementation = (config: ClientConfig) => {
|
|
|
477
421
|
wire.copyPipeline(pipelineId, body, requestOptions),
|
|
478
422
|
};
|
|
479
423
|
|
|
480
|
-
const baseModels = {
|
|
481
|
-
list: async () => (await wire.listBaseModels(requestOptions)).baseModels,
|
|
482
|
-
get: ({ id }: { id: BaseModelId }) => wire.getBaseModel(id, requestOptions),
|
|
483
|
-
};
|
|
484
|
-
|
|
485
|
-
const models = {
|
|
486
|
-
listPage: ({ projectId, ...params }: { projectId: ProjectId } & ListProjectModelsParams) =>
|
|
487
|
-
wire.listProjectModels(projectId, params, requestOptions),
|
|
488
|
-
listAll: ({ projectId, ...params }: { projectId: ProjectId } & ListProjectModelsParams) =>
|
|
489
|
-
listAllPages(async (pageOptions) => {
|
|
490
|
-
const page = await wire.listProjectModels(
|
|
491
|
-
projectId,
|
|
492
|
-
{ ...params, ...pageOptions },
|
|
493
|
-
requestOptions,
|
|
494
|
-
);
|
|
495
|
-
return { items: page.models, pagination: page.pagination };
|
|
496
|
-
}, params),
|
|
497
|
-
get: ({ projectId, modelId }: { projectId: ProjectId; modelId: ModelId }) =>
|
|
498
|
-
wire.getProjectModel(projectId, modelId, requestOptions),
|
|
499
|
-
listVersionsPage: ({
|
|
500
|
-
projectId,
|
|
501
|
-
modelId,
|
|
502
|
-
...params
|
|
503
|
-
}: { projectId: ProjectId; modelId: ModelId } & ListModelVersionsParams) =>
|
|
504
|
-
wire.listModelVersions(projectId, modelId, params, requestOptions),
|
|
505
|
-
listAllVersions: ({
|
|
506
|
-
projectId,
|
|
507
|
-
modelId,
|
|
508
|
-
...params
|
|
509
|
-
}: { projectId: ProjectId; modelId: ModelId } & ListModelVersionsParams) =>
|
|
510
|
-
listAllPages(async (pageOptions) => {
|
|
511
|
-
const page = await wire.listModelVersions(
|
|
512
|
-
projectId,
|
|
513
|
-
modelId,
|
|
514
|
-
{ ...params, ...pageOptions },
|
|
515
|
-
requestOptions,
|
|
516
|
-
);
|
|
517
|
-
return { items: page.versions, pagination: page.pagination };
|
|
518
|
-
}, params),
|
|
519
|
-
create: ({ projectId, ...body }: { projectId: ProjectId } & CreateProjectModelBody) =>
|
|
520
|
-
wire.createProjectModel(projectId, body, requestOptions),
|
|
521
|
-
getVersion: ({ modelVersionId }: { modelVersionId: ModelVersionId }) =>
|
|
522
|
-
wire.getModelVersion(modelVersionId, requestOptions),
|
|
523
|
-
getVersionContent: ({ modelVersionId }: { modelVersionId: ModelVersionId }) =>
|
|
524
|
-
wire.getModelVersionContent(modelVersionId, requestOptions),
|
|
525
|
-
archive: ({ projectId, modelId }: { projectId: ProjectId; modelId: ModelId }) => {
|
|
526
|
-
const headers = new Headers(requestOptions.headers);
|
|
527
|
-
headers.set("Content-Type", "application/json");
|
|
528
|
-
return wire.archiveProjectModel(projectId, modelId, { ...requestOptions, headers });
|
|
529
|
-
},
|
|
530
|
-
};
|
|
531
|
-
|
|
532
|
-
const trainings = {
|
|
533
|
-
listPage: ({ projectId, ...params }: { projectId: ProjectId } & ListProjectTrainingsParams) =>
|
|
534
|
-
wire.listProjectTrainings(projectId, params, requestOptions),
|
|
535
|
-
listAll: ({ projectId, ...params }: { projectId: ProjectId } & ListProjectTrainingsParams) =>
|
|
536
|
-
listAllPages(async (pageOptions) => {
|
|
537
|
-
const page = await wire.listProjectTrainings(
|
|
538
|
-
projectId,
|
|
539
|
-
{ ...params, ...pageOptions },
|
|
540
|
-
requestOptions,
|
|
541
|
-
);
|
|
542
|
-
return { items: page.trainings, pagination: page.pagination };
|
|
543
|
-
}, params),
|
|
544
|
-
get: ({ trainingId }: { trainingId: TrainingId }) =>
|
|
545
|
-
wire.getTraining(trainingId, requestOptions),
|
|
546
|
-
create: ({ projectId, ...body }: { projectId: ProjectId } & CreateProjectTrainingBody) =>
|
|
547
|
-
wire.createProjectTraining(projectId, body, requestOptions),
|
|
548
|
-
updateMetadata: ({
|
|
549
|
-
trainingId,
|
|
550
|
-
...body
|
|
551
|
-
}: { trainingId: TrainingId } & UpdateTrainingMetadataBody) =>
|
|
552
|
-
wire.updateTrainingMetadata(trainingId, body, requestOptions),
|
|
553
|
-
replaceConfiguration: ({
|
|
554
|
-
trainingId,
|
|
555
|
-
...body
|
|
556
|
-
}: { trainingId: TrainingId } & ReplaceTrainingConfigurationBody) =>
|
|
557
|
-
wire.replaceTrainingConfiguration(trainingId, body, requestOptions),
|
|
558
|
-
prepareCostEstimateInputs: ({
|
|
559
|
-
trainingId,
|
|
560
|
-
idempotencyKey,
|
|
561
|
-
...body
|
|
562
|
-
}: {
|
|
563
|
-
trainingId: TrainingId;
|
|
564
|
-
idempotencyKey: string;
|
|
565
|
-
} & PrepareTrainingCostEstimateInputsBody) => {
|
|
566
|
-
const headers = new Headers(requestOptions.headers);
|
|
567
|
-
headers.set("Idempotency-Key", idempotencyKey);
|
|
568
|
-
return wire.prepareTrainingCostEstimateInputs(trainingId, body, {
|
|
569
|
-
...requestOptions,
|
|
570
|
-
headers: Object.fromEntries(headers.entries()),
|
|
571
|
-
});
|
|
572
|
-
},
|
|
573
|
-
estimateCost: ({
|
|
574
|
-
trainingId,
|
|
575
|
-
...body
|
|
576
|
-
}: { trainingId: TrainingId } & EstimateTrainingCostBody) =>
|
|
577
|
-
wire.estimateTrainingCost(trainingId, body, requestOptions),
|
|
578
|
-
resumeRun: ({ trainingRunId }: { trainingRunId: TrainingRunId }) =>
|
|
579
|
-
wire.resumeTrainingRun(trainingRunId, requestOptions),
|
|
580
|
-
cancelRun: ({ trainingRunId }: { trainingRunId: TrainingRunId }) =>
|
|
581
|
-
wire.cancelTrainingRun(trainingRunId, requestOptions),
|
|
582
|
-
createRun: ({
|
|
583
|
-
trainingId,
|
|
584
|
-
idempotencyKey,
|
|
585
|
-
...body
|
|
586
|
-
}: { trainingId: TrainingId; idempotencyKey: string } & CreateTrainingRunBody) => {
|
|
587
|
-
const headers = new Headers(requestOptions.headers);
|
|
588
|
-
headers.set("Idempotency-Key", idempotencyKey);
|
|
589
|
-
return wire.createTrainingRun(trainingId, body, {
|
|
590
|
-
...requestOptions,
|
|
591
|
-
headers: Object.fromEntries(headers.entries()),
|
|
592
|
-
});
|
|
593
|
-
},
|
|
594
|
-
listRunsPage: ({
|
|
595
|
-
trainingId,
|
|
596
|
-
...params
|
|
597
|
-
}: { trainingId: TrainingId } & ListTrainingRunsParams) =>
|
|
598
|
-
wire.listTrainingRuns(trainingId, params, requestOptions),
|
|
599
|
-
listAllRuns: ({ trainingId, ...params }: { trainingId: TrainingId } & ListTrainingRunsParams) =>
|
|
600
|
-
listAllPages(async (pageOptions) => {
|
|
601
|
-
const page = await wire.listTrainingRuns(
|
|
602
|
-
trainingId,
|
|
603
|
-
{ ...params, ...pageOptions },
|
|
604
|
-
requestOptions,
|
|
605
|
-
);
|
|
606
|
-
return { items: page.trainingRuns, pagination: page.pagination };
|
|
607
|
-
}, params),
|
|
608
|
-
getRun: ({ trainingRunId }: { trainingRunId: TrainingRunId }) =>
|
|
609
|
-
wire.getTrainingRun(trainingRunId, requestOptions),
|
|
610
|
-
getRunLogs: ({
|
|
611
|
-
trainingRunId,
|
|
612
|
-
...params
|
|
613
|
-
}: { trainingRunId: TrainingRunId } & GetTrainingRunLogsParams) =>
|
|
614
|
-
wire.getTrainingRunLogs(trainingRunId, params, requestOptions),
|
|
615
|
-
getRunMetrics: ({ trainingRunId }: { trainingRunId: TrainingRunId }) =>
|
|
616
|
-
wire.getTrainingRunMetrics(trainingRunId, requestOptions),
|
|
617
|
-
getRunMetricHistory: ({
|
|
618
|
-
trainingRunId,
|
|
619
|
-
metricKey,
|
|
620
|
-
...params
|
|
621
|
-
}: { trainingRunId: TrainingRunId; metricKey: string } & GetTrainingRunMetricHistoryParams) =>
|
|
622
|
-
wire.getTrainingRunMetricHistory(trainingRunId, metricKey, params, requestOptions),
|
|
623
|
-
};
|
|
624
|
-
|
|
625
|
-
const batchInference = {
|
|
626
|
-
createRun: ({
|
|
627
|
-
projectId,
|
|
628
|
-
idempotencyKey,
|
|
629
|
-
...body
|
|
630
|
-
}: { projectId: ProjectId; idempotencyKey: string } & CreateBatchInferenceRunBody) => {
|
|
631
|
-
const headers = new Headers(requestOptions.headers);
|
|
632
|
-
headers.set("Idempotency-Key", idempotencyKey);
|
|
633
|
-
return wire.createBatchInferenceRun(projectId, body, {
|
|
634
|
-
...requestOptions,
|
|
635
|
-
headers: Object.fromEntries(headers.entries()),
|
|
636
|
-
});
|
|
637
|
-
},
|
|
638
|
-
listRunsPage: ({
|
|
639
|
-
projectId,
|
|
640
|
-
...params
|
|
641
|
-
}: { projectId: ProjectId } & ListBatchInferenceRunsParams) =>
|
|
642
|
-
wire.listBatchInferenceRuns(projectId, params, requestOptions),
|
|
643
|
-
listAllRuns: ({
|
|
644
|
-
projectId,
|
|
645
|
-
...params
|
|
646
|
-
}: { projectId: ProjectId } & ListBatchInferenceRunsParams) =>
|
|
647
|
-
listAllPages(async (pageOptions) => {
|
|
648
|
-
const page = await wire.listBatchInferenceRuns(
|
|
649
|
-
projectId,
|
|
650
|
-
{ ...params, ...pageOptions },
|
|
651
|
-
requestOptions,
|
|
652
|
-
);
|
|
653
|
-
return { items: page.batchInferenceRuns, pagination: page.pagination };
|
|
654
|
-
}, params),
|
|
655
|
-
getRun: ({ batchInferenceRunId }: { batchInferenceRunId: BatchInferenceRunId }) =>
|
|
656
|
-
wire.getBatchInferenceRun(batchInferenceRunId, requestOptions),
|
|
657
|
-
confirmRun: ({ batchInferenceRunId }: { batchInferenceRunId: BatchInferenceRunId }) =>
|
|
658
|
-
wire.confirmBatchInferenceRun(batchInferenceRunId, requestOptions),
|
|
659
|
-
resumeRun: ({ batchInferenceRunId }: { batchInferenceRunId: BatchInferenceRunId }) =>
|
|
660
|
-
wire.resumeBatchInferenceRun(batchInferenceRunId, requestOptions),
|
|
661
|
-
cancelRun: ({ batchInferenceRunId }: { batchInferenceRunId: BatchInferenceRunId }) =>
|
|
662
|
-
wire.cancelBatchInferenceRun(batchInferenceRunId, requestOptions),
|
|
663
|
-
};
|
|
664
|
-
|
|
665
424
|
const datasets = {
|
|
666
425
|
create: ({ projectId, ...body }: { projectId: ProjectId } & CreateDatasetBody) =>
|
|
667
426
|
wire.createDataset(projectId, body, requestOptions),
|
|
@@ -900,11 +659,7 @@ const createClientImplementation = (config: ClientConfig) => {
|
|
|
900
659
|
projects,
|
|
901
660
|
pipelines,
|
|
902
661
|
datasets,
|
|
903
|
-
baseModels,
|
|
904
662
|
generationModels,
|
|
905
|
-
models,
|
|
906
|
-
trainings,
|
|
907
|
-
batchInference,
|
|
908
663
|
runs,
|
|
909
664
|
reviews,
|
|
910
665
|
secrets,
|
|
@@ -927,20 +682,6 @@ type PublicOutput<T> = IsJsonValue<T> extends true
|
|
|
927
682
|
? ExportJob
|
|
928
683
|
: T extends GeneratedUploadJob
|
|
929
684
|
? UploadJob
|
|
930
|
-
: T extends GeneratedModel
|
|
931
|
-
? Model
|
|
932
|
-
: T extends GeneratedTraining
|
|
933
|
-
? Training
|
|
934
|
-
: T extends GeneratedModelVersion
|
|
935
|
-
? ModelVersion
|
|
936
|
-
: T extends GeneratedTrainingCostEstimateInputSet
|
|
937
|
-
? TrainingCostEstimateInputSet
|
|
938
|
-
: T extends GeneratedTrainingCostEstimate
|
|
939
|
-
? TrainingCostEstimate
|
|
940
|
-
: T extends GeneratedTrainingRun
|
|
941
|
-
? TrainingRun
|
|
942
|
-
: T extends GeneratedBatchInferenceRun
|
|
943
|
-
? BatchInferenceRun
|
|
944
685
|
: T extends GeneratedProject
|
|
945
686
|
? Project
|
|
946
687
|
: T extends GeneratedPipeline
|