Commit 1be14ee3
Changed files (2)
openai
api_resources
abstract
openai/api_resources/abstract/nested_resource_class_methods.py
@@ -127,11 +127,11 @@ def _nested_resource_class_methods(
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
openai/cli.py
@@ -779,15 +779,17 @@ class FineTuningJob:
@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):