langsmith 0.3.47 → 0.3.48

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
@@ -34,7 +34,7 @@ var __importStar = (this && this.__importStar) || (function () {
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.Client = exports.DEFAULT_BATCH_SIZE_LIMIT_BYTES = exports.AutoBatchQueue = void 0;
37
- exports.mergeRuntimeEnvIntoRunCreate = mergeRuntimeEnvIntoRunCreate;
37
+ exports.mergeRuntimeEnvIntoRun = mergeRuntimeEnvIntoRun;
38
38
  const uuid = __importStar(require("uuid"));
39
39
  const translator_js_1 = require("./experimental/otel/translator.cjs");
40
40
  const otel_js_1 = require("./singletons/otel.cjs");
@@ -48,7 +48,7 @@ const prompts_js_1 = require("./utils/prompts.cjs");
48
48
  const error_js_1 = require("./utils/error.cjs");
49
49
  const fetch_js_1 = require("./singletons/fetch.cjs");
50
50
  const index_js_2 = require("./utils/fast-safe-stringify/index.cjs");
51
- function mergeRuntimeEnvIntoRunCreate(run) {
51
+ function mergeRuntimeEnvIntoRun(run) {
52
52
  const runtimeEnv = (0, env_js_1.getRuntimeEnvironment)();
53
53
  const envVars = (0, env_js_1.getLangChainEnvVarsMetadata)();
54
54
  const extra = run.extra ?? {};
@@ -61,8 +61,11 @@ function mergeRuntimeEnvIntoRunCreate(run) {
61
61
  },
62
62
  metadata: {
63
63
  ...envVars,
64
- ...(envVars.revision_id || run.revision_id
65
- ? { revision_id: run.revision_id ?? envVars.revision_id }
64
+ ...(envVars.revision_id || ("revision_id" in run && run.revision_id)
65
+ ? {
66
+ revision_id: ("revision_id" in run ? run.revision_id : undefined) ??
67
+ envVars.revision_id,
68
+ }
66
69
  : {}),
67
70
  ...metadata,
68
71
  },
@@ -724,9 +727,7 @@ class Client {
724
727
  async processRunOperation(item) {
725
728
  clearTimeout(this.autoBatchTimeout);
726
729
  this.autoBatchTimeout = undefined;
727
- if (item.action === "create") {
728
- item.item = mergeRuntimeEnvIntoRunCreate(item.item);
729
- }
730
+ item.item = mergeRuntimeEnvIntoRun(item.item);
730
731
  const itemPromise = this.autoBatchQueue.push(item);
731
732
  if (this.manualFlushMode) {
732
733
  // Rely on manual flushing in serverless environments
@@ -833,7 +834,7 @@ class Client {
833
834
  }).catch(console.error);
834
835
  return;
835
836
  }
836
- const mergedRunCreateParam = mergeRuntimeEnvIntoRunCreate(runCreate);
837
+ const mergedRunCreateParam = mergeRuntimeEnvIntoRun(runCreate);
837
838
  if (options?.apiKey !== undefined) {
838
839
  headers["x-api-key"] = options.apiKey;
839
840
  }
package/dist/client.d.ts CHANGED
@@ -260,7 +260,7 @@ type Thread = {
260
260
  last_outputs: string;
261
261
  last_error: string | null;
262
262
  };
263
- export declare function mergeRuntimeEnvIntoRunCreate(run: RunCreate): RunCreate;
263
+ export declare function mergeRuntimeEnvIntoRun<T extends RunCreate | RunUpdate>(run: T): T;
264
264
  export declare class AutoBatchQueue {
265
265
  items: {
266
266
  action: "create" | "update";
package/dist/client.js CHANGED
@@ -11,7 +11,7 @@ import { parsePromptIdentifier } from "./utils/prompts.js";
11
11
  import { raiseForStatus } from "./utils/error.js";
12
12
  import { _globalFetchImplementationIsNodeFetch, _getFetchImplementation, } from "./singletons/fetch.js";
13
13
  import { serialize as serializePayloadForTracing } from "./utils/fast-safe-stringify/index.js";
14
- export function mergeRuntimeEnvIntoRunCreate(run) {
14
+ export function mergeRuntimeEnvIntoRun(run) {
15
15
  const runtimeEnv = getRuntimeEnvironment();
16
16
  const envVars = getLangChainEnvVarsMetadata();
17
17
  const extra = run.extra ?? {};
@@ -24,8 +24,11 @@ export function mergeRuntimeEnvIntoRunCreate(run) {
24
24
  },
25
25
  metadata: {
26
26
  ...envVars,
27
- ...(envVars.revision_id || run.revision_id
28
- ? { revision_id: run.revision_id ?? envVars.revision_id }
27
+ ...(envVars.revision_id || ("revision_id" in run && run.revision_id)
28
+ ? {
29
+ revision_id: ("revision_id" in run ? run.revision_id : undefined) ??
30
+ envVars.revision_id,
31
+ }
29
32
  : {}),
30
33
  ...metadata,
31
34
  },
@@ -686,9 +689,7 @@ export class Client {
686
689
  async processRunOperation(item) {
687
690
  clearTimeout(this.autoBatchTimeout);
688
691
  this.autoBatchTimeout = undefined;
689
- if (item.action === "create") {
690
- item.item = mergeRuntimeEnvIntoRunCreate(item.item);
691
- }
692
+ item.item = mergeRuntimeEnvIntoRun(item.item);
692
693
  const itemPromise = this.autoBatchQueue.push(item);
693
694
  if (this.manualFlushMode) {
694
695
  // Rely on manual flushing in serverless environments
@@ -795,7 +796,7 @@ export class Client {
795
796
  }).catch(console.error);
796
797
  return;
797
798
  }
798
- const mergedRunCreateParam = mergeRuntimeEnvIntoRunCreate(runCreate);
799
+ const mergedRunCreateParam = mergeRuntimeEnvIntoRun(runCreate);
799
800
  if (options?.apiKey !== undefined) {
800
801
  headers["x-api-key"] = options.apiKey;
801
802
  }
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.47";
13
+ exports.__version__ = "0.3.48";
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.47";
6
+ export declare const __version__ = "0.3.48";
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.47";
6
+ export const __version__ = "0.3.48";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "langsmith",
3
- "version": "0.3.47",
3
+ "version": "0.3.48",
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": [