langsmith 0.3.46-rc.2 → 0.3.47

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
@@ -1981,14 +1981,14 @@ class Client {
1981
1981
  let path = "/datasets";
1982
1982
  // limit to 1 result
1983
1983
  const params = new URLSearchParams({ limit: "1" });
1984
- if (datasetId !== undefined && datasetName !== undefined) {
1984
+ if (datasetId && datasetName) {
1985
1985
  throw new Error("Must provide either datasetName or datasetId, not both");
1986
1986
  }
1987
- else if (datasetId !== undefined) {
1987
+ else if (datasetId) {
1988
1988
  (0, _uuid_js_1.assertUuid)(datasetId);
1989
1989
  path += `/${datasetId}`;
1990
1990
  }
1991
- else if (datasetName !== undefined) {
1991
+ else if (datasetName) {
1992
1992
  params.append("name", datasetName);
1993
1993
  }
1994
1994
  else {
package/dist/client.js CHANGED
@@ -1943,14 +1943,14 @@ export class Client {
1943
1943
  let path = "/datasets";
1944
1944
  // limit to 1 result
1945
1945
  const params = new URLSearchParams({ limit: "1" });
1946
- if (datasetId !== undefined && datasetName !== undefined) {
1946
+ if (datasetId && datasetName) {
1947
1947
  throw new Error("Must provide either datasetName or datasetId, not both");
1948
1948
  }
1949
- else if (datasetId !== undefined) {
1949
+ else if (datasetId) {
1950
1950
  assertUuid(datasetId);
1951
1951
  path += `/${datasetId}`;
1952
1952
  }
1953
- else if (datasetName !== undefined) {
1953
+ else if (datasetName) {
1954
1954
  params.append("name", datasetName);
1955
1955
  }
1956
1956
  else {
@@ -138,7 +138,11 @@ class LangSmithOTLPTraceExporter extends exporter_trace_otlp_proto_1.OTLPTraceEx
138
138
  });
139
139
  }
140
140
  }
141
- if (span.attributes["ai.toolCall.args"]) {
141
+ if (span.attributes["ai.toolCall.input"]) {
142
+ span.attributes[constants.GENAI_PROMPT] =
143
+ span.attributes["ai.toolCall.input"];
144
+ }
145
+ else if (span.attributes["ai.toolCall.args"]) {
142
146
  span.attributes[constants.GENAI_PROMPT] =
143
147
  span.attributes["ai.toolCall.args"];
144
148
  }
@@ -176,7 +180,11 @@ class LangSmithOTLPTraceExporter extends exporter_trace_otlp_proto_1.OTLPTraceEx
176
180
  span.attributes[constants.GENAI_COMPLETION] =
177
181
  span.attributes["ai.response.toolCalls"];
178
182
  }
179
- if (span.attributes["ai.toolCall.result"]) {
183
+ if (span.attributes["ai.toolCall.output"]) {
184
+ span.attributes[constants.GENAI_COMPLETION] =
185
+ span.attributes["ai.toolCall.output"];
186
+ }
187
+ else if (span.attributes["ai.toolCall.result"]) {
180
188
  span.attributes[constants.GENAI_COMPLETION] =
181
189
  span.attributes["ai.toolCall.result"];
182
190
  }
@@ -102,7 +102,11 @@ export class LangSmithOTLPTraceExporter extends OTLPTraceExporter {
102
102
  });
103
103
  }
104
104
  }
105
- if (span.attributes["ai.toolCall.args"]) {
105
+ if (span.attributes["ai.toolCall.input"]) {
106
+ span.attributes[constants.GENAI_PROMPT] =
107
+ span.attributes["ai.toolCall.input"];
108
+ }
109
+ else if (span.attributes["ai.toolCall.args"]) {
106
110
  span.attributes[constants.GENAI_PROMPT] =
107
111
  span.attributes["ai.toolCall.args"];
108
112
  }
@@ -140,7 +144,11 @@ export class LangSmithOTLPTraceExporter extends OTLPTraceExporter {
140
144
  span.attributes[constants.GENAI_COMPLETION] =
141
145
  span.attributes["ai.response.toolCalls"];
142
146
  }
143
- if (span.attributes["ai.toolCall.result"]) {
147
+ if (span.attributes["ai.toolCall.output"]) {
148
+ span.attributes[constants.GENAI_COMPLETION] =
149
+ span.attributes["ai.toolCall.output"];
150
+ }
151
+ else if (span.attributes["ai.toolCall.result"]) {
144
152
  span.attributes[constants.GENAI_COMPLETION] =
145
153
  span.attributes["ai.toolCall.result"];
146
154
  }
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.46-rc.2";
13
+ exports.__version__ = "0.3.47";
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.46-rc.2";
6
+ export declare const __version__ = "0.3.47";
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.46-rc.2";
6
+ export const __version__ = "0.3.47";
package/dist/vercel.cjs CHANGED
@@ -18,15 +18,19 @@ 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
22
  ...part.experimental_providerMetadata,
22
23
  };
23
24
  }
24
25
  if (part.type === "tool-call") {
26
+ // @ts-expect-error Backcompat for AI SDK 4
27
+ const legacyToolCallInput = part.args;
25
28
  return {
26
29
  type: "tool_use",
27
30
  name: part.toolName,
28
31
  id: part.toolCallId,
29
- input: part.args,
32
+ input: legacyToolCallInput ?? part.input,
33
+ // @ts-expect-error Backcompat for AI SDK 4
30
34
  ...part.experimental_providerMetadata,
31
35
  };
32
36
  }
@@ -36,13 +40,15 @@ function convertCoreToSmith(message) {
36
40
  if (toolCalls.length > 0) {
37
41
  data.additional_kwargs ??= {};
38
42
  data.additional_kwargs.tool_calls = toolCalls.map((part) => {
43
+ // @ts-expect-error Backcompat for AI SDK 4
44
+ const legacyToolCallInput = part.args;
39
45
  return {
40
46
  id: part.toolCallId,
41
47
  type: "function",
42
48
  function: {
43
49
  name: part.toolName,
44
50
  id: part.toolCallId,
45
- arguments: JSON.stringify(part.args),
51
+ arguments: JSON.stringify(legacyToolCallInput ?? part.input),
46
52
  },
47
53
  };
48
54
  });
@@ -58,6 +64,7 @@ function convertCoreToSmith(message) {
58
64
  return {
59
65
  type: "text",
60
66
  text: part.text,
67
+ // @ts-expect-error Backcompat for AI SDK 4
61
68
  ...part.experimental_providerMetadata,
62
69
  };
63
70
  }
@@ -92,6 +99,7 @@ function convertCoreToSmith(message) {
92
99
  return {
93
100
  type: "image_url",
94
101
  image_url: imageUrl,
102
+ // @ts-expect-error Backcompat for AI SDK 4
95
103
  ...part.experimental_providerMetadata,
96
104
  };
97
105
  }
@@ -105,10 +113,12 @@ function convertCoreToSmith(message) {
105
113
  }
106
114
  if (message.role === "tool") {
107
115
  const res = message.content.map((toolCall) => {
116
+ // @ts-expect-error Backcompat for AI SDK 4
117
+ const legacyToolCallResult = toolCall.result;
108
118
  return {
109
119
  type: "tool",
110
120
  data: {
111
- content: JSON.stringify(toolCall.result),
121
+ content: JSON.stringify(legacyToolCallResult ?? toolCall.output),
112
122
  name: toolCall.toolName,
113
123
  tool_call_id: toolCall.toolCallId,
114
124
  },
@@ -530,12 +540,14 @@ class AISDKExporter {
530
540
  });
531
541
  }
532
542
  case "ai.toolCall": {
533
- const args = tryJson(span.attributes["ai.toolCall.args"]);
543
+ const args = tryJson(span.attributes["ai.toolCall.input"] ??
544
+ span.attributes["ai.toolCall.args"]);
534
545
  let inputs = { args };
535
546
  if (typeof args === "object" && args != null) {
536
547
  inputs = args;
537
548
  }
538
- const output = tryJson(span.attributes["ai.toolCall.result"]);
549
+ const output = tryJson(span.attributes["ai.toolCall.output"] ??
550
+ span.attributes["ai.toolCall.result"]);
539
551
  let outputs = { output };
540
552
  if (typeof output === "object" && output != null) {
541
553
  outputs = output;
package/dist/vercel.js CHANGED
@@ -15,15 +15,19 @@ 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
19
  ...part.experimental_providerMetadata,
19
20
  };
20
21
  }
21
22
  if (part.type === "tool-call") {
23
+ // @ts-expect-error Backcompat for AI SDK 4
24
+ const legacyToolCallInput = part.args;
22
25
  return {
23
26
  type: "tool_use",
24
27
  name: part.toolName,
25
28
  id: part.toolCallId,
26
- input: part.args,
29
+ input: legacyToolCallInput ?? part.input,
30
+ // @ts-expect-error Backcompat for AI SDK 4
27
31
  ...part.experimental_providerMetadata,
28
32
  };
29
33
  }
@@ -33,13 +37,15 @@ function convertCoreToSmith(message) {
33
37
  if (toolCalls.length > 0) {
34
38
  data.additional_kwargs ??= {};
35
39
  data.additional_kwargs.tool_calls = toolCalls.map((part) => {
40
+ // @ts-expect-error Backcompat for AI SDK 4
41
+ const legacyToolCallInput = part.args;
36
42
  return {
37
43
  id: part.toolCallId,
38
44
  type: "function",
39
45
  function: {
40
46
  name: part.toolName,
41
47
  id: part.toolCallId,
42
- arguments: JSON.stringify(part.args),
48
+ arguments: JSON.stringify(legacyToolCallInput ?? part.input),
43
49
  },
44
50
  };
45
51
  });
@@ -55,6 +61,7 @@ function convertCoreToSmith(message) {
55
61
  return {
56
62
  type: "text",
57
63
  text: part.text,
64
+ // @ts-expect-error Backcompat for AI SDK 4
58
65
  ...part.experimental_providerMetadata,
59
66
  };
60
67
  }
@@ -89,6 +96,7 @@ function convertCoreToSmith(message) {
89
96
  return {
90
97
  type: "image_url",
91
98
  image_url: imageUrl,
99
+ // @ts-expect-error Backcompat for AI SDK 4
92
100
  ...part.experimental_providerMetadata,
93
101
  };
94
102
  }
@@ -102,10 +110,12 @@ function convertCoreToSmith(message) {
102
110
  }
103
111
  if (message.role === "tool") {
104
112
  const res = message.content.map((toolCall) => {
113
+ // @ts-expect-error Backcompat for AI SDK 4
114
+ const legacyToolCallResult = toolCall.result;
105
115
  return {
106
116
  type: "tool",
107
117
  data: {
108
- content: JSON.stringify(toolCall.result),
118
+ content: JSON.stringify(legacyToolCallResult ?? toolCall.output),
109
119
  name: toolCall.toolName,
110
120
  tool_call_id: toolCall.toolCallId,
111
121
  },
@@ -527,12 +537,14 @@ export class AISDKExporter {
527
537
  });
528
538
  }
529
539
  case "ai.toolCall": {
530
- const args = tryJson(span.attributes["ai.toolCall.args"]);
540
+ const args = tryJson(span.attributes["ai.toolCall.input"] ??
541
+ span.attributes["ai.toolCall.args"]);
531
542
  let inputs = { args };
532
543
  if (typeof args === "object" && args != null) {
533
544
  inputs = args;
534
545
  }
535
- const output = tryJson(span.attributes["ai.toolCall.result"]);
546
+ const output = tryJson(span.attributes["ai.toolCall.output"] ??
547
+ span.attributes["ai.toolCall.result"]);
536
548
  let outputs = { output };
537
549
  if (typeof output === "object" && output != null) {
538
550
  outputs = output;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "langsmith",
3
- "version": "0.3.46-rc.2",
3
+ "version": "0.3.47",
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": [
@@ -140,8 +140,8 @@
140
140
  "uuid": "^10.0.0"
141
141
  },
142
142
  "devDependencies": {
143
- "@ai-sdk/anthropic": "^1.2.12",
144
- "@ai-sdk/openai": "^1.3.20",
143
+ "@ai-sdk/anthropic": "2.0.0-beta.8",
144
+ "@ai-sdk/openai": "2.0.0-beta.11",
145
145
  "@babel/preset-env": "^7.22.4",
146
146
  "@faker-js/faker": "^8.4.1",
147
147
  "@jest/globals": "^29.5.0",
@@ -159,7 +159,7 @@
159
159
  "@types/node-fetch": "^2.6.12",
160
160
  "@typescript-eslint/eslint-plugin": "^5.59.8",
161
161
  "@typescript-eslint/parser": "^5.59.8",
162
- "ai": "^4.3.17",
162
+ "ai": "5.0.0-beta.25",
163
163
  "babel-jest": "^29.5.0",
164
164
  "cross-env": "^7.0.3",
165
165
  "dotenv": "^16.1.3",
@@ -179,7 +179,7 @@
179
179
  "typedoc-plugin-expand-object-like-types": "^0.1.2",
180
180
  "typescript": "^5.4.5",
181
181
  "vitest": "^3.1.3",
182
- "zod": "^3.23.8"
182
+ "zod": "^3.25.76"
183
183
  },
184
184
  "peerDependencies": {
185
185
  "@opentelemetry/api": "*",