Create, Get, Update, Delete

Create

To create a new custom workflow, specify a list of model IDs that are to be included in the workflow. Each model ID also requires a specific model version ID, since a model can have several versions.

import com.clarifai.grpc.api.*;
import com.clarifai.grpc.api.status.*;

// Insert here the initialization code as outlined on this page:
// https://docs.clarifai.com/api-guide/api-overview/api-clients#client-installation-instructions

MultiWorkflowResponse postWorkflowsResponse = stub.postWorkflows(
    PostWorkflowsRequest.newBuilder().addWorkflows(
        Workflow.newBuilder()
            .setId("my-custom-workflow")
            .addNodes(
                WorkflowNode.newBuilder()
                    .setId("food-concepts")
                    .setModel(
                        Model.newBuilder()
                            .setId("bd367be194cf45149e75f01d59f77ba7")
                            .setModelVersion(ModelVersion.newBuilder().setId("dfebc169854e429086aceb8368662641"))
                    )
            )
            .addNodes(
                WorkflowNode.newBuilder()
                    .setId("general-concepts")
                    .setModel(
                        Model.newBuilder()
                            .setId("aaa03c23b3724a16a56b629203edc62c")
                            .setModelVersion(ModelVersion.newBuilder().setId("aa9ca48295b37401f8af92ad1af0d91d"))
                    )
            )
    ).build()
);

if (postWorkflowsResponse.getStatus().getCode() != StatusCode.SUCCESS) {
    throw new RuntimeException("Post workflows failed, status: " + postWorkflowsResponse.getStatus());
}

Workflow Predict

Predict using a workflow. The response will contain the predictions each model in the workflow returns for the input.

Get

Get all workflows in an app

Return all custom workflows in your app.

Get a workflow by a specific ID

Returns information about a specific workflow.

Update

Patch workflow

Ability to change the workflow, that is to change the models of which the workflow consists.

Possible actions are "overwrite", "merge" and "remove".

Delete

Delete workflow by ID

Delete a specific workflow.

Delete all workflows

Deletes all custom workflows.

Note: instead of "delete_all" it's possible to specify a list of workflow IDs to be deleted, using the ids field.

Last updated

Was this helpful?