langsmith 0.3.56-rc.2 → 0.3.56-rc.3

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 CHANGED
@@ -10,4 +10,4 @@ Object.defineProperty(exports, "overrideFetchImplementation", { enumerable: true
10
10
  var project_js_1 = require("./utils/project.cjs");
11
11
  Object.defineProperty(exports, "getDefaultProjectName", { enumerable: true, get: function () { return project_js_1.getDefaultProjectName; } });
12
12
  // Update using yarn bump-version
13
- exports.__version__ = "0.3.56-rc.2";
13
+ exports.__version__ = "0.3.56-rc.3";
package/dist/index.d.ts CHANGED
@@ -3,4 +3,4 @@ export type { Dataset, Example, TracerSession, Run, Feedback, RetrieverOutput, }
3
3
  export { RunTree, type RunTreeConfig } from "./run_trees.js";
4
4
  export { overrideFetchImplementation } from "./singletons/fetch.js";
5
5
  export { getDefaultProjectName } from "./utils/project.js";
6
- export declare const __version__ = "0.3.56-rc.2";
6
+ export declare const __version__ = "0.3.56-rc.3";
package/dist/index.js CHANGED
@@ -3,4 +3,4 @@ export { RunTree } from "./run_trees.js";
3
3
  export { overrideFetchImplementation } from "./singletons/fetch.js";
4
4
  export { getDefaultProjectName } from "./utils/project.js";
5
5
  // Update using yarn bump-version
6
- export const __version__ = "0.3.56-rc.2";
6
+ export const __version__ = "0.3.56-rc.3";
@@ -46,22 +46,28 @@ const wrapJest = (originalJestMethods) => {
46
46
  if (typeof originalJestMethods !== "object" || originalJestMethods == null) {
47
47
  throw new Error("originalJestMethods must be an non-null object.");
48
48
  }
49
- if (!("expect" in originalJestMethods) || typeof originalJestMethods.expect !== "function") {
49
+ if (!("expect" in originalJestMethods) ||
50
+ typeof originalJestMethods.expect !== "function") {
50
51
  throw new Error("Your passed object must contain a `expect` method.");
51
52
  }
52
- if (!("it" in originalJestMethods) || typeof originalJestMethods.it !== "function") {
53
+ if (!("it" in originalJestMethods) ||
54
+ typeof originalJestMethods.it !== "function") {
53
55
  throw new Error("Your passed object must contain a `it` method.");
54
56
  }
55
- if (!("test" in originalJestMethods) || typeof originalJestMethods.test !== "function") {
57
+ if (!("test" in originalJestMethods) ||
58
+ typeof originalJestMethods.test !== "function") {
56
59
  throw new Error("Your passed object must contain a `test` method.");
57
60
  }
58
- if (!("describe" in originalJestMethods) || typeof originalJestMethods.describe !== "function") {
61
+ if (!("describe" in originalJestMethods) ||
62
+ typeof originalJestMethods.describe !== "function") {
59
63
  throw new Error("Your passed object must contain a `describe` method.");
60
64
  }
61
- if (!("beforeAll" in originalJestMethods) || typeof originalJestMethods.beforeAll !== "function") {
65
+ if (!("beforeAll" in originalJestMethods) ||
66
+ typeof originalJestMethods.beforeAll !== "function") {
62
67
  throw new Error("Your passed object must contain a `beforeAll` method.");
63
68
  }
64
- if (!("afterAll" in originalJestMethods) || typeof originalJestMethods.afterAll !== "function") {
69
+ if (!("afterAll" in originalJestMethods) ||
70
+ typeof originalJestMethods.afterAll !== "function") {
65
71
  throw new Error("Your passed object must contain a `afterAll` method.");
66
72
  }
67
73
  const wrappedMethods = (0, index_js_2.generateWrapperFromJestlikeMethods)({
@@ -75,9 +81,16 @@ const wrapJest = (originalJestMethods) => {
75
81
  logOutputs: index_js_1.logOutputs,
76
82
  wrapEvaluator: evaluatedBy_js_1.wrapEvaluator,
77
83
  }, process?.versions?.bun !== undefined ? "bun" : "jest");
84
+ // Return the normal used LS methods for convenience
85
+ // so that you can do:
86
+ //
87
+ // const ls = wrapJest(jest);
88
+ // ls.logFeedback({ key: "quality", score: 0.7 });
78
89
  return {
79
- ...originalJestMethods,
80
90
  ...wrappedMethods,
91
+ logFeedback: index_js_1.logFeedback,
92
+ logOutputs: index_js_1.logOutputs,
93
+ wrapEvaluator: evaluatedBy_js_1.wrapEvaluator,
81
94
  };
82
95
  };
83
96
  exports.wrapJest = wrapJest;
@@ -70,6 +70,9 @@ declare global {
70
70
  * for more details.
71
71
  */
72
72
  declare const wrapJest: (originalJestMethods: Record<string, unknown>) => {
73
+ logFeedback: typeof logFeedback;
74
+ logOutputs: typeof logOutputs;
75
+ wrapEvaluator: typeof wrapEvaluator;
73
76
  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: {
74
77
  inputs: I;
75
78
  referenceOutputs?: O;
@@ -26,22 +26,28 @@ const wrapJest = (originalJestMethods) => {
26
26
  if (typeof originalJestMethods !== "object" || originalJestMethods == null) {
27
27
  throw new Error("originalJestMethods must be an non-null object.");
28
28
  }
29
- if (!("expect" in originalJestMethods) || typeof originalJestMethods.expect !== "function") {
29
+ if (!("expect" in originalJestMethods) ||
30
+ typeof originalJestMethods.expect !== "function") {
30
31
  throw new Error("Your passed object must contain a `expect` method.");
31
32
  }
32
- if (!("it" in originalJestMethods) || typeof originalJestMethods.it !== "function") {
33
+ if (!("it" in originalJestMethods) ||
34
+ typeof originalJestMethods.it !== "function") {
33
35
  throw new Error("Your passed object must contain a `it` method.");
34
36
  }
35
- if (!("test" in originalJestMethods) || typeof originalJestMethods.test !== "function") {
37
+ if (!("test" in originalJestMethods) ||
38
+ typeof originalJestMethods.test !== "function") {
36
39
  throw new Error("Your passed object must contain a `test` method.");
37
40
  }
38
- if (!("describe" in originalJestMethods) || typeof originalJestMethods.describe !== "function") {
41
+ if (!("describe" in originalJestMethods) ||
42
+ typeof originalJestMethods.describe !== "function") {
39
43
  throw new Error("Your passed object must contain a `describe` method.");
40
44
  }
41
- if (!("beforeAll" in originalJestMethods) || typeof originalJestMethods.beforeAll !== "function") {
45
+ if (!("beforeAll" in originalJestMethods) ||
46
+ typeof originalJestMethods.beforeAll !== "function") {
42
47
  throw new Error("Your passed object must contain a `beforeAll` method.");
43
48
  }
44
- if (!("afterAll" in originalJestMethods) || typeof originalJestMethods.afterAll !== "function") {
49
+ if (!("afterAll" in originalJestMethods) ||
50
+ typeof originalJestMethods.afterAll !== "function") {
45
51
  throw new Error("Your passed object must contain a `afterAll` method.");
46
52
  }
47
53
  const wrappedMethods = generateWrapperFromJestlikeMethods({
@@ -55,9 +61,16 @@ const wrapJest = (originalJestMethods) => {
55
61
  logOutputs,
56
62
  wrapEvaluator,
57
63
  }, process?.versions?.bun !== undefined ? "bun" : "jest");
64
+ // Return the normal used LS methods for convenience
65
+ // so that you can do:
66
+ //
67
+ // const ls = wrapJest(jest);
68
+ // ls.logFeedback({ key: "quality", score: 0.7 });
58
69
  return {
59
- ...originalJestMethods,
60
70
  ...wrappedMethods,
71
+ logFeedback,
72
+ logOutputs,
73
+ wrapEvaluator,
61
74
  };
62
75
  };
63
76
  const { test, it, describe, expect } = wrapJest({
@@ -43,25 +43,32 @@ vitest_1.expect.extend({
43
43
  * for more details.
44
44
  */
45
45
  const wrapVitest = (originalVitestMethods) => {
46
- if (typeof originalVitestMethods !== "object" || originalVitestMethods == null) {
46
+ if (typeof originalVitestMethods !== "object" ||
47
+ originalVitestMethods == null) {
47
48
  throw new Error("originalVitestMethods must be an non-null object.");
48
49
  }
49
- if (!("expect" in originalVitestMethods) || typeof originalVitestMethods.expect !== "function") {
50
+ if (!("expect" in originalVitestMethods) ||
51
+ typeof originalVitestMethods.expect !== "function") {
50
52
  throw new Error("Your passed object must contain a `expect` method.");
51
53
  }
52
- if (!("it" in originalVitestMethods) || typeof originalVitestMethods.it !== "function") {
54
+ if (!("it" in originalVitestMethods) ||
55
+ typeof originalVitestMethods.it !== "function") {
53
56
  throw new Error("Your passed object must contain a `it` method.");
54
57
  }
55
- if (!("test" in originalVitestMethods) || typeof originalVitestMethods.test !== "function") {
58
+ if (!("test" in originalVitestMethods) ||
59
+ typeof originalVitestMethods.test !== "function") {
56
60
  throw new Error("Your passed object must contain a `test` method.");
57
61
  }
58
- if (!("describe" in originalVitestMethods) || typeof originalVitestMethods.describe !== "function") {
62
+ if (!("describe" in originalVitestMethods) ||
63
+ typeof originalVitestMethods.describe !== "function") {
59
64
  throw new Error("Your passed object must contain a `describe` method.");
60
65
  }
61
- if (!("beforeAll" in originalVitestMethods) || typeof originalVitestMethods.beforeAll !== "function") {
66
+ if (!("beforeAll" in originalVitestMethods) ||
67
+ typeof originalVitestMethods.beforeAll !== "function") {
62
68
  throw new Error("Your passed object must contain a `beforeAll` method.");
63
69
  }
64
- if (!("afterAll" in originalVitestMethods) || typeof originalVitestMethods.afterAll !== "function") {
70
+ if (!("afterAll" in originalVitestMethods) ||
71
+ typeof originalVitestMethods.afterAll !== "function") {
65
72
  throw new Error("Your passed object must contain a `afterAll` method.");
66
73
  }
67
74
  const wrappedMethods = (0, index_js_2.generateWrapperFromJestlikeMethods)({
@@ -71,11 +78,18 @@ const wrapVitest = (originalVitestMethods) => {
71
78
  describe: originalVitestMethods.describe,
72
79
  beforeAll: originalVitestMethods.beforeAll,
73
80
  afterAll: originalVitestMethods.afterAll,
81
+ }, "vitest");
82
+ // Return the normal used LS methods for convenience
83
+ // so that you can do:
84
+ //
85
+ // const ls = wrapVitest(vitest);
86
+ // ls.logFeedback({ key: "quality", score: 0.7 });
87
+ return {
88
+ ...wrappedMethods,
74
89
  logFeedback: index_js_1.logFeedback,
75
90
  logOutputs: index_js_1.logOutputs,
76
91
  wrapEvaluator: evaluatedBy_js_1.wrapEvaluator,
77
- }, "vitest");
78
- return wrappedMethods;
92
+ };
79
93
  };
80
94
  exports.wrapVitest = wrapVitest;
81
95
  const { test, it, describe, expect } = wrapVitest({
@@ -68,6 +68,9 @@ declare module "vitest" {
68
68
  * for more details.
69
69
  */
70
70
  declare const wrapVitest: (originalVitestMethods: Record<string, unknown>) => {
71
+ logFeedback: typeof logFeedback;
72
+ logOutputs: typeof logOutputs;
73
+ wrapEvaluator: typeof wrapEvaluator;
71
74
  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: {
72
75
  inputs: I;
73
76
  referenceOutputs?: O;
@@ -23,25 +23,32 @@ vitestExpect.extend({
23
23
  * for more details.
24
24
  */
25
25
  const wrapVitest = (originalVitestMethods) => {
26
- if (typeof originalVitestMethods !== "object" || originalVitestMethods == null) {
26
+ if (typeof originalVitestMethods !== "object" ||
27
+ originalVitestMethods == null) {
27
28
  throw new Error("originalVitestMethods must be an non-null object.");
28
29
  }
29
- if (!("expect" in originalVitestMethods) || typeof originalVitestMethods.expect !== "function") {
30
+ if (!("expect" in originalVitestMethods) ||
31
+ typeof originalVitestMethods.expect !== "function") {
30
32
  throw new Error("Your passed object must contain a `expect` method.");
31
33
  }
32
- if (!("it" in originalVitestMethods) || typeof originalVitestMethods.it !== "function") {
34
+ if (!("it" in originalVitestMethods) ||
35
+ typeof originalVitestMethods.it !== "function") {
33
36
  throw new Error("Your passed object must contain a `it` method.");
34
37
  }
35
- if (!("test" in originalVitestMethods) || typeof originalVitestMethods.test !== "function") {
38
+ if (!("test" in originalVitestMethods) ||
39
+ typeof originalVitestMethods.test !== "function") {
36
40
  throw new Error("Your passed object must contain a `test` method.");
37
41
  }
38
- if (!("describe" in originalVitestMethods) || typeof originalVitestMethods.describe !== "function") {
42
+ if (!("describe" in originalVitestMethods) ||
43
+ typeof originalVitestMethods.describe !== "function") {
39
44
  throw new Error("Your passed object must contain a `describe` method.");
40
45
  }
41
- if (!("beforeAll" in originalVitestMethods) || typeof originalVitestMethods.beforeAll !== "function") {
46
+ if (!("beforeAll" in originalVitestMethods) ||
47
+ typeof originalVitestMethods.beforeAll !== "function") {
42
48
  throw new Error("Your passed object must contain a `beforeAll` method.");
43
49
  }
44
- if (!("afterAll" in originalVitestMethods) || typeof originalVitestMethods.afterAll !== "function") {
50
+ if (!("afterAll" in originalVitestMethods) ||
51
+ typeof originalVitestMethods.afterAll !== "function") {
45
52
  throw new Error("Your passed object must contain a `afterAll` method.");
46
53
  }
47
54
  const wrappedMethods = generateWrapperFromJestlikeMethods({
@@ -51,11 +58,18 @@ const wrapVitest = (originalVitestMethods) => {
51
58
  describe: originalVitestMethods.describe,
52
59
  beforeAll: originalVitestMethods.beforeAll,
53
60
  afterAll: originalVitestMethods.afterAll,
61
+ }, "vitest");
62
+ // Return the normal used LS methods for convenience
63
+ // so that you can do:
64
+ //
65
+ // const ls = wrapVitest(vitest);
66
+ // ls.logFeedback({ key: "quality", score: 0.7 });
67
+ return {
68
+ ...wrappedMethods,
54
69
  logFeedback,
55
70
  logOutputs,
56
71
  wrapEvaluator,
57
- }, "vitest");
58
- return wrappedMethods;
72
+ };
59
73
  };
60
74
  const { test, it, describe, expect } = wrapVitest({
61
75
  expect: vitestExpect,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "langsmith",
3
- "version": "0.3.56-rc.2",
3
+ "version": "0.3.56-rc.3",
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": [