langsmith 0.5.4 → 0.5.5
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/experimental/anthropic/context.cjs +29 -14
- package/dist/experimental/anthropic/context.js +29 -14
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/singletons/types.d.ts +1 -0
- package/dist/traceable.cjs +13 -2
- package/dist/traceable.js +13 -2
- package/package.json +4 -4
|
@@ -145,21 +145,36 @@ class StreamManager {
|
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
147
|
if (message.type === "user") {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
if (
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
148
|
+
const toolResultBlocks = Array.isArray(message.message.content)
|
|
149
|
+
? message.message.content.filter((block) => "tool_use_id" in block)
|
|
150
|
+
: [];
|
|
151
|
+
const getToolOutput = (result) => {
|
|
152
|
+
if (typeof result === "object" &&
|
|
153
|
+
result != null &&
|
|
154
|
+
!Array.isArray(result)) {
|
|
155
|
+
return result;
|
|
156
|
+
}
|
|
157
|
+
return { content: result };
|
|
158
|
+
};
|
|
159
|
+
const getToolError = (result) => {
|
|
160
|
+
if (["string", "number", "boolean"].includes(typeof result)) {
|
|
161
|
+
return String(result);
|
|
162
|
+
}
|
|
163
|
+
return JSON.stringify(result);
|
|
164
|
+
};
|
|
165
|
+
for (const block of toolResultBlocks) {
|
|
166
|
+
if (this.tools[block.tool_use_id] != null) {
|
|
167
|
+
// Previous versions of @anthropic-ai/claude-agent-sdk did provide
|
|
168
|
+
// tool result in `message.tool_use_result`, but at least since 0.2.50 it disappeared,
|
|
169
|
+
// so we rely on the last tool result block instead.
|
|
170
|
+
const result = message.tool_use_result != null && toolResultBlocks.length === 1
|
|
171
|
+
? message.tool_use_result
|
|
172
|
+
: block.content;
|
|
173
|
+
const toolOutput = getToolOutput(result);
|
|
174
|
+
const toolError = "is_error" in block && block.is_error === true
|
|
175
|
+
? getToolError(result)
|
|
161
176
|
: undefined;
|
|
162
|
-
void this.tools[
|
|
177
|
+
void this.tools[block.tool_use_id].end(toolOutput, toolError);
|
|
163
178
|
}
|
|
164
179
|
}
|
|
165
180
|
}
|
|
@@ -142,21 +142,36 @@ export class StreamManager {
|
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
144
|
if (message.type === "user") {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
if (
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
145
|
+
const toolResultBlocks = Array.isArray(message.message.content)
|
|
146
|
+
? message.message.content.filter((block) => "tool_use_id" in block)
|
|
147
|
+
: [];
|
|
148
|
+
const getToolOutput = (result) => {
|
|
149
|
+
if (typeof result === "object" &&
|
|
150
|
+
result != null &&
|
|
151
|
+
!Array.isArray(result)) {
|
|
152
|
+
return result;
|
|
153
|
+
}
|
|
154
|
+
return { content: result };
|
|
155
|
+
};
|
|
156
|
+
const getToolError = (result) => {
|
|
157
|
+
if (["string", "number", "boolean"].includes(typeof result)) {
|
|
158
|
+
return String(result);
|
|
159
|
+
}
|
|
160
|
+
return JSON.stringify(result);
|
|
161
|
+
};
|
|
162
|
+
for (const block of toolResultBlocks) {
|
|
163
|
+
if (this.tools[block.tool_use_id] != null) {
|
|
164
|
+
// Previous versions of @anthropic-ai/claude-agent-sdk did provide
|
|
165
|
+
// tool result in `message.tool_use_result`, but at least since 0.2.50 it disappeared,
|
|
166
|
+
// so we rely on the last tool result block instead.
|
|
167
|
+
const result = message.tool_use_result != null && toolResultBlocks.length === 1
|
|
168
|
+
? message.tool_use_result
|
|
169
|
+
: block.content;
|
|
170
|
+
const toolOutput = getToolOutput(result);
|
|
171
|
+
const toolError = "is_error" in block && block.is_error === true
|
|
172
|
+
? getToolError(result)
|
|
158
173
|
: undefined;
|
|
159
|
-
void this.tools[
|
|
174
|
+
void this.tools[block.tool_use_id].end(toolOutput, toolError);
|
|
160
175
|
}
|
|
161
176
|
}
|
|
162
177
|
}
|
package/dist/index.cjs
CHANGED
|
@@ -18,4 +18,4 @@ Object.defineProperty(exports, "PromptCache", { enumerable: true, get: function
|
|
|
18
18
|
Object.defineProperty(exports, "configureGlobalPromptCache", { enumerable: true, get: function () { return index_js_1.configureGlobalPromptCache; } });
|
|
19
19
|
Object.defineProperty(exports, "promptCacheSingleton", { enumerable: true, get: function () { return index_js_1.promptCacheSingleton; } });
|
|
20
20
|
// Update using yarn bump-version
|
|
21
|
-
exports.__version__ = "0.5.
|
|
21
|
+
exports.__version__ = "0.5.5";
|
package/dist/index.d.ts
CHANGED
|
@@ -5,4 +5,4 @@ export { overrideFetchImplementation } from "./singletons/fetch.js";
|
|
|
5
5
|
export { getDefaultProjectName } from "./utils/project.js";
|
|
6
6
|
export { uuid7, uuid7FromTime } from "./uuid.js";
|
|
7
7
|
export { Cache, PromptCache, type CacheConfig, type CacheMetrics, configureGlobalPromptCache, promptCacheSingleton, } from "./utils/prompt_cache/index.js";
|
|
8
|
-
export declare const __version__ = "0.5.
|
|
8
|
+
export declare const __version__ = "0.5.5";
|
package/dist/index.js
CHANGED
|
@@ -5,4 +5,4 @@ export { getDefaultProjectName } from "./utils/project.js";
|
|
|
5
5
|
export { uuid7, uuid7FromTime } from "./uuid.js";
|
|
6
6
|
export { Cache, PromptCache, configureGlobalPromptCache, promptCacheSingleton, } from "./utils/prompt_cache/index.js";
|
|
7
7
|
// Update using yarn bump-version
|
|
8
|
-
export const __version__ = "0.5.
|
|
8
|
+
export const __version__ = "0.5.5";
|
package/dist/traceable.cjs
CHANGED
|
@@ -236,7 +236,7 @@ const handleRunAttachments = (rawInputs, extractAttachments) => {
|
|
|
236
236
|
};
|
|
237
237
|
const getTracingRunTree = (runTree, inputs, getInvocationParams, processInputs, extractAttachments) => {
|
|
238
238
|
if (!(0, env_js_1.isTracingEnabled)(runTree.tracingEnabled)) {
|
|
239
|
-
return {};
|
|
239
|
+
return { tracingEnabled: runTree.tracingEnabled };
|
|
240
240
|
}
|
|
241
241
|
const [attached, args] = handleRunAttachments(inputs, extractAttachments);
|
|
242
242
|
runTree.attachments = attached;
|
|
@@ -568,7 +568,18 @@ function traceable(wrappedFunc, config) {
|
|
|
568
568
|
}
|
|
569
569
|
return [currentRunTree, processedArgs];
|
|
570
570
|
}
|
|
571
|
-
|
|
571
|
+
// If the parent context explicitly disabled tracing and the child
|
|
572
|
+
// didn't override it, propagate the tracingEnabled setting so that
|
|
573
|
+
// child runs inside a traceable({ tracingEnabled: false }) wrapper
|
|
574
|
+
// also have tracing disabled.
|
|
575
|
+
const childConfig = ensuredConfig.tracingEnabled === undefined &&
|
|
576
|
+
prevRunFromStore?.tracingEnabled !== undefined
|
|
577
|
+
? {
|
|
578
|
+
...ensuredConfig,
|
|
579
|
+
tracingEnabled: prevRunFromStore.tracingEnabled,
|
|
580
|
+
}
|
|
581
|
+
: ensuredConfig;
|
|
582
|
+
const currentRunTree = getTracingRunTree(new run_trees_js_1.RunTree(childConfig), processedArgs, config?.getInvocationParams, processInputsFn, extractAttachmentsFn);
|
|
572
583
|
if (lc_contextVars) {
|
|
573
584
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
574
585
|
(currentRunTree ?? {})[constants_js_1._LC_CONTEXT_VARIABLES_KEY] =
|
package/dist/traceable.js
CHANGED
|
@@ -232,7 +232,7 @@ const handleRunAttachments = (rawInputs, extractAttachments) => {
|
|
|
232
232
|
};
|
|
233
233
|
const getTracingRunTree = (runTree, inputs, getInvocationParams, processInputs, extractAttachments) => {
|
|
234
234
|
if (!isTracingEnabled(runTree.tracingEnabled)) {
|
|
235
|
-
return {};
|
|
235
|
+
return { tracingEnabled: runTree.tracingEnabled };
|
|
236
236
|
}
|
|
237
237
|
const [attached, args] = handleRunAttachments(inputs, extractAttachments);
|
|
238
238
|
runTree.attachments = attached;
|
|
@@ -564,7 +564,18 @@ export function traceable(wrappedFunc, config) {
|
|
|
564
564
|
}
|
|
565
565
|
return [currentRunTree, processedArgs];
|
|
566
566
|
}
|
|
567
|
-
|
|
567
|
+
// If the parent context explicitly disabled tracing and the child
|
|
568
|
+
// didn't override it, propagate the tracingEnabled setting so that
|
|
569
|
+
// child runs inside a traceable({ tracingEnabled: false }) wrapper
|
|
570
|
+
// also have tracing disabled.
|
|
571
|
+
const childConfig = ensuredConfig.tracingEnabled === undefined &&
|
|
572
|
+
prevRunFromStore?.tracingEnabled !== undefined
|
|
573
|
+
? {
|
|
574
|
+
...ensuredConfig,
|
|
575
|
+
tracingEnabled: prevRunFromStore.tracingEnabled,
|
|
576
|
+
}
|
|
577
|
+
: ensuredConfig;
|
|
578
|
+
const currentRunTree = getTracingRunTree(new RunTree(childConfig), processedArgs, config?.getInvocationParams, processInputsFn, extractAttachmentsFn);
|
|
568
579
|
if (lc_contextVars) {
|
|
569
580
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
570
581
|
(currentRunTree ?? {})[_LC_CONTEXT_VARIABLES_KEY] =
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "langsmith",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.5",
|
|
4
4
|
"description": "Client library to connect to the LangSmith Observability and Evaluation Platform.",
|
|
5
5
|
"packageManager": "yarn@1.22.19",
|
|
6
6
|
"files": [
|
|
@@ -146,7 +146,7 @@
|
|
|
146
146
|
"homepage": "https://github.com/langchain-ai/langsmith-sdk#readme",
|
|
147
147
|
"dependencies": {
|
|
148
148
|
"@types/uuid": "^10.0.0",
|
|
149
|
-
"chalk": "^
|
|
149
|
+
"chalk": "^5.6.2",
|
|
150
150
|
"console-table-printer": "^2.12.1",
|
|
151
151
|
"p-queue": "^6.6.2",
|
|
152
152
|
"semver": "^7.6.3",
|
|
@@ -162,13 +162,13 @@
|
|
|
162
162
|
"@babel/preset-env": "^7.22.4",
|
|
163
163
|
"@faker-js/faker": "^8.4.1",
|
|
164
164
|
"@jest/globals": "^29.5.0",
|
|
165
|
-
"@jest/reporters": "^
|
|
165
|
+
"@jest/reporters": "^30.2.0",
|
|
166
166
|
"@langchain/core": "^0.3.72",
|
|
167
167
|
"@langchain/langgraph": "^0.3.6",
|
|
168
168
|
"@langchain/openai": "^0.5.16",
|
|
169
169
|
"@opentelemetry/api": "^1.9.0",
|
|
170
170
|
"@opentelemetry/auto-instrumentations-node": "^0.69.0",
|
|
171
|
-
"@opentelemetry/sdk-node": "^0.
|
|
171
|
+
"@opentelemetry/sdk-node": "^0.212.0",
|
|
172
172
|
"@opentelemetry/sdk-trace-base": "^2.0.0",
|
|
173
173
|
"@opentelemetry/sdk-trace-node": "^2.0.0",
|
|
174
174
|
"@tsconfig/recommended": "^1.0.2",
|