langsmith 0.3.14 → 0.3.15

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.
Files changed (42) hide show
  1. package/dist/anonymizer/index.cjs +1 -2
  2. package/dist/client.cjs +19 -9
  3. package/dist/evaluation/_random_name.cjs +1 -2
  4. package/dist/evaluation/_runner.cjs +2 -2
  5. package/dist/evaluation/evaluate_comparative.cjs +1 -2
  6. package/dist/evaluation/evaluator.cjs +2 -2
  7. package/dist/evaluation/langchain.cjs +1 -2
  8. package/dist/index.cjs +1 -1
  9. package/dist/index.d.ts +1 -1
  10. package/dist/index.js +1 -1
  11. package/dist/jest/index.d.ts +45 -46
  12. package/dist/langchain.cjs +2 -2
  13. package/dist/run_trees.cjs +21 -11
  14. package/dist/singletons/traceable.cjs +3 -3
  15. package/dist/traceable.cjs +2 -3
  16. package/dist/traceable.js +0 -1
  17. package/dist/utils/_uuid.cjs +18 -9
  18. package/dist/utils/asserts.cjs +3 -3
  19. package/dist/utils/asserts.d.ts +3 -3
  20. package/dist/utils/atee.cjs +1 -2
  21. package/dist/utils/env.cjs +9 -9
  22. package/dist/utils/error.cjs +3 -3
  23. package/dist/utils/fast-safe-stringify/index.cjs +1 -2
  24. package/dist/utils/fast-safe-stringify/index.d.ts +1 -1
  25. package/dist/utils/jestlike/globals.cjs +3 -3
  26. package/dist/utils/jestlike/globals.d.ts +0 -1
  27. package/dist/utils/jestlike/index.cjs +23 -13
  28. package/dist/utils/jestlike/index.d.ts +30 -31
  29. package/dist/utils/jestlike/matchers.cjs +3 -4
  30. package/dist/utils/jestlike/reporter.cjs +18 -9
  31. package/dist/utils/jestlike/vendor/chain.cjs +1 -2
  32. package/dist/utils/jestlike/vendor/chain.d.ts +0 -1
  33. package/dist/utils/jestlike/vendor/evaluatedBy.cjs +2 -3
  34. package/dist/utils/messages.cjs +2 -3
  35. package/dist/utils/prompts.cjs +2 -3
  36. package/dist/utils/shuffle.cjs +1 -2
  37. package/dist/utils/warn.cjs +1 -2
  38. package/dist/vercel.cjs +17 -0
  39. package/dist/vercel.d.ts +4 -4
  40. package/dist/vercel.js +17 -0
  41. package/dist/vitest/index.d.ts +45 -46
  42. package/package.json +1 -1
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.createAnonymizer = void 0;
6
+ exports.createAnonymizer = createAnonymizer;
7
7
  const set_js_1 = __importDefault(require("../utils/lodash/set.cjs"));
8
8
  function extractStringNodes(data, options) {
9
9
  const parsedOptions = { ...options, maxDepth: options.maxDepth ?? 10 };
@@ -99,4 +99,3 @@ function createAnonymizer(replacer, options) {
99
99
  return mutateValue;
100
100
  };
101
101
  }
102
- exports.createAnonymizer = createAnonymizer;
package/dist/client.cjs CHANGED
@@ -15,15 +15,26 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.Client = exports.DEFAULT_BATCH_SIZE_LIMIT_BYTES = exports.AutoBatchQueue = exports.mergeRuntimeEnvIntoRunCreate = void 0;
36
+ exports.Client = exports.DEFAULT_BATCH_SIZE_LIMIT_BYTES = exports.AutoBatchQueue = void 0;
37
+ exports.mergeRuntimeEnvIntoRunCreate = mergeRuntimeEnvIntoRunCreate;
27
38
  const uuid = __importStar(require("uuid"));
28
39
  const async_caller_js_1 = require("./utils/async_caller.cjs");
29
40
  const messages_js_1 = require("./utils/messages.cjs");
@@ -56,7 +67,6 @@ function mergeRuntimeEnvIntoRunCreate(run) {
56
67
  };
57
68
  return run;
58
69
  }
