langsmith 0.3.53 → 0.3.54

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.53";
13
+ exports.__version__ = "0.3.54";
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.53";
6
+ export declare const __version__ = "0.3.54";
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.53";
6
+ export const __version__ = "0.3.54";
package/dist/vercel.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AISDKExporter = void 0;
3
+ exports.AISDKExporter = exports.parseStrippedIsoTime = void 0;
4
4
  const vercel_js_1 = require("./utils/vercel.cjs");
5
5
  const index_js_1 = require("./index.cjs");
6
6
  const uuid_1 = require("uuid");
@@ -18,19 +18,22 @@ function convertCoreToSmith(message) {
18
18
  return {
19
19
  type: "text",
20
20
  text: part.text,
21
- // @ts-expect-error Backcompat for AI SDK 4
21
+ // Backcompat for AI SDK 4
22
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
22
23
  ...part.experimental_providerMetadata,
23
24
  };
24
25
  }
25
26
  if (part.type === "tool-call") {
26
- // @ts-expect-error Backcompat for AI SDK 4
27
+ // Backcompat for AI SDK 4
28
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
27
29
  const legacyToolCallInput = part.args;
28
30
  return {
29
31
  type: "tool_use",
30
32
  name: part.toolName,
31
33
  id: part.toolCallId,
32
34
  input: legacyToolCallInput ?? part.input,
33
- // @ts-expect-error Backcompat for AI SDK 4
35
+ // Backcompat for AI SDK 4
36
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
34
37
  ...part.experimental_providerMetadata,
35
38
  };
36
39
  }
