From a58419c9e1efdbc97bab13df7b0ccabc0a03a4a3 Mon Sep 17 00:00:00 2001 From: Alexander <123825756+JohannFaust666@users.noreply.github.com> Date: Thu, 10 Apr 2025 01:09:04 +0700 Subject: [PATCH 1/3] Update README.md Since replicate.paginate() doesn't exists --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 8367552..c2b017b 100644 --- a/README.md +++ b/README.md @@ -396,11 +396,11 @@ Lists of models are paginated. You can get the next page of models by passing th ```python # Automatic pagination using `replicate.paginate` (recommended) +from replicate.pagination import paginate + models = [] -for page in replicate.paginate(replicate.models.list): - models.extend(page.results) - if len(models) > 100: - break +for page in paginate(client.trainings.list): + models.extend(page) # Manual pagination using `next` cursors page = replicate.models.list() From 7e4e70199d6d5639ec481ecdacf5619fa58998d7 Mon Sep 17 00:00:00 2001 From: Alexander <123825756+JohannFaust666@users.noreply.github.com> Date: Thu, 10 Apr 2025 01:15:24 +0700 Subject: [PATCH 2/3] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c2b017b..92dc57a 100644 --- a/README.md +++ b/README.md @@ -395,11 +395,11 @@ replicate.models.list() Lists of models are paginated. You can get the next page of models by passing the `next` property as an argument to the `list` method, or you can use the `paginate` method to fetch pages automatically. ```python -# Automatic pagination using `replicate.paginate` (recommended) +# Automatic pagination using `paginate` (recommended) from replicate.pagination import paginate models = [] -for page in paginate(client.trainings.list): +for page in paginate(replicate.models.list): models.extend(page) # Manual pagination using `next` cursors From 4ad27b91dc4d386118fba88f53ab95755171816e Mon Sep 17 00:00:00 2001 From: Alexander <123825756+JohannFaust666@users.noreply.github.com> Date: Thu, 10 Apr 2025 01:16:42 +0700 Subject: [PATCH 3/3] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 92dc57a..2b6a194 100644 --- a/README.md +++ b/README.md @@ -401,6 +401,8 @@ from replicate.pagination import paginate models = [] for page in paginate(replicate.models.list): models.extend(page) + if len(models) > 100: + break # Manual pagination using `next` cursors page = replicate.models.list()