@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.
Files changed (35) hide show
  1. package/README.md +2 -2
  2. package/dist/cli/toloka.js +180 -191
  3. package/dist/cli/toloka.js.jsc +0 -0
  4. package/dist/cli/toloka.js.jsc.sha256 +1 -1
  5. package/dist/cli/toloka.js.sha256 +1 -1
  6. package/examples/video-pair-rating/nodes/adjudicate/node.ts +1 -1
  7. package/examples/video-pair-rating/nodes/adjudicate_op/node.ts +1 -1
  8. package/examples/video-pair-rating/nodes/overall_preference_pick/node.ts +5 -1
  9. package/examples/video-pair-rating/nodes/rate_pair/node.ts +5 -1
  10. package/openapi/gen/api.schemas.ts +52 -756
  11. package/openapi/gen/api.ts +0 -860
  12. package/package.json +2 -2
  13. package/skills/catalog.json +6 -40
  14. package/skills/toloka-build/references/human-work.md +42 -7
  15. package/skills/toloka-build/references/local-setup.md +2 -2
  16. package/skills/toloka-build/references/workflow-and-cli.md +3 -22
  17. package/skills/toloka-get-started/SKILL.md +9 -13
  18. package/src/authoring/index.ts +34 -3
  19. package/src/cli/analytics.ts +0 -31
  20. package/src/cli/context.ts +0 -109
  21. package/src/cli/init.ts +1 -1
  22. package/src/cli/program.ts +0 -6
  23. package/src/cli/project.ts +9 -1
  24. package/src/client.ts +0 -259
  25. package/src/importer.ts +88 -6
  26. package/src/index.ts +2 -2
  27. package/src/pipeline-graph-v1.contract.json +130 -101
  28. package/skills/toloka-fine-tuning/SKILL.md +0 -177
  29. package/skills/toloka-gisting/SKILL.md +0 -186
  30. package/src/cli/batch-inference.ts +0 -267
  31. package/src/cli/commands/batch-inference.ts +0 -116
  32. package/src/cli/commands/models.ts +0 -121
  33. package/src/cli/commands/training.ts +0 -275
  34. package/src/cli/models.ts +0 -304
  35. package/src/cli/trainings.ts +0 -880