59
- exports.mergeRuntimeEnvIntoRunCreate = mergeRuntimeEnvIntoRunCreate;
60
70
  const getTracingSamplingRate = (configRate) => {
61
71
  const samplingRateStr = configRate?.toString() ??
62
72
  (0, env_js_1.getLangSmithEnvironmentVariable)("TRACING_SAMPLING_RATE");
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.randomName = void 0;
3
+ exports.randomName = randomName;
4
4
  const adjectives = [
5
5
  "abandoned",
6
6
  "aching",
@@ -727,4 +727,3 @@ function randomName() {
727
727
  const number = Math.floor(Math.random() * 100);
728
728
  return `${adjective}-${noun}-${number}`;
729
729
  }
730
- exports.randomName = randomName;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports._ExperimentManager = exports.evaluate = void 0;
3
+ exports._ExperimentManager = void 0;
4
+ exports.evaluate = evaluate;
4
5
  const index_js_1 = require("../index.cjs");
5
6
  const traceable_js_1 = require("../traceable.cjs");
6
7
  const _git_js_1 = require("../utils/_git.cjs");
@@ -17,7 +18,6 @@ const evaluate_comparative_js_1 = require("./evaluate_comparative.cjs");
17
18
  function evaluate(target, options) {
18
19
  return _evaluate(target, options);
19
20
  }
20
- exports.evaluate = evaluate;
21
21
  /**
22
22
  * Manage the execution of experiments.
23
23
  *
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.evaluateComparative = void 0;
6
+ exports.evaluateComparative = evaluateComparative;
7
7
  const uuid_1 = require("uuid");
8
8
  const index_js_1 = require("../index.cjs");
9
9
  const shuffle_js_1 = require("../utils/shuffle.cjs");
@@ -216,4 +216,3 @@ async function evaluateComparative(experiments, options) {
216
216
  const results = await Promise.all(promises);
217
217
  return { experimentName, results };
218
218
  }
219
- exports.evaluateComparative = evaluateComparative;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.runEvaluator = exports.DynamicRunEvaluator = void 0;
3
+ exports.DynamicRunEvaluator = void 0;
4
+ exports.runEvaluator = runEvaluator;
4
5
  const uuid_1 = require("uuid");
5
6
  const traceable_js_1 = require("../traceable.cjs");
6
7
  /**
@@ -109,4 +110,3 @@ exports.DynamicRunEvaluator = DynamicRunEvaluator;
109
110
  function runEvaluator(func) {
110
111
  return new DynamicRunEvaluator(func);
111
112
  }
112
- exports.runEvaluator = runEvaluator;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getLangchainStringEvaluator = void 0;
3
+ exports.getLangchainStringEvaluator = getLangchainStringEvaluator;
4
4
  // eslint-disable-next-line import/no-extraneous-dependencies
5
5
  const evaluation_1 = require("langchain/evaluation");
6
6
  const langchain_js_1 = require("../langchain.cjs");
@@ -52,4 +52,3 @@ async function getLangchainStringEvaluator(type, options) {
52
52
  return { key: feedbackKey, ...score };
53
53
  };
54
54
  }
55
- exports.getLangchainStringEvaluator = getLangchainStringEvaluator;
package/dist/index.cjs CHANGED
@@ -8,4 +8,4 @@ Object.defineProperty(exports, "RunTree", { enumerable: true, get: function () {
8
8
  var fetch_js_1 = require("./singletons/fetch.cjs");
9
9
  Object.defineProperty(exports, "overrideFetchImplementation", { enumerable: true, get: function () { return fetch_js_1.overrideFetchImplementation; } });
10
10
  // Update using yarn bump-version
11
- exports.__version__ = "0.3.14";
11
+ exports.__version__ = "0.3.15";
package/dist/index.d.ts CHANGED
@@ -2,4 +2,4 @@ export { Client, type ClientConfig, type LangSmithTracingClientInterface, } from
2
2
  export type { Dataset, Example, TracerSession, Run, Feedback, RetrieverOutput, } from "./schemas.js";
3
3
  export { RunTree, type RunTreeConfig } from "./run_trees.js";
4
4
  export { overrideFetchImplementation } from "./singletons/fetch.js";
5
- export declare const __version__ = "0.3.14";
5
+ export declare const __version__ = "0.3.15";
package/dist/index.js CHANGED
@@ -2,4 +2,4 @@ export { Client, } from "./client.js";
2
2
  export { RunTree } from "./run_trees.js";
3
3
  export { overrideFetchImplementation } from "./singletons/fetch.js";
4
4
  // Update using yarn bump-version
5
- export const __version__ = "0.3.14";
5
+ export const __version__ = "0.3.15";
@@ -1,4 +1,3 @@
1
- /// <reference types="jest" />
2
1
  import { type AbsoluteCloseToMatcherOptions, type SemanticCloseToMatcherOptions, type RelativeCloseToMatcherOptions } from "../utils/jestlike/matchers.js";
3
2
  import type { SimpleEvaluator } from "../utils/jestlike/vendor/evaluatedBy.js";
4
3
  import { wrapEvaluator } from "../utils/jestlike/vendor/evaluatedBy.js";
@@ -60,74 +59,74 @@ declare global {
60
59
  }
61
60
  declare const test: (<I extends Record<string, any> = Record<string, any>, O extends Record<string, any> = Record<string, any>>(name: string, lsParams: LangSmithJestlikeWrapperParams<I, O>, testFn: (data: {
62
61
  inputs: I;
63
- referenceOutputs?: O | undefined;
64
- } & Record<string, any>) => unknown, timeout?: number | undefined) => void) & {
62
+ referenceOutputs?: O;
63
+ } & Record<string, any>) => unknown | Promise<unknown>, timeout?: number) => void) & {
65
64
  only: (<I extends Record<string, any> = Record<string, any>, O extends Record<string, any> = Record<string, any>>(name: string, lsParams: LangSmithJestlikeWrapperParams<I, O>, testFn: (data: {
66
65
  inputs: I;
67
- referenceOutputs?: O | undefined;
68
- } & Record<string, any>) => unknown, timeout?: number | undefined) => void) & {
69
- each: <I_1 extends import("../schemas.js").KVMap, O_1 extends import("../schemas.js").KVMap>(table: ({
70
- inputs: I_1;
71
- referenceOutputs?: O_1 | undefined;
72
- } & Record<string, any>)[], config?: import("../utils/jestlike/types.js").LangSmithJestlikeWrapperConfig | undefined) => (name: string, fn: (params: {
73
- inputs: I_1;
74
- referenceOutputs?: O_1 | undefined;
75
- } & Record<string, any>) => unknown, timeout?: number | undefined) => void;
66
+ referenceOutputs?: O;
67
+ } & Record<string, any>) => unknown | Promise<unknown>, timeout?: number) => void) & {
68
+ each: <I extends import("../schemas.js").KVMap, O extends import("../schemas.js").KVMap>(table: ({
69
+ inputs: I;
70
+ referenceOutputs?: O;
71
+ } & Record<string, any>)[], config?: import("../utils/jestlike/types.js").LangSmithJestlikeWrapperConfig) => (name: string, fn: (params: {
72
+ inputs: I;
73
+ referenceOutputs?: O;
74
+ } & Record<string, any>) => unknown | Promise<unknown>, timeout?: number) => void;
76
75
  };
77
76
  skip: (<I extends Record<string, any> = Record<string, any>, O extends Record<string, any> = Record<string, any>>(name: string, lsParams: LangSmithJestlikeWrapperParams<I, O>, testFn: (data: {
78
77
  inputs: I;
79
- referenceOutputs?: O | undefined;
80
- } & Record<string, any>) => unknown, timeout?: number | undefined) => void) & {
81
- each: <I_1 extends import("../schemas.js").KVMap, O_1 extends import("../schemas.js").KVMap>(table: ({
82
- inputs: I_1;
83
- referenceOutputs?: O_1 | undefined;
84
- } & Record<string, any>)[], config?: import("../utils/jestlike/types.js").LangSmithJestlikeWrapperConfig | undefined) => (name: string, fn: (params: {
85
- inputs: I_1;
86
- referenceOutputs?: O_1 | undefined;
87
- } & Record<string, any>) => unknown, timeout?: number | undefined) => void;
78
+ referenceOutputs?: O;
79
+ } & Record<string, any>) => unknown | Promise<unknown>, timeout?: number) => void) & {
80
+ each: <I extends import("../schemas.js").KVMap, O extends import("../schemas.js").KVMap>(table: ({
81
+ inputs: I;
82
+ referenceOutputs?: O;
83
+ } & Record<string, any>)[], config?: import("../utils/jestlike/types.js").LangSmithJestlikeWrapperConfig) => (name: string, fn: (params: {
84
+ inputs: I;
85
+ referenceOutputs?: O;
86
+ } & Record<string, any>) => unknown | Promise<unknown>, timeout?: number) => void;
88
87
  };
89
- each: <I_1 extends import("../schemas.js").KVMap, O_1 extends import("../schemas.js").KVMap>(table: ({
90
- inputs: I_1;
91
- referenceOutputs?: O_1 | undefined;
92
- } & Record<string, any>)[], config?: import("../utils/jestlike/types.js").LangSmithJestlikeWrapperConfig | undefined) => (name: string, fn: (params: {
93
- inputs: I_1;
94
- referenceOutputs?: O_1 | undefined;
95
- } & Record<string, any>) => unknown, timeout?: number | undefined) => void;
88
+ each: <I extends import("../schemas.js").KVMap, O extends import("../schemas.js").KVMap>(table: ({
89
+ inputs: I;
90
+ referenceOutputs?: O;
91
+ } & Record<string, any>)[], config?: import("../utils/jestlike/types.js").LangSmithJestlikeWrapperConfig) => (name: string, fn: (params: {
92
+ inputs: I;
93
+ referenceOutputs?: O;
94
+ } & Record<string, any>) => unknown | Promise<unknown>, timeout?: number) => void;
96
95
  }, it: (<I extends Record<string, any> = Record<string, any>, O extends Record<string, any> = Record<string, any>>(name: string, lsParams: LangSmithJestlikeWrapperParams<I, O>, testFn: (data: {
97
96
  inputs: I;
98
- referenceOutputs?: O | undefined;
99
- } & Record<string, any>) => unknown, timeout?: number | undefined) => void) & {
97
+ referenceOutputs?: O;
98
+ } & Record<string, any>) => unknown | Promise<unknown>, timeout?: number) => void) & {
100
99
  only: (<I extends Record<string, any> = Record<string, any>, O extends Record<string, any> = Record<string, any>>(name: string, lsParams: LangSmithJestlikeWrapperParams<I, O>, testFn: (data: {
101
100
  inputs: I;
102
- referenceOutputs?: O | undefined;
103
- } & Record<string, any>) => unknown, timeout?: number | undefined) => void) & {
101
+ referenceOutputs?: O;
102
+ } & Record<string, any>) => unknown | Promise<unknown>, timeout?: number) => void) & {
104
103
  each: <I extends import("../schemas.js").KVMap, O extends import("../schemas.js").KVMap>(table: ({
105
104
  inputs: I;
106
- referenceOutputs?: O | undefined;
107
- } & Record<string, any>)[], config?: import("../utils/jestlike/types.js").LangSmithJestlikeWrapperConfig | undefined) => (name: string, fn: (params: {
105
+ referenceOutputs?: O;
106
+ } & Record<string, any>)[], config?: import("../utils/jestlike/types.js").LangSmithJestlikeWrapperConfig) => (name: string, fn: (params: {
108
107
  inputs: I;
109
- referenceOutputs?: O | undefined;
110
- } & Record<string, any>) => unknown, timeout?: number | undefined) => void;
108
+ referenceOutputs?: O;
109
+ } & Record<string, any>) => unknown | Promise<unknown>, timeout?: number) => void;
111
110
  };
112
111
  skip: (<I extends Record<string, any> = Record<string, any>, O extends Record<string, any> = Record<string, any>>(name: string, lsParams: LangSmithJestlikeWrapperParams<I, O>, testFn: (data: {
113
112
  inputs: I;
114
- referenceOutputs?: O | undefined;
115
- } & Record<string, any>) => unknown, timeout?: number | undefined) => void) & {
113
+ referenceOutputs?: O;
114
+ } & Record<string, any>) => unknown | Promise<unknown>, timeout?: number) => void) & {
116
115
  each: <I extends import("../schemas.js").KVMap, O extends import("../schemas.js").KVMap>(table: ({
117
116
  inputs: I;
118
- referenceOutputs?: O | undefined;
119
- } & Record<string, any>)[], config?: import("../utils/jestlike/types.js").LangSmithJestlikeWrapperConfig | undefined) => (name: string, fn: (params: {
117
+ referenceOutputs?: O;
118
+ } & Record<string, any>)[], config?: import("../utils/jestlike/types.js").LangSmithJestlikeWrapperConfig) => (name: string, fn: (params: {
120
119
  inputs: I;
121
- referenceOutputs?: O | undefined;
122
- } & Record<string, any>) => unknown, timeout?: number | undefined) => void;
120
+ referenceOutputs?: O;
121
+ } & Record<string, any>) => unknown | Promise<unknown>, timeout?: number) => void;
123
122
  };
124
123
  each: <I extends import("../schemas.js").KVMap, O extends import("../schemas.js").KVMap>(table: ({
125
124
  inputs: I;
126
- referenceOutputs?: O | undefined;
127
- } & Record<string, any>)[], config?: import("../utils/jestlike/types.js").LangSmithJestlikeWrapperConfig | undefined) => (name: string, fn: (params: {
125
+ referenceOutputs?: O;
126
+ } & Record<string, any>)[], config?: import("../utils/jestlike/types.js").LangSmithJestlikeWrapperConfig) => (name: string, fn: (params: {
128
127
  inputs: I;
129
- referenceOutputs?: O | undefined;
130
- } & Record<string, any>) => unknown, timeout?: number | undefined) => void;
128
+ referenceOutputs?: O;
129
+ } & Record<string, any>) => unknown | Promise<unknown>, timeout?: number) => void;
131
130
  }, describe: import("../utils/jestlike/types.js").LangSmithJestlikeDescribeWrapper & {
132
131
  only: import("../utils/jestlike/types.js").LangSmithJestlikeDescribeWrapper;
133
132
  skip: import("../utils/jestlike/types.js").LangSmithJestlikeDescribeWrapper;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RunnableTraceable = exports.getLangchainCallbacks = void 0;
3
+ exports.RunnableTraceable = void 0;
4
+ exports.getLangchainCallbacks = getLangchainCallbacks;
4
5
  // These `@langchain/core` imports are intentionally not peer dependencies
5
6
  // to avoid package manager issues around circular dependencies.
6
7
  // eslint-disable-next-line import/no-extraneous-dependencies
@@ -77,7 +78,6 @@ async function getLangchainCallbacks(currentRunTree) {
77
78
  }
78
79
  return callbacks;
79
80
  }
80
- exports.getLangchainCallbacks = getLangchainCallbacks;
81
81
  /**
82
82
  * RunnableTraceable is a Runnable that wraps a traceable function.
83
83
  * This allows adding Langsmith traced functions into LangChain sequences.
@@ -15,15 +15,28 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.isRunnableConfigLike = exports.isRunTree = exports.RunTree = exports.convertToDottedOrderFormat = void 0;
36
+ exports.RunTree = void 0;
37
+ exports.convertToDottedOrderFormat = convertToDottedOrderFormat;
38
+ exports.isRunTree = isRunTree;
39
+ exports.isRunnableConfigLike = isRunnableConfigLike;
27
40
  const uuid = __importStar(require("uuid"));
28
41
  const env_js_1 = require("./utils/env.cjs");
29
42
  const client_js_1 = require("./client.cjs");
@@ -39,7 +52,6 @@ function convertToDottedOrderFormat(epoch, runId, executionOrder = 1) {
39
52
  const paddedOrder = executionOrder.toFixed(0).slice(0, 3).padStart(3, "0");
40
53
  return (stripNonAlphanumeric(`${new Date(epoch).toISOString().slice(0, -1)}${paddedOrder}Z`) + runId);
41
54
  }
42
- exports.convertToDottedOrderFormat = convertToDottedOrderFormat;
43
55
  /**
44
56
  * Baggage header information
45
57
  */
@@ -557,7 +569,6 @@ function isRunTree(x) {
557
569
  typeof x.createChild === "function" &&
558
570
  typeof x.postRun === "function");
559
571
  }
560
- exports.isRunTree = isRunTree;
561
572
  function isLangChainTracerLike(x) {
562
573
  return (typeof x === "object" &&
563
574
  x != null &&
@@ -583,4 +594,3 @@ function isRunnableConfigLike(x) {
583
594
  // Or it's an array with a LangChainTracerLike object within it
584
595
  containsLangChainTracerLike(x.callbacks)));
585
596
  }
586
- exports.isRunnableConfigLike = isRunnableConfigLike;
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isTraceableFunction = exports.ROOT = exports.withRunTree = exports.getCurrentRunTree = exports.AsyncLocalStorageProviderSingleton = void 0;
3
+ exports.ROOT = exports.getCurrentRunTree = exports.AsyncLocalStorageProviderSingleton = void 0;
4
+ exports.withRunTree = withRunTree;
5
+ exports.isTraceableFunction = isTraceableFunction;
4
6
  const run_trees_js_1 = require("../run_trees.cjs");
5
7
  class MockAsyncLocalStorage {
6
8
  getStore() {
@@ -51,11 +53,9 @@ function withRunTree(runTree, fn) {
51
53
  storage.run(runTree, () => void Promise.resolve(fn()).then(resolve).catch(reject));
52
54
  });
53
55
  }
54
- exports.withRunTree = withRunTree;
55
56
  exports.ROOT = Symbol.for("langsmith:traceable:root");
56
57
  function isTraceableFunction(x
57
58
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
58
59
  ) {
59
60
  return typeof x === "function" && "langsmith:traceable" in x;
60
61
  }
61
- exports.isTraceableFunction = isTraceableFunction;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ROOT = exports.withRunTree = exports.isTraceableFunction = exports.getCurrentRunTree = exports.traceable = void 0;
3
+ exports.ROOT = exports.withRunTree = exports.isTraceableFunction = exports.getCurrentRunTree = void 0;
4
+ exports.traceable = traceable;
4
5
  const node_async_hooks_1 = require("node:async_hooks");
5
6
  const run_trees_js_1 = require("./run_trees.cjs");
6
7
  const env_js_1 = require("./env.cjs");
@@ -189,7 +190,6 @@ const convertSerializableArg = (arg) => {
189
190
  if (prop === "next" || prop === "return" || prop === "throw") {
190
191
  const bound = arg[prop]?.bind(arg);
191
192
  return (...args) => {
192
- // @ts-expect-error TS cannot infer the argument types for the bound function
193
193
  const next = bound?.(...args);
194
194
  if (next != null)
195
195
  proxyState.push(next);
@@ -546,7 +546,6 @@ function traceable(wrappedFunc, config) {
546
546
  });
547
547
  return traceableFunc;
548
548
  }
549
- exports.traceable = traceable;
550
549
  var traceable_js_2 = require("./singletons/traceable.cjs");
551
550
  Object.defineProperty(exports, "getCurrentRunTree", { enumerable: true, get: function () { return traceable_js_2.getCurrentRunTree; } });
552
551
  Object.defineProperty(exports, "isTraceableFunction", { enumerable: true, get: function () { return traceable_js_2.isTraceableFunction; } });
package/dist/traceable.js CHANGED
@@ -186,7 +186,6 @@ const convertSerializableArg = (arg) => {
186
186
  if (prop === "next" || prop === "return" || prop === "throw") {
187
187
  const bound = arg[prop]?.bind(arg);
188
188
  return (...args) => {
189
- // @ts-expect-error TS cannot infer the argument types for the bound function
190
189
  const next = bound?.(...args);
191
190
  if (next != null)
192
191
  proxyState.push(next);
@@ -15,15 +15,25 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.assertUuid = void 0;
36
+ exports.assertUuid = assertUuid;
27
37
  const uuid = __importStar(require("uuid"));
28
38
  function assertUuid(str, which) {
29
39
  if (!uuid.validate(str)) {
@@ -34,4 +44,3 @@ function assertUuid(str, which) {
34
44
  }
35
45
  return str;
36
46
  }
37
- exports.assertUuid = assertUuid;
@@ -1,13 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isReadableStream = exports.isThenable = exports.isGenerator = exports.isIteratorLike = exports.isAsyncIterable = exports.isKVMap = exports.isPromiseMethod = void 0;
3
+ exports.isReadableStream = exports.isThenable = exports.isGenerator = exports.isIteratorLike = exports.isAsyncIterable = void 0;
4
+ exports.isPromiseMethod = isPromiseMethod;
5
+ exports.isKVMap = isKVMap;
4
6
  function isPromiseMethod(x) {
5
7
  if (x === "then" || x === "catch" || x === "finally") {
6
8
  return true;
7
9
  }
8
10
  return false;
9
11
  }
10
- exports.isPromiseMethod = isPromiseMethod;
11
12
  function isKVMap(x) {
12
13
  if (typeof x !== "object" || x == null) {
13
14
  return false;
@@ -19,7 +20,6 @@ function isKVMap(x) {
19
20
  !(Symbol.toStringTag in x) &&
20
21
  !(Symbol.iterator in x));
21
22
  }
22
- exports.isKVMap = isKVMap;
23
23
  const isAsyncIterable = (x) => x != null &&
24
24
  typeof x === "object" &&
25
25
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -1,7 +1,7 @@
1
1
  export declare function isPromiseMethod(x: string | symbol): x is "then" | "catch" | "finally";
2
2
  export declare function isKVMap(x: unknown): x is Record<string, unknown>;
3
3
  export declare const isAsyncIterable: (x: unknown) => x is AsyncIterable<unknown>;
4
- export declare const isIteratorLike: (x: unknown) => x is Iterator<unknown, any, undefined>;
5
- export declare const isGenerator: (x: unknown) => x is Generator<unknown, any, unknown>;
4
+ export declare const isIteratorLike: (x: unknown) => x is Iterator<unknown>;
5
+ export declare const isGenerator: (x: unknown) => x is Generator;
6
6
  export declare const isThenable: (x: unknown) => x is Promise<unknown>;
7
- export declare const isReadableStream: (x: unknown) => x is ReadableStream<any>;
7
+ export declare const isReadableStream: (x: unknown) => x is ReadableStream;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.atee = void 0;
3
+ exports.atee = atee;
4
4
  function atee(iter, length = 2) {
5
5
  const buffers = Array.from({ length }, () => []);
6
6
  return buffers.map(async function* makeIter(buffer) {
@@ -21,4 +21,3 @@ function atee(iter, length = 2) {
21
21
  }
22
22
  });
23
23
  }
24
- exports.atee = atee;
@@ -1,6 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getShas = exports.setEnvironmentVariable = exports.getLangSmithEnvironmentVariable = exports.getEnvironmentVariable = exports.getEnvironmentVariables = exports.getLangChainEnvVarsMetadata = exports.getLangChainEnvVars = exports.getRuntimeEnvironment = exports.getEnv = exports.isNode = exports.isDeno = exports.isJsDom = exports.isWebWorker = exports.isBrowser = void 0;
3
+ exports.getEnv = exports.isNode = exports.isDeno = exports.isJsDom = exports.isWebWorker = exports.isBrowser = void 0;
4
+ exports.getRuntimeEnvironment = getRuntimeEnvironment;
5
+ exports.getLangChainEnvVars = getLangChainEnvVars;
6
+ exports.getLangChainEnvVarsMetadata = getLangChainEnvVarsMetadata;
7
+ exports.getEnvironmentVariables = getEnvironmentVariables;
8
+ exports.getEnvironmentVariable = getEnvironmentVariable;
9
+ exports.getLangSmithEnvironmentVariable = getLangSmithEnvironmentVariable;
10
+ exports.setEnvironmentVariable = setEnvironmentVariable;
11
+ exports.getShas = getShas;
4
12
  // Inlined from https://github.com/flexdinesh/browser-or-node
5
13
  const index_js_1 = require("../index.cjs");
6
14
  let globalEnv;
@@ -65,7 +73,6 @@ function getRuntimeEnvironment() {
65
73
  }
66
74
  return runtimeEnvironment;
67
75
  }
68
- exports.getRuntimeEnvironment = getRuntimeEnvironment;
69
76
  /**
70
77
  * Retrieves the LangChain-specific environment variables from the current runtime environment.
71
78
  * Sensitive keys (containing the word "key", "token", or "secret") have their values redacted for security.
@@ -93,7 +100,6 @@ function getLangChainEnvVars() {
93
100
  }
94
101
  return envVars;
95
102
  }
96
- exports.getLangChainEnvVars = getLangChainEnvVars;
97
103
  /**
98
104
  * Retrieves the LangChain-specific metadata from the current runtime environment.
99
105
  *
@@ -132,7 +138,6 @@ function getLangChainEnvVarsMetadata() {
132
138
  }
133
139
  return envVars;
134
140
  }
135
- exports.getLangChainEnvVarsMetadata = getLangChainEnvVarsMetadata;
136
141
  /**
137
142
  * Retrieves the environment variables from the current runtime environment.
138
143
  *
@@ -163,7 +168,6 @@ function getEnvironmentVariables() {
163
168
  return undefined;
164
169
  }
165
170
  }
166
- exports.getEnvironmentVariables = getEnvironmentVariables;
167
171
  function getEnvironmentVariable(name) {
168
172
  // Certain Deno setups will throw an error if you try to access environment variables
169
173
  // https://github.com/hwchase17/langchainjs/issues/1412
@@ -177,19 +181,16 @@ function getEnvironmentVariable(name) {
177
181
  return undefined;
178
182
  }
179
183
  }
180
- exports.getEnvironmentVariable = getEnvironmentVariable;
181
184
  function getLangSmithEnvironmentVariable(name) {
182
185
  return (getEnvironmentVariable(`LANGSMITH_${name}`) ||
183
186
  getEnvironmentVariable(`LANGCHAIN_${name}`));
184
187
  }
185
- exports.getLangSmithEnvironmentVariable = getLangSmithEnvironmentVariable;
186
188
  function setEnvironmentVariable(name, value) {
187
189
  if (typeof process !== "undefined") {
188
190
  // eslint-disable-next-line no-process-env
189
191
  process.env[name] = value;
190
192
  }
191
193
  }
192
- exports.setEnvironmentVariable = setEnvironmentVariable;
193
194
  let cachedCommitSHAs;
194
195
  /**
195
196
  * Get the Git commit SHA from common environment variables
@@ -231,4 +232,3 @@ function getShas() {
231
232
  cachedCommitSHAs = shas;
232
233
  return shas;
233
234
  }
234
- exports.getShas = getShas;
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.raiseForStatus = exports.LangSmithConflictError = exports.printErrorStackTrace = void 0;
3
+ exports.LangSmithConflictError = void 0;
4
+ exports.printErrorStackTrace = printErrorStackTrace;
5
+ exports.raiseForStatus = raiseForStatus;
4
6
  function getErrorStackTrace(e) {
5
7
  if (typeof e !== "object" || e == null)
6
8
  return undefined;
@@ -22,7 +24,6 @@ function printErrorStackTrace(e) {
22
24
  return;
23
25
  console.error(stack);
24
26
  }
25
- exports.printErrorStackTrace = printErrorStackTrace;
26
27
  /**
27
28
  * LangSmithConflictError
28
29
  *
@@ -86,4 +87,3 @@ async function raiseForStatus(response, context, consume) {
86
87
  }
87
88
  throw new Error(fullMessage);
88
89
  }
89
- exports.raiseForStatus = raiseForStatus;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.serialize = void 0;
3
+ exports.serialize = serialize;
4
4
  /* eslint-disable */
5
5
  // @ts-nocheck
6
6
  var LIMIT_REPLACE_NODE = "[...]";
@@ -60,7 +60,6 @@ function serialize(obj, replacer, spacer, options) {
60
60
  return encodeString(res);
61
61
  }
62
62
  }
63
- exports.serialize = serialize;
64
63
  function setReplace(replace, val, k, parent) {
65
64
  var propertyDescriptor = Object.getOwnPropertyDescriptor(parent, k);
66
65
  if (propertyDescriptor.get !== undefined) {
@@ -1 +1 @@
1
- export declare function serialize(obj: any, replacer?: any, spacer?: any, options?: any): Uint8Array;
1
+ export declare function serialize(obj: any, replacer?: any, spacer?: any, options?: any): Uint8Array<ArrayBufferLike>;