From afaa6407f75038322474180999314a0317eca1a7 Mon Sep 17 00:00:00 2001 From: William Fu-Hinthorn <13333726+hinthornw@users.noreply.github.com> Date: Tue, 3 Dec 2024 09:11:14 -0800 Subject: [PATCH] Delete examples bulk --- python/langsmith/client.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/python/langsmith/client.py b/python/langsmith/client.py index 6a4950da0..0a4d1922e 100644 --- a/python/langsmith/client.py +++ b/python/langsmith/client.py @@ -3969,6 +3969,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, *,