Skip to main content

ListChunks

Queries the list and information of text chunks.

Operation description

  • For document search or audio and video search knowledge bases, this operation can query all chunk content of a specified file; for data query or image Q&A knowledge bases, it can retrieve information about all text chunks.
  • RAM users (sub-accounts) must first obtain the API permissions of Alibaba Cloud Model Studio (AliyunBailianDataFullAccess is required, which already includes the sfm:ChunkList permission point) and join a workspace before they can call this operation. Alibaba Cloud accounts (primary accounts) can call this operation directly without authorization. We recommend that you call this operation by using the latest version of the Alibaba Cloud Model Studio SDK.
  • Before you call this operation, make sure that your knowledge base has been created and has not been deleted (that is, the knowledge base ID IndexId is valid).
  • This operation is idempotent.
Rate limit: This operation is throttled if called too frequently. Do not exceed 10 calls per second. If you are throttled, retry later.

Debugging

You can run this operation directly in OpenAPI Explorer, which saves you the trouble of calculating signatures. After the operation runs successfully, OpenAPI Explorer can automatically generate SDK code examples. Debug

Authorization information

The following table describes the authorization information of the API. You can use it in the Action element of RAM policy statements to grant RAM users or RAM roles the permission to call this API. The details are as follows:
  • Operation: the specific permission point.
  • Access level: the access level of each operation. Valid values: Write, Read, or List.
  • Resource type: the resource types that support authorization in the operation. The details are as follows:
    • For required resource types, an asterisk (*) is added as a prefix.
    • For operations that do not support resource-level authorization, All Resources is used.
  • Condition key: the condition keys defined by the cloud service itself.
  • Related operation: other permissions required to successfully perform the operation. The caller must also have the permissions of the related operations for the operation to succeed.
OperationAccess levelResource typeCondition keyRelated operation
sfm:ChunkListlist
*All Resources
*
    None
None

Request syntax

POST /{WorkspaceId}/index/list_chunks HTTP/1.1

Request parameters

NameTypeRequiredDescriptionExample value
WorkspaceIdstringYes

The ID of the workspace to which the knowledge base belongs. For information about how to obtain it, see How to use workspaces.

llm-3z7uw7fwz0vxxxx
bodyobjectNo

The body of the request parameters.

FieldsarrayNo

Fields is an array of field names used to filter the non-private fields (those not prefixed with an underscore _) in the Metadata field returned by this operation. By default, when Fields is empty, all non-private fields in the Metadata field are returned. If you want the returned Metadata field to contain only the specified non-private fields, such as only title, pass title in this parameter.

Default value: empty.

stringNo

The field name.

name
FiledstringNo

This field is the file ID field in the legacy Alibaba Cloud Model Studio SDK. Its usage and default value are exactly the same as those of the FileId field. If the Alibaba Cloud Model Studio SDK you use is one of the following versions (or later), we recommend that you use the FileId field to specify the file ID instead. If you use the SWIFT Alibaba Cloud Model Studio SDK, continue to use this field.

  • Java (async): 1.0.18
  • Java: 1.10.2
  • TypeScript: 1.10.2
  • Go: 1.10.2
  • PHP: 1.10.2
  • Python: 1.10.2
  • C#: 1.10.2
  • C++: 1.10.17
Note How to check the Alibaba Cloud Model Studio SDK version: Visit the Alibaba Cloud Model Studio SDK center, click "Install" in the left-side navigation pane, set the API version to "2023-12-29", select your programming language, and then click "History Versions" to view the versions.
file_5f03dfea56da4050ab68d61871fc4cb3_xxxxxxxx
FileIdstringNo

The file ID, that is, the FileId returned by the AddFile operation. You do not need to pass this field for data query or image Q&A knowledge bases; you must pass this field for document search knowledge bases. Open Collections and click Details for the target file dataset. Click the ID icon next to the file name, then click the copy icon to copy the file ID. You can filter the returned chunks by file ID. Default value: empty.

file_5f03dfea56da4050ab68d61871fc4cb3_xxxxxxxx
IndexIdstringYes

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

otoru9xxxx
PageNumintegerNo

The page number to query. The starting value is 1. Default value: 1.

1
PageSizeintegerNo

