braintrust 0.0.97 → 0.0.98

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.js CHANGED
@@ -3648,7 +3648,6 @@ var require_pluralize = __commonJS({
3648
3648
  var src_exports = {};
3649
3649
  __export(src_exports, {
3650
3650
  BaseExperiment: () => BaseExperiment,
3651
- Dataset: () => Dataset,
3652
3651
  Eval: () => Eval,
3653
3652
  Experiment: () => Experiment,
3654
3653
  Logger: () => Logger,
@@ -3664,6 +3663,7 @@ __export(src_exports, {
3664
3663
  getSpanParentObject: () => getSpanParentObject,
3665
3664
  init: () => init,
3666
3665
  initDataset: () => initDataset,
3666
+ initExperiment: () => initExperiment,
3667
3667
  initLogger: () => initLogger,
3668
3668
  log: () => log,
3669
3669
  login: () => login,
@@ -3695,7 +3695,7 @@ var DefaultAsyncLocalStorage = class {
3695
3695
  }
3696
3696
  };
3697
3697
  var iso = {
3698
- getRepoStatus: async (_settings) => void 0,
3698
+ getRepoInfo: async (_settings) => void 0,
3699
3699
  getPastNAncestors: async () => [],
3700
3700
  getEnv: (_name) => void 0,
3701
3701
  getCallerLocation: () => void 0,
@@ -7734,11 +7734,11 @@ function truncateToByteLimit(s, byteLimit = 65536) {
7734
7734
  const truncated = encoded.subarray(0, byteLimit);
7735
7735
  return new TextDecoder().decode(truncated);
7736
7736
  }
7737
- async function getRepoStatus(settings) {
7737
+ async function getRepoInfo(settings) {
7738
7738
  if (settings && settings.collect === "none") {
7739
7739
  return void 0;
7740
7740
  }
7741
- const repo = await repoStatus();
7741
+ const repo = await repoInfo();
7742
7742
  if (!repo || !settings || settings.collect === "all") {
7743
7743
  return repo;
7744
7744
  }
@@ -7748,7 +7748,7 @@ async function getRepoStatus(settings) {
7748
7748
  });
7749
7749
  return sanitized;
7750
7750
  }
7751
- async function repoStatus() {
7751
+ async function repoInfo() {
7752
7752
  const git = await currentRepo();
7753
7753
  if (git === null) {
7754
7754
  return void 0;
@@ -7890,9 +7890,10 @@ function v4(options, buf, offset) {
7890
7890
  }
7891
7891
  var v4_default = v4;
7892
7892
 
7893
- // ../core/js/dist/index.mjs
7893
+ // ../core/js/dist/main/index.mjs
7894
7894
  var TRANSACTION_ID_FIELD = "_xact_id";
7895
7895
  var IS_MERGE_FIELD = "_is_merge";
7896
+ var MERGE_PATHS_FIELD = "_merge_paths";
7896
7897
  var AUDIT_SOURCE_FIELD = "_audit_source";
7897
7898
  var AUDIT_METADATA_FIELD = "_audit_metadata";
7898
7899
  var VALID_SOURCES = ["app", "api", "external"];
@@ -7951,6 +7952,54 @@ function mergeRowBatch(rows) {
7951
7952
  out.push(...Object.values(rowGroups));
7952
7953
  return out;
7953
7954
  }
7955
+ var DEFAULT_IS_LEGACY_DATASET = true;
7956
+ function ensureDatasetRecord(r, legacy) {
7957
+ if (legacy) {
7958
+ return ensureLegacyDatasetRecord(r);
7959
+ } else {
7960
+ return ensureNewDatasetRecord(r);
7961
+ }
7962
+ }
7963
+ function ensureLegacyDatasetRecord(r) {
7964
+ if ("output" in r) {
7965
+ return r;
7966
+ }
7967
+ const row = {
7968
+ ...r,
7969
+ output: r.expected
7970
+ };
7971
+ delete row.expected;
7972
+ return row;
7973
+ }
7974
+ function ensureNewDatasetRecord(r) {
7975
+ if ("expected" in r) {
7976
+ return r;
7977
+ }
7978
+ const row = {
7979
+ ...r,
7980
+ expected: r.output
7981
+ };
7982
+ delete row.output;
7983
+ return row;
7984
+ }
7985
+ function makeLegacyEvent(e) {
7986
+ if (!("dataset_id" in e) || !("expected" in e)) {
7987
+ return e;
7988
+ }
7989
+ const event = {
7990
+ ...e,
7991
+ output: e.expected
7992
+ };
7993
+ delete event.expected;
7994
+ if (MERGE_PATHS_FIELD in event) {
7995
+ for (const path2 of event[MERGE_PATHS_FIELD] || []) {
7996
+ if (path2.length > 0 && path2[0] === "expected") {
7997
+ path2[0] = "output";
7998
+ }
7999
+ }
8000
+ }
8001
+ return event;
8002
+ }
7954
8003
  var SpanTypeAttribute = /* @__PURE__ */ ((SpanTypeAttribute2) => {
7955
8004
  SpanTypeAttribute2["LLM"] = "llm";
7956
8005
  SpanTypeAttribute2["SCORE"] = "score";
@@ -8416,6 +8465,9 @@ var MaxRequestSize = 6 * 1024 * 1024;
8416
8465
  function constructJsonArray(items) {
8417
8466
  return `[${items.join(",")}]`;
8418
8467
  }
8468
+ function constructLogs3Data(items) {
8469
+ return `{"rows": ${constructJsonArray(items)}, "api_version": 2}`;
8470
+ }
8419
8471
  var DefaultBatchSize = 100;
8420
8472
  var NumRetries = 3;
8421
8473
  function now() {
@@ -8474,11 +8526,20 @@ var BackgroundLogger = class {
8474
8526
  }
8475
8527
  postPromises.push(
8476
8528
  (async () => {
8477
- const itemsS = constructJsonArray(items);
8529
+ const dataS = constructLogs3Data(items);
8478
8530
  for (let i = 0; i < NumRetries; i++) {
8479
8531
  const startTime = now();
8480
8532
  try {
8481
- return (await (await this.logConn.get()).post_json("logs", itemsS)).map((res) => res.id);
8533
+ try {
8534
+ return (await (await this.logConn.get()).post_json("logs3", dataS)).ids.map((res) => res.id);
8535
+ } catch (e) {
8536
+ const legacyDataS = constructJsonArray(
8537
+ items.map(
8538
+ (r) => JSON.stringify(makeLegacyEvent(JSON.parse(r)))
8539
+ )
8540
+ );
8541
+ return (await (await this.logConn.get()).post_json("logs", legacyDataS)).map((res) => res.id);
8542
+ }
8482
8543
  } catch (e) {
8483
8544
  const retryingText = i + 1 === NumRetries ? "" : " Retrying";
8484
8545
  const errMsg = (() => {
@@ -8489,7 +8550,7 @@ var BackgroundLogger = class {
8489
8550
  }
8490
8551
  })();
8491
8552
  console.warn(
8492
- `log request failed. Elapsed time: ${(now() - startTime) / 1e3} seconds. Payload size: ${itemsS.length}. Error: ${errMsg}.${retryingText}`
8553
+ `log request failed. Elapsed time: ${(now() - startTime) / 1e3} seconds. Payload size: ${dataS.length}. Error: ${errMsg}.${retryingText}`
8493
8554
  );
8494
8555
  }
8495
8556
  }
@@ -8517,8 +8578,21 @@ var BackgroundLogger = class {
8517
8578
  }
8518
8579
  }
8519
8580
  };
8520
- function init(project, options = {}) {
8581
+ function init(projectOrOptions, optionalOptions) {
8582
+ const options = (() => {
8583
+ if (typeof projectOrOptions === "string") {
8584
+ return { ...optionalOptions, project: projectOrOptions };
8585
+ } else {
8586
+ if (optionalOptions !== void 0) {
8587
+ throw new Error(
8588
+ "Cannot specify options struct as both parameters. Must call either init(project, options) or init(options)."
8589
+ );
8590
+ }
8591
+ return projectOrOptions;
8592
+ }
8593
+ })();
8521
8594
  const {
8595
+ project,
8522
8596
  experiment,
8523
8597
  description,
8524
8598
  dataset,
@@ -8530,47 +8604,55 @@ function init(project, options = {}) {
8530
8604
  apiKey,
8531
8605
  orgName,
8532
8606
  metadata,
8533
- gitMetadataSettings
8534
- } = options || {};
8607
+ gitMetadataSettings,
8608
+ projectId,
8609
+ baseExperimentId,
8610
+ repoInfo: repoInfo2
8611
+ } = options;
8535
8612
  if (open && update) {
8536
8613
  throw new Error("Cannot open and update an experiment at the same time");
8537
8614
  }
8538
8615
  if (open || update) {
8539
8616
  if (isEmpty(experiment)) {
8540
8617
  const action = open ? "open" : "update";
8541
- throw new Error(`Cannot ${action} an experiment without specifying its name`);
8618
+ throw new Error(
8619
+ `Cannot ${action} an experiment without specifying its name`
8620
+ );
8542
8621
  }
8543
- const lazyMetadata2 = new LazyValue(async () => {
8544
- await login({
8545
- orgName,
8546
- apiKey,
8547
- appUrl
8548
- });
8549
- const args = {
8550
- project_name: project,
8551
- org_name: _state.orgName,
8552
- experiment_name: experiment
8553
- };
8554
- const response = await _state.apiConn().post_json("api/experiment/get", args);
8555
- if (response.length === 0) {
8556
- throw new Error(
8557
- `Experiment ${experiment} not found in project ${project}.`
8558
- );
8559
- }
8560
- const info = response[0];
8561
- return {
8562
- project: {
8563
- id: info.project_id,
8564
- name: "",
8565
- fullInfo: {}
8566
- },
8567
- experiment: {
8568
- id: info.id,
8569
- name: info.name,
8570
- fullInfo: info
8622
+ const lazyMetadata2 = new LazyValue(
8623
+ async () => {
8624
+ await login({
8625
+ orgName,
8626
+ apiKey,
8627
+ appUrl
8628
+ });
8629
+ const args = {
8630
+ project_name: project,
8631
+ project_id: projectId,
8632
+ org_name: _state.orgName,
8633
+ experiment_name: experiment
8634
+ };
8635
+ const response = await _state.apiConn().post_json("api/experiment/get", args);
8636
+ if (response.length === 0) {
8637
+ throw new Error(
8638
+ `Experiment ${experiment} not found in project ${projectId ?? project}.`
8639
+ );
8571
8640
  }
8572
- };
8573
- });
8641
+ const info = response[0];
8642
+ return {
8643
+ project: {
8644
+ id: info.project_id,
8645
+ name: "",
8646
+ fullInfo: {}
8647
+ },
8648
+ experiment: {
8649
+ id: info.id,
8650
+ name: info.name,
8651
+ fullInfo: info
8652
+ }
8653
+ };
8654
+ }
8655
+ );
8574
8656
  if (open) {
8575
8657
  return new ReadonlyExperiment(
8576
8658
  lazyMetadata2
@@ -8592,6 +8674,7 @@ function init(project, options = {}) {
8592
8674
  });
8593
8675
  const args = {
8594
8676
  project_name: project,
8677
+ project_id: projectId,
8595
8678
  org_id: _state.orgId
8596
8679
  };
8597
8680
  if (experiment) {
@@ -8600,22 +8683,29 @@ function init(project, options = {}) {
8600
8683
  if (description) {
8601
8684
  args["description"] = description;
8602
8685
  }
8603
- let mergedGitMetadataSettings = {
8604
- ..._state.gitMetadataSettings || {
8605
- collect: "all"
8686
+ const repoInfoArg = await (async () => {
8687
+ if (repoInfo2) {
8688
+ return repoInfo2;
8606
8689
  }
8607
- };
8608
- if (gitMetadataSettings) {
8609
- mergedGitMetadataSettings = mergeGitMetadataSettings(
8610
- mergedGitMetadataSettings,
8611
- gitMetadataSettings
8612
- );
8613
- }
8614
- const repoStatus2 = await isomorph_default.getRepoStatus(gitMetadataSettings);
8615
- if (repoStatus2) {
8616
- args["repo_info"] = repoStatus2;
8690
+ let mergedGitMetadataSettings = {
8691
+ ..._state.gitMetadataSettings || {
8692
+ collect: "all"
8693
+ }
8694
+ };
8695
+ if (gitMetadataSettings) {
8696
+ mergedGitMetadataSettings = mergeGitMetadataSettings(
8697
+ mergedGitMetadataSettings,
8698
+ gitMetadataSettings
8699
+ );
8700
+ }
8701
+ return await isomorph_default.getRepoInfo(mergedGitMetadataSettings);
8702
+ })();
8703
+ if (repoInfoArg) {
8704
+ args["repo_info"] = repoInfoArg;
8617
8705
  }
8618
- if (baseExperiment) {
8706
+ if (baseExperimentId) {
8707
+ args["base_exp_id"] = baseExperimentId;
8708
+ } else if (baseExperiment) {
8619
8709
  args["base_experiment"] = baseExperiment;
8620
8710
  } else {
8621
8711
  args["ancestor_commits"] = await isomorph_default.getPastNAncestors();
@@ -8666,6 +8756,21 @@ function init(project, options = {}) {
8666
8756
  }
8667
8757
  return ret;
8668
8758
  }
8759
+ function initExperiment(projectOrOptions, optionalOptions) {
8760
+ const options = (() => {
8761
+ if (typeof projectOrOptions === "string") {
8762
+ return { ...optionalOptions, project: projectOrOptions };
8763
+ } else {
8764
+ if (optionalOptions !== void 0) {
8765
+ throw new Error(
8766
+ "Cannot specify options struct as both parameters. Must call either init(project, options) or init(options)."
8767
+ );
8768
+ }
8769
+ return projectOrOptions;
8770
+ }
8771
+ })();
8772
+ return init(options);
8773
+ }
8669
8774
  function withExperiment(project, callback, options = {}) {
8670
8775
  console.warn(
8671
8776
  "withExperiment is deprecated and will be removed in a future version of braintrust. Simply create the experiment with `init`."
@@ -8680,8 +8785,30 @@ function withLogger(callback, options = {}) {
8680
8785
  const logger = initLogger(options);
8681
8786
  return callback(logger);
8682
8787
  }
8683
- function initDataset(project, options = {}) {
8684
- const { dataset, description, version, appUrl, apiKey, orgName } = options || {};
8788
+ function initDataset(projectOrOptions, optionalOptions) {
8789
+ const options = (() => {
8790
+ if (typeof projectOrOptions === "string") {
8791
+ return { ...optionalOptions, project: projectOrOptions };
8792
+ } else {
8793
+ if (optionalOptions !== void 0) {
8794
+ throw new Error(
8795
+ "Cannot specify options struct as both parameters. Must call either initDataset(project, options) or initDataset(options)."
8796
+ );
8797
+ }
8798
+ return projectOrOptions;
8799
+ }
8800
+ })();
8801
+ const {
8802
+ project,
8803
+ dataset,
8804
+ description,
8805
+ version,
8806
+ appUrl,
8807
+ apiKey,
8808
+ orgName,
8809
+ projectId,
8810
+ useOutput: legacy
8811
+ } = options;
8685
8812
  const lazyMetadata = new LazyValue(
8686
8813
  async () => {
8687
8814
  await login({
@@ -8692,6 +8819,7 @@ function initDataset(project, options = {}) {
8692
8819
  const args = {
8693
8820
  org_id: _state.orgId,
8694
8821
  project_name: project,
8822
+ project_id: projectId,
8695
8823
  dataset_name: dataset,
8696
8824
  description
8697
8825
  };
@@ -8710,7 +8838,7 @@ function initDataset(project, options = {}) {
8710
8838
  };
8711
8839
  }
8712
8840
  );
8713
- return new Dataset(lazyMetadata, version);
8841
+ return new Dataset(lazyMetadata, version, legacy);
8714
8842
  }
8715
8843
  function withDataset(project, callback, options = {}) {
8716
8844
  console.warn(
@@ -8780,15 +8908,27 @@ function initLogger(options = {}) {
8780
8908
  return ret;
8781
8909
  }
8782
8910
  async function login(options = {}) {
8911
+ let { forceLogin = false } = options || {};
8912
+ if (_state.loggedIn && !forceLogin) {
8913
+ let checkUpdatedParam2 = function(varname, arg, orig) {
8914
+ if (!isEmpty(arg) && !isEmpty(orig) && arg !== orig) {
8915
+ throw new Error(
8916
+ `Re-logging in with different ${varname} (${arg}) than original (${orig}). To force re-login, pass \`forceLogin: true\``
8917
+ );
8918
+ }
8919
+ };
8920
+ var checkUpdatedParam = checkUpdatedParam2;
8921
+ ;
8922
+ checkUpdatedParam2("appUrl", options.appUrl, _state.appUrl);
8923
+ checkUpdatedParam2("apiKey", options.apiKey ? HTTPConnection.sanitize_token(options.apiKey) : void 0, _state.loginToken);
8924
+ checkUpdatedParam2("orgName", options.orgName, _state.orgName);
8925
+ return;
8926
+ }
8783
8927
  const {
8784
8928
  appUrl = isomorph_default.getEnv("BRAINTRUST_APP_URL") || "https://www.braintrustdata.com",
8785
8929
  apiKey = isomorph_default.getEnv("BRAINTRUST_API_KEY"),
8786
8930
  orgName = isomorph_default.getEnv("BRAINTRUST_ORG_NAME")
8787
8931
  } = options || {};
8788
- let { forceLogin = false } = options || {};
8789
- if (_state.loggedIn && !forceLogin) {
8790
- return;
8791
- }
8792
8932
  _state.resetLoginInfo();
8793
8933
  _state.appUrl = appUrl;
8794
8934
  let conn = null;
@@ -8997,9 +9137,10 @@ function validateAndSanitizeExperimentLogFullArgs(event, hasDataset) {
8997
9137
  return event;
8998
9138
  }
8999
9139
  var ObjectFetcher = class {
9000
- constructor(objectType, pinnedVersion) {
9140
+ constructor(objectType, pinnedVersion, mutateRecord) {
9001
9141
  this.objectType = objectType;
9002
9142
  this.pinnedVersion = pinnedVersion;
9143
+ this.mutateRecord = mutateRecord;
9003
9144
  this._fetchedData = void 0;
9004
9145
  }
9005
9146
  get id() {
@@ -9020,12 +9161,24 @@ var ObjectFetcher = class {
9020
9161
  async fetchedData() {
9021
9162
  if (this._fetchedData === void 0) {
9022
9163
  const state = await this.getState();
9023
- const resp = await state.logConn().get(`object/${this.objectType}`, {
9024
- id: await this.id,
9025
- fmt: "json2",
9026
- version: this.pinnedVersion
9027
- });
9028
- this._fetchedData = await resp.json();
9164
+ let data = void 0;
9165
+ try {
9166
+ const resp = await state.logConn().get(`object3/${this.objectType}`, {
9167
+ id: await this.id,
9168
+ fmt: "json2",
9169
+ version: this.pinnedVersion,
9170
+ api_version: "2"
9171
+ });
9172
+ data = await resp.json();
9173
+ } catch (e) {
9174
+ const resp = await state.logConn().get(`object/${this.objectType}`, {
9175
+ id: await this.id,
9176
+ fmt: "json2",
9177
+ version: this.pinnedVersion
9178
+ });
9179
+ data = await resp.json();
9180
+ }
9181
+ this._fetchedData = this.mutateRecord ? data?.map(this.mutateRecord) : data;
9029
9182
  }
9030
9183
  return this._fetchedData || [];
9031
9184
  }
@@ -9274,11 +9427,18 @@ var ReadonlyExperiment = class extends ObjectFetcher {
9274
9427
  if (record.root_span_id !== record.span_id) {
9275
9428
  continue;
9276
9429
  }
9277
- const { output, expected } = record;
9278
- yield {
9279
- input: record.input,
9280
- expected: expected ?? output
9281
- };
9430
+ const { output, expected: expectedRecord } = record;
9431
+ const expected = expectedRecord ?? output;
9432
+ if (isEmpty(expected)) {
9433
+ yield {
9434
+ input: record.input
9435
+ };
9436
+ } else {
9437
+ yield {
9438
+ input: record.input,
9439
+ expected
9440
+ };
9441
+ }
9282
9442
  }
9283
9443
  }
9284
9444
  };
@@ -9411,8 +9571,18 @@ var SpanImpl = class _SpanImpl {
9411
9571
  }
9412
9572
  };
9413
9573
  var Dataset = class extends ObjectFetcher {
9414
- constructor(lazyMetadata, pinnedVersion) {
9415
- super("dataset", pinnedVersion);
9574
+ constructor(lazyMetadata, pinnedVersion, legacy) {
9575
+ const isLegacyDataset = legacy ?? DEFAULT_IS_LEGACY_DATASET;
9576
+ if (isLegacyDataset) {
9577
+ console.warn(
9578
+ `Records will be fetched from this dataset in the legacy format, with the "expected" field renamed to "output". Please update your code to use "expected", and use \`braintrust.initDataset()\` with \`{ useOutput: false }\`, which will become the default in a future version of Braintrust.`
9579
+ );
9580
+ }
9581
+ super(
9582
+ "dataset",
9583
+ pinnedVersion,
9584
+ (r) => ensureDatasetRecord(r, isLegacyDataset)
9585
+ );
9416
9586
  this.lazyMetadata = lazyMetadata;
9417
9587
  const logConn = new LazyValue(
9418
9588
  () => this.getState().then((state) => state.logConn())
@@ -9444,19 +9614,21 @@ var Dataset = class extends ObjectFetcher {
9444
9614
  *
9445
9615
  * @param event The event to log.
9446
9616
  * @param event.input The argument that uniquely define an input case (an arbitrary, JSON serializable object).
9447
- * @param event.output The output of your application, including post-processing (an arbitrary, JSON serializable object).
9617
+ * @param event.expected The output of your application, including post-processing (an arbitrary, JSON serializable object).
9448
9618
  * @param event.metadata (Optional) a dictionary with additional data about the test example, model outputs, or just
9449
9619
  * about anything else that's relevant, that you can use to help find and analyze examples later. For example, you could log the
9450
9620
  * `prompt`, example's `id`, or anything else that would be useful to slice/dice later. The values in `metadata` can be any
9451
9621
  * JSON-serializable type, but its keys must be strings.
9452
9622
  * @param event.id (Optional) a unique identifier for the event. If you don't provide one, Braintrust will generate one for you.
9623
+ * @param event.output: (Deprecated) The output of your application. Use `expected` instead.
9453
9624
  * @returns The `id` of the logged record.
9454
9625
  */
9455
9626
  insert({
9456
9627
  input,
9457
- output,
9628
+ expected,
9458
9629
  metadata,
9459
- id
9630
+ id,
9631
+ output
9460
9632
  }) {
9461
9633
  if (metadata !== void 0) {
9462
9634
  for (const key of Object.keys(metadata)) {
@@ -9465,11 +9637,16 @@ var Dataset = class extends ObjectFetcher {
9465
9637
  }
9466
9638
  }
9467
9639
  }
9640
+ if (expected && output) {
9641
+ throw new Error(
9642
+ "Only one of expected or output (deprecated) can be specified. Prefer expected."
9643
+ );
9644
+ }
9468
9645
  const rowId = id || v4_default();
9469
9646
  const args = new LazyValue(async () => ({
9470
9647
  id: rowId,
9471
- inputs: input,
9472
- output,
9648
+ input,
9649
+ expected: expected === void 0 ? output : expected,
9473
9650
  project_id: (await this.project).id,
9474
9651
  dataset_id: await this.id,
9475
9652
  created: (/* @__PURE__ */ new Date()).toISOString(),
@@ -9540,7 +9717,7 @@ var Dataset = class extends ObjectFetcher {
9540
9717
 
9541
9718
  // src/node.ts
9542
9719
  function configureNode() {
9543
- isomorph_default.getRepoStatus = getRepoStatus;
9720
+ isomorph_default.getRepoInfo = getRepoInfo;
9544
9721
  isomorph_default.getPastNAncestors = getPastNAncestors;
9545
9722
  isomorph_default.getEnv = (name) => process.env[name];
9546
9723
  isomorph_default.getCallerLocation = getCallerLocation;
@@ -9602,7 +9779,7 @@ function makeEvalName(projectName, experimentName) {
9602
9779
  }
9603
9780
  return out;
9604
9781
  }
9605
- function initExperiment(projectName, options = {}) {
9782
+ function initExperiment2(projectName, options = {}) {
9606
9783
  return init(projectName, {
9607
9784
  ...options,
9608
9785
  setCurrent: false
@@ -9628,7 +9805,7 @@ async function Eval(name, evaluator) {
9628
9805
  }
9629
9806
  const progressReporter = new BarProgressReporter();
9630
9807
  try {
9631
- const experiment = initExperiment(name, {
9808
+ const experiment = initExperiment2(name, {
9632
9809
  experiment: evaluator.experimentName,
9633
9810
  metadata: evaluator.metadata,
9634
9811
  isPublic: evaluator.isPublic
@@ -9690,7 +9867,7 @@ async function runEvaluator(experiment, evaluator, progressReporter, filters) {
9690
9867
  }
9691
9868
  name = baseExperiment.name;
9692
9869
  }
9693
- dataResult = initExperiment(evaluator.projectName, {
9870
+ dataResult = initExperiment2(evaluator.projectName, {
9694
9871
  experiment: name,
9695
9872
  open: true
9696
9873
  }).asDataset();
@@ -9711,7 +9888,7 @@ async function runEvaluator(experiment, evaluator, progressReporter, filters) {
9711
9888
  );
9712
9889
  progressReporter.start(evaluator.evalName, data.length);
9713
9890
  const evals = data.map(async (datum) => {
9714
- let metadata = { ...datum.metadata };
9891
+ let metadata = { ..."metadata" in datum ? datum.metadata : {} };
9715
9892
  let output = void 0;
9716
9893
  let error2 = void 0;
9717
9894
  let scores = {};
@@ -9798,7 +9975,7 @@ async function runEvaluator(experiment, evaluator, progressReporter, filters) {
9798
9975
  },
9799
9976
  event: {
9800
9977
  input: datum.input,
9801
- expected: datum.expected
9978
+ expected: "expected" in datum ? datum.expected : void 0
9802
9979
  }
9803
9980
  });
9804
9981
  }
@@ -10118,7 +10295,6 @@ configureNode();
10118
10295
  // Annotate the CommonJS export names for ESM import in node:
10119
10296
  0 && (module.exports = {
10120
10297
  BaseExperiment,
10121
- Dataset,
10122
10298
  Eval,
10123
10299
  Experiment,
10124
10300
  Logger,
@@ -10134,6 +10310,7 @@ configureNode();
10134
10310
  getSpanParentObject,
10135
10311
  init,
10136
10312
  initDataset,
10313
+ initExperiment,
10137
10314
  initLogger,
10138
10315
  log,
10139
10316
  login,
@@ -1,4 +1,4 @@
1
- import { GitMetadataSettings, RepoStatus } from "@braintrust/core";
1
+ import { GitMetadataSettings, RepoInfo } from "@braintrust/core";
2
2
  export interface CallerLocation {
3
3
  caller_functionname: string;
4
4
  caller_filename: string;
@@ -10,7 +10,7 @@ export interface IsoAsyncLocalStorage<T> {
10
10
  getStore(): T | undefined;
11
11
  }
12
12
  export interface Common {
13
- getRepoStatus: (settings?: GitMetadataSettings) => Promise<RepoStatus | undefined>;
13
+ getRepoInfo: (settings?: GitMetadataSettings) => Promise<RepoInfo | undefined>;
14
14
  getPastNAncestors: () => Promise<string[]>;
15
15
  getEnv: (name: string) => string | undefined;
16
16
  getCallerLocation: () => CallerLocation | undefined;