langsmith 0.2.16-rc.3 → 0.2.16-rc.4
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 +1 -1
- package/dist/jest/reporter.js +1 -1
- package/dist/utils/jestlike/index.cjs +11 -3
- package/dist/utils/jestlike/index.js +11 -3
- package/dist/utils/jestlike/reporter.cjs +9 -2
- package/dist/utils/jestlike/reporter.js +9 -2
- 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.2.16-rc.
|
|
11
|
+
exports.__version__ = "0.2.16-rc.4";
|
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.2.16-rc.
|
|
5
|
+
export declare const __version__ = "0.2.16-rc.4";
|
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.2.16-rc.
|
|
5
|
+
export const __version__ = "0.2.16-rc.4";
|
package/dist/jest/reporter.cjs
CHANGED
|
@@ -5,12 +5,12 @@ 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
|
+
super.onTestResult(test, testResult, aggregatedResults);
|
|
8
9
|
try {
|
|
9
10
|
await (0, reporter_js_1.printReporterTable)(testResult.testResults, testResult.failureMessage);
|
|
10
11
|
}
|
|
11
12
|
catch (e) {
|
|
12
13
|
console.log("Failed to display LangSmith eval results:", e.message);
|
|
13
|
-
return super.onTestResult(test, testResult, aggregatedResults);
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
}
|
package/dist/jest/reporter.js
CHANGED
|
@@ -3,12 +3,12 @@ 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
|
+
super.onTestResult(test, testResult, aggregatedResults);
|
|
6
7
|
try {
|
|
7
8
|
await printReporterTable(testResult.testResults, testResult.failureMessage);
|
|
8
9
|
}
|
|
9
10
|
catch (e) {
|
|
10
11
|
console.log("Failed to display LangSmith eval results:", e.message);
|
|
11
|
-
return super.onTestResult(test, testResult, aggregatedResults);
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
}
|
|
@@ -193,10 +193,16 @@ function generateWrapperFromJestlikeMethods(methods) {
|
|
|
193
193
|
}
|
|
194
194
|
}
|
|
195
195
|
const project = await _createProject(testClient, dataset.id, projectConfig);
|
|
196
|
+
const datasetUrl = await testClient.getDatasetUrl({
|
|
197
|
+
datasetId: dataset.id,
|
|
198
|
+
});
|
|
199
|
+
const experimentUrl = `${datasetUrl}/compare?selectedSessions=${project.id}`;
|
|
200
|
+
console.log(`[LANGSMITH]: Experiment starting! View results at ${experimentUrl}`);
|
|
196
201
|
storageValue = {
|
|
197
202
|
dataset,
|
|
198
203
|
project,
|
|
199
204
|
client: testClient,
|
|
205
|
+
experimentUrl,
|
|
200
206
|
};
|
|
201
207
|
}
|
|
202
208
|
return storageValue;
|
|
@@ -215,7 +221,8 @@ function generateWrapperFromJestlikeMethods(methods) {
|
|
|
215
221
|
enableTestTracking: experimentConfig?.enableTestTracking,
|
|
216
222
|
};
|
|
217
223
|
beforeAll(async () => {
|
|
218
|
-
|
|
224
|
+
const storageValue = await runDatasetSetup(context);
|
|
225
|
+
datasetSetupInfo.set(suiteUuid, storageValue);
|
|
219
226
|
});
|
|
220
227
|
afterAll(async () => {
|
|
221
228
|
await Promise.all([
|
|
@@ -261,14 +268,14 @@ function generateWrapperFromJestlikeMethods(methods) {
|
|
|
261
268
|
// total runs is greater than 1.
|
|
262
269
|
testCounter += 1;
|
|
263
270
|
const resultsPath = path.join(os.tmpdir(), "langsmith_test_results", `${testCounter}.json`);
|
|
264
|
-
void method(`${testCounter}: ${name}${totalRuns > 1 ? `,
|
|
271
|
+
void method(`${testCounter}: ${name}${totalRuns > 1 ? `, run ${i}` : ""}`, async () => {
|
|
265
272
|
if (context === undefined) {
|
|
266
273
|
throw new Error(`Could not retrieve test context.\nPlease make sure you have tracing enabled and you are wrapping all of your test cases in an "ls.describe()" function.`);
|
|
267
274
|
}
|
|
268
275
|
if (!datasetSetupInfo.get(context.suiteUuid)) {
|
|
269
276
|
throw new Error("Dataset failed to initialize. Please check your LangSmith environment variables.");
|
|
270
277
|
}
|
|
271
|
-
const { dataset, createdAt, project, client } = datasetSetupInfo.get(context.suiteUuid);
|
|
278
|
+
const { dataset, createdAt, project, client, experimentUrl } = datasetSetupInfo.get(context.suiteUuid);
|
|
272
279
|
const testInput = inputs;
|
|
273
280
|
const testOutput = expected;
|
|
274
281
|
const testFeedback = [];
|
|
@@ -414,6 +421,7 @@ function generateWrapperFromJestlikeMethods(methods) {
|
|
|
414
421
|
expected,
|
|
415
422
|
outputs: loggedOutput,
|
|
416
423
|
feedback: testFeedback,
|
|
424
|
+
experimentUrl,
|
|
417
425
|
}));
|
|
418
426
|
}, timeout);
|
|
419
427
|
}
|
|
@@ -162,10 +162,16 @@ export function generateWrapperFromJestlikeMethods(methods) {
|
|
|
162
162
|
}
|
|
163
163
|
}
|
|
164
164
|
const project = await _createProject(testClient, dataset.id, projectConfig);
|
|
165
|
+
const datasetUrl = await testClient.getDatasetUrl({
|
|
166
|
+
datasetId: dataset.id,
|
|
167
|
+
});
|
|
168
|
+
const experimentUrl = `${datasetUrl}/compare?selectedSessions=${project.id}`;
|
|
169
|
+
console.log(`[LANGSMITH]: Experiment starting! View results at ${experimentUrl}`);
|
|
165
170
|
storageValue = {
|
|
166
171
|
dataset,
|
|
167
172
|
project,
|
|
168
173
|
client: testClient,
|
|
174
|
+
experimentUrl,
|
|
169
175
|
};
|
|
170
176
|
}
|
|
171
177
|
return storageValue;
|
|
@@ -184,7 +190,8 @@ export function generateWrapperFromJestlikeMethods(methods) {
|
|
|
184
190
|
enableTestTracking: experimentConfig?.enableTestTracking,
|
|
185
191
|
};
|
|
186
192
|
beforeAll(async () => {
|
|
187
|
-
|
|
193
|
+
const storageValue = await runDatasetSetup(context);
|
|
194
|
+
datasetSetupInfo.set(suiteUuid, storageValue);
|
|
188
195
|
});
|
|
189
196
|
afterAll(async () => {
|
|
190
197
|
await Promise.all([
|
|
@@ -230,14 +237,14 @@ export function generateWrapperFromJestlikeMethods(methods) {
|
|
|
230
237
|
// total runs is greater than 1.
|
|
231
238
|
testCounter += 1;
|
|
232
239
|
const resultsPath = path.join(os.tmpdir(), "langsmith_test_results", `${testCounter}.json`);
|
|
233
|
-
void method(`${testCounter}: ${name}${totalRuns > 1 ? `,
|
|
240
|
+
void method(`${testCounter}: ${name}${totalRuns > 1 ? `, run ${i}` : ""}`, async () => {
|
|
234
241
|
if (context === undefined) {
|
|
235
242
|
throw new Error(`Could not retrieve test context.\nPlease make sure you have tracing enabled and you are wrapping all of your test cases in an "ls.describe()" function.`);
|
|
236
243
|
}
|
|
237
244
|
if (!datasetSetupInfo.get(context.suiteUuid)) {
|
|
238
245
|
throw new Error("Dataset failed to initialize. Please check your LangSmith environment variables.");
|
|
239
246
|
}
|
|
240
|
-
const { dataset, createdAt, project, client } = datasetSetupInfo.get(context.suiteUuid);
|
|
247
|
+
const { dataset, createdAt, project, client, experimentUrl } = datasetSetupInfo.get(context.suiteUuid);
|
|
241
248
|
const testInput = inputs;
|
|
242
249
|
const testOutput = expected;
|
|
243
250
|
const testFeedback = [];
|
|
@@ -383,6 +390,7 @@ export function generateWrapperFromJestlikeMethods(methods) {
|
|
|
383
390
|
expected,
|
|
384
391
|
outputs: loggedOutput,
|
|
385
392
|
feedback: testFeedback,
|
|
393
|
+
experimentUrl,
|
|
386
394
|
}));
|
|
387
395
|
}, timeout);
|
|
388
396
|
}
|
|
@@ -89,6 +89,7 @@ function formatValue(value) {
|
|
|
89
89
|
async function printReporterTable(results, failureMessage) {
|
|
90
90
|
const rows = [];
|
|
91
91
|
const feedbackKeys = new Set();
|
|
92
|
+
let experimentUrl;
|
|
92
93
|
for (const result of results) {
|
|
93
94
|
const { title, duration, status } = result;
|
|
94
95
|
const titleComponents = title.split(":");
|
|
@@ -136,6 +137,7 @@ async function printReporterTable(results, failureMessage) {
|
|
|
136
137
|
}
|
|
137
138
|
return acc;
|
|
138
139
|
}, {});
|
|
140
|
+
experimentUrl = experimentUrl ?? fileContent.experimentUrl;
|
|
139
141
|
rows.push([
|
|
140
142
|
{
|
|
141
143
|
Name: formatTestName(testName, duration),
|
|
@@ -187,10 +189,10 @@ async function printReporterTable(results, failureMessage) {
|
|
|
187
189
|
}
|
|
188
190
|
}
|
|
189
191
|
}
|
|
190
|
-
console.log(
|
|
192
|
+
console.log();
|
|
191
193
|
const table = new console_table_printer_1.Table({
|
|
192
194
|
columns: [
|
|
193
|
-
{ name: "Name", alignment: "left" },
|
|
195
|
+
{ name: "Name", alignment: "left", maxLen: 48 },
|
|
194
196
|
{ name: "Result", alignment: "left" },
|
|
195
197
|
{ name: "Inputs", alignment: "left" },
|
|
196
198
|
{ name: "Expected", alignment: "left" },
|
|
@@ -207,5 +209,10 @@ async function printReporterTable(results, failureMessage) {
|
|
|
207
209
|
console.log(failureMessage);
|
|
208
210
|
}
|
|
209
211
|
table.printTable();
|
|
212
|
+
if (experimentUrl) {
|
|
213
|
+
console.log();
|
|
214
|
+
console.log(` [LANGSMITH]: View full results in LangSmith at ${experimentUrl}`);
|
|
215
|
+
console.log();
|
|
216
|
+
}
|
|
210
217
|
}
|
|
211
218
|
exports.printReporterTable = printReporterTable;
|
|
@@ -60,6 +60,7 @@ function formatValue(value) {
|
|
|
60
60
|
export async function printReporterTable(results, failureMessage) {
|
|
61
61
|
const rows = [];
|
|
62
62
|
const feedbackKeys = new Set();
|
|
63
|
+
let experimentUrl;
|
|
63
64
|
for (const result of results) {
|
|
64
65
|
const { title, duration, status } = result;
|
|
65
66
|
const titleComponents = title.split(":");
|
|
@@ -107,6 +108,7 @@ export async function printReporterTable(results, failureMessage) {
|
|
|
107
108
|
}
|
|
108
109
|
return acc;
|
|
109
110
|
}, {});
|
|
111
|
+
experimentUrl = experimentUrl ?? fileContent.experimentUrl;
|
|
110
112
|
rows.push([
|
|
111
113
|
{
|
|
112
114
|
Name: formatTestName(testName, duration),
|
|
@@ -158,10 +160,10 @@ export async function printReporterTable(results, failureMessage) {
|
|
|
158
160
|
}
|
|
159
161
|
}
|
|
160
162
|
}
|
|
161
|
-
console.log(
|
|
163
|
+
console.log();
|
|
162
164
|
const table = new Table({
|
|
163
165
|
columns: [
|
|
164
|
-
{ name: "Name", alignment: "left" },
|
|
166
|
+
{ name: "Name", alignment: "left", maxLen: 48 },
|
|
165
167
|
{ name: "Result", alignment: "left" },
|
|
166
168
|
{ name: "Inputs", alignment: "left" },
|
|
167
169
|
{ name: "Expected", alignment: "left" },
|
|
@@ -178,4 +180,9 @@ export async function printReporterTable(results, failureMessage) {
|
|
|
178
180
|
console.log(failureMessage);
|
|
179
181
|
}
|
|
180
182
|
table.printTable();
|
|
183
|
+
if (experimentUrl) {
|
|
184
|
+
console.log();
|
|
185
|
+
console.log(` [LANGSMITH]: View full results in LangSmith at ${experimentUrl}`);
|
|
186
|
+
console.log();
|
|
187
|
+
}
|
|
181
188
|
}
|