Skip to content

Commit

Permalink
List limit (#1043)
Browse files Browse the repository at this point in the history
Closes #1042
  • Loading branch information
hinthornw authored Sep 26, 2024
1 parent 0a7b126 commit cae0a2f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions python/langsmith/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -5328,7 +5328,7 @@ def list_prompt_commits(
owner, prompt_name, _ = ls_utils.parse_prompt_identifier(prompt_identifier)

params = {
"limit": limit if limit is not None else 100,
"limit": min(100, limit) if limit is not None else limit,
"offset": offset,
"include_model": include_model,
}
Expand All @@ -5347,12 +5347,12 @@ def list_prompt_commits(
if not items:
break
for it in items:
i += 1
if limit is not None and i >= limit:
return # Stop iteration if we've reached the limit
yield ls_schemas.ListedPromptCommit(
**{"owner": owner, "repo": prompt_name, **it}
)
if limit is not None and i >= limit:
break
i += 1

offset += len(items)
if offset >= total:
Expand Down

0 comments on commit cae0a2f

Please sign in to comment.