CreateKnowledgeBaseBuildTask

Updated at:

Creates a repeatable knowledge building task and configures the input scope, trigger method, and runtime resources.

Operation description

Creates a knowledge base build task. The tenant and caller identities are determined by the POP authentication context.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

dataworks:CreateKnowledgeBaseBuildTask

create

*All Resource

*

None None

Request parameters

Parameter

Type

Required

Description

Example

KnowledgeBaseId

string

Yes

The knowledge base to which the task belongs.

12345678-1234-4234-8234-123456789abc

Name

string

Yes

The name of the task.

Project space knowledge building

Description

string

No

The description of the task. The description can be up to 1,024 characters in length. If this parameter is omitted, no description is set.

Sales metrics and policy documents

ProjectId

integer

Yes

The ID of the workspace where the task runs.

67890

Input

object

Yes

The input scope, which includes projects, entities, sources, or files selected based on the type.

ProjectIds

array

No

The IDs of the DataWorks workspaces selected for workspace-scoped building. This parameter cannot be empty and the values must be unique.

integer

No

The IDs of the DataWorks workspaces selected for workspace-scoped building. This parameter cannot be empty and the values must be unique.

12345

SourceIds

array

No

The IDs of the registered sources in the current knowledge base. The values must be unique. Whether this parameter is required and the allowed source types depend on the task input scenario. For more information, see the following table.

string

No

The IDs of the registered sources in the current knowledge base. The values must be unique. Whether this parameter is required and the allowed source types depend on the task input scenario. For more information, see the following table.

src-document-001

Entities

array<object>

No

The Data Map entities such as databases, schemas, and tables selected for data asset-scoped building. This parameter cannot be empty and the values must be unique.

object

No

EntityId

string

No

The metadata entity ID returned by Data Map. The client must pass this ID as is and must not concatenate database, schema, or table identifiers.

maxcompute-table:::project_name:schema_name:table_name

EntityType

string

No

The entity level, such as DATABASE, SCHEMA, or TABLE. The server validates this parameter based on the Data Map identity. The presence of an enum value does not guarantee that all engines support it.

TABLE

YamlUploadId

string

No

The YAML upload session ID in the current knowledge base used for SEMANTIC_MODEL import tasks. This ID is bound when the task is created and cannot be mixed with other input scopes.

upload-yaml-001

KnowledgeObjectIds

array

No

The IDs of the knowledge objects. This parameter is required, cannot be empty, and the values must be unique when building from document objects in the current knowledge base. Each item is the KnowledgeObjectId of a DOCUMENT type object in the current knowledge base. This parameter cannot be mixed with SourceIds for external connector synchronization scopes.

string

No

The IDs of the knowledge objects. This parameter is required, cannot be empty, and the values must be unique when building from document objects in the current knowledge base. Each item is the KnowledgeObjectId of a DOCUMENT type object in the current knowledge base. This parameter cannot be mixed with SourceIds for external connector synchronization scopes.

obj-document-001

Trigger

object

No

The trigger configuration, which can be manual or periodic.

Mode

string

No

The trigger mode. Valid values: MANUAL and PERIODIC. Manual tasks do not automatically create instances.

MANUAL

Cron

string

No

The cron expression for DataWorks scheduling. This parameter is only provided for PERIODIC tasks.

0 0 2 * * ?

Enabled

boolean

No

Specifies whether to enable automatic periodic triggering. This parameter is only provided for PERIODIC tasks and does not indicate the instance status.

RuntimeResource

object

Yes

The resource group and Builder compute units (CUs).

ResourceGroupId

string

No

The ID of the DataWorks resource group used by the actual Builder nodes. The server validates that the resource group is available in the workspace corresponding to the top-level ProjectId of the task.

rg-001

Cu

integer

No

The Builder compute specifications. Valid values: 4 to 16. If this parameter is omitted during creation, the default value is 4. The actual valid value is returned in read operations.

4

LlmModel

string

No

The specific model ID or AUTO.

model-001

ContentLocale

string

No

The language of the content.

zh-CN

Type

string

Yes

The available building types.

Valid values:

  • PROJECT_SPACE_BUILD
  • SEMANTIC_GRAPH
  • SEMANTIC_MODEL
  • DOCUMENT_GRAPH
  • DOCUMENT_SYNC
  • DOCUMENT_SYNC_AND_GRAPH

PROJECT_SPACE_BUILD

ClientToken

string

No

The client token used to ensure the idempotence of the creation request.

task-create-001

Response elements

Element

Type

Description

Example

object

Schema of Response

RequestId

string

The unique identifier of the request, which can be used to troubleshoot issues.

00000000-0000-4000-8000-000000000001

Success

boolean

Indicates whether the request is successful.

Data

object

The business data returned when the request is successful.

TaskId

string

The stable ID of the task.

10001

KnowledgeBaseId

string

The knowledge base to which the task belongs.

12345678-1234-4234-8234-123456789abc

Name

string

The name of the task.

Project space knowledge building

Description

string

The description of the task. This parameter is optional.

Sales metrics and policy documents

Type

string

The task type. Valid values: PROJECT_SPACE_BUILD, SEMANTIC_GRAPH, DOCUMENT_GRAPH, DOCUMENT_SYNC, DOCUMENT_SYNC_AND_GRAPH, and SEMANTIC_MODEL. SEMANTIC_MODEL is only used for YAML imports.

PROJECT_SPACE_BUILD

LlmModel

string

The specific model ID or AUTO configured for tasks that require a model. If this parameter is omitted during creation, it is equivalent to AUTO. This parameter is not configured for tasks that do not call a model.

