@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.
- package/README.md +10 -4
- package/dist/cli/toloka.js +162 -154
- 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 +18 -1
- package/docs/cli-v2.md +6 -4
- package/docs/cli.md +58 -11
- package/docs/getting-started.md +3 -3
- package/docs/limitations.md +1 -1
- package/docs/testing.md +1 -1
- package/docs/troubleshooting.md +1 -1
- package/examples/face-image-collection/README.md +2 -2
- package/openapi/gen/api.ts +78 -0
- package/openapi/gen/models/baseModel.ts +1 -0
- package/openapi/gen/models/checkReport.ts +2 -1
- package/openapi/gen/models/checkReportAnyOfTwoseven.ts +5 -0
- package/openapi/gen/models/checkReportAnyOfTwosevenResultsItem.ts +6 -0
- package/openapi/gen/models/checkReportAnyOfTwosevenResultsItemVerdict.ts +2 -0
- package/openapi/gen/models/currentUser.ts +3 -0
- package/openapi/gen/models/currentUserTeamsItem.ts +6 -0
- package/openapi/gen/models/deliveryOrder.ts +9 -0
- package/openapi/gen/models/deliveryOrderClientName.ts +2 -0
- package/openapi/gen/models/getTrainingRunMetricHistoryParams.ts +4 -0
- package/openapi/gen/models/gistingTrainingConfiguration.ts +6 -2
- package/openapi/gen/models/gistingTrainingConfigurationBatchSize.ts +2 -0
- package/openapi/gen/models/gistingTrainingConfigurationGistTokens.ts +2 -0
- package/openapi/gen/models/gistingTrainingConfigurationInput.ts +6 -2
- package/openapi/gen/models/gistingTrainingConfigurationInputBatchSize.ts +2 -0
- package/openapi/gen/models/gistingTrainingConfigurationInputGistTokens.ts +2 -0
- package/openapi/gen/models/index.ts +28 -4
- package/openapi/gen/models/listDeliveryOrders200.ts +5 -0
- package/openapi/gen/models/sftTrainingConfiguration.ts +6 -3
- package/openapi/gen/models/sftTrainingConfigurationBatchSize.ts +2 -0
- package/openapi/gen/models/sftTrainingConfigurationInput.ts +6 -3
- package/openapi/gen/models/sftTrainingConfigurationInputBatchSize.ts +2 -0
- package/openapi/gen/models/sftTrainingConfigurationInputLoraRank.ts +2 -0
- package/openapi/gen/models/sftTrainingConfigurationLoraRank.ts +2 -0
- package/openapi/gen/models/trainingRunMetricHistory.ts +9 -0
- package/openapi/gen/models/trainingRunMetricHistoryMetric.ts +2 -0
- package/openapi/gen/models/trainingRunMetricHistoryPointsItem.ts +9 -0
- package/openapi/gen/models/trainingRunMetricHistoryPointsItemNonFinite.ts +2 -0
- package/openapi/gen/models/trainingRunMetricHistoryPointsItemValue.ts +2 -0
- package/openapi/gen/models/trainingRunMetrics.ts +9 -0
- package/openapi/gen/models/trainingRunMetricsMetricsItem.ts +8 -0
- package/openapi/gen/models/trainingRunMetricsMetricsItemLatest.ts +9 -0
- package/openapi/gen/models/trainingRunMetricsMetricsItemLatestNonFinite.ts +2 -0
- package/openapi/gen/models/trainingRunMetricsMetricsItemLatestValue.ts +2 -0
- package/openapi/gen/models/trainingRunMetricsMetricsItemMetric.ts +2 -0
- package/openapi/gen/models/trainingRunMetricsUnavailableReason.ts +2 -0
- package/package.json +2 -2
- package/skills/catalog.json +55 -7
- package/skills/toloka-build/SKILL.md +35 -21
- package/skills/toloka-build/references/node-semantics.md +13 -11
- package/skills/toloka-build/references/workflow-and-cli.md +31 -20
- package/skills/toloka-fine-tuning/SKILL.md +155 -0
- package/skills/toloka-get-started/SKILL.md +70 -0
- package/skills/toloka-gisting/SKILL.md +166 -0
- package/skills/toloka-report-issue/references/report-template.md +1 -1
- package/src/authoring/index.ts +14 -0
- package/src/checks/task-ui-typecheck.ts +12 -10
- package/src/cli/analytics.ts +88 -15
- package/src/cli/auth.ts +93 -21
- package/src/cli/auto-update.ts +36 -39
- package/src/cli/check.ts +88 -39
- package/src/cli/cli-entry.ts +3 -2
- package/src/cli/cli-error.ts +43 -0
- package/src/cli/commands/auth.ts +89 -0
- package/src/cli/commands/config.ts +28 -0
- package/src/cli/commands/dataset.ts +85 -0
- package/src/cli/commands/delivery-order.ts +18 -0
- package/src/cli/commands/models.ts +121 -0
- package/src/cli/commands/pipeline.ts +131 -0
- package/src/cli/commands/project.ts +168 -0
- package/src/cli/commands/report.ts +43 -0
- package/src/cli/commands/secret.ts +40 -0
- package/src/cli/commands/skill.ts +36 -0
- package/src/cli/commands/source.ts +204 -0
- package/src/cli/commands/status.ts +17 -0
- package/src/cli/commands/training.ts +261 -0
- package/src/cli/commands/version.ts +14 -0
- package/src/cli/config.ts +7 -8
- package/src/cli/context.ts +251 -0
- package/src/cli/credentials.ts +12 -4
- package/src/cli/data.ts +96 -34
- package/src/cli/delivery-orders.ts +47 -0
- package/src/cli/environment.ts +26 -0
- package/src/cli/file-system.ts +6 -2
- package/src/cli/format-error.ts +45 -2
- package/src/cli/init.ts +14 -11
- package/src/cli/models.ts +43 -12
- package/src/cli/program.ts +120 -1347
- package/src/cli/project-context.ts +126 -43
- package/src/cli/project.ts +80 -28
- package/src/cli/report.ts +24 -9
- package/src/cli/runs.ts +33 -8
- package/src/cli/sdk-version.ts +38 -0
- package/src/cli/settings.ts +13 -5
- package/src/cli/skill.ts +67 -24
- package/src/cli/source.ts +3 -2
- package/src/cli/terminal-io.ts +110 -0
- package/src/cli/trainings.ts +242 -57
- package/src/cli/version.ts +3 -3
- package/src/client.ts +21 -9
- package/src/importer.ts +32 -2
- package/src/transport.ts +13 -1
- package/openapi/gen/models/gistingTrainingConfigurationInputRegime.ts +0 -2
- package/openapi/gen/models/gistingTrainingConfigurationRegime.ts +0 -2
- package/openapi/gen/models/sftTrainingConfigurationInputRegime.ts +0 -2
- 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(
|
|
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) {
|