@toloka-platform/sdk 0.2.0-preview.2 → 0.2.0-preview.4

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 (110) hide show
  1. package/README.md +10 -4
  2. package/dist/cli/toloka.js +162 -154
  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/docs/authoring.md +18 -1
  7. package/docs/cli-v2.md +6 -4
  8. package/docs/cli.md +58 -11
  9. package/docs/getting-started.md +3 -3
  10. package/docs/limitations.md +1 -1
  11. package/docs/testing.md +1 -1
  12. package/docs/troubleshooting.md +1 -1
  13. package/examples/face-image-collection/README.md +2 -2
  14. package/openapi/gen/api.ts +78 -0
  15. package/openapi/gen/models/baseModel.ts +1 -0
  16. package/openapi/gen/models/checkReport.ts +2 -1
  17. package/openapi/gen/models/checkReportAnyOfTwoseven.ts +5 -0
  18. package/openapi/gen/models/checkReportAnyOfTwosevenResultsItem.ts +6 -0
  19. package/openapi/gen/models/checkReportAnyOfTwosevenResultsItemVerdict.ts +2 -0
  20. package/openapi/gen/models/currentUser.ts +3 -0
  21. package/openapi/gen/models/currentUserTeamsItem.ts +6 -0
  22. package/openapi/gen/models/deliveryOrder.ts +9 -0
  23. package/openapi/gen/models/deliveryOrderClientName.ts +2 -0
  24. package/openapi/gen/models/getTrainingRunMetricHistoryParams.ts +4 -0
  25. package/openapi/gen/models/gistingTrainingConfiguration.ts +6 -2
  26. package/openapi/gen/models/gistingTrainingConfigurationBatchSize.ts +2 -0
  27. package/openapi/gen/models/gistingTrainingConfigurationGistTokens.ts +2 -0
  28. package/openapi/gen/models/gistingTrainingConfigurationInput.ts +6 -2
  29. package/openapi/gen/models/gistingTrainingConfigurationInputBatchSize.ts +2 -0
  30. package/openapi/gen/models/gistingTrainingConfigurationInputGistTokens.ts +2 -0
  31. package/openapi/gen/models/index.ts +28 -4
  32. package/openapi/gen/models/listDeliveryOrders200.ts +5 -0
  33. package/openapi/gen/models/sftTrainingConfiguration.ts +6 -3
  34. package/openapi/gen/models/sftTrainingConfigurationBatchSize.ts +2 -0
  35. package/openapi/gen/models/sftTrainingConfigurationInput.ts +6 -3
  36. package/openapi/gen/models/sftTrainingConfigurationInputBatchSize.ts +2 -0
  37. package/openapi/gen/models/sftTrainingConfigurationInputLoraRank.ts +2 -0
  38. package/openapi/gen/models/sftTrainingConfigurationLoraRank.ts +2 -0
  39. package/openapi/gen/models/trainingRunMetricHistory.ts +9 -0
  40. package/openapi/gen/models/trainingRunMetricHistoryMetric.ts +2 -0
  41. package/openapi/gen/models/trainingRunMetricHistoryPointsItem.ts +9 -0
  42. package/openapi/gen/models/trainingRunMetricHistoryPointsItemNonFinite.ts +2 -0
  43. package/openapi/gen/models/trainingRunMetricHistoryPointsItemValue.ts +2 -0
  44. package/openapi/gen/models/trainingRunMetrics.ts +9 -0
  45. package/openapi/gen/models/trainingRunMetricsMetricsItem.ts +8 -0
  46. package/openapi/gen/models/trainingRunMetricsMetricsItemLatest.ts +9 -0
  47. package/openapi/gen/models/trainingRunMetricsMetricsItemLatestNonFinite.ts +2 -0
  48. package/openapi/gen/models/trainingRunMetricsMetricsItemLatestValue.ts +2 -0
  49. package/openapi/gen/models/trainingRunMetricsMetricsItemMetric.ts +2 -0
  50. package/openapi/gen/models/trainingRunMetricsUnavailableReason.ts +2 -0
  51. package/package.json +2 -2
  52. package/skills/catalog.json +55 -7
  53. package/skills/toloka-build/SKILL.md +35 -21
  54. package/skills/toloka-build/references/node-semantics.md +13 -11
  55. package/skills/toloka-build/references/workflow-and-cli.md +31 -20
  56. package/skills/toloka-fine-tuning/SKILL.md +155 -0
  57. package/skills/toloka-get-started/SKILL.md +70 -0
  58. package/skills/toloka-gisting/SKILL.md +166 -0
  59. package/skills/toloka-report-issue/references/report-template.md +1 -1
  60. package/src/authoring/index.ts +14 -0
  61. package/src/checks/task-ui-typecheck.ts +12 -10
  62. package/src/cli/analytics.ts +88 -15
  63. package/src/cli/auth.ts +93 -21
  64. package/src/cli/auto-update.ts +36 -39
  65. package/src/cli/check.ts +88 -39
  66. package/src/cli/cli-entry.ts +3 -2
  67. package/src/cli/cli-error.ts +43 -0
  68. package/src/cli/commands/auth.ts +89 -0
  69. package/src/cli/commands/config.ts +28 -0
  70. package/src/cli/commands/dataset.ts +85 -0
  71. package/src/cli/commands/delivery-order.ts +18 -0
  72. package/src/cli/commands/models.ts +121 -0
  73. package/src/cli/commands/pipeline.ts +131 -0
  74. package/src/cli/commands/project.ts +168 -0
  75. package/src/cli/commands/report.ts +43 -0
  76. package/src/cli/commands/secret.ts +40 -0
  77. package/src/cli/commands/skill.ts +36 -0
  78. package/src/cli/commands/source.ts +204 -0
  79. package/src/cli/commands/status.ts +17 -0
  80. package/src/cli/commands/training.ts +261 -0
  81. package/src/cli/commands/version.ts +14 -0
  82. package/src/cli/config.ts +7 -8
  83. package/src/cli/context.ts +251 -0
  84. package/src/cli/credentials.ts +12 -4
  85. package/src/cli/data.ts +96 -34
  86. package/src/cli/delivery-orders.ts +47 -0
  87. package/src/cli/environment.ts +26 -0
  88. package/src/cli/file-system.ts +6 -2
  89. package/src/cli/format-error.ts +45 -2
  90. package/src/cli/init.ts +14 -11
  91. package/src/cli/models.ts +43 -12
  92. package/src/cli/program.ts +120 -1347
  93. package/src/cli/project-context.ts +126 -43
  94. package/src/cli/project.ts +80 -28
  95. package/src/cli/report.ts +24 -9
  96. package/src/cli/runs.ts +33 -8
  97. package/src/cli/sdk-version.ts +38 -0
  98. package/src/cli/settings.ts +13 -5
  99. package/src/cli/skill.ts +67 -24
  100. package/src/cli/source.ts +3 -2
  101. package/src/cli/terminal-io.ts +110 -0
  102. package/src/cli/trainings.ts +242 -57
  103. package/src/cli/version.ts +3 -3
  104. package/src/client.ts +21 -9
  105. package/src/importer.ts +32 -2
  106. package/src/transport.ts +13 -1
  107. package/openapi/gen/models/gistingTrainingConfigurationInputRegime.ts +0 -2
  108. package/openapi/gen/models/gistingTrainingConfigurationRegime.ts +0 -2
  109. package/openapi/gen/models/sftTrainingConfigurationInputRegime.ts +0 -2
  110. package/openapi/gen/models/sftTrainingConfigurationRegime.ts +0 -2
