UpdateChunk

Updated at:
Copy as MD

Modifies the content and title of a specified text chunk in a knowledge base, and specifies whether the chunk participates in knowledge base retrieval.

Operation description

  • Key limits: This operation supports only document search knowledge bases. Data query and image Q&A knowledge bases are not supported.

  • Permission requirements:
    • Resource Access Management (RAM) user: Before invoking this operation, obtain API permissions for Model Studio (you can use the AliyunBailianDataFullAccess policy, which includes the sfm:UpdateChunk permission required by this operation), and join a workspace.

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

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

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

  • Idempotence: This operation is idempotent. If you repeat the operation on a text chunk that has already been updated, the operation returns a success response.

Rate limit: This operation is throttled if called too frequently. Do not exceed 10 calls per second. If you are 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:UpdateChunk

update

*All Resource

*

None None

Request syntax

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

Path Parameters

Parameter

Type

Required

Description

Example

WorkspaceId

string

Yes

The workspace ID of the knowledge base. For information about how to obtain the workspace ID, see How to use a workspace.

llm-3z7uw7fwz0vexxxx

Request parameters

Parameter

Type

Required

Description

Example

PipelineId

string

Yes

The knowledge base ID. This is the Data.Id returned by the CreateIndex operation, or you can obtain it from the Knowledge Base page.

79c0alxxxx

DataId

string

Yes

The file ID. This is the FileId returned by the AddFile operation. You can also obtain it from the Application Data - Files tab in the Model Studio console by clicking the ID icon next to the corresponding file.

doc_c134aa2073204a5d936d870bf960f56axxxxxxxx

ChunkId

string

Yes

The ID of the text chunk to modify. You can obtain this value by calling the ListChunks operation. The value is in the Node.Metadata._id field of the response.

llm-5ip55o1zrzxx_09fe52x_xxxxx_033b551e10024029992e79767b151fxx_10024xx_0

IsDisplayedChunkContent

boolean

Yes

Specifies whether this text chunk participates in knowledge base retrieval. Valid values:

  • true: Participates.

  • false: Does not participate.

Default value: true.

true

content

string

Yes

The new content of the text chunk. The content length must be between 10 and 6000 characters and cannot exceed the maximum segment length specified when the knowledge base was created.

在哲学中所获得的确定性类型不是科学的确定性(即对每个人的理智来说都一样的确定性),而是一种要在人类的整体本质中才能获得的亲证。哲学的每一形态都不同于科学,因为所有的哲学都没有得到一致的认可...

title

string

No

The new title of the text chunk. The length is limited to 0 to 50 characters. An empty string is allowed. If you pass an empty string, the existing title is cleared. If you do not pass this parameter, the original title is retained.

什么是哲学

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 operation was successful. Valid values:

  • true: Succeeded.

  • false: 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",
  "Code": "InvalidParameter\n",
  "Message": "Required parameter(%s) missing or invalid, please check the request parameters.",
  "Success": true,
  "Data": true,
  "Status": "\"200\""
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.