Skip to main content

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).
  • Before calling this operation, a RAM user must obtain Alibaba Cloud Model Studio API permissions (AliyunBailianDataFullAccess, which includes sfm:ChunkList) and join a workspace. An Alibaba Cloud account can call this operation directly without additional authorization. We recommend using the latest Alibaba 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

NameTypeRequiredDescriptionExample
WorkspaceIdstringYesThe workspace ID.llm-19hxxxxx7htdf9lh

Request parameters

NameTypeRequiredDescriptionExample
PipelineIdstringYesThe knowledge base ID.79c0alxxxx
dataIdstringNoThe file ID.doc_xxx
fieldobjectNoThe chunk content to insert, specified as key-value pairs. Document search knowledge bases use the following fixed keys:
  • content (String): Required: the body text of the chunk.
  • title (String): Optional: the chunk title.
  • image_urls (Array): Optional: the URLs of images in the chunk. Up to 10 images are supported.
For data query and image question answering knowledge bases, the keys depend on the source spreadsheet: 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" ] }
anyNoThe column header fields of the chunk to insert. This parameter is supported only for data query and image question answering knowledge bases. Headers used for retrieval or responses are required. Value requirements by type:
  • String: maximum length of 6000.
  • Time: a 13-digit timestamp in milliseconds.
  • Long: an integer up to 2147483647.
  • Double: decimal values are supported.
  • image_url: up to 5 images. Join multiple URLs into a single string with commas (,).
{"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

NameTypeDescriptionExample
objectSchema of Response
RequestIdstringThe request ID.35A267BF-xxxx-54DB-8394-AA3B0742D833
CodestringThe error status code.Index.InvalidParameter
MessagestringThe error message.Required parameter(%s) missing or invalid, please check the request parameters.
SuccessbooleanIndicates whether the API call succeeded.Valid values:
  • true : true
  • false : false
true
DatabooleanThe business data returned when the request succeeds.Valid values:
  • true : true
  • false : false
true
StatusstringThe 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.
Managed Agent API
Flow Agent API
Sandbox API
RAG API
Long-term Memory
ParseX API
Security API
Framework Integration