diff --git a/openai/api_resources/abstract/nested_resource_class_methods.py b/openai/api_resources/abstract/nested_resource_class_methods.py index 2f2dd45e40..f171737b17 100644 --- a/openai/api_resources/abstract/nested_resource_class_methods.py +++ b/openai/api_resources/abstract/nested_resource_class_methods.py @@ -127,11 +127,11 @@ def list_nested_resources(cls, id, **params): elif operation == "paginated_list": def paginated_list_nested_resources( - cls, id, limit=None, cursor=None, **params + cls, id, limit=None, after=None, **params ): url = getattr(cls, resource_url_method)(id) return getattr(cls, resource_request_method)( - "get", url, limit=limit, cursor=cursor, **params + "get", url, limit=limit, after=after, **params ) list_method = "list_%s" % resource_plural diff --git a/openai/cli.py b/openai/cli.py index c272d0b8d8..99d171a849 100644 --- a/openai/cli.py +++ b/openai/cli.py @@ -779,15 +779,17 @@ def results(cls, args): @classmethod def events(cls, args): - seen, has_more = 0, True + seen, has_more, after = 0, True, None while has_more: - resp = openai.FineTuningJob.list_events(id=args.id) # type: ignore + resp = openai.FineTuningJob.list_events(id=args.id, after=after) # type: ignore for event in resp["data"]: print(event) seen += 1 if args.limit is not None and seen >= args.limit: return - has_more = resp["has_more"] + has_more = resp.get("has_more", False) + if resp["data"]: + after = resp["data"][-1]["id"] @classmethod def follow(cls, args): diff --git a/openai/version.py b/openai/version.py index 51f3ce82ff..f62542b1ed 100644 --- a/openai/version.py +++ b/openai/version.py @@ -1 +1 @@ -VERSION = "0.27.9" +VERSION = "0.28.0"