langsmith 0.3.14 → 0.3.15

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.
Files changed (42) hide show
  1. package/dist/anonymizer/index.cjs +1 -2
  2. package/dist/client.cjs +19 -9
  3. package/dist/evaluation/_random_name.cjs +1 -2
  4. package/dist/evaluation/_runner.cjs +2 -2
  5. package/dist/evaluation/evaluate_comparative.cjs +1 -2
  6. package/dist/evaluation/evaluator.cjs +2 -2
  7. package/dist/evaluation/langchain.cjs +1 -2
  8. package/dist/index.cjs +1 -1
  9. package/dist/index.d.ts +1 -1
  10. package/dist/index.js +1 -1
  11. package/dist/jest/index.d.ts +45 -46
  12. package/dist/langchain.cjs +2 -2
  13. package/dist/run_trees.cjs +21 -11
  14. package/dist/singletons/traceable.cjs +3 -3
  15. package/dist/traceable.cjs +2 -3
  16. package/dist/traceable.js +0 -1
  17. package/dist/utils/_uuid.cjs +18 -9
  18. package/dist/utils/asserts.cjs +3 -3
  19. package/dist/utils/asserts.d.ts +3 -3
  20. package/dist/utils/atee.cjs +1 -2
  21. package/dist/utils/env.cjs +9 -9
  22. package/dist/utils/error.cjs +3 -3
  23. package/dist/utils/fast-safe-stringify/index.cjs +1 -2
  24. package/dist/utils/fast-safe-stringify/index.d.ts +1 -1
  25. package/dist/utils/jestlike/globals.cjs +3 -3
  26. package/dist/utils/jestlike/globals.d.ts +0 -1
  27. package/dist/utils/jestlike/index.cjs +23 -13
  28. package/dist/utils/jestlike/index.d.ts +30 -31
  29. package/dist/utils/jestlike/matchers.cjs +3 -4
  30. package/dist/utils/jestlike/reporter.cjs +18 -9
  31. package/dist/utils/jestlike/vendor/chain.cjs +1 -2
  32. package/dist/utils/jestlike/vendor/chain.d.ts +0 -1
  33. package/dist/utils/jestlike/vendor/evaluatedBy.cjs +2 -3
  34. package/dist/utils/messages.cjs +2 -3
  35. package/dist/utils/prompts.cjs +2 -3
  36. package/dist/utils/shuffle.cjs +1 -2
  37. package/dist/utils/warn.cjs +1 -2
  38. package/dist/vercel.cjs +17 -0
  39. package/dist/vercel.d.ts +4 -4
  40. package/dist/vercel.js +17 -0
  41. package/dist/vitest/index.d.ts +45 -46
  42. package/package.json +1 -1
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports._logTestFeedback = exports.syncExamplePromises = exports.evaluatorLogFeedbackPromises = exports.trackingEnabled = exports.testWrapperAsyncLocalStorageInstance = exports.DEFAULT_TEST_CLIENT = void 0;
3
+ exports.syncExamplePromises = exports.evaluatorLogFeedbackPromises = exports.testWrapperAsyncLocalStorageInstance = exports.DEFAULT_TEST_CLIENT = void 0;
4
+ exports.trackingEnabled = trackingEnabled;
5
+ exports._logTestFeedback = _logTestFeedback;
4
6
  const node_async_hooks_1 = require("node:async_hooks");
5
7
  const client_js_1 = require("../../client.cjs");
6
8
  const env_js_1 = require("../env.cjs");
@@ -16,7 +18,6 @@ function trackingEnabled(context) {
16
18
  }
17
19
  return (0, env_js_2.isTracingEnabled)();
18
20
  }
19
- exports.trackingEnabled = trackingEnabled;
20
21
  exports.evaluatorLogFeedbackPromises = new Set();
21
22
  exports.syncExamplePromises = new Map();
22
23
  function _logTestFeedback(params) {
@@ -37,4 +38,3 @@ function _logTestFeedback(params) {
37
38
  }
38
39
  context.onFeedbackLogged?.(feedback);
39
40
  }
40
- exports._logTestFeedback = _logTestFeedback;
@@ -1,4 +1,3 @@
1
- /// <reference types="node" resolution-mode="require"/>
2
1
  import { AsyncLocalStorage } from "node:async_hooks";
3
2
  import { Dataset, TracerSession, Example } from "../../schemas.js";
