Modifies the content and title of a specified text chunk in the knowledge base, and sets whether the chunk participates in knowledge base retrieval.
Operation description
-
Limits: This operation supports only knowledge base of the document search type. Data query and image Q&A types are not supported.
-
Required permissions:
- RAM users: Must first obtain the API permissions of Model Studio (such as the
AliyunBailianDataFullAccesspolicy, which includes the sfm:UpdateChunk permission required), and become member of a workspace. - Alibaba Cloud account: Has the permission by default, and can call the operation directly.
- RAM users: Must first obtain the API permissions of Model Studio (such as the
-
Call method: We recommend using the latest version of the GenAI Service Platform SDK. The SDK encapsulates complex signature computational logic to simplify the call process.
-
Delay: The update takes effect immediately. During peak hours, the update may take place in seconds.
-
Idempotence: This operation is idempotent. If you perform a repeated operation on a chunk that has already been updated, the interface returns a success.
Rate limit: Rate limiting will be triggered if you call this operation frequently. Do not exceed 10 times per second. If limiting is triggered, try again later.
Debugging
Authorization information
The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:
- Operation: the value that you can use in the Action element to specify the operation on a resource.
- Access level: the access level of each operation. The levels are read, write, and list.
- Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
- For mandatory resource types, indicate with a prefix of * .
- If the permissions cannot be granted at the resource level,
All Resourcesis used in the Resource type column of the operation.
- Condition Key: the condition key that is defined by the cloud service.
- Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
| Operation | Access level | Resource type | Condition key | Associated operation |
|---|---|---|---|---|
| sfm:UpdateChunk | update | *All Resources * |
| none |
Request syntax
POST /{WorkspaceId}/chunk/update HTTP/1.1
Request parameters
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
| PipelineId | string | Yes | The knowledge base ID, which is the | 79c0alxxxx |
| DataId | string | Yes | The file ID, which is the | doc_c134aa2073204a5d936d870bf960f56axxxxxxxx |
| ChunkId | string | Yes | The ID of the text chunk to be modified. You can find it in the Node.Metadata._id field returned by ListChunks. | llm-5ip55o1zrzxx_09fe52x_table_033b551e10024029992e79767b151fxx_10024xx_0 |
| IsDisplayedChunkContent | boolean | Yes | Specifies whether this text chunk participates in knowledge base retrieval. Valid values:
Default value: true. | true |
| content | string | Yes | The new content of the chunk. The content must be between 10 and 6,000 characters in length and cannot exceed the maximum chunk length set when the knowledge base was created. | |
| WorkspaceId | string | Yes | The ID of the workspace to which the knowledge base belongs. For more information, see How to use workspace. | llm-3z7uw7fwz0vexxxx |
| title | string | No | The new title of the chunk. The title must be 0 to 50 characters in length and can be an empty string. If you specify an empty string, the existing title is cleared. If you do not pass this parameter, the original title remains unchanged. |
Response parameters
Examples
Sample success responses
JSONformat
{
"RequestId": "35A267BF-xxxx-54DB-8394-AA3B0742D833\n",
"Code": "InvalidParameter\n",
"Message": "Required parameter(%s) missing or invalid, please check the request parameters.",
"Success": true,
"Data": true,
"Status": 200
}Error codes
For a list of error codes, visit the Service error codes.
