langsmith 0.3.14 → 0.3.16
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/anonymizer/index.cjs +1 -2
- package/dist/client.cjs +22 -11
- package/dist/client.js +3 -2
- package/dist/evaluation/_random_name.cjs +1 -2
- package/dist/evaluation/_runner.cjs +2 -2
- package/dist/evaluation/evaluate_comparative.cjs +1 -2
- package/dist/evaluation/evaluator.cjs +2 -2
- package/dist/evaluation/langchain.cjs +1 -2
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/jest/index.d.ts +45 -46
- package/dist/langchain.cjs +2 -2
- package/dist/run_trees.cjs +22 -11
- package/dist/run_trees.js +1 -0
- package/dist/schemas.d.ts +1 -0
- package/dist/singletons/traceable.cjs +3 -3
- package/dist/traceable.cjs +2 -3
- package/dist/traceable.js +0 -1
- package/dist/utils/_uuid.cjs +18 -9
- package/dist/utils/asserts.cjs +3 -3
- package/dist/utils/asserts.d.ts +3 -3
- package/dist/utils/atee.cjs +1 -2
- package/dist/utils/env.cjs +9 -9
- package/dist/utils/error.cjs +3 -3
- package/dist/utils/fast-safe-stringify/index.cjs +1 -2
- package/dist/utils/fast-safe-stringify/index.d.ts +1 -1
- package/dist/utils/jestlike/globals.cjs +3 -3
- package/dist/utils/jestlike/globals.d.ts +0 -1
- package/dist/utils/jestlike/index.cjs +26 -13
- package/dist/utils/jestlike/index.d.ts +30 -31
- package/dist/utils/jestlike/index.js +4 -1
- package/dist/utils/jestlike/matchers.cjs +3 -4
- package/dist/utils/jestlike/reporter.cjs +18 -9
- package/dist/utils/jestlike/vendor/chain.cjs +1 -2
- package/dist/utils/jestlike/vendor/chain.d.ts +0 -1
- package/dist/utils/jestlike/vendor/evaluatedBy.cjs +2 -3
- package/dist/utils/messages.cjs +2 -3
- package/dist/utils/prompts.cjs +2 -3
- package/dist/utils/shuffle.cjs +1 -2
- package/dist/utils/warn.cjs +1 -2
- package/dist/vercel.cjs +17 -0
- package/dist/vercel.d.ts +4 -4
- package/dist/vercel.js +17 -0
- package/dist/vitest/index.d.ts +45 -46
- 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 =
|
|
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 (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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 =
|
|
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");
|
|
@@ -2918,7 +2928,7 @@ class Client {
|
|
|
2918
2928
|
}
|
|
2919
2929
|
async _updateExamplesMultipart(datasetId, updates = []) {
|
|
2920
2930
|
if (!(await this._getMultiPartSupport())) {
|
|
2921
|
-
throw new Error("Your LangSmith
|
|
2931
|
+
throw new Error("Your LangSmith deployment does not allow using the multipart examples endpoint, please upgrade your deployment to the latest version.");
|
|
2922
2932
|
}
|
|
2923
2933
|
const formData = new FormData();
|
|
2924
2934
|
for (const example of updates) {
|
|
@@ -2996,7 +3006,7 @@ class Client {
|
|
|
2996
3006
|
}
|
|
2997
3007
|
async _uploadExamplesMultipart(datasetId, uploads = []) {
|
|
2998
3008
|
if (!(await this._getMultiPartSupport())) {
|
|
2999
|
-
throw new Error("Your LangSmith
|
|
3009
|
+
throw new Error("Your LangSmith deployment does not allow using the multipart examples endpoint, please upgrade your deployment to the latest version.");
|
|
3000
3010
|
}
|
|
3001
3011
|
const formData = new FormData();
|
|
3002
3012
|
for (const example of uploads) {
|
|
@@ -3060,6 +3070,7 @@ class Client {
|
|
|
3060
3070
|
headers: this.headers,
|
|
3061
3071
|
body: formData,
|
|
3062
3072
|
});
|
|
3073
|
+
await (0, error_js_1.raiseForStatus)(response, "upload examples");
|
|
3063
3074
|
const result = await response.json();
|
|
3064
3075
|
return result;
|
|
3065
3076
|
}
|
package/dist/client.js
CHANGED
|
@@ -2890,7 +2890,7 @@ export class Client {
|
|
|
2890
2890
|
}
|
|
2891
2891
|
async _updateExamplesMultipart(datasetId, updates = []) {
|
|
2892
2892
|
if (!(await this._getMultiPartSupport())) {
|
|
2893
|
-
throw new Error("Your LangSmith
|
|
2893
|
+
throw new Error("Your LangSmith deployment does not allow using the multipart examples endpoint, please upgrade your deployment to the latest version.");
|
|
2894
2894
|
}
|
|
2895
2895
|
const formData = new FormData();
|
|
2896
2896
|
for (const example of updates) {
|
|
@@ -2968,7 +2968,7 @@ export class Client {
|
|
|
2968
2968
|
}
|
|
2969
2969
|
async _uploadExamplesMultipart(datasetId, uploads = []) {
|
|
2970
2970
|
if (!(await this._getMultiPartSupport())) {
|
|
2971
|
-
throw new Error("Your LangSmith
|
|
2971
|
+
throw new Error("Your LangSmith deployment does not allow using the multipart examples endpoint, please upgrade your deployment to the latest version.");
|
|
2972
2972
|
}
|
|
2973
2973
|
const formData = new FormData();
|
|
2974
2974
|
for (const example of uploads) {
|
|
@@ -3032,6 +3032,7 @@ export class Client {
|
|
|
3032
3032
|
headers: this.headers,
|
|
3033
3033
|
body: formData,
|
|
3034
3034
|
});
|
|
3035
|
+
await raiseForStatus(response, "upload examples");
|
|
3035
3036
|
const result = await response.json();
|
|
3036
3037
|
return result;
|
|
3037
3038
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.randomName =
|
|
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 =
|
|
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 =
|
|
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.
|
|
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 =
|
|
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.
|
|
11
|
+
exports.__version__ = "0.3.16";
|
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.
|
|
5
|
+
export declare const __version__ = "0.3.16";
|
package/dist/index.js
CHANGED
package/dist/jest/index.d.ts
CHANGED
|
@@ -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
|
|
64
|
-
} & Record<string, any>) => unknown
|
|
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
|
|
68
|
-
} & Record<string, any>) => unknown
|
|
69
|
-
each: <
|
|
70
|
-
inputs:
|
|
71
|
-
referenceOutputs?:
|
|
72
|
-
} & Record<string, any>)[], config?: import("../utils/jestlike/types.js").LangSmithJestlikeWrapperConfig
|
|
73
|
-
inputs:
|
|
74
|
-
referenceOutputs?:
|
|
75
|
-
} & Record<string, any>) => unknown
|
|
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
|
|
80
|
-
} & Record<string, any>) => unknown
|
|
81
|
-
each: <
|
|
82
|
-
inputs:
|
|
83
|
-
referenceOutputs?:
|
|
84
|
-
} & Record<string, any>)[], config?: import("../utils/jestlike/types.js").LangSmithJestlikeWrapperConfig
|
|
85
|
-
inputs:
|
|
86
|
-
referenceOutputs?:
|
|
87
|
-
} & Record<string, any>) => unknown
|
|
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: <
|
|
90
|
-
inputs:
|
|
91
|
-
referenceOutputs?:
|
|
92
|
-
} & Record<string, any>)[], config?: import("../utils/jestlike/types.js").LangSmithJestlikeWrapperConfig
|
|
93
|
-
inputs:
|
|
94
|
-
referenceOutputs?:
|
|
95
|
-
} & Record<string, any>) => unknown
|
|
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
|
|
99
|
-
} & Record<string, any>) => unknown
|
|
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
|
|
103
|
-
} & Record<string, any>) => unknown
|
|
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
|
|
107
|
-
} & Record<string, any>)[], config?: import("../utils/jestlike/types.js").LangSmithJestlikeWrapperConfig
|
|
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
|
|
110
|
-
} & Record<string, any>) => unknown
|
|
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
|
|
115
|
-
} & Record<string, any>) => unknown
|
|
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
|
|
119
|
-
} & Record<string, any>)[], config?: import("../utils/jestlike/types.js").LangSmithJestlikeWrapperConfig
|
|
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
|
|
122
|
-
} & Record<string, any>) => unknown
|
|
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
|
|
127
|
-
} & Record<string, any>)[], config?: import("../utils/jestlike/types.js").LangSmithJestlikeWrapperConfig
|
|
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
|
|
130
|
-
} & Record<string, any>) => unknown
|
|
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;
|
package/dist/langchain.cjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RunnableTraceable =
|
|
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.
|
package/dist/run_trees.cjs
CHANGED
|
@@ -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 (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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.
|
|
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
|
*/
|
|
@@ -422,6 +434,7 @@ class RunTree {
|
|
|
422
434
|
trace_id: this.trace_id,
|
|
423
435
|
tags: this.tags,
|
|
424
436
|
attachments: this.attachments,
|
|
437
|
+
session_name: this.project_name,
|
|
425
438
|
};
|
|
426
439
|
await this.client.updateRun(this.id, runUpdate);
|
|
427
440
|
}
|
|
@@ -557,7 +570,6 @@ function isRunTree(x) {
|
|
|
557
570
|
typeof x.createChild === "function" &&
|
|
558
571
|
typeof x.postRun === "function");
|
|
559
572
|
}
|
|
560
|
-
exports.isRunTree = isRunTree;
|
|
561
573
|
function isLangChainTracerLike(x) {
|
|
562
574
|
return (typeof x === "object" &&
|
|
563
575
|
x != null &&
|
|
@@ -583,4 +595,3 @@ function isRunnableConfigLike(x) {
|
|
|
583
595
|
// Or it's an array with a LangChainTracerLike object within it
|
|
584
596
|
containsLangChainTracerLike(x.callbacks)));
|
|
585
597
|
}
|
|
586
|
-
exports.isRunnableConfigLike = isRunnableConfigLike;
|
package/dist/run_trees.js
CHANGED
package/dist/schemas.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
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;
|
package/dist/traceable.cjs
CHANGED
|
@@ -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 =
|
|
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);
|
package/dist/utils/_uuid.cjs
CHANGED
|
@@ -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 (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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 =
|
|
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;
|
package/dist/utils/asserts.cjs
CHANGED
|
@@ -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 =
|
|
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
|
package/dist/utils/asserts.d.ts
CHANGED
|
@@ -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
|
|
5
|
-
export declare const isGenerator: (x: unknown) => x is Generator
|
|
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
|
|
7
|
+
export declare const isReadableStream: (x: unknown) => x is ReadableStream;
|
package/dist/utils/atee.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.atee =
|
|
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;
|