package/src/importer.ts CHANGED
@@ -263,6 +263,32 @@ function transformExam<Exam extends { gradedEntities: Array<{ targetEntity: stri
263
263
  };
264
264
  }
265
265
 
266
+ const generationCheckNames: readonly string[] = [
267
+ "ui",
268
+ "llmqa",
269
+ "qc_lint",
270
+ "ui_types_lint",
271
+ "exam_dataset",
272
+ "synthgen",
273
+ ];
274
+ const quorumCheckNames: readonly string[] = [
275
+ "ui",
276
+ "llmqa",
277
+ "qc_lint",
278
+ "ui_types_lint",
279
+ "exam_dataset",
280
+ ];
281
+
282
+ const normalizeImportedChecks = (
283
+ checks: Record<string, unknown[]> | undefined,
284
+ requiredNames: readonly string[],
285
+ ): Record<string, unknown[]> | undefined => {
286
+ if (checks === undefined) return undefined;
287
+ const normalized = { ...checks };
288
+ for (const name of requiredNames) normalized[name] ??= [];
289
+ return normalized;
290
+ };
291
+
266
292
  function authoringSettings(node: GraphNode, fieldReference: FieldReference): unknown {
267
293
  switch (node.type) {
268
294
  case "root": {
@@ -296,9 +322,11 @@ function authoringSettings(node: GraphNode, fieldReference: FieldReference): unk
296
322
  };
297
323
  }
298
324
  case "generation": {
299
- const { entities, qualityCriteria, exam, ...settings } = node.settings;
325
+ const { entities, qualityCriteria, exam, checks, ...settings } = node.settings;
326
+ const normalizedChecks = normalizeImportedChecks(checks, generationCheckNames);
300
327
  return {
301
328
  ...settings,
329
+ ...(normalizedChecks === undefined ? {} : { checks: normalizedChecks }),
302
330
  entities: {
303
331
  input: entities.input.map((entity) => transformEntity(entity, fieldReference)),
304
332
  output: entities.output.map((entity) => transformEntity(entity, fieldReference)),
@@ -326,9 +354,11 @@ function authoringSettings(node: GraphNode, fieldReference: FieldReference): unk
326
354
  };
327
355
  }
328
356
  case "quorum": {
329
- const { entities, qualityCriteria, exam, ...settings } = node.settings;
357
+ const { entities, qualityCriteria, exam, checks, ...settings } = node.settings;
358
+ const normalizedChecks = normalizeImportedChecks(checks, quorumCheckNames);
330
359
  return {
331
360
  ...settings,
361
+ ...(normalizedChecks === undefined ? {} : { checks: normalizedChecks }),
332
362
  entities: {
333
363
  input: entities.input.map((entity) => transformEntity(entity, fieldReference)),
334
364
  output: entities.output.map((entity) => transformEntity(entity, fieldReference)),
package/src/transport.ts CHANGED
@@ -25,6 +25,15 @@ export const createRequestOptions = (
25
25
  };
26
26
  };
27
27
 
28
+ const prepareRequestInit = (requestOptions: RequestInit, headers: Headers): RequestInit => {
29
+ const method = (requestOptions.method ?? "GET").toUpperCase();
30
+ if (method === "GET" || method === "HEAD" || requestOptions.body !== undefined) {
31
+ return { ...requestOptions, headers };
32
+ }
33
+ headers.set("Content-Type", "application/json");
34
+ return { ...requestOptions, headers, body: "{}" };
35
+ };
36
+
28
37
  export function potatoFetch<T>(url: string, options: TransportRequestInit): Promise<T>;
29
38
  export async function potatoFetch(url: string, options: TransportRequestInit): Promise<unknown> {
30
39
  const { fetch: fetchImplementation = globalThis.fetch, ...requestOptions } = options;
@@ -33,7 +42,10 @@ export async function potatoFetch(url: string, options: TransportRequestInit): P
33
42
  assert(baseUrl, "The SDK base URL is missing");
34
43
  headers.delete(BASE_URL_HEADER);
35
44
 
36
- const response = await fetchImplementation(new URL(url, baseUrl), { ...requestOptions, headers });
45
+ const response = await fetchImplementation(
46
+ new URL(url, baseUrl),
47
+ prepareRequestInit(requestOptions, headers),
48
+ );
37
49
  const text = await response.text();
38
50
 
39
51
  if (!response.ok) {
@@ -1,2 +0,0 @@
1
-
2
- export type GistingTrainingConfigurationInputRegime = 'low' | 'medium' | 'high';
@@ -1,2 +0,0 @@
1
-
2
- export type GistingTrainingConfigurationRegime = 'low' | 'medium' | 'high';
@@ -1,2 +0,0 @@
1
-
2
- export type SftTrainingConfigurationInputRegime = 'low' | 'medium' | 'high';
@@ -1,2 +0,0 @@
1
-
2
- export type SftTrainingConfigurationRegime = 'low' | 'medium' | 'high';