Appends parsed files to a specified knowledge base.
Operation description
- This operation does not support data query or image Q&A knowledge bases. For information about how to update data query or image Q&A knowledge bases, see the knowledge base update instructions in Knowledge base.
- Resource Access Management (RAM) users must first obtain API permissions for Model Studio (requiring
AliyunBailianDataFullAccess, which includes the sfm:SubmitIndexAddDocumentsJob permission), and join a workspace before invoking this operation. Alibaba Cloud accounts can invoke this operation directly without authorization. Use the latest Model Studio SDK to invoke this operation. - Before invoking this operation, make sure that your knowledge base has been created and has not been deleted (that is, the knowledge base ID
IndexIdis valid). - Before invoking this operation, invoke the AddFile operation to upload the files you want to append to Model Studio.
- After invoking this operation, the node requires time to execute and may take several hours during peak periods. Do not submit duplicate requests before the node is complete. To query the node execution status, invoke the GetIndexJobStatus operation. The
Documentsfile list returned by this operation contains all files in this append job (uniquely identified by thejob_idyou provide), and you can check whether each file was imported (parsed) successfully. Note that invoking GetIndexJobStatus too frequently will trigger rate limiting. Do not exceed a frequency of 20 times per minute. - After this operation is invoked successfully, it takes some time to execute. Do not submit duplicate requests before the response is returned. This operation does not have idempotence.
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
Actionelement 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
Resourceelement of the policy. - For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the
Resourceelement of the policy.
- For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the
- 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 |
|---|---|---|---|---|
sfm:SubmitIndexAddDocumentsJob | create | *All Resource
| None | None |
Request syntax
Path Parameters
Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
| WorkspaceId | string | Yes | The workspace ID to which the knowledge base belongs. For information about how to obtain the workspace ID, see How to use a workspace. | llm-3shx2gu255oqxxxx |
Request parameters
Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
| IndexId | string | Yes | The knowledge base ID, which is the | 79c0alxxxx |
| SourceType | string | Yes | The data source type. Valid values:
If this parameter is set to DATA_CENTER_CATEGORY, you must specify the Valid values:
| DATA_CENTER_FILE |
| DocumentIds | array | No | The list of file IDs. | |
string | No | The file ID, which is the | doc_ea4a504d9ce545508d8aa6d90371bf54xxxxxxxx | |
| CategoryIds | array | No | The list of category IDs. | |
string | No | The category ID, which is the | cate_21a407a3372c4ba7aedc649709143f0cxxxxxxxx | |
| ChunkMode | string | No | This parameter is not yet available. Do not specify this parameter. | length |
| Separator | string | No | This parameter is not yet available. Do not specify this parameter. | (?<=。) |
| ChunkSize | integer | No | This parameter is not yet available. Do not specify this parameter. | 128 |
| OverlapSize | integer | No | This parameter is not yet available. Do not specify this parameter. | 16 |
| EnableHeaders | boolean | No | Specifies whether to enable header assembly for Excel files. When enabled, the knowledge base treats the first row of all xlsx and xls files as headers and automatically appends them to each text chunk (data row), preventing the large language model from treating headers as regular data rows. Enable this feature only when all imported files are in xlsx or xls format and contain headers. Otherwise, leave it disabled. Valid values:
Default value: false. Valid values:
| false |
| Extra | object | No | ||
| uniqueId | string | No |
Response elements
Element | Type | Description | Example |
|---|---|---|---|
object | Schema of Response | ||
| RequestId | string | The request ID. | 778C0B3B-xxxx-5FC1-A947-36EDD13606AB |
| Data | object | The business data returned by the operation. | |
| Id | string | The task ID, also known as | 42687eb254a34802bed398357f5498ae |
| Status | string | The status code returned by the operation. | 200 |
| Success | boolean | Indicates whether the operation was successful. Valid values:
| true |
| Message | string | The error message. | Required parameter(%s) missing or invalid, please check the request parameters. |
| Code | string | The error code. | Index.InvalidParameter |
Examples
Success response
JSON format
Error codes
HTTP status code | Error code | Error message | Description |
|---|---|---|---|
| 400 | IdempotentParameterMismatch | The request uses the same client token as a previous, but non-identical request. Do not reuse a client token with different requests, unless the requests are identical. |