langsmith 0.8.4 → 0.8.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/client.cjs CHANGED
@@ -648,6 +648,12 @@ class Client {
648
648
  writable: true,
649
649
  value: void 0
650
650
  });
651
+ Object.defineProperty(this, "_stainlessVersionChecked", {
652
+ enumerable: true,
653
+ configurable: true,
654
+ writable: true,
655
+ value: false
656
+ });
651
657
  Object.defineProperty(this, "manualFlushMode", {
652
658
  enumerable: true,
653
659
  configurable: true,
@@ -975,27 +981,37 @@ class Client {
975
981
  return needsV1Prefix ? `/v1/platform/${path}` : `/platform/${path}`;
976
982
  }
977
983
  get evaluators() {
984
+ this._checkStainlessVersion();
978
985
  return this.openAPIClient.onlineEvaluators;
979
986
  }
980
987
  get runs() {
988
+ this._checkStainlessVersion();
981
989
  return this.openAPIClient.runs;
982
990
  }
983
991
  /** Access the v2 sandboxes resource (registries, snapshots, boxes). */
984
992
  get sandboxes() {
993
+ this._checkStainlessVersion();
985
994
  return this.openAPIClient.sandboxes;
986
995
  }
987
996
  /** Access the v2 datasets resource (experimentRuns, etc.). */
988
997
  get datasets() {
998
+ this._checkStainlessVersion();
989
999
  return this.openAPIClient.datasets;
990
1000
  }
991
1001
  /** Access the threads resource (query, stats, listTraces). */
992
1002
  get threads() {
1003
+ this._checkStainlessVersion();
993
1004
  return this.openAPIClient.threads;
994
1005
  }
995
1006
  /** Access the traces resource (query, listRuns). */
996
1007
  get traces() {
1008
+ this._checkStainlessVersion();
997
1009
  return this.openAPIClient.traces;
998
1010
  }
1011
+ /** Access the public shared-run resource. */
1012
+ get public() {
1013
+ return this.openAPIClient.public;
1014
+ }
999
1015
  async processInputs(inputs) {
1000
1016
  if (this.hideInputs === false) {
1001
1017
  return inputs;
@@ -1482,15 +1498,26 @@ class Client {
1482
1498
  }
1483
1499
  return json;
1484
1500
  }
1501
+ _checkStainlessVersion() {
1502
+ if (this._stainlessVersionChecked)
1503
+ return;
1504
+ this._stainlessVersionChecked = true;
1505
+ this._ensureServerInfo()
1506
+ .then((serverInfo) => {
1507
+ if (serverInfo?.version) {
1508
+ _checkBackendVersion(serverInfo.version);
1509
+ }
1510
+ })
1511
+ .catch(() => {
1512
+ // _ensureServerInfo handles and logs its own errors
1513
+ });
1514
+ }
1485
1515
  async _ensureServerInfo() {
1486
1516
  if (this._getServerInfoPromise === undefined) {
1487
1517
  this._getServerInfoPromise = (async () => {
1488
1518
  if (this._serverInfo === undefined) {
1489
1519
  try {
1490
1520
  this._serverInfo = await this._getServerInfo();
1491
- if (this._serverInfo?.version) {
1492
- _checkBackendVersion(this._serverInfo.version);
1493
- }
1494
1521
  }
1495
1522
  catch (e) {
1496
1523
  console.warn(`[LANGSMITH]: Failed to fetch info on supported operations. Falling back to batch operations and default limits. Info: ${e.status ?? "Unspecified status code"} ${e.message}`);
@@ -1506,6 +1533,10 @@ class Client {
1506
1533
  return serverInfo;
1507
1534
  });
1508
1535
  }
1536
+ async _supportsSDBQuery() {
1537
+ const serverInfo = await this._ensureServerInfo();
1538
+ return serverInfo.instance_flags?.sdb_query_enabled === true;
1539
+ }
1509
1540
  async _getSettings() {
1510
1541
  if (!this.settings) {
1511
1542
  this.settings = this._get("/settings");
@@ -2444,6 +2475,9 @@ class Client {
2444
2475
  ...(await Promise.all(projectNames.map((name) => this.readProject({ projectName: name }).then((project) => project.id)))),
2445
2476
  ];
2446
2477
  }
2478
+ if (projectIds_.length === 0) {
2479
+ throw new Error("At least one of projectNames or projectIds must be provided.");
2480
+ }
2447
2481
  const payload = {
2448
2482
  id,
2449
2483
  trace,
@@ -3827,7 +3861,7 @@ class Client {
3827
3861
  }
3828
3862
  return results_;
3829
3863
  }
3830
- async _logEvaluationFeedback(evaluatorResponse, run, sourceInfo) {
3864
+ async _logEvaluationFeedback(evaluatorResponse, run, sourceInfo, sessionId) {
3831
3865
  const evalResults = this._selectEvalResults(evaluatorResponse);
3832
3866
  const feedbacks = [];
3833
3867
  for (const res of evalResults) {
@@ -3851,14 +3885,20 @@ class Client {
3851
3885
  sourceRunId: res.sourceRunId,
3852
3886
  feedbackConfig: res.feedbackConfig,
3853
3887
  feedbackSourceType: "model",
3854
- sessionId: run?.session_id,
3888
+ sessionId: run?.session_id ?? sessionId,
3855
3889
  startTime: run?.start_time,
3856
3890
  }));
3857
3891
  }
3858
3892
  return [evalResults, feedbacks];
3859
3893
  }
3860
- async logEvaluationFeedback(evaluatorResponse, run, sourceInfo) {
3861
- const [results] = await this._logEvaluationFeedback(evaluatorResponse, run, sourceInfo);
3894
+ async logEvaluationFeedback(evaluatorResponseOrParams, run, sourceInfo, sessionId) {
3895
+ if (evaluatorResponseOrParams != null &&
3896
+ typeof evaluatorResponseOrParams === "object" &&
3897
+ "evaluatorResponse" in evaluatorResponseOrParams) {
3898
+ const [results] = await this._logEvaluationFeedback(evaluatorResponseOrParams.evaluatorResponse, evaluatorResponseOrParams.run, evaluatorResponseOrParams.sourceInfo, evaluatorResponseOrParams.projectId);
3899
+ return results;
3900
+ }
3901
+ const [results] = await this._logEvaluationFeedback(evaluatorResponseOrParams, run, sourceInfo, sessionId);
3862
3902
  return results;
3863
3903
  }
3864
3904
  /**
package/dist/client.d.ts CHANGED
@@ -9,6 +9,7 @@ import { Sandboxes } from "./_openapi_client/resources/sandboxes/sandboxes.js";
9
9
  import { Datasets } from "./_openapi_client/resources/datasets/datasets.js";
10
10
  import { Threads } from "./_openapi_client/resources/threads.js";
11
11
  import { Traces } from "./_openapi_client/resources/traces.js";
12
+ import { Public } from "./_openapi_client/resources/public/public.js";
12
13
  import { PromptCache } from "./utils/prompt_cache/index.js";
13
14
  import { ProfileAuth } from "./utils/profiles.js";
14
15
  export interface ClientConfig {
@@ -461,6 +462,7 @@ export declare class Client implements LangSmithTracingClientInterface {
461
462
  private traceBatchConcurrency;
462
463
  private _serverInfo;
463
464
  private _getServerInfoPromise?;
465
+ private _stainlessVersionChecked;
464
466
  private manualFlushMode;
465
467
  private _serializeWorker?;
466
468
  /**
@@ -528,6 +530,8 @@ export declare class Client implements LangSmithTracingClientInterface {
528
530
  get threads(): Threads;
529
531
  /** Access the traces resource (query, listRuns). */
530
532
  get traces(): Traces;
533
+ /** Access the public shared-run resource. */
534
+ get public(): Public;
531
535
  private processInputs;
532
536
  private processOutputs;
533
537
  private processMetadata;
@@ -580,7 +584,9 @@ export declare class Client implements LangSmithTracingClientInterface {
580
584
  private _sendBatchToOTELTranslator;
581
585
  private processRunOperation;
582
586
  protected _getServerInfo(): Promise<any>;
587
+ private _checkStainlessVersion;
583
588
  protected _ensureServerInfo(): Promise<Record<string, any>>;
589
+ _supportsSDBQuery(): Promise<boolean>;
584
590
  protected _getSettings(): Promise<LangSmithSettings>;
585
591
  /**
586
592
  * Flushes current queued traces.
@@ -1027,10 +1033,19 @@ export declare class Client implements LangSmithTracingClientInterface {
1027
1033
  _selectEvalResults(results: EvaluationResult | EvaluationResult[] | EvaluationResults): Array<EvaluationResult>;
1028
1034
  _logEvaluationFeedback(evaluatorResponse: EvaluationResult | EvaluationResult[] | EvaluationResults, run?: Run, sourceInfo?: {
1029
1035
  [key: string]: any;
1030
- }): Promise<[results: EvaluationResult[], feedbacks: Feedback[]]>;
1036
+ }, sessionId?: string): Promise<[results: EvaluationResult[], feedbacks: Feedback[]]>;
1037
+ logEvaluationFeedback(params: {
1038
+ evaluatorResponse: EvaluationResult | EvaluationResult[] | EvaluationResults;
1039
+ run: Run;
1040
+ projectId: string;
1041
+ sourceInfo?: {
1042
+ [key: string]: any;
1043
+ };
1044
+ }): Promise<EvaluationResult[]>;
1045
+ /** @deprecated Pass all params within an object and populate projectId. */
1031
1046
  logEvaluationFeedback(evaluatorResponse: EvaluationResult | EvaluationResult[] | EvaluationResults, run?: Run, sourceInfo?: {
1032
1047
  [key: string]: any;
1033
- }): Promise<EvaluationResult[]>;
1048
+ }, sessionId?: string): Promise<EvaluationResult[]>;
1034
1049
  /**
1035
1050
  * API for managing feedback configs
1036
1051
  */
package/dist/client.js CHANGED
@@ -609,6 +609,12 @@ export class Client {
609
609
  writable: true,
610
610
  value: void 0
611
611
  });
612
+ Object.defineProperty(this, "_stainlessVersionChecked", {
613
+ enumerable: true,
614
+ configurable: true,
615
+ writable: true,
616
+ value: false
617
+ });
612
618
  Object.defineProperty(this, "manualFlushMode", {
613
619
  enumerable: true,
614
620
  configurable: true,
@@ -936,27 +942,37 @@ export class Client {
936
942
  return needsV1Prefix ? `/v1/platform/${path}` : `/platform/${path}`;
937
943
  }
938
944
  get evaluators() {
945
+ this._checkStainlessVersion();
939
946
  return this.openAPIClient.onlineEvaluators;
940
947
  }
941
948
  get runs() {
949
+ this._checkStainlessVersion();
942
950
  return this.openAPIClient.runs;
943
951
  }
944
952
  /** Access the v2 sandboxes resource (registries, snapshots, boxes). */
945
953
  get sandboxes() {
954
+ this._checkStainlessVersion();
946
955
  return this.openAPIClient.sandboxes;
947
956
  }
948
957
  /** Access the v2 datasets resource (experimentRuns, etc.). */
949
958
  get datasets() {
959
+ this._checkStainlessVersion();
950
960
  return this.openAPIClient.datasets;
951
961
  }
952
962
  /** Access the threads resource (query, stats, listTraces). */
953
963
  get threads() {
964
+ this._checkStainlessVersion();
954
965
  return this.openAPIClient.threads;
955
966
  }
956
967
  /** Access the traces resource (query, listRuns). */
957
968
  get traces() {
969
+ this._checkStainlessVersion();
958
970
  return this.openAPIClient.traces;
959
971
  }
972
+ /** Access the public shared-run resource. */
973
+ get public() {
974
+ return this.openAPIClient.public;
975
+ }
960
976
  async processInputs(inputs) {
961
977
  if (this.hideInputs === false) {
962
978
  return inputs;
@@ -1443,15 +1459,26 @@ export class Client {
1443
1459
  }
1444
1460
  return json;
1445
1461
  }
1462
+ _checkStainlessVersion() {
1463
+ if (this._stainlessVersionChecked)
1464
+ return;
1465
+ this._stainlessVersionChecked = true;
1466
+ this._ensureServerInfo()
1467
+ .then((serverInfo) => {
1468
+ if (serverInfo?.version) {
1469
+ _checkBackendVersion(serverInfo.version);
1470
+ }
1471
+ })
1472
+ .catch(() => {
1473
+ // _ensureServerInfo handles and logs its own errors
1474
+ });
1475
+ }
1446
1476
  async _ensureServerInfo() {
1447
1477
  if (this._getServerInfoPromise === undefined) {
1448
1478
  this._getServerInfoPromise = (async () => {
1449
1479
  if (this._serverInfo === undefined) {
1450
1480
  try {
1451
1481
  this._serverInfo = await this._getServerInfo();
1452
- if (this._serverInfo?.version) {
1453
- _checkBackendVersion(this._serverInfo.version);
1454
- }
1455
1482
  }
1456
1483
  catch (e) {
1457
1484
  console.warn(`[LANGSMITH]: Failed to fetch info on supported operations. Falling back to batch operations and default limits. Info: ${e.status ?? "Unspecified status code"} ${e.message}`);
@@ -1467,6 +1494,10 @@ export class Client {
1467
1494
  return serverInfo;
1468
1495
  });
1469
1496
  }
1497
+ async _supportsSDBQuery() {
1498
+ const serverInfo = await this._ensureServerInfo();
1499
+ return serverInfo.instance_flags?.sdb_query_enabled === true;
1500
+ }
1470
1501
  async _getSettings() {
1471
1502
  if (!this.settings) {
1472
1503
  this.settings = this._get("/settings");
@@ -2405,6 +2436,9 @@ export class Client {
2405
2436
  ...(await Promise.all(projectNames.map((name) => this.readProject({ projectName: name }).then((project) => project.id)))),
2406
2437
  ];
2407
2438
  }
2439
+ if (projectIds_.length === 0) {
2440
+ throw new Error("At least one of projectNames or projectIds must be provided.");
2441
+ }
2408
2442
  const payload = {
2409
2443
  id,
2410
2444
  trace,
@@ -3788,7 +3822,7 @@ export class Client {
3788
3822
  }
3789
3823
  return results_;
3790
3824
  }
3791
- async _logEvaluationFeedback(evaluatorResponse, run, sourceInfo) {
3825
+ async _logEvaluationFeedback(evaluatorResponse, run, sourceInfo, sessionId) {
3792
3826
  const evalResults = this._selectEvalResults(evaluatorResponse);
3793
3827
  const feedbacks = [];
3794
3828
  for (const res of evalResults) {
@@ -3812,14 +3846,20 @@ export class Client {
3812
3846
  sourceRunId: res.sourceRunId,
3813
3847
  feedbackConfig: res.feedbackConfig,
3814
3848
  feedbackSourceType: "model",
3815
- sessionId: run?.session_id,
3849
+ sessionId: run?.session_id ?? sessionId,
3816
3850
  startTime: run?.start_time,
3817
3851
  }));
3818
3852
  }
3819
3853
  return [evalResults, feedbacks];
3820
3854
  }
3821
- async logEvaluationFeedback(evaluatorResponse, run, sourceInfo) {
3822
- const [results] = await this._logEvaluationFeedback(evaluatorResponse, run, sourceInfo);
3855
+ async logEvaluationFeedback(evaluatorResponseOrParams, run, sourceInfo, sessionId) {
3856
+ if (evaluatorResponseOrParams != null &&
3857
+ typeof evaluatorResponseOrParams === "object" &&
3858
+ "evaluatorResponse" in evaluatorResponseOrParams) {
3859
+ const [results] = await this._logEvaluationFeedback(evaluatorResponseOrParams.evaluatorResponse, evaluatorResponseOrParams.run, evaluatorResponseOrParams.sourceInfo, evaluatorResponseOrParams.projectId);
3860
+ return results;
3861
+ }
3862
+ const [results] = await this._logEvaluationFeedback(evaluatorResponseOrParams, run, sourceInfo, sessionId);
3823
3863
  return results;
3824
3864
  }
3825
3865
  /**
@@ -342,6 +342,8 @@ class _ExperimentManager {
342
342
  experiment: project,
343
343
  metadata: this._metadata,
344
344
  client: this.client,
345
+ runs: this._runs,
346
+ _runsArray: this._runsArray,
345
347
  evaluationResults: this._evaluationResults,
346
348
  summaryResults: this._summaryResults,
347
349
  numRepetitions: this._numRepetitions,
@@ -542,7 +544,11 @@ class _ExperimentManager {
542
544
  tracingEnabled: true,
543
545
  };
544
546
  const evaluatorResponse = await evaluator.evaluateRun(run, example, options);
545
- evaluationResults.results.push(...(await fields.client.logEvaluationFeedback(evaluatorResponse, run)));
547
+ evaluationResults.results.push(...(await fields.client.logEvaluationFeedback({
548
+ evaluatorResponse,
549
+ run,
550
+ projectId: this._getExperiment().id,
551
+ })));
546
552
  }
547
553
  catch (e) {
548
554
  console.error(`Error running evaluator ${evaluator.evaluateRun.name} on run ${run.id}: ${e}`);
@@ -1049,7 +1055,12 @@ async function _resolveExperiment(experiment, runs, client) {
1049
1055
  const firstRun = await runsCloneIterator
1050
1056
  .next()
1051
1057
  .then((result) => result.value);
1052
- const retrievedExperiment = await client.readProject(firstRun.sessionId);
1058
+ if (firstRun?.session_id == null) {
1059
+ throw new Error("Experiment ID not found for provided runs.");
1060
+ }
1061
+ const retrievedExperiment = await client.readProject({
1062
+ projectId: firstRun.session_id,
1063
+ });
1053
1064
  if (!retrievedExperiment.name) {
1054
1065
  throw new Error("Experiment name not found for provided runs.");
1055
1066
  }
@@ -334,6 +334,8 @@ export class _ExperimentManager {
334
334
  experiment: project,
335
335
  metadata: this._metadata,
336
336
  client: this.client,
337
+ runs: this._runs,
338
+ _runsArray: this._runsArray,
337
339
  evaluationResults: this._evaluationResults,
338
340
  summaryResults: this._summaryResults,
339
341
  numRepetitions: this._numRepetitions,
@@ -534,7 +536,11 @@ export class _ExperimentManager {
534
536
  tracingEnabled: true,
535
537
  };
536
538
  const evaluatorResponse = await evaluator.evaluateRun(run, example, options);
537
- evaluationResults.results.push(...(await fields.client.logEvaluationFeedback(evaluatorResponse, run)));
539
+ evaluationResults.results.push(...(await fields.client.logEvaluationFeedback({
540
+ evaluatorResponse,
541
+ run,
542
+ projectId: this._getExperiment().id,
543
+ })));
538
544
  }
539
545
  catch (e) {
540
546
  console.error(`Error running evaluator ${evaluator.evaluateRun.name} on run ${run.id}: ${e}`);
@@ -1040,7 +1046,12 @@ async function _resolveExperiment(experiment, runs, client) {
1040
1046
  const firstRun = await runsCloneIterator
1041
1047
  .next()
1042
1048
  .then((result) => result.value);
1043
- const retrievedExperiment = await client.readProject(firstRun.sessionId);
1049
+ if (firstRun?.session_id == null) {
1050
+ throw new Error("Experiment ID not found for provided runs.");
1051
+ }
1052
+ const retrievedExperiment = await client.readProject({
1053
+ projectId: firstRun.session_id,
1054
+ });
1044
1055
  if (!retrievedExperiment.name) {
1045
1056
  throw new Error("Experiment name not found for provided runs.");
1046
1057
  }
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.loadTracesForExperiment = loadTracesForExperiment;
6
7
  exports.evaluateComparative = evaluateComparative;
7
8
  const index_js_1 = require("../utils/uuid/src/index.cjs");
8
9
  const index_js_2 = require("../index.cjs");
@@ -10,6 +11,7 @@ const shuffle_js_1 = require("../utils/shuffle.cjs");
10
11
  const async_caller_js_1 = require("../utils/async_caller.cjs");
11
12
  const index_js_3 = __importDefault(require("../utils/p-retry/index.cjs"));
12
13
  const traceable_js_1 = require("../traceable.cjs");
14
+ const v2_migration_js_1 = require("../utils/v2_migration.cjs");
13
15
  function isExperimentResultsList(value) {
14
16
  return value.some((x) => typeof x !== "string");
15
17
  }
@@ -17,11 +19,15 @@ async function loadExperiment(client, experiment) {
17
19
  const value = typeof experiment === "string" ? experiment : experiment.experimentName;
18
20
  return client.readProject((0, index_js_1.validate)(value) ? { projectId: value } : { projectName: value });
19
21
  }
20
- async function loadTraces(client, experiment, options) {
21
- const executionOrder = options.loadNested ? undefined : 1;
22
- const runs = await client.listRuns((0, index_js_1.validate)(experiment)
23
- ? { projectId: experiment, executionOrder }
24
- : { projectName: experiment, executionOrder });
22
+ async function loadTracesForExperiment(client, project, options) {
23
+ // v1 `/runs/query` returns 501 on SmithDB-only backends; use v2 when it's available.
24
+ const isRoot = options.loadNested ? undefined : true;
25
+ const runs = (await client._supportsSDBQuery())
26
+ ? await (0, v2_migration_js_1.loadTracesV2)(client, project, { isRoot })
27
+ : await client.listRuns({
28
+ projectId: project.id,
29
+ executionOrder: options.loadNested ? undefined : 1,
30
+ });
25
31
  const treeMap = {};
26
32
  const runIdMap = {};
27
33
  const results = [];
@@ -121,7 +127,9 @@ async function evaluateComparative(experiments, options) {
121
127
  if (viewUrl != null) {
122
128
  console.log(`View results at: ${viewUrl}`);
123
129
  }
124
- const experimentRuns = await Promise.all(projects.map((p) => loadTraces(client, p.id, { loadNested: !!options.loadNested })));
130
+ const experimentRuns = await Promise.all(projects.map((project) => loadTracesForExperiment(client, project, {
131
+ loadNested: !!options.loadNested,
132
+ })));
125
133
  let exampleIdsIntersect;
126
134
  for (const runs of experimentRuns) {
127
135
  const exampleIdsSet = new Set(runs
@@ -1,7 +1,10 @@
1
1
  import { Client } from "../index.js";
2
- import { ComparativeExperiment, ComparisonEvaluationResult as ComparisonEvaluationResultRow, Example, Run } from "../schemas.js";
2
+ import { ComparativeExperiment, ComparisonEvaluationResult as ComparisonEvaluationResultRow, Example, Run, TracerSession } from "../schemas.js";
3
3
  import { evaluate } from "./index.js";
4
4
  type ExperimentResults = Awaited<ReturnType<typeof evaluate>>;
5
+ export declare function loadTracesForExperiment(client: Client, project: TracerSession, options: {
6
+ loadNested: boolean;
7
+ }): Promise<Run[]>;
5
8
  /** @deprecated Use ComparativeEvaluatorNew instead: (args: { runs, example, inputs, outputs, referenceOutputs }) => ... */
6
9
  export type _ComparativeEvaluatorLegacy = (runs: Run[], example: Example) => ComparisonEvaluationResultRow | Promise<ComparisonEvaluationResultRow>;
7
10
  export type _ComparativeEvaluator = (args: {
@@ -4,6 +4,7 @@ import { shuffle } from "../utils/shuffle.js";
4
4
  import { AsyncCaller } from "../utils/async_caller.js";
5
5
  import pRetry from "../utils/p-retry/index.js";
6
6
  import { getCurrentRunTree, traceable } from "../traceable.js";
7
+ import { loadTracesV2 } from "../utils/v2_migration.js";
7
8
  function isExperimentResultsList(value) {
8
9
  return value.some((x) => typeof x !== "string");
9
10
  }
@@ -11,11 +12,15 @@ async function loadExperiment(client, experiment) {
11
12
  const value = typeof experiment === "string" ? experiment : experiment.experimentName;
12
13
  return client.readProject(validate(value) ? { projectId: value } : { projectName: value });
13
14
  }
14
- async function loadTraces(client, experiment, options) {
15
- const executionOrder = options.loadNested ? undefined : 1;
16
- const runs = await client.listRuns(validate(experiment)
17
- ? { projectId: experiment, executionOrder }
18
- : { projectName: experiment, executionOrder });
15
+ export async function loadTracesForExperiment(client, project, options) {
16
+ // v1 `/runs/query` returns 501 on SmithDB-only backends; use v2 when it's available.
17
+ const isRoot = options.loadNested ? undefined : true;
18
+ const runs = (await client._supportsSDBQuery())
19
+ ? await loadTracesV2(client, project, { isRoot })
20
+ : await client.listRuns({
21
+ projectId: project.id,
22
+ executionOrder: options.loadNested ? undefined : 1,
23
+ });
19
24
  const treeMap = {};
20
25
  const runIdMap = {};
21
26
  const results = [];
@@ -115,7 +120,9 @@ export async function evaluateComparative(experiments, options) {
115
120
  if (viewUrl != null) {
116
121
  console.log(`View results at: ${viewUrl}`);
117
122
  }
118
- const experimentRuns = await Promise.all(projects.map((p) => loadTraces(client, p.id, { loadNested: !!options.loadNested })));
123
+ const experimentRuns = await Promise.all(projects.map((project) => loadTracesForExperiment(client, project, {
124
+ loadNested: !!options.loadNested,
125
+ })));
119
126
  let exampleIdsIntersect;
120
127
  for (const runs of experimentRuns) {
121
128
  const exampleIdsSet = new Set(runs