@toloka-platform/sdk 0.11.1 → 0.11.3
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 +4 -2
- package/dist/cli/toloka.js +167 -160
- 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 +15 -5
- package/docs/cli.md +48 -16
- package/docs/getting-started.md +1 -1
- package/docs/limitations.md +2 -2
- package/docs/testing.md +5 -3
- package/docs/troubleshooting.md +1 -1
- package/examples/README.md +11 -0
- package/examples/app-crowdtesting/README.md +41 -0
- package/examples/app-crowdtesting/fields.ts +6 -0
- package/examples/app-crowdtesting/nodes/app-flow-test/node.ts +381 -0
- package/examples/app-crowdtesting/nodes/collection/node.ts +8 -0
- package/examples/app-crowdtesting/pipeline.browser.integration.spec.ts +77 -0
- package/examples/app-crowdtesting/pipeline.ts +17 -0
- package/examples/egocentric-video-collection/README.md +35 -0
- package/examples/egocentric-video-collection/fields.ts +24 -0
- package/examples/egocentric-video-collection/nodes/collection/node.ts +5 -0
- package/examples/egocentric-video-collection/nodes/record-activity/node.ts +760 -0
- package/examples/egocentric-video-collection/pipeline.browser.integration.spec.ts +65 -0
- package/examples/egocentric-video-collection/pipeline.ts +17 -0
- package/examples/product-moderation/README.md +49 -0
- package/examples/product-moderation/fields.ts +37 -0
- package/examples/product-moderation/nodes/collection/node.ts +16 -0
- package/examples/product-moderation/nodes/moderate-product/instruction.ts +77 -0
- package/examples/product-moderation/nodes/moderate-product/node.ts +368 -0
- package/examples/product-moderation/pipeline.browser.integration.spec.ts +48 -0
- package/examples/product-moderation/pipeline.ts +33 -0
- package/examples/video-pair-rating/fields.ts +16 -4
- package/examples/video-pair-rating/nodes/adjudicate/node.ts +78 -3
- package/examples/video-pair-rating/nodes/adjudicate_op/node.ts +28 -3
- package/examples/video-pair-rating/nodes/overall_preference_pick/node.ts +28 -3
- package/examples/video-pair-rating/nodes/rate_pair/node.ts +65 -2
- package/openapi/gen/api.ts +22 -0
- package/openapi/gen/models/generationBudget.ts +8 -0
- package/openapi/gen/models/generationBudgetReasoningEffort.ts +2 -0
- package/openapi/gen/models/generationModel.ts +12 -0
- package/openapi/gen/models/generationModelDefaultReasoningEffort.ts +2 -0
- package/openapi/gen/models/generationModelId.ts +2 -0
- package/openapi/gen/models/index.ts +8 -0
- package/openapi/gen/models/invalidFieldSchema.ts +6 -0
- package/openapi/gen/models/listGenerationModels200.ts +7 -0
- package/openapi/gen/models/listGenerationModels200DefaultGenerationModelId.ts +2 -0
- package/openapi/gen/models/pipelineGraphSnapshot.ts +2 -0
- package/package.json +2 -2
- package/skills/catalog.json +16 -12
- package/skills/toloka-build/SKILL.md +44 -56
- package/skills/toloka-build/references/human-work.md +156 -0
- package/skills/toloka-build/references/local-setup.md +136 -0
- package/skills/toloka-build/references/node-checks.md +11 -0
- package/skills/toloka-build/references/node-semantics.md +22 -213
- package/skills/toloka-build/references/task-ui.md +61 -0
- package/skills/toloka-build/references/workflow-and-cli.md +29 -227
- package/skills/toloka-fine-tuning/SKILL.md +1 -1
- package/skills/toloka-get-started/SKILL.md +1 -1
- package/skills/toloka-gisting/SKILL.md +1 -1
- package/src/authoring/index.ts +26 -7
- package/src/checks/task-ui-typecheck.ts +3 -3
- package/src/cli/analytics.ts +1 -0
- package/src/cli/auth.ts +51 -18
- package/src/cli/check.ts +88 -17
- package/src/cli/commands/auth.ts +5 -3
- package/src/cli/commands/generation-model.ts +18 -0
- package/src/cli/commands/pipeline.ts +1 -1
- package/src/cli/commands/project.ts +7 -2
- package/src/cli/commands/source.ts +14 -3
- package/src/cli/commands/ui.ts +23 -0
- package/src/cli/config.ts +15 -9
- package/src/cli/context.ts +30 -12
- package/src/cli/credentials.ts +2 -2
- package/src/cli/environment.ts +5 -1
- package/src/cli/generation-models.ts +46 -0
- package/src/cli/program.ts +7 -0
- package/src/cli/project-context.ts +5 -2
- package/src/cli/project.ts +288 -138
- package/src/cli/trainings.ts +12 -0
- package/src/cli/ui.ts +63 -0
- package/src/client.ts +5 -0
- package/src/core-entity-types.json +32 -0
- package/src/graph-rules.json +11 -0
- package/src/importer.ts +46 -40
- package/src/index.ts +4 -0
- package/src/testing/task-ui-browser.ts +45 -2
- package/src/testing/task-ui.ts +2 -9
- package/src/transport.ts +28 -6
- package/src/validate.ts +232 -2
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { PotatoClient } from "../client";
|
|
2
|
+
import { formatTable, type TableIo, writeOutput } from "./table";
|
|
3
|
+
|
|
4
|
+
type GenerationModelApi = Pick<PotatoClient, "generationModels">;
|
|
5
|
+
|
|
6
|
+
const dollars = (amount: number): string => `$${amount.toFixed(2)}`;
|
|
7
|
+
|
|
8
|
+
export const listGenerationModels = async (
|
|
9
|
+
client: GenerationModelApi,
|
|
10
|
+
input: { json: boolean },
|
|
11
|
+
io: TableIo,
|
|
12
|
+
): Promise<void> => {
|
|
13
|
+
const catalog = await client.generationModels.list();
|
|
14
|
+
const recommended = catalog.generationModels
|
|
15
|
+
.filter((model) => model.recommended)
|
|
16
|
+
.map((model) => model.id);
|
|
17
|
+
writeOutput(
|
|
18
|
+
io,
|
|
19
|
+
input.json,
|
|
20
|
+
catalog,
|
|
21
|
+
catalog.generationModels.length === 0
|
|
22
|
+
? "No generation models available."
|
|
23
|
+
: [
|
|
24
|
+
formatTable([
|
|
25
|
+
["ID", "NAME", "REASONING EFFORT", "TYPICAL", "MIN", "MAX"],
|
|
26
|
+
...catalog.generationModels.flatMap((model) =>
|
|
27
|
+
model.budgets.map((budget) => [
|
|
28
|
+
model.id,
|
|
29
|
+
model.displayName,
|
|
30
|
+
budget.reasoningEffort === undefined
|
|
31
|
+
? "-"
|
|
32
|
+
: budget.reasoningEffort === model.defaultReasoningEffort
|
|
33
|
+
? `${budget.reasoningEffort} (default)`
|
|
34
|
+
: budget.reasoningEffort,
|
|
35
|
+
dollars(budget.typical),
|
|
36
|
+
dollars(budget.min),
|
|
37
|
+
dollars(budget.maxEstimate),
|
|
38
|
+
]),
|
|
39
|
+
),
|
|
40
|
+
]),
|
|
41
|
+
"",
|
|
42
|
+
`Default model: ${catalog.defaultGenerationModelId}`,
|
|
43
|
+
...(recommended.length === 0 ? [] : [`Recommended: ${recommended.join(", ")}`]),
|
|
44
|
+
].join("\n"),
|
|
45
|
+
);
|
|
46
|
+
};
|
package/src/cli/program.ts
CHANGED
|
@@ -5,11 +5,13 @@ import type { CliAnalytics, CliAnalyticsCommandOutcome } from "./analytics";
|
|
|
5
5
|
import type { AutoUpdateHooks } from "./auto-update";
|
|
6
6
|
import { maybeAutoUpdate } from "./auto-update";
|
|
7
7
|
import type { BrowserLoginFlow } from "./browser-login";
|
|
8
|
+
import type { DescribeTaskUiComponents } from "../testing/task-ui-browser";
|
|
8
9
|
import { CHECK_RESULT_FILE_ENV, type checkProject } from "./check";
|
|
9
10
|
import { registerAudienceCommands } from "./commands/audience";
|
|
10
11
|
import { registerAuthCommands } from "./commands/auth";
|
|
11
12
|
import { registerConfigCommands } from "./commands/config";
|
|
12
13
|
import { registerDatasetCommands } from "./commands/dataset";
|
|
14
|
+
import { registerGenerationModelCommands } from "./commands/generation-model";
|
|
13
15
|
import { registerDeliveryOrderCommands } from "./commands/delivery-order";
|
|
14
16
|
import { registerModelCommands } from "./commands/models";
|
|
15
17
|
import { registerPipelineCommands } from "./commands/pipeline";
|
|
@@ -20,6 +22,7 @@ import { registerSkillCommands } from "./commands/skill";
|
|
|
20
22
|
import { registerSourceCommands } from "./commands/source";
|
|
21
23
|
import { registerStatusCommand } from "./commands/status";
|
|
22
24
|
import { registerTrainingCommands } from "./commands/training";
|
|
25
|
+
import { registerUiCommands } from "./commands/ui";
|
|
23
26
|
import { registerVersionCommand } from "./commands/version";
|
|
24
27
|
import type { TolokaEnvironment } from "./config";
|
|
25
28
|
import {
|
|
@@ -94,6 +97,7 @@ export function createProgram(context: ProgramContext): CreatedProgram {
|
|
|
94
97
|
registerProjectCommands(program, host);
|
|
95
98
|
registerDeliveryOrderCommands(program, host);
|
|
96
99
|
registerAudienceCommands(program, host);
|
|
100
|
+
registerGenerationModelCommands(program, host);
|
|
97
101
|
registerSourceCommands(program, host);
|
|
98
102
|
registerSecretCommands(program, host);
|
|
99
103
|
registerModelCommands(program, host);
|
|
@@ -103,6 +107,7 @@ export function createProgram(context: ProgramContext): CreatedProgram {
|
|
|
103
107
|
registerStatusCommand(program, host);
|
|
104
108
|
registerReportCommand(program, host);
|
|
105
109
|
registerSkillCommands(program, host);
|
|
110
|
+
registerUiCommands(program, host);
|
|
106
111
|
|
|
107
112
|
return { program, exitCode };
|
|
108
113
|
}
|
|
@@ -198,6 +203,7 @@ export async function runTolokaCli(
|
|
|
198
203
|
runChecks?: typeof checkProject,
|
|
199
204
|
autoUpdate?: AutoUpdateHooks,
|
|
200
205
|
browserLogin?: BrowserLoginFlow,
|
|
206
|
+
taskUiComponents?: DescribeTaskUiComponents,
|
|
201
207
|
): Promise<number> {
|
|
202
208
|
const { environment, warnings } = normalizeEnvironment(rawEnvironment);
|
|
203
209
|
for (const warning of warnings) io.stderr(warning);
|
|
@@ -220,6 +226,7 @@ export async function runTolokaCli(
|
|
|
220
226
|
...(injectedClient === undefined ? {} : { injectedClient }),
|
|
221
227
|
...(browserLogin === undefined ? {} : { browserLogin }),
|
|
222
228
|
...(runChecks === undefined ? {} : { runChecks }),
|
|
229
|
+
...(taskUiComponents === undefined ? {} : { taskUiComponents }),
|
|
223
230
|
};
|
|
224
231
|
const { program, exitCode } = createProgram(baseContext);
|
|
225
232
|
const startedAt = Date.now();
|
|
@@ -50,7 +50,7 @@ export const NO_PROJECT_SELECTED_MESSAGE =
|
|
|
50
50
|
"No project selected. Run toloka project create for a new project, toloka project add for an existing project, or cd into a checkout.";
|
|
51
51
|
|
|
52
52
|
const NETWORK_MISMATCH_MESSAGE =
|
|
53
|
-
"project add writes the machine registry; unset --api-key / --base-url / TOLOKA_API_KEY / TOLOKA_BASE_URL, or run login against that platform first.";
|
|
53
|
+
"project add writes the machine registry; unset --api-key / --base-url / TOLOKA_SCOPED_TOKEN / TOLOKA_API_KEY / TOLOKA_BASE_URL, or run login against that platform first.";
|
|
54
54
|
|
|
55
55
|
const ALIAS_PATTERN = /^[^/\s]+$/u;
|
|
56
56
|
|
|
@@ -187,7 +187,10 @@ const assertStoredNetworkMatches = (
|
|
|
187
187
|
environment: TolokaEnvironment,
|
|
188
188
|
stored: StoredCredentials,
|
|
189
189
|
) => {
|
|
190
|
-
const flagOrEnvKey =
|
|
190
|
+
const flagOrEnvKey =
|
|
191
|
+
firstNonEmpty(flags.apiKey) ??
|
|
192
|
+
firstNonEmpty(environment.TOLOKA_SCOPED_TOKEN) ??
|
|
193
|
+
firstNonEmpty(environment.TOLOKA_API_KEY);
|
|
191
194
|
const flagOrEnvBase =
|
|
192
195
|
firstNonEmpty(flags.baseUrl) ??
|
|
193
196
|
firstNonEmpty(environment.TOLOKA_BASE_URL) ??
|