@@ -40,7 +43,8 @@ function convertCoreToSmith(message) {
40
43
  if (toolCalls.length > 0) {
41
44
  data.additional_kwargs ??= {};
42
45
  data.additional_kwargs.tool_calls = toolCalls.map((part) => {
43
- // @ts-expect-error Backcompat for AI SDK 4
46
+ // Backcompat for AI SDK 4
47
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
44
48
  const legacyToolCallInput = part.args;
45
49
  return {
46
50
  id: part.toolCallId,
@@ -64,7 +68,8 @@ function convertCoreToSmith(message) {
64
68
  return {
65
69
  type: "text",
66
70
  text: part.text,
67
- // @ts-expect-error Backcompat for AI SDK 4
71
+ // Backcompat for AI SDK 4
72
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
68
73
  ...part.experimental_providerMetadata,
69
74
  };
70
75
  }
@@ -99,7 +104,8 @@ function convertCoreToSmith(message) {
99
104
  return {
100
105
  type: "image_url",
101
106
  image_url: imageUrl,
102
- // @ts-expect-error Backcompat for AI SDK 4
107
+ // Backcompat for AI SDK 4
108
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
103
109
  ...part.experimental_providerMetadata,
104
110
  };
105
111
  }
@@ -113,7 +119,8 @@ function convertCoreToSmith(message) {
113
119
  }
114
120
  if (message.role === "tool") {
115
121
  const res = message.content.map((toolCall) => {
116
- // @ts-expect-error Backcompat for AI SDK 4
122
+ // Backcompat for AI SDK 4
123
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
117
124
  const legacyToolCallResult = toolCall.result;
118
125
  return {
119
126
  type: "tool",
@@ -172,6 +179,22 @@ function reparentDotOrder(dotOrder, sourceRunId, parentDotOrder) {
172
179
  return dotOrder;
173
180
  return joinDotOrder(...parentDotOrder.split("."), ...segments.slice(sourceIndex));
174
181
  }
182
+ // Helper function to convert dotted order version of start time to ISO string
183
+ const parseStrippedIsoTime = (stripped) => {
184
+ const year = stripped.slice(0, 4);
185
+ const month = stripped.slice(4, 6);
186
+ const day = stripped.slice(6, 8);
187
+ const hour = stripped.slice(9, 11); // Skip 'T'
188
+ const minute = stripped.slice(11, 13);
189
+ const second = stripped.slice(13, 15);
190
+ const ms = stripped.slice(15, 18); // milliseconds
191
+ const us = stripped.length >= 21 ? stripped.slice(18, 21) : "000"; // microseconds
192
+ // Create ISO string with microsecond precision only if microseconds are present
193
+ return us !== "000"
194
+ ? `${year}-${month}-${day}T${hour}:${minute}:${second}.${ms}${us}Z`
195
+ : `${year}-${month}-${day}T${hour}:${minute}:${second}.${ms}Z`;
196
+ };
197
+ exports.parseStrippedIsoTime = parseStrippedIsoTime;
175
198
  function getMutableRunCreate(dotOrder) {
176
199
  const segments = dotOrder.split(".").map((i) => {
177
200
  const [startTime, runId] = i.split("Z");
@@ -180,12 +203,14 @@ function getMutableRunCreate(dotOrder) {
180
203
  const traceId = segments[0].runId;
181
204
  const parentRunId = segments.at(-2)?.runId;
182
205
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
183
- const runId = segments.at(-1).runId;
206
+ const lastSegment = segments.at(-1);
207
+ const startTime = (0, exports.parseStrippedIsoTime)(lastSegment.startTime);
184
208
  return {
185
- id: runId,
209
+ id: lastSegment.runId,
186
210
  trace_id: traceId,
187
211
  dotted_order: dotOrder,
188
212
  parent_run_id: parentRunId,
213
+ start_time: startTime,
189
214
  };
190
215
  }
191
216
  function convertToTimestamp([seconds, nanoseconds]) {
package/dist/vercel.d.ts CHANGED
@@ -7,6 +7,7 @@ export interface TelemetrySettings extends AITelemetrySettings {
7
7
  /** Name of the run sent to LangSmith */
8
8
  runName?: string;
9
9
  }
10
+ export declare const parseStrippedIsoTime: (stripped: string) => string;
10
11
  /**
11
12
  * OpenTelemetry trace exporter for Vercel AI SDK.
12
13
  *
package/dist/vercel.js CHANGED
@@ -15,19 +15,22 @@ function convertCoreToSmith(message) {
15
15
  return {
16
16
  type: "text",
17
17
  text: part.text,
18
- // @ts-expect-error Backcompat for AI SDK 4
18
+ // Backcompat for AI SDK 4
19
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
19
20
  ...part.experimental_providerMetadata,
20
21
  };
21
22
  }
22
23
  if (part.type === "tool-call") {
23
- // @ts-expect-error Backcompat for AI SDK 4
24
+ // Backcompat for AI SDK 4
25
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
24
26
  const legacyToolCallInput = part.args;
25
27
  return {
26
28
  type: "tool_use",
27
29
  name: part.toolName,
28
30
  id: part.toolCallId,
29
31
  input: legacyToolCallInput ?? part.input,
30
- // @ts-expect-error Backcompat for AI SDK 4
32
+ // Backcompat for AI SDK 4
33
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
31
34
  ...part.experimental_providerMetadata,
32
35
  };
33
36
  }
@@ -37,7 +40,8 @@ function convertCoreToSmith(message) {
37
40
  if (toolCalls.length > 0) {
38
41
  data.additional_kwargs ??= {};
39
42
  data.additional_kwargs.tool_calls = toolCalls.map((part) => {
40
- // @ts-expect-error Backcompat for AI SDK 4
43
+ // Backcompat for AI SDK 4
44
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
41
45
  const legacyToolCallInput = part.args;
42
46
  return {
43
47
  id: part.toolCallId,
@@ -61,7 +65,8 @@ function convertCoreToSmith(message) {
61
65
  return {
62
66
  type: "text",
63
67
  text: part.text,
64
- // @ts-expect-error Backcompat for AI SDK 4
68
+ // Backcompat for AI SDK 4
69
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
65
70
  ...part.experimental_providerMetadata,
66
71
  };
67
72
  }
@@ -96,7 +101,8 @@ function convertCoreToSmith(message) {
96
101
  return {
97
102
  type: "image_url",
98
103
  image_url: imageUrl,
99
- // @ts-expect-error Backcompat for AI SDK 4
104
+ // Backcompat for AI SDK 4
105
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
100
106
  ...part.experimental_providerMetadata,
101
107
  };
102
108
  }
@@ -110,7 +116,8 @@ function convertCoreToSmith(message) {
110
116
  }
111
117
  if (message.role === "tool") {
112
118
  const res = message.content.map((toolCall) => {
113
- // @ts-expect-error Backcompat for AI SDK 4
119
+ // Backcompat for AI SDK 4
120
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
114
121
  const legacyToolCallResult = toolCall.result;
115
122
  return {
116
123
  type: "tool",
@@ -169,6 +176,21 @@ function reparentDotOrder(dotOrder, sourceRunId, parentDotOrder) {
169
176
  return dotOrder;
170
177
  return joinDotOrder(...parentDotOrder.split("."), ...segments.slice(sourceIndex));
171
178
  }
179
+ // Helper function to convert dotted order version of start time to ISO string
180
+ export const parseStrippedIsoTime = (stripped) => {
181
+ const year = stripped.slice(0, 4);
182
+ const month = stripped.slice(4, 6);
183
+ const day = stripped.slice(6, 8);
184
+ const hour = stripped.slice(9, 11); // Skip 'T'
185
+ const minute = stripped.slice(11, 13);
186
+ const second = stripped.slice(13, 15);
187
+ const ms = stripped.slice(15, 18); // milliseconds
188
+ const us = stripped.length >= 21 ? stripped.slice(18, 21) : "000"; // microseconds
189
+ // Create ISO string with microsecond precision only if microseconds are present
190
+ return us !== "000"
191
+ ? `${year}-${month}-${day}T${hour}:${minute}:${second}.${ms}${us}Z`
192
+ : `${year}-${month}-${day}T${hour}:${minute}:${second}.${ms}Z`;
193
+ };
172
194
  function getMutableRunCreate(dotOrder) {
173
195
  const segments = dotOrder.split(".").map((i) => {
174
196
  const [startTime, runId] = i.split("Z");
@@ -177,12 +199,14 @@ function getMutableRunCreate(dotOrder) {
177
199
  const traceId = segments[0].runId;
178
200
  const parentRunId = segments.at(-2)?.runId;
179
201
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
180
- const runId = segments.at(-1).runId;
202
+ const lastSegment = segments.at(-1);
203
+ const startTime = parseStrippedIsoTime(lastSegment.startTime);
181
204
  return {
182
- id: runId,
205
+ id: lastSegment.runId,
183
206
  trace_id: traceId,
184
207
  dotted_order: dotOrder,
185
208
  parent_run_id: parentRunId,
209
+ start_time: startTime,
186
210
  };
187
211
  }
188
212
  function convertToTimestamp([seconds, nanoseconds]) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "langsmith",
3
- "version": "0.3.53",
3
+ "version": "0.3.54",
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": [