View Chunks

This page shows you how to view the text chunks within a Catalog, including how to manage their retrievable status, and also inspect their start and end positions.

INFO

Please note that you will have had to upload and process files first before you can view chunks.

#View Chunks via API

cURL
Python

export INSTILL_API_TOKEN=********
curl -X GET 'https://api.instill.tech/v1alpha/namespaces/NAMESPACE_ID/catalogs/CATALOG_ID/chunks?fileUid=FILE_UID' \
--header "Authorization: Bearer $INSTILL_API_TOKEN" \
--header "Content-Type: application/json"

Note that the NAMESPACE_ID and CATALOG_ID path parameters must be replaced by the Catalog owner's ID (namespace) and the identifier of the Catalog you are querying.

#Optional Query Parameters

You can use the following optional query parameters to customize your request:

  • FILE_UID (string): Specifies the unique identifier (UID) of the file whose chunks are to be listed.

#Example Response

A successful response will return a list of chunks, within their specified Catalog:


{
"chunks": [
{
"chunkUid": "chunk123",
"retrievable": true,
"startPos": 0,
"endPos": 1024,
"tokens": 100, // coming soon
"createTime": "2024-07-01T12:00:00Z",
"originalFileUid": "file123"
},
{
"chunkUid": "chunk456",
"retrievable": true,
"startPos": 1025,
"endPos": 2048,
"tokens": 100, // coming soon
"createTime": "2024-07-01T12:10:00Z",
"originalFileUid": "file456"
}
]
}

#Output Description

  • chunks: An array of objects containing details of each chunk.
    • chunkUid (string): The unique identifier of the chunk.
    • retrievable (boolean): Whether the chunk is retrievable.
    • startPos (integer): The start position of the chunk in the source file.
    • endPos (integer): The end position of the chunk in the source file.
    • tokens (integer): The number of tokens in the chunk (coming soon).
    • createTime (string): The creation time of the chunk.
    • originalFileUid (string): The unique identifier of the original file.

#View Chunks via 📺 Instill Console

To view chunks from 📺 Instill Console, follow these steps:

  1. Launch 📺 Instill Console on ☁️ Instill Cloud or via a local 🔮 Instill Core deployment at http://localhost:3000.
  2. Navigate to the Artifacts page using the navigation bar.
  3. Click the Catalog card you wish to view chunks from.
  4. Select Chunks in the left panel.

A chunk-level view of your Catalog will appear below, categorized by file name.

INFO

You will need to wait until the file processing status is completed to view the corresponding chunks.

#Update Retrievable Status via API

You may wish to change the retrievable status of a chunk in your Catalog. This API facilitates this.

cURL
Python

export INSTILL_API_TOKEN=********
curl -X POST 'https://api.instill.tech/v1alpha/chunks/CHUNK_UID' \
--header "Authorization: Bearer $INSTILL_API_TOKEN" \
--header "Content-Type: application/json"
-d '{
"retrievable": true
}'

Note that the CHUNK_UID path parameter must be replaced by the unique identifier (UID) of the chunk whose retrievable status is to be updated. The retrievable field in the request body must be set to true or false to update the status.

#Example Response

A successful response will return a JSON object containing the updated chunk details:


{
"chunk": {
"chunkUid": "chunk123",
"retrievable": true,
"startPos": 0,
"endPos": 1024,
"tokens": 100, // coming soon
"createTime": "2024-07-01T12:00:00Z",
"originalFileUid": "file123"
}
}

#Output Description

  • chunk: An object containing details of the updated chunk.
    • chunkUid (string): The unique identifier of the chunk.
    • retrievable (boolean): Whether the chunk is retrievable.
    • startPos (integer): The start position of the chunk in the source file.
    • endPos (integer): The end position of the chunk in the source file.
    • tokens (integer): The number of tokens in the chunk. (coming soon)
    • createTime (string): The creation time of the chunk.
    • originalFileUid (string): The unique identifier of the original file.
INFO

Note that if a chunk's retrievable status is set to false, the chunk will not be returned.

#Update Retrievable Status via 📺 Instill Console

To update the retrievable status of a chunk from 📺 Instill Console, follow these steps:

  1. Launch 📺 Instill Console on ☁️ Instill Cloud or via a local 🔮 Instill Core deployment at http://localhost:3000.
  2. Navigate to the Artifacts page using the navigation bar.
  3. Click the Catalog card you wish to manage.
  4. Select Chunks in the left panel.
  5. Locate the specific chunk you wish to update.
  6. Click on the RETRIEVABLE toggle button to set the chunk's retrievable status. You can toggle it on or off depending on whether you want the chunk to be retrievable.