langsmith 0.3.16 → 0.3.17

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
@@ -8,4 +8,4 @@ Object.defineProperty(exports, "RunTree", { enumerable: true, get: function () {
8
8
  var fetch_js_1 = require("./singletons/fetch.cjs");
9
9
  Object.defineProperty(exports, "overrideFetchImplementation", { enumerable: true, get: function () { return fetch_js_1.overrideFetchImplementation; } });
10
10
  // Update using yarn bump-version
11
- exports.__version__ = "0.3.16";
11
+ exports.__version__ = "0.3.17";
package/dist/index.d.ts CHANGED
@@ -2,4 +2,4 @@ export { Client, type ClientConfig, type LangSmithTracingClientInterface, } from
2
2
  export type { Dataset, Example, TracerSession, Run, Feedback, RetrieverOutput, } from "./schemas.js";
3
3
  export { RunTree, type RunTreeConfig } from "./run_trees.js";
4
4
  export { overrideFetchImplementation } from "./singletons/fetch.js";
5
- export declare const __version__ = "0.3.16";
5
+ export declare const __version__ = "0.3.17";
package/dist/index.js CHANGED
@@ -2,4 +2,4 @@ export { Client, } from "./client.js";
2
2
  export { RunTree } from "./run_trees.js";
3
3
  export { overrideFetchImplementation } from "./singletons/fetch.js";
4
4
  // Update using yarn bump-version
5
- export const __version__ = "0.3.16";
5
+ export const __version__ = "0.3.17";
@@ -56,7 +56,7 @@ function convertToDottedOrderFormat(epoch, runId, executionOrder = 1) {
56
56
  * Baggage header information
57
57
  */
58
58
  class Baggage {
59
- constructor(metadata, tags) {
59
+ constructor(metadata, tags, project_name) {
60
60
  Object.defineProperty(this, "metadata", {
61
61
  enumerable: true,
62
62
  configurable: true,
@@ -69,13 +69,21 @@ class Baggage {
69
69
  writable: true,
70
70
  value: void 0
71
71
  });
72
+ Object.defineProperty(this, "project_name", {
73
+ enumerable: true,
74
+ configurable: true,
75
+ writable: true,
76
+ value: void 0
77
+ });
72
78
  this.metadata = metadata;
73
79
  this.tags = tags;
80
+ this.project_name = project_name;
74
81
  }
75
82
  static fromHeader(value) {
76
83
  const items = value.split(",");
77
84
  let metadata = {};
78
85
  let tags = [];
86
+ let project_name;
79
87
  for (const item of items) {
80
88
  const [key, uriValue] = item.split("=");
81
89
  const value = decodeURIComponent(uriValue);
@@ -85,8 +93,11 @@ class Baggage {
85
93
  else if (key === "langsmith-tags") {
86
94
  tags = value.split(",");
87
95
  }
96
+ else if (key === "langsmith-project") {
97
+ project_name = value;
98
+ }
88
99
  }
89
- return new Baggage(metadata, tags);
100
+ return new Baggage(metadata, tags, project_name);
90
101
  }
91
102
  toHeader() {
92
103
  const items = [];
@@ -96,6 +107,9 @@ class Baggage {
96
107
  if (this.tags && this.tags.length > 0) {
97
108
  items.push(`langsmith-tags=${encodeURIComponent(this.tags.join(","))}`);
98
109
  }
110
+ if (this.project_name) {
111
+ items.push(`langsmith-project=${encodeURIComponent(this.project_name)}`);
112
+ }
99
113
  return items.join(",");
100
114
  }
101
115
  }
@@ -542,13 +556,14 @@ class RunTree {
542
556
  const baggage = Baggage.fromHeader(rawHeaders["baggage"]);
543
557
  config.metadata = baggage.metadata;
544
558
  config.tags = baggage.tags;
559
+ config.project_name = baggage.project_name;
545
560
  }
546
561
  return new RunTree(config);
547
562
  }
548
563
  toHeaders(headers) {
549
564
  const result = {
550
565
  "langsmith-trace": this.dotted_order,
551
- baggage: new Baggage(this.extra?.metadata, this.tags).toHeader(),
566
+ baggage: new Baggage(this.extra?.metadata, this.tags, this.project_name).toHeader(),
552
567
  };
553
568
  if (headers) {
554
569
  for (const [key, value] of Object.entries(result)) {
package/dist/run_trees.js CHANGED
@@ -17,7 +17,7 @@ export function convertToDottedOrderFormat(epoch, runId, executionOrder = 1) {
17
17
  * Baggage header information
18
18
  */
19
19
  class Baggage {
20
- constructor(metadata, tags) {
20
+ constructor(metadata, tags, project_name) {
21
21
  Object.defineProperty(this, "metadata", {
22
22
  enumerable: true,
23
23
  configurable: true,
@@ -30,13 +30,21 @@ class Baggage {
30
30
  writable: true,
31
31
  value: void 0
32
32
  });
33
+ Object.defineProperty(this, "project_name", {
34
+ enumerable: true,
35
+ configurable: true,
36
+ writable: true,
37
+ value: void 0
38
+ });
33
39
  this.metadata = metadata;
34
40
  this.tags = tags;
41
+ this.project_name = project_name;
35
42
  }
36
43
  static fromHeader(value) {
37
44
  const items = value.split(",");
38
45
  let metadata = {};
39
46
  let tags = [];
47
+ let project_name;
40
48
  for (const item of items) {
41
49
  const [key, uriValue] = item.split("=");
42
50
  const value = decodeURIComponent(uriValue);
@@ -46,8 +54,11 @@ class Baggage {
46
54
  else if (key === "langsmith-tags") {
47
55
  tags = value.split(",");
48
56
  }
57
+ else if (key === "langsmith-project") {
58
+ project_name = value;
59
+ }
49
60
  }
50
- return new Baggage(metadata, tags);
61
+ return new Baggage(metadata, tags, project_name);
51
62
  }
52
63
  toHeader() {
53
64
  const items = [];
@@ -57,6 +68,9 @@ class Baggage {
57
68
  if (this.tags && this.tags.length > 0) {
58
69
  items.push(`langsmith-tags=${encodeURIComponent(this.tags.join(","))}`);
59
70
  }
71
+ if (this.project_name) {
72
+ items.push(`langsmith-project=${encodeURIComponent(this.project_name)}`);
73
+ }
60
74
  return items.join(",");
61
75
  }
62
76
  }
@@ -503,13 +517,14 @@ export class RunTree {
503
517
  const baggage = Baggage.fromHeader(rawHeaders["baggage"]);
504
518
  config.metadata = baggage.metadata;
505
519
  config.tags = baggage.tags;
520
+ config.project_name = baggage.project_name;
506
521
  }
507
522
  return new RunTree(config);
508
523
  }
509
524
  toHeaders(headers) {
510
525
  const result = {
511
526
  "langsmith-trace": this.dotted_order,
512
- baggage: new Baggage(this.extra?.metadata, this.tags).toHeader(),
527
+ baggage: new Baggage(this.extra?.metadata, this.tags, this.project_name).toHeader(),
513
528
  };
514
529
  if (headers) {
515
530
  for (const [key, value] of Object.entries(result)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "langsmith",
3
- "version": "0.3.16",
3
+ "version": "0.3.17",
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": [