dataiku-sdk 0.10.1 → 0.12.0
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/LICENSE +21 -0
- package/dist/packages/types/src/index.d.ts +19 -2
- package/dist/packages/types/src/index.js +13 -1
- package/dist/src/cli/coerce.d.ts +36 -0
- package/dist/src/cli/coerce.js +239 -0
- package/dist/src/cli/commands/analysis.d.ts +2 -0
- package/dist/src/cli/commands/analysis.js +66 -0
- package/dist/src/cli/commands/api-deployer.d.ts +2 -0
- package/dist/src/cli/commands/api-deployer.js +170 -0
- package/dist/src/cli/commands/api-service.d.ts +2 -0
- package/dist/src/cli/commands/api-service.js +121 -0
- package/dist/src/cli/commands/app.d.ts +2 -0
- package/dist/src/cli/commands/app.js +78 -0
- package/dist/src/cli/commands/bundle.d.ts +2 -0
- package/dist/src/cli/commands/bundle.js +107 -0
- package/dist/src/cli/commands/business-app.d.ts +2 -0
- package/dist/src/cli/commands/business-app.js +76 -0
- package/dist/src/cli/commands/code-env.d.ts +2 -0
- package/dist/src/cli/commands/code-env.js +255 -0
- package/dist/src/cli/commands/code.d.ts +2 -0
- package/dist/src/cli/commands/code.js +63 -0
- package/dist/src/cli/commands/connection.d.ts +2 -0
- package/dist/src/cli/commands/connection.js +54 -0
- package/dist/src/cli/commands/continuous-activity.d.ts +2 -0
- package/dist/src/cli/commands/continuous-activity.js +38 -0
- package/dist/src/cli/commands/dashboard.d.ts +2 -0
- package/dist/src/cli/commands/dashboard.js +99 -0
- package/dist/src/cli/commands/data-quality.d.ts +2 -0
- package/dist/src/cli/commands/data-quality.js +235 -0
- package/dist/src/cli/commands/dataset.d.ts +2 -0
- package/dist/src/cli/commands/dataset.js +288 -0
- package/dist/src/cli/commands/discussion.d.ts +2 -0
- package/dist/src/cli/commands/discussion.js +47 -0
- package/dist/src/cli/commands/doctor.d.ts +2 -0
- package/dist/src/cli/commands/doctor.js +9 -0
- package/dist/src/cli/commands/flow-zone.d.ts +2 -0
- package/dist/src/cli/commands/flow-zone.js +282 -0
- package/dist/src/cli/commands/folder.d.ts +2 -0
- package/dist/src/cli/commands/folder.js +202 -0
- package/dist/src/cli/commands/future.d.ts +2 -0
- package/dist/src/cli/commands/future.js +57 -0
- package/dist/src/cli/commands/index.d.ts +2 -0
- package/dist/src/cli/commands/index.js +78 -0
- package/dist/src/cli/commands/insight.d.ts +2 -0
- package/dist/src/cli/commands/insight.js +156 -0
- package/dist/src/cli/commands/job.d.ts +2 -0
- package/dist/src/cli/commands/job.js +406 -0
- package/dist/src/cli/commands/meaning.d.ts +2 -0
- package/dist/src/cli/commands/meaning.js +115 -0
- package/dist/src/cli/commands/metrics.d.ts +2 -0
- package/dist/src/cli/commands/metrics.js +39 -0
- package/dist/src/cli/commands/ml-task.d.ts +2 -0
- package/dist/src/cli/commands/ml-task.js +171 -0
- package/dist/src/cli/commands/model-evaluation-store.d.ts +2 -0
- package/dist/src/cli/commands/model-evaluation-store.js +83 -0
- package/dist/src/cli/commands/notebook.d.ts +2 -0
- package/dist/src/cli/commands/notebook.js +242 -0
- package/dist/src/cli/commands/project-deployer.d.ts +2 -0
- package/dist/src/cli/commands/project-deployer.js +118 -0
- package/dist/src/cli/commands/project-library.d.ts +2 -0
- package/dist/src/cli/commands/project-library.js +197 -0
- package/dist/src/cli/commands/project.d.ts +2 -0
- package/dist/src/cli/commands/project.js +133 -0
- package/dist/src/cli/commands/recipe.d.ts +2 -0
- package/dist/src/cli/commands/recipe.js +659 -0
- package/dist/src/cli/commands/saved-model.d.ts +2 -0
- package/dist/src/cli/commands/saved-model.js +85 -0
- package/dist/src/cli/commands/scenario.d.ts +2 -0
- package/dist/src/cli/commands/scenario.js +190 -0
- package/dist/src/cli/commands/sql.d.ts +2 -0
- package/dist/src/cli/commands/sql.js +109 -0
- package/dist/src/cli/commands/statistics.d.ts +2 -0
- package/dist/src/cli/commands/statistics.js +165 -0
- package/dist/src/cli/commands/streaming-endpoint.d.ts +2 -0
- package/dist/src/cli/commands/streaming-endpoint.js +50 -0
- package/dist/src/cli/commands/variable.d.ts +2 -0
- package/dist/src/cli/commands/variable.js +49 -0
- package/dist/src/cli/commands/webapp.d.ts +2 -0
- package/dist/src/cli/commands/webapp.js +67 -0
- package/dist/src/cli/commands/wiki.d.ts +2 -0
- package/dist/src/cli/commands/wiki.js +123 -0
- package/dist/src/cli/commands/workspace.d.ts +2 -0
- package/dist/src/cli/commands/workspace.js +68 -0
- package/dist/src/cli/contract.d.ts +104 -0
- package/dist/src/cli/contract.js +2041 -0
- package/dist/src/cli/doctor.d.ts +104 -0
- package/dist/src/cli/doctor.js +356 -0
- package/dist/src/cli/env.d.ts +2 -0
- package/dist/src/cli/env.js +37 -0
- package/dist/src/cli/flags.d.ts +16 -0
- package/dist/src/cli/flags.js +272 -0
- package/dist/src/cli/helpers/cleanup.d.ts +3 -0
- package/dist/src/cli/helpers/cleanup.js +204 -0
- package/dist/src/cli/helpers/dataset.d.ts +2 -0
- package/dist/src/cli/helpers/dataset.js +17 -0
- package/dist/src/cli/helpers/flow-zone.d.ts +69 -0
- package/dist/src/cli/helpers/flow-zone.js +420 -0
- package/dist/src/cli/helpers/recipe.d.ts +11 -0
- package/dist/src/cli/helpers/recipe.js +83 -0
- package/dist/src/cli/output.d.ts +38 -0
- package/dist/src/cli/output.js +159 -0
- package/dist/src/cli/runtime.d.ts +15 -0
- package/dist/src/cli/runtime.js +59 -0
- package/dist/src/cli/types.d.ts +25 -0
- package/dist/src/cli/types.js +1 -0
- package/dist/src/cli/usage.d.ts +16 -0
- package/dist/src/cli/usage.js +84 -0
- package/dist/src/cli/version.d.ts +14 -0
- package/dist/src/cli/version.js +63 -0
- package/dist/src/cli.js +671 -8254
- package/dist/src/client.d.ts +13 -1
- package/dist/src/client.js +34 -13
- package/dist/src/errors.d.ts +6 -0
- package/dist/src/errors.js +102 -4
- package/dist/src/index.d.ts +7 -3
- package/dist/src/index.js +6 -2
- package/dist/src/resources/analyses.d.ts +34 -0
- package/dist/src/resources/analyses.js +31 -0
- package/dist/src/resources/api-services.d.ts +2 -0
- package/dist/src/resources/api-services.js +10 -0
- package/dist/src/resources/applications.d.ts +1 -1
- package/dist/src/resources/applications.js +27 -1
- package/dist/src/resources/continuous-activities.js +1 -0
- package/dist/src/resources/data-quality.js +5 -3
- package/dist/src/resources/datasets.d.ts +3 -0
- package/dist/src/resources/datasets.js +10 -5
- package/dist/src/resources/flow-zones.d.ts +2 -2
- package/dist/src/resources/flow-zones.js +4 -1
- package/dist/src/resources/meanings.d.ts +2 -0
- package/dist/src/resources/meanings.js +4 -0
- package/dist/src/resources/ml-tasks.d.ts +91 -0
- package/dist/src/resources/ml-tasks.js +130 -0
- package/dist/src/resources/model-evaluation-stores.d.ts +41 -0
- package/dist/src/resources/model-evaluation-stores.js +36 -0
- package/dist/src/resources/notebooks.d.ts +5 -7
- package/dist/src/resources/notebooks.js +10 -7
- package/dist/src/resources/projects.d.ts +1 -1
- package/dist/src/resources/projects.js +2 -2
- package/dist/src/resources/recipes.d.ts +3 -3
- package/dist/src/resources/recipes.js +198 -38
- package/dist/src/resources/saved-models.d.ts +41 -0
- package/dist/src/resources/saved-models.js +40 -0
- package/dist/src/resources/scenarios.js +67 -26
- package/dist/src/resources/statistics.js +9 -0
- package/dist/src/schemas.d.ts +2 -2
- package/dist/src/schemas.js +1 -1
- package/dist/src/skill.js +2 -2
- package/dist/src/utils/sanitize.js +2 -1
- package/package.json +1 -1
- package/packages/types/dist/index.d.ts +19 -2
- package/packages/types/dist/index.js +13 -1
|
@@ -54,8 +54,11 @@ export class FlowZonesResource extends BaseResource {
|
|
|
54
54
|
async moveItem(zoneId, item, projectKey) {
|
|
55
55
|
return this.moveItems(zoneId, [item,], projectKey);
|
|
56
56
|
}
|
|
57
|
-
/** Get the graph for a single flow zone. */
|
|
57
|
+
/** Get the full flow graph, or the graph for a single non-default flow zone. */
|
|
58
58
|
async graph(zoneId, projectKey) {
|
|
59
|
+
if (zoneId === undefined || zoneId === "default") {
|
|
60
|
+
return this.client.get(`/public/api/projects/${this.enc(projectKey)}/flow/graph/`);
|
|
61
|
+
}
|
|
59
62
|
return this.client.get(`/public/api/projects/${this.enc(projectKey)}/flow/zones/${encodeURIComponent(zoneId)}/graph`);
|
|
60
63
|
}
|
|
61
64
|
}
|
|
@@ -37,5 +37,7 @@ export declare class MeaningsResource extends BaseResource {
|
|
|
37
37
|
create(id: string, label: string, type: MeaningType, body?: MeaningCreateBody): Promise<string>;
|
|
38
38
|
/** Replace a user-defined meaning definition. */
|
|
39
39
|
update(meaningId: string, body: MeaningDefinition): Promise<MeaningDefinition>;
|
|
40
|
+
/** Delete a user-defined meaning definition. */
|
|
41
|
+
delete(meaningId: string): Promise<void>;
|
|
40
42
|
private meaningPath;
|
|
41
43
|
}
|
|
@@ -27,6 +27,10 @@ export class MeaningsResource extends BaseResource {
|
|
|
27
27
|
async update(meaningId, body) {
|
|
28
28
|
return this.client.put(this.meaningPath(meaningId), body);
|
|
29
29
|
}
|
|
30
|
+
/** Delete a user-defined meaning definition. */
|
|
31
|
+
async delete(meaningId) {
|
|
32
|
+
await this.client.del(this.meaningPath(meaningId));
|
|
33
|
+
}
|
|
30
34
|
meaningPath(meaningId) {
|
|
31
35
|
return `/public/api/meanings/${encodeURIComponent(meaningId)}`;
|
|
32
36
|
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { BaseResource } from "./base.js";
|
|
2
|
+
export type MlTaskType = "PREDICTION" | "CLUSTERING";
|
|
3
|
+
export interface MlTaskCreateOptions {
|
|
4
|
+
analysisId: string;
|
|
5
|
+
taskType: MlTaskType;
|
|
6
|
+
targetVariable?: string;
|
|
7
|
+
predictionType?: string;
|
|
8
|
+
backendType?: string;
|
|
9
|
+
guessPolicy?: string;
|
|
10
|
+
projectKey?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface MlTaskCreateResult extends Record<string, unknown> {
|
|
13
|
+
analysisId?: string;
|
|
14
|
+
mlTaskId?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface MlTaskFullModelId extends Record<string, unknown> {
|
|
17
|
+
id?: string;
|
|
18
|
+
fullModelId?: {
|
|
19
|
+
sessionId?: string;
|
|
20
|
+
[key: string]: unknown;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export interface MlTaskStatus extends Record<string, unknown> {
|
|
24
|
+
guessing?: boolean;
|
|
25
|
+
training?: boolean;
|
|
26
|
+
fullModelIds?: MlTaskFullModelId[];
|
|
27
|
+
}
|
|
28
|
+
export interface MlTaskSettings extends Record<string, unknown> {
|
|
29
|
+
taskType?: MlTaskType;
|
|
30
|
+
predictionType?: string;
|
|
31
|
+
}
|
|
32
|
+
export interface MlTaskActionResult extends Record<string, unknown> {
|
|
33
|
+
message?: string;
|
|
34
|
+
}
|
|
35
|
+
export interface MlTaskTrainOptions {
|
|
36
|
+
analysisId: string;
|
|
37
|
+
mlTaskId: string;
|
|
38
|
+
sessionName?: string;
|
|
39
|
+
sessionDescription?: string;
|
|
40
|
+
runQueue?: boolean;
|
|
41
|
+
wait?: boolean;
|
|
42
|
+
projectKey?: string;
|
|
43
|
+
}
|
|
44
|
+
export interface MlTaskTrainingSession extends Record<string, unknown> {
|
|
45
|
+
sessionId: string;
|
|
46
|
+
}
|
|
47
|
+
export interface MlTaskTrainCompletedResult extends Record<string, unknown> {
|
|
48
|
+
sessionId: string;
|
|
49
|
+
trainedModelIds: string[];
|
|
50
|
+
}
|
|
51
|
+
export type MlTaskTrainResult = MlTaskTrainingSession | MlTaskTrainCompletedResult;
|
|
52
|
+
export interface MlTrainedModelDetails extends Record<string, unknown> {
|
|
53
|
+
id?: string;
|
|
54
|
+
algorithm?: string;
|
|
55
|
+
predictionType?: string;
|
|
56
|
+
}
|
|
57
|
+
export interface MlTaskDeployOptions {
|
|
58
|
+
analysisId: string;
|
|
59
|
+
mlTaskId: string;
|
|
60
|
+
modelId: string;
|
|
61
|
+
trainDatasetRef: string;
|
|
62
|
+
testDatasetRef?: string;
|
|
63
|
+
modelName: string;
|
|
64
|
+
redoOptimization?: boolean;
|
|
65
|
+
projectKey?: string;
|
|
66
|
+
}
|
|
67
|
+
export interface MlTaskDeployResult extends Record<string, unknown> {
|
|
68
|
+
savedModelId?: string;
|
|
69
|
+
trainRecipeName?: string;
|
|
70
|
+
}
|
|
71
|
+
export declare class MlTasksResource extends BaseResource {
|
|
72
|
+
/** Create a prediction or clustering task in an existing visual analysis. */
|
|
73
|
+
create(opts: MlTaskCreateOptions): Promise<MlTaskCreateResult>;
|
|
74
|
+
/** Get the current guessing, training, and trained-model status of a task. */
|
|
75
|
+
status(analysisId: string, mlTaskId: string, projectKey?: string): Promise<MlTaskStatus>;
|
|
76
|
+
/** Get the editable settings of an ML task. */
|
|
77
|
+
getSettings(analysisId: string, mlTaskId: string, projectKey?: string): Promise<MlTaskSettings>;
|
|
78
|
+
/** Save the full settings object of an ML task. */
|
|
79
|
+
saveSettings(analysisId: string, mlTaskId: string, settings: MlTaskSettings, projectKey?: string): Promise<MlTaskActionResult | undefined>;
|
|
80
|
+
/** Start training, optionally waiting for the task to finish. */
|
|
81
|
+
train(opts: MlTaskTrainOptions): Promise<MlTaskTrainResult>;
|
|
82
|
+
/** List identifiers for every trained model currently present on the task. */
|
|
83
|
+
listTrainedModels(analysisId: string, mlTaskId: string, projectKey?: string): Promise<string[]>;
|
|
84
|
+
/** Get full details for a trained model. */
|
|
85
|
+
trainedModelDetails(analysisId: string, mlTaskId: string, modelId: string, projectKey?: string): Promise<MlTrainedModelDetails>;
|
|
86
|
+
/** Deploy a trained model to the Flow as a saved model and training recipe. */
|
|
87
|
+
deployToFlow(opts: MlTaskDeployOptions): Promise<MlTaskDeployResult>;
|
|
88
|
+
/** Delete an ML task and its trained models. */
|
|
89
|
+
delete(analysisId: string, mlTaskId: string, projectKey?: string): Promise<void>;
|
|
90
|
+
private taskPath;
|
|
91
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { UsageError, } from "../cli/usage.js";
|
|
2
|
+
import { BaseResource, } from "./base.js";
|
|
3
|
+
const TRAIN_POLL_INTERVAL_MS = 5_000;
|
|
4
|
+
function requireNonEmpty(value, name) {
|
|
5
|
+
if (typeof value !== "string" || value.trim().length === 0) {
|
|
6
|
+
throw new UsageError(`${name} must be a non-empty string.`, "validation_failed");
|
|
7
|
+
}
|
|
8
|
+
return value;
|
|
9
|
+
}
|
|
10
|
+
function delay(ms) {
|
|
11
|
+
const { promise, resolve, } = Promise.withResolvers();
|
|
12
|
+
setTimeout(resolve, ms);
|
|
13
|
+
return promise;
|
|
14
|
+
}
|
|
15
|
+
function modelIdsFromStatus(status) {
|
|
16
|
+
if (!Array.isArray(status.fullModelIds))
|
|
17
|
+
return [];
|
|
18
|
+
const modelIds = [];
|
|
19
|
+
for (const model of status.fullModelIds) {
|
|
20
|
+
if (typeof model?.id === "string" && model.id.length > 0)
|
|
21
|
+
modelIds.push(model.id);
|
|
22
|
+
}
|
|
23
|
+
return modelIds;
|
|
24
|
+
}
|
|
25
|
+
export class MlTasksResource extends BaseResource {
|
|
26
|
+
/** Create a prediction or clustering task in an existing visual analysis. */
|
|
27
|
+
async create(opts) {
|
|
28
|
+
if (opts.taskType !== "PREDICTION" && opts.taskType !== "CLUSTERING") {
|
|
29
|
+
throw new UsageError("taskType must be PREDICTION or CLUSTERING.", "invalid_enum");
|
|
30
|
+
}
|
|
31
|
+
if (opts.taskType === "PREDICTION"
|
|
32
|
+
&& (typeof opts.targetVariable !== "string" || opts.targetVariable.trim().length === 0)) {
|
|
33
|
+
throw new UsageError("targetVariable is required for PREDICTION ML tasks.", "missing_required_arg");
|
|
34
|
+
}
|
|
35
|
+
const analysisId = encodeURIComponent(requireNonEmpty(opts.analysisId, "analysisId"));
|
|
36
|
+
const backendType = opts.backendType ?? "PY_MEMORY";
|
|
37
|
+
const guessPolicy = opts.guessPolicy
|
|
38
|
+
?? (opts.taskType === "CLUSTERING" ? "KMEANS" : "DEFAULT");
|
|
39
|
+
requireNonEmpty(backendType, "backendType");
|
|
40
|
+
requireNonEmpty(guessPolicy, "guessPolicy");
|
|
41
|
+
if (opts.targetVariable !== undefined)
|
|
42
|
+
requireNonEmpty(opts.targetVariable, "targetVariable");
|
|
43
|
+
if (opts.predictionType !== undefined)
|
|
44
|
+
requireNonEmpty(opts.predictionType, "predictionType");
|
|
45
|
+
return this.client.post(`/public/api/projects/${this.enc(opts.projectKey)}/lab/${analysisId}/models/`, {
|
|
46
|
+
taskType: opts.taskType,
|
|
47
|
+
...(opts.targetVariable !== undefined
|
|
48
|
+
? { targetVariable: opts.targetVariable, }
|
|
49
|
+
: {}),
|
|
50
|
+
...(opts.predictionType !== undefined
|
|
51
|
+
? { predictionType: opts.predictionType, }
|
|
52
|
+
: {}),
|
|
53
|
+
backendType,
|
|
54
|
+
guessPolicy,
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
/** Get the current guessing, training, and trained-model status of a task. */
|
|
58
|
+
async status(analysisId, mlTaskId, projectKey) {
|
|
59
|
+
return this.client.get(`${this.taskPath(analysisId, mlTaskId, projectKey)}/status`);
|
|
60
|
+
}
|
|
61
|
+
/** Get the editable settings of an ML task. */
|
|
62
|
+
async getSettings(analysisId, mlTaskId, projectKey) {
|
|
63
|
+
return this.client.get(`${this.taskPath(analysisId, mlTaskId, projectKey)}/settings`);
|
|
64
|
+
}
|
|
65
|
+
/** Save the full settings object of an ML task. */
|
|
66
|
+
async saveSettings(analysisId, mlTaskId, settings, projectKey) {
|
|
67
|
+
if (settings === null || typeof settings !== "object" || Array.isArray(settings)) {
|
|
68
|
+
throw new UsageError("settings must be an object.", "validation_failed");
|
|
69
|
+
}
|
|
70
|
+
return this.client.post(`${this.taskPath(analysisId, mlTaskId, projectKey)}/settings`, settings);
|
|
71
|
+
}
|
|
72
|
+
/** Start training, optionally waiting for the task to finish. */
|
|
73
|
+
async train(opts) {
|
|
74
|
+
if (opts.sessionName !== undefined)
|
|
75
|
+
requireNonEmpty(opts.sessionName, "sessionName");
|
|
76
|
+
if (opts.sessionDescription !== undefined) {
|
|
77
|
+
requireNonEmpty(opts.sessionDescription, "sessionDescription");
|
|
78
|
+
}
|
|
79
|
+
const taskPath = this.taskPath(opts.analysisId, opts.mlTaskId, opts.projectKey);
|
|
80
|
+
const session = await this.client.post(`${taskPath}/train`, {
|
|
81
|
+
sessionName: opts.sessionName,
|
|
82
|
+
sessionDescription: opts.sessionDescription,
|
|
83
|
+
runQueue: opts.runQueue ?? false,
|
|
84
|
+
});
|
|
85
|
+
if (opts.wait !== true)
|
|
86
|
+
return session;
|
|
87
|
+
let status = await this.status(opts.analysisId, opts.mlTaskId, opts.projectKey);
|
|
88
|
+
while (status.training !== false) {
|
|
89
|
+
await delay(TRAIN_POLL_INTERVAL_MS);
|
|
90
|
+
status = await this.status(opts.analysisId, opts.mlTaskId, opts.projectKey);
|
|
91
|
+
}
|
|
92
|
+
return {
|
|
93
|
+
sessionId: session.sessionId,
|
|
94
|
+
trainedModelIds: modelIdsFromStatus(status),
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
/** List identifiers for every trained model currently present on the task. */
|
|
98
|
+
async listTrainedModels(analysisId, mlTaskId, projectKey) {
|
|
99
|
+
return modelIdsFromStatus(await this.status(analysisId, mlTaskId, projectKey));
|
|
100
|
+
}
|
|
101
|
+
/** Get full details for a trained model. */
|
|
102
|
+
async trainedModelDetails(analysisId, mlTaskId, modelId, projectKey) {
|
|
103
|
+
const id = encodeURIComponent(requireNonEmpty(modelId, "modelId"));
|
|
104
|
+
return this.client.get(`${this.taskPath(analysisId, mlTaskId, projectKey)}/models/${id}/details`);
|
|
105
|
+
}
|
|
106
|
+
/** Deploy a trained model to the Flow as a saved model and training recipe. */
|
|
107
|
+
async deployToFlow(opts) {
|
|
108
|
+
const modelId = encodeURIComponent(requireNonEmpty(opts.modelId, "modelId"));
|
|
109
|
+
const trainDatasetRef = requireNonEmpty(opts.trainDatasetRef, "trainDatasetRef");
|
|
110
|
+
const modelName = requireNonEmpty(opts.modelName, "modelName");
|
|
111
|
+
if (opts.testDatasetRef !== undefined) {
|
|
112
|
+
requireNonEmpty(opts.testDatasetRef, "testDatasetRef");
|
|
113
|
+
}
|
|
114
|
+
return this.client.post(`${this.taskPath(opts.analysisId, opts.mlTaskId, opts.projectKey)}/models/${modelId}/actions/deployToFlow`, {
|
|
115
|
+
trainDatasetRef,
|
|
116
|
+
testDatasetRef: opts.testDatasetRef,
|
|
117
|
+
modelName,
|
|
118
|
+
redoOptimization: opts.redoOptimization ?? true,
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
/** Delete an ML task and its trained models. */
|
|
122
|
+
async delete(analysisId, mlTaskId, projectKey) {
|
|
123
|
+
await this.client.del(`${this.taskPath(analysisId, mlTaskId, projectKey)}/`);
|
|
124
|
+
}
|
|
125
|
+
taskPath(analysisId, mlTaskId, projectKey) {
|
|
126
|
+
const analysis = encodeURIComponent(requireNonEmpty(analysisId, "analysisId"));
|
|
127
|
+
const task = encodeURIComponent(requireNonEmpty(mlTaskId, "mlTaskId"));
|
|
128
|
+
return `/public/api/projects/${this.enc(projectKey)}/models/lab/${analysis}/${task}`;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { BaseResource } from "./base.js";
|
|
2
|
+
export interface ModelEvaluationStoreListItem extends Record<string, unknown> {
|
|
3
|
+
id?: string;
|
|
4
|
+
name?: string;
|
|
5
|
+
projectKey?: string;
|
|
6
|
+
mesFlavor?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface ModelEvaluationStore extends Record<string, unknown> {
|
|
9
|
+
id?: string;
|
|
10
|
+
name?: string;
|
|
11
|
+
projectKey?: string;
|
|
12
|
+
mesFlavor?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface ModelEvaluationStoreCreateOptions {
|
|
15
|
+
name: string;
|
|
16
|
+
projectKey?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface ModelEvaluationStoreCreateResult extends Record<string, unknown> {
|
|
19
|
+
id?: string;
|
|
20
|
+
name?: string;
|
|
21
|
+
projectKey?: string;
|
|
22
|
+
}
|
|
23
|
+
export interface ModelEvaluationListItem extends Record<string, unknown> {
|
|
24
|
+
id?: string;
|
|
25
|
+
evaluationId?: string;
|
|
26
|
+
createdOn?: number;
|
|
27
|
+
label?: string;
|
|
28
|
+
}
|
|
29
|
+
export declare class ModelEvaluationStoresResource extends BaseResource {
|
|
30
|
+
/** List model evaluation stores in a project. */
|
|
31
|
+
list(projectKey?: string): Promise<ModelEvaluationStoreListItem[]>;
|
|
32
|
+
/** Get model evaluation store settings and metadata. */
|
|
33
|
+
get(modelEvaluationStoreId: string, projectKey?: string): Promise<ModelEvaluationStore>;
|
|
34
|
+
/** Create a tabular model evaluation store. */
|
|
35
|
+
create(opts: ModelEvaluationStoreCreateOptions): Promise<ModelEvaluationStoreCreateResult>;
|
|
36
|
+
/** List evaluations in a model evaluation store. */
|
|
37
|
+
listEvaluations(modelEvaluationStoreId: string, projectKey?: string): Promise<ModelEvaluationListItem[]>;
|
|
38
|
+
/** Delete a model evaluation store and its evaluations. */
|
|
39
|
+
delete(modelEvaluationStoreId: string, projectKey?: string): Promise<void>;
|
|
40
|
+
private storePath;
|
|
41
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { UsageError, } from "../cli/usage.js";
|
|
2
|
+
import { BaseResource, } from "./base.js";
|
|
3
|
+
function requireNonEmpty(value, name) {
|
|
4
|
+
if (typeof value !== "string" || value.trim().length === 0) {
|
|
5
|
+
throw new UsageError(`${name} must be a non-empty string.`, "validation_failed");
|
|
6
|
+
}
|
|
7
|
+
return value;
|
|
8
|
+
}
|
|
9
|
+
export class ModelEvaluationStoresResource extends BaseResource {
|
|
10
|
+
/** List model evaluation stores in a project. */
|
|
11
|
+
async list(projectKey) {
|
|
12
|
+
return this.client.get(`/public/api/projects/${this.enc(projectKey)}/evaluationstores/`);
|
|
13
|
+
}
|
|
14
|
+
/** Get model evaluation store settings and metadata. */
|
|
15
|
+
async get(modelEvaluationStoreId, projectKey) {
|
|
16
|
+
return this.client.get(this.storePath(modelEvaluationStoreId, projectKey));
|
|
17
|
+
}
|
|
18
|
+
/** Create a tabular model evaluation store. */
|
|
19
|
+
async create(opts) {
|
|
20
|
+
const name = requireNonEmpty(opts.name, "name");
|
|
21
|
+
const projectKey = this.resolveProjectKey(opts.projectKey);
|
|
22
|
+
return this.client.post(`/public/api/projects/${encodeURIComponent(projectKey)}/evaluationstores/?flavor=TABULAR`, { projectKey, name, });
|
|
23
|
+
}
|
|
24
|
+
/** List evaluations in a model evaluation store. */
|
|
25
|
+
async listEvaluations(modelEvaluationStoreId, projectKey) {
|
|
26
|
+
return this.client.get(`${this.storePath(modelEvaluationStoreId, projectKey)}/evaluations/`);
|
|
27
|
+
}
|
|
28
|
+
/** Delete a model evaluation store and its evaluations. */
|
|
29
|
+
async delete(modelEvaluationStoreId, projectKey) {
|
|
30
|
+
await this.client.del(this.storePath(modelEvaluationStoreId, projectKey));
|
|
31
|
+
}
|
|
32
|
+
storePath(modelEvaluationStoreId, projectKey) {
|
|
33
|
+
const id = encodeURIComponent(requireNonEmpty(modelEvaluationStoreId, "modelEvaluationStoreId"));
|
|
34
|
+
return `/public/api/projects/${this.enc(projectKey)}/evaluationstores/${id}`;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -5,15 +5,11 @@ export declare class NotebooksResource extends BaseResource {
|
|
|
5
5
|
listJupyter(projectKey?: string): Promise<JupyterNotebookSummary[]>;
|
|
6
6
|
/** Get the full content of a Jupyter notebook. */
|
|
7
7
|
getJupyter(name: string, projectKey?: string): Promise<JupyterNotebookContent>;
|
|
8
|
+
/** Create a Jupyter notebook. */
|
|
9
|
+
createJupyter(name: string, content: JupyterNotebookContent, projectKey?: string): Promise<void>;
|
|
8
10
|
/** Save (overwrite) a Jupyter notebook's content. */
|
|
9
11
|
saveJupyter(name: string, content: JupyterNotebookContent, projectKey?: string): Promise<void>;
|
|
10
|
-
/**
|
|
11
|
-
* Delete a Jupyter notebook.
|
|
12
|
-
*
|
|
13
|
-
* The SDK intentionally does not expose notebook creation as a first-class
|
|
14
|
-
* resource method yet; integration tests create disposable notebooks through
|
|
15
|
-
* the documented project-level create endpoint.
|
|
16
|
-
*/
|
|
12
|
+
/** Delete a Jupyter notebook. */
|
|
17
13
|
deleteJupyter(name: string, projectKey?: string): Promise<void>;
|
|
18
14
|
/**
|
|
19
15
|
* Clear all cell outputs from a Jupyter notebook.
|
|
@@ -36,6 +32,8 @@ export declare class NotebooksResource extends BaseResource {
|
|
|
36
32
|
listSql(projectKey?: string): Promise<SqlNotebookSummary[]>;
|
|
37
33
|
/** Get the full content of a SQL notebook. */
|
|
38
34
|
getSql(id: string, projectKey?: string): Promise<SqlNotebookContent>;
|
|
35
|
+
/** Create a SQL notebook. */
|
|
36
|
+
createSql(id: string, content: SqlNotebookContent, projectKey?: string): Promise<void>;
|
|
39
37
|
/** Save (overwrite) a SQL notebook's content. */
|
|
40
38
|
saveSql(id: string, content: SqlNotebookContent, projectKey?: string): Promise<void>;
|
|
41
39
|
/** Delete a SQL notebook. */
|
|
@@ -13,18 +13,17 @@ export class NotebooksResource extends BaseResource {
|
|
|
13
13
|
const raw = await this.client.get(`/public/api/projects/${this.enc(projectKey)}/jupyter-notebooks/${nameEnc}`);
|
|
14
14
|
return this.client.safeParse(JupyterNotebookContentSchema, raw, "notebooks.getJupyter");
|
|
15
15
|
}
|
|
16
|
+
/** Create a Jupyter notebook. */
|
|
17
|
+
async createJupyter(name, content, projectKey) {
|
|
18
|
+
const nameEnc = encodeURIComponent(name);
|
|
19
|
+
await this.client.post(`/public/api/projects/${this.enc(projectKey)}/jupyter-notebooks/${nameEnc}`, content);
|
|
20
|
+
}
|
|
16
21
|
/** Save (overwrite) a Jupyter notebook's content. */
|
|
17
22
|
async saveJupyter(name, content, projectKey) {
|
|
18
23
|
const nameEnc = encodeURIComponent(name);
|
|
19
24
|
await this.client.putVoid(`/public/api/projects/${this.enc(projectKey)}/jupyter-notebooks/${nameEnc}`, content);
|
|
20
25
|
}
|
|
21
|
-
/**
|
|
22
|
-
* Delete a Jupyter notebook.
|
|
23
|
-
*
|
|
24
|
-
* The SDK intentionally does not expose notebook creation as a first-class
|
|
25
|
-
* resource method yet; integration tests create disposable notebooks through
|
|
26
|
-
* the documented project-level create endpoint.
|
|
27
|
-
*/
|
|
26
|
+
/** Delete a Jupyter notebook. */
|
|
28
27
|
async deleteJupyter(name, projectKey) {
|
|
29
28
|
const nameEnc = encodeURIComponent(name);
|
|
30
29
|
await this.client.del(`/public/api/projects/${this.enc(projectKey)}/jupyter-notebooks/${nameEnc}`);
|
|
@@ -74,6 +73,10 @@ export class NotebooksResource extends BaseResource {
|
|
|
74
73
|
const raw = await this.client.get(`/public/api/projects/${this.enc(projectKey)}/sql-notebooks/${idEnc}`);
|
|
75
74
|
return this.client.safeParse(SqlNotebookContentSchema, raw, "notebooks.getSql");
|
|
76
75
|
}
|
|
76
|
+
/** Create a SQL notebook. */
|
|
77
|
+
async createSql(id, content, projectKey) {
|
|
78
|
+
await this.client.post(`/public/api/projects/${this.enc(projectKey)}/sql-notebooks/`, { ...content, id, projectKey: this.resolveProjectKey(projectKey), });
|
|
79
|
+
}
|
|
77
80
|
/** Save (overwrite) a SQL notebook's content. */
|
|
78
81
|
async saveSql(id, content, projectKey) {
|
|
79
82
|
const idEnc = encodeURIComponent(id);
|
|
@@ -69,7 +69,7 @@ export declare class ProjectsResource extends BaseResource {
|
|
|
69
69
|
private postStream;
|
|
70
70
|
private uploadJson;
|
|
71
71
|
/** Create a new project. */
|
|
72
|
-
createProject(projectKey: string, name: string, ownerLogin
|
|
72
|
+
createProject(projectKey: string, name: string, ownerLogin: string, settings?: ProjectLifecycleSettings | null): Promise<Record<string, unknown>>;
|
|
73
73
|
/** Delete a project using the lifecycle endpoint. */
|
|
74
74
|
deleteProject(projectKey: string, dropData?: boolean): Promise<void>;
|
|
75
75
|
/** Duplicate a project. */
|
|
@@ -130,10 +130,10 @@ export class ProjectsResource extends BaseResource {
|
|
|
130
130
|
}
|
|
131
131
|
/** Create a new project. */
|
|
132
132
|
async createProject(projectKey, name, ownerLogin, settings) {
|
|
133
|
-
return this.client.
|
|
133
|
+
return this.client.post("/public/api/projects/", {
|
|
134
134
|
projectKey,
|
|
135
135
|
name,
|
|
136
|
-
owner: ownerLogin
|
|
136
|
+
owner: ownerLogin,
|
|
137
137
|
settings: settings ?? null,
|
|
138
138
|
description: null,
|
|
139
139
|
permissions: [],
|
|
@@ -103,10 +103,10 @@ export declare class RecipesResource extends BaseResource {
|
|
|
103
103
|
/** Clone recipe graph/settings and optionally clone a dataset output. */
|
|
104
104
|
clone(sourceName: string, opts: RecipeCloneOptions): Promise<RecipeCloneResult>;
|
|
105
105
|
/**
|
|
106
|
-
|
|
106
|
+
* Download a recipe code payload to a local file.
|
|
107
107
|
|
|
108
|
-
|
|
109
|
-
|
|
108
|
+
* Returns the path to the written file.
|
|
109
|
+
*/
|
|
110
110
|
downloadCode(recipeName: string, opts?: {
|
|
111
111
|
outputPath?: string;
|
|
112
112
|
projectKey?: string;
|