langsmith 0.5.21 → 0.5.22
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 +60 -0
- package/dist/client.d.ts +12 -0
- package/dist/client.js +60 -0
- package/dist/experimental/sandbox/client.cjs +102 -427
- package/dist/experimental/sandbox/client.d.ts +68 -159
- package/dist/experimental/sandbox/client.js +104 -429
- package/dist/experimental/sandbox/errors.cjs +1 -2
- package/dist/experimental/sandbox/errors.d.ts +1 -2
- package/dist/experimental/sandbox/errors.js +1 -2
- package/dist/experimental/sandbox/helpers.cjs +8 -98
- package/dist/experimental/sandbox/helpers.d.ts +0 -29
- package/dist/experimental/sandbox/helpers.js +9 -95
- package/dist/experimental/sandbox/index.cjs +6 -1
- package/dist/experimental/sandbox/index.d.ts +7 -2
- package/dist/experimental/sandbox/index.js +6 -1
- package/dist/experimental/sandbox/sandbox.cjs +3 -11
- package/dist/experimental/sandbox/sandbox.d.ts +3 -5
- package/dist/experimental/sandbox/sandbox.js +3 -11
- package/dist/experimental/sandbox/types.d.ts +32 -149
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/wrappers/openai_agents.cjs +849 -0
- package/dist/wrappers/openai_agents.d.ts +92 -0
- package/dist/wrappers/openai_agents.js +845 -0
- package/package.json +19 -5
- package/wrappers/openai_agents.cjs +1 -0
- package/wrappers/openai_agents.d.cts +1 -0
- package/wrappers/openai_agents.d.ts +1 -0
- package/wrappers/openai_agents.js +1 -0
package/dist/client.cjs
CHANGED
|
@@ -317,6 +317,12 @@ class Client {
|
|
|
317
317
|
writable: true,
|
|
318
318
|
value: void 0
|
|
319
319
|
});
|
|
320
|
+
Object.defineProperty(this, "hideMetadata", {
|
|
321
|
+
enumerable: true,
|
|
322
|
+
configurable: true,
|
|
323
|
+
writable: true,
|
|
324
|
+
value: void 0
|
|
325
|
+
});
|
|
320
326
|
Object.defineProperty(this, "omitTracedRuntimeInfo", {
|
|
321
327
|
enumerable: true,
|
|
322
328
|
configurable: true,
|
|
@@ -529,6 +535,7 @@ class Client {
|
|
|
529
535
|
config.hideInputs ?? config.anonymizer ?? defaultConfig.hideInputs;
|
|
530
536
|
this.hideOutputs =
|
|
531
537
|
config.hideOutputs ?? config.anonymizer ?? defaultConfig.hideOutputs;
|
|
538
|
+
this.hideMetadata = config.hideMetadata ?? defaultConfig.hideMetadata;
|
|
532
539
|
this.omitTracedRuntimeInfo = config.omitTracedRuntimeInfo ?? false;
|
|
533
540
|
this.autoBatchTracing = config.autoBatchTracing ?? this.autoBatchTracing;
|
|
534
541
|
this.autoBatchQueue = new AutoBatchQueue(maxMemory);
|
|
@@ -578,12 +585,14 @@ class Client {
|
|
|
578
585
|
const apiUrl = (0, env_js_1.getLangSmithEnvironmentVariable)("ENDPOINT") ?? DEFAULT_API_URL;
|
|
579
586
|
const hideInputs = (0, env_js_1.getLangSmithEnvironmentVariable)("HIDE_INPUTS") === "true";
|
|
580
587
|
const hideOutputs = (0, env_js_1.getLangSmithEnvironmentVariable)("HIDE_OUTPUTS") === "true";
|
|
588
|
+
const hideMetadata = (0, env_js_1.getLangSmithEnvironmentVariable)("HIDE_METADATA") === "true";
|
|
581
589
|
return {
|
|
582
590
|
apiUrl: apiUrl,
|
|
583
591
|
apiKey: apiKey,
|
|
584
592
|
webUrl: undefined,
|
|
585
593
|
hideInputs: hideInputs,
|
|
586
594
|
hideOutputs: hideOutputs,
|
|
595
|
+
hideMetadata: hideMetadata,
|
|
587
596
|
};
|
|
588
597
|
}
|
|
589
598
|
getHostUrl() {
|
|
@@ -679,6 +688,18 @@ class Client {
|
|
|
679
688
|
}
|
|
680
689
|
return outputs;
|
|
681
690
|
}
|
|
691
|
+
async processMetadata(metadata) {
|
|
692
|
+
if (this.hideMetadata === false) {
|
|
693
|
+
return metadata;
|
|
694
|
+
}
|
|
695
|
+
if (this.hideMetadata === true) {
|
|
696
|
+
return {};
|
|
697
|
+
}
|
|
698
|
+
if (typeof this.hideMetadata === "function") {
|
|
699
|
+
return this.hideMetadata(metadata);
|
|
700
|
+
}
|
|
701
|
+
return metadata;
|
|
702
|
+
}
|
|
682
703
|
/**
|
|
683
704
|
* Filter content from new_token events to prevent streaming LLM output
|
|
684
705
|
* from being uploaded via events.
|
|
@@ -705,6 +726,12 @@ class Client {
|
|
|
705
726
|
if (runParams.outputs !== undefined) {
|
|
706
727
|
runParams.outputs = await this.processOutputs(runParams.outputs);
|
|
707
728
|
}
|
|
729
|
+
if (runParams.extra != null && "metadata" in runParams.extra) {
|
|
730
|
+
runParams.extra = {
|
|
731
|
+
...runParams.extra,
|
|
732
|
+
metadata: await this.processMetadata(runParams.extra.metadata),
|
|
733
|
+
};
|
|
734
|
+
}
|
|
708
735
|
if (runParams.events !== undefined) {
|
|
709
736
|
runParams.events = this._filterNewTokenEvents(runParams.events);
|
|
710
737
|
}
|
|
@@ -1552,6 +1579,12 @@ class Client {
|
|
|
1552
1579
|
if (run.outputs) {
|
|
1553
1580
|
run.outputs = await this.processOutputs(run.outputs);
|
|
1554
1581
|
}
|
|
1582
|
+
if (run.extra != null && "metadata" in run.extra) {
|
|
1583
|
+
run.extra = {
|
|
1584
|
+
...run.extra,
|
|
1585
|
+
metadata: await this.processMetadata(run.extra.metadata),
|
|
1586
|
+
};
|
|
1587
|
+
}
|
|
1555
1588
|
if (run.events) {
|
|
1556
1589
|
run.events = this._filterNewTokenEvents(run.events);
|
|
1557
1590
|
}
|
|
@@ -4563,6 +4596,33 @@ class Client {
|
|
|
4563
4596
|
await (0, otel_js_1.getDefaultOTLPTracerComponents)()?.DEFAULT_LANGSMITH_SPAN_PROCESSOR?.forceFlush();
|
|
4564
4597
|
}
|
|
4565
4598
|
}
|
|
4599
|
+
/**
|
|
4600
|
+
* Returns a string representation of the Client instance.
|
|
4601
|
+
* This method is called when the object is converted to a string
|
|
4602
|
+
* or logged, ensuring sensitive information like API keys is not exposed.
|
|
4603
|
+
*
|
|
4604
|
+
* @returns A string representation of the Client.
|
|
4605
|
+
*/
|
|
4606
|
+
toString() {
|
|
4607
|
+
const params = [`apiUrl=${JSON.stringify(this.apiUrl)}`];
|
|
4608
|
+
if (this.webUrl !== undefined) {
|
|
4609
|
+
params.push(`webUrl=${JSON.stringify(this.webUrl)}`);
|
|
4610
|
+
}
|
|
4611
|
+
if (this.workspaceId !== undefined) {
|
|
4612
|
+
params.push(`workspaceId=${JSON.stringify(this.workspaceId)}`);
|
|
4613
|
+
}
|
|
4614
|
+
return `[LangSmithClient ${params.join(" ")}]`;
|
|
4615
|
+
}
|
|
4616
|
+
/**
|
|
4617
|
+
* Custom inspect method for Node.js.
|
|
4618
|
+
* This method is called when the object is inspected in the Node.js REPL
|
|
4619
|
+
* or with console.log, ensuring sensitive information like API keys is not exposed.
|
|
4620
|
+
*
|
|
4621
|
+
* @returns A string representation of the Client for inspection.
|
|
4622
|
+
*/
|
|
4623
|
+
[Symbol.for("nodejs.util.inspect.custom")]() {
|
|
4624
|
+
return this.toString();
|
|
4625
|
+
}
|
|
4566
4626
|
}
|
|
4567
4627
|
exports.Client = Client;
|
|
4568
4628
|
Object.defineProperty(Client, "_fallbackDirsCreated", {
|
package/dist/client.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export interface ClientConfig {
|
|
|
12
12
|
anonymizer?: (values: KVMap) => KVMap | Promise<KVMap>;
|
|
13
13
|
hideInputs?: boolean | ((inputs: KVMap) => KVMap | Promise<KVMap>);
|
|
14
14
|
hideOutputs?: boolean | ((outputs: KVMap) => KVMap | Promise<KVMap>);
|
|
15
|
+
hideMetadata?: boolean | ((metadata: KVMap) => KVMap | Promise<KVMap>);
|
|
15
16
|
/**
|
|
16
17
|
* Whether to omit runtime information from traced runs.
|
|
17
18
|
* If true, runtime information (SDK version, platform, etc.) and
|
|
@@ -396,6 +397,7 @@ export declare class Client implements LangSmithTracingClientInterface {
|
|
|
396
397
|
private _tenantId;
|
|
397
398
|
private hideInputs?;
|
|
398
399
|
private hideOutputs?;
|
|
400
|
+
private hideMetadata?;
|
|
399
401
|
private omitTracedRuntimeInfo?;
|
|
400
402
|
private tracingSampleRate?;
|
|
401
403
|
private filteredPostUuids;
|
|
@@ -432,6 +434,7 @@ export declare class Client implements LangSmithTracingClientInterface {
|
|
|
432
434
|
webUrl?: string;
|
|
433
435
|
hideInputs?: boolean;
|
|
434
436
|
hideOutputs?: boolean;
|
|
437
|
+
hideMetadata?: boolean;
|
|
435
438
|
};
|
|
436
439
|
getHostUrl(): string;
|
|
437
440
|
private get _mergedHeaders();
|
|
@@ -445,6 +448,7 @@ export declare class Client implements LangSmithTracingClientInterface {
|
|
|
445
448
|
private _getPlatformEndpointPath;
|
|
446
449
|
private processInputs;
|
|
447
450
|
private processOutputs;
|
|
451
|
+
private processMetadata;
|
|
448
452
|
/**
|
|
449
453
|
* Filter content from new_token events to prevent streaming LLM output
|
|
450
454
|
* from being uploaded via events.
|
|
@@ -1345,6 +1349,14 @@ export declare class Client implements LangSmithTracingClientInterface {
|
|
|
1345
1349
|
* @returns A promise that resolves once all currently pending traces have sent.
|
|
1346
1350
|
*/
|
|
1347
1351
|
awaitPendingTraceBatches(): Promise<void>;
|
|
1352
|
+
/**
|
|
1353
|
+
* Returns a string representation of the Client instance.
|
|
1354
|
+
* This method is called when the object is converted to a string
|
|
1355
|
+
* or logged, ensuring sensitive information like API keys is not exposed.
|
|
1356
|
+
*
|
|
1357
|
+
* @returns A string representation of the Client.
|
|
1358
|
+
*/
|
|
1359
|
+
toString(): string;
|
|
1348
1360
|
}
|
|
1349
1361
|
export interface LangSmithTracingClientInterface {
|
|
1350
1362
|
createRun: (run: CreateRunParams) => Promise<void>;
|
package/dist/client.js
CHANGED
|
@@ -279,6 +279,12 @@ export class Client {
|
|
|
279
279
|
writable: true,
|
|
280
280
|
value: void 0
|
|
281
281
|
});
|
|
282
|
+
Object.defineProperty(this, "hideMetadata", {
|
|
283
|
+
enumerable: true,
|
|
284
|
+
configurable: true,
|
|
285
|
+
writable: true,
|
|
286
|
+
value: void 0
|
|
287
|
+
});
|
|
282
288
|
Object.defineProperty(this, "omitTracedRuntimeInfo", {
|
|
283
289
|
enumerable: true,
|
|
284
290
|
configurable: true,
|
|
@@ -491,6 +497,7 @@ export class Client {
|
|
|
491
497
|
config.hideInputs ?? config.anonymizer ?? defaultConfig.hideInputs;
|
|
492
498
|
this.hideOutputs =
|
|
493
499
|
config.hideOutputs ?? config.anonymizer ?? defaultConfig.hideOutputs;
|
|
500
|
+
this.hideMetadata = config.hideMetadata ?? defaultConfig.hideMetadata;
|
|
494
501
|
this.omitTracedRuntimeInfo = config.omitTracedRuntimeInfo ?? false;
|
|
495
502
|
this.autoBatchTracing = config.autoBatchTracing ?? this.autoBatchTracing;
|
|
496
503
|
this.autoBatchQueue = new AutoBatchQueue(maxMemory);
|
|
@@ -540,12 +547,14 @@ export class Client {
|
|
|
540
547
|
const apiUrl = getLangSmithEnvironmentVariable("ENDPOINT") ?? DEFAULT_API_URL;
|
|
541
548
|
const hideInputs = getLangSmithEnvironmentVariable("HIDE_INPUTS") === "true";
|
|
542
549
|
const hideOutputs = getLangSmithEnvironmentVariable("HIDE_OUTPUTS") === "true";
|
|
550
|
+
const hideMetadata = getLangSmithEnvironmentVariable("HIDE_METADATA") === "true";
|
|
543
551
|
return {
|
|
544
552
|
apiUrl: apiUrl,
|
|
545
553
|
apiKey: apiKey,
|
|
546
554
|
webUrl: undefined,
|
|
547
555
|
hideInputs: hideInputs,
|
|
548
556
|
hideOutputs: hideOutputs,
|
|
557
|
+
hideMetadata: hideMetadata,
|
|
549
558
|
};
|
|
550
559
|
}
|
|
551
560
|
getHostUrl() {
|
|
@@ -641,6 +650,18 @@ export class Client {
|
|
|
641
650
|
}
|
|
642
651
|
return outputs;
|
|
643
652
|
}
|
|
653
|
+
async processMetadata(metadata) {
|
|
654
|
+
if (this.hideMetadata === false) {
|
|
655
|
+
return metadata;
|
|
656
|
+
}
|
|
657
|
+
if (this.hideMetadata === true) {
|
|
658
|
+
return {};
|
|
659
|
+
}
|
|
660
|
+
if (typeof this.hideMetadata === "function") {
|
|
661
|
+
return this.hideMetadata(metadata);
|
|
662
|
+
}
|
|
663
|
+
return metadata;
|
|
664
|
+
}
|
|
644
665
|
/**
|
|
645
666
|
* Filter content from new_token events to prevent streaming LLM output
|
|
646
667
|
* from being uploaded via events.
|
|
@@ -667,6 +688,12 @@ export class Client {
|
|
|
667
688
|
if (runParams.outputs !== undefined) {
|
|
668
689
|
runParams.outputs = await this.processOutputs(runParams.outputs);
|
|
669
690
|
}
|
|
691
|
+
if (runParams.extra != null && "metadata" in runParams.extra) {
|
|
692
|
+
runParams.extra = {
|
|
693
|
+
...runParams.extra,
|
|
694
|
+
metadata: await this.processMetadata(runParams.extra.metadata),
|
|
695
|
+
};
|
|
696
|
+
}
|
|
670
697
|
if (runParams.events !== undefined) {
|
|
671
698
|
runParams.events = this._filterNewTokenEvents(runParams.events);
|
|
672
699
|
}
|
|
@@ -1514,6 +1541,12 @@ export class Client {
|
|
|
1514
1541
|
if (run.outputs) {
|
|
1515
1542
|
run.outputs = await this.processOutputs(run.outputs);
|
|
1516
1543
|
}
|
|
1544
|
+
if (run.extra != null && "metadata" in run.extra) {
|
|
1545
|
+
run.extra = {
|
|
1546
|
+
...run.extra,
|
|
1547
|
+
metadata: await this.processMetadata(run.extra.metadata),
|
|
1548
|
+
};
|
|
1549
|
+
}
|
|
1517
1550
|
if (run.events) {
|
|
1518
1551
|
run.events = this._filterNewTokenEvents(run.events);
|
|
1519
1552
|
}
|
|
@@ -4525,6 +4558,33 @@ export class Client {
|
|
|
4525
4558
|
await getDefaultOTLPTracerComponents()?.DEFAULT_LANGSMITH_SPAN_PROCESSOR?.forceFlush();
|
|
4526
4559
|
}
|
|
4527
4560
|
}
|
|
4561
|
+
/**
|
|
4562
|
+
* Returns a string representation of the Client instance.
|
|
4563
|
+
* This method is called when the object is converted to a string
|
|
4564
|
+
* or logged, ensuring sensitive information like API keys is not exposed.
|
|
4565
|
+
*
|
|
4566
|
+
* @returns A string representation of the Client.
|
|
4567
|
+
*/
|
|
4568
|
+
toString() {
|
|
4569
|
+
const params = [`apiUrl=${JSON.stringify(this.apiUrl)}`];
|
|
4570
|
+
if (this.webUrl !== undefined) {
|
|
4571
|
+
params.push(`webUrl=${JSON.stringify(this.webUrl)}`);
|
|
4572
|
+
}
|
|
4573
|
+
if (this.workspaceId !== undefined) {
|
|
4574
|
+
params.push(`workspaceId=${JSON.stringify(this.workspaceId)}`);
|
|
4575
|
+
}
|
|
4576
|
+
return `[LangSmithClient ${params.join(" ")}]`;
|
|
4577
|
+
}
|
|
4578
|
+
/**
|
|
4579
|
+
* Custom inspect method for Node.js.
|
|
4580
|
+
* This method is called when the object is inspected in the Node.js REPL
|
|
4581
|
+
* or with console.log, ensuring sensitive information like API keys is not exposed.
|
|
4582
|
+
*
|
|
4583
|
+
* @returns A string representation of the Client for inspection.
|
|
4584
|
+
*/
|
|
4585
|
+
[Symbol.for("nodejs.util.inspect.custom")]() {
|
|
4586
|
+
return this.toString();
|
|
4587
|
+
}
|
|
4528
4588
|
}
|
|
4529
4589
|
Object.defineProperty(Client, "_fallbackDirsCreated", {
|
|
4530
4590
|
enumerable: true,
|