model-001

ContentLocale

string

The language of the content for the task. This parameter is optional and is explicitly selected when the task is created.

zh-CN

ProjectId

integer

The ID of the DataWorks workspace where the task runs. This is different from the building asset scope specified by Input.ProjectIds.

67890

Input

object

The input scope specified based on the task type.

ProjectIds

array

The IDs of the DataWorks workspaces selected for workspace-scoped building. This parameter cannot be empty and the values must be unique.

integer

The IDs of the DataWorks workspaces selected for workspace-scoped building. This parameter cannot be empty and the values must be unique.

12345

SourceIds

array

The IDs of the registered sources in the current knowledge base. The values must be unique. Whether this parameter is required and the allowed source types depend on the task input scenario. For more information, see the following table.

string

The IDs of the registered sources in the current knowledge base. The values must be unique. Whether this parameter is required and the allowed source types depend on the task input scenario. For more information, see the following table.

src-document-001

Entities

array<object>

The Data Map entities such as databases, schemas, and tables selected for data asset-scoped building. This parameter cannot be empty and the values must be unique.

object

EntityId

string

The metadata entity ID returned by Data Map. The client must pass this ID as is and must not concatenate database, schema, or table identifiers.

maxcompute-table:::project_name:schema_name:table_name

EntityType

string

The entity level, such as DATABASE, SCHEMA, or TABLE. The server validates this parameter based on the Data Map identity. The presence of an enum value does not guarantee that all engines support it.

TABLE

YamlUploadId

string

The YAML upload session ID in the current knowledge base used for SEMANTIC_MODEL import tasks. This ID is bound when the task is created and cannot be mixed with other input scopes.

upload-yaml-001

KnowledgeObjectIds

array

The IDs of the knowledge objects. This parameter is required, cannot be empty, and the values must be unique when building from document objects in the current knowledge base. Each item is the KnowledgeObjectId of a DOCUMENT type object in the current knowledge base. This parameter cannot be mixed with SourceIds for external connector synchronization scopes.

string

The IDs of the knowledge objects. This parameter is required, cannot be empty, and the values must be unique when building from document objects in the current knowledge base. Each item is the KnowledgeObjectId of a DOCUMENT type object in the current knowledge base. This parameter cannot be mixed with SourceIds for external connector synchronization scopes.

obj-document-001

RuntimeResource

object

The resource group and Builder compute specifications for running the task.

ResourceGroupId

string

The ID of the DataWorks resource group used by the actual Builder nodes. The server validates that the resource group is available in the workspace corresponding to the top-level ProjectId of the task.

rg-001

Cu

integer

The Builder compute specifications. Valid values: 4 to 16. If this parameter is omitted during creation, the default value is 4. The actual valid value is returned in read operations.

4

Trigger

object

The manual or periodic trigger configuration.

Mode

string

The trigger mode. Valid values: MANUAL and PERIODIC. Manual tasks do not automatically create instances.

MANUAL

Cron

string

The cron expression for DataWorks scheduling. This parameter is only provided for PERIODIC tasks.

0 0 2 * * ?

Enabled

boolean

Specifies whether to enable automatic periodic triggering. This parameter is only provided for PERIODIC tasks and does not indicate the instance status.

CreateTime

integer

The time when the task was created.

1790200000000

ModifyTime

integer

The time when the task definition was last modified.

1790200300000

Code

string

The business error code, which is used to determine the error type when the request fails.

InvalidParameter

Message

string

The secure error message returned when the request fails.

The request parameters are invalid

Examples

Success response

JSON format

{
  "RequestId": "00000000-0000-4000-8000-000000000001",
  "Success": false,
  "Data": {
    "TaskId": "10001",
    "KnowledgeBaseId": "12345678-1234-4234-8234-123456789abc",
    "Name": "Project space knowledge building",
    "Description": "Sales metrics and policy documents",
    "Type": "PROJECT_SPACE_BUILD",
    "LlmModel": "model-001",
    "ContentLocale": "zh-CN",
    "ProjectId": 67890,
    "Input": {
      "ProjectIds": [
        12345
      ],
      "SourceIds": [
        "src-document-001"
      ],
      "Entities": [
        {
          "EntityId": "maxcompute-table:::project_name:schema_name:table_name",
          "EntityType": "TABLE"
        }
      ],
      "YamlUploadId": "upload-yaml-001",
      "KnowledgeObjectIds": [
        "obj-document-001"
      ]
    },
    "RuntimeResource": {
      "ResourceGroupId": "rg-001",
      "Cu": 4
    },
    "Trigger": {
      "Mode": "MANUAL",
      "Cron": "0 0 2 * * ?",
      "Enabled": false
    },
    "CreateTime": 1790200000000,
    "ModifyTime": 1790200300000
  },
  "Code": "InvalidParameter",
  "Message": "The request parameters are invalid"
}

Error codes

HTTP status code

Error code

Error message

Description

400 InvalidParameter The request parameters are invalid.
500 InternalError The knowledge base operation failed. Use RequestId to contact support.
403 Forbidden Creating a knowledge base build task requires knowledge base management permission. For PROJECT_SPACE_BUILD, the project administrator role (role_project_admin) is also required for every project in Input.ProjectIds.
403 DataAgentUnavailable DataAgent is unavailable; check the product edition and usage quota
403 DataAgentNotActivated Activate DataAgent pay-as-you-go before configuring or starting a knowledge base build
404 ResourceNotFound The requested resource does not exist or is not visible.
409 Conflict The resource state conflicts with this operation.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.