braintrust 0.4.1 → 0.4.3

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/cli.js CHANGED
@@ -6364,7 +6364,6 @@ var init_context3 = __esm({
6364
6364
  "src/otel/context.ts"() {
6365
6365
  "use strict";
6366
6366
  init_logger();
6367
- init_util();
6368
6367
  OTEL_NOT_INSTALLED_MESSAGE = "OpenTelemetry packages are not installed. Install them with: npm install @opentelemetry/api @opentelemetry/sdk-trace-base";
6369
6368
  otelTrace = null;
6370
6369
  otelContext = null;
@@ -6427,6 +6426,10 @@ var init_context3 = __esm({
6427
6426
  const currentContext = otelContext.active();
6428
6427
  let newContext = otelTrace.setSpan(currentContext, wrappedContext);
6429
6428
  newContext = newContext.setValue("braintrust_span", span);
6429
+ const parentValue = span._getOtelParent();
6430
+ if (parentValue) {
6431
+ newContext = newContext.setValue("braintrust.parent", parentValue);
6432
+ }
6430
6433
  return otelContext.with(newContext, callback);
6431
6434
  }
6432
6435
  } catch (error2) {
@@ -6442,34 +6445,6 @@ var init_context3 = __esm({
6442
6445
  }
6443
6446
  return void 0;
6444
6447
  }
6445
- _getOtelParent(span) {
6446
- if (!span.parentObjectType || !span.parentObjectId) {
6447
- return void 0;
6448
- }
6449
- try {
6450
- const parentType = span.parentObjectType;
6451
- const parentId = span.parentObjectId;
6452
- if (parentType === 2 /* PROJECT_LOGS */) {
6453
- const id = typeof parentId === "object" && parentId !== null && "get" in parentId ? (
6454
- // eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- Type guard ensures object has get method
6455
- parentId.get()
6456
- ) : parentId;
6457
- if (typeof id === "string") {
6458
- return `project_id:${id}`;
6459
- }
6460
- } else if (parentType === 1 /* EXPERIMENT */) {
6461
- const id = typeof parentId === "object" && parentId !== null && "get" in parentId ? (
6462
- // eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- Type guard ensures object has get method
6463
- parentId.get()
6464
- ) : parentId;
6465
- if (typeof id === "string") {
6466
- return `experiment_id:${id}`;
6467
- }
6468
- }
6469
- } catch {
6470
- }
6471
- return void 0;
6472
- }
6473
6448
  };
6474
6449
  }
6475
6450
  });
@@ -7744,6 +7719,9 @@ var init_logger = __esm({
7744
7719
  state() {
7745
7720
  return _internalGetGlobalState();
7746
7721
  }
7722
+ _getOtelParent() {
7723
+ return void 0;
7724
+ }
7747
7725
  // Custom inspect for Node.js console.log
7748
7726
  [Symbol.for("nodejs.util.inspect.custom")]() {
7749
7727
  return `NoopSpan {
@@ -8471,6 +8449,9 @@ with a Blob/ArrayBuffer, or run the program on Node.js.`
8471
8449
  get id() {
8472
8450
  return (async () => (await this.project).id)();
8473
8451
  }
8452
+ get loggingState() {
8453
+ return this.state;
8454
+ }
8474
8455
  parentObjectType() {
8475
8456
  return 2 /* PROJECT_LOGS */;
8476
8457
  }
@@ -9131,6 +9112,18 @@ Error: ${errorText}`;
9131
9112
  return (await this.lazyMetadata.get()).experiment.id;
9132
9113
  })();
9133
9114
  }
9115
+ get loggingState() {
9116
+ return this.state;
9117
+ }
9118
+ /**
9119
+ * Wait for the experiment ID to be resolved. This is useful for ensuring the ID
9120
+ * is available synchronously in child spans (for OTEL parent attributes).
9121
+ * @internal
9122
+ */
9123
+ async _waitForId() {
9124
+ await this.lazyId.get().catch(() => {
9125
+ });
9126
+ }
9134
9127
  get name() {
9135
9128
  return (async () => {
9136
9129
  return (await this.lazyMetadata.get()).experiment.name;
@@ -9387,6 +9380,9 @@ View complete results in Braintrust or run experiment.summarize() again.`
9387
9380
  return (await this.lazyMetadata.get()).experiment.name;
9388
9381
  })();
9389
9382
  }
