Retrieve Chunks
Get a Specific Chunk
To retrieve a specific chunk, use get_chunk
with the collection's and chunk's identifiers.
import taskingai
chunk = taskingai.retrieval.get_chunk(
collection_id="YOUR_COLLECTION_ID",
chunk_id="YOUR_CHUNK_ID",
)
List Chunks with Pagination
The list_chunks
function is designed to efficiently provide a comprehensive list of all chunks within a given collection.
This function is enhanced with pagination capabilities, featuring parameters such as order
, limit
, after
, and before
.
import taskingai
chunks = taskingai.retrieval.list_chunks(
collection_id="YOUR_COLLECTION_ID",
limit=20,
after="YOUR_CHUNK_ID"
)
If after
or before
is not specified, the function will return the first limit
number of chunks in the collection, sorted in ascending order of creation time by default.
When one of after
or before
is specified, the function will return the next limit
number of chunks in the collection, sorted in ascending or descending order, respectively.
Note that only one of after
or before
can be specified at a time.