SubmitIndexAddDocumentsJob
Adds parsed files to the specified knowledge base.
Operation description
-
This API does not support knowledge bases for data queries or image Q&A. To update these knowledge bases, see the knowledge base documentation.
-
A RAM user (sub-account) can call this API only after being granted the required api permission for Alibaba Cloud Model Studio (specifically, the
AliyunBailianDataFullAccesspolicy, which includes thesfm:SubmitIndexAddDocumentsJobpermission) and joining a workspace. An Alibaba Cloud account can call this API directly without authorization. We recommend using the latest version of the Alibaba Cloud Model Studio SDK to call this API. -
Before calling this API, ensure your knowledge base exists and has a valid knowledge base ID (
IndexId). -
Before calling this API, you must first upload files to Alibaba Cloud Model Studio using the AddFile API.
-
After calling this API, the job runs in the background and may take several hours to complete, especially during peak times. Do not submit duplicate requests until the job is complete. To check the job status, call the GetIndexJobStatus API. The
Documentsfile list returned by the GetIndexJobStatus API contains all files for the job, which is uniquely identified by thejob_idyou provided. You can check this list to verify whether each file was imported (parsed) successfully. Note that frequent calls to the GetIndexJobStatus API are subject to rate limiting. Do not exceed 20 calls per minute. -
A successful API call indicates the job has been submitted for processing, which takes time. This API is not idempotent, so do not send duplicate requests; doing so will create multiple jobs.
Rate limiting: This API is limited to 10 calls per second. If you exceed this limit, wait before retrying.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
sfm:SubmitIndexAddDocumentsJob |
create |
*All Resource
|
None | None |
Request syntax
POST /{WorkspaceId}/index/add_documents_to_index HTTP/1.1
Path Parameters
|
Parameter |
Type |
Required |
Description |
Example |
| WorkspaceId |
string |
Yes |
The ID of the workspace that contains the knowledge base. To obtain the ID, see How to use workspaces. |
llm-3shx2gu255oqxxxx |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| IndexId |
string |
Yes |
The knowledge base ID. This is the |
79c0alxxxx |
| SourceType |
string |
Yes |
The type of the data source. Valid values:
Note
If you set this parameter to Valid values:
|
DATA_CENTER_FILE |
| DocumentIds |
array |
No |
A list of file IDs. |
|
|
string |
No |
The file ID. This is the |
doc_ea4a504d9ce545508d8aa6d90371bf54xxxxxxxx |
|
| CategoryIds |
array |
No |
A list of category IDs. |
|
|
string |
No |
The category ID. This is the |
cate_21a407a3372c4ba7aedc649709143f0cxxxxxxxx |
|
| ChunkMode |
string |
No |
Note
This parameter is not available. Do not specify it. |
length |
| Separator |
string |
No |
Note
This parameter is not available. Do not specify it. |
(?<=。) |
| ChunkSize |
integer |
No |
Note
This parameter is not available. Do not specify it. |
128 |
| OverlapSize |
integer |
No |
Note
This parameter is not available. Do not specify it. |
16 |
| EnableHeaders |
boolean |
No |
Specifies whether to include Excel file headers. If set to Note
Enable this parameter only if all imported documents are Excel files that contain a header. Valid values:
Default value: false. Valid values:
|
false |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
The response object. |
||
| RequestId |
string |
The request ID. |
778C0B3B-xxxx-5FC1-A947-36EDD13606AB |
| Data |
object |
The business data. |
|
| Id |
string |
The job ID, also known as |
42687eb254a34802bed398357f5498ae |
| Status |
string |
The response status code. |
200 |
| Success |
boolean |
Indicates whether the request was successful. Valid values:
|
true |
| Message |
string |
The error message returned on failure. |
Required parameter(%s) missing or invalid, please check the request parameters. |
| Code |
string |
The error code returned on failure. |
Index.InvalidParameter |
Examples
Success response
JSON format
{
"RequestId": "778C0B3B-xxxx-5FC1-A947-36EDD13606AB",
"Data": {
"Id": "42687eb254a34802bed398357f5498ae"
},
"Status": "200",
"Success": true,
"Message": "Required parameter(%s) missing or invalid, please check the request parameters.",
"Code": "Index.InvalidParameter"
}
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. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.