langsmith 0.5.10 → 0.5.11

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
@@ -2476,7 +2476,7 @@ class Client {
2476
2476
  const body = {
2477
2477
  name,
2478
2478
  description,
2479
- extra: metadata ? { metadata } : undefined,
2479
+ extra: { source: "sdk", ...(metadata ? { metadata } : {}) },
2480
2480
  };
2481
2481
  if (dataType) {
2482
2482
  body.data_type = dataType;
package/dist/client.js CHANGED
@@ -2438,7 +2438,7 @@ export class Client {
2438
2438
  const body = {
2439
2439
  name,
2440
2440
  description,
2441
- extra: metadata ? { metadata } : undefined,
2441
+ extra: { source: "sdk", ...(metadata ? { metadata } : {}) },
2442
2442
  };
2443
2443
  if (dataType) {
2444
2444
  body.data_type = dataType;
@@ -1,19 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.wrapClaudeAgentSDK = wrapClaudeAgentSDK;
4
- const module_1 = require("module");
5
4
  const traceable_js_1 = require("../../traceable.cjs");
6
5
  const context_js_1 = require("./context.cjs");
7
6
  const messages_js_1 = require("./messages.cjs");
8
- function _getPackageVersion(packageName) {
9
- try {
10
- const req = (0, module_1.createRequire)(process.cwd() + "/package.json");
11
- return req(`${packageName}/package.json`).version;
12
- }
13
- catch {
14
- return undefined;
15
- }
16
- }
17
7
  /**
18
8
  * Wraps the Claude Agent SDK's query function to add LangSmith tracing.
19
9
  * Traces the entire agent interaction including all streaming messages.
@@ -120,11 +110,7 @@ function wrapClaudeAgentQuery(queryFn, defaultThis, baseConfig) {
120
110
  name: "claude.conversation",
121
111
  run_type: "chain",
122
112
  ...baseConfig,
123
- metadata: {
124
- ls_integration: "claude-agent-sdk",
125
- ls_integration_version: _getPackageVersion("@anthropic-ai/claude-agent-sdk"),
126
- ...baseConfig?.metadata,
127
- },
113
+ metadata: { ...baseConfig?.metadata },
128
114
  __deferredSerializableArgOptions: { maxDepth: 1 },
129
115
  processInputs,
130
116
  processOutputs,
@@ -1,16 +1,6 @@
1
- import { createRequire } from "module";
2
1
  import { traceable, isTraceableFunction } from "../../traceable.js";
3
2
  import { StreamManager } from "./context.js";
4
3
  import { convertFromAnthropicMessage } from "./messages.js";
5
- function _getPackageVersion(packageName) {
6
- try {
7
- const req = createRequire(process.cwd() + "/package.json");
8
- return req(`${packageName}/package.json`).version;
9
- }
10
- catch {
11
- return undefined;
12
- }
13
- }
14
4
  /**
15
5
  * Wraps the Claude Agent SDK's query function to add LangSmith tracing.
16
6
  * Traces the entire agent interaction including all streaming messages.
@@ -117,11 +107,7 @@ function wrapClaudeAgentQuery(queryFn, defaultThis, baseConfig) {
117
107
  name: "claude.conversation",
118
108
  run_type: "chain",
119
109
  ...baseConfig,
120
- metadata: {
121
- ls_integration: "claude-agent-sdk",
122
- ls_integration_version: _getPackageVersion("@anthropic-ai/claude-agent-sdk"),
123
- ...baseConfig?.metadata,
124
- },
110
+ metadata: { ...baseConfig?.metadata },
125
111
  __deferredSerializableArgOptions: { maxDepth: 1 },
126
112
  processInputs,
127
113
  processOutputs,
@@ -1,16 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.convertMessageToTracedFormat = exports.wrapAISDK = exports.createLangSmithProviderOptions = void 0;
4
- const module_1 = require("module");
5
- function _getPackageVersion(packageName) {
6
- try {
7
- const req = (0, module_1.createRequire)(process.cwd() + "/package.json");
8
- return req(`${packageName}/package.json`).version;
9
- }
10
- catch {
11
- return undefined;
12
- }
13
- }
14
4
  const middleware_js_1 = require("./middleware.cjs");
15
5
  const utils_js_1 = require("./utils.cjs");
16
6
  Object.defineProperty(exports, "convertMessageToTracedFormat", { enumerable: true, get: function () { return utils_js_1.convertMessageToTracedFormat; } });
@@ -315,14 +305,6 @@ exports.createLangSmithProviderOptions = createLangSmithProviderOptions;
315
305
  * @returns returns.streamObject - Wrapped streamObject function that traces calls to LangSmith
316
306
  */
317
307
  const wrapAISDK = (ai, baseLsConfig) => {
318
- const _baseLsConfig = {
319
- ...baseLsConfig,
320
- metadata: {
321
- ls_integration: "vercel-ai-sdk",
322
- ls_integration_version: _getPackageVersion("ai"),
323
- ...baseLsConfig?.metadata,
324
- },
325
- };
326
308
  /**
327
309
  * Wrapped version of AI SDK's generateText with LangSmith tracing.
328
310
  *
@@ -344,7 +326,7 @@ const wrapAISDK = (ai, baseLsConfig) => {
344
326
  const wrappedGenerateText = async (...args) => {
345
327
  const params = args[0];
346
328
  const { langsmith: runtimeLsConfig, ...providerOptions } = params.providerOptions ?? {};
347
- const { resolvedLsConfig, resolvedChildLLMRunConfig, resolvedToolConfig } = _resolveConfigs(_baseLsConfig, runtimeLsConfig);
329
+ const { resolvedLsConfig, resolvedChildLLMRunConfig, resolvedToolConfig } = _resolveConfigs(baseLsConfig, runtimeLsConfig);
348
330
  const hasExplicitOutput = "output" in params;
349
331
  const hasExplicitExperimentalOutput = "experimental_output" in params;
350
332
  const traceableFunc = (0, traceable_js_1.traceable)(async (...args) => {
@@ -396,7 +378,7 @@ const wrapAISDK = (ai, baseLsConfig) => {
396
378
  wrappedGenerateObject = async (...args) => {
397
379
  const params = args[0];
398
380
  const { langsmith: runtimeLsConfig, ...providerOptions } = params.providerOptions ?? {};
399
- const { resolvedLsConfig, resolvedChildLLMRunConfig } = _resolveConfigs(_baseLsConfig, runtimeLsConfig);
381
+ const { resolvedLsConfig, resolvedChildLLMRunConfig } = _resolveConfigs(baseLsConfig, runtimeLsConfig);
400
382
  const traceableFunc = (0, traceable_js_1.traceable)(async (...args) => {
401
383
  const [params, ...rest] = args;
402
384
  const wrappedModel = ai.wrapLanguageModel({
@@ -464,7 +446,7 @@ const wrapAISDK = (ai, baseLsConfig) => {
464
446
  const wrappedStreamText = (...args) => {
465
447
  const params = args[0];
466
448
  const { langsmith: runtimeLsConfig, ...providerOptions } = params.providerOptions ?? {};
467
- const { resolvedLsConfig, resolvedChildLLMRunConfig, resolvedToolConfig } = _resolveConfigs(_baseLsConfig, runtimeLsConfig);
449
+ const { resolvedLsConfig, resolvedChildLLMRunConfig, resolvedToolConfig } = _resolveConfigs(baseLsConfig, runtimeLsConfig);
468
450
  const hasExplicitOutput = "output" in params;
469
451
  const hasExplicitExperimentalOutput = "experimental_output" in params;
470
452
  const traceableFunc = (0, traceable_js_1.traceable)((...args) => {
@@ -517,7 +499,7 @@ const wrapAISDK = (ai, baseLsConfig) => {
517
499
  wrappedStreamObject = (...args) => {
518
500
  const params = args[0];
519
501
  const { langsmith: runtimeLsConfig, ...providerOptions } = params.providerOptions ?? {};
520
- const { resolvedLsConfig, resolvedChildLLMRunConfig } = _resolveConfigs(_baseLsConfig, runtimeLsConfig);
502
+ const { resolvedLsConfig, resolvedChildLLMRunConfig } = _resolveConfigs(baseLsConfig, runtimeLsConfig);
521
503
  const traceableFunc = (0, traceable_js_1.traceable)((...args) => {
522
504
  const [params, ...rest] = args;
523
505
  const wrappedModel = ai.wrapLanguageModel({
@@ -581,7 +563,7 @@ const wrapAISDK = (ai, baseLsConfig) => {
581
563
  construct(ToolLoopAgent, args) {
582
564
  const params = args[0] ?? {};
583
565
  const { langsmith: runtimeLsConfig } = params.providerOptions ?? {};
584
- const { resolvedLsConfig, resolvedChildLLMRunConfig, resolvedToolConfig, } = _resolveConfigs(_baseLsConfig, runtimeLsConfig);
566
+ const { resolvedLsConfig, resolvedChildLLMRunConfig, resolvedToolConfig, } = _resolveConfigs(baseLsConfig, runtimeLsConfig);
585
567
  let wrappedModel = params.model;
586
568
  if (wrappedModel != null) {
587
569
  wrappedModel = ai.wrapLanguageModel({
@@ -1,13 +1,3 @@
1
- import { createRequire } from "module";
2
- function _getPackageVersion(packageName) {
3
- try {
4
- const req = createRequire(process.cwd() + "/package.json");
5
- return req(`${packageName}/package.json`).version;
6
- }
7
- catch {
8
- return undefined;
9
- }
10
- }
11
1
  import { LangSmithMiddleware, } from "./middleware.js";
12
2
  import { convertMessageToTracedFormat } from "./utils.js";
13
3
  import { isTraceableFunction, traceable } from "../../traceable.js";
@@ -310,14 +300,6 @@ export const createLangSmithProviderOptions = (lsConfig) => {
310
300
  * @returns returns.streamObject - Wrapped streamObject function that traces calls to LangSmith
311
301
  */
312
302
  const wrapAISDK = (ai, baseLsConfig) => {
313
- const _baseLsConfig = {
314
- ...baseLsConfig,
315
- metadata: {
316
- ls_integration: "vercel-ai-sdk",
317
- ls_integration_version: _getPackageVersion("ai"),
318
- ...baseLsConfig?.metadata,
319
- },
320
- };
321
303
  /**
322
304
  * Wrapped version of AI SDK's generateText with LangSmith tracing.
323
305
  *
@@ -339,7 +321,7 @@ const wrapAISDK = (ai, baseLsConfig) => {
339
321
  const wrappedGenerateText = async (...args) => {
340
322
  const params = args[0];
341
323
  const { langsmith: runtimeLsConfig, ...providerOptions } = params.providerOptions ?? {};
342
- const { resolvedLsConfig, resolvedChildLLMRunConfig, resolvedToolConfig } = _resolveConfigs(_baseLsConfig, runtimeLsConfig);
324
+ const { resolvedLsConfig, resolvedChildLLMRunConfig, resolvedToolConfig } = _resolveConfigs(baseLsConfig, runtimeLsConfig);
343
325
  const hasExplicitOutput = "output" in params;
344
326
  const hasExplicitExperimentalOutput = "experimental_output" in params;
345
327
  const traceableFunc = traceable(async (...args) => {
@@ -391,7 +373,7 @@ const wrapAISDK = (ai, baseLsConfig) => {
391
373
  wrappedGenerateObject = async (...args) => {
392
374
  const params = args[0];
393
375
  const { langsmith: runtimeLsConfig, ...providerOptions } = params.providerOptions ?? {};
394
- const { resolvedLsConfig, resolvedChildLLMRunConfig } = _resolveConfigs(_baseLsConfig, runtimeLsConfig);
376
+ const { resolvedLsConfig, resolvedChildLLMRunConfig } = _resolveConfigs(baseLsConfig, runtimeLsConfig);
395
377
  const traceableFunc = traceable(async (...args) => {
396
378
  const [params, ...rest] = args;
397
379
  const wrappedModel = ai.wrapLanguageModel({
@@ -459,7 +441,7 @@ const wrapAISDK = (ai, baseLsConfig) => {
459
441
  const wrappedStreamText = (...args) => {
460
442
  const params = args[0];
461
443
  const { langsmith: runtimeLsConfig, ...providerOptions } = params.providerOptions ?? {};
462
- const { resolvedLsConfig, resolvedChildLLMRunConfig, resolvedToolConfig } = _resolveConfigs(_baseLsConfig, runtimeLsConfig);
444
+ const { resolvedLsConfig, resolvedChildLLMRunConfig, resolvedToolConfig } = _resolveConfigs(baseLsConfig, runtimeLsConfig);
463
445
  const hasExplicitOutput = "output" in params;
464
446
  const hasExplicitExperimentalOutput = "experimental_output" in params;
465
447
  const traceableFunc = traceable((...args) => {
@@ -512,7 +494,7 @@ const wrapAISDK = (ai, baseLsConfig) => {
512
494
  wrappedStreamObject = (...args) => {
513
495
  const params = args[0];
514
496
  const { langsmith: runtimeLsConfig, ...providerOptions } = params.providerOptions ?? {};
515
- const { resolvedLsConfig, resolvedChildLLMRunConfig } = _resolveConfigs(_baseLsConfig, runtimeLsConfig);
497
+ const { resolvedLsConfig, resolvedChildLLMRunConfig } = _resolveConfigs(baseLsConfig, runtimeLsConfig);
516
498
  const traceableFunc = traceable((...args) => {
517
499
  const [params, ...rest] = args;
518
500
  const wrappedModel = ai.wrapLanguageModel({
@@ -576,7 +558,7 @@ const wrapAISDK = (ai, baseLsConfig) => {
576
558
  construct(ToolLoopAgent, args) {
577
559
  const params = args[0] ?? {};
578
560
  const { langsmith: runtimeLsConfig } = params.providerOptions ?? {};
579
- const { resolvedLsConfig, resolvedChildLLMRunConfig, resolvedToolConfig, } = _resolveConfigs(_baseLsConfig, runtimeLsConfig);
561
+ const { resolvedLsConfig, resolvedChildLLMRunConfig, resolvedToolConfig, } = _resolveConfigs(baseLsConfig, runtimeLsConfig);
580
562
  let wrappedModel = params.model;
581
563
  if (wrappedModel != null) {
582
564
  wrappedModel = ai.wrapLanguageModel({
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.10";
21
+ exports.__version__ = "0.5.11";
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.10";
8
+ export declare const __version__ = "0.5.11";
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.10";
8
+ export const __version__ = "0.5.11";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "langsmith",
3
- "version": "0.5.10",
3
+ "version": "0.5.11",
4
4
  "description": "Client library to connect to the LangSmith Observability and Evaluation Platform.",
5
5
  "packageManager": "yarn@1.22.19",
6
6
  "files": [