Skip to content

Commit

Permalink
Delete examples bulk (#1279)
Browse files Browse the repository at this point in the history
Closes #1272
  • Loading branch information
hinthornw authored Jan 8, 2025
1 parent c476cde commit b41b835
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions python/langsmith/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -4761,6 +4761,29 @@ def delete_example(self, example_id: ID_TYPE) -> None:
)
ls_utils.raise_for_status_with_text(response)

def delete_examples(self, example_ids: Sequence[ID_TYPE]) -> None:
"""Delete multiple examples by ID.
Parameters
----------
example_ids : Sequence[ID_TYPE]
The IDs of the examples to delete.
"""
response = self.request_with_retries(
"DELETE",
"/examples",
headers={**self._headers, "Content-Type": "application/json"},
data=_dumps_json(
{
"ids": [
str(_as_uuid(id_, f"example_ids[{i}]"))
for i, id_ in enumerate(example_ids)
]
}
),
)
ls_utils.raise_for_status_with_text(response)

def list_dataset_splits(
self,
*,
Expand Down

0 comments on commit b41b835

Please sign in to comment.