langsmith 0.4.5 → 0.4.6

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/index.cjs CHANGED
@@ -15,4 +15,4 @@ Object.defineProperty(exports, "uuid7FromTime", { enumerable: true, get: functio
15
15
  var prompts_cache_js_1 = require("./utils/prompts_cache.cjs");
16
16
  Object.defineProperty(exports, "Cache", { enumerable: true, get: function () { return prompts_cache_js_1.Cache; } });
17
17
  // Update using yarn bump-version
18
- exports.__version__ = "0.4.5";
18
+ exports.__version__ = "0.4.6";
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, type CacheConfig, type CacheMetrics, } from "./utils/prompts_cache.js";
8
- export declare const __version__ = "0.4.5";
8
+ export declare const __version__ = "0.4.6";
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, } from "./utils/prompts_cache.js";
7
7
  // Update using yarn bump-version
8
- export const __version__ = "0.4.5";
8
+ export const __version__ = "0.4.6";
@@ -44,6 +44,20 @@ function convertToDottedOrderFormat(epoch, runId, executionOrder = 1) {
44
44
  microsecondPrecisionDatestring,
45
45
  };
46
46
  }
47
+ const HEADER_SAFE_REPLICA_FIELDS = new Set([
48
+ "projectName",
49
+ "updates",
50
+ "reroot",
51
+ ]);
52
+ function filterReplicaForHeaders(replica) {
53
+ const filtered = {};
54
+ for (const key of Object.keys(replica)) {
55
+ if (HEADER_SAFE_REPLICA_FIELDS.has(key)) {
56
+ filtered[key] = replica[key];
57
+ }
58
+ }
59
+ return filtered;
60
+ }
47
61
  /**
48
62
  * Baggage header information
49
63
  */
@@ -97,7 +111,13 @@ class Baggage {
97
111
  project_name = value;
98
112
  }
99
113
  else if (key === "langsmith-replicas") {
100
- replicas = JSON.parse(value);
114
+ const parsed = JSON.parse(value);
115
+ replicas = parsed.map((replica) => {
116
+ if (Array.isArray(replica)) {
117
+ return replica;
118
+ }
119
+ return filterReplicaForHeaders(replica);
120
+ });
101
121
  }
102
122
  }
103
123
  return new Baggage(metadata, tags, project_name, replicas);
package/dist/run_trees.js CHANGED
@@ -38,6 +38,20 @@ export function convertToDottedOrderFormat(epoch, runId, executionOrder = 1) {
38
38
  microsecondPrecisionDatestring,
39
39
  };
40
40
  }
41
+ const HEADER_SAFE_REPLICA_FIELDS = new Set([
42
+ "projectName",
43
+ "updates",
44
+ "reroot",
45
+ ]);
46
+ function filterReplicaForHeaders(replica) {
47
+ const filtered = {};
48
+ for (const key of Object.keys(replica)) {
49
+ if (HEADER_SAFE_REPLICA_FIELDS.has(key)) {
50
+ filtered[key] = replica[key];
51
+ }
52
+ }
53
+ return filtered;
54
+ }
41
55
  /**
42
56
  * Baggage header information
43
57
  */
@@ -91,7 +105,13 @@ class Baggage {
91
105
  project_name = value;
92
106
  }
93
107
  else if (key === "langsmith-replicas") {
94
- replicas = JSON.parse(value);
108
+ const parsed = JSON.parse(value);
109
+ replicas = parsed.map((replica) => {
110
+ if (Array.isArray(replica)) {
111
+ return replica;
112
+ }
113
+ return filterReplicaForHeaders(replica);
114
+ });
95
115
  }
96
116
  }
97
117
  return new Baggage(metadata, tags, project_name, replicas);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "langsmith",
3
- "version": "0.4.5",
3
+ "version": "0.4.6",
4
4
  "description": "Client library to connect to the LangSmith Observability and Evaluation Platform.",
5
5
  "packageManager": "yarn@1.22.19",
6
6
  "files": [