4
3
  import { Client, CreateProjectParams } from "../../client.js";
@@ -17,13 +17,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
17
17
  }) : function(o, v) {
18
18
  o["default"] = v;
19
19
  });
20
- var __importStar = (this && this.__importStar) || function (mod) {
21
- if (mod && mod.__esModule) return mod;
22
- var result = {};
23
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
24
- __setModuleDefault(result, mod);
25
- return result;
26
- };
20
+ var __importStar = (this && this.__importStar) || (function () {
21
+ var ownKeys = function(o) {
22
+ ownKeys = Object.getOwnPropertyNames || function (o) {
23
+ var ar = [];
24
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
25
+ return ar;
26
+ };
27
+ return ownKeys(o);
28
+ };
29
+ return function (mod) {
30
+ if (mod && mod.__esModule) return mod;
31
+ var result = {};
32
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
33
+ __setModuleDefault(result, mod);
34
+ return result;
35
+ };
36
+ })();
27
37
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
28
38
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
29
39
  };
@@ -31,7 +41,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
31
41
  return (mod && mod.__esModule) ? mod : { "default": mod };
32
42
  };
33
43
  Object.defineProperty(exports, "__esModule", { value: true });
34
- exports.wrapEvaluator = exports.isInTestContext = exports.generateWrapperFromJestlikeMethods = exports._objectHash = exports.logOutputs = exports.logFeedback = void 0;
44
+ exports.wrapEvaluator = void 0;
45
+ exports.logFeedback = logFeedback;
46
+ exports.logOutputs = logOutputs;
47
+ exports._objectHash = _objectHash;
48
+ exports.generateWrapperFromJestlikeMethods = generateWrapperFromJestlikeMethods;
49
+ exports.isInTestContext = isInTestContext;
35
50
  const crypto_1 = __importDefault(require("crypto"));
36
51
  const uuid_1 = require("uuid");
37
52
  const os = __importStar(require("node:os"));
@@ -68,7 +83,6 @@ function logFeedback(feedback, config) {
68
83
  client: context.client,
69
84
  });
70
85
  }
