DeleteChunk

Updated at:
Copy as MD

Deletes specified text chunks from a knowledge base. Deleted text chunks cannot be retrieved or recalled.

Operation description

Warning Deleted text chunks cannot be recovered (hard delete). Proceed with caution.
  • Permission requirements:
    • Resource Access Management (RAM) user: Obtain API permissions for Model Studio first (you can use the AliyunBailianDataFullAccess policy, which includes the sfm:DeleteChunk permission required by this operation), and join a workspace before invoking this operation.

    • Alibaba Cloud account: Has permissions by default and can invoke this operation directly.

  • Invocation method: Use the latest Model Studio SDK. The SDK provides encapsulation of complex signature calculation logic and simplifies the invocation procedure.

  • Effective latency: Changes typically take effect immediately. During peak hours, there may be a slight delay (seconds).

  • Idempotence: This operation is idempotent. Repeated calls to delete an already deleted text chunk return a success response.

Rate limit: This operation is throttled if called too frequently. Do not exceed 10 calls per second. If throttled, retry later.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

sfm:DeleteChunk

delete

*All Resource

*

None None

Request syntax

POST /{WorkspaceId}/chunk/delete HTTP/1.1

Path Parameters

Parameter

Type

Required

Description

Example

WorkspaceId

string

Yes

The workspace ID of the knowledge base. To obtain the workspace ID, refer to How to use a workspace.

llm-3z7uw7fwz0vexxxx

Request parameters

Parameter

Type

Required

Description

Example

PipelineId

string

Yes

The knowledge base ID, which is the Data.Id returned by the CreateIndex operation.

79c0alxxxx

ChunkIds

array

Yes

The list of text chunks to delete. A maximum of 10 text chunk IDs can be specified in a single request.

string

Yes

The text chunk ID, which is the _id field in Metadata of the Node object returned by the ListChunks operation.

llm-5ip55o1zrzxx_09fe52x_xxxxx_033b551e10024029992e79767b151fxx_10024xx_0

Response elements

Element

Type

Description

Example

object

Schema of Response

RequestId

string

The request ID.

35A267BF-xxxx-54DB-8394-AA3B0742D833

Code

string

The error status code.

Message

string

The error message.

Success

boolean

Indicates whether the call was successful. Valid values:

  • true: The call was successful.

  • false: The call failed.

true

Data

boolean

The business data returned upon a successful request.

true

Status

string

The status code returned by the operation.

200

Examples

Success response

JSON format

{
  "RequestId": "35A267BF-xxxx-54DB-8394-AA3B0742D833\n",
  "Code": "InvalidParameter\n",
  "Message": "Required parameter(%s) missing or invalid, please check the request parameters.\n",
  "Success": true,
  "Data": true,
  "Status": "200\n"
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.