langsmith 0.3.83 → 0.3.85
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 +56 -3
- package/dist/client.d.ts +18 -1
- package/dist/client.js +56 -3
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/client.cjs
CHANGED
|
@@ -48,7 +48,10 @@ const prompts_js_1 = require("./utils/prompts.cjs");
|
|
|
48
48
|
const error_js_1 = require("./utils/error.cjs");
|
|
49
49
|
const fetch_js_1 = require("./singletons/fetch.cjs");
|
|
50
50
|
const index_js_2 = require("./utils/fast-safe-stringify/index.cjs");
|
|
51
|
-
function mergeRuntimeEnvIntoRun(run, cachedEnvVars) {
|
|
51
|
+
function mergeRuntimeEnvIntoRun(run, cachedEnvVars, omitTracedRuntimeInfo) {
|
|
52
|
+
if (omitTracedRuntimeInfo) {
|
|
53
|
+
return run;
|
|
54
|
+
}
|
|
52
55
|
const runtimeEnv = (0, env_js_1.getRuntimeEnvironment)();
|
|
53
56
|
const envVars = cachedEnvVars ?? (0, env_js_1.getLangSmithEnvVarsMetadata)();
|
|
54
57
|
const extra = run.extra ?? {};
|
|
@@ -292,6 +295,12 @@ class Client {
|
|
|
292
295
|
writable: true,
|
|
293
296
|
value: void 0
|
|
294
297
|
});
|
|
298
|
+
Object.defineProperty(this, "omitTracedRuntimeInfo", {
|
|
299
|
+
enumerable: true,
|
|
300
|
+
configurable: true,
|
|
301
|
+
writable: true,
|
|
302
|
+
value: void 0
|
|
303
|
+
});
|
|
295
304
|
Object.defineProperty(this, "tracingSampleRate", {
|
|
296
305
|
enumerable: true,
|
|
297
306
|
configurable: true,
|
|
@@ -452,6 +461,7 @@ class Client {
|
|
|
452
461
|
config.hideInputs ?? config.anonymizer ?? defaultConfig.hideInputs;
|
|
453
462
|
this.hideOutputs =
|
|
454
463
|
config.hideOutputs ?? config.anonymizer ?? defaultConfig.hideOutputs;
|
|
464
|
+
this.omitTracedRuntimeInfo = config.omitTracedRuntimeInfo ?? false;
|
|
455
465
|
this.autoBatchTracing = config.autoBatchTracing ?? this.autoBatchTracing;
|
|
456
466
|
this.autoBatchQueue = new AutoBatchQueue(maxMemory);
|
|
457
467
|
this.blockOnRootRunFinalization =
|
|
@@ -821,7 +831,7 @@ class Client {
|
|
|
821
831
|
async processRunOperation(item) {
|
|
822
832
|
clearTimeout(this.autoBatchTimeout);
|
|
823
833
|
this.autoBatchTimeout = undefined;
|
|
824
|
-
item.item = mergeRuntimeEnvIntoRun(item.item, this.cachedLSEnvVarsForMetadata);
|
|
834
|
+
item.item = mergeRuntimeEnvIntoRun(item.item, this.cachedLSEnvVarsForMetadata, this.omitTracedRuntimeInfo);
|
|
825
835
|
const itemPromise = this.autoBatchQueue.push(item);
|
|
826
836
|
if (this.manualFlushMode) {
|
|
827
837
|
// Rely on manual flushing in serverless environments
|
|
@@ -943,7 +953,7 @@ class Client {
|
|
|
943
953
|
}).catch(console.error);
|
|
944
954
|
return;
|
|
945
955
|
}
|
|
946
|
-
const mergedRunCreateParam = mergeRuntimeEnvIntoRun(runCreate, this.cachedLSEnvVarsForMetadata);
|
|
956
|
+
const mergedRunCreateParam = mergeRuntimeEnvIntoRun(runCreate, this.cachedLSEnvVarsForMetadata, this.omitTracedRuntimeInfo);
|
|
947
957
|
if (options?.apiKey !== undefined) {
|
|
948
958
|
headers["x-api-key"] = options.apiKey;
|
|
949
959
|
}
|
|
@@ -2695,6 +2705,49 @@ class Client {
|
|
|
2695
2705
|
return res;
|
|
2696
2706
|
});
|
|
2697
2707
|
}
|
|
2708
|
+
/**
|
|
2709
|
+
* Delete multiple examples by ID.
|
|
2710
|
+
* @param exampleIds - The IDs of the examples to delete
|
|
2711
|
+
* @param options - Optional settings for deletion
|
|
2712
|
+
* @param options.hardDelete - If true, permanently delete examples. If false (default), soft delete them.
|
|
2713
|
+
*/
|
|
2714
|
+
async deleteExamples(exampleIds, options) {
|
|
2715
|
+
// Validate all UUIDs
|
|
2716
|
+
exampleIds.forEach((id) => (0, _uuid_js_1.assertUuid)(id));
|
|
2717
|
+
if (options?.hardDelete) {
|
|
2718
|
+
// Hard delete uses POST to a different platform endpoint
|
|
2719
|
+
const path = this._getPlatformEndpointPath("datasets/examples/delete");
|
|
2720
|
+
await this.caller.call(async () => {
|
|
2721
|
+
const res = await this._fetch(`${this.apiUrl}${path}`, {
|
|
2722
|
+
method: "POST",
|
|
2723
|
+
headers: { ...this.headers, "Content-Type": "application/json" },
|
|
2724
|
+
body: JSON.stringify({
|
|
2725
|
+
example_ids: exampleIds,
|
|
2726
|
+
hard_delete: true,
|
|
2727
|
+
}),
|
|
2728
|
+
signal: AbortSignal.timeout(this.timeout_ms),
|
|
2729
|
+
...this.fetchOptions,
|
|
2730
|
+
});
|
|
2731
|
+
await (0, error_js_1.raiseForStatus)(res, "hard delete examples", true);
|
|
2732
|
+
return res;
|
|
2733
|
+
});
|
|
2734
|
+
}
|
|
2735
|
+
else {
|
|
2736
|
+
// Soft delete uses DELETE with query params
|
|
2737
|
+
const params = new URLSearchParams();
|
|
2738
|
+
exampleIds.forEach((id) => params.append("example_ids", id));
|
|
2739
|
+
await this.caller.call(async () => {
|
|
2740
|
+
const res = await this._fetch(`${this.apiUrl}/examples?${params.toString()}`, {
|
|
2741
|
+
method: "DELETE",
|
|
2742
|
+
headers: this.headers,
|
|
2743
|
+
signal: AbortSignal.timeout(this.timeout_ms),
|
|
2744
|
+
...this.fetchOptions,
|
|
2745
|
+
});
|
|
2746
|
+
await (0, error_js_1.raiseForStatus)(res, "delete examples", true);
|
|
2747
|
+
return res;
|
|
2748
|
+
});
|
|
2749
|
+
}
|
|
2750
|
+
}
|
|
2698
2751
|
async updateExample(exampleIdOrUpdate, update) {
|
|
2699
2752
|
let exampleId;
|
|
2700
2753
|
if (update) {
|
package/dist/client.d.ts
CHANGED
|
@@ -11,6 +11,13 @@ export interface ClientConfig {
|
|
|
11
11
|
anonymizer?: (values: KVMap) => KVMap | Promise<KVMap>;
|
|
12
12
|
hideInputs?: boolean | ((inputs: KVMap) => KVMap | Promise<KVMap>);
|
|
13
13
|
hideOutputs?: boolean | ((outputs: KVMap) => KVMap | Promise<KVMap>);
|
|
14
|
+
/**
|
|
15
|
+
* Whether to omit runtime information from traced runs.
|
|
16
|
+
* If true, runtime information (SDK version, platform, etc.) and
|
|
17
|
+
* LangChain environment variable metadata will not be stored in runs.
|
|
18
|
+
* Defaults to false.
|
|
19
|
+
*/
|
|
20
|
+
omitTracedRuntimeInfo?: boolean;
|
|
14
21
|
autoBatchTracing?: boolean;
|
|
15
22
|
/** Maximum size of a batch of runs in bytes. */
|
|
16
23
|
batchSizeBytesLimit?: number;
|
|
@@ -280,7 +287,7 @@ type Thread = {
|
|
|
280
287
|
last_outputs: string;
|
|
281
288
|
last_error: string | null;
|
|
282
289
|
};
|
|
283
|
-
export declare function mergeRuntimeEnvIntoRun<T extends RunCreate | RunUpdate>(run: T, cachedEnvVars?: Record<string, string
|
|
290
|
+
export declare function mergeRuntimeEnvIntoRun<T extends RunCreate | RunUpdate>(run: T, cachedEnvVars?: Record<string, string>, omitTracedRuntimeInfo?: boolean): T;
|
|
284
291
|
export declare const DEFAULT_UNCOMPRESSED_BATCH_SIZE_LIMIT_BYTES: number;
|
|
285
292
|
/** Default maximum memory (1GB) for queue size limits. */
|
|
286
293
|
export declare const DEFAULT_MAX_SIZE_BYTES: number;
|
|
@@ -325,6 +332,7 @@ export declare class Client implements LangSmithTracingClientInterface {
|
|
|
325
332
|
private _tenantId;
|
|
326
333
|
private hideInputs?;
|
|
327
334
|
private hideOutputs?;
|
|
335
|
+
private omitTracedRuntimeInfo?;
|
|
328
336
|
private tracingSampleRate?;
|
|
329
337
|
private filteredPostUuids;
|
|
330
338
|
private autoBatchTracing;
|
|
@@ -743,6 +751,15 @@ export declare class Client implements LangSmithTracingClientInterface {
|
|
|
743
751
|
includeAttachments?: boolean;
|
|
744
752
|
}): AsyncIterable<Example>;
|
|
745
753
|
deleteExample(exampleId: string): Promise<void>;
|
|
754
|
+
/**
|
|
755
|
+
* Delete multiple examples by ID.
|
|
756
|
+
* @param exampleIds - The IDs of the examples to delete
|
|
757
|
+
* @param options - Optional settings for deletion
|
|
758
|
+
* @param options.hardDelete - If true, permanently delete examples. If false (default), soft delete them.
|
|
759
|
+
*/
|
|
760
|
+
deleteExamples(exampleIds: string[], options?: {
|
|
761
|
+
hardDelete?: boolean;
|
|
762
|
+
}): Promise<void>;
|
|
746
763
|
/**
|
|
747
764
|
* @deprecated This signature is deprecated, use updateExample(update: ExampleUpdate) instead
|
|
748
765
|
*/
|
package/dist/client.js
CHANGED
|
@@ -11,7 +11,10 @@ import { parsePromptIdentifier } from "./utils/prompts.js";
|
|
|
11
11
|
import { raiseForStatus } from "./utils/error.js";
|
|
12
12
|
import { _globalFetchImplementationIsNodeFetch, _getFetchImplementation, } from "./singletons/fetch.js";
|
|
13
13
|
import { serialize as serializePayloadForTracing } from "./utils/fast-safe-stringify/index.js";
|
|
14
|
-
export function mergeRuntimeEnvIntoRun(run, cachedEnvVars) {
|
|
14
|
+
export function mergeRuntimeEnvIntoRun(run, cachedEnvVars, omitTracedRuntimeInfo) {
|
|
15
|
+
if (omitTracedRuntimeInfo) {
|
|
16
|
+
return run;
|
|
17
|
+
}
|
|
15
18
|
const runtimeEnv = getRuntimeEnvironment();
|
|
16
19
|
const envVars = cachedEnvVars ?? getLangSmithEnvVarsMetadata();
|
|
17
20
|
const extra = run.extra ?? {};
|
|
@@ -254,6 +257,12 @@ export class Client {
|
|
|
254
257
|
writable: true,
|
|
255
258
|
value: void 0
|
|
256
259
|
});
|
|
260
|
+
Object.defineProperty(this, "omitTracedRuntimeInfo", {
|
|
261
|
+
enumerable: true,
|
|
262
|
+
configurable: true,
|
|
263
|
+
writable: true,
|
|
264
|
+
value: void 0
|
|
265
|
+
});
|
|
257
266
|
Object.defineProperty(this, "tracingSampleRate", {
|
|
258
267
|
enumerable: true,
|
|
259
268
|
configurable: true,
|
|
@@ -414,6 +423,7 @@ export class Client {
|
|
|
414
423
|
config.hideInputs ?? config.anonymizer ?? defaultConfig.hideInputs;
|
|
415
424
|
this.hideOutputs =
|
|
416
425
|
config.hideOutputs ?? config.anonymizer ?? defaultConfig.hideOutputs;
|
|
426
|
+
this.omitTracedRuntimeInfo = config.omitTracedRuntimeInfo ?? false;
|
|
417
427
|
this.autoBatchTracing = config.autoBatchTracing ?? this.autoBatchTracing;
|
|
418
428
|
this.autoBatchQueue = new AutoBatchQueue(maxMemory);
|
|
419
429
|
this.blockOnRootRunFinalization =
|
|
@@ -783,7 +793,7 @@ export class Client {
|
|
|
783
793
|
async processRunOperation(item) {
|
|
784
794
|
clearTimeout(this.autoBatchTimeout);
|
|
785
795
|
this.autoBatchTimeout = undefined;
|
|
786
|
-
item.item = mergeRuntimeEnvIntoRun(item.item, this.cachedLSEnvVarsForMetadata);
|
|
796
|
+
item.item = mergeRuntimeEnvIntoRun(item.item, this.cachedLSEnvVarsForMetadata, this.omitTracedRuntimeInfo);
|
|
787
797
|
const itemPromise = this.autoBatchQueue.push(item);
|
|
788
798
|
if (this.manualFlushMode) {
|
|
789
799
|
// Rely on manual flushing in serverless environments
|
|
@@ -905,7 +915,7 @@ export class Client {
|
|
|
905
915
|
}).catch(console.error);
|
|
906
916
|
return;
|
|
907
917
|
}
|
|
908
|
-
const mergedRunCreateParam = mergeRuntimeEnvIntoRun(runCreate, this.cachedLSEnvVarsForMetadata);
|
|
918
|
+
const mergedRunCreateParam = mergeRuntimeEnvIntoRun(runCreate, this.cachedLSEnvVarsForMetadata, this.omitTracedRuntimeInfo);
|
|
909
919
|
if (options?.apiKey !== undefined) {
|
|
910
920
|
headers["x-api-key"] = options.apiKey;
|
|
911
921
|
}
|
|
@@ -2657,6 +2667,49 @@ export class Client {
|
|
|
2657
2667
|
return res;
|
|
2658
2668
|
});
|
|
2659
2669
|
}
|
|
2670
|
+
/**
|
|
2671
|
+
* Delete multiple examples by ID.
|
|
2672
|
+
* @param exampleIds - The IDs of the examples to delete
|
|
2673
|
+
* @param options - Optional settings for deletion
|
|
2674
|
+
* @param options.hardDelete - If true, permanently delete examples. If false (default), soft delete them.
|
|
2675
|
+
*/
|
|
2676
|
+
async deleteExamples(exampleIds, options) {
|
|
2677
|
+
// Validate all UUIDs
|
|
2678
|
+
exampleIds.forEach((id) => assertUuid(id));
|
|
2679
|
+
if (options?.hardDelete) {
|
|
2680
|
+
// Hard delete uses POST to a different platform endpoint
|
|
2681
|
+
const path = this._getPlatformEndpointPath("datasets/examples/delete");
|
|
2682
|
+
await this.caller.call(async () => {
|
|
2683
|
+
const res = await this._fetch(`${this.apiUrl}${path}`, {
|
|
2684
|
+
method: "POST",
|
|
2685
|
+
headers: { ...this.headers, "Content-Type": "application/json" },
|
|
2686
|
+
body: JSON.stringify({
|
|
2687
|
+
example_ids: exampleIds,
|
|
2688
|
+
hard_delete: true,
|
|
2689
|
+
}),
|
|
2690
|
+
signal: AbortSignal.timeout(this.timeout_ms),
|
|
2691
|
+
...this.fetchOptions,
|
|
2692
|
+
});
|
|
2693
|
+
await raiseForStatus(res, "hard delete examples", true);
|
|
2694
|
+
return res;
|
|
2695
|
+
});
|
|
2696
|
+
}
|
|
2697
|
+
else {
|
|
2698
|
+
// Soft delete uses DELETE with query params
|
|
2699
|
+
const params = new URLSearchParams();
|
|
2700
|
+
exampleIds.forEach((id) => params.append("example_ids", id));
|
|
2701
|
+
await this.caller.call(async () => {
|
|
2702
|
+
const res = await this._fetch(`${this.apiUrl}/examples?${params.toString()}`, {
|
|
2703
|
+
method: "DELETE",
|
|
2704
|
+
headers: this.headers,
|
|
2705
|
+
signal: AbortSignal.timeout(this.timeout_ms),
|
|
2706
|
+
...this.fetchOptions,
|
|
2707
|
+
});
|
|
2708
|
+
await raiseForStatus(res, "delete examples", true);
|
|
2709
|
+
return res;
|
|
2710
|
+
});
|
|
2711
|
+
}
|
|
2712
|
+
}
|
|
2660
2713
|
async updateExample(exampleIdOrUpdate, update) {
|
|
2661
2714
|
let exampleId;
|
|
2662
2715
|
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.
|
|
16
|
+
exports.__version__ = "0.3.85";
|
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.
|
|
7
|
+
export declare const __version__ = "0.3.85";
|
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.
|
|
7
|
+
export const __version__ = "0.3.85";
|