langsmith 0.3.83 → 0.3.84

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/client.cjs CHANGED
@@ -2695,6 +2695,49 @@ class Client {
2695
2695
  return res;
2696
2696
  });
2697
2697
  }
2698
+ /**
2699
+ * Delete multiple examples by ID.
2700
+ * @param exampleIds - The IDs of the examples to delete
2701
+ * @param options - Optional settings for deletion
2702
+ * @param options.hardDelete - If true, permanently delete examples. If false (default), soft delete them.
2703
+ */
2704
+ async deleteExamples(exampleIds, options) {
2705
+ // Validate all UUIDs
2706
+ exampleIds.forEach((id) => (0, _uuid_js_1.assertUuid)(id));
2707
+ if (options?.hardDelete) {
2708
+ // Hard delete uses POST to a different platform endpoint
2709
+ const path = this._getPlatformEndpointPath("datasets/examples/delete");
2710
+ await this.caller.call(async () => {
2711
+ const res = await this._fetch(`${this.apiUrl}${path}`, {
2712
+ method: "POST",
2713
+ headers: { ...this.headers, "Content-Type": "application/json" },
2714
+ body: JSON.stringify({
2715
+ example_ids: exampleIds,
2716
+ hard_delete: true,
2717
+ }),
2718
+ signal: AbortSignal.timeout(this.timeout_ms),
2719
+ ...this.fetchOptions,
2720
+ });
2721
+ await (0, error_js_1.raiseForStatus)(res, "hard delete examples", true);
2722
+ return res;
2723
+ });
2724
+ }
2725
+ else {
2726
+ // Soft delete uses DELETE with query params
2727
+ const params = new URLSearchParams();
2728
+ exampleIds.forEach((id) => params.append("example_ids", id));
2729
+ await this.caller.call(async () => {
2730
+ const res = await this._fetch(`${this.apiUrl}/examples?${params.toString()}`, {
2731
+ method: "DELETE",
2732
+ headers: this.headers,
2733
+ signal: AbortSignal.timeout(this.timeout_ms),
2734
+ ...this.fetchOptions,
2735
+ });
2736
+ await (0, error_js_1.raiseForStatus)(res, "delete examples", true);
2737
+ return res;
2738
+ });
2739
+ }
2740
+ }
2698
2741
  async updateExample(exampleIdOrUpdate, update) {
2699
2742
  let exampleId;
2700
2743
  if (update) {
package/dist/client.d.ts CHANGED
@@ -743,6 +743,15 @@ export declare class Client implements LangSmithTracingClientInterface {
743
743
  includeAttachments?: boolean;
744
744
  }): AsyncIterable<Example>;
745
745
  deleteExample(exampleId: string): Promise<void>;
746
+ /**
747
+ * Delete multiple examples by ID.
748
+ * @param exampleIds - The IDs of the examples to delete
749
+ * @param options - Optional settings for deletion
750
+ * @param options.hardDelete - If true, permanently delete examples. If false (default), soft delete them.
751
+ */
752
+ deleteExamples(exampleIds: string[], options?: {
753
+ hardDelete?: boolean;
754
+ }): Promise<void>;
746
755
  /**
747
756
  * @deprecated This signature is deprecated, use updateExample(update: ExampleUpdate) instead
748
757
  */
package/dist/client.js CHANGED
@@ -2657,6 +2657,49 @@ export class Client {
2657
2657
  return res;
2658
2658
  });
2659
2659
  }
2660
+ /**
2661
+ * Delete multiple examples by ID.
2662
+ * @param exampleIds - The IDs of the examples to delete
2663
+ * @param options - Optional settings for deletion
2664
+ * @param options.hardDelete - If true, permanently delete examples. If false (default), soft delete them.
2665
+ */
2666
+ async deleteExamples(exampleIds, options) {
2667
+ // Validate all UUIDs
2668
+ exampleIds.forEach((id) => assertUuid(id));
2669
+ if (options?.hardDelete) {
2670
+ // Hard delete uses POST to a different platform endpoint
2671
+ const path = this._getPlatformEndpointPath("datasets/examples/delete");
2672
+ await this.caller.call(async () => {
2673
+ const res = await this._fetch(`${this.apiUrl}${path}`, {
2674
+ method: "POST",
2675
+ headers: { ...this.headers, "Content-Type": "application/json" },
2676
+ body: JSON.stringify({
2677
+ example_ids: exampleIds,
2678
+ hard_delete: true,
2679
+ }),
2680
+ signal: AbortSignal.timeout(this.timeout_ms),
2681
+ ...this.fetchOptions,
2682
+ });
2683
+ await raiseForStatus(res, "hard delete examples", true);
2684
+ return res;
2685
+ });
2686
+ }
2687
+ else {
2688
+ // Soft delete uses DELETE with query params
2689
+ const params = new URLSearchParams();
2690
+ exampleIds.forEach((id) => params.append("example_ids", id));
2691
+ await this.caller.call(async () => {
2692
+ const res = await this._fetch(`${this.apiUrl}/examples?${params.toString()}`, {
2693
+ method: "DELETE",
2694
+ headers: this.headers,
2695
+ signal: AbortSignal.timeout(this.timeout_ms),
2696
+ ...this.fetchOptions,
2697
+ });
2698
+ await raiseForStatus(res, "delete examples", true);
2699
+ return res;
2700
+ });
2701
+ }
2702
+ }
2660
2703
  async updateExample(exampleIdOrUpdate, update) {
2661
2704
  let exampleId;
2662
2705
  if (update) {
package/dist/index.cjs CHANGED
@@ -13,4 +13,4 @@ var uuid_js_1 = require("./uuid.cjs");
13
13
  Object.defineProperty(exports, "uuid7", { enumerable: true, get: function () { return uuid_js_1.uuid7; } });
14
14
  Object.defineProperty(exports, "uuid7FromTime", { enumerable: true, get: function () { return uuid_js_1.uuid7FromTime; } });
15
15
  // Update using yarn bump-version
16
- exports.__version__ = "0.3.83";
16
+ exports.__version__ = "0.3.84";
package/dist/index.d.ts CHANGED
@@ -4,4 +4,4 @@ export { RunTree, type RunTreeConfig } from "./run_trees.js";
4
4
  export { overrideFetchImplementation } from "./singletons/fetch.js";
5
5
  export { getDefaultProjectName } from "./utils/project.js";
6
6
  export { uuid7, uuid7FromTime } from "./uuid.js";
7
- export declare const __version__ = "0.3.83";
7
+ export declare const __version__ = "0.3.84";
package/dist/index.js CHANGED
@@ -4,4 +4,4 @@ export { overrideFetchImplementation } from "./singletons/fetch.js";
4
4
  export { getDefaultProjectName } from "./utils/project.js";
5
5
  export { uuid7, uuid7FromTime } from "./uuid.js";
6
6
  // Update using yarn bump-version
7
- export const __version__ = "0.3.83";
7
+ export const __version__ = "0.3.84";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "langsmith",
3
- "version": "0.3.83",
3
+ "version": "0.3.84",
4
4
  "description": "Client library to connect to the LangSmith Observability and Evaluation Platform.",
5
5
  "packageManager": "yarn@1.22.19",
6
6
  "files": [