AddChunk
Adds chunks to document search (document), data query (table), and image question answering (image) knowledge bases.
Usage notes
- For document search (document), data query (table), and image question answering (image) knowledge bases, this operation adds chunks to the specified knowledge base. Audio and video search (multimedia) knowledge bases are not supported. For data query and image question answering knowledge bases, this operation takes effect only when the data source is an Excel connector (excel).
- A RAM user must first obtain Alibaba Cloud Model Studio API permissions (
AliyunBailianDataFullAccess, which includes sfm:ChunkList) and join a workspace before calling this operation. An Alibaba Cloud account can call this operation directly without additional authorization. We recommend that you call this operation by using the latest Alibaba Cloud Model Studio SDKAlibaba Cloud Model Studio SDK. - Before calling this operation, make sure that the knowledge base has been created and has not been deleted, and that its ID,
IndexId, is valid. - This operation is idempotent.
Throttling: This operation is throttled if called too frequently. Do not exceed 10 calls per second. If a request is throttled, try again later.
Try it out
You can call this operation in OpenAPI Explorer without calculating a signature. After a successful call, OpenAPI Explorer can automatically generate SDK code examples.
Authorization information
No authorization information is available for this API operation.
Request syntax
POST /{WorkspaceId}/chunk/create HTTP/1.1
Path parameters
Name | Type | Required | Description | Example |
|---|---|---|---|---|
| WorkspaceId | string | Yes | The workspace ID. | llm-19hxxxxx7htdf9lh |
Request parameters
Name | Type | Required | Description | Example |
|---|---|---|---|---|
| PipelineId | string | Yes | The knowledge base ID. | 79c0alxxxx |
| dataId | string | No | The file ID. | doc_xxx |
| field | object | No | The chunk content to insert, specified as key-value pairs. Document search knowledge bases use the following fixed keys:
For data query and image question answering knowledge bases, the keys are not fixed and are determined by the source spreadsheet of the knowledge base: each key is an Excel column header, and its value is the corresponding cell value. | { "content": "The Bailian platform supports parsing multiple document formats including PDF, Word, and PPT.", "title": "Document Parsing and Chunking", "image_urls": [ "https://example.com/images/chunk-flow.png", "https://example.com/images/parsing-result.png" ] } |
any | No | The column header fields of the chunk to insert, supported only for data query and image question answering knowledge bases. Headers that must be used for retrieval or responses are required. Value requirements by type:
| {"Product Name": "Wireless Bluetooth Headphones", "Publish Time": 1752624000000, "Stock Quantity": 1580, "Unit Price": 299.99, "image_url":"https://example.com/images/headphones-front.jpg,https://example.com/images/headphones-side.jpg,https://example.com/images/headphones-package.jpg" } |
Response parameters
Name | Type | Description | Example |
|---|---|---|---|
object | Schema of Response | ||
| RequestId | string | The request ID. | 35A267BF-xxxx-54DB-8394-AA3B0742D833 |
| Code | string | The error status code. | Index.InvalidParameter |
| Message | string | The error message. | Required parameter(%s) missing or invalid, please check the request parameters. |
| Success | boolean | Indicates whether the API call succeeded. Valid values:
| true |
| Data | boolean | The business data returned when the request succeeds. Valid values:
| true |
| Status | string | The status code returned by the operation. | 200 |
Examples
Sample success response
JSON format
{
"RequestId": "35A267BF-xxxx-54DB-8394-AA3B0742D833",
"Code": "Index.InvalidParameter",
"Message": "Required parameter(%s) missing or invalid, please check the request parameters.",
"Success": true,
"Data": true,
"Status": "200"
}
Error codes
For more error codes, see Error Center.
Change history
For more information, see Change details.