Conversation
Signed-off-by: Mattt Zmuda <mattt@replicate.com>
Signed-off-by: Mattt Zmuda <mattt@replicate.com>
|
Why would somebody not want to paginate? If that happens much less often than wanting to paginate, it feels like the default should be pagination, otherwise you get unexpected silent failures. Suppose there are 150 objects, and you do |
|
@bfirsh For me, it's not as much a question about whether or not to paginate a list, as much as it's a matter of having control over how pagination happens. If a user wants to fetch all of the items all at once, that's still a one-liner in Python: collections = [collection for page in replicate.paginate(replicate.collections.list) for collection in page]If you think about fetching much larger lists, like public models or an org's predictions, then you start to see more of the benefit to having more fine-grained control. I'm less concerned about an API consumer seeing less than expected than inadvertently downloading everything. |
Signed-off-by: Mattt Zmuda <mattt@replicate.com>
This PR adds
paginateandasync_paginatemethods that let you iterate over a paginated list of resources.sync
async