Use the ListChunks operation to query the list of slices of a specified document in a paginated manner.
Prerequisites
-
An AgentStorage instance has been created and its status is
normal, and the instance endpoint and instance name have been obtained. -
An API Key has been created.
-
The knowledge base and document to query already exist.
Request parameters
|
Parameter |
Type |
Description |
|
|
string |
The name of the knowledge base. Required. |
|
|
string |
The name of the subspace. Required when the subspace feature is enabled. |
|
|
string |
The document ID. Specify either this parameter or `ossKey`. |
|
|
string |
The OSS path. Specify either this parameter or `docId`. |
|
|
int |
The number of entries to return. Default: 10. Maximum: 1000. |
|
|
string |
The pagination token. |
Request example
When you use API Key authentication, pass the instance name and API Key through the x-ots-instancename and x-ots-apikey request headers.
curl -X POST https://<endpoint>/ListChunks \
-H "x-ots-instancename: <instance-name>" \
-H "x-ots-apikey: <your-api-key>" \
-H "Content-Type: application/json" \
-d '{
"knowledgeBaseName": "product_docs_kb",
"subspace": "default",
"ossKey": "oss://example-bucket/docs/manual.pdf",
"maxResults": 10
}'
Response
|
Field |
Type |
Description |
|
|
string |
The subspace to which the slice belongs. |
|
|
int |
The slice ID. |
|
|
string |
The slice content. |
|
|
string |
The slice title. |
|
|
string |
The slice type, such as `TEXT`. |
|
|
string |
`active` (retrievable) or `inactive` (not retrievable). |
|
|
string |
The ID of the document to which the slice belongs. |
|
|
string |
The OSS path of the document to which the slice belongs. |
|
|
int |
The creation timestamp. |
|
|
int |
The update timestamp. |
|
|
string |
The pagination token. An empty value indicates the last page. |
{
"code": "SUCCESS",
"data": {
"chunkDetails": [
{
"subspace": "default",
"docId": "fc6ed97f-28ad-4dc0-9b73-bf4a7d67ab65",
"ossKey": "oss://example-bucket/docs/manual.pdf",
"chunkId": 0,
"content": "Product installation steps: 1. Download and extract the installation package. 2. Follow the installation wizard to complete the installation. 3. Launch the product and verify that the installation success page is displayed.",
"title": "Product installation steps",
"chunkType": "TEXT",
"status": "active",
"createdAt": 1787636596495
}
],
"nextToken": ""
},
"message": "succeed"
}