langsmith 0.3.7 → 0.3.9-rc.0
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/index.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/traceable.cjs +24 -0
- package/dist/traceable.js +24 -0
- package/dist/utils/jestlike/constants.cjs +10 -0
- package/dist/utils/jestlike/constants.d.ts +4 -0
- package/dist/utils/jestlike/constants.js +7 -0
- package/dist/utils/jestlike/index.cjs +20 -20
- package/dist/utils/jestlike/index.d.ts +3 -3
- package/dist/utils/jestlike/index.js +10 -14
- package/dist/utils/jestlike/reporter.cjs +5 -5
- package/dist/utils/jestlike/reporter.js +1 -1
- package/package.json +15 -2
- package/utils/jestlike.cjs +1 -0
- package/utils/jestlike.d.cts +1 -0
- package/utils/jestlike.d.ts +1 -0
- package/utils/jestlike.js +1 -0
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.8";
|
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.8";
|
package/dist/index.js
CHANGED
package/dist/traceable.cjs
CHANGED
|
@@ -363,6 +363,18 @@ function traceable(wrappedFunc, config) {
|
|
|
363
363
|
controller.close();
|
|
364
364
|
break;
|
|
365
365
|
}
|
|
366
|
+
if (currentRunTree?.run_type === "llm") {
|
|
367
|
+
if (currentRunTree.events === undefined) {
|
|
368
|
+
currentRunTree.events = [];
|
|
369
|
+
}
|
|
370
|
+
currentRunTree.events.push({
|
|
371
|
+
name: "new_token",
|
|
372
|
+
time: new Date().toISOString(),
|
|
373
|
+
kwargs: {
|
|
374
|
+
token: result.value,
|
|
375
|
+
},
|
|
376
|
+
});
|
|
377
|
+
}
|
|
366
378
|
chunks.push(result.value);
|
|
367
379
|
controller.enqueue(result.value);
|
|
368
380
|
}
|
|
@@ -389,6 +401,18 @@ function traceable(wrappedFunc, config) {
|
|
|
389
401
|
finished = true;
|
|
390
402
|
break;
|
|
391
403
|
}
|
|
404
|
+
if (currentRunTree?.run_type === "llm") {
|
|
405
|
+
if (currentRunTree.events === undefined) {
|
|
406
|
+
currentRunTree.events = [];
|
|
407
|
+
}
|
|
408
|
+
currentRunTree.events.push({
|
|
409
|
+
name: "new_token",
|
|
410
|
+
time: new Date().toISOString(),
|
|
411
|
+
kwargs: {
|
|
412
|
+
token: value,
|
|
413
|
+
},
|
|
414
|
+
});
|
|
415
|
+
}
|
|
392
416
|
chunks.push(value);
|
|
393
417
|
yield value;
|
|
394
418
|
}
|
package/dist/traceable.js
CHANGED
|
@@ -360,6 +360,18 @@ export function traceable(wrappedFunc, config) {
|
|
|
360
360
|
controller.close();
|
|
361
361
|
break;
|
|
362
362
|
}
|
|
363
|
+
if (currentRunTree?.run_type === "llm") {
|
|
364
|
+
if (currentRunTree.events === undefined) {
|
|
365
|
+
currentRunTree.events = [];
|
|
366
|
+
}
|
|
367
|
+
currentRunTree.events.push({
|
|
368
|
+
name: "new_token",
|
|
369
|
+
time: new Date().toISOString(),
|
|
370
|
+
kwargs: {
|
|
371
|
+
token: result.value,
|
|
372
|
+
},
|
|
373
|
+
});
|
|
374
|
+
}
|
|
363
375
|
chunks.push(result.value);
|
|
364
376
|
controller.enqueue(result.value);
|
|
365
377
|
}
|
|
@@ -386,6 +398,18 @@ export function traceable(wrappedFunc, config) {
|
|
|
386
398
|
finished = true;
|
|
387
399
|
break;
|
|
388
400
|
}
|
|
401
|
+
if (currentRunTree?.run_type === "llm") {
|
|
402
|
+
if (currentRunTree.events === undefined) {
|
|
403
|
+
currentRunTree.events = [];
|
|
404
|
+
}
|
|
405
|
+
currentRunTree.events.push({
|
|
406
|
+
name: "new_token",
|
|
407
|
+
time: new Date().toISOString(),
|
|
408
|
+
kwargs: {
|
|
409
|
+
token: value,
|
|
410
|
+
},
|
|
411
|
+
});
|
|
412
|
+
}
|
|
389
413
|
chunks.push(value);
|
|
390
414
|
yield value;
|
|
391
415
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TEST_ID_DELIMITER = exports.STRIP_ANSI_REGEX = exports.UUID5_NAMESPACE = exports.DEFAULT_TEST_TIMEOUT = void 0;
|
|
4
|
+
exports.DEFAULT_TEST_TIMEOUT = 30_000;
|
|
5
|
+
exports.UUID5_NAMESPACE = "6ba7b810-9dad-11d1-80b4-00c04fd430c8";
|
|
6
|
+
// From https://stackoverflow.com/a/29497680
|
|
7
|
+
exports.STRIP_ANSI_REGEX =
|
|
8
|
+
// eslint-disable-next-line no-control-regex
|
|
9
|
+
/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g;
|
|
10
|
+
exports.TEST_ID_DELIMITER = ", test_id=";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export const DEFAULT_TEST_TIMEOUT = 30_000;
|
|
2
|
+
export const UUID5_NAMESPACE = "6ba7b810-9dad-11d1-80b4-00c04fd430c8";
|
|
3
|
+
// From https://stackoverflow.com/a/29497680
|
|
4
|
+
export const STRIP_ANSI_REGEX =
|
|
5
|
+
// eslint-disable-next-line no-control-regex
|
|
6
|
+
/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g;
|
|
7
|
+
export const TEST_ID_DELIMITER = ", test_id=";
|
|
@@ -24,11 +24,14 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
__setModuleDefault(result, mod);
|
|
25
25
|
return result;
|
|
26
26
|
};
|
|
27
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
28
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
29
|
+
};
|
|
27
30
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
28
31
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
29
32
|
};
|
|
30
33
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
|
-
exports.
|
|
34
|
+
exports.wrapEvaluator = exports.generateWrapperFromJestlikeMethods = exports._objectHash = exports.logOutputs = exports.logFeedback = void 0;
|
|
32
35
|
const crypto_1 = __importDefault(require("crypto"));
|
|
33
36
|
const uuid_1 = require("uuid");
|
|
34
37
|
const os = __importStar(require("node:os"));
|
|
@@ -41,13 +44,7 @@ const matchers_js_1 = require("./matchers.cjs");
|
|
|
41
44
|
const globals_js_1 = require("./globals.cjs");
|
|
42
45
|
const chain_js_1 = require("./vendor/chain.cjs");
|
|
43
46
|
const env_js_1 = require("../env.cjs");
|
|
44
|
-
const
|
|
45
|
-
const UUID5_NAMESPACE = "6ba7b810-9dad-11d1-80b4-00c04fd430c8";
|
|
46
|
-
// From https://stackoverflow.com/a/29497680
|
|
47
|
-
exports.STRIP_ANSI_REGEX =
|
|
48
|
-
// eslint-disable-next-line no-control-regex
|
|
49
|
-
/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g;
|
|
50
|
-
exports.TEST_ID_DELIMITER = ", test_id=";
|
|
47
|
+
const constants_js_1 = require("./constants.cjs");
|
|
51
48
|
function logFeedback(feedback, config) {
|
|
52
49
|
const context = globals_js_1.testWrapperAsyncLocalStorageInstance.getStore();
|
|
53
50
|
if (context === undefined) {
|
|
@@ -87,19 +84,19 @@ function logOutputs(output) {
|
|
|
87
84
|
context.setLoggedOutput(output);
|
|
88
85
|
}
|
|
89
86
|
exports.logOutputs = logOutputs;
|
|
90
|
-
function
|
|
87
|
+
function _objectHash(obj, depth = 0) {
|
|
91
88
|
// Prevent infinite recursion
|
|
92
89
|
if (depth > 50) {
|
|
93
90
|
throw new Error("Object is too deep to check equality for serialization. Please use a simpler example.");
|
|
94
91
|
}
|
|
95
92
|
if (Array.isArray(obj)) {
|
|
96
|
-
const arrayHash = obj.map((item) =>
|
|
93
|
+
const arrayHash = obj.map((item) => _objectHash(item, depth + 1)).join(",");
|
|
97
94
|
return crypto_1.default.createHash("sha256").update(arrayHash).digest("hex");
|
|
98
95
|
}
|
|
99
96
|
if (obj && typeof obj === "object") {
|
|
100
97
|
const sortedHash = Object.keys(obj)
|
|
101
98
|
.sort()
|
|
102
|
-
.map((key) => `${key}:${
|
|
99
|
+
.map((key) => `${key}:${_objectHash(obj[key], depth + 1)}`)
|
|
103
100
|
.join(",");
|
|
104
101
|
return crypto_1.default.createHash("sha256").update(sortedHash).digest("hex");
|
|
105
102
|
}
|
|
@@ -109,7 +106,7 @@ function objectHash(obj, depth = 0) {
|
|
|
109
106
|
.update(JSON.stringify(obj ?? null))
|
|
110
107
|
.digest("hex"));
|
|
111
108
|
}
|
|
112
|
-
exports.
|
|
109
|
+
exports._objectHash = _objectHash;
|
|
113
110
|
function generateWrapperFromJestlikeMethods(methods, testRunnerName) {
|
|
114
111
|
const { expect, test, describe, beforeAll, afterAll } = methods;
|
|
115
112
|
async function _createProject(client, datasetId, projectConfig) {
|
|
@@ -143,18 +140,18 @@ function generateWrapperFromJestlikeMethods(methods, testRunnerName) {
|
|
|
143
140
|
function getExampleId(datasetId, inputs, outputs) {
|
|
144
141
|
const identifier = JSON.stringify({
|
|
145
142
|
datasetId,
|
|
146
|
-
inputsHash:
|
|
147
|
-
outputsHash:
|
|
143
|
+
inputsHash: _objectHash(inputs),
|
|
144
|
+
outputsHash: _objectHash(outputs ?? {}),
|
|
148
145
|
});
|
|
149
|
-
return (0, uuid_1.v5)(identifier, UUID5_NAMESPACE);
|
|
146
|
+
return (0, uuid_1.v5)(identifier, constants_js_1.UUID5_NAMESPACE);
|
|
150
147
|
}
|
|
151
148
|
async function syncExample(params) {
|
|
152
149
|
const { client, exampleId, inputs, outputs, metadata, createdAt, datasetId, } = params;
|
|
153
150
|
let example;
|
|
154
151
|
try {
|
|
155
152
|
example = await client.readExample(exampleId);
|
|
156
|
-
if (
|
|
157
|
-
|
|
153
|
+
if (_objectHash(example.inputs) !== _objectHash(inputs) ||
|
|
154
|
+
_objectHash(example.outputs ?? {}) !== _objectHash(outputs ?? {}) ||
|
|
158
155
|
example.dataset_id !== datasetId) {
|
|
159
156
|
await client.updateExample(exampleId, {
|
|
160
157
|
inputs,
|
|
@@ -362,7 +359,7 @@ function generateWrapperFromJestlikeMethods(methods, testRunnerName) {
|
|
|
362
359
|
// Jest will not group tests under the same "describe" group if you await the test and
|
|
363
360
|
// total runs is greater than 1.
|
|
364
361
|
const resultsPath = path.join(os.tmpdir(), "langsmith_test_results", `${testUuid}.json`);
|
|
365
|
-
void method(`${name}${totalRuns > 1 ? `, run ${i}` : ""}${
|
|
362
|
+
void method(`${name}${totalRuns > 1 ? `, run ${i}` : ""}${constants_js_1.TEST_ID_DELIMITER}${testUuid}`, async () => {
|
|
366
363
|
if (context === undefined) {
|
|
367
364
|
throw new Error([
|
|
368
365
|
`Could not retrieve test context.`,
|
|
@@ -428,7 +425,7 @@ function generateWrapperFromJestlikeMethods(methods, testRunnerName) {
|
|
|
428
425
|
client: testContext.client,
|
|
429
426
|
});
|
|
430
427
|
const rawError = e;
|
|
431
|
-
const strippedErrorMessage = e.message.replace(
|
|
428
|
+
const strippedErrorMessage = e.message.replace(constants_js_1.STRIP_ANSI_REGEX, "");
|
|
432
429
|
const langsmithFriendlyError = new Error(strippedErrorMessage);
|
|
433
430
|
langsmithFriendlyError.rawJestError = rawError;
|
|
434
431
|
throw langsmithFriendlyError;
|
|
@@ -536,7 +533,7 @@ function generateWrapperFromJestlikeMethods(methods, testRunnerName) {
|
|
|
536
533
|
experimentUrl,
|
|
537
534
|
}));
|
|
538
535
|
}
|
|
539
|
-
}, timeout ?? DEFAULT_TEST_TIMEOUT);
|
|
536
|
+
}, timeout ?? constants_js_1.DEFAULT_TEST_TIMEOUT);
|
|
540
537
|
}
|
|
541
538
|
};
|
|
542
539
|
}
|
|
@@ -584,3 +581,6 @@ function generateWrapperFromJestlikeMethods(methods, testRunnerName) {
|
|
|
584
581
|
};
|
|
585
582
|
}
|
|
586
583
|
exports.generateWrapperFromJestlikeMethods = generateWrapperFromJestlikeMethods;
|
|
584
|
+
var evaluatedBy_js_1 = require("./vendor/evaluatedBy.cjs");
|
|
585
|
+
Object.defineProperty(exports, "wrapEvaluator", { enumerable: true, get: function () { return evaluatedBy_js_1.wrapEvaluator; } });
|
|
586
|
+
__exportStar(require("./types.cjs"), exports);
|
|
@@ -3,13 +3,11 @@ import { KVMap } from "../../schemas.js";
|
|
|
3
3
|
import { toBeRelativeCloseTo, toBeAbsoluteCloseTo, toBeSemanticCloseTo } from "./matchers.js";
|
|
4
4
|
import { SimpleEvaluationResult } from "./types.js";
|
|
5
5
|
import type { LangSmithJestlikeWrapperConfig, LangSmithJestlikeWrapperParams, LangSmithJestlikeDescribeWrapper } from "./types.js";
|
|
6
|
-
export declare const STRIP_ANSI_REGEX: RegExp;
|
|
7
|
-
export declare const TEST_ID_DELIMITER = ", test_id=";
|
|
8
6
|
export declare function logFeedback(feedback: SimpleEvaluationResult, config?: {
|
|
9
7
|
sourceRunId?: string;
|
|
10
8
|
}): void;
|
|
11
9
|
export declare function logOutputs(output: Record<string, unknown>): void;
|
|
12
|
-
export declare function
|
|
10
|
+
export declare function _objectHash(obj: KVMap, depth?: number): string;
|
|
13
11
|
export declare function generateWrapperFromJestlikeMethods(methods: Record<string, any>, testRunnerName: string): {
|
|
14
12
|
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: {
|
|
15
13
|
inputs: I;
|
|
@@ -92,3 +90,5 @@ export declare function generateWrapperFromJestlikeMethods(methods: Record<strin
|
|
|
92
90
|
toBeAbsoluteCloseTo: typeof toBeAbsoluteCloseTo;
|
|
93
91
|
toBeSemanticCloseTo: typeof toBeSemanticCloseTo;
|
|
94
92
|
};
|
|
93
|
+
export { wrapEvaluator } from "./vendor/evaluatedBy.js";
|
|
94
|
+
export * from "./types.js";
|
|
@@ -12,13 +12,7 @@ import { toBeRelativeCloseTo, toBeAbsoluteCloseTo, toBeSemanticCloseTo, } from "
|
|
|
12
12
|
import { evaluatorLogFeedbackPromises, testWrapperAsyncLocalStorageInstance, _logTestFeedback, syncExamplePromises, trackingEnabled, DEFAULT_TEST_CLIENT, } from "./globals.js";
|
|
13
13
|
import { wrapExpect } from "./vendor/chain.js";
|
|
14
14
|
import { getEnvironmentVariable } from "../env.js";
|
|
15
|
-
|
|
16
|
-
const UUID5_NAMESPACE = "6ba7b810-9dad-11d1-80b4-00c04fd430c8";
|
|
17
|
-
// From https://stackoverflow.com/a/29497680
|
|
18
|
-
export const STRIP_ANSI_REGEX =
|
|
19
|
-
// eslint-disable-next-line no-control-regex
|
|
20
|
-
/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g;
|
|
21
|
-
export const TEST_ID_DELIMITER = ", test_id=";
|
|
15
|
+
import { STRIP_ANSI_REGEX, TEST_ID_DELIMITER, DEFAULT_TEST_TIMEOUT, UUID5_NAMESPACE, } from "./constants.js";
|
|
22
16
|
export function logFeedback(feedback, config) {
|
|
23
17
|
const context = testWrapperAsyncLocalStorageInstance.getStore();
|
|
24
18
|
if (context === undefined) {
|
|
@@ -56,19 +50,19 @@ export function logOutputs(output) {
|
|
|
56
50
|
}
|
|
57
51
|
context.setLoggedOutput(output);
|
|
58
52
|
}
|
|
59
|
-
export function
|
|
53
|
+
export function _objectHash(obj, depth = 0) {
|
|
60
54
|
// Prevent infinite recursion
|
|
61
55
|
if (depth > 50) {
|
|
62
56
|
throw new Error("Object is too deep to check equality for serialization. Please use a simpler example.");
|
|
63
57
|
}
|
|
64
58
|
if (Array.isArray(obj)) {
|
|
65
|
-
const arrayHash = obj.map((item) =>
|
|
59
|
+
const arrayHash = obj.map((item) => _objectHash(item, depth + 1)).join(",");
|
|
66
60
|
return crypto.createHash("sha256").update(arrayHash).digest("hex");
|
|
67
61
|
}
|
|
68
62
|
if (obj && typeof obj === "object") {
|
|
69
63
|
const sortedHash = Object.keys(obj)
|
|
70
64
|
.sort()
|
|
71
|
-
.map((key) => `${key}:${
|
|
65
|
+
.map((key) => `${key}:${_objectHash(obj[key], depth + 1)}`)
|
|
72
66
|
.join(",");
|
|
73
67
|
return crypto.createHash("sha256").update(sortedHash).digest("hex");
|
|
74
68
|
}
|
|
@@ -111,8 +105,8 @@ export function generateWrapperFromJestlikeMethods(methods, testRunnerName) {
|
|
|
111
105
|
function getExampleId(datasetId, inputs, outputs) {
|
|
112
106
|
const identifier = JSON.stringify({
|
|
113
107
|
datasetId,
|
|
114
|
-
inputsHash:
|
|
115
|
-
outputsHash:
|
|
108
|
+
inputsHash: _objectHash(inputs),
|
|
109
|
+
outputsHash: _objectHash(outputs ?? {}),
|
|
116
110
|
});
|
|
117
111
|
return v5(identifier, UUID5_NAMESPACE);
|
|
118
112
|
}
|
|
@@ -121,8 +115,8 @@ export function generateWrapperFromJestlikeMethods(methods, testRunnerName) {
|
|
|
121
115
|
let example;
|
|
122
116
|
try {
|
|
123
117
|
example = await client.readExample(exampleId);
|
|
124
|
-
if (
|
|
125
|
-
|
|
118
|
+
if (_objectHash(example.inputs) !== _objectHash(inputs) ||
|
|
119
|
+
_objectHash(example.outputs ?? {}) !== _objectHash(outputs ?? {}) ||
|
|
126
120
|
example.dataset_id !== datasetId) {
|
|
127
121
|
await client.updateExample(exampleId, {
|
|
128
122
|
inputs,
|
|
@@ -551,3 +545,5 @@ export function generateWrapperFromJestlikeMethods(methods, testRunnerName) {
|
|
|
551
545
|
toBeSemanticCloseTo,
|
|
552
546
|
};
|
|
553
547
|
}
|
|
548
|
+
export { wrapEvaluator } from "./vendor/evaluatedBy.js";
|
|
549
|
+
export * from "./types.js";
|
|
@@ -32,7 +32,7 @@ const chalk_1 = __importDefault(require("chalk"));
|
|
|
32
32
|
const os = __importStar(require("node:os"));
|
|
33
33
|
const path = __importStar(require("node:path"));
|
|
34
34
|
const fs = __importStar(require("node:fs/promises"));
|
|
35
|
-
const
|
|
35
|
+
const constants_js_1 = require("./constants.cjs");
|
|
36
36
|
const FEEDBACK_COLLAPSE_THRESHOLD = 48;
|
|
37
37
|
const MAX_TEST_PARAMS_LENGTH = 18;
|
|
38
38
|
const RESERVED_KEYS = [
|
|
@@ -105,13 +105,13 @@ async function printReporterTable(testSuiteName, results, testStatus, failureMes
|
|
|
105
105
|
let experimentUrl;
|
|
106
106
|
for (const result of results) {
|
|
107
107
|
const { title, duration, status } = result;
|
|
108
|
-
const titleComponents = title.split(
|
|
108
|
+
const titleComponents = title.split(constants_js_1.TEST_ID_DELIMITER);
|
|
109
109
|
const testId = titleComponents.length > 1 && titleComponents.at(-1) !== undefined
|
|
110
110
|
? titleComponents.at(-1)
|
|
111
111
|
: undefined;
|
|
112
112
|
const testName = testId !== undefined
|
|
113
|
-
? titleComponents.slice(0, -1).join(
|
|
114
|
-
: titleComponents.join(
|
|
113
|
+
? titleComponents.slice(0, -1).join(constants_js_1.TEST_ID_DELIMITER).trim()
|
|
114
|
+
: titleComponents.join(constants_js_1.TEST_ID_DELIMITER);
|
|
115
115
|
// Non-LangSmith test
|
|
116
116
|
if (testId === undefined) {
|
|
117
117
|
rows.push([
|
|
@@ -245,7 +245,7 @@ async function printReporterTable(testSuiteName, results, testStatus, failureMes
|
|
|
245
245
|
if (collapseFeedbackColumn) {
|
|
246
246
|
const feedbackColumnLength = rows.reduce((max, [row]) => {
|
|
247
247
|
const maxFeedbackLineLength = row.Feedback?.split("\n").reduce((max, feedbackLine) => {
|
|
248
|
-
return Math.max(max, feedbackLine.replace(
|
|
248
|
+
return Math.max(max, feedbackLine.replace(constants_js_1.STRIP_ANSI_REGEX, "").length);
|
|
249
249
|
}, 0) ?? 0;
|
|
250
250
|
return Math.max(max, maxFeedbackLineLength);
|
|
251
251
|
}, 0);
|
|
@@ -3,7 +3,7 @@ import chalk from "chalk";
|
|
|
3
3
|
import * as os from "node:os";
|
|
4
4
|
import * as path from "node:path";
|
|
5
5
|
import * as fs from "node:fs/promises";
|
|
6
|
-
import { STRIP_ANSI_REGEX, TEST_ID_DELIMITER } from "./
|
|
6
|
+
import { STRIP_ANSI_REGEX, TEST_ID_DELIMITER } from "./constants.js";
|
|
7
7
|
const FEEDBACK_COLLAPSE_THRESHOLD = 48;
|
|
8
8
|
const MAX_TEST_PARAMS_LENGTH = 18;
|
|
9
9
|
const RESERVED_KEYS = [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "langsmith",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.9-rc.0",
|
|
4
4
|
"description": "Client library to connect to the LangSmith LLM Tracing and Evaluation Platform.",
|
|
5
5
|
"packageManager": "yarn@1.22.19",
|
|
6
6
|
"files": [
|
|
@@ -73,6 +73,10 @@
|
|
|
73
73
|
"singletons/traceable.js",
|
|
74
74
|
"singletons/traceable.d.ts",
|
|
75
75
|
"singletons/traceable.d.cts",
|
|
76
|
+
"utils/jestlike.cjs",
|
|
77
|
+
"utils/jestlike.js",
|
|
78
|
+
"utils/jestlike.d.ts",
|
|
79
|
+
"utils/jestlike.d.cts",
|
|
76
80
|
"index.cjs",
|
|
77
81
|
"index.js",
|
|
78
82
|
"index.d.ts",
|
|
@@ -162,7 +166,7 @@
|
|
|
162
166
|
"typedoc": "^0.27.6",
|
|
163
167
|
"typedoc-plugin-expand-object-like-types": "^0.1.2",
|
|
164
168
|
"typescript": "^5.4.5",
|
|
165
|
-
"vitest": "^
|
|
169
|
+
"vitest": "^3.0.5",
|
|
166
170
|
"zod": "^3.23.8"
|
|
167
171
|
},
|
|
168
172
|
"peerDependencies": {
|
|
@@ -342,6 +346,15 @@
|
|
|
342
346
|
"import": "./singletons/traceable.js",
|
|
343
347
|
"require": "./singletons/traceable.cjs"
|
|
344
348
|
},
|
|
349
|
+
"./utils/jestlike": {
|
|
350
|
+
"types": {
|
|
351
|
+
"import": "./utils/jestlike.d.ts",
|
|
352
|
+
"require": "./utils/jestlike.d.cts",
|
|
353
|
+
"default": "./utils/jestlike.d.ts"
|
|
354
|
+
},
|
|
355
|
+
"import": "./utils/jestlike.js",
|
|
356
|
+
"require": "./utils/jestlike.cjs"
|
|
357
|
+
},
|
|
345
358
|
"./package.json": "./package.json"
|
|
346
359
|
}
|
|
347
360
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('../dist/utils/jestlike/index.cjs');
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../dist/utils/jestlike/index.js'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../dist/utils/jestlike/index.js'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../dist/utils/jestlike/index.js'
|