Update the content of a single chunk.
Prerequisites
Configure the endpoint and authentication first. See API overview and Authentication.
Endpoint
POST /api/v1/indices/rag/index/chunk/update
Update the content of a specified chunk.
Chunk content must be between 10 and 6000 characters.
Request body
| Field | Required | Type | Description |
|---|---|---|---|
pipelineId | Yes | string | Knowledge base ID, the data.id returned by the createIndex API. |
chunkId | Yes | string | ID of the chunk to update. Obtain it from the listChunks API, using the node.metadata._id field in the response. |
dataId | Yes | string | File ID, the fileId returned by the addFile API; also available from node.metadata.doc_id of the listChunks API. |
content | Yes | string | Chunk content, 10 to 6000 characters, and must not exceed the maximum segment length set when the knowledge base was created. |
title | No | string | Chunk title, 0 to 50 characters. Pass an empty string to clear the title; omit this parameter to keep the original title unchanged. |
isDisplayedChunkContent | Yes | boolean | Whether the chunk participates in knowledge base retrieval. true: participates in retrieval; false: does not participate in retrieval. |
Request example
BASE_URL is https://{workspace_id}.cn-beijing.maas.aliyuncs.com ({workspace_id} is the workspace ID), and BAILIAN_API_KEY is your Alibaba Cloud Model Studio API key.
Response example
Returns 200 on success.
Response fields
| Field | Type | Description |
|---|---|---|
code | string | Response code. Success on success. |
status_code | integer | HTTP status code. |
request_id | string | Unique request identifier. Provide this ID when troubleshooting. |
success | boolean | Whether the operation succeeded. |
message | string | Response message. success on success. |
status | string | Request status: SUCCESS or FAILED. |
Error codes
| HTTP status code | Error code | Message | Description |
|---|---|---|---|
| 400 | Index.InvalidParameter | Required parameter missing or invalid. | Invalid request parameters. |
| 401 | InvalidApiKey | Invalid API-key provided. | Authentication failed. The API key is invalid or missing. |