The number of text chunks displayed on each page in a paged query. Maximum value: 100. Default value: 10.

10

Response parameters

NameTypeDescriptionExample value
object
Codestring

The error status code.

Index.InvalidParameter
Dataobject

The business fields returned by the operation.

Nodesarray<object>

The list of text chunks.

nodesobject

The text chunk object.

Metadataany

The metadata map of the text chunk.

Note In the metadata map of a document search knowledge base, the file_path field is meaningless. Do not use it in business code.
Note When you retrieve from a document search knowledge base, if a chunk contains images, they will be exposed through the image_url field in the metadata map, together with an expiration time.
{ "file_path": "https://bailian-***", "parent": "Alibaba Cloud Model Studio is a one-stop platform for developing large models and building applications. Both developers and business users can deeply participate in the design and construction of large model applications. Through simple interface operations, you can develop a large model application in 5 minutes or train a custom model in a few hours, allowing you to focus more on application innovation.", "is_displayed_chunk_content": "true", "image_url": [], "nid": "83***", "source": "0", "_score": 0, "title": "", "doc_id": "file_24e***", "content": "Alibaba Cloud Model Studio is a one-stop platform for developing large models and building applications. Both developers and business users can deeply participate in the design and construction of large model applications. Through simple interface operations, you can develop a large model application in 5 minutes or train a custom model in a few hours, allowing you to focus more on application innovation.", "_rc_score": 0, "workspace_id": "llm-zna***", "hier_title": "", "doc_name": "What is Alibaba Cloud Model Studio", "pipeline_id": "j6b***", "_id": "llm-zna5***" }
Scoredouble

The similarity score of the text chunk.

0
Textstring

The content of the text chunk.

Alibaba Cloud Model Studio is a one-stop platform for developing large models and building applications. Both developers and business users can deeply participate in the design and construction of large model applications. Through simple interface operations, you can develop a large model application in 5 minutes or train a custom model in a few hours, allowing you to focus more on application innovation.
Totallong

The total number of returned results.

1
Messagestring

The error message.

Required parameter(%s) missing or invalid, please check the request parameters.
RequestIdstring

The request ID.

8F97A63B-xxxx-527F-9D6E-467B6A7E8CF1
Statusstring

The status code returned by the operation.

200
Successboolean

Indicates whether the operation call is successful. Valid values:

  • true: Successful.
  • false: Failed.
true

Examples

Success response example JSON format
{
  "Code": "Index.InvalidParameter",
  "Data": {
    "Nodes": [
      {
        "Metadata": {
          "file_path": "https://bailian-***",
          "parent": "Alibaba Cloud Model Studio is a one-stop platform for developing large models and building applications. Both developers and business users can deeply participate in the design and construction of large model applications. Through simple interface operations, you can develop a large model application in 5 minutes or train a custom model in a few hours, allowing you to focus more on application innovation.",
          "is_displayed_chunk_content": true,
          "image_url": [],
          "nid": "83***",
          "source": 0,
          "_score": 0,
          "title": "",
          "doc_id": "file_24e***",
          "content": "Alibaba Cloud Model Studio is a one-stop platform for developing large models and building applications. Both developers and business users can deeply participate in the design and construction of large model applications. Through simple interface operations, you can develop a large model application in 5 minutes or train a custom model in a few hours, allowing you to focus more on application innovation.",
          "_rc_score": 0,
          "workspace_id": "llm-zna***",
          "hier_title": "",
          "doc_name": "What is Alibaba Cloud Model Studio",
          "pipeline_id": "j6b***",
          "_id": "llm-zna5***"
        },
        "Score": 0,
        "Text": "Alibaba Cloud Model Studio is a one-stop platform for developing large models and building applications. Both developers and business users can deeply participate in the design and construction of large model applications. Through simple interface operations, you can develop a large model application in 5 minutes or train a custom model in a few hours, allowing you to focus more on application innovation."
      }
    ],
    "Total": 1
  },
  "Message": "Required parameter(%s) missing or invalid, please check the request parameters.",
  "RequestId": "8F97A63B-xxxx-527F-9D6E-467B6A7E8CF1",
  "Status": 200,
  "Success": true
}

Error codes

Visit the Error Center to view more error codes.