langsmith 0.3.1 → 0.3.2
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/jest/reporter.cjs +12 -1
- package/dist/jest/reporter.js +12 -1
- package/dist/utils/jestlike/reporter.cjs +12 -5
- package/dist/utils/jestlike/reporter.js +12 -5
- package/package.json +1 -1
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.2";
|
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.2";
|
package/dist/index.js
CHANGED
package/dist/jest/reporter.cjs
CHANGED
|
@@ -5,8 +5,19 @@ const reporters_1 = require("@jest/reporters");
|
|
|
5
5
|
const reporter_js_1 = require("../utils/jestlike/reporter.cjs");
|
|
6
6
|
class LangSmithEvalReporter extends reporters_1.DefaultReporter {
|
|
7
7
|
async onTestResult(test, testResult, aggregatedResults) {
|
|
8
|
+
const groupedTestResults = testResult.testResults.reduce((groups, testResult) => {
|
|
9
|
+
const ancestorTitle = testResult.ancestorTitles.join(" > ");
|
|
10
|
+
if (groups[ancestorTitle] === undefined) {
|
|
11
|
+
groups[ancestorTitle] = [];
|
|
12
|
+
}
|
|
13
|
+
groups[ancestorTitle].push(testResult);
|
|
14
|
+
return groups;
|
|
15
|
+
}, {});
|
|
8
16
|
try {
|
|
9
|
-
|
|
17
|
+
for (const testGroupName of Object.keys(groupedTestResults)) {
|
|
18
|
+
const resultGroup = groupedTestResults[testGroupName];
|
|
19
|
+
await (0, reporter_js_1.printReporterTable)(resultGroup, testResult.failureMessage);
|
|
20
|
+
}
|
|
10
21
|
}
|
|
11
22
|
catch (e) {
|
|
12
23
|
console.log("Failed to display LangSmith eval results:", e.message);
|
package/dist/jest/reporter.js
CHANGED
|
@@ -3,8 +3,19 @@ import { DefaultReporter } from "@jest/reporters";
|
|
|
3
3
|
import { printReporterTable } from "../utils/jestlike/reporter.js";
|
|
4
4
|
class LangSmithEvalReporter extends DefaultReporter {
|
|
5
5
|
async onTestResult(test, testResult, aggregatedResults) {
|
|
6
|
+
const groupedTestResults = testResult.testResults.reduce((groups, testResult) => {
|
|
7
|
+
const ancestorTitle = testResult.ancestorTitles.join(" > ");
|
|
8
|
+
if (groups[ancestorTitle] === undefined) {
|
|
9
|
+
groups[ancestorTitle] = [];
|
|
10
|
+
}
|
|
11
|
+
groups[ancestorTitle].push(testResult);
|
|
12
|
+
return groups;
|
|
13
|
+
}, {});
|
|
6
14
|
try {
|
|
7
|
-
|
|
15
|
+
for (const testGroupName of Object.keys(groupedTestResults)) {
|
|
16
|
+
const resultGroup = groupedTestResults[testGroupName];
|
|
17
|
+
await printReporterTable(resultGroup, testResult.failureMessage);
|
|
18
|
+
}
|
|
8
19
|
}
|
|
9
20
|
catch (e) {
|
|
10
21
|
console.log("Failed to display LangSmith eval results:", e.message);
|
|
@@ -34,6 +34,7 @@ const path = __importStar(require("node:path"));
|
|
|
34
34
|
const fs = __importStar(require("node:fs/promises"));
|
|
35
35
|
const index_js_1 = require("./index.cjs");
|
|
36
36
|
const FEEDBACK_COLLAPSE_THRESHOLD = 48;
|
|
37
|
+
const MAX_TEST_PARAMS_LENGTH = 18;
|
|
37
38
|
const RESERVED_KEYS = [
|
|
38
39
|
"Name",
|
|
39
40
|
"Result",
|
|
@@ -86,7 +87,9 @@ function formatValue(value) {
|
|
|
86
87
|
.map(([k, v]) => {
|
|
87
88
|
const rawValue = typeof v === "string" ? v : JSON.stringify(v);
|
|
88
89
|
const rawEntry = `${k}: ${rawValue}`;
|
|
89
|
-
const entry = rawEntry.length >
|
|
90
|
+
const entry = rawEntry.length > MAX_TEST_PARAMS_LENGTH
|
|
91
|
+
? rawEntry.slice(0, MAX_TEST_PARAMS_LENGTH - 3) + "..."
|
|
92
|
+
: rawEntry;
|
|
90
93
|
return entry;
|
|
91
94
|
})
|
|
92
95
|
.join("\n");
|
|
@@ -230,9 +233,13 @@ async function printReporterTable(results, failureMessage) {
|
|
|
230
233
|
}
|
|
231
234
|
const defaultColumns = [
|
|
232
235
|
{ name: "Test", alignment: "left", maxLen: 36 },
|
|
233
|
-
{ name: "Inputs", alignment: "left", minLen:
|
|
234
|
-
{
|
|
235
|
-
|
|
236
|
+
{ name: "Inputs", alignment: "left", minLen: MAX_TEST_PARAMS_LENGTH },
|
|
237
|
+
{
|
|
238
|
+
name: "Reference Outputs",
|
|
239
|
+
alignment: "left",
|
|
240
|
+
minLen: MAX_TEST_PARAMS_LENGTH,
|
|
241
|
+
},
|
|
242
|
+
{ name: "Outputs", alignment: "left", minLen: MAX_TEST_PARAMS_LENGTH },
|
|
236
243
|
{ name: "Status", alignment: "left" },
|
|
237
244
|
];
|
|
238
245
|
if (collapseFeedbackColumn) {
|
|
@@ -245,7 +252,7 @@ async function printReporterTable(results, failureMessage) {
|
|
|
245
252
|
defaultColumns.push({
|
|
246
253
|
name: "Feedback",
|
|
247
254
|
alignment: "left",
|
|
248
|
-
minLen: feedbackColumnLength +
|
|
255
|
+
minLen: feedbackColumnLength + 8,
|
|
249
256
|
});
|
|
250
257
|
}
|
|
251
258
|
console.log();
|
|
@@ -5,6 +5,7 @@ import * as path from "node:path";
|
|
|
5
5
|
import * as fs from "node:fs/promises";
|
|
6
6
|
import { STRIP_ANSI_REGEX, TEST_ID_DELIMITER } from "./index.js";
|
|
7
7
|
const FEEDBACK_COLLAPSE_THRESHOLD = 48;
|
|
8
|
+
const MAX_TEST_PARAMS_LENGTH = 18;
|
|
8
9
|
const RESERVED_KEYS = [
|
|
9
10
|
"Name",
|
|
10
11
|
"Result",
|
|
@@ -57,7 +58,9 @@ function formatValue(value) {
|
|
|
57
58
|
.map(([k, v]) => {
|
|
58
59
|
const rawValue = typeof v === "string" ? v : JSON.stringify(v);
|
|
59
60
|
const rawEntry = `${k}: ${rawValue}`;
|
|
60
|
-
const entry = rawEntry.length >
|
|
61
|
+
const entry = rawEntry.length > MAX_TEST_PARAMS_LENGTH
|
|
62
|
+
? rawEntry.slice(0, MAX_TEST_PARAMS_LENGTH - 3) + "..."
|
|
63
|
+
: rawEntry;
|
|
61
64
|
return entry;
|
|
62
65
|
})
|
|
63
66
|
.join("\n");
|
|
@@ -201,9 +204,13 @@ export async function printReporterTable(results, failureMessage) {
|
|
|
201
204
|
}
|
|
202
205
|
const defaultColumns = [
|
|
203
206
|
{ name: "Test", alignment: "left", maxLen: 36 },
|
|
204
|
-
{ name: "Inputs", alignment: "left", minLen:
|
|
205
|
-
{
|
|
206
|
-
|
|
207
|
+
{ name: "Inputs", alignment: "left", minLen: MAX_TEST_PARAMS_LENGTH },
|
|
208
|
+
{
|
|
209
|
+
name: "Reference Outputs",
|
|
210
|
+
alignment: "left",
|
|
211
|
+
minLen: MAX_TEST_PARAMS_LENGTH,
|
|
212
|
+
},
|
|
213
|
+
{ name: "Outputs", alignment: "left", minLen: MAX_TEST_PARAMS_LENGTH },
|
|
207
214
|
{ name: "Status", alignment: "left" },
|
|
208
215
|
];
|
|
209
216
|
if (collapseFeedbackColumn) {
|
|
@@ -216,7 +223,7 @@ export async function printReporterTable(results, failureMessage) {
|
|
|
216
223
|
defaultColumns.push({
|
|
217
224
|
name: "Feedback",
|
|
218
225
|
alignment: "left",
|
|
219
|
-
minLen: feedbackColumnLength +
|
|
226
|
+
minLen: feedbackColumnLength + 8,
|
|
220
227
|
});
|
|
221
228
|
}
|
|
222
229
|
console.log();
|