braintrust 0.0.204 → 0.0.205

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.
@@ -171,9 +171,14 @@ declare class PromptCache {
171
171
 
172
172
  declare class LazyValue<T> {
173
173
  private callable;
174
+ private resolvedValue;
174
175
  private value;
175
176
  constructor(callable: () => Promise<T>);
176
177
  get(): Promise<T>;
178
+ getSync(): {
179
+ resolved: boolean;
180
+ value: T | undefined;
181
+ };
177
182
  get hasSucceeded(): boolean;
178
183
  }
179
184
 
@@ -287,9 +292,25 @@ interface Span extends Exportable {
287
292
  * Links can be generated at any time, but they will only become viewable
288
293
  * after the span and its root have been flushed to the server and ingested.
289
294
  *
290
- * @returns A permalink to the span.
295
+ * This function can block resolving data with the server. For production
296
+ * applications it's preferable to call {@link Span.link} instead.
297
+ *
298
+ * @returns A promise which resolves to a permalink to the span.
291
299
  */
292
300
  permalink(): Promise<string>;
301
+ /**
302
+ * Format a link to the Braintrust application for viewing this span.
303
+ *
304
+ * Links can be generated at any time, but they will only become viewable
305
+ * after the span and its root have been flushed to the server and ingested.
306
+ *
307
+ * There are certain conditions that a Span doesn'thave enough information
308
+ * to return a stable link (e.g. during an unresolved experiment). In this case
309
+ * or if there's an error generating link, we'll return a placeholder link.
310
+ *
311
+ * @returns A link to the span.
312
+ */
313
+ link(): string;
293
314
  /**
294
315
  * Flush any pending rows to the server.
295
316
  */
@@ -326,6 +347,7 @@ declare class NoopSpan implements Span {
326
347
  end(args?: EndSpanArgs): number;
327
348
  export(): Promise<string>;
328
349
  permalink(): Promise<string>;
350
+ link(): string;
329
351
  flush(): Promise<void>;
330
352
  close(args?: EndSpanArgs): number;
331
353
  setAttributes(_args: Omit<StartSpanArgs, "event">): void;
@@ -171,9 +171,14 @@ declare class PromptCache {
171
171
 
172
172
  declare class LazyValue<T> {
173
173
  private callable;
174
+ private resolvedValue;
174
175
  private value;
175
176
  constructor(callable: () => Promise<T>);
176
177
  get(): Promise<T>;
178
+ getSync(): {
179
+ resolved: boolean;
180
+ value: T | undefined;
181
+ };
177
182
  get hasSucceeded(): boolean;
178
183
  }
179
184
 
@@ -287,9 +292,25 @@ interface Span extends Exportable {
287
292
  * Links can be generated at any time, but they will only become viewable
288
293
  * after the span and its root have been flushed to the server and ingested.
289
294
  *
290
- * @returns A permalink to the span.
295
+ * This function can block resolving data with the server. For production
296
+ * applications it's preferable to call {@link Span.link} instead.
297
+ *
298
+ * @returns A promise which resolves to a permalink to the span.
291
299
  */
292
300
  permalink(): Promise<string>;
301
+ /**
302
+ * Format a link to the Braintrust application for viewing this span.
303
+ *
304
+ * Links can be generated at any time, but they will only become viewable
305
+ * after the span and its root have been flushed to the server and ingested.
306
+ *
307
+ * There are certain conditions that a Span doesn'thave enough information
308
+ * to return a stable link (e.g. during an unresolved experiment). In this case
309
+ * or if there's an error generating link, we'll return a placeholder link.
310
+ *
311
+ * @returns A link to the span.
312
+ */
313
+ link(): string;
293
314
  /**
294
315
  * Flush any pending rows to the server.
295
316
  */
@@ -326,6 +347,7 @@ declare class NoopSpan implements Span {
326
347
  end(args?: EndSpanArgs): number;
327
348
  export(): Promise<string>;
328
349
  permalink(): Promise<string>;
350
+ link(): string;
329
351
  flush(): Promise<void>;
330
352
  close(args?: EndSpanArgs): number;
331
353
  setAttributes(_args: Omit<StartSpanArgs, "event">): void;
package/dev/dist/index.js CHANGED
@@ -1654,6 +1654,7 @@ function isEmpty(a) {
1654
1654
  }
1655
1655
  var LazyValue = class {
1656
1656
  callable;
1657
+ resolvedValue = void 0;
1657
1658
  value = {
1658
1659
  computedState: "uninitialized"
1659
1660
  };
@@ -1668,11 +1669,18 @@ var LazyValue = class {
1668
1669
  computedState: "in_progress",
1669
1670
  val: this.callable().then((x) => {
1670
1671
  this.value.computedState = "succeeded";
1672
+ this.resolvedValue = x;
1671
1673
  return x;
1672
1674
  })
1673
1675
  };
1674
1676
  return this.value.val;
1675
1677
  }
1678
+ getSync() {
1679
+ return {
1680
+ resolved: this.value.computedState === "succeeded",
1681
+ value: this.resolvedValue
1682
+ };
1683
+ }
1676
1684
  // If this is true, the caller should be able to obtain the LazyValue without
1677
1685
  // it throwing.
1678
1686
  get hasSucceeded() {
@@ -1763,6 +1771,9 @@ var NoopSpan = class {
1763
1771
  async permalink() {
1764
1772
  return NOOP_SPAN_PERMALINK;
1765
1773
  }
1774
+ link() {
1775
+ return NOOP_SPAN_PERMALINK;
1776
+ }
1766
1777
  async flush() {
1767
1778
  }
1768
1779
  close(args) {
@@ -2334,6 +2345,13 @@ async function spanComponentsToObjectId({
2334
2345
  components
2335
2346
  )();
2336
2347
  }
2348
+ var ERR_PERMALINK = "https://braintrust.dev/error-generating-link";
2349
+ function getErrPermlink(msg) {
2350
+ if (msg == "") {
2351
+ return ERR_PERMALINK;
2352
+ }
2353
+ return `${ERR_PERMALINK}?msg=${encodeURIComponent(msg)}`;
2354
+ }
2337
2355
  async function permalink(slug, opts) {
2338
2356
  if (slug === "") {
2339
2357
  return NOOP_SPAN_PERMALINK;
@@ -2345,9 +2363,7 @@ async function permalink(slug, opts) {
2345
2363
  }
2346
2364
  await state.login({});
2347
2365
  if (!state.orgName) {
2348
- throw new Error(
2349
- "Must either provide orgName explicitly or be logged in to a specific org"
2350
- );
2366
+ throw new Error("provide-org-or-login");
2351
2367
  }
2352
2368
  return state.orgName;
2353
2369
  };
@@ -2357,23 +2373,30 @@ async function permalink(slug, opts) {
2357
2373
  }
2358
2374
  await state.login({});
2359
2375
  if (!state.appUrl) {
2360
- throw new Error("Must either provide appUrl explicitly or be logged in");
2376
+ throw new Error("provide-app-url-or-login");
2361
2377
  }
2362
2378
  return state.appUrl;
2363
2379
  };
2364
- const components = import_core2.SpanComponentsV3.fromStr(slug);
2365
- const object_type = (0, import_core2.spanObjectTypeV3ToString)(components.data.object_type);
2366
- const [orgName, appUrl, object_id] = await Promise.all([
2367
- getOrgName(),
2368
- getAppUrl(),
2369
- spanComponentsToObjectId({ components, state })
2370
- ]);
2371
- const id = components.data.row_id;
2372
- if (!id) {
2373
- throw new Error("Span slug does not refer to an individual row");
2374
- }
2375
- const urlParams = new URLSearchParams({ object_type, object_id, id });
2376
- return `${appUrl}/app/${orgName}/object?${urlParams}`;
2380
+ try {
2381
+ const components = import_core2.SpanComponentsV3.fromStr(slug);
2382
+ const object_type = (0, import_core2.spanObjectTypeV3ToString)(components.data.object_type);
2383
+ const [orgName, appUrl, object_id] = await Promise.all([
2384
+ getOrgName(),
2385
+ getAppUrl(),
2386
+ spanComponentsToObjectId({ components, state })
2387
+ ]);
2388
+ const id = components.data.row_id;
2389
+ if (!id) {
2390
+ throw new Error("Span slug does not refer to an individual row");
2391
+ }
2392
+ const urlParams = new URLSearchParams({ object_type, object_id, id });
2393
+ return `${appUrl}/app/${orgName}/object?${urlParams}`;
2394
+ } catch (e) {
2395
+ if (e instanceof FailedHTTPResponse) {
2396
+ return getErrPermlink(`http-error-${e.status}`);
2397
+ }
2398
+ return getErrPermlink(e instanceof Error ? e.message : String(e));
2399
+ }
2377
2400
  }
2378
2401
  function startSpanParentArgs(args) {
2379
2402
  let argParentObjectId = void 0;
@@ -4223,6 +4246,54 @@ var SpanImpl = class _SpanImpl {
4223
4246
  state: this._state
4224
4247
  });
4225
4248
  }
4249
+ link() {
4250
+ if (!this.id) {
4251
+ return NOOP_SPAN_PERMALINK;
4252
+ }
4253
+ try {
4254
+ const orgName = this._state.orgName;
4255
+ if (!orgName) {
4256
+ throw new Error("log-in-or-provide-org-name");
4257
+ }
4258
+ return this._link(orgName);
4259
+ } catch (e) {
4260
+ return getErrPermlink(e instanceof Error ? e.message : String(e));
4261
+ }
4262
+ }
4263
+ _link(orgName) {
4264
+ const appUrl = this._state.appUrl || "https://www.braintrust.dev";
4265
+ const baseUrl = `${appUrl}/app/${orgName}`;
4266
+ const args = this.parentComputeObjectMetadataArgs;
4267
+ switch (this.parentObjectType) {
4268
+ case import_core2.SpanObjectTypeV3.PROJECT_LOGS: {
4269
+ const projectID = args?.project_id || this.parentObjectId.getSync().value;
4270
+ const projectName = args?.project_name;
4271
+ if (projectID) {
4272
+ return `${baseUrl}/object?object_type=project_logs&object_id=${projectID}&id=${this._id}`;
4273
+ } else if (projectName) {
4274
+ return `${baseUrl}/p/${projectName}/logs?oid=${this._id}`;
4275
+ } else {
4276
+ return getErrPermlink("provide-project-name-or-id");
4277
+ }
4278
+ }
4279
+ case import_core2.SpanObjectTypeV3.EXPERIMENT: {
4280
+ let expID = args?.experiment_id || this.parentObjectId?.getSync()?.value;
4281
+ if (!expID) {
4282
+ return getErrPermlink("provide-experiment-id");
4283
+ } else {
4284
+ return `${baseUrl}/object?object_type=experiment&object_id=${expID}&id=${this._id}`;
4285
+ }
4286
+ }
4287
+ case import_core2.SpanObjectTypeV3.PLAYGROUND_LOGS: {
4288
+ return NOOP_SPAN_PERMALINK;
4289
+ }
4290
+ default: {
4291
+ const _exhaustive = this.parentObjectType;
4292
+ _exhaustive;
4293
+ return NOOP_SPAN_PERMALINK;
4294
+ }
4295
+ }
4296
+ }
4226
4297
  async flush() {
4227
4298
  return await this._state.bgLogger().flush();
4228
4299
  }
@@ -1655,6 +1655,7 @@ function isEmpty(a) {
1655
1655
  }
1656
1656
  var LazyValue = class {
1657
1657
  callable;
1658
+ resolvedValue = void 0;
1658
1659
  value = {
1659
1660
  computedState: "uninitialized"
1660
1661
  };
@@ -1669,11 +1670,18 @@ var LazyValue = class {
1669
1670
  computedState: "in_progress",
1670
1671
  val: this.callable().then((x) => {
1671
1672
  this.value.computedState = "succeeded";
1673
+ this.resolvedValue = x;
1672
1674
  return x;
1673
1675
  })
1674
1676
  };
1675
1677
  return this.value.val;
1676
1678
  }
1679
+ getSync() {
1680
+ return {
1681
+ resolved: this.value.computedState === "succeeded",
1682
+ value: this.resolvedValue
1683
+ };
1684
+ }
1677
1685
  // If this is true, the caller should be able to obtain the LazyValue without
1678
1686
  // it throwing.
1679
1687
  get hasSucceeded() {
@@ -1764,6 +1772,9 @@ var NoopSpan = class {
1764
1772
  async permalink() {
1765
1773
  return NOOP_SPAN_PERMALINK;
1766
1774
  }
1775
+ link() {
1776
+ return NOOP_SPAN_PERMALINK;
1777
+ }
1767
1778
  async flush() {
1768
1779
  }
1769
1780
  close(args) {
@@ -2335,6 +2346,13 @@ async function spanComponentsToObjectId({
2335
2346
  components
2336
2347
  )();
2337
2348
  }
2349
+ var ERR_PERMALINK = "https://braintrust.dev/error-generating-link";
2350
+ function getErrPermlink(msg) {
2351
+ if (msg == "") {
2352
+ return ERR_PERMALINK;
2353
+ }
2354
+ return `${ERR_PERMALINK}?msg=${encodeURIComponent(msg)}`;
2355
+ }
2338
2356
  async function permalink(slug, opts) {
2339
2357
  if (slug === "") {
2340
2358
  return NOOP_SPAN_PERMALINK;
@@ -2346,9 +2364,7 @@ async function permalink(slug, opts) {
2346
2364
  }
2347
2365
  await state.login({});
2348
2366
  if (!state.orgName) {
2349
- throw new Error(
2350
- "Must either provide orgName explicitly or be logged in to a specific org"
2351
- );
2367
+ throw new Error("provide-org-or-login");
2352
2368
  }
2353
2369
  return state.orgName;
2354
2370
  };
@@ -2358,23 +2374,30 @@ async function permalink(slug, opts) {
2358
2374
  }
2359
2375
  await state.login({});
2360
2376
  if (!state.appUrl) {
2361
- throw new Error("Must either provide appUrl explicitly or be logged in");
2377
+ throw new Error("provide-app-url-or-login");
2362
2378
  }
2363
2379
  return state.appUrl;
2364
2380
  };
2365
- const components = SpanComponentsV3.fromStr(slug);
2366
- const object_type = spanObjectTypeV3ToString(components.data.object_type);
2367
- const [orgName, appUrl, object_id] = await Promise.all([
2368
- getOrgName(),
2369
- getAppUrl(),
2370
- spanComponentsToObjectId({ components, state })
2371
- ]);
2372
- const id = components.data.row_id;
2373
- if (!id) {
2374
- throw new Error("Span slug does not refer to an individual row");
2375
- }
2376
- const urlParams = new URLSearchParams({ object_type, object_id, id });
2377
- return `${appUrl}/app/${orgName}/object?${urlParams}`;
2381
+ try {
2382
+ const components = SpanComponentsV3.fromStr(slug);
2383
+ const object_type = spanObjectTypeV3ToString(components.data.object_type);
2384
+ const [orgName, appUrl, object_id] = await Promise.all([
2385
+ getOrgName(),
2386
+ getAppUrl(),
2387
+ spanComponentsToObjectId({ components, state })
2388
+ ]);
2389
+ const id = components.data.row_id;
2390
+ if (!id) {
2391
+ throw new Error("Span slug does not refer to an individual row");
2392
+ }
2393
+ const urlParams = new URLSearchParams({ object_type, object_id, id });
2394
+ return `${appUrl}/app/${orgName}/object?${urlParams}`;
2395
+ } catch (e) {
2396
+ if (e instanceof FailedHTTPResponse) {
2397
+ return getErrPermlink(`http-error-${e.status}`);
2398
+ }
2399
+ return getErrPermlink(e instanceof Error ? e.message : String(e));
2400
+ }
2378
2401
  }
2379
2402
  function startSpanParentArgs(args) {
2380
2403
  let argParentObjectId = void 0;
@@ -4224,6 +4247,54 @@ var SpanImpl = class _SpanImpl {
4224
4247
  state: this._state
4225
4248
  });
4226
4249
  }
4250
+ link() {
4251
+ if (!this.id) {
4252
+ return NOOP_SPAN_PERMALINK;
4253
+ }
4254
+ try {
4255
+ const orgName = this._state.orgName;
4256
+ if (!orgName) {
4257
+ throw new Error("log-in-or-provide-org-name");
4258
+ }
4259
+ return this._link(orgName);
4260
+ } catch (e) {
4261
+ return getErrPermlink(e instanceof Error ? e.message : String(e));
4262
+ }
4263
+ }
4264
+ _link(orgName) {
4265
+ const appUrl = this._state.appUrl || "https://www.braintrust.dev";
4266
+ const baseUrl = `${appUrl}/app/${orgName}`;
4267
+ const args = this.parentComputeObjectMetadataArgs;
4268
+ switch (this.parentObjectType) {
4269
+ case SpanObjectTypeV3.PROJECT_LOGS: {
4270
+ const projectID = args?.project_id || this.parentObjectId.getSync().value;
4271
+ const projectName = args?.project_name;
4272
+ if (projectID) {
4273
+ return `${baseUrl}/object?object_type=project_logs&object_id=${projectID}&id=${this._id}`;
4274
+ } else if (projectName) {
4275
+ return `${baseUrl}/p/${projectName}/logs?oid=${this._id}`;
4276
+ } else {
4277
+ return getErrPermlink("provide-project-name-or-id");
4278
+ }
4279
+ }
4280
+ case SpanObjectTypeV3.EXPERIMENT: {
4281
+ let expID = args?.experiment_id || this.parentObjectId?.getSync()?.value;
4282
+ if (!expID) {
4283
+ return getErrPermlink("provide-experiment-id");
4284
+ } else {
4285
+ return `${baseUrl}/object?object_type=experiment&object_id=${expID}&id=${this._id}`;
4286
+ }
4287
+ }
4288
+ case SpanObjectTypeV3.PLAYGROUND_LOGS: {
4289
+ return NOOP_SPAN_PERMALINK;
4290
+ }
4291
+ default: {
4292
+ const _exhaustive = this.parentObjectType;
4293
+ _exhaustive;
4294
+ return NOOP_SPAN_PERMALINK;
4295
+ }
4296
+ }
4297
+ }
4227
4298
  async flush() {
4228
4299
  return await this._state.bgLogger().flush();
4229
4300
  }
@@ -170,9 +170,14 @@ declare class PromptCache {
170
170
 
171
171
  declare class LazyValue<T> {
172
172
  private callable;
173
+ private resolvedValue;
173
174
  private value;
174
175
  constructor(callable: () => Promise<T>);
175
176
  get(): Promise<T>;
177
+ getSync(): {
178
+ resolved: boolean;
179
+ value: T | undefined;
180
+ };
176
181
  get hasSucceeded(): boolean;
177
182
  }
178
183
 
@@ -286,9 +291,25 @@ interface Span extends Exportable {
286
291
  * Links can be generated at any time, but they will only become viewable
287
292
  * after the span and its root have been flushed to the server and ingested.
288
293
  *
289
- * @returns A permalink to the span.
294
+ * This function can block resolving data with the server. For production
295
+ * applications it's preferable to call {@link Span.link} instead.
296
+ *
297
+ * @returns A promise which resolves to a permalink to the span.
290
298
  */
291
299
  permalink(): Promise<string>;
300
+ /**
301
+ * Format a link to the Braintrust application for viewing this span.
302
+ *
303
+ * Links can be generated at any time, but they will only become viewable
304
+ * after the span and its root have been flushed to the server and ingested.
305
+ *
306
+ * There are certain conditions that a Span doesn'thave enough information
307
+ * to return a stable link (e.g. during an unresolved experiment). In this case
308
+ * or if there's an error generating link, we'll return a placeholder link.
309
+ *
310
+ * @returns A link to the span.
311
+ */
312
+ link(): string;
292
313
  /**
293
314
  * Flush any pending rows to the server.
294
315
  */
@@ -325,6 +346,7 @@ declare class NoopSpan implements Span {
325
346
  end(args?: EndSpanArgs): number;
326
347
  export(): Promise<string>;
327
348
  permalink(): Promise<string>;
349
+ link(): string;
328
350
  flush(): Promise<void>;
329
351
  close(args?: EndSpanArgs): number;
330
352
  setAttributes(_args: Omit<StartSpanArgs, "event">): void;
@@ -695,6 +717,7 @@ declare function spanComponentsToObjectId({ components, state, }: {
695
717
  components: SpanComponentsV3;
696
718
  state?: BraintrustState;
697
719
  }): Promise<string>;
720
+ declare const ERR_PERMALINK = "https://braintrust.dev/error-generating-link";
698
721
  /**
699
722
  * Format a permalink to the Braintrust application for viewing the span
700
723
  * represented by the provided `slug`.
@@ -702,7 +725,7 @@ declare function spanComponentsToObjectId({ components, state, }: {
702
725
  * Links can be generated at any time, but they will only become viewable after
703
726
  * the span and its root have been flushed to the server and ingested.
704
727
  *
705
- * If you have a `Span` object, use {@link Span.permalink} instead.
728
+ * If you have a `Span` object, use {@link Span.link} instead.
706
729
  *
707
730
  * @param slug The identifier generated from {@link Span.export}.
708
731
  * @param opts Optional arguments.
@@ -1377,6 +1400,8 @@ declare class SpanImpl implements Span {
1377
1400
  end(args?: EndSpanArgs): number;
1378
1401
  export(): Promise<string>;
1379
1402
  permalink(): Promise<string>;
1403
+ link(): string;
1404
+ _link(orgName: string): string;
1380
1405
  flush(): Promise<void>;
1381
1406
  close(args?: EndSpanArgs): number;
1382
1407
  state(): BraintrustState;
@@ -1628,12 +1653,14 @@ interface DatasetSummary {
1628
1653
  dataSummary: DataSummary | undefined;
1629
1654
  }
1630
1655
  declare function simulateLoginForTests(): Promise<BraintrustState>;
1656
+ declare function simulateLogoutForTests(): BraintrustState;
1631
1657
  declare const _exportsForTestingOnly: {
1632
1658
  extractAttachments: typeof extractAttachments;
1633
1659
  deepCopyEvent: typeof deepCopyEvent;
1634
1660
  useTestBackgroundLogger: typeof useTestBackgroundLogger;
1635
1661
  clearTestBackgroundLogger: typeof clearTestBackgroundLogger;
1636
1662
  simulateLoginForTests: typeof simulateLoginForTests;
1663
+ simulateLogoutForTests: typeof simulateLogoutForTests;
1637
1664
  };
1638
1665
 
1639
1666
  declare const braintrustStreamChunkSchema: z.ZodUnion<[z.ZodObject<{
@@ -11618,6 +11645,7 @@ declare const braintrust_DatasetRecord: typeof DatasetRecord;
11618
11645
  type braintrust_DatasetSummary = DatasetSummary;
11619
11646
  type braintrust_DefaultMetadataType = DefaultMetadataType;
11620
11647
  type braintrust_DefaultPromptArgs = DefaultPromptArgs;
11648
+ declare const braintrust_ERR_PERMALINK: typeof ERR_PERMALINK;
11621
11649
  type braintrust_EndSpanArgs = EndSpanArgs;
11622
11650
  type braintrust_EvalCase<Input, Expected, Metadata> = EvalCase<Input, Expected, Metadata>;
11623
11651
  type braintrust_EvalParameterSerializedSchema = EvalParameterSerializedSchema;
@@ -11723,7 +11751,7 @@ declare const braintrust_wrapOpenAI: typeof wrapOpenAI;
11723
11751
  declare const braintrust_wrapOpenAIv4: typeof wrapOpenAIv4;
11724
11752
  declare const braintrust_wrapTraced: typeof wrapTraced;
11725
11753
  declare namespace braintrust {
11726
- export { type braintrust_AnyDataset as AnyDataset, braintrust_Attachment as Attachment, type braintrust_AttachmentParams as AttachmentParams, type braintrust_BackgroundLoggerOpts as BackgroundLoggerOpts, braintrust_BaseAttachment as BaseAttachment, type braintrust_BaseMetadata as BaseMetadata, braintrust_BraintrustState as BraintrustState, braintrust_BraintrustStream as BraintrustStream, type braintrust_BraintrustStreamChunk as BraintrustStreamChunk, type braintrust_ChatPrompt as ChatPrompt, braintrust_CommentEvent as CommentEvent, type braintrust_CompiledPrompt as CompiledPrompt, type braintrust_CompiledPromptParams as CompiledPromptParams, type braintrust_CompletionPrompt as CompletionPrompt, type braintrust_DataSummary as DataSummary, braintrust_Dataset as Dataset, braintrust_DatasetRecord as DatasetRecord, type braintrust_DatasetSummary as DatasetSummary, type braintrust_DefaultMetadataType as DefaultMetadataType, type braintrust_DefaultPromptArgs as DefaultPromptArgs, type braintrust_EndSpanArgs as EndSpanArgs, type braintrust_EvalCase as EvalCase, type braintrust_EvalParameterSerializedSchema as EvalParameterSerializedSchema, type braintrust_EvalParameters as EvalParameters, type braintrust_EvaluatorDefinition as EvaluatorDefinition, type braintrust_EvaluatorDefinitions as EvaluatorDefinitions, type braintrust_EvaluatorManifest as EvaluatorManifest, braintrust_Experiment as Experiment, braintrust_ExperimentLogFullArgs as ExperimentLogFullArgs, braintrust_ExperimentLogPartialArgs as ExperimentLogPartialArgs, type braintrust_ExperimentSummary as ExperimentSummary, type braintrust_Exportable as Exportable, braintrust_ExternalAttachment as ExternalAttachment, type braintrust_ExternalAttachmentParams as ExternalAttachmentParams, braintrust_FailedHTTPResponse as FailedHTTPResponse, type braintrust_FullInitOptions as FullInitOptions, type braintrust_FullLoginOptions as FullLoginOptions, braintrust_INTERNAL_BTQL_LIMIT as INTERNAL_BTQL_LIMIT, braintrust_IdField as IdField, type braintrust_InitOptions as InitOptions, braintrust_InputField as InputField, type braintrust_InvokeFunctionArgs as InvokeFunctionArgs, type braintrust_InvokeReturn as InvokeReturn, braintrust_LEGACY_CACHED_HEADER as LEGACY_CACHED_HEADER, braintrust_LogCommentFullArgs as LogCommentFullArgs, braintrust_LogFeedbackFullArgs as LogFeedbackFullArgs, type braintrust_LogOptions as LogOptions, braintrust_Logger as Logger, type braintrust_LoginOptions as LoginOptions, type braintrust_MetricSummary as MetricSummary, braintrust_NOOP_SPAN as NOOP_SPAN, braintrust_NOOP_SPAN_PERMALINK as NOOP_SPAN_PERMALINK, braintrust_NoopSpan as NoopSpan, type braintrust_ObjectMetadata as ObjectMetadata, braintrust_OtherExperimentLogFields as OtherExperimentLogFields, braintrust_ParentExperimentIds as ParentExperimentIds, braintrust_ParentProjectLogIds as ParentProjectLogIds, type braintrust_PromiseUnless as PromiseUnless, braintrust_Prompt as Prompt, type braintrust_PromptRowWithId as PromptRowWithId, braintrust_ReadonlyAttachment as ReadonlyAttachment, braintrust_ReadonlyExperiment as ReadonlyExperiment, type braintrust_ScoreSummary as ScoreSummary, type braintrust_SerializedBraintrustState as SerializedBraintrustState, type braintrust_SetCurrentArg as SetCurrentArg, type braintrust_Span as Span, braintrust_SpanImpl as SpanImpl, type braintrust_StartSpanArgs as StartSpanArgs, type braintrust_WithTransactionId as WithTransactionId, braintrust_X_CACHED_HEADER as X_CACHED_HEADER, braintrust__exportsForTestingOnly as _exportsForTestingOnly, braintrust__internalGetGlobalState as _internalGetGlobalState, braintrust__internalSetInitialState as _internalSetInitialState, braintrust_braintrustStreamChunkSchema as braintrustStreamChunkSchema, braintrust_createFinalValuePassThroughStream as createFinalValuePassThroughStream, braintrust_currentExperiment as currentExperiment, braintrust_currentLogger as currentLogger, braintrust_currentSpan as currentSpan, braintrust_deserializePlainStringAsJSON as deserializePlainStringAsJSON, braintrust_devNullWritableStream as devNullWritableStream, braintrust_evaluatorDefinitionSchema as evaluatorDefinitionSchema, braintrust_evaluatorDefinitionsSchema as evaluatorDefinitionsSchema, braintrust_flush as flush, braintrust_getSpanParentObject as getSpanParentObject, braintrust_init as init, braintrust_initDataset as initDataset, braintrust_initExperiment as initExperiment, braintrust_initFunction as initFunction, braintrust_initLogger as initLogger, braintrust_invoke as invoke, braintrust_loadPrompt as loadPrompt, braintrust_log as log, braintrust_logError as logError, braintrust_login as login, braintrust_loginToState as loginToState, braintrust_newId as newId, braintrust_parseCachedHeader as parseCachedHeader, braintrust_permalink as permalink, braintrust_renderMessage as renderMessage, braintrust_renderPromptParams as renderPromptParams, braintrust_setFetch as setFetch, braintrust_spanComponentsToObjectId as spanComponentsToObjectId, braintrust_startSpan as startSpan, braintrust_summarize as summarize, braintrust_traceable as traceable, braintrust_traced as traced, braintrust_updateSpan as updateSpan, braintrust_withCurrent as withCurrent, braintrust_withDataset as withDataset, braintrust_withExperiment as withExperiment, braintrust_withLogger as withLogger, braintrust_withParent as withParent, braintrust_wrapOpenAI as wrapOpenAI, braintrust_wrapOpenAIv4 as wrapOpenAIv4, braintrust_wrapTraced as wrapTraced };
11754
+ export { type braintrust_AnyDataset as AnyDataset, braintrust_Attachment as Attachment, type braintrust_AttachmentParams as AttachmentParams, type braintrust_BackgroundLoggerOpts as BackgroundLoggerOpts, braintrust_BaseAttachment as BaseAttachment, type braintrust_BaseMetadata as BaseMetadata, braintrust_BraintrustState as BraintrustState, braintrust_BraintrustStream as BraintrustStream, type braintrust_BraintrustStreamChunk as BraintrustStreamChunk, type braintrust_ChatPrompt as ChatPrompt, braintrust_CommentEvent as CommentEvent, type braintrust_CompiledPrompt as CompiledPrompt, type braintrust_CompiledPromptParams as CompiledPromptParams, type braintrust_CompletionPrompt as CompletionPrompt, type braintrust_DataSummary as DataSummary, braintrust_Dataset as Dataset, braintrust_DatasetRecord as DatasetRecord, type braintrust_DatasetSummary as DatasetSummary, type braintrust_DefaultMetadataType as DefaultMetadataType, type braintrust_DefaultPromptArgs as DefaultPromptArgs, braintrust_ERR_PERMALINK as ERR_PERMALINK, type braintrust_EndSpanArgs as EndSpanArgs, type braintrust_EvalCase as EvalCase, type braintrust_EvalParameterSerializedSchema as EvalParameterSerializedSchema, type braintrust_EvalParameters as EvalParameters, type braintrust_EvaluatorDefinition as EvaluatorDefinition, type braintrust_EvaluatorDefinitions as EvaluatorDefinitions, type braintrust_EvaluatorManifest as EvaluatorManifest, braintrust_Experiment as Experiment, braintrust_ExperimentLogFullArgs as ExperimentLogFullArgs, braintrust_ExperimentLogPartialArgs as ExperimentLogPartialArgs, type braintrust_ExperimentSummary as ExperimentSummary, type braintrust_Exportable as Exportable, braintrust_ExternalAttachment as ExternalAttachment, type braintrust_ExternalAttachmentParams as ExternalAttachmentParams, braintrust_FailedHTTPResponse as FailedHTTPResponse, type braintrust_FullInitOptions as FullInitOptions, type braintrust_FullLoginOptions as FullLoginOptions, braintrust_INTERNAL_BTQL_LIMIT as INTERNAL_BTQL_LIMIT, braintrust_IdField as IdField, type braintrust_InitOptions as InitOptions, braintrust_InputField as InputField, type braintrust_InvokeFunctionArgs as InvokeFunctionArgs, type braintrust_InvokeReturn as InvokeReturn, braintrust_LEGACY_CACHED_HEADER as LEGACY_CACHED_HEADER, braintrust_LogCommentFullArgs as LogCommentFullArgs, braintrust_LogFeedbackFullArgs as LogFeedbackFullArgs, type braintrust_LogOptions as LogOptions, braintrust_Logger as Logger, type braintrust_LoginOptions as LoginOptions, type braintrust_MetricSummary as MetricSummary, braintrust_NOOP_SPAN as NOOP_SPAN, braintrust_NOOP_SPAN_PERMALINK as NOOP_SPAN_PERMALINK, braintrust_NoopSpan as NoopSpan, type braintrust_ObjectMetadata as ObjectMetadata, braintrust_OtherExperimentLogFields as OtherExperimentLogFields, braintrust_ParentExperimentIds as ParentExperimentIds, braintrust_ParentProjectLogIds as ParentProjectLogIds, type braintrust_PromiseUnless as PromiseUnless, braintrust_Prompt as Prompt, type braintrust_PromptRowWithId as PromptRowWithId, braintrust_ReadonlyAttachment as ReadonlyAttachment, braintrust_ReadonlyExperiment as ReadonlyExperiment, type braintrust_ScoreSummary as ScoreSummary, type braintrust_SerializedBraintrustState as SerializedBraintrustState, type braintrust_SetCurrentArg as SetCurrentArg, type braintrust_Span as Span, braintrust_SpanImpl as SpanImpl, type braintrust_StartSpanArgs as StartSpanArgs, type braintrust_WithTransactionId as WithTransactionId, braintrust_X_CACHED_HEADER as X_CACHED_HEADER, braintrust__exportsForTestingOnly as _exportsForTestingOnly, braintrust__internalGetGlobalState as _internalGetGlobalState, braintrust__internalSetInitialState as _internalSetInitialState, braintrust_braintrustStreamChunkSchema as braintrustStreamChunkSchema, braintrust_createFinalValuePassThroughStream as createFinalValuePassThroughStream, braintrust_currentExperiment as currentExperiment, braintrust_currentLogger as currentLogger, braintrust_currentSpan as currentSpan, braintrust_deserializePlainStringAsJSON as deserializePlainStringAsJSON, braintrust_devNullWritableStream as devNullWritableStream, braintrust_evaluatorDefinitionSchema as evaluatorDefinitionSchema, braintrust_evaluatorDefinitionsSchema as evaluatorDefinitionsSchema, braintrust_flush as flush, braintrust_getSpanParentObject as getSpanParentObject, braintrust_init as init, braintrust_initDataset as initDataset, braintrust_initExperiment as initExperiment, braintrust_initFunction as initFunction, braintrust_initLogger as initLogger, braintrust_invoke as invoke, braintrust_loadPrompt as loadPrompt, braintrust_log as log, braintrust_logError as logError, braintrust_login as login, braintrust_loginToState as loginToState, braintrust_newId as newId, braintrust_parseCachedHeader as parseCachedHeader, braintrust_permalink as permalink, braintrust_renderMessage as renderMessage, braintrust_renderPromptParams as renderPromptParams, braintrust_setFetch as setFetch, braintrust_spanComponentsToObjectId as spanComponentsToObjectId, braintrust_startSpan as startSpan, braintrust_summarize as summarize, braintrust_traceable as traceable, braintrust_traced as traced, braintrust_updateSpan as updateSpan, braintrust_withCurrent as withCurrent, braintrust_withDataset as withDataset, braintrust_withExperiment as withExperiment, braintrust_withLogger as withLogger, braintrust_withParent as withParent, braintrust_wrapOpenAI as wrapOpenAI, braintrust_wrapOpenAIv4 as wrapOpenAIv4, braintrust_wrapTraced as wrapTraced };
11727
11755
  }
11728
11756
 
11729
- export { type AnyDataset, Attachment, type AttachmentParams, type BackgroundLoggerOpts, BaseAttachment, type BaseMetadata, BraintrustState, BraintrustStream, type BraintrustStreamChunk, type ChatPrompt, type CompiledPrompt, type CompiledPromptParams, type CompletionPrompt, type DataSummary, Dataset, type DatasetSummary, type DefaultMetadataType, type DefaultPromptArgs, type EndSpanArgs, type EvalCase, type EvalParameterSerializedSchema, type EvalParameters, type EvaluatorDefinition, type EvaluatorDefinitions, type EvaluatorManifest, Experiment, type ExperimentSummary, type Exportable, ExternalAttachment, type ExternalAttachmentParams, FailedHTTPResponse, type FullInitOptions, type FullLoginOptions, INTERNAL_BTQL_LIMIT, type InitOptions, type InvokeFunctionArgs, type InvokeReturn, LEGACY_CACHED_HEADER, type LogOptions, Logger, type LoginOptions, type MetricSummary, NOOP_SPAN, NOOP_SPAN_PERMALINK, NoopSpan, type ObjectMetadata, type PromiseUnless, Prompt, type PromptRowWithId, ReadonlyAttachment, ReadonlyExperiment, type ScoreSummary, type SerializedBraintrustState, type SetCurrentArg, type Span, SpanImpl, type StartSpanArgs, type WithTransactionId, X_CACHED_HEADER, _exportsForTestingOnly, _internalGetGlobalState, _internalSetInitialState, braintrustStreamChunkSchema, createFinalValuePassThroughStream, currentExperiment, currentLogger, currentSpan, braintrust as default, deserializePlainStringAsJSON, devNullWritableStream, evaluatorDefinitionSchema, evaluatorDefinitionsSchema, flush, getSpanParentObject, init, initDataset, initExperiment, initFunction, initLogger, invoke, loadPrompt, log, logError, login, loginToState, newId, parseCachedHeader, permalink, renderMessage, renderPromptParams, setFetch, spanComponentsToObjectId, startSpan, summarize, traceable, traced, updateSpan, withCurrent, withDataset, withExperiment, withLogger, withParent, wrapOpenAI, wrapOpenAIv4, wrapTraced };
11757
+ export { type AnyDataset, Attachment, type AttachmentParams, type BackgroundLoggerOpts, BaseAttachment, type BaseMetadata, BraintrustState, BraintrustStream, type BraintrustStreamChunk, type ChatPrompt, type CompiledPrompt, type CompiledPromptParams, type CompletionPrompt, type DataSummary, Dataset, type DatasetSummary, type DefaultMetadataType, type DefaultPromptArgs, ERR_PERMALINK, type EndSpanArgs, type EvalCase, type EvalParameterSerializedSchema, type EvalParameters, type EvaluatorDefinition, type EvaluatorDefinitions, type EvaluatorManifest, Experiment, type ExperimentSummary, type Exportable, ExternalAttachment, type ExternalAttachmentParams, FailedHTTPResponse, type FullInitOptions, type FullLoginOptions, INTERNAL_BTQL_LIMIT, type InitOptions, type InvokeFunctionArgs, type InvokeReturn, LEGACY_CACHED_HEADER, type LogOptions, Logger, type LoginOptions, type MetricSummary, NOOP_SPAN, NOOP_SPAN_PERMALINK, NoopSpan, type ObjectMetadata, type PromiseUnless, Prompt, type PromptRowWithId, ReadonlyAttachment, ReadonlyExperiment, type ScoreSummary, type SerializedBraintrustState, type SetCurrentArg, type Span, SpanImpl, type StartSpanArgs, type WithTransactionId, X_CACHED_HEADER, _exportsForTestingOnly, _internalGetGlobalState, _internalSetInitialState, braintrustStreamChunkSchema, createFinalValuePassThroughStream, currentExperiment, currentLogger, currentSpan, braintrust as default, deserializePlainStringAsJSON, devNullWritableStream, evaluatorDefinitionSchema, evaluatorDefinitionsSchema, flush, getSpanParentObject, init, initDataset, initExperiment, initFunction, initLogger, invoke, loadPrompt, log, logError, login, loginToState, newId, parseCachedHeader, permalink, renderMessage, renderPromptParams, setFetch, spanComponentsToObjectId, startSpan, summarize, traceable, traced, updateSpan, withCurrent, withDataset, withExperiment, withLogger, withParent, wrapOpenAI, wrapOpenAIv4, wrapTraced };