langsmith 0.3.50 → 0.3.51

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
@@ -588,11 +588,11 @@ class Client {
588
588
  if (patch) {
589
589
  const sampled = [];
590
590
  for (const run of runs) {
591
- if (!this.filteredPostUuids.has(run.id)) {
591
+ if (!this.filteredPostUuids.has(run.trace_id)) {
592
592
  sampled.push(run);
593
593
  }
594
- else {
595
- this.filteredPostUuids.delete(run.id);
594
+ else if (run.id === run.trace_id) {
595
+ this.filteredPostUuids.delete(run.trace_id);
596
596
  }
597
597
  }
598
598
  return sampled;
package/dist/client.js CHANGED
@@ -550,11 +550,11 @@ export class Client {
550
550
  if (patch) {
551
551
  const sampled = [];
552
552
  for (const run of runs) {
553
- if (!this.filteredPostUuids.has(run.id)) {
553
+ if (!this.filteredPostUuids.has(run.trace_id)) {
554
554
  sampled.push(run);
555
555
  }
556
- else {
557
- this.filteredPostUuids.delete(run.id);
556
+ else if (run.id === run.trace_id) {
557
+ this.filteredPostUuids.delete(run.trace_id);
558
558
  }
559
559
  }
560
560
  return sampled;
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.50";
13
+ exports.__version__ = "0.3.51";
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.50";
6
+ export declare const __version__ = "0.3.51";
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.50";
6
+ export const __version__ = "0.3.51";
@@ -776,17 +776,62 @@ function _getWriteReplicasFromEnv() {
776
776
  return [];
777
777
  try {
778
778
  const parsed = JSON.parse(envVar);
779
- _checkEndpointEnvUnset(parsed);
780
- return Object.entries(parsed).map(([url, key]) => ({
781
- apiUrl: url.replace(/\/$/, ""),
782
- apiKey: key,
783
- }));
779
+ if (Array.isArray(parsed)) {
780
+ const replicas = [];
781
+ for (const item of parsed) {
782
+ if (typeof item !== "object" || item === null) {
783
+ console.warn(`Invalid item type in LANGSMITH_RUNS_ENDPOINTS: ` +
784
+ `expected object, got ${typeof item}`);
785
+ continue;
786
+ }
787
+ if (typeof item.api_url !== "string") {
788
+ console.warn(`Invalid api_url type in LANGSMITH_RUNS_ENDPOINTS: ` +
789
+ `expected string, got ${typeof item.api_url}`);
790
+ continue;
791
+ }
792
+ if (typeof item.api_key !== "string") {
793
+ console.warn(`Invalid api_key type in LANGSMITH_RUNS_ENDPOINTS: ` +
794
+ `expected string, got ${typeof item.api_key}`);
795
+ continue;
796
+ }
797
+ replicas.push({
798
+ apiUrl: item.api_url.replace(/\/$/, ""),
799
+ apiKey: item.api_key,
800
+ });
801
+ }
802
+ return replicas;
803
+ }
804
+ else if (typeof parsed === "object" && parsed !== null) {
805
+ _checkEndpointEnvUnset(parsed);
806
+ const replicas = [];
807
+ for (const [url, key] of Object.entries(parsed)) {
808
+ const cleanUrl = url.replace(/\/$/, "");
809
+ if (typeof key === "string") {
810
+ replicas.push({
811
+ apiUrl: cleanUrl,
812
+ apiKey: key,
813
+ });
814
+ }
815
+ else {
816
+ console.warn(`Invalid value type in LANGSMITH_RUNS_ENDPOINTS for URL ${url}: ` +
817
+ `expected string, got ${typeof key}`);
818
+ continue;
819
+ }
820
+ }
821
+ return replicas;
822
+ }
823
+ else {
824
+ console.warn("Invalid LANGSMITH_RUNS_ENDPOINTS – must be valid JSON array of " +
825
+ `objects with api_url and api_key properties, or object mapping url->apiKey, got ${typeof parsed}`);
826
+ return [];
827
+ }
784
828
  }
785
829
  catch (e) {
786
830
  if ((0, error_js_1.isConflictingEndpointsError)(e)) {
787
831
  throw e;
788
832
  }
789
- console.warn("Invalid LANGSMITH_RUNS_ENDPOINTS – must be valid JSON mapping of url->apiKey");
833
+ console.warn("Invalid LANGSMITH_RUNS_ENDPOINTS – must be valid JSON array of " +
834
+ "objects with api_url and api_key properties, or object mapping url->apiKey");
790
835
  return [];
791
836
  }
792
837
  }
package/dist/run_trees.js CHANGED
@@ -735,17 +735,62 @@ function _getWriteReplicasFromEnv() {
735
735
  return [];
736
736
  try {
737
737
  const parsed = JSON.parse(envVar);
738
- _checkEndpointEnvUnset(parsed);
739
- return Object.entries(parsed).map(([url, key]) => ({
740
- apiUrl: url.replace(/\/$/, ""),
741
- apiKey: key,
742
- }));
738
+ if (Array.isArray(parsed)) {
739
+ const replicas = [];
740
+ for (const item of parsed) {
741
+ if (typeof item !== "object" || item === null) {
742
+ console.warn(`Invalid item type in LANGSMITH_RUNS_ENDPOINTS: ` +
743
+ `expected object, got ${typeof item}`);
744
+ continue;
745
+ }
746
+ if (typeof item.api_url !== "string") {
747
+ console.warn(`Invalid api_url type in LANGSMITH_RUNS_ENDPOINTS: ` +
748
+ `expected string, got ${typeof item.api_url}`);
749
+ continue;
750
+ }
751
+ if (typeof item.api_key !== "string") {
752
+ console.warn(`Invalid api_key type in LANGSMITH_RUNS_ENDPOINTS: ` +
753
+ `expected string, got ${typeof item.api_key}`);
754
+ continue;
755
+ }
756
+ replicas.push({
757
+ apiUrl: item.api_url.replace(/\/$/, ""),
758
+ apiKey: item.api_key,
759
+ });
760
+ }
761
+ return replicas;
762
+ }
763
+ else if (typeof parsed === "object" && parsed !== null) {
764
+ _checkEndpointEnvUnset(parsed);
765
+ const replicas = [];
766
+ for (const [url, key] of Object.entries(parsed)) {
767
+ const cleanUrl = url.replace(/\/$/, "");
768
+ if (typeof key === "string") {
769
+ replicas.push({
770
+ apiUrl: cleanUrl,
771
+ apiKey: key,
772
+ });
773
+ }
774
+ else {
775
+ console.warn(`Invalid value type in LANGSMITH_RUNS_ENDPOINTS for URL ${url}: ` +
776
+ `expected string, got ${typeof key}`);
777
+ continue;
778
+ }
779
+ }
780
+ return replicas;
781
+ }
782
+ else {
783
+ console.warn("Invalid LANGSMITH_RUNS_ENDPOINTS – must be valid JSON array of " +
784
+ `objects with api_url and api_key properties, or object mapping url->apiKey, got ${typeof parsed}`);
785
+ return [];
786
+ }
743
787
  }
744
788
  catch (e) {
745
789
  if (isConflictingEndpointsError(e)) {
746
790
  throw e;
747
791
  }
748
- console.warn("Invalid LANGSMITH_RUNS_ENDPOINTS – must be valid JSON mapping of url->apiKey");
792
+ console.warn("Invalid LANGSMITH_RUNS_ENDPOINTS – must be valid JSON array of " +
793
+ "objects with api_url and api_key properties, or object mapping url->apiKey");
749
794
  return [];
750
795
  }
751
796
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "langsmith",
3
- "version": "0.3.50",
3
+ "version": "0.3.51",
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": [