9383
+ get loggingState() {
9384
+ return this.state;
9385
+ }
9390
9386
  async getState() {
9391
9387
  await this.lazyMetadata.get();
9392
9388
  return this.state;
@@ -9683,6 +9679,42 @@ View complete results in Braintrust or run experiment.summarize() again.`
9683
9679
  state() {
9684
9680
  return this._state;
9685
9681
  }
9682
+ /**
9683
+ * Internal method to get the OTEL parent string for this span.
9684
+ * This is used by OtelContextManager to set the braintrust.parent attribute.
9685
+ * @returns A string like "project_id:X" or "experiment_id:X", or undefined if no parent
9686
+ */
9687
+ _getOtelParent() {
9688
+ if (!this.parentObjectType) {
9689
+ return void 0;
9690
+ }
9691
+ try {
9692
+ if (this.parentObjectType === 2 /* PROJECT_LOGS */) {
9693
+ const syncResult = this.parentObjectId.getSync();
9694
+ const id = syncResult.value;
9695
+ const args = this.parentComputeObjectMetadataArgs;
9696
+ if (id) {
9697
+ return `project_id:${id}`;
9698
+ }
9699
+ const projectName = args?.project_name;
9700
+ if (projectName) {
9701
+ return `project_name:${projectName}`;
9702
+ }
9703
+ } else if (this.parentObjectType === 1 /* EXPERIMENT */) {
9704
+ const syncResult = this.parentObjectId.getSync();
9705
+ const id = syncResult.value;
9706
+ if (!syncResult.resolved) {
9707
+ this.parentObjectId.get().catch(() => {
9708
+ });
9709
+ }
9710
+ if (id) {
9711
+ return `experiment_id:${id}`;
9712
+ }
9713
+ }
9714
+ } catch (e) {
9715
+ }
9716
+ return void 0;
9717
+ }
9686
9718
  // Custom inspect for Node.js console.log
9687
9719
  [Symbol.for("nodejs.util.inspect.custom")]() {
9688
9720
  return `SpanImpl {
@@ -9739,6 +9771,9 @@ View complete results in Braintrust or run experiment.summarize() again.`
9739
9771
  return (await this.lazyMetadata.get()).project;
9740
9772
  })();
9741
9773
  }
9774
+ get loggingState() {
9775
+ return this.state;
9776
+ }
9742
9777
  async getState() {
9743
9778
  await this.lazyMetadata.get();
9744
9779
  return this.state;
@@ -10173,7 +10208,7 @@ var require_package = __commonJS({
10173
10208
  "package.json"(exports2, module2) {
10174
10209
  module2.exports = {
10175
10210
  name: "braintrust",
10176
- version: "0.4.1",
10211
+ version: "0.4.3",
10177
10212
  description: "SDK for integrating Braintrust",
10178
10213
  repository: {
10179
10214
  type: "git",
@@ -10319,7 +10354,7 @@ var dotenv2 = __toESM(require("dotenv"));
10319
10354
  var import_fs2 = __toESM(require("fs"));
10320
10355
  var import_os = __toESM(require("os"));
10321
10356
  var import_path6 = __toESM(require("path"));
10322
- var import_util15 = __toESM(require("util"));
10357
+ var import_util14 = __toESM(require("util"));
10323
10358
  var fsWalk = __toESM(require_out3());
10324
10359
  var import_minimatch = require("minimatch");
10325
10360
  var import_argparse = require("argparse");
@@ -11922,6 +11957,9 @@ async function Eval(name, evaluator, reporterOrOpts) {
11922
11957
  repoInfo: evaluator.repoInfo,
11923
11958
  dataset: Dataset2.isDataset(data) ? data : void 0
11924
11959
  });
11960
+ if (experiment && typeof process !== "undefined" && process.env?.BRAINTRUST_OTEL_COMPAT?.toLowerCase() === "true") {
11961
+ await experiment._waitForId();
11962
+ }
11925
11963
  if (experiment && options.onStart) {
11926
11964
  const summary = await experiment.summarize({ summarizeScores: false });
11927
11965
  options.onStart(summary);
@@ -12664,7 +12702,7 @@ function getCallerLocation() {
12664
12702
 
12665
12703
  // src/node.ts
12666
12704
  init_logger();
12667
- var import_util9 = require("util");
12705
+ var import_util8 = require("util");
12668
12706
  var zlib = __toESM(require("zlib"));
12669
12707
  function configureNode() {
12670
12708
  isomorph_default.getRepoInfo = getRepoInfo;
@@ -12686,8 +12724,8 @@ function configureNode() {
12686
12724
  isomorph_default.utimes = fs.utimes;
12687
12725
  isomorph_default.unlink = fs.unlink;
12688
12726
  isomorph_default.homedir = os.homedir;
12689
- isomorph_default.gzip = (0, import_util9.promisify)(zlib.gzip);
12690
- isomorph_default.gunzip = (0, import_util9.promisify)(zlib.gunzip);
12727
+ isomorph_default.gzip = (0, import_util8.promisify)(zlib.gzip);
12728
+ isomorph_default.gunzip = (0, import_util8.promisify)(zlib.gunzip);
12691
12729
  isomorph_default.hash = (data) => crypto.createHash("sha256").update(data).digest("hex");
12692
12730
  _internalSetInitialState();
12693
12731
  }
@@ -13311,7 +13349,7 @@ init_generated_types();
13311
13349
  init_logger();
13312
13350
  var import_v311 = require("zod/v3");
13313
13351
  var import_promises = __toESM(require("fs/promises"));
13314
- var import_util12 = __toESM(require("util"));
13352
+ var import_util11 = __toESM(require("util"));
13315
13353
  var import_slugify3 = __toESM(require("slugify"));
13316
13354
  var import_path5 = __toESM(require("path"));
13317
13355
  init_util();
@@ -13584,7 +13622,7 @@ function safeStringify(obj) {
13584
13622
  return JSON.stringify(obj, null, 2);
13585
13623
  } catch (error2) {
13586
13624
  try {
13587
- return import_util12.default.inspect(obj, {
13625
+ return import_util11.default.inspect(obj, {
13588
13626
  depth: 5,
13589
13627
  maxStringLength: 1e3,
13590
13628
  breakLength: 80,
@@ -14586,7 +14624,7 @@ async function collectFiles(inputPath, mode) {
14586
14624
  }
14587
14625
  files.push(inputPath);
14588
14626
  } else {
14589
- const walked = await import_util15.default.promisify(fsWalk.walk)(inputPath, {
14627
+ const walked = await import_util14.default.promisify(fsWalk.walk)(inputPath, {
14590
14628
  deepFilter: (entry) => {
14591
14629
  return checkMatch(entry.path, null, EXCLUDE);
14592
14630
  },
package/dist/index.d.mts CHANGED
@@ -14477,6 +14477,12 @@ interface Span$1 extends Exportable {
14477
14477
  */
14478
14478
  startSpanWithParents(spanId: string, spanParents: string[], args?: StartSpanArgs): Span$1;
14479
14479
  state(): BraintrustState;
14480
+ /**
14481
+ * Internal method to get the OTEL parent string for this span.
14482
+ * This is used by OtelContextManager to set the braintrust.parent attribute.
14483
+ * @returns A string like "project_id:X" or "experiment_id:X", or undefined if no parent
14484
+ */
14485
+ _getOtelParent(): string | undefined;
14480
14486
  kind: "span";
14481
14487
  }
14482
14488
  declare abstract class ContextManager {
@@ -14508,6 +14514,7 @@ declare class NoopSpan implements Span$1 {
14508
14514
  setAttributes(_args: Omit<StartSpanArgs, "event">): void;
14509
14515
  startSpanWithParents(_spanId: string, _spanParents: string[], _args?: StartSpanArgs): Span$1;
14510
14516
  state(): BraintrustState;
14517
+ _getOtelParent(): string | undefined;
14511
14518
  toString(): string;
14512
14519
  }
14513
14520
  declare const NOOP_SPAN: NoopSpan;
@@ -14869,6 +14876,48 @@ declare class ReadonlyAttachment {
14869
14876
  status(): Promise<AttachmentStatusType>;
14870
14877
  private initDownloader;
14871
14878
  }
14879
+ /**
14880
+ * Represents a JSON object that should be stored as an attachment.
14881
+ *
14882
+ * `JSONAttachment` is a convenience function that creates an `Attachment`
14883
+ * from JSON data. It's particularly useful for large JSON objects that
14884
+ * would otherwise bloat the trace size.
14885
+ *
14886
+ * The JSON data is automatically serialized and stored as an attachment
14887
+ * with content type "application/json".
14888
+ */
14889
+ declare class JSONAttachment extends Attachment {
14890
+ /**
14891
+ * Construct a JSONAttachment from a JSON-serializable object.
14892
+ *
14893
+ * @param data The JSON object to attach. Must be JSON-serializable.
14894
+ * @param options Additional options:
14895
+ * - `filename`: The filename for the attachment (defaults to "data.json")
14896
+ * - `pretty`: Whether to pretty-print the JSON (defaults to false)
14897
+ * - `state`: (Optional) For internal use.
14898
+ *
14899
+ * @example
14900
+ * ```typescript
14901
+ * const largeTranscript = [
14902
+ * { role: "user", content: "..." },
14903
+ * { role: "assistant", content: "..." },
14904
+ * // ... many more messages
14905
+ * ];
14906
+ *
14907
+ * logger.log({
14908
+ * input: {
14909
+ * type: "chat",
14910
+ * transcript: new JSONAttachment(largeTranscript, { filename: "transcript.json" })
14911
+ * }
14912
+ * });
14913
+ * ```
14914
+ */
14915
+ constructor(data: unknown, options?: {
14916
+ filename?: string;
14917
+ pretty?: boolean;
14918
+ state?: BraintrustState;
14919
+ });
14920
+ }
14872
14921
  /**
14873
14922
  * Update a span using the output of `span.export()`. It is important that you only resume updating
14874
14923
  * to a span once the original span has been fully written and flushed, since otherwise updates to
@@ -14928,6 +14977,7 @@ declare class Logger<IsAsyncFlush extends boolean> implements Exportable {
14928
14977
  get org_id(): Promise<string>;
14929
14978
  get project(): Promise<ObjectMetadata>;
14930
14979
  get id(): Promise<string>;
14980
+ get loggingState(): BraintrustState;
14931
14981
  private parentObjectType;
14932
14982
  /**
14933
14983
  * Log a single event. The event will be batched and uploaded behind the scenes if `logOptions.asyncFlush` is true.
@@ -15479,6 +15529,13 @@ declare class Experiment extends ObjectFetcher<ExperimentEvent> implements Expor
15479
15529
  kind: "experiment";
15480
15530
  constructor(state: BraintrustState, lazyMetadata: LazyValue<ProjectExperimentMetadata>, dataset?: AnyDataset);
15481
15531
  get id(): Promise<string>;
15532
+ get loggingState(): BraintrustState;
15533
+ /**
15534
+ * Wait for the experiment ID to be resolved. This is useful for ensuring the ID
15535
+ * is available synchronously in child spans (for OTEL parent attributes).
15536
+ * @internal
15537
+ */
15538
+ _waitForId(): Promise<void>;
15482
15539
  get name(): Promise<string>;
15483
15540
  get project(): Promise<ObjectMetadata>;
15484
15541
  private parentObjectType;
@@ -15577,6 +15634,7 @@ declare class ReadonlyExperiment extends ObjectFetcher<ExperimentEvent> {
15577
15634
  constructor(state: BraintrustState, lazyMetadata: LazyValue<ProjectExperimentMetadata>);
15578
15635
  get id(): Promise<string>;
15579
15636
  get name(): Promise<string>;
15637
+ get loggingState(): BraintrustState;
15580
15638
  protected getState(): Promise<BraintrustState>;
15581
15639
  asDataset<Input, Expected, Metadata = DefaultMetadataType>(): AsyncGenerator<EvalCase<Input, Expected, Metadata>>;
15582
15640
  }
@@ -15628,6 +15686,12 @@ declare class SpanImpl implements Span$1 {
15628
15686
  flush(): Promise<void>;
15629
15687
  close(args?: EndSpanArgs): number;
15630
15688
  state(): BraintrustState;
15689
+ /**
15690
+ * Internal method to get the OTEL parent string for this span.
15691
+ * This is used by OtelContextManager to set the braintrust.parent attribute.
15692
+ * @returns A string like "project_id:X" or "experiment_id:X", or undefined if no parent
15693
+ */
15694
+ _getOtelParent(): string | undefined;
15631
15695
  toString(): string;
15632
15696
  }
15633
15697
  /**
@@ -15646,6 +15710,7 @@ declare class Dataset<IsLegacyDataset extends boolean = typeof DEFAULT_IS_LEGACY
15646
15710
  get id(): Promise<string>;
15647
15711
  get name(): Promise<string>;
15648
15712
  get project(): Promise<ObjectMetadata>;
15713
+ get loggingState(): BraintrustState;
15649
15714
  protected getState(): Promise<BraintrustState>;
15650
15715
  private validateEvent;
15651
15716
  private createArgs;
@@ -21683,6 +21748,8 @@ declare const braintrust_INTERNAL_BTQL_LIMIT: typeof INTERNAL_BTQL_LIMIT;
21683
21748
  type braintrust_InitOptions<IsOpen extends boolean> = InitOptions<IsOpen>;
21684
21749
  type braintrust_InvokeFunctionArgs<Input, Output, Stream extends boolean = false> = InvokeFunctionArgs<Input, Output, Stream>;
21685
21750
  type braintrust_InvokeReturn<Stream extends boolean, Output> = InvokeReturn<Stream, Output>;
21751
+ type braintrust_JSONAttachment = JSONAttachment;
21752
+ declare const braintrust_JSONAttachment: typeof JSONAttachment;
21686
21753
  declare const braintrust_LEGACY_CACHED_HEADER: typeof LEGACY_CACHED_HEADER;
21687
21754
  type braintrust_LazyValue<T> = LazyValue<T>;
21688
21755
  declare const braintrust_LazyValue: typeof LazyValue;
@@ -21799,7 +21866,7 @@ declare const braintrust_wrapOpenAI: typeof wrapOpenAI;
21799
21866
  declare const braintrust_wrapOpenAIv4: typeof wrapOpenAIv4;
21800
21867
  declare const braintrust_wrapTraced: typeof wrapTraced;
21801
21868
  declare namespace braintrust {
21802
- export { braintrust_AISpanProcessor as AISpanProcessor, type braintrust_AnyDataset as AnyDataset, braintrust_Attachment as Attachment, type braintrust_AttachmentParams as AttachmentParams, type braintrust_BackgroundLoggerOpts as BackgroundLoggerOpts, braintrust_BaseAttachment as BaseAttachment, braintrust_BaseExperiment as BaseExperiment, type braintrust_BaseMetadata as BaseMetadata, braintrust_BraintrustExporter as BraintrustExporter, braintrust_BraintrustMiddleware as BraintrustMiddleware, braintrust_BraintrustSpanProcessor as BraintrustSpanProcessor, braintrust_BraintrustState as BraintrustState, braintrust_BraintrustStream as BraintrustStream, type braintrust_BraintrustStreamChunk as BraintrustStreamChunk, type braintrust_ChatPrompt as ChatPrompt, braintrust_CodeFunction as CodeFunction, type braintrust_CodeOpts as CodeOpts, braintrust_CodePrompt as CodePrompt, type braintrust_CompiledPrompt as CompiledPrompt, type braintrust_CompiledPromptParams as CompiledPromptParams, type braintrust_CompletionPrompt as CompletionPrompt, braintrust_ContextManager as ContextManager, type braintrust_ContextParentSpanIds as ContextParentSpanIds, type braintrust_CreateProjectOpts as CreateProjectOpts, type braintrust_DataSummary as DataSummary, braintrust_Dataset as Dataset, 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, braintrust_Eval as Eval, type braintrust_EvalCase as EvalCase, type braintrust_EvalHooks as EvalHooks, type braintrust_EvalResult as EvalResult, braintrust_EvalResultWithSummary as EvalResultWithSummary, type braintrust_EvalScorer as EvalScorer, type braintrust_EvalScorerArgs as EvalScorerArgs, type braintrust_EvalTask as EvalTask, type braintrust_Evaluator as Evaluator, type braintrust_EvaluatorDef as EvaluatorDef, type braintrust_EvaluatorFile as EvaluatorFile, braintrust_Experiment as Experiment, 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, type braintrust_FunctionEvent as FunctionEvent, braintrust_IDGenerator as IDGenerator, braintrust_INTERNAL_BTQL_LIMIT as INTERNAL_BTQL_LIMIT, type braintrust_InitOptions as InitOptions, type braintrust_InvokeFunctionArgs as InvokeFunctionArgs, type braintrust_InvokeReturn as InvokeReturn, braintrust_LEGACY_CACHED_HEADER as LEGACY_CACHED_HEADER, braintrust_LazyValue as LazyValue, 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, braintrust_OTELIDGenerator as OTELIDGenerator, type braintrust_ObjectMetadata as ObjectMetadata, braintrust_Project as Project, braintrust_ProjectNameIdMap as ProjectNameIdMap, type braintrust_PromiseUnless as PromiseUnless, braintrust_Prompt as Prompt, braintrust_PromptBuilder as PromptBuilder, type braintrust_PromptContents as PromptContents, type braintrust_PromptDefinition as PromptDefinition, type braintrust_PromptDefinitionWithTools as PromptDefinitionWithTools, type braintrust_PromptOpts as PromptOpts, type braintrust_PromptRowWithId as PromptRowWithId, braintrust_ReadonlyAttachment as ReadonlyAttachment, braintrust_ReadonlyExperiment as ReadonlyExperiment, braintrust_Reporter as Reporter, type braintrust_ReporterBody as ReporterBody, type braintrust_ScoreSummary as ScoreSummary, braintrust_ScorerBuilder as ScorerBuilder, type braintrust_ScorerOpts as ScorerOpts, type braintrust_SerializedBraintrustState as SerializedBraintrustState, type braintrust_SetCurrentArg as SetCurrentArg, type Span$1 as Span, type braintrust_SpanContext as SpanContext, braintrust_SpanImpl as SpanImpl, type braintrust_StartSpanArgs as StartSpanArgs, braintrust_TestBackgroundLogger as TestBackgroundLogger, braintrust_ToolBuilder as ToolBuilder, braintrust_UUIDGenerator as UUIDGenerator, 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_buildLocalSummary as buildLocalSummary, braintrust_createFinalValuePassThroughStream as createFinalValuePassThroughStream, braintrust_currentExperiment as currentExperiment, braintrust_currentLogger as currentLogger, braintrust_currentSpan as currentSpan, braintrust_deepCopyEvent as deepCopyEvent, braintrust_defaultErrorScoreHandler as defaultErrorScoreHandler, braintrust_deserializePlainStringAsJSON as deserializePlainStringAsJSON, braintrust_devNullWritableStream as devNullWritableStream, braintrust_flush as flush, braintrust_getContextManager as getContextManager, braintrust_getIdGenerator as getIdGenerator, braintrust_getPromptVersions as getPromptVersions, braintrust_getSpanParentObject as getSpanParentObject, graphFramework as graph, 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_projects as projects, braintrust_promptContentsSchema as promptContentsSchema, braintrust_promptDefinitionSchema as promptDefinitionSchema, braintrust_promptDefinitionToPromptData as promptDefinitionToPromptData, braintrust_promptDefinitionWithToolsSchema as promptDefinitionWithToolsSchema, braintrust_renderMessage as renderMessage, braintrust_renderPromptParams as renderPromptParams, braintrust_reportFailures as reportFailures, braintrust_runEvaluator as runEvaluator, braintrust_setFetch as setFetch, braintrust_setMaskingFunction as setMaskingFunction, braintrust_spanComponentsToObjectId as spanComponentsToObjectId, braintrust_startSpan as startSpan, braintrust_summarize as summarize, ToolFunctionDefinition as toolFunctionDefinitionSchema, 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_wrapAISDK as wrapAISDK, braintrust_wrapAISDKModel as wrapAISDKModel, braintrust_wrapAnthropic as wrapAnthropic, braintrust_wrapClaudeAgentSDK as wrapClaudeAgentSDK, braintrust_wrapMastraAgent as wrapMastraAgent, braintrust_wrapOpenAI as wrapOpenAI, braintrust_wrapOpenAIv4 as wrapOpenAIv4, braintrust_wrapTraced as wrapTraced };
21869
+ export { braintrust_AISpanProcessor as AISpanProcessor, type braintrust_AnyDataset as AnyDataset, braintrust_Attachment as Attachment, type braintrust_AttachmentParams as AttachmentParams, type braintrust_BackgroundLoggerOpts as BackgroundLoggerOpts, braintrust_BaseAttachment as BaseAttachment, braintrust_BaseExperiment as BaseExperiment, type braintrust_BaseMetadata as BaseMetadata, braintrust_BraintrustExporter as BraintrustExporter, braintrust_BraintrustMiddleware as BraintrustMiddleware, braintrust_BraintrustSpanProcessor as BraintrustSpanProcessor, braintrust_BraintrustState as BraintrustState, braintrust_BraintrustStream as BraintrustStream, type braintrust_BraintrustStreamChunk as BraintrustStreamChunk, type braintrust_ChatPrompt as ChatPrompt, braintrust_CodeFunction as CodeFunction, type braintrust_CodeOpts as CodeOpts, braintrust_CodePrompt as CodePrompt, type braintrust_CompiledPrompt as CompiledPrompt, type braintrust_CompiledPromptParams as CompiledPromptParams, type braintrust_CompletionPrompt as CompletionPrompt, braintrust_ContextManager as ContextManager, type braintrust_ContextParentSpanIds as ContextParentSpanIds, type braintrust_CreateProjectOpts as CreateProjectOpts, type braintrust_DataSummary as DataSummary, braintrust_Dataset as Dataset, 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, braintrust_Eval as Eval, type braintrust_EvalCase as EvalCase, type braintrust_EvalHooks as EvalHooks, type braintrust_EvalResult as EvalResult, braintrust_EvalResultWithSummary as EvalResultWithSummary, type braintrust_EvalScorer as EvalScorer, type braintrust_EvalScorerArgs as EvalScorerArgs, type braintrust_EvalTask as EvalTask, type braintrust_Evaluator as Evaluator, type braintrust_EvaluatorDef as EvaluatorDef, type braintrust_EvaluatorFile as EvaluatorFile, braintrust_Experiment as Experiment, 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, type braintrust_FunctionEvent as FunctionEvent, braintrust_IDGenerator as IDGenerator, braintrust_INTERNAL_BTQL_LIMIT as INTERNAL_BTQL_LIMIT, type braintrust_InitOptions as InitOptions, type braintrust_InvokeFunctionArgs as InvokeFunctionArgs, type braintrust_InvokeReturn as InvokeReturn, braintrust_JSONAttachment as JSONAttachment, braintrust_LEGACY_CACHED_HEADER as LEGACY_CACHED_HEADER, braintrust_LazyValue as LazyValue, 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, braintrust_OTELIDGenerator as OTELIDGenerator, type braintrust_ObjectMetadata as ObjectMetadata, braintrust_Project as Project, braintrust_ProjectNameIdMap as ProjectNameIdMap, type braintrust_PromiseUnless as PromiseUnless, braintrust_Prompt as Prompt, braintrust_PromptBuilder as PromptBuilder, type braintrust_PromptContents as PromptContents, type braintrust_PromptDefinition as PromptDefinition, type braintrust_PromptDefinitionWithTools as PromptDefinitionWithTools, type braintrust_PromptOpts as PromptOpts, type braintrust_PromptRowWithId as PromptRowWithId, braintrust_ReadonlyAttachment as ReadonlyAttachment, braintrust_ReadonlyExperiment as ReadonlyExperiment, braintrust_Reporter as Reporter, type braintrust_ReporterBody as ReporterBody, type braintrust_ScoreSummary as ScoreSummary, braintrust_ScorerBuilder as ScorerBuilder, type braintrust_ScorerOpts as ScorerOpts, type braintrust_SerializedBraintrustState as SerializedBraintrustState, type braintrust_SetCurrentArg as SetCurrentArg, type Span$1 as Span, type braintrust_SpanContext as SpanContext, braintrust_SpanImpl as SpanImpl, type braintrust_StartSpanArgs as StartSpanArgs, braintrust_TestBackgroundLogger as TestBackgroundLogger, braintrust_ToolBuilder as ToolBuilder, braintrust_UUIDGenerator as UUIDGenerator, 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_buildLocalSummary as buildLocalSummary, braintrust_createFinalValuePassThroughStream as createFinalValuePassThroughStream, braintrust_currentExperiment as currentExperiment, braintrust_currentLogger as currentLogger, braintrust_currentSpan as currentSpan, braintrust_deepCopyEvent as deepCopyEvent, braintrust_defaultErrorScoreHandler as defaultErrorScoreHandler, braintrust_deserializePlainStringAsJSON as deserializePlainStringAsJSON, braintrust_devNullWritableStream as devNullWritableStream, braintrust_flush as flush, braintrust_getContextManager as getContextManager, braintrust_getIdGenerator as getIdGenerator, braintrust_getPromptVersions as getPromptVersions, braintrust_getSpanParentObject as getSpanParentObject, graphFramework as graph, 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_projects as projects, braintrust_promptContentsSchema as promptContentsSchema, braintrust_promptDefinitionSchema as promptDefinitionSchema, braintrust_promptDefinitionToPromptData as promptDefinitionToPromptData, braintrust_promptDefinitionWithToolsSchema as promptDefinitionWithToolsSchema, braintrust_renderMessage as renderMessage, braintrust_renderPromptParams as renderPromptParams, braintrust_reportFailures as reportFailures, braintrust_runEvaluator as runEvaluator, braintrust_setFetch as setFetch, braintrust_setMaskingFunction as setMaskingFunction, braintrust_spanComponentsToObjectId as spanComponentsToObjectId, braintrust_startSpan as startSpan, braintrust_summarize as summarize, ToolFunctionDefinition as toolFunctionDefinitionSchema, 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_wrapAISDK as wrapAISDK, braintrust_wrapAISDKModel as wrapAISDKModel, braintrust_wrapAnthropic as wrapAnthropic, braintrust_wrapClaudeAgentSDK as wrapClaudeAgentSDK, braintrust_wrapMastraAgent as wrapMastraAgent, braintrust_wrapOpenAI as wrapOpenAI, braintrust_wrapOpenAIv4 as wrapOpenAIv4, braintrust_wrapTraced as wrapTraced };
21803
21870
  }
21804
21871
 
21805
21872
  type EvaluatorManifest = Record<string, EvaluatorDef<unknown, unknown, unknown, BaseMetadata>>;
@@ -28856,4 +28923,4 @@ type EvaluatorDefinitions = z.infer<typeof evaluatorDefinitionsSchema>;
28856
28923
  * @module braintrust
28857
28924
  */
28858
28925
 
28859
- export { AISpanProcessor, type AnyDataset, Attachment, type AttachmentParams, type BackgroundLoggerOpts, BaseAttachment, BaseExperiment, type BaseMetadata, BraintrustExporter, BraintrustMiddleware, BraintrustSpanProcessor, BraintrustState, BraintrustStream, type BraintrustStreamChunk, type ChatPrompt, CodeFunction, type CodeOpts, CodePrompt, type CommentEvent, type CompiledPrompt, type CompiledPromptParams, type CompletionPrompt, ContextManager, type ContextParentSpanIds, type CreateProjectOpts, type DataSummary, Dataset, type DatasetRecord, type DatasetSummary, type DefaultMetadataType, type DefaultPromptArgs, ERR_PERMALINK, type EndSpanArgs, Eval, type EvalCase, type EvalHooks, type EvalParameterSerializedSchema, type EvalParameters, type EvalResult, EvalResultWithSummary, type EvalScorer, type EvalScorerArgs, type EvalTask, type Evaluator, type EvaluatorDef, type EvaluatorDefinition, type EvaluatorDefinitions, type EvaluatorFile, type EvaluatorManifest, Experiment, type ExperimentLogFullArgs, type ExperimentLogPartialArgs, type ExperimentSummary, type Exportable, ExternalAttachment, type ExternalAttachmentParams, FailedHTTPResponse, type FullInitOptions, type FullLoginOptions, type FunctionEvent, IDGenerator, INTERNAL_BTQL_LIMIT, type IdField, type InitOptions, type InputField, type InvokeFunctionArgs, type InvokeReturn, LEGACY_CACHED_HEADER, LazyValue, type LogCommentFullArgs, type LogFeedbackFullArgs, type LogOptions, Logger, type LoginOptions, type MetricSummary, NOOP_SPAN, NOOP_SPAN_PERMALINK, NoopSpan, OTELIDGenerator, type ObjectMetadata, type OtherExperimentLogFields, type ParentExperimentIds, type ParentProjectLogIds, Project, ProjectNameIdMap, type PromiseUnless, Prompt, PromptBuilder, type PromptContents, type PromptDefinition, type PromptDefinitionWithTools, type PromptOpts, type PromptRowWithId, ReadonlyAttachment, ReadonlyExperiment, Reporter, type ReporterBody, type ScoreSummary, ScorerBuilder, type ScorerOpts, type SerializedBraintrustState, type SetCurrentArg, type Span$1 as Span, type SpanContext, SpanImpl, type StartSpanArgs, TestBackgroundLogger, ToolBuilder, UUIDGenerator, type WithTransactionId, X_CACHED_HEADER, _exportsForTestingOnly, _internalGetGlobalState, _internalSetInitialState, braintrustStreamChunkSchema, buildLocalSummary, createFinalValuePassThroughStream, currentExperiment, currentLogger, currentSpan, deepCopyEvent, braintrust as default, defaultErrorScoreHandler, deserializePlainStringAsJSON, devNullWritableStream, evaluatorDefinitionSchema, evaluatorDefinitionsSchema, flush, getContextManager, getIdGenerator, getPromptVersions, getSpanParentObject, graphFramework as graph, init, initDataset, initExperiment, initFunction, initLogger, invoke, loadPrompt, log, logError, login, loginToState, newId, parseCachedHeader, permalink, projects, promptContentsSchema, promptDefinitionSchema, promptDefinitionToPromptData, promptDefinitionWithToolsSchema, renderMessage, renderPromptParams, reportFailures, runEvaluator, setFetch, setMaskingFunction, spanComponentsToObjectId, startSpan, summarize, ToolFunctionDefinition as toolFunctionDefinitionSchema, traceable, traced, updateSpan, withCurrent, withDataset, withExperiment, withLogger, withParent, wrapAISDK, wrapAISDKModel, wrapAnthropic, wrapClaudeAgentSDK, wrapMastraAgent, wrapOpenAI, wrapOpenAIv4, wrapTraced };
28926
+ export { AISpanProcessor, type AnyDataset, Attachment, type AttachmentParams, AttachmentReference, type BackgroundLoggerOpts, BaseAttachment, BaseExperiment, type BaseMetadata, BraintrustExporter, BraintrustMiddleware, BraintrustSpanProcessor, BraintrustState, BraintrustStream, type BraintrustStreamChunk, type ChatPrompt, CodeFunction, type CodeOpts, CodePrompt, type CommentEvent, type CompiledPrompt, type CompiledPromptParams, type CompletionPrompt, ContextManager, type ContextParentSpanIds, type CreateProjectOpts, type DataSummary, Dataset, type DatasetRecord, type DatasetSummary, type DefaultMetadataType, type DefaultPromptArgs, ERR_PERMALINK, type EndSpanArgs, Eval, type EvalCase, type EvalHooks, type EvalParameterSerializedSchema, type EvalParameters, type EvalResult, EvalResultWithSummary, type EvalScorer, type EvalScorerArgs, type EvalTask, type Evaluator, type EvaluatorDef, type EvaluatorDefinition, type EvaluatorDefinitions, type EvaluatorFile, type EvaluatorManifest, Experiment, type ExperimentLogFullArgs, type ExperimentLogPartialArgs, type ExperimentSummary, type Exportable, ExternalAttachment, type ExternalAttachmentParams, FailedHTTPResponse, type FullInitOptions, type FullLoginOptions, type FunctionEvent, IDGenerator, INTERNAL_BTQL_LIMIT, type IdField, type InitOptions, type InputField, type InvokeFunctionArgs, type InvokeReturn, JSONAttachment, LEGACY_CACHED_HEADER, LazyValue, type LogCommentFullArgs, type LogFeedbackFullArgs, type LogOptions, Logger, type LoginOptions, type MetricSummary, NOOP_SPAN, NOOP_SPAN_PERMALINK, NoopSpan, OTELIDGenerator, type ObjectMetadata, type OtherExperimentLogFields, type ParentExperimentIds, type ParentProjectLogIds, Project, ProjectNameIdMap, type PromiseUnless, Prompt, PromptBuilder, type PromptContents, type PromptDefinition, type PromptDefinitionWithTools, type PromptOpts, type PromptRowWithId, ReadonlyAttachment, ReadonlyExperiment, Reporter, type ReporterBody, type ScoreSummary, ScorerBuilder, type ScorerOpts, type SerializedBraintrustState, type SetCurrentArg, type Span$1 as Span, type SpanContext, SpanImpl, type StartSpanArgs, TestBackgroundLogger, ToolBuilder, UUIDGenerator, type WithTransactionId, X_CACHED_HEADER, _exportsForTestingOnly, _internalGetGlobalState, _internalSetInitialState, braintrustStreamChunkSchema, buildLocalSummary, createFinalValuePassThroughStream, currentExperiment, currentLogger, currentSpan, deepCopyEvent, braintrust as default, defaultErrorScoreHandler, deserializePlainStringAsJSON, devNullWritableStream, evaluatorDefinitionSchema, evaluatorDefinitionsSchema, flush, getContextManager, getIdGenerator, getPromptVersions, getSpanParentObject, graphFramework as graph, init, initDataset, initExperiment, initFunction, initLogger, invoke, loadPrompt, log, logError, login, loginToState, newId, parseCachedHeader, permalink, projects, promptContentsSchema, promptDefinitionSchema, promptDefinitionToPromptData, promptDefinitionWithToolsSchema, renderMessage, renderPromptParams, reportFailures, runEvaluator, setFetch, setMaskingFunction, spanComponentsToObjectId, startSpan, summarize, ToolFunctionDefinition as toolFunctionDefinitionSchema, traceable, traced, updateSpan, withCurrent, withDataset, withExperiment, withLogger, withParent, wrapAISDK, wrapAISDKModel, wrapAnthropic, wrapClaudeAgentSDK, wrapMastraAgent, wrapOpenAI, wrapOpenAIv4, wrapTraced };
package/dist/index.d.ts CHANGED
@@ -14477,6 +14477,12 @@ interface Span$1 extends Exportable {
14477
14477
  */
14478
14478
  startSpanWithParents(spanId: string, spanParents: string[], args?: StartSpanArgs): Span$1;
14479
14479
  state(): BraintrustState;
14480
+ /**
14481
+ * Internal method to get the OTEL parent string for this span.
14482
+ * This is used by OtelContextManager to set the braintrust.parent attribute.
14483
+ * @returns A string like "project_id:X" or "experiment_id:X", or undefined if no parent
14484
+ */
14485
+ _getOtelParent(): string | undefined;
14480
14486
  kind: "span";
14481
14487
  }
14482
14488
  declare abstract class ContextManager {
@@ -14508,6 +14514,7 @@ declare class NoopSpan implements Span$1 {
14508
14514
  setAttributes(_args: Omit<StartSpanArgs, "event">): void;
14509
14515
  startSpanWithParents(_spanId: string, _spanParents: string[], _args?: StartSpanArgs): Span$1;
14510
14516
  state(): BraintrustState;
14517
+ _getOtelParent(): string | undefined;
14511
14518
  toString(): string;
14512
14519
  }
14513
14520
  declare const NOOP_SPAN: NoopSpan;
@@ -14869,6 +14876,48 @@ declare class ReadonlyAttachment {
14869
14876
  status(): Promise<AttachmentStatusType>;
14870
14877
  private initDownloader;
14871
14878
  }
14879
+ /**
14880
+ * Represents a JSON object that should be stored as an attachment.
14881
+ *
14882
+ * `JSONAttachment` is a convenience function that creates an `Attachment`
14883
+ * from JSON data. It's particularly useful for large JSON objects that
14884
+ * would otherwise bloat the trace size.
14885
+ *
14886
+ * The JSON data is automatically serialized and stored as an attachment
14887
+ * with content type "application/json".
14888
+ */
14889
+ declare class JSONAttachment extends Attachment {
14890
+ /**
14891
+ * Construct a JSONAttachment from a JSON-serializable object.
14892
+ *
14893
+ * @param data The JSON object to attach. Must be JSON-serializable.
14894
+ * @param options Additional options:
14895
+ * - `filename`: The filename for the attachment (defaults to "data.json")
14896
+ * - `pretty`: Whether to pretty-print the JSON (defaults to false)
14897
+ * - `state`: (Optional) For internal use.
14898
+ *
14899
+ * @example
14900
+ * ```typescript
14901
+ * const largeTranscript = [
14902
+ * { role: "user", content: "..." },
14903
+ * { role: "assistant", content: "..." },
14904
+ * // ... many more messages
14905
+ * ];
14906
+ *
14907
+ * logger.log({
14908
+ * input: {
14909
+ * type: "chat",
14910
+ * transcript: new JSONAttachment(largeTranscript, { filename: "transcript.json" })
14911
+ * }
14912
+ * });
14913
+ * ```
14914
+ */
14915
+ constructor(data: unknown, options?: {
14916
+ filename?: string;
14917
+ pretty?: boolean;
14918
+ state?: BraintrustState;
14919
+ });
14920
+ }
14872
14921
  /**
14873
14922
  * Update a span using the output of `span.export()`. It is important that you only resume updating
14874
14923
  * to a span once the original span has been fully written and flushed, since otherwise updates to
@@ -14928,6 +14977,7 @@ declare class Logger<IsAsyncFlush extends boolean> implements Exportable {
14928
14977
  get org_id(): Promise<string>;
14929
14978
  get project(): Promise<ObjectMetadata>;
14930
14979
  get id(): Promise<string>;
14980
+ get loggingState(): BraintrustState;
14931
14981
  private parentObjectType;
14932
14982
  /**
14933
14983
  * Log a single event. The event will be batched and uploaded behind the scenes if `logOptions.asyncFlush` is true.
@@ -15479,6 +15529,13 @@ declare class Experiment extends ObjectFetcher<ExperimentEvent> implements Expor
15479
15529
  kind: "experiment";
15480
15530
  constructor(state: BraintrustState, lazyMetadata: LazyValue<ProjectExperimentMetadata>, dataset?: AnyDataset);
15481
15531
  get id(): Promise<string>;
15532
+ get loggingState(): BraintrustState;
15533
+ /**
15534
+ * Wait for the experiment ID to be resolved. This is useful for ensuring the ID
15535
+ * is available synchronously in child spans (for OTEL parent attributes).
15536
+ * @internal
15537
+ */
15538
+ _waitForId(): Promise<void>;
15482
15539
  get name(): Promise<string>;
15483
15540
  get project(): Promise<ObjectMetadata>;
15484
15541
  private parentObjectType;
@@ -15577,6 +15634,7 @@ declare class ReadonlyExperiment extends ObjectFetcher<ExperimentEvent> {
15577
15634
  constructor(state: BraintrustState, lazyMetadata: LazyValue<ProjectExperimentMetadata>);
15578
15635
  get id(): Promise<string>;
15579
15636
  get name(): Promise<string>;
15637
+ get loggingState(): BraintrustState;
15580
15638
  protected getState(): Promise<BraintrustState>;
15581
15639
  asDataset<Input, Expected, Metadata = DefaultMetadataType>(): AsyncGenerator<EvalCase<Input, Expected, Metadata>>;
15582
15640
  }
@@ -15628,6 +15686,12 @@ declare class SpanImpl implements Span$1 {
15628
15686
  flush(): Promise<void>;
15629
15687
  close(args?: EndSpanArgs): number;
15630
15688
  state(): BraintrustState;
15689
+ /**
15690
+ * Internal method to get the OTEL parent string for this span.
15691
+ * This is used by OtelContextManager to set the braintrust.parent attribute.
15692
+ * @returns A string like "project_id:X" or "experiment_id:X", or undefined if no parent
15693
+ */
15694
+ _getOtelParent(): string | undefined;
15631
15695
  toString(): string;
15632
15696
  }
15633
15697
  /**
@@ -15646,6 +15710,7 @@ declare class Dataset<IsLegacyDataset extends boolean = typeof DEFAULT_IS_LEGACY
15646
15710
  get id(): Promise<string>;
15647
15711
  get name(): Promise<string>;
15648
15712
  get project(): Promise<ObjectMetadata>;
15713
+ get loggingState(): BraintrustState;
15649
15714
  protected getState(): Promise<BraintrustState>;
15650
15715
  private validateEvent;
15651
15716
  private createArgs;
@@ -21683,6 +21748,8 @@ declare const braintrust_INTERNAL_BTQL_LIMIT: typeof INTERNAL_BTQL_LIMIT;
21683
21748
  type braintrust_InitOptions<IsOpen extends boolean> = InitOptions<IsOpen>;
21684
21749
  type braintrust_InvokeFunctionArgs<Input, Output, Stream extends boolean = false> = InvokeFunctionArgs<Input, Output, Stream>;
21685
21750
  type braintrust_InvokeReturn<Stream extends boolean, Output> = InvokeReturn<Stream, Output>;
21751
+ type braintrust_JSONAttachment = JSONAttachment;
21752
+ declare const braintrust_JSONAttachment: typeof JSONAttachment;
21686
21753
  declare const braintrust_LEGACY_CACHED_HEADER: typeof LEGACY_CACHED_HEADER;
21687
21754
  type braintrust_LazyValue<T> = LazyValue<T>;
21688
21755
  declare const braintrust_LazyValue: typeof LazyValue;
@@ -21799,7 +21866,7 @@ declare const braintrust_wrapOpenAI: typeof wrapOpenAI;
21799
21866
  declare const braintrust_wrapOpenAIv4: typeof wrapOpenAIv4;
21800
21867
  declare const braintrust_wrapTraced: typeof wrapTraced;
21801
21868
  declare namespace braintrust {
21802
- export { braintrust_AISpanProcessor as AISpanProcessor, type braintrust_AnyDataset as AnyDataset, braintrust_Attachment as Attachment, type braintrust_AttachmentParams as AttachmentParams, type braintrust_BackgroundLoggerOpts as BackgroundLoggerOpts, braintrust_BaseAttachment as BaseAttachment, braintrust_BaseExperiment as BaseExperiment, type braintrust_BaseMetadata as BaseMetadata, braintrust_BraintrustExporter as BraintrustExporter, braintrust_BraintrustMiddleware as BraintrustMiddleware, braintrust_BraintrustSpanProcessor as BraintrustSpanProcessor, braintrust_BraintrustState as BraintrustState, braintrust_BraintrustStream as BraintrustStream, type braintrust_BraintrustStreamChunk as BraintrustStreamChunk, type braintrust_ChatPrompt as ChatPrompt, braintrust_CodeFunction as CodeFunction, type braintrust_CodeOpts as CodeOpts, braintrust_CodePrompt as CodePrompt, type braintrust_CompiledPrompt as CompiledPrompt, type braintrust_CompiledPromptParams as CompiledPromptParams, type braintrust_CompletionPrompt as CompletionPrompt, braintrust_ContextManager as ContextManager, type braintrust_ContextParentSpanIds as ContextParentSpanIds, type braintrust_CreateProjectOpts as CreateProjectOpts, type braintrust_DataSummary as DataSummary, braintrust_Dataset as Dataset, 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, braintrust_Eval as Eval, type braintrust_EvalCase as EvalCase, type braintrust_EvalHooks as EvalHooks, type braintrust_EvalResult as EvalResult, braintrust_EvalResultWithSummary as EvalResultWithSummary, type braintrust_EvalScorer as EvalScorer, type braintrust_EvalScorerArgs as EvalScorerArgs, type braintrust_EvalTask as EvalTask, type braintrust_Evaluator as Evaluator, type braintrust_EvaluatorDef as EvaluatorDef, type braintrust_EvaluatorFile as EvaluatorFile, braintrust_Experiment as Experiment, 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, type braintrust_FunctionEvent as FunctionEvent, braintrust_IDGenerator as IDGenerator, braintrust_INTERNAL_BTQL_LIMIT as INTERNAL_BTQL_LIMIT, type braintrust_InitOptions as InitOptions, type braintrust_InvokeFunctionArgs as InvokeFunctionArgs, type braintrust_InvokeReturn as InvokeReturn, braintrust_LEGACY_CACHED_HEADER as LEGACY_CACHED_HEADER, braintrust_LazyValue as LazyValue, 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, braintrust_OTELIDGenerator as OTELIDGenerator, type braintrust_ObjectMetadata as ObjectMetadata, braintrust_Project as Project, braintrust_ProjectNameIdMap as ProjectNameIdMap, type braintrust_PromiseUnless as PromiseUnless, braintrust_Prompt as Prompt, braintrust_PromptBuilder as PromptBuilder, type braintrust_PromptContents as PromptContents, type braintrust_PromptDefinition as PromptDefinition, type braintrust_PromptDefinitionWithTools as PromptDefinitionWithTools, type braintrust_PromptOpts as PromptOpts, type braintrust_PromptRowWithId as PromptRowWithId, braintrust_ReadonlyAttachment as ReadonlyAttachment, braintrust_ReadonlyExperiment as ReadonlyExperiment, braintrust_Reporter as Reporter, type braintrust_ReporterBody as ReporterBody, type braintrust_ScoreSummary as ScoreSummary, braintrust_ScorerBuilder as ScorerBuilder, type braintrust_ScorerOpts as ScorerOpts, type braintrust_SerializedBraintrustState as SerializedBraintrustState, type braintrust_SetCurrentArg as SetCurrentArg, type Span$1 as Span, type braintrust_SpanContext as SpanContext, braintrust_SpanImpl as SpanImpl, type braintrust_StartSpanArgs as StartSpanArgs, braintrust_TestBackgroundLogger as TestBackgroundLogger, braintrust_ToolBuilder as ToolBuilder, braintrust_UUIDGenerator as UUIDGenerator, 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_buildLocalSummary as buildLocalSummary, braintrust_createFinalValuePassThroughStream as createFinalValuePassThroughStream, braintrust_currentExperiment as currentExperiment, braintrust_currentLogger as currentLogger, braintrust_currentSpan as currentSpan, braintrust_deepCopyEvent as deepCopyEvent, braintrust_defaultErrorScoreHandler as defaultErrorScoreHandler, braintrust_deserializePlainStringAsJSON as deserializePlainStringAsJSON, braintrust_devNullWritableStream as devNullWritableStream, braintrust_flush as flush, braintrust_getContextManager as getContextManager, braintrust_getIdGenerator as getIdGenerator, braintrust_getPromptVersions as getPromptVersions, braintrust_getSpanParentObject as getSpanParentObject, graphFramework as graph, 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_projects as projects, braintrust_promptContentsSchema as promptContentsSchema, braintrust_promptDefinitionSchema as promptDefinitionSchema, braintrust_promptDefinitionToPromptData as promptDefinitionToPromptData, braintrust_promptDefinitionWithToolsSchema as promptDefinitionWithToolsSchema, braintrust_renderMessage as renderMessage, braintrust_renderPromptParams as renderPromptParams, braintrust_reportFailures as reportFailures, braintrust_runEvaluator as runEvaluator, braintrust_setFetch as setFetch, braintrust_setMaskingFunction as setMaskingFunction, braintrust_spanComponentsToObjectId as spanComponentsToObjectId, braintrust_startSpan as startSpan, braintrust_summarize as summarize, ToolFunctionDefinition as toolFunctionDefinitionSchema, 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_wrapAISDK as wrapAISDK, braintrust_wrapAISDKModel as wrapAISDKModel, braintrust_wrapAnthropic as wrapAnthropic, braintrust_wrapClaudeAgentSDK as wrapClaudeAgentSDK, braintrust_wrapMastraAgent as wrapMastraAgent, braintrust_wrapOpenAI as wrapOpenAI, braintrust_wrapOpenAIv4 as wrapOpenAIv4, braintrust_wrapTraced as wrapTraced };
21869
+ export { braintrust_AISpanProcessor as AISpanProcessor, type braintrust_AnyDataset as AnyDataset, braintrust_Attachment as Attachment, type braintrust_AttachmentParams as AttachmentParams, type braintrust_BackgroundLoggerOpts as BackgroundLoggerOpts, braintrust_BaseAttachment as BaseAttachment, braintrust_BaseExperiment as BaseExperiment, type braintrust_BaseMetadata as BaseMetadata, braintrust_BraintrustExporter as BraintrustExporter, braintrust_BraintrustMiddleware as BraintrustMiddleware, braintrust_BraintrustSpanProcessor as BraintrustSpanProcessor, braintrust_BraintrustState as BraintrustState, braintrust_BraintrustStream as BraintrustStream, type braintrust_BraintrustStreamChunk as BraintrustStreamChunk, type braintrust_ChatPrompt as ChatPrompt, braintrust_CodeFunction as CodeFunction, type braintrust_CodeOpts as CodeOpts, braintrust_CodePrompt as CodePrompt, type braintrust_CompiledPrompt as CompiledPrompt, type braintrust_CompiledPromptParams as CompiledPromptParams, type braintrust_CompletionPrompt as CompletionPrompt, braintrust_ContextManager as ContextManager, type braintrust_ContextParentSpanIds as ContextParentSpanIds, type braintrust_CreateProjectOpts as CreateProjectOpts, type braintrust_DataSummary as DataSummary, braintrust_Dataset as Dataset, 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, braintrust_Eval as Eval, type braintrust_EvalCase as EvalCase, type braintrust_EvalHooks as EvalHooks, type braintrust_EvalResult as EvalResult, braintrust_EvalResultWithSummary as EvalResultWithSummary, type braintrust_EvalScorer as EvalScorer, type braintrust_EvalScorerArgs as EvalScorerArgs, type braintrust_EvalTask as EvalTask, type braintrust_Evaluator as Evaluator, type braintrust_EvaluatorDef as EvaluatorDef, type braintrust_EvaluatorFile as EvaluatorFile, braintrust_Experiment as Experiment, 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, type braintrust_FunctionEvent as FunctionEvent, braintrust_IDGenerator as IDGenerator, braintrust_INTERNAL_BTQL_LIMIT as INTERNAL_BTQL_LIMIT, type braintrust_InitOptions as InitOptions, type braintrust_InvokeFunctionArgs as InvokeFunctionArgs, type braintrust_InvokeReturn as InvokeReturn, braintrust_JSONAttachment as JSONAttachment, braintrust_LEGACY_CACHED_HEADER as LEGACY_CACHED_HEADER, braintrust_LazyValue as LazyValue, 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, braintrust_OTELIDGenerator as OTELIDGenerator, type braintrust_ObjectMetadata as ObjectMetadata, braintrust_Project as Project, braintrust_ProjectNameIdMap as ProjectNameIdMap, type braintrust_PromiseUnless as PromiseUnless, braintrust_Prompt as Prompt, braintrust_PromptBuilder as PromptBuilder, type braintrust_PromptContents as PromptContents, type braintrust_PromptDefinition as PromptDefinition, type braintrust_PromptDefinitionWithTools as PromptDefinitionWithTools, type braintrust_PromptOpts as PromptOpts, type braintrust_PromptRowWithId as PromptRowWithId, braintrust_ReadonlyAttachment as ReadonlyAttachment, braintrust_ReadonlyExperiment as ReadonlyExperiment, braintrust_Reporter as Reporter, type braintrust_ReporterBody as ReporterBody, type braintrust_ScoreSummary as ScoreSummary, braintrust_ScorerBuilder as ScorerBuilder, type braintrust_ScorerOpts as ScorerOpts, type braintrust_SerializedBraintrustState as SerializedBraintrustState, type braintrust_SetCurrentArg as SetCurrentArg, type Span$1 as Span, type braintrust_SpanContext as SpanContext, braintrust_SpanImpl as SpanImpl, type braintrust_StartSpanArgs as StartSpanArgs, braintrust_TestBackgroundLogger as TestBackgroundLogger, braintrust_ToolBuilder as ToolBuilder, braintrust_UUIDGenerator as UUIDGenerator, 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_buildLocalSummary as buildLocalSummary, braintrust_createFinalValuePassThroughStream as createFinalValuePassThroughStream, braintrust_currentExperiment as currentExperiment, braintrust_currentLogger as currentLogger, braintrust_currentSpan as currentSpan, braintrust_deepCopyEvent as deepCopyEvent, braintrust_defaultErrorScoreHandler as defaultErrorScoreHandler, braintrust_deserializePlainStringAsJSON as deserializePlainStringAsJSON, braintrust_devNullWritableStream as devNullWritableStream, braintrust_flush as flush, braintrust_getContextManager as getContextManager, braintrust_getIdGenerator as getIdGenerator, braintrust_getPromptVersions as getPromptVersions, braintrust_getSpanParentObject as getSpanParentObject, graphFramework as graph, 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_projects as projects, braintrust_promptContentsSchema as promptContentsSchema, braintrust_promptDefinitionSchema as promptDefinitionSchema, braintrust_promptDefinitionToPromptData as promptDefinitionToPromptData, braintrust_promptDefinitionWithToolsSchema as promptDefinitionWithToolsSchema, braintrust_renderMessage as renderMessage, braintrust_renderPromptParams as renderPromptParams, braintrust_reportFailures as reportFailures, braintrust_runEvaluator as runEvaluator, braintrust_setFetch as setFetch, braintrust_setMaskingFunction as setMaskingFunction, braintrust_spanComponentsToObjectId as spanComponentsToObjectId, braintrust_startSpan as startSpan, braintrust_summarize as summarize, ToolFunctionDefinition as toolFunctionDefinitionSchema, 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_wrapAISDK as wrapAISDK, braintrust_wrapAISDKModel as wrapAISDKModel, braintrust_wrapAnthropic as wrapAnthropic, braintrust_wrapClaudeAgentSDK as wrapClaudeAgentSDK, braintrust_wrapMastraAgent as wrapMastraAgent, braintrust_wrapOpenAI as wrapOpenAI, braintrust_wrapOpenAIv4 as wrapOpenAIv4, braintrust_wrapTraced as wrapTraced };
21803
21870
  }
21804
21871
 
21805
21872
  type EvaluatorManifest = Record<string, EvaluatorDef<unknown, unknown, unknown, BaseMetadata>>;
@@ -28856,4 +28923,4 @@ type EvaluatorDefinitions = z.infer<typeof evaluatorDefinitionsSchema>;
28856
28923
  * @module braintrust
28857
28924
  */
28858
28925
 
28859
- export { AISpanProcessor, type AnyDataset, Attachment, type AttachmentParams, type BackgroundLoggerOpts, BaseAttachment, BaseExperiment, type BaseMetadata, BraintrustExporter, BraintrustMiddleware, BraintrustSpanProcessor, BraintrustState, BraintrustStream, type BraintrustStreamChunk, type ChatPrompt, CodeFunction, type CodeOpts, CodePrompt, type CommentEvent, type CompiledPrompt, type CompiledPromptParams, type CompletionPrompt, ContextManager, type ContextParentSpanIds, type CreateProjectOpts, type DataSummary, Dataset, type DatasetRecord, type DatasetSummary, type DefaultMetadataType, type DefaultPromptArgs, ERR_PERMALINK, type EndSpanArgs, Eval, type EvalCase, type EvalHooks, type EvalParameterSerializedSchema, type EvalParameters, type EvalResult, EvalResultWithSummary, type EvalScorer, type EvalScorerArgs, type EvalTask, type Evaluator, type EvaluatorDef, type EvaluatorDefinition, type EvaluatorDefinitions, type EvaluatorFile, type EvaluatorManifest, Experiment, type ExperimentLogFullArgs, type ExperimentLogPartialArgs, type ExperimentSummary, type Exportable, ExternalAttachment, type ExternalAttachmentParams, FailedHTTPResponse, type FullInitOptions, type FullLoginOptions, type FunctionEvent, IDGenerator, INTERNAL_BTQL_LIMIT, type IdField, type InitOptions, type InputField, type InvokeFunctionArgs, type InvokeReturn, LEGACY_CACHED_HEADER, LazyValue, type LogCommentFullArgs, type LogFeedbackFullArgs, type LogOptions, Logger, type LoginOptions, type MetricSummary, NOOP_SPAN, NOOP_SPAN_PERMALINK, NoopSpan, OTELIDGenerator, type ObjectMetadata, type OtherExperimentLogFields, type ParentExperimentIds, type ParentProjectLogIds, Project, ProjectNameIdMap, type PromiseUnless, Prompt, PromptBuilder, type PromptContents, type PromptDefinition, type PromptDefinitionWithTools, type PromptOpts, type PromptRowWithId, ReadonlyAttachment, ReadonlyExperiment, Reporter, type ReporterBody, type ScoreSummary, ScorerBuilder, type ScorerOpts, type SerializedBraintrustState, type SetCurrentArg, type Span$1 as Span, type SpanContext, SpanImpl, type StartSpanArgs, TestBackgroundLogger, ToolBuilder, UUIDGenerator, type WithTransactionId, X_CACHED_HEADER, _exportsForTestingOnly, _internalGetGlobalState, _internalSetInitialState, braintrustStreamChunkSchema, buildLocalSummary, createFinalValuePassThroughStream, currentExperiment, currentLogger, currentSpan, deepCopyEvent, braintrust as default, defaultErrorScoreHandler, deserializePlainStringAsJSON, devNullWritableStream, evaluatorDefinitionSchema, evaluatorDefinitionsSchema, flush, getContextManager, getIdGenerator, getPromptVersions, getSpanParentObject, graphFramework as graph, init, initDataset, initExperiment, initFunction, initLogger, invoke, loadPrompt, log, logError, login, loginToState, newId, parseCachedHeader, permalink, projects, promptContentsSchema, promptDefinitionSchema, promptDefinitionToPromptData, promptDefinitionWithToolsSchema, renderMessage, renderPromptParams, reportFailures, runEvaluator, setFetch, setMaskingFunction, spanComponentsToObjectId, startSpan, summarize, ToolFunctionDefinition as toolFunctionDefinitionSchema, traceable, traced, updateSpan, withCurrent, withDataset, withExperiment, withLogger, withParent, wrapAISDK, wrapAISDKModel, wrapAnthropic, wrapClaudeAgentSDK, wrapMastraAgent, wrapOpenAI, wrapOpenAIv4, wrapTraced };
28926
+ export { AISpanProcessor, type AnyDataset, Attachment, type AttachmentParams, AttachmentReference, type BackgroundLoggerOpts, BaseAttachment, BaseExperiment, type BaseMetadata, BraintrustExporter, BraintrustMiddleware, BraintrustSpanProcessor, BraintrustState, BraintrustStream, type BraintrustStreamChunk, type ChatPrompt, CodeFunction, type CodeOpts, CodePrompt, type CommentEvent, type CompiledPrompt, type CompiledPromptParams, type CompletionPrompt, ContextManager, type ContextParentSpanIds, type CreateProjectOpts, type DataSummary, Dataset, type DatasetRecord, type DatasetSummary, type DefaultMetadataType, type DefaultPromptArgs, ERR_PERMALINK, type EndSpanArgs, Eval, type EvalCase, type EvalHooks, type EvalParameterSerializedSchema, type EvalParameters, type EvalResult, EvalResultWithSummary, type EvalScorer, type EvalScorerArgs, type EvalTask, type Evaluator, type EvaluatorDef, type EvaluatorDefinition, type EvaluatorDefinitions, type EvaluatorFile, type EvaluatorManifest, Experiment, type ExperimentLogFullArgs, type ExperimentLogPartialArgs, type ExperimentSummary, type Exportable, ExternalAttachment, type ExternalAttachmentParams, FailedHTTPResponse, type FullInitOptions, type FullLoginOptions, type FunctionEvent, IDGenerator, INTERNAL_BTQL_LIMIT, type IdField, type InitOptions, type InputField, type InvokeFunctionArgs, type InvokeReturn, JSONAttachment, LEGACY_CACHED_HEADER, LazyValue, type LogCommentFullArgs, type LogFeedbackFullArgs, type LogOptions, Logger, type LoginOptions, type MetricSummary, NOOP_SPAN, NOOP_SPAN_PERMALINK, NoopSpan, OTELIDGenerator, type ObjectMetadata, type OtherExperimentLogFields, type ParentExperimentIds, type ParentProjectLogIds, Project, ProjectNameIdMap, type PromiseUnless, Prompt, PromptBuilder, type PromptContents, type PromptDefinition, type PromptDefinitionWithTools, type PromptOpts, type PromptRowWithId, ReadonlyAttachment, ReadonlyExperiment, Reporter, type ReporterBody, type ScoreSummary, ScorerBuilder, type ScorerOpts, type SerializedBraintrustState, type SetCurrentArg, type Span$1 as Span, type SpanContext, SpanImpl, type StartSpanArgs, TestBackgroundLogger, ToolBuilder, UUIDGenerator, type WithTransactionId, X_CACHED_HEADER, _exportsForTestingOnly, _internalGetGlobalState, _internalSetInitialState, braintrustStreamChunkSchema, buildLocalSummary, createFinalValuePassThroughStream, currentExperiment, currentLogger, currentSpan, deepCopyEvent, braintrust as default, defaultErrorScoreHandler, deserializePlainStringAsJSON, devNullWritableStream, evaluatorDefinitionSchema, evaluatorDefinitionsSchema, flush, getContextManager, getIdGenerator, getPromptVersions, getSpanParentObject, graphFramework as graph, init, initDataset, initExperiment, initFunction, initLogger, invoke, loadPrompt, log, logError, login, loginToState, newId, parseCachedHeader, permalink, projects, promptContentsSchema, promptDefinitionSchema, promptDefinitionToPromptData, promptDefinitionWithToolsSchema, renderMessage, renderPromptParams, reportFailures, runEvaluator, setFetch, setMaskingFunction, spanComponentsToObjectId, startSpan, summarize, ToolFunctionDefinition as toolFunctionDefinitionSchema, traceable, traced, updateSpan, withCurrent, withDataset, withExperiment, withLogger, withParent, wrapAISDK, wrapAISDKModel, wrapAnthropic, wrapClaudeAgentSDK, wrapMastraAgent, wrapOpenAI, wrapOpenAIv4, wrapTraced };