langsmith 0.5.25 → 0.5.26
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 +6 -2
- package/dist/client.js +6 -2
- package/dist/experimental/anthropic/context.cjs +419 -49
- package/dist/experimental/anthropic/context.js +420 -50
- package/dist/experimental/anthropic/index.cjs +78 -10
- package/dist/experimental/anthropic/index.js +80 -12
- package/dist/experimental/anthropic/messages.cjs +53 -0
- package/dist/experimental/anthropic/messages.d.ts +6 -0
- package/dist/experimental/anthropic/messages.js +52 -0
- package/dist/experimental/anthropic/transcripts.cjs +144 -0
- package/dist/experimental/anthropic/transcripts.d.ts +22 -0
- package/dist/experimental/anthropic/transcripts.js +141 -0
- package/dist/experimental/anthropic/types.d.ts +1 -0
- package/dist/experimental/anthropic/usage.cjs +19 -20
- package/dist/experimental/anthropic/usage.d.ts +2 -1
- package/dist/experimental/anthropic/usage.js +18 -20
- package/dist/experimental/opencode/index.cjs +36 -0
- package/dist/experimental/opencode/index.d.ts +3 -0
- package/dist/experimental/opencode/index.js +32 -0
- package/dist/experimental/opencode/tracer.cjs +389 -0
- package/dist/experimental/opencode/tracer.d.ts +30 -0
- package/dist/experimental/opencode/tracer.js +385 -0
- package/dist/experimental/otel/setup.cjs +1 -1
- package/dist/experimental/otel/setup.js +1 -1
- package/dist/experimental/sandbox/sandbox.cjs +6 -2
- package/dist/experimental/sandbox/sandbox.d.ts +5 -1
- package/dist/experimental/sandbox/sandbox.js +6 -2
- package/dist/experimental/sandbox/types.d.ts +3 -1
- package/dist/experimental/vercel/index.cjs +1 -1
- package/dist/experimental/vercel/index.js +1 -1
- package/dist/experimental/vercel/middleware.cjs +2 -1
- package/dist/experimental/vercel/middleware.js +2 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/singletons/traceable.cjs +1 -3
- package/dist/singletons/traceable.js +1 -3
- package/dist/traceable.cjs +1 -3
- package/dist/traceable.js +1 -3
- package/dist/utils/_git.cjs +2 -2
- package/dist/utils/_git.js +2 -2
- package/dist/utils/env.cjs +2 -2
- package/dist/utils/env.js +2 -2
- package/dist/utils/error.cjs +2 -2
- package/dist/utils/error.js +2 -2
- package/dist/utils/jestlike/reporter.cjs +1 -1
- package/dist/utils/jestlike/reporter.js +1 -1
- package/dist/utils/jestlike/vendor/chain.cjs +2 -3
- package/dist/utils/jestlike/vendor/chain.js +2 -3
- package/dist/vitest/utils/esm.mjs +4 -4
- package/dist/wrappers/gemini.cjs +1 -1
- package/dist/wrappers/gemini.js +1 -1
- package/dist/wrappers/openai.cjs +2 -6
- package/dist/wrappers/openai.js +2 -6
- package/experimental/opencode.cjs +1 -0
- package/experimental/opencode.d.cts +1 -0
- package/experimental/opencode.d.ts +1 -0
- package/experimental/opencode.js +1 -0
- package/package.json +24 -18
package/dist/utils/error.cjs
CHANGED
|
@@ -152,7 +152,7 @@ async function raiseForStatus(response, context, consumeOnSuccess) {
|
|
|
152
152
|
}
|
|
153
153
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
154
154
|
}
|
|
155
|
-
catch (
|
|
155
|
+
catch (_e) {
|
|
156
156
|
const errorWithStatus = new Error(`${response.status} ${response.statusText}`);
|
|
157
157
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
158
158
|
errorWithStatus.status = response?.status;
|
|
@@ -164,7 +164,7 @@ async function raiseForStatus(response, context, consumeOnSuccess) {
|
|
|
164
164
|
errorBody = await response.text();
|
|
165
165
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
166
166
|
}
|
|
167
|
-
catch (
|
|
167
|
+
catch (_e) {
|
|
168
168
|
errorBody = "";
|
|
169
169
|
}
|
|
170
170
|
}
|
package/dist/utils/error.js
CHANGED
|
@@ -141,7 +141,7 @@ export async function raiseForStatus(response, context, consumeOnSuccess) {
|
|
|
141
141
|
}
|
|
142
142
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
143
143
|
}
|
|
144
|
-
catch (
|
|
144
|
+
catch (_e) {
|
|
145
145
|
const errorWithStatus = new Error(`${response.status} ${response.statusText}`);
|
|
146
146
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
147
147
|
errorWithStatus.status = response?.status;
|
|
@@ -153,7 +153,7 @@ export async function raiseForStatus(response, context, consumeOnSuccess) {
|
|
|
153
153
|
errorBody = await response.text();
|
|
154
154
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
155
155
|
}
|
|
156
|
-
catch (
|
|
156
|
+
catch (_e) {
|
|
157
157
|
errorBody = "";
|
|
158
158
|
}
|
|
159
159
|
}
|
|
@@ -149,7 +149,7 @@ async function printReporterTable(testSuiteName, results, testStatus, failureMes
|
|
|
149
149
|
fileContent = JSON.parse(await fs.readFile(resultsPath, "utf-8"));
|
|
150
150
|
await fs.unlink(resultsPath);
|
|
151
151
|
}
|
|
152
|
-
catch (
|
|
152
|
+
catch (_e) {
|
|
153
153
|
console.log("[LANGSMITH]: Failed to read custom evaluation results. Please contact us for help.");
|
|
154
154
|
rows.push([
|
|
155
155
|
{
|
|
@@ -110,7 +110,7 @@ export async function printReporterTable(testSuiteName, results, testStatus, fai
|
|
|
110
110
|
fileContent = JSON.parse(await fs.readFile(resultsPath, "utf-8"));
|
|
111
111
|
await fs.unlink(resultsPath);
|
|
112
112
|
}
|
|
113
|
-
catch (
|
|
113
|
+
catch (_e) {
|
|
114
114
|
console.log("[LANGSMITH]: Failed to read custom evaluation results. Please contact us for help.");
|
|
115
115
|
rows.push([
|
|
116
116
|
{
|
|
@@ -61,7 +61,7 @@ const addEvaluatedBy = (matchers, originalArgs, originalExpect, staticPath = [])
|
|
|
61
61
|
try {
|
|
62
62
|
return [prop, matchers[prop]];
|
|
63
63
|
}
|
|
64
|
-
catch (
|
|
64
|
+
catch (_e) {
|
|
65
65
|
// Ignore bizarre Bun bug
|
|
66
66
|
return [];
|
|
67
67
|
}
|
|
@@ -85,8 +85,7 @@ const addEvaluatedBy = (matchers, originalArgs, originalExpect, staticPath = [])
|
|
|
85
85
|
function wrapExpect(originalExpect) {
|
|
86
86
|
// proxy the expect function
|
|
87
87
|
const expectProxy = Object.assign((...args) => addEvaluatedBy(originalExpect(...args), args, originalExpect, []), // partially apply expect to get all matchers and chain them
|
|
88
|
-
originalExpect
|
|
89
|
-
);
|
|
88
|
+
originalExpect);
|
|
90
89
|
return expectProxy;
|
|
91
90
|
}
|
|
92
91
|
globalThis.expect = wrapExpect(globalThis.expect);
|
|
@@ -58,7 +58,7 @@ const addEvaluatedBy = (matchers, originalArgs, originalExpect, staticPath = [])
|
|
|
58
58
|
try {
|
|
59
59
|
return [prop, matchers[prop]];
|
|
60
60
|
}
|
|
61
|
-
catch (
|
|
61
|
+
catch (_e) {
|
|
62
62
|
// Ignore bizarre Bun bug
|
|
63
63
|
return [];
|
|
64
64
|
}
|
|
@@ -82,8 +82,7 @@ const addEvaluatedBy = (matchers, originalArgs, originalExpect, staticPath = [])
|
|
|
82
82
|
export function wrapExpect(originalExpect) {
|
|
83
83
|
// proxy the expect function
|
|
84
84
|
const expectProxy = Object.assign((...args) => addEvaluatedBy(originalExpect(...args), args, originalExpect, []), // partially apply expect to get all matchers and chain them
|
|
85
|
-
originalExpect
|
|
86
|
-
);
|
|
85
|
+
originalExpect);
|
|
87
86
|
return expectProxy;
|
|
88
87
|
}
|
|
89
88
|
globalThis.expect = wrapExpect(globalThis.expect);
|
|
@@ -20,9 +20,9 @@ export const importVitestModule = async (entrypoint) => {
|
|
|
20
20
|
const pkg = require(packagePath);
|
|
21
21
|
const pkgDir = packagePath.replace(`${sep}package.json`, "");
|
|
22
22
|
const esmEntry = !entrypoint
|
|
23
|
-
? pkg.module ?? pkg.exports?.["."]?.import ?? "dist/index.js"
|
|
24
|
-
: pkg.exports?.[`./${entrypoint}`]?.import ??
|
|
25
|
-
pkg.exports?.[`./${entrypoint}`]?.default;
|
|
23
|
+
? (pkg.module ?? pkg.exports?.["."]?.import ?? "dist/index.js")
|
|
24
|
+
: (pkg.exports?.[`./${entrypoint}`]?.import ??
|
|
25
|
+
pkg.exports?.[`./${entrypoint}`]?.default);
|
|
26
26
|
const modulePath = `${pkgDir}${sep}${esmEntry}`;
|
|
27
27
|
const path = pathToFileURL(modulePath).href;
|
|
28
28
|
importedModule = await import(path);
|
|
@@ -31,7 +31,7 @@ export const importVitestModule = async (entrypoint) => {
|
|
|
31
31
|
}
|
|
32
32
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
33
33
|
}
|
|
34
|
-
catch (
|
|
34
|
+
catch (_error) {
|
|
35
35
|
importedModule = await import(`vitest${entrypoint ? `/${entrypoint}` : ""}`);
|
|
36
36
|
}
|
|
37
37
|
return importedModule;
|
package/dist/wrappers/gemini.cjs
CHANGED
|
@@ -190,7 +190,7 @@ function processGeminiInputs(inputs) {
|
|
|
190
190
|
return "parts" in item && Array.isArray(item.parts);
|
|
191
191
|
};
|
|
192
192
|
const role = "role" in content ? content.role : "user";
|
|
193
|
-
const parts = isContent(content) ? content.parts ?? [] : [content];
|
|
193
|
+
const parts = isContent(content) ? (content.parts ?? []) : [content];
|
|
194
194
|
const textParts = [];
|
|
195
195
|
const contentParts = [];
|
|
196
196
|
for (const part of parts) {
|
package/dist/wrappers/gemini.js
CHANGED
|
@@ -187,7 +187,7 @@ function processGeminiInputs(inputs) {
|
|
|
187
187
|
return "parts" in item && Array.isArray(item.parts);
|
|
188
188
|
};
|
|
189
189
|
const role = "role" in content ? content.role : "user";
|
|
190
|
-
const parts = isContent(content) ? content.parts ?? [] : [content];
|
|
190
|
+
const parts = isContent(content) ? (content.parts ?? []) : [content];
|
|
191
191
|
const textParts = [];
|
|
192
192
|
const contentParts = [];
|
|
193
193
|
for (const part of parts) {
|
package/dist/wrappers/openai.cjs
CHANGED
|
@@ -25,9 +25,7 @@ const TRACED_INVOCATION_KEYS = [
|
|
|
25
25
|
"verbosity",
|
|
26
26
|
"web_search_options",
|
|
27
27
|
];
|
|
28
|
-
function _combineChatCompletionChoices(choices
|
|
29
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
30
|
-
) {
|
|
28
|
+
function _combineChatCompletionChoices(choices) {
|
|
31
29
|
const reversedChoices = choices.slice().reverse();
|
|
32
30
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
33
31
|
const message = {
|
|
@@ -130,9 +128,7 @@ const responsesAggregator = (events) => {
|
|
|
130
128
|
// If no completed event found, return the last event
|
|
131
129
|
return events[events.length - 1] || {};
|
|
132
130
|
};
|
|
133
|
-
const textAggregator = (allChunks
|
|
134
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
135
|
-
) => {
|
|
131
|
+
const textAggregator = (allChunks) => {
|
|
136
132
|
if (allChunks.length === 0) {
|
|
137
133
|
return { choices: [{ text: "" }] };
|
|
138
134
|
}
|
package/dist/wrappers/openai.js
CHANGED
|
@@ -22,9 +22,7 @@ const TRACED_INVOCATION_KEYS = [
|
|
|
22
22
|
"verbosity",
|
|
23
23
|
"web_search_options",
|
|
24
24
|
];
|
|
25
|
-
function _combineChatCompletionChoices(choices
|
|
26
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
27
|
-
) {
|
|
25
|
+
function _combineChatCompletionChoices(choices) {
|
|
28
26
|
const reversedChoices = choices.slice().reverse();
|
|
29
27
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
30
28
|
const message = {
|
|
@@ -127,9 +125,7 @@ const responsesAggregator = (events) => {
|
|
|
127
125
|
// If no completed event found, return the last event
|
|
128
126
|
return events[events.length - 1] || {};
|
|
129
127
|
};
|
|
130
|
-
const textAggregator = (allChunks
|
|
131
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
132
|
-
) => {
|
|
128
|
+
const textAggregator = (allChunks) => {
|
|
133
129
|
if (allChunks.length === 0) {
|
|
134
130
|
return { choices: [{ text: "" }] };
|
|
135
131
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('../dist/experimental/opencode/index.cjs');
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../dist/experimental/opencode/index.js'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../dist/experimental/opencode/index.js'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../dist/experimental/opencode/index.js'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "langsmith",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.26",
|
|
4
4
|
"description": "Client library to connect to the LangSmith Observability and Evaluation Platform.",
|
|
5
5
|
"packageManager": "pnpm@10.33.0",
|
|
6
6
|
"files": [
|
|
@@ -101,6 +101,10 @@
|
|
|
101
101
|
"experimental/sandbox.js",
|
|
102
102
|
"experimental/sandbox.d.ts",
|
|
103
103
|
"experimental/sandbox.d.cts",
|
|
104
|
+
"experimental/opencode.cjs",
|
|
105
|
+
"experimental/opencode.js",
|
|
106
|
+
"experimental/opencode.d.ts",
|
|
107
|
+
"experimental/opencode.d.cts",
|
|
104
108
|
"index.cjs",
|
|
105
109
|
"index.js",
|
|
106
110
|
"index.d.ts",
|
|
@@ -124,10 +128,10 @@
|
|
|
124
128
|
"watch:single": "NODE_OPTIONS=--experimental-vm-modules pnpm jest --watch --config jest.config.cjs --testTimeout 100000",
|
|
125
129
|
"test:vitest": "vitest run --config vitest.config.ts",
|
|
126
130
|
"test:eval:vitest": "vitest run --config ls.vitest.config.ts",
|
|
127
|
-
"lint": "
|
|
128
|
-
"lint:fix": "
|
|
129
|
-
"format": "
|
|
130
|
-
"format:check": "
|
|
131
|
+
"lint": "oxlint src/",
|
|
132
|
+
"lint:fix": "oxlint --fix src/",
|
|
133
|
+
"format": "oxfmt --write 'src/**/*.{ts,tsx,mts}'",
|
|
134
|
+
"format:check": "oxfmt --check 'src/**/*.{ts,tsx,mts}'",
|
|
131
135
|
"check:types": "tsc --noEmit",
|
|
132
136
|
"precommit": "lint-staged",
|
|
133
137
|
"prepublish": "pnpm run build"
|
|
@@ -156,7 +160,7 @@
|
|
|
156
160
|
"@ai-sdk/openai": "^3.0.0",
|
|
157
161
|
"@ai-sdk/provider": "^3.0.0",
|
|
158
162
|
"@anthropic-ai/claude-agent-sdk": "^0.2.83",
|
|
159
|
-
"@anthropic-ai/sdk": "^0.
|
|
163
|
+
"@anthropic-ai/sdk": "^0.91.1",
|
|
160
164
|
"@babel/preset-env": "^7.22.4",
|
|
161
165
|
"@faker-js/faker": "^8.4.1",
|
|
162
166
|
"@google/genai": "^1.29.0",
|
|
@@ -164,7 +168,7 @@
|
|
|
164
168
|
"@jest/reporters": "^30.2.0",
|
|
165
169
|
"@langchain/core": "^0.3.72",
|
|
166
170
|
"@langchain/langgraph": "^0.3.6",
|
|
167
|
-
"@langchain/openai": "^0.
|
|
171
|
+
"@langchain/openai": "^0.6.17",
|
|
168
172
|
"@openai/agents": "^0.8.3",
|
|
169
173
|
"@opentelemetry/api": "^1.9.0",
|
|
170
174
|
"@opentelemetry/auto-instrumentations-node": "^0.73.0",
|
|
@@ -176,26 +180,19 @@
|
|
|
176
180
|
"@types/jest": "^29.5.1",
|
|
177
181
|
"@types/node-fetch": "^2.6.12",
|
|
178
182
|
"@types/semver": "^7.7.1",
|
|
179
|
-
"@types/uuid": "^10.0.0",
|
|
180
183
|
"@types/ws": "^8.18.1",
|
|
181
|
-
"@typescript-eslint/eslint-plugin": "^5.59.8",
|
|
182
|
-
"@typescript-eslint/parser": "^5.59.8",
|
|
183
184
|
"ai": "^6.0.1",
|
|
184
185
|
"babel-jest": "^30.2.0",
|
|
185
186
|
"cross-env": "^10.1.0",
|
|
186
187
|
"dotenv": "^17.3.1",
|
|
187
|
-
"eslint": "^8.41.0",
|
|
188
|
-
"eslint-config-prettier": "^10.1.8",
|
|
189
|
-
"eslint-plugin-import": "^2.27.5",
|
|
190
|
-
"eslint-plugin-no-instanceof": "^1.0.1",
|
|
191
|
-
"eslint-plugin-prettier": "^4.2.1",
|
|
192
188
|
"jest": "^29.5.0",
|
|
193
189
|
"langchain": "^0.3.29",
|
|
194
190
|
"mongoose": "^9.5.0",
|
|
195
191
|
"msw": "^2.11.2",
|
|
196
192
|
"node-fetch": "^3.3.2",
|
|
197
193
|
"openai": "^6.18.0",
|
|
198
|
-
"
|
|
194
|
+
"oxfmt": "^0.47.0",
|
|
195
|
+
"oxlint": "^1.62.0",
|
|
199
196
|
"semver": "^7.7.4",
|
|
200
197
|
"ts-jest": "^29.1.0",
|
|
201
198
|
"ts-node": "^10.9.1",
|
|
@@ -232,8 +229,8 @@
|
|
|
232
229
|
},
|
|
233
230
|
"lint-staged": {
|
|
234
231
|
"**/*.{ts,tsx}": [
|
|
235
|
-
"
|
|
236
|
-
"
|
|
232
|
+
"oxfmt --write",
|
|
233
|
+
"oxlint --fix"
|
|
237
234
|
]
|
|
238
235
|
},
|
|
239
236
|
"exports": {
|
|
@@ -462,6 +459,15 @@
|
|
|
462
459
|
"import": "./experimental/sandbox.js",
|
|
463
460
|
"require": "./experimental/sandbox.cjs"
|
|
464
461
|
},
|
|
462
|
+
"./experimental/opencode": {
|
|
463
|
+
"types": {
|
|
464
|
+
"import": "./experimental/opencode.d.ts",
|
|
465
|
+
"require": "./experimental/opencode.d.cts",
|
|
466
|
+
"default": "./experimental/opencode.d.ts"
|
|
467
|
+
},
|
|
468
|
+
"import": "./experimental/opencode.js",
|
|
469
|
+
"require": "./experimental/opencode.cjs"
|
|
470
|
+
},
|
|
465
471
|
"./package.json": "./package.json"
|
|
466
472
|
},
|
|
467
473
|
"pnpm": {
|