71
- exports.logFeedback = logFeedback;
72
86
  function logOutputs(output) {
73
87
  const context = globals_js_1.testWrapperAsyncLocalStorageInstance.getStore();
74
88
  if (context === undefined) {
@@ -83,7 +97,6 @@ function logOutputs(output) {
83
97
  }
84
98
  context.setLoggedOutput(output);
85
99
  }
86
- exports.logOutputs = logOutputs;
87
100
  function _objectHash(obj, depth = 0) {
88
101
  // Prevent infinite recursion
89
102
  if (depth > 50) {
@@ -106,7 +119,6 @@ function _objectHash(obj, depth = 0) {
106
119
  .update(JSON.stringify(obj ?? null))
107
120
  .digest("hex"));
108
121
  }
109
- exports._objectHash = _objectHash;
110
122
  function generateWrapperFromJestlikeMethods(methods, testRunnerName) {
111
123
  const { expect, test, describe, beforeAll, afterAll } = methods;
112
124
  async function _createProject(client, datasetId, projectConfig) {
@@ -580,12 +592,10 @@ function generateWrapperFromJestlikeMethods(methods, testRunnerName) {
580
592
  toBeSemanticCloseTo: matchers_js_1.toBeSemanticCloseTo,
581
593
  };
582
594
  }
583
- exports.generateWrapperFromJestlikeMethods = generateWrapperFromJestlikeMethods;
584
595
  function isInTestContext() {
585
596
  const context = globals_js_1.testWrapperAsyncLocalStorageInstance.getStore();
586
597
  return context !== undefined;
587
598
  }
588
- exports.isInTestContext = isInTestContext;
589
599
  var evaluatedBy_js_1 = require("./vendor/evaluatedBy.cjs");
590
600
  Object.defineProperty(exports, "wrapEvaluator", { enumerable: true, get: function () { return evaluatedBy_js_1.wrapEvaluator; } });
591
601
  __exportStar(require("./types.cjs"), exports);
@@ -1,4 +1,3 @@
1
- /// <reference types="jest" />
2
1
  import { KVMap } from "../../schemas.js";
3
2
  import { toBeRelativeCloseTo, toBeAbsoluteCloseTo, toBeSemanticCloseTo } from "./matchers.js";
4
3
  import { SimpleEvaluationResult } from "./types.js";
@@ -17,32 +16,32 @@ export declare function generateWrapperFromJestlikeMethods(methods: Record<strin
17
16
  inputs: I;
18
17
  referenceOutputs?: O;
19
18
  } & Record<string, any>) => unknown | Promise<unknown>, timeout?: number) => void) & {
20
- each: <I_1 extends KVMap, O_1 extends KVMap>(table: ({
21
- inputs: I_1;
22
- referenceOutputs?: O_1 | undefined;
19
+ each: <I extends KVMap, O extends KVMap>(table: ({
20
+ inputs: I;
21
+ referenceOutputs?: O;
23
22
  } & Record<string, any>)[], config?: LangSmithJestlikeWrapperConfig) => (name: string, fn: (params: {
24
- inputs: I_1;
25
- referenceOutputs?: O_1 | undefined;
23
+ inputs: I;
24
+ referenceOutputs?: O;
26
25
  } & Record<string, any>) => unknown | Promise<unknown>, timeout?: number) => void;
27
26
  };
28
27
  skip: (<I extends Record<string, any> = Record<string, any>, O extends Record<string, any> = Record<string, any>>(name: string, lsParams: LangSmithJestlikeWrapperParams<I, O>, testFn: (data: {
29
28
  inputs: I;
30
29
  referenceOutputs?: O;
31
30
  } & Record<string, any>) => unknown | Promise<unknown>, timeout?: number) => void) & {
32
- each: <I_1 extends KVMap, O_1 extends KVMap>(table: ({
33
- inputs: I_1;
34
- referenceOutputs?: O_1 | undefined;
31
+ each: <I extends KVMap, O extends KVMap>(table: ({
32
+ inputs: I;
33
+ referenceOutputs?: O;
35
34
  } & Record<string, any>)[], config?: LangSmithJestlikeWrapperConfig) => (name: string, fn: (params: {
36
- inputs: I_1;
37
- referenceOutputs?: O_1 | undefined;
35
+ inputs: I;
36
+ referenceOutputs?: O;
38
37
  } & Record<string, any>) => unknown | Promise<unknown>, timeout?: number) => void;
39
38
  };
40
- each: <I_1 extends KVMap, O_1 extends KVMap>(table: ({
41
- inputs: I_1;
42
- referenceOutputs?: O_1 | undefined;
39
+ each: <I extends KVMap, O extends KVMap>(table: ({
40
+ inputs: I;
41
+ referenceOutputs?: O;
43
42
  } & Record<string, any>)[], config?: LangSmithJestlikeWrapperConfig) => (name: string, fn: (params: {
44
- inputs: I_1;
45
- referenceOutputs?: O_1 | undefined;
43
+ inputs: I;
44
+ referenceOutputs?: O;
46
45
  } & Record<string, any>) => unknown | Promise<unknown>, timeout?: number) => void;
47
46
  };
48
47
  it: (<I extends Record<string, any> = Record<string, any>, O extends Record<string, any> = Record<string, any>>(name: string, lsParams: LangSmithJestlikeWrapperParams<I, O>, testFn: (data: {
@@ -53,32 +52,32 @@ export declare function generateWrapperFromJestlikeMethods(methods: Record<strin
53
52
  inputs: I;
54
53
  referenceOutputs?: O;
55
54
  } & Record<string, any>) => unknown | Promise<unknown>, timeout?: number) => void) & {
56
- each: <I_1 extends KVMap, O_1 extends KVMap>(table: ({
57
- inputs: I_1;
58
- referenceOutputs?: O_1 | undefined;
55
+ each: <I extends KVMap, O extends KVMap>(table: ({
56
+ inputs: I;
57
+ referenceOutputs?: O;
59
58
  } & Record<string, any>)[], config?: LangSmithJestlikeWrapperConfig) => (name: string, fn: (params: {
60
- inputs: I_1;
61
- referenceOutputs?: O_1 | undefined;
59
+ inputs: I;
60
+ referenceOutputs?: O;
62
61
  } & Record<string, any>) => unknown | Promise<unknown>, timeout?: number) => void;
63
62
  };
64
63
  skip: (<I extends Record<string, any> = Record<string, any>, O extends Record<string, any> = Record<string, any>>(name: string, lsParams: LangSmithJestlikeWrapperParams<I, O>, testFn: (data: {
65
64
  inputs: I;
66
65
  referenceOutputs?: O;
67
66
  } & Record<string, any>) => unknown | Promise<unknown>, timeout?: number) => void) & {
68
- each: <I_1 extends KVMap, O_1 extends KVMap>(table: ({
69
- inputs: I_1;
70
- referenceOutputs?: O_1 | undefined;
67
+ each: <I extends KVMap, O extends KVMap>(table: ({
68
+ inputs: I;
69
+ referenceOutputs?: O;
71
70
  } & Record<string, any>)[], config?: LangSmithJestlikeWrapperConfig) => (name: string, fn: (params: {
72
- inputs: I_1;
73
- referenceOutputs?: O_1 | undefined;
71
+ inputs: I;
72
+ referenceOutputs?: O;
74
73
  } & Record<string, any>) => unknown | Promise<unknown>, timeout?: number) => void;
75
74
  };
76
- each: <I_1 extends KVMap, O_1 extends KVMap>(table: ({
77
- inputs: I_1;
78
- referenceOutputs?: O_1 | undefined;
75
+ each: <I extends KVMap, O extends KVMap>(table: ({
76
+ inputs: I;
77
+ referenceOutputs?: O;
79
78
  } & Record<string, any>)[], config?: LangSmithJestlikeWrapperConfig) => (name: string, fn: (params: {
80
- inputs: I_1;
81
- referenceOutputs?: O_1 | undefined;
79
+ inputs: I;
80
+ referenceOutputs?: O;
82
81
  } & Record<string, any>) => unknown | Promise<unknown>, timeout?: number) => void;
83
82
  };
84
83
  describe: LangSmithJestlikeDescribeWrapper & {
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.toBeSemanticCloseTo = exports.toBeAbsoluteCloseTo = exports.toBeRelativeCloseTo = void 0;
3
+ exports.toBeRelativeCloseTo = toBeRelativeCloseTo;
4
+ exports.toBeAbsoluteCloseTo = toBeAbsoluteCloseTo;
5
+ exports.toBeSemanticCloseTo = toBeSemanticCloseTo;
4
6
  // Levenshtein distance implementation
5
7
  function levenshteinDistance(a, b) {
6
8
  if (a.length === 0)
@@ -47,7 +49,6 @@ async function toBeRelativeCloseTo(received, expected, options = {}) {
47
49
  : `Expected "${received}" to be relatively close to "${expected}" (threshold: ${threshold}, actual distance: ${relativeDistance})`,
48
50
  };
49
51
  }
50
- exports.toBeRelativeCloseTo = toBeRelativeCloseTo;
51
52
  async function toBeAbsoluteCloseTo(received, expected, options = {}) {
52
53
  const { threshold = 3, algorithm = "levenshtein" } = options;
53
54
  let distance;
@@ -66,7 +67,6 @@ async function toBeAbsoluteCloseTo(received, expected, options = {}) {
66
67
  : `Expected "${received}" to be absolutely close to "${expected}" (threshold: ${threshold}, actual distance: ${distance})`,
67
68
  };
68
69
  }
69
- exports.toBeAbsoluteCloseTo = toBeAbsoluteCloseTo;
70
70
  async function toBeSemanticCloseTo(received, expected, options) {
71
71
  const { threshold = 0.2, embeddings, algorithm = "cosine" } = options;
72
72
  // Get embeddings for both strings
@@ -101,4 +101,3 @@ async function toBeSemanticCloseTo(received, expected, options) {
101
101
  : `Expected "${received}" to be semantically close to "${expected}" (threshold: ${threshold}, similarity: ${similarity})`,
102
102
  };
103
103
  }
104
- exports.toBeSemanticCloseTo = toBeSemanticCloseTo;
@@ -15,18 +15,28 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  var __importDefault = (this && this.__importDefault) || function (mod) {
26
36
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
37
  };
28
38
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.printReporterTable = void 0;
39
+ exports.printReporterTable = printReporterTable;
30
40
  const console_table_printer_1 = require("console-table-printer");
31
41
  const chalk_1 = __importDefault(require("chalk"));
32
42
  const os = __importStar(require("node:os"));
@@ -283,4 +293,3 @@ async function printReporterTable(testSuiteName, results, testStatus, failureMes
283
293
  console.log();
284
294
  }
285
295
  }
286
- exports.printReporterTable = printReporterTable;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.wrapExpect = void 0;
3
+ exports.wrapExpect = wrapExpect;
4
4
  /**
5
5
  * Adapted from https://github.com/mattphillips/jest-chain/blob/main/src/chain.js
6
6
  */
@@ -89,5 +89,4 @@ function wrapExpect(originalExpect) {
89
89
  );
90
90
  return expectProxy;
91
91
  }
92
- exports.wrapExpect = wrapExpect;
93
92
  globalThis.expect = wrapExpect(globalThis.expect);
@@ -1,2 +1 @@
1
- /// <reference types="jest" />
2
1
  export declare function wrapExpect(originalExpect: any): typeof expect;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.evaluatedBy = exports.wrapEvaluator = void 0;
3
+ exports.wrapEvaluator = wrapEvaluator;
4
+ exports.evaluatedBy = evaluatedBy;
4
5
  const traceable_js_1 = require("../../../traceable.cjs");
5
6
  const globals_js_1 = require("../globals.cjs");
6
7
  const uuid_1 = require("uuid");
@@ -65,7 +66,6 @@ function wrapEvaluator(evaluator) {
65
66
  return evalResult;
66
67
  };
67
68
  }
68
- exports.wrapEvaluator = wrapEvaluator;
69
69
  async function evaluatedBy(outputs, evaluator) {
70
70
  const context = globals_js_1.testWrapperAsyncLocalStorageInstance.getStore();
71
71
  if (context === undefined || context.currentExample === undefined) {
@@ -87,4 +87,3 @@ async function evaluatedBy(outputs, evaluator) {
87
87
  }
88
88
  return evalResult.score;
89
89
  }
90
- exports.evaluatedBy = evaluatedBy;
@@ -1,12 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.convertLangChainMessageToExample = exports.isLangChainMessage = void 0;
3
+ exports.isLangChainMessage = isLangChainMessage;
4
+ exports.convertLangChainMessageToExample = convertLangChainMessageToExample;
4
5
  function isLangChainMessage(
5
6
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
6
7
  message) {
7
8
  return typeof message?._getType === "function";
8
9
  }
9
- exports.isLangChainMessage = isLangChainMessage;
10
10
  function convertLangChainMessageToExample(message) {
11
11
  const converted = {
12
12
  type: message._getType(),
@@ -19,4 +19,3 @@ function convertLangChainMessageToExample(message) {
19
19
  }
20
20
  return converted;
21
21
  }
22
- exports.convertLangChainMessageToExample = convertLangChainMessageToExample;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.parsePromptIdentifier = exports.isVersionGreaterOrEqual = void 0;
3
+ exports.isVersionGreaterOrEqual = isVersionGreaterOrEqual;
4
+ exports.parsePromptIdentifier = parsePromptIdentifier;
4
5
  const semver_1 = require("semver");
5
6
  function isVersionGreaterOrEqual(current_version, target_version) {
6
7
  const current = (0, semver_1.parse)(current_version);
@@ -10,7 +11,6 @@ function isVersionGreaterOrEqual(current_version, target_version) {
10
11
  }
11
12
  return current.compare(target) >= 0;
12
13
  }
13
- exports.isVersionGreaterOrEqual = isVersionGreaterOrEqual;
14
14
  function parsePromptIdentifier(identifier) {
15
15
  if (!identifier ||
16
16
  identifier.split("/").length > 2 ||
@@ -35,4 +35,3 @@ function parsePromptIdentifier(identifier) {
35
35
  return ["-", ownerNamePart, commit];
36
36
  }
37
37
  }
38
- exports.parsePromptIdentifier = parsePromptIdentifier;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.shuffle = void 0;
3
+ exports.shuffle = shuffle;
4
4
  function shuffle(array) {
5
5
  let currentIndex = array.length;
6
6
  while (currentIndex !== 0) {
@@ -12,4 +12,3 @@ function shuffle(array) {
12
12
  }
13
13
  return array;
14
14
  }
15
- exports.shuffle = shuffle;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.warnOnce = void 0;
3
+ exports.warnOnce = warnOnce;
4
4
  const warnedMessages = {};
5
5
  function warnOnce(message) {
6
6
  if (!warnedMessages[message]) {
@@ -8,4 +8,3 @@ function warnOnce(message) {
8
8
  warnedMessages[message] = true;
9
9
  }
10
10
  }
11
- exports.warnOnce = warnOnce;
package/dist/vercel.cjs CHANGED
@@ -421,6 +421,22 @@ class AISDKExporter {
421
421
  }
422
422
  return result;
423
423
  })();
424
+ const invocationParams = (() => {
425
+ if ("ai.prompt.tools" in span.attributes) {
426
+ return {
427
+ tools: span.attributes["ai.prompt.tools"].flatMap((tool) => {
428
+ try {
429
+ return JSON.parse(tool);
430
+ }
431
+ catch {
432
+ // pass
433
+ }
434
+ return [];
435
+ }),
436
+ };
437
+ }
438
+ return {};
439
+ })();
424
440
  const events = [];
425
441
  const firstChunkEvent = span.events.find((i) => i.name === "ai.stream.firstChunk");
426
442
  if (firstChunkEvent) {
@@ -437,6 +453,7 @@ class AISDKExporter {
437
453
  outputs,
438
454
  events,
439
455
  extra: {
456
+ invocation_params: invocationParams,
440
457
  batch_size: 1,
441
458
  metadata: {
442
459
  ls_provider: span.attributes["ai.model.provider"]
package/dist/vercel.d.ts CHANGED
@@ -60,10 +60,10 @@ export declare class AISDKExporter {
60
60
  metadata: {
61
61
  [x: string]: import("@opentelemetry/api").AttributeValue;
62
62
  };
63
- recordInputs?: boolean | undefined;
64
- recordOutputs?: boolean | undefined;
65
- functionId?: string | undefined;
66
- tracer?: import("@opentelemetry/api").Tracer | undefined;
63
+ recordInputs?: boolean;
64
+ recordOutputs?: boolean;
65
+ functionId?: string;
66
+ tracer?: import("@opentelemetry/api").Tracer;
67
67
  };
68
68
  export(spans: unknown[], resultCallback: (result: {
69
69
  code: 0 | 1;
package/dist/vercel.js CHANGED
@@ -418,6 +418,22 @@ export class AISDKExporter {
418
418
  }
419
419
  return result;
420
420
  })();
421
+ const invocationParams = (() => {
422
+ if ("ai.prompt.tools" in span.attributes) {
423
+ return {
424
+ tools: span.attributes["ai.prompt.tools"].flatMap((tool) => {
425
+ try {
426
+ return JSON.parse(tool);
427
+ }
428
+ catch {
429
+ // pass
430
+ }
431
+ return [];
432
+ }),
433
+ };
434
+ }
435
+ return {};
436
+ })();
421
437
  const events = [];
422
438
  const firstChunkEvent = span.events.find((i) => i.name === "ai.stream.firstChunk");
423
439
  if (firstChunkEvent) {
@@ -434,6 +450,7 @@ export class AISDKExporter {
434
450
  outputs,
435
451
  events,
436
452
  extra: {
453
+ invocation_params: invocationParams,
437
454
  batch_size: 1,
438
455
  metadata: {
439
456
  ls_provider: span.attributes["ai.model.provider"]
@@ -1,4 +1,3 @@
1
- /// <reference types="jest" />
2
1
  import { Assertion } from "vitest";
3
2
  import { type AbsoluteCloseToMatcherOptions, type SemanticCloseToMatcherOptions, type RelativeCloseToMatcherOptions } from "../utils/jestlike/matchers.js";
4
3
  import type { SimpleEvaluator } from "../utils/jestlike/vendor/evaluatedBy.js";
@@ -58,74 +57,74 @@ declare module "vitest" {
58
57
  }
59
58
  declare const 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: {
60
59
  inputs: I;
61
- referenceOutputs?: O | undefined;
62
- } & Record<string, any>) => unknown, timeout?: number | undefined) => void) & {
60
+ referenceOutputs?: O;
61
+ } & Record<string, any>) => unknown | Promise<unknown>, timeout?: number) => void) & {
63
62
  only: (<I extends Record<string, any> = Record<string, any>, O extends Record<string, any> = Record<string, any>>(name: string, lsParams: LangSmithJestlikeWrapperParams<I, O>, testFn: (data: {
64
63
  inputs: I;
65
- referenceOutputs?: O | undefined;
66
- } & Record<string, any>) => unknown, timeout?: number | undefined) => void) & {
67
- each: <I_1 extends import("../schemas.js").KVMap, O_1 extends import("../schemas.js").KVMap>(table: ({
68
- inputs: I_1;
69
- referenceOutputs?: O_1 | undefined;
70
- } & Record<string, any>)[], config?: import("../utils/jestlike/types.js").LangSmithJestlikeWrapperConfig | undefined) => (name: string, fn: (params: {
71
- inputs: I_1;
72
- referenceOutputs?: O_1 | undefined;
73
- } & Record<string, any>) => unknown, timeout?: number | undefined) => void;
64
+ referenceOutputs?: O;
65
+ } & Record<string, any>) => unknown | Promise<unknown>, timeout?: number) => void) & {
66
+ each: <I extends import("../schemas.js").KVMap, O extends import("../schemas.js").KVMap>(table: ({
67
+ inputs: I;
68
+ referenceOutputs?: O;
69
+ } & Record<string, any>)[], config?: import("../utils/jestlike/types.js").LangSmithJestlikeWrapperConfig) => (name: string, fn: (params: {
70
+ inputs: I;
71
+ referenceOutputs?: O;
72
+ } & Record<string, any>) => unknown | Promise<unknown>, timeout?: number) => void;
74
73
  };
75
74
  skip: (<I extends Record<string, any> = Record<string, any>, O extends Record<string, any> = Record<string, any>>(name: string, lsParams: LangSmithJestlikeWrapperParams<I, O>, testFn: (data: {
76
75
  inputs: I;
77
- referenceOutputs?: O | undefined;
78
- } & Record<string, any>) => unknown, timeout?: number | undefined) => void) & {
79
- each: <I_1 extends import("../schemas.js").KVMap, O_1 extends import("../schemas.js").KVMap>(table: ({
80
- inputs: I_1;
81
- referenceOutputs?: O_1 | undefined;
82
- } & Record<string, any>)[], config?: import("../utils/jestlike/types.js").LangSmithJestlikeWrapperConfig | undefined) => (name: string, fn: (params: {
83
- inputs: I_1;
84
- referenceOutputs?: O_1 | undefined;
85
- } & Record<string, any>) => unknown, timeout?: number | undefined) => void;
76
+ referenceOutputs?: O;
77
+ } & Record<string, any>) => unknown | Promise<unknown>, timeout?: number) => void) & {
78
+ each: <I extends import("../schemas.js").KVMap, O extends import("../schemas.js").KVMap>(table: ({
79
+ inputs: I;
80
+ referenceOutputs?: O;
81
+ } & Record<string, any>)[], config?: import("../utils/jestlike/types.js").LangSmithJestlikeWrapperConfig) => (name: string, fn: (params: {
82
+ inputs: I;
83
+ referenceOutputs?: O;
84
+ } & Record<string, any>) => unknown | Promise<unknown>, timeout?: number) => void;
86
85
  };
87
- each: <I_1 extends import("../schemas.js").KVMap, O_1 extends import("../schemas.js").KVMap>(table: ({
88
- inputs: I_1;
89
- referenceOutputs?: O_1 | undefined;
90
- } & Record<string, any>)[], config?: import("../utils/jestlike/types.js").LangSmithJestlikeWrapperConfig | undefined) => (name: string, fn: (params: {
91
- inputs: I_1;
92
- referenceOutputs?: O_1 | undefined;
93
- } & Record<string, any>) => unknown, timeout?: number | undefined) => void;
86
+ each: <I extends import("../schemas.js").KVMap, O extends import("../schemas.js").KVMap>(table: ({
87
+ inputs: I;
88
+ referenceOutputs?: O;
89
+ } & Record<string, any>)[], config?: import("../utils/jestlike/types.js").LangSmithJestlikeWrapperConfig) => (name: string, fn: (params: {
90
+ inputs: I;
91
+ referenceOutputs?: O;
92
+ } & Record<string, any>) => unknown | Promise<unknown>, timeout?: number) => void;
94
93
  }, it: (<I extends Record<string, any> = Record<string, any>, O extends Record<string, any> = Record<string, any>>(name: string, lsParams: LangSmithJestlikeWrapperParams<I, O>, testFn: (data: {
95
94
  inputs: I;
96
- referenceOutputs?: O | undefined;
97
- } & Record<string, any>) => unknown, timeout?: number | undefined) => void) & {
95
+ referenceOutputs?: O;
96
+ } & Record<string, any>) => unknown | Promise<unknown>, timeout?: number) => void) & {
98
97
  only: (<I extends Record<string, any> = Record<string, any>, O extends Record<string, any> = Record<string, any>>(name: string, lsParams: LangSmithJestlikeWrapperParams<I, O>, testFn: (data: {
99
98
  inputs: I;
100
- referenceOutputs?: O | undefined;
101
- } & Record<string, any>) => unknown, timeout?: number | undefined) => void) & {
99
+ referenceOutputs?: O;
100
+ } & Record<string, any>) => unknown | Promise<unknown>, timeout?: number) => void) & {
102
101
  each: <I extends import("../schemas.js").KVMap, O extends import("../schemas.js").KVMap>(table: ({
103
102
  inputs: I;
104
- referenceOutputs?: O | undefined;
105
- } & Record<string, any>)[], config?: import("../utils/jestlike/types.js").LangSmithJestlikeWrapperConfig | undefined) => (name: string, fn: (params: {
103
+ referenceOutputs?: O;
104
+ } & Record<string, any>)[], config?: import("../utils/jestlike/types.js").LangSmithJestlikeWrapperConfig) => (name: string, fn: (params: {
106
105
  inputs: I;
107
- referenceOutputs?: O | undefined;
108
- } & Record<string, any>) => unknown, timeout?: number | undefined) => void;
106
+ referenceOutputs?: O;
107
+ } & Record<string, any>) => unknown | Promise<unknown>, timeout?: number) => void;
109
108
  };
110
109
  skip: (<I extends Record<string, any> = Record<string, any>, O extends Record<string, any> = Record<string, any>>(name: string, lsParams: LangSmithJestlikeWrapperParams<I, O>, testFn: (data: {
111
110
  inputs: I;
112
- referenceOutputs?: O | undefined;
113
- } & Record<string, any>) => unknown, timeout?: number | undefined) => void) & {
111
+ referenceOutputs?: O;
112
+ } & Record<string, any>) => unknown | Promise<unknown>, timeout?: number) => void) & {
114
113
  each: <I extends import("../schemas.js").KVMap, O extends import("../schemas.js").KVMap>(table: ({
115
114
  inputs: I;
116
- referenceOutputs?: O | undefined;
117
- } & Record<string, any>)[], config?: import("../utils/jestlike/types.js").LangSmithJestlikeWrapperConfig | undefined) => (name: string, fn: (params: {
115
+ referenceOutputs?: O;
116
+ } & Record<string, any>)[], config?: import("../utils/jestlike/types.js").LangSmithJestlikeWrapperConfig) => (name: string, fn: (params: {
118
117
  inputs: I;
119
- referenceOutputs?: O | undefined;
120
- } & Record<string, any>) => unknown, timeout?: number | undefined) => void;
118
+ referenceOutputs?: O;
119
+ } & Record<string, any>) => unknown | Promise<unknown>, timeout?: number) => void;
121
120
  };
122
121
  each: <I extends import("../schemas.js").KVMap, O extends import("../schemas.js").KVMap>(table: ({
123
122
  inputs: I;
124
- referenceOutputs?: O | undefined;
125
- } & Record<string, any>)[], config?: import("../utils/jestlike/types.js").LangSmithJestlikeWrapperConfig | undefined) => (name: string, fn: (params: {
123
+ referenceOutputs?: O;
124
+ } & Record<string, any>)[], config?: import("../utils/jestlike/types.js").LangSmithJestlikeWrapperConfig) => (name: string, fn: (params: {
126
125
  inputs: I;
127
- referenceOutputs?: O | undefined;
128
- } & Record<string, any>) => unknown, timeout?: number | undefined) => void;
126
+ referenceOutputs?: O;
127
+ } & Record<string, any>) => unknown | Promise<unknown>, timeout?: number) => void;
129
128
  }, describe: import("../utils/jestlike/types.js").LangSmithJestlikeDescribeWrapper & {
130
129
  only: import("../utils/jestlike/types.js").LangSmithJestlikeDescribeWrapper;
131
130
  skip: import("../utils/jestlike/types.js").LangSmithJestlikeDescribeWrapper;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "langsmith",
3
- "version": "0.3.14",
3
+ "version": "0.3.15",
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": [