Skip to main content

Retrieve Records

Get a Specific Text Record

To retrieve a specific record, use get_record with the collection's and record's identifiers.

import taskingai

record = taskingai.retrieval.get_record(
collection_id="YOUR_COLLECTION_ID",
record_id="YOUR_RECORD_ID",
)

List Records with Pagination

The list_records function is designed to efficiently provide a comprehensive list of all records within a given collection. This function is enhanced with pagination capabilities, featuring parameters such as order, limit, after, and before.

import taskingai

records = taskingai.retrieval.list_records(
collection_id="YOUR_COLLECTION_ID",
order="desc",
limit=20,
after="YOUR_RECORD_ID",
)

If after or before is not specified, the function will return the first limit number of records 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 records in the collection, sorted in ascending or descending order, respectively.

Note that only one of after or before can be specified at a time.