langsmith 0.3.4-rc.0 → 0.3.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/client.cjs CHANGED
@@ -371,6 +371,10 @@ class Client {
371
371
  this.webUrl = "http://localhost:3000";
372
372
  return this.webUrl;
373
373
  }
374
+ else if (this.apiUrl.endsWith("/api/v1")) {
375
+ this.webUrl = this.apiUrl.replace("/api/v1", "");
376
+ return this.webUrl;
377
+ }
374
378
  else if (this.apiUrl.includes("/api") &&
375
379
  !this.apiUrl.split(".", 1)[0].endsWith("api")) {
376
380
  this.webUrl = this.apiUrl.replace("/api", "");
@@ -384,6 +388,10 @@ class Client {
384
388
  this.webUrl = "https://eu.smith.langchain.com";
385
389
  return this.webUrl;
386
390
  }
391
+ else if (this.apiUrl.split(".", 1)[0].includes("beta")) {
392
+ this.webUrl = "https://beta.smith.langchain.com";
393
+ return this.webUrl;
394
+ }
387
395
  else {
388
396
  this.webUrl = "https://smith.langchain.com";
389
397
  return this.webUrl;
@@ -907,7 +915,7 @@ class Client {
907
915
  const body = new Blob(chunks);
908
916
  // Convert Blob to ArrayBuffer for compatibility
909
917
  const arrayBuffer = await body.arrayBuffer();
910
- const res = await this.batchIngestCaller.call((0, fetch_js_1._getFetchImplementation)(), `${this.apiUrl}/v1/runs/multipart`, {
918
+ const res = await this.batchIngestCaller.call((0, fetch_js_1._getFetchImplementation)(), `${this.apiUrl}/runs/multipart`, {
911
919
  method: "POST",
912
920
  headers: {
913
921
  ...this.headers,
package/dist/client.js CHANGED
@@ -343,6 +343,10 @@ export class Client {
343
343
  this.webUrl = "http://localhost:3000";
344
344
  return this.webUrl;
345
345
  }
346
+ else if (this.apiUrl.endsWith("/api/v1")) {
347
+ this.webUrl = this.apiUrl.replace("/api/v1", "");
348
+ return this.webUrl;
349
+ }
346
350
  else if (this.apiUrl.includes("/api") &&
347
351
  !this.apiUrl.split(".", 1)[0].endsWith("api")) {
348
352
  this.webUrl = this.apiUrl.replace("/api", "");
@@ -356,6 +360,10 @@ export class Client {
356
360
  this.webUrl = "https://eu.smith.langchain.com";
357
361
  return this.webUrl;
358
362
  }
363
+ else if (this.apiUrl.split(".", 1)[0].includes("beta")) {
364
+ this.webUrl = "https://beta.smith.langchain.com";
365
+ return this.webUrl;
366
+ }
359
367
  else {
360
368
  this.webUrl = "https://smith.langchain.com";
361
369
  return this.webUrl;
@@ -879,7 +887,7 @@ export class Client {
879
887
  const body = new Blob(chunks);
880
888
  // Convert Blob to ArrayBuffer for compatibility
881
889
  const arrayBuffer = await body.arrayBuffer();
882
- const res = await this.batchIngestCaller.call(_getFetchImplementation(), `${this.apiUrl}/v1/runs/multipart`, {
890
+ const res = await this.batchIngestCaller.call(_getFetchImplementation(), `${this.apiUrl}/runs/multipart`, {
883
891
  method: "POST",
884
892
  headers: {
885
893
  ...this.headers,
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.4-rc.0";
11
+ exports.__version__ = "0.3.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.3.4-rc.0";
5
+ export declare const __version__ = "0.3.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.3.4-rc.0";
5
+ export const __version__ = "0.3.4";
@@ -5,6 +5,9 @@ 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
+ if (testResult.failureMessage) {
9
+ console.log(testResult.failureMessage);
10
+ }
8
11
  const groupedTestResults = testResult.testResults.reduce((groups, testResult) => {
9
12
  const ancestorTitle = testResult.ancestorTitles.join(" > ");
10
13
  if (groups[ancestorTitle] === undefined) {
@@ -16,7 +19,13 @@ class LangSmithEvalReporter extends reporters_1.DefaultReporter {
16
19
  try {
17
20
  for (const testGroupName of Object.keys(groupedTestResults)) {
18
21
  const resultGroup = groupedTestResults[testGroupName];
19
- await (0, reporter_js_1.printReporterTable)(resultGroup, testResult.failureMessage);
22
+ const unskippedTests = resultGroup.filter((result) => result.status !== "pending");
23
+ const overallResult = unskippedTests.length === 0
24
+ ? "skip"
25
+ : unskippedTests.every((result) => result.status === "passed")
26
+ ? "pass"
27
+ : "fail";
28
+ await (0, reporter_js_1.printReporterTable)(testGroupName, resultGroup, overallResult);
20
29
  }
21
30
  }
22
31
  catch (e) {
@@ -3,6 +3,9 @@ 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
+ if (testResult.failureMessage) {
7
+ console.log(testResult.failureMessage);
8
+ }
6
9
  const groupedTestResults = testResult.testResults.reduce((groups, testResult) => {
7
10
  const ancestorTitle = testResult.ancestorTitles.join(" > ");
8
11
  if (groups[ancestorTitle] === undefined) {
@@ -14,7 +17,13 @@ class LangSmithEvalReporter extends DefaultReporter {
14
17
  try {
15
18
  for (const testGroupName of Object.keys(groupedTestResults)) {
16
19
  const resultGroup = groupedTestResults[testGroupName];
17
- await printReporterTable(resultGroup, testResult.failureMessage);
20
+ const unskippedTests = resultGroup.filter((result) => result.status !== "pending");
21
+ const overallResult = unskippedTests.length === 0
22
+ ? "skip"
23
+ : unskippedTests.every((result) => result.status === "passed")
24
+ ? "pass"
25
+ : "fail";
26
+ await printReporterTable(testGroupName, resultGroup, overallResult);
18
27
  }
19
28
  }
20
29
  catch (e) {
@@ -53,13 +53,13 @@ function formatTestName(name, duration) {
53
53
  }
54
54
  function getFormattedStatus(status) {
55
55
  const s = status.toLowerCase();
56
- if (s === "pending") {
56
+ if (s === "pending" || s === "skipped") {
57
57
  return chalk_1.default.yellow("○ Skipped");
58
58
  }
59
- else if (s === "passed") {
59
+ else if (s.includes("pass")) {
60
60
  return chalk_1.default.green("✓ Passed");
61
61
  }
62
- else if (s === "failed") {
62
+ else if (s.includes("fail")) {
63
63
  return chalk_1.default.red("✕ Failed");
64
64
  }
65
65
  else {
@@ -68,13 +68,13 @@ function getFormattedStatus(status) {
68
68
  }
69
69
  function getColorParam(status) {
70
70
  const s = status.toLowerCase();
71
- if (s === "pending") {
71
+ if (s === "pending" || s === "skipped") {
72
72
  return { color: "yellow" };
73
73
  }
74
- else if (s === "passed") {
74
+ else if (s.includes("pass")) {
75
75
  return { color: "grey" };
76
76
  }
77
- else if (s === "failed") {
77
+ else if (s.includes("fail")) {
78
78
  return { color: "red" };
79
79
  }
80
80
  else {
@@ -99,7 +99,7 @@ function formatValue(value) {
99
99
  }
100
100
  return String(value);
101
101
  }
102
- async function printReporterTable(results, failureMessage) {
102
+ async function printReporterTable(testSuiteName, results, testStatus, failureMessage) {
103
103
  const rows = [];
104
104
  const feedbackKeys = new Set();
105
105
  let experimentUrl;
@@ -122,7 +122,7 @@ async function printReporterTable(results, failureMessage) {
122
122
  getColorParam(status),
123
123
  ]);
124
124
  }
125
- else if (status === "pending") {
125
+ else if (status === "pending" || status === "skipped") {
126
126
  // Skipped
127
127
  rows.push([
128
128
  {
@@ -265,6 +265,14 @@ async function printReporterTable(results, failureMessage) {
265
265
  for (const row of rows) {
266
266
  table.addRow(row[0], row[1]);
267
267
  }
268
+ const testStatusColor = testStatus.includes("pass")
269
+ ? chalk_1.default.green
270
+ : testStatus.includes("fail")
271
+ ? chalk_1.default.red
272
+ : chalk_1.default.yellow;
273
+ if (testSuiteName) {
274
+ console.log(testStatusColor(`› ${testSuiteName}`));
275
+ }
268
276
  if (failureMessage) {
269
277
  console.log(failureMessage);
270
278
  }
@@ -1,5 +1,5 @@
1
- export declare function printReporterTable(results: {
1
+ export declare function printReporterTable(testSuiteName: string, results: {
2
2
  title: string;
3
3
  duration: number;
4
- status: string;
5
- }[], failureMessage?: string): Promise<void>;
4
+ status: "pass" | "passed" | "fail" | "failed" | "pending" | "skipped";
5
+ }[], testStatus: "pass" | "skip" | "fail", failureMessage?: string): Promise<void>;
@@ -24,13 +24,13 @@ function formatTestName(name, duration) {
24
24
  }
25
25
  function getFormattedStatus(status) {
26
26
  const s = status.toLowerCase();
27
- if (s === "pending") {
27
+ if (s === "pending" || s === "skipped") {
28
28
  return chalk.yellow("○ Skipped");
29
29
  }
30
- else if (s === "passed") {
30
+ else if (s.includes("pass")) {
31
31
  return chalk.green("✓ Passed");
32
32
  }
33
- else if (s === "failed") {
33
+ else if (s.includes("fail")) {
34
34
  return chalk.red("✕ Failed");
35
35
  }
36
36
  else {
@@ -39,13 +39,13 @@ function getFormattedStatus(status) {
39
39
  }
40
40
  function getColorParam(status) {
41
41
  const s = status.toLowerCase();
42
- if (s === "pending") {
42
+ if (s === "pending" || s === "skipped") {
43
43
  return { color: "yellow" };
44
44
  }
45
- else if (s === "passed") {
45
+ else if (s.includes("pass")) {
46
46
  return { color: "grey" };
47
47
  }
48
- else if (s === "failed") {
48
+ else if (s.includes("fail")) {
49
49
  return { color: "red" };
50
50
  }
51
51
  else {
@@ -70,7 +70,7 @@ function formatValue(value) {
70
70
  }
71
71
  return String(value);
72
72
  }
73
- export async function printReporterTable(results, failureMessage) {
73
+ export async function printReporterTable(testSuiteName, results, testStatus, failureMessage) {
74
74
  const rows = [];
75
75
  const feedbackKeys = new Set();
76
76
  let experimentUrl;
@@ -93,7 +93,7 @@ export async function printReporterTable(results, failureMessage) {
93
93
  getColorParam(status),
94
94
  ]);
95
95
  }
96
- else if (status === "pending") {
96
+ else if (status === "pending" || status === "skipped") {
97
97
  // Skipped
98
98
  rows.push([
99
99
  {
@@ -236,6 +236,14 @@ export async function printReporterTable(results, failureMessage) {
236
236
  for (const row of rows) {
237
237
  table.addRow(row[0], row[1]);
238
238
  }
239
+ const testStatusColor = testStatus.includes("pass")
240
+ ? chalk.green
241
+ : testStatus.includes("fail")
242
+ ? chalk.red
243
+ : chalk.yellow;
244
+ if (testSuiteName) {
245
+ console.log(testStatusColor(`› ${testSuiteName}`));
246
+ }
239
247
  if (failureMessage) {
240
248
  console.log(failureMessage);
241
249
  }
@@ -9,15 +9,20 @@ class LangSmithEvalReporter extends reporters_1.DefaultReporter {
9
9
  async onFinished(files, errors) {
10
10
  super.onFinished(files, errors);
11
11
  for (const file of files) {
12
- const testModule = this.ctx.state.getReportedEntity(file);
13
- const tests = [...testModule.children.allTests()].map((test) => {
14
- return {
15
- title: test.name,
16
- status: test.result()?.state ?? "skipped",
17
- duration: Math.round(test.diagnostic()?.duration ?? 0),
18
- };
19
- });
20
- await (0, reporter_js_1.printReporterTable)(tests);
12
+ for (const task of file.tasks) {
13
+ const testModule = this.ctx.state.getReportedEntity(task);
14
+ const tests = [...testModule.children.allTests()].map((test) => {
15
+ return {
16
+ title: test.name,
17
+ status: test.result()?.state ?? "skipped",
18
+ duration: Math.round(test.diagnostic()?.duration ?? 0),
19
+ };
20
+ });
21
+ const result = ["pass", "fail", "skip"].includes(task.result?.state ?? "")
22
+ ? task.result?.state
23
+ : "skip";
24
+ await (0, reporter_js_1.printReporterTable)(task.name, tests, result);
25
+ }
21
26
  }
22
27
  }
23
28
  }
@@ -7,15 +7,20 @@ class LangSmithEvalReporter extends DefaultReporter {
7
7
  async onFinished(files, errors) {
8
8
  super.onFinished(files, errors);
9
9
  for (const file of files) {
10
- const testModule = this.ctx.state.getReportedEntity(file);
11
- const tests = [...testModule.children.allTests()].map((test) => {
12
- return {
13
- title: test.name,
14
- status: test.result()?.state ?? "skipped",
15
- duration: Math.round(test.diagnostic()?.duration ?? 0),
16
- };
17
- });
18
- await printReporterTable(tests);
10
+ for (const task of file.tasks) {
11
+ const testModule = this.ctx.state.getReportedEntity(task);
12
+ const tests = [...testModule.children.allTests()].map((test) => {
13
+ return {
14
+ title: test.name,
15
+ status: test.result()?.state ?? "skipped",
16
+ duration: Math.round(test.diagnostic()?.duration ?? 0),
17
+ };
18
+ });
19
+ const result = ["pass", "fail", "skip"].includes(task.result?.state ?? "")
20
+ ? task.result?.state
21
+ : "skip";
22
+ await printReporterTable(task.name, tests, result);
23
+ }
19
24
  }
20
25
  }
21
26
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "langsmith",
3
- "version": "0.3.4-rc.0",
3
+ "version": "0.3.4",
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": [