@@ -6,15 +6,10 @@ import type {
6
6
  AddExpertBanListExpertsBody,
7
7
  AddExpertListExpertsBody,
8
8
  AttachPipelineDatasetBody,
9
- BaseModel,
10
- BaseModelId,
11
- BatchInferenceRun,
12
- BatchInferenceRunId,
13
9
  CancelPipelineRunBody,
14
10
  CheckJob,
15
11
  CheckRunId,
16
12
  CopyPipelineBody,
17
- CreateBatchInferenceRunBody,
18
13
  CreateDatasetBody,
19
14
  CreateDatasetExportBody,
20
15
  CreateDatasetFieldBody,
@@ -27,10 +22,7 @@ import type {
27
22
  CreateProjectBody,
28
23
  CreateProjectFileUpload200,
29
24
  CreateProjectFileUploadBody,
30
- CreateProjectModelBody,
31
- CreateProjectTrainingBody,
32
25
  CreateScopedTokenBody,
33
- CreateTrainingRunBody,
34
26
  CreatedDatasetFields,
35
27
  CurrentUser,
36
28
  Dataset,
@@ -38,7 +30,6 @@ import type {
38
30
  DatasetId,
39
31
  DatasetSlice,
40
32
  EstimatePipelineCostBody,
41
- EstimateTrainingCostBody,
42
33
  ExpertBanListDetails,
43
34
  ExpertChangeResult,
44
35
  ExpertList,
@@ -47,14 +38,9 @@ import type {
47
38
  ExportJob,
48
39
  ExportPipeline200,
49
40
  GetDatasetInferredFields200,
50
- GetTrainingRunLogsParams,
51
- GetTrainingRunMetricHistoryParams,
52
41
  ImportPipelineBody,
53
42
  ListAudienceSpecializations200,
54
43
  ListAudienceSpecializationsParams,
55
- ListBaseModels200,
56
- ListBatchInferenceRuns200,
57
- ListBatchInferenceRunsParams,
58
44
  ListDatasetFields200,
59
45
  ListDatasetFieldsParams,
60
46
  ListDatasetItems200,
@@ -68,8 +54,6 @@ import type {
68
54
  ListExpertListExpertsParams,
69
55
  ListExpertLists200,
70
56
  ListGenerationModels200,
71
- ListModelVersions200,
72
- ListModelVersionsParams,
73
57
  ListPipelineChecks200,
74
58
  ListPipelineRunItems200,
75
59
  ListPipelineRunItemsParams,
@@ -80,31 +64,19 @@ import type {
80
64
  ListProjectDatasets200,
81
65
  ListProjectDatasetsParams,
82
66
  ListProjectFiles200,
83
- ListProjectModels200,
84
- ListProjectModelsParams,
85
67
  ListProjectPipelines200,
86
68
  ListProjectPipelinesParams,
87
69
  ListProjectSecrets200,
88
70
  ListProjectTokens200,
89
71
  ListProjectTokensParams,
90
- ListProjectTrainings200,
91
- ListProjectTrainingsParams,
92
72
  ListProjects200,
93
73
  ListProjectsParams,
94
- ListTrainingRuns200,
95
- ListTrainingRunsParams,
96
- Model,
97
- ModelId,
98
- ModelVersion,
99
- ModelVersionContentDownload,
100
- ModelVersionId,
101
74
  PatchPipelineNodeBody,
102
75
  Pipeline,
103
76
  PipelineCostEstimate,
104
77
  PipelineGraphSnapshot,
105
78
  PipelineId,
106
79
  PipelineValidationReport,
107
- PrepareTrainingCostEstimateInputsBody,
108
80
  Project,
109
81
  ProjectFile,
110
82
  ProjectFileId,
@@ -115,7 +87,6 @@ import type {
115
87
  RemoveExpertBanListExpertsBody,
116
88
  RemoveExpertListExpertsBody,
117
89
  ReplacePipelineGraphBody,
118
- ReplaceTrainingConfigurationBody,
119
90
  Review,
120
91
  ReviewId,
121
92
  RevokedScopedTokens,
@@ -131,19 +102,9 @@ import type {
131
102
  ScopedToken,
132
103
  SetProjectSecretBody,
133
104
  SplitDatasetBody,
134
- Training,
135
- TrainingCostEstimate,
136
- TrainingCostEstimateInputSet,
137
- TrainingId,
138
- TrainingRun,
139
- TrainingRunId,
140
- TrainingRunLogs,
141
- TrainingRunMetricHistory,
142
- TrainingRunMetrics,
143
105
  UpdateExpertListBody,
144
106
  UpdatePipelineBody,
145
107
  UpdateProjectBody,
146
- UpdateTrainingMetadataBody,
147
108
  UploadId,
148
109
  UploadJob,
149
110
  ValidatePipelineGraphBody
@@ -151,677 +112,6 @@ import type {
151
112
 
152
113
  import { potatoFetch } from '../../src/transport';
153
114
 
154
- export const getListBaseModelsUrl = () => {
155
-
156
-
157
-
158
-
159
- return `/api/v2-beta/base-models`
160
- }
161
-
162
- export const listBaseModels = async ( options?: Parameters<typeof potatoFetch>[1]): Promise<ListBaseModels200> => {
163
-
164
- return potatoFetch<ListBaseModels200>(getListBaseModelsUrl(),
165
- {
166
- ...options,
167
- method: 'GET'
168
-
169
-
170
- }
171
- );}
172
-
173
-
174
-
175
- export const getGetBaseModelUrl = (baseModelId: BaseModelId,) => {
176
-
177
-
178
-
179
-
180
- return `/api/v2-beta/base-models/${baseModelId}`
181
- }
182
-
183
- export const getBaseModel = async (baseModelId: BaseModelId, options?: Parameters<typeof potatoFetch>[1]): Promise<BaseModel> => {
184
-
185
- return potatoFetch<BaseModel>(getGetBaseModelUrl(baseModelId),
186
- {
187
- ...options,
188
- method: 'GET'
189
-
190
-
191
- }
192
- );}
193
-
194
-
195
-
196
- export const getListProjectModelsUrl = (projectId: ProjectId,
197
- params?: ListProjectModelsParams,) => {
198
- const normalizedParams = new URLSearchParams();
199
-
200
- Object.entries(params || {}).forEach(([key, value]) => {
201
-
202
- if (value !== undefined) {
203
- normalizedParams.append(key, value === null ? 'null' : String(value))
204
- }
205
- });
206
-
207
- const stringifiedParams = normalizedParams.toString();
208
-
209
- return stringifiedParams.length > 0 ? `/api/v2-beta/projects/${projectId}/models?${stringifiedParams}` : `/api/v2-beta/projects/${projectId}/models`
210
- }
211
-
212
- export const listProjectModels = async (projectId: ProjectId,
213
- params?: ListProjectModelsParams, options?: Parameters<typeof potatoFetch>[1]): Promise<ListProjectModels200> => {
214
-
215
- return potatoFetch<ListProjectModels200>(getListProjectModelsUrl(projectId,params),
216
- {
217
- ...options,
218
- method: 'GET'
219
-
220
-
221
- }
222
- );}
223
-
224
-
225
-
226
- export const getCreateProjectModelUrl = (projectId: ProjectId,) => {
227
-
228
-
229
-
230
-
231
- return `/api/v2-beta/projects/${projectId}/models`
232
- }
233
-
234
- export const createProjectModel = async (projectId: ProjectId,
235
- createProjectModelBody: CreateProjectModelBody, options?: Parameters<typeof potatoFetch>[1]): Promise<Model> => {
236
-
237
- const getHeaders = (h?: NonNullable<RequestInit['headers']>): Record<string, string | readonly string[]> => {
238
- if (!h) return {};
239
- if (h instanceof Headers) return Object.fromEntries(h.entries());
240
- if (Symbol.iterator in h) {
241
- return Object.fromEntries(
242
- Array.from(h as Iterable<Iterable<string>>, (entry) => Array.from(entry) as [string, string]),
243
- );
244
- }
245
- const headers: Record<string, string | readonly string[]> = {};
246
- for (const [name, value] of Object.entries<string | readonly string[] | undefined>(h)) {
247
- if (value !== undefined) headers[name] = value;
248
- }
249
- return headers;
250
- };
251
- return potatoFetch<Model>(getCreateProjectModelUrl(projectId),
252
- {
253
- ...options,
254
- method: 'POST',
255
- headers: { 'Content-Type': 'application/json', ...getHeaders(options?.headers) },
256
- body: JSON.stringify(createProjectModelBody)
257
- }
258
- );}
259
-
260
-
261
-
262
- export const getListModelVersionsUrl = (projectId: ProjectId,
263
- modelId: ModelId,
264
- params?: ListModelVersionsParams,) => {
265
- const normalizedParams = new URLSearchParams();
266
-
267
- Object.entries(params || {}).forEach(([key, value]) => {
268
-
269
- if (value !== undefined) {
270
- normalizedParams.append(key, value === null ? 'null' : String(value))
271
- }
272
- });
273
-
274
- const stringifiedParams = normalizedParams.toString();
275
-
276
- return stringifiedParams.length > 0 ? `/api/v2-beta/projects/${projectId}/models/${modelId}/versions?${stringifiedParams}` : `/api/v2-beta/projects/${projectId}/models/${modelId}/versions`
277
- }
278
-
279
- export const listModelVersions = async (projectId: ProjectId,
280
- modelId: ModelId,
281
- params?: ListModelVersionsParams, options?: Parameters<typeof potatoFetch>[1]): Promise<ListModelVersions200> => {
282
-
283
- return potatoFetch<ListModelVersions200>(getListModelVersionsUrl(projectId,modelId,params),
284
- {
285
- ...options,
286
- method: 'GET'
287
-
288
-
289
- }
290
- );}
291
-
292
-
293
-
294
- export const getGetModelVersionUrl = (modelVersionId: ModelVersionId,) => {
295
-
296
-
297
-
298
-
299
- return `/api/v2-beta/model-versions/${modelVersionId}`
300
- }
301
-
302
- export const getModelVersion = async (modelVersionId: ModelVersionId, options?: Parameters<typeof potatoFetch>[1]): Promise<ModelVersion> => {
303
-
304
- return potatoFetch<ModelVersion>(getGetModelVersionUrl(modelVersionId),
305
- {
306
- ...options,
307
- method: 'GET'
308
-
309
-
310
- }
311
- );}
312
-
313
-
314
-
315
- export const getGetModelVersionContentUrl = (modelVersionId: ModelVersionId,) => {
316
-
317
-
318
-
319
-
320
- return `/api/v2-beta/model-versions/${modelVersionId}/content`
321
- }
322
-
323
- export const getModelVersionContent = async (modelVersionId: ModelVersionId, options?: Parameters<typeof potatoFetch>[1]): Promise<ModelVersionContentDownload> => {
324
-
325
- return potatoFetch<ModelVersionContentDownload>(getGetModelVersionContentUrl(modelVersionId),
326
- {
327
- ...options,
328
- method: 'GET'
329
-
330
-
331
- }
332
- );}
333
-
334
-
335
-
336
- export const getArchiveProjectModelUrl = (projectId: ProjectId,
337
- modelId: ModelId,) => {
338
-
339
-
340
-
341
-
342
- return `/api/v2-beta/projects/${projectId}/models/${modelId}/archive`
343
- }
344
-
345
- export const archiveProjectModel = async (projectId: ProjectId,
346
- modelId: ModelId, options?: Parameters<typeof potatoFetch>[1]): Promise<Model> => {
347
-
348
- return potatoFetch<Model>(getArchiveProjectModelUrl(projectId,modelId),
349
- {
350
- ...options,
351
- method: 'POST'
352
-
353
-
354
- }
355
- );}
356
-
357
-
358
-
359
- export const getGetProjectModelUrl = (projectId: ProjectId,
360
- modelId: ModelId,) => {
361
-
362
-
363
-
364
-
365
- return `/api/v2-beta/projects/${projectId}/models/${modelId}`
366
- }
367
-
368
- export const getProjectModel = async (projectId: ProjectId,
369
- modelId: ModelId, options?: Parameters<typeof potatoFetch>[1]): Promise<Model> => {
370
-
371
- return potatoFetch<Model>(getGetProjectModelUrl(projectId,modelId),
372
- {
373
- ...options,
374
- method: 'GET'
375
-
376
-
377
- }
378
- );}
379
-
380
-
381
-
382
- export const getListProjectTrainingsUrl = (projectId: ProjectId,
383
- params?: ListProjectTrainingsParams,) => {
384
- const normalizedParams = new URLSearchParams();
385
-
386
- Object.entries(params || {}).forEach(([key, value]) => {
387
-
388
- if (value !== undefined) {
389
- normalizedParams.append(key, value === null ? 'null' : String(value))
390
- }
391
- });
392
-
393
- const stringifiedParams = normalizedParams.toString();
394
-
395
- return stringifiedParams.length > 0 ? `/api/v2-beta/projects/${projectId}/trainings?${stringifiedParams}` : `/api/v2-beta/projects/${projectId}/trainings`
396
- }
397
-
398
- export const listProjectTrainings = async (projectId: ProjectId,
399
- params?: ListProjectTrainingsParams, options?: Parameters<typeof potatoFetch>[1]): Promise<ListProjectTrainings200> => {
400
-
401
- return potatoFetch<ListProjectTrainings200>(getListProjectTrainingsUrl(projectId,params),
402
- {
403
- ...options,
404
- method: 'GET'
405
-
406
-
407
- }
408
- );}
409
-
410
-
411
-
412
- export const getCreateProjectTrainingUrl = (projectId: ProjectId,) => {
413
-
414
-
415
-
416
-
417
- return `/api/v2-beta/projects/${projectId}/trainings`
418
- }
419
-
420
- export const createProjectTraining = async (projectId: ProjectId,
421
- createProjectTrainingBody: CreateProjectTrainingBody, options?: Parameters<typeof potatoFetch>[1]): Promise<Training> => {
422
-
423
- const getHeaders = (h?: NonNullable<RequestInit['headers']>): Record<string, string | readonly string[]> => {
424
- if (!h) return {};
425
- if (h instanceof Headers) return Object.fromEntries(h.entries());
426
- if (Symbol.iterator in h) {
427
- return Object.fromEntries(
428
- Array.from(h as Iterable<Iterable<string>>, (entry) => Array.from(entry) as [string, string]),
429
- );
430
- }
431
- const headers: Record<string, string | readonly string[]> = {};
432
- for (const [name, value] of Object.entries<string | readonly string[] | undefined>(h)) {
433
- if (value !== undefined) headers[name] = value;
434
- }
435
- return headers;
436
- };
437
- return potatoFetch<Training>(getCreateProjectTrainingUrl(projectId),
438
- {
439
- ...options,
440
- method: 'POST',
441
- headers: { 'Content-Type': 'application/json', ...getHeaders(options?.headers) },
442
- body: JSON.stringify(createProjectTrainingBody)
443
- }
444
- );}
445
-
446
-
447
-
448
- export const getGetTrainingUrl = (trainingId: TrainingId,) => {
449
-
450
-
451
-
452
-
453
- return `/api/v2-beta/trainings/${trainingId}`
454
- }
455
-
456
- export const getTraining = async (trainingId: TrainingId, options?: Parameters<typeof potatoFetch>[1]): Promise<Training> => {
457
-
458
- return potatoFetch<Training>(getGetTrainingUrl(trainingId),
459
- {
460
- ...options,
461
- method: 'GET'
462
-
463
-
464
- }
465
- );}
466
-
467
-
468
-
469
- export const getUpdateTrainingMetadataUrl = (trainingId: TrainingId,) => {
470
-
471
-
472
-
473
-
474
- return `/api/v2-beta/trainings/${trainingId}`
475
- }
476
-
477
- export const updateTrainingMetadata = async (trainingId: TrainingId,
478
- updateTrainingMetadataBody: UpdateTrainingMetadataBody, options?: Parameters<typeof potatoFetch>[1]): Promise<Training> => {
479
-
480
- const getHeaders = (h?: NonNullable<RequestInit['headers']>): Record<string, string | readonly string[]> => {
481
- if (!h) return {};
482
- if (h instanceof Headers) return Object.fromEntries(h.entries());
483
- if (Symbol.iterator in h) {
484
- return Object.fromEntries(
485
- Array.from(h as Iterable<Iterable<string>>, (entry) => Array.from(entry) as [string, string]),
486
- );
487
- }
488
- const headers: Record<string, string | readonly string[]> = {};
489
- for (const [name, value] of Object.entries<string | readonly string[] | undefined>(h)) {
490
- if (value !== undefined) headers[name] = value;
491
- }
492
- return headers;
493
- };
494
- return potatoFetch<Training>(getUpdateTrainingMetadataUrl(trainingId),
495
- {
496
- ...options,
497
- method: 'PATCH',
498
- headers: { 'Content-Type': 'application/json', ...getHeaders(options?.headers) },
499
- body: JSON.stringify(updateTrainingMetadataBody)
500
- }
501
- );}
502
-
503
-
504
-
505
- export const getReplaceTrainingConfigurationUrl = (trainingId: TrainingId,) => {
506
-
507
-
508
-
509
-
510
- return `/api/v2-beta/trainings/${trainingId}/configuration`
511
- }
512
-
513
- export const replaceTrainingConfiguration = async (trainingId: TrainingId,
514
- replaceTrainingConfigurationBody: ReplaceTrainingConfigurationBody, options?: Parameters<typeof potatoFetch>[1]): Promise<Training> => {
515
-
516
- const getHeaders = (h?: NonNullable<RequestInit['headers']>): Record<string, string | readonly string[]> => {
517
- if (!h) return {};
518
- if (h instanceof Headers) return Object.fromEntries(h.entries());
519
- if (Symbol.iterator in h) {
520
- return Object.fromEntries(
521
- Array.from(h as Iterable<Iterable<string>>, (entry) => Array.from(entry) as [string, string]),
522
- );
523
- }
524
- const headers: Record<string, string | readonly string[]> = {};
525
- for (const [name, value] of Object.entries<string | readonly string[] | undefined>(h)) {
526
- if (value !== undefined) headers[name] = value;
527
- }
528
- return headers;
529
- };
530
- return potatoFetch<Training>(getReplaceTrainingConfigurationUrl(trainingId),
531
- {
532
- ...options,
533
- method: 'PUT',
534
- headers: { 'Content-Type': 'application/json', ...getHeaders(options?.headers) },
535
- body: JSON.stringify(replaceTrainingConfigurationBody)
536
- }
537
- );}
538
-
539
-
540
-
541
- export const getPrepareTrainingCostEstimateInputsUrl = (trainingId: TrainingId,) => {
542
-
543
-
544
-
545
-
546
- return `/api/v2-beta/trainings/${trainingId}/cost-estimate-inputs`
547
- }
548
-
549
- export const prepareTrainingCostEstimateInputs = async (trainingId: TrainingId,
550
- prepareTrainingCostEstimateInputsBody: PrepareTrainingCostEstimateInputsBody, options?: Parameters<typeof potatoFetch>[1]): Promise<TrainingCostEstimateInputSet> => {
551
-
552
- const getHeaders = (h?: NonNullable<RequestInit['headers']>): Record<string, string | readonly string[]> => {
553
- if (!h) return {};
554
- if (h instanceof Headers) return Object.fromEntries(h.entries());
555
- if (Symbol.iterator in h) {
556
- return Object.fromEntries(
557
- Array.from(h as Iterable<Iterable<string>>, (entry) => Array.from(entry) as [string, string]),
558
- );
559
- }
560
- const headers: Record<string, string | readonly string[]> = {};
561
- for (const [name, value] of Object.entries<string | readonly string[] | undefined>(h)) {
562
- if (value !== undefined) headers[name] = value;
563
- }
564
- return headers;
565
- };
566
- return potatoFetch<TrainingCostEstimateInputSet>(getPrepareTrainingCostEstimateInputsUrl(trainingId),
567
- {
568
- ...options,
569
- method: 'POST',
570
- headers: { 'Content-Type': 'application/json', ...getHeaders(options?.headers) },
571
- body: JSON.stringify(prepareTrainingCostEstimateInputsBody)
572
- }
573
- );}
574
-
575
-
576
-
577
- export const getEstimateTrainingCostUrl = (trainingId: TrainingId,) => {
578
-
579
-
580
-
581
-
582
- return `/api/v2-beta/trainings/${trainingId}/cost-estimate`
583
- }
584
-
585
- export const estimateTrainingCost = async (trainingId: TrainingId,
586
- estimateTrainingCostBody: EstimateTrainingCostBody, options?: Parameters<typeof potatoFetch>[1]): Promise<TrainingCostEstimate> => {
587
-
588
- const getHeaders = (h?: NonNullable<RequestInit['headers']>): Record<string, string | readonly string[]> => {
589
- if (!h) return {};
590
- if (h instanceof Headers) return Object.fromEntries(h.entries());
591
- if (Symbol.iterator in h) {
592
- return Object.fromEntries(
593
- Array.from(h as Iterable<Iterable<string>>, (entry) => Array.from(entry) as [string, string]),
594
- );
595
- }
596
- const headers: Record<string, string | readonly string[]> = {};
597
- for (const [name, value] of Object.entries<string | readonly string[] | undefined>(h)) {
598
- if (value !== undefined) headers[name] = value;
599
- }
600
- return headers;
601
- };
602
- return potatoFetch<TrainingCostEstimate>(getEstimateTrainingCostUrl(trainingId),
603
- {
604
- ...options,
605
- method: 'POST',
606
- headers: { 'Content-Type': 'application/json', ...getHeaders(options?.headers) },
607
- body: JSON.stringify(estimateTrainingCostBody)
608
- }
609
- );}
610
-
611
-
612
-
613
- export const getCreateTrainingRunUrl = (trainingId: TrainingId,) => {
614
-
615
-
616
-
617
-
618
- return `/api/v2-beta/trainings/${trainingId}/runs`
619
- }
620
-
621
- export const createTrainingRun = async (trainingId: TrainingId,
622
- createTrainingRunBody: CreateTrainingRunBody, options?: Parameters<typeof potatoFetch>[1]): Promise<TrainingRun> => {
623
-
624
- const getHeaders = (h?: NonNullable<RequestInit['headers']>): Record<string, string | readonly string[]> => {
625
- if (!h) return {};
626
- if (h instanceof Headers) return Object.fromEntries(h.entries());
627
- if (Symbol.iterator in h) {
628
- return Object.fromEntries(
629
- Array.from(h as Iterable<Iterable<string>>, (entry) => Array.from(entry) as [string, string]),
630
- );
631
- }
632
- const headers: Record<string, string | readonly string[]> = {};
633
- for (const [name, value] of Object.entries<string | readonly string[] | undefined>(h)) {
634
- if (value !== undefined) headers[name] = value;
635
- }
636
- return headers;
637
- };
638
- return potatoFetch<TrainingRun>(getCreateTrainingRunUrl(trainingId),
639
- {
640
- ...options,
641
- method: 'POST',
642
- headers: { 'Content-Type': 'application/json', ...getHeaders(options?.headers) },
643
- body: JSON.stringify(createTrainingRunBody)
644
- }
645
- );}
646
-
647
-
648
-
649
- export const getListTrainingRunsUrl = (trainingId: TrainingId,
650
- params?: ListTrainingRunsParams,) => {
651
- const normalizedParams = new URLSearchParams();
652
-
653
- Object.entries(params || {}).forEach(([key, value]) => {
654
-
655
- if (value !== undefined) {
656
- normalizedParams.append(key, value === null ? 'null' : String(value))
657
- }
658
- });
659
-
660
- const stringifiedParams = normalizedParams.toString();
661
-
662
- return stringifiedParams.length > 0 ? `/api/v2-beta/trainings/${trainingId}/runs?${stringifiedParams}` : `/api/v2-beta/trainings/${trainingId}/runs`
663
- }
664
-
665
- export const listTrainingRuns = async (trainingId: TrainingId,
666
- params?: ListTrainingRunsParams, options?: Parameters<typeof potatoFetch>[1]): Promise<ListTrainingRuns200> => {
667
-
668
- return potatoFetch<ListTrainingRuns200>(getListTrainingRunsUrl(trainingId,params),
669
- {
670
- ...options,
671
- method: 'GET'
672
-
673
-
674
- }
675
- );}
676
-
677
-
678
-
679
- export const getGetTrainingRunUrl = (trainingRunId: TrainingRunId,) => {
680
-
681
-
682
-
683
-
684
- return `/api/v2-beta/training-runs/${trainingRunId}`
685
- }
686
-
687
- export const getTrainingRun = async (trainingRunId: TrainingRunId, options?: Parameters<typeof potatoFetch>[1]): Promise<TrainingRun> => {
688
-
689
- return potatoFetch<TrainingRun>(getGetTrainingRunUrl(trainingRunId),
690
- {
691
- ...options,
692
- method: 'GET'
693
-
694
-
695
- }
696
- );}
697
-
698
-
699
-
700
- export const getGetTrainingRunLogsUrl = (trainingRunId: TrainingRunId,
701
- params?: GetTrainingRunLogsParams,) => {
702
- const normalizedParams = new URLSearchParams();
703
-
704
- Object.entries(params || {}).forEach(([key, value]) => {
705
-
706
- if (value !== undefined) {
707
- normalizedParams.append(key, value === null ? 'null' : String(value))
708
- }
709
- });
710
-
711
- const stringifiedParams = normalizedParams.toString();
712
-
713
- return stringifiedParams.length > 0 ? `/api/v2-beta/training-runs/${trainingRunId}/logs?${stringifiedParams}` : `/api/v2-beta/training-runs/${trainingRunId}/logs`
714
- }
715
-
716
- export const getTrainingRunLogs = async (trainingRunId: TrainingRunId,
717
- params?: GetTrainingRunLogsParams, options?: Parameters<typeof potatoFetch>[1]): Promise<TrainingRunLogs> => {
718
-
719
- return potatoFetch<TrainingRunLogs>(getGetTrainingRunLogsUrl(trainingRunId,params),
720
- {
721
- ...options,
722
- method: 'GET'
723
-
724
-
725
- }
726
- );}
727
-
728
-
729
-
730
- export const getGetTrainingRunMetricsUrl = (trainingRunId: TrainingRunId,) => {
731
-
732
-
733
-
734
-
735
- return `/api/v2-beta/training-runs/${trainingRunId}/metrics`
736
- }
737
-
738
- export const getTrainingRunMetrics = async (trainingRunId: TrainingRunId, options?: Parameters<typeof potatoFetch>[1]): Promise<TrainingRunMetrics> => {
739
-
740
- return potatoFetch<TrainingRunMetrics>(getGetTrainingRunMetricsUrl(trainingRunId),
741
- {
742
- ...options,
743
- method: 'GET'
744
-
745
-
746
- }
747
- );}
748
-
749
-
750
-
751
- export const getGetTrainingRunMetricHistoryUrl = (trainingRunId: TrainingRunId,
752
- metricKey: string,
753
- params?: GetTrainingRunMetricHistoryParams,) => {
754
- const normalizedParams = new URLSearchParams();
755
-
756
- Object.entries(params || {}).forEach(([key, value]) => {
757
-
758
- if (value !== undefined) {
759
- normalizedParams.append(key, value === null ? 'null' : String(value))
760
- }
761
- });
762
-
763
- const stringifiedParams = normalizedParams.toString();
764
-
765
- return stringifiedParams.length > 0 ? `/api/v2-beta/training-runs/${trainingRunId}/metrics/${metricKey}?${stringifiedParams}` : `/api/v2-beta/training-runs/${trainingRunId}/metrics/${metricKey}`
766
- }
767
-
768
- export const getTrainingRunMetricHistory = async (trainingRunId: TrainingRunId,
769
- metricKey: string,
770
- params?: GetTrainingRunMetricHistoryParams, options?: Parameters<typeof potatoFetch>[1]): Promise<TrainingRunMetricHistory> => {
771
-
772
- return potatoFetch<TrainingRunMetricHistory>(getGetTrainingRunMetricHistoryUrl(trainingRunId,metricKey,params),
773
- {
774
- ...options,
775
- method: 'GET'
776
-
777
-
778
- }
779
- );}
780
-
781
-
782
-
783
- export const getResumeTrainingRunUrl = (trainingRunId: TrainingRunId,) => {
784
-
785
-
786
-
787
-
788
- return `/api/v2-beta/training-runs/${trainingRunId}/resume`
789
- }
790
-
791
- export const resumeTrainingRun = async (trainingRunId: TrainingRunId, options?: Parameters<typeof potatoFetch>[1]): Promise<TrainingRun> => {
792
-
793
- return potatoFetch<TrainingRun>(getResumeTrainingRunUrl(trainingRunId),
794
- {
795
- ...options,
796
- method: 'POST'
797
-
798
-
799
- }
800
- );}
801
-
802
-
803
-
804
- export const getCancelTrainingRunUrl = (trainingRunId: TrainingRunId,) => {
805
-
806
-
807
-
808
-
809
- return `/api/v2-beta/training-runs/${trainingRunId}/cancel`
810
- }
811
-
812
- export const cancelTrainingRun = async (trainingRunId: TrainingRunId, options?: Parameters<typeof potatoFetch>[1]): Promise<TrainingRun> => {
813
-
814
- return potatoFetch<TrainingRun>(getCancelTrainingRunUrl(trainingRunId),
815
- {
816
- ...options,
817
- method: 'POST'
818
-
819
-
820
- }
821
- );}
822
-
823
-
824
-
825
115
  export const getListAudienceSpecializationsUrl = (params?: ListAudienceSpecializationsParams,) => {
826
116
  const normalizedParams = new URLSearchParams();
827
117
 
@@ -3085,153 +2375,3 @@ export const getPipelineCheck = async (checkRunId: CheckRunId, options?: Paramet
3085
2375
 
3086
2376
 
3087
2377
 
3088
- export const getCreateBatchInferenceRunUrl = (projectId: ProjectId,) => {
3089
-
3090
-
3091
-
3092
-
3093
- return `/api/v2-beta/projects/${projectId}/batch-inference-runs`
3094
- }
3095
-
3096
- export const createBatchInferenceRun = async (projectId: ProjectId,
3097
- createBatchInferenceRunBody: CreateBatchInferenceRunBody, options?: Parameters<typeof potatoFetch>[1]): Promise<BatchInferenceRun> => {
3098
-
3099
- const getHeaders = (h?: NonNullable<RequestInit['headers']>): Record<string, string | readonly string[]> => {
3100
- if (!h) return {};
3101
- if (h instanceof Headers) return Object.fromEntries(h.entries());
3102
- if (Symbol.iterator in h) {
3103
- return Object.fromEntries(
3104
- Array.from(h as Iterable<Iterable<string>>, (entry) => Array.from(entry) as [string, string]),
3105
- );
3106
- }
3107
- const headers: Record<string, string | readonly string[]> = {};
3108
- for (const [name, value] of Object.entries<string | readonly string[] | undefined>(h)) {
3109
- if (value !== undefined) headers[name] = value;
3110
- }
3111
- return headers;
3112
- };
3113
- return potatoFetch<BatchInferenceRun>(getCreateBatchInferenceRunUrl(projectId),
3114
- {
3115
- ...options,
3116
- method: 'POST',
3117
- headers: { 'Content-Type': 'application/json', ...getHeaders(options?.headers) },
3118
- body: JSON.stringify(createBatchInferenceRunBody)
3119
- }
3120
- );}
3121
-
3122
-
3123
-
3124
- export const getListBatchInferenceRunsUrl = (projectId: ProjectId,
3125
- params?: ListBatchInferenceRunsParams,) => {
3126
- const normalizedParams = new URLSearchParams();
3127
-
3128
- Object.entries(params || {}).forEach(([key, value]) => {
3129
-
3130
- if (value !== undefined) {
3131
- normalizedParams.append(key, value === null ? 'null' : String(value))
3132
- }
3133
- });
3134
-
3135
- const stringifiedParams = normalizedParams.toString();
3136
-
3137
- return stringifiedParams.length > 0 ? `/api/v2-beta/projects/${projectId}/batch-inference-runs?${stringifiedParams}` : `/api/v2-beta/projects/${projectId}/batch-inference-runs`
3138
- }
3139
-
3140
- export const listBatchInferenceRuns = async (projectId: ProjectId,
3141
- params?: ListBatchInferenceRunsParams, options?: Parameters<typeof potatoFetch>[1]): Promise<ListBatchInferenceRuns200> => {
3142
-
3143
- return potatoFetch<ListBatchInferenceRuns200>(getListBatchInferenceRunsUrl(projectId,params),
3144
- {
3145
- ...options,
3146
- method: 'GET'
3147
-
3148
-
3149
- }
3150
- );}
3151
-
3152
-
3153
-
3154
- export const getGetBatchInferenceRunUrl = (batchInferenceRunId: BatchInferenceRunId,) => {
3155
-
3156
-
3157
-
3158
-
3159
- return `/api/v2-beta/batch-inference-runs/${batchInferenceRunId}`
3160
- }
3161
-
3162
- export const getBatchInferenceRun = async (batchInferenceRunId: BatchInferenceRunId, options?: Parameters<typeof potatoFetch>[1]): Promise<BatchInferenceRun> => {
3163
-
3164
- return potatoFetch<BatchInferenceRun>(getGetBatchInferenceRunUrl(batchInferenceRunId),
3165
- {
3166
- ...options,
3167
- method: 'GET'
3168
-
3169
-
3170
- }
3171
- );}
3172
-
3173
-
3174
-
3175
- export const getConfirmBatchInferenceRunUrl = (batchInferenceRunId: BatchInferenceRunId,) => {
3176
-
3177
-
3178
-
3179
-
3180
- return `/api/v2-beta/batch-inference-runs/${batchInferenceRunId}/confirm`
3181
- }
3182
-
3183
- export const confirmBatchInferenceRun = async (batchInferenceRunId: BatchInferenceRunId, options?: Parameters<typeof potatoFetch>[1]): Promise<BatchInferenceRun> => {
3184
-
3185
- return potatoFetch<BatchInferenceRun>(getConfirmBatchInferenceRunUrl(batchInferenceRunId),
3186
- {
3187
- ...options,
3188
- method: 'POST'
3189
-
3190
-
3191
- }
3192
- );}
3193
-
3194
-
3195
-
3196
- export const getResumeBatchInferenceRunUrl = (batchInferenceRunId: BatchInferenceRunId,) => {
3197
-
3198
-
3199
-
3200
-
3201
- return `/api/v2-beta/batch-inference-runs/${batchInferenceRunId}/resume`
3202
- }
3203
-
3204
- export const resumeBatchInferenceRun = async (batchInferenceRunId: BatchInferenceRunId, options?: Parameters<typeof potatoFetch>[1]): Promise<BatchInferenceRun> => {
3205
-
3206
- return potatoFetch<BatchInferenceRun>(getResumeBatchInferenceRunUrl(batchInferenceRunId),
3207
- {
3208
- ...options,
3209
- method: 'POST'
3210
-
3211
-
3212
- }
3213
- );}
3214
-
3215
-
3216
-
3217
- export const getCancelBatchInferenceRunUrl = (batchInferenceRunId: BatchInferenceRunId,) => {
3218
-
3219
-
3220
-
3221
-
3222
- return `/api/v2-beta/batch-inference-runs/${batchInferenceRunId}/cancel`
3223
- }
3224
-
3225
- export const cancelBatchInferenceRun = async (batchInferenceRunId: BatchInferenceRunId, options?: Parameters<typeof potatoFetch>[1]): Promise<BatchInferenceRun> => {
3226
-
3227
- return potatoFetch<BatchInferenceRun>(getCancelBatchInferenceRunUrl(batchInferenceRunId),
3228
- {
3229
- ...options,
3230
- method: 'POST'
3231
-
3232
-
3233
- }
3234
- );}
3235
-
3236
-
3237
-