braintrust 0.4.7 → 0.4.9

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/dev/dist/index.js CHANGED
@@ -2941,7 +2941,7 @@ var init_stream = __esm({
2941
2941
  /**
2942
2942
  * Get the underlying ReadableStream.
2943
2943
  *
2944
- * @returns The underlying ReadableStream<BraintrustStreamChunk>.
2944
+ * @returns The underlying `ReadableStream<BraintrustStreamChunk>`.
2945
2945
  */
2946
2946
  toReadableStream() {
2947
2947
  return this.stream;
@@ -2941,7 +2941,7 @@ var init_stream = __esm({
2941
2941
  /**
2942
2942
  * Get the underlying ReadableStream.
2943
2943
  *
2944
- * @returns The underlying ReadableStream<BraintrustStreamChunk>.
2944
+ * @returns The underlying `ReadableStream<BraintrustStreamChunk>`.
2945
2945
  */
2946
2946
  toReadableStream() {
2947
2947
  return this.stream;
@@ -9803,7 +9803,7 @@ declare class BraintrustStream {
9803
9803
  /**
9804
9804
  * Get the underlying ReadableStream.
9805
9805
  *
9806
- * @returns The underlying ReadableStream<BraintrustStreamChunk>.
9806
+ * @returns The underlying `ReadableStream<BraintrustStreamChunk>`.
9807
9807
  */
9808
9808
  toReadableStream(): ReadableStream<BraintrustStreamChunk>;
9809
9809
  /**
@@ -20078,10 +20078,13 @@ declare const braintrust_ExternalAttachment: typeof ExternalAttachment;
20078
20078
  type braintrust_ExternalAttachmentParams = ExternalAttachmentParams;
20079
20079
  type braintrust_FailedHTTPResponse = FailedHTTPResponse;
20080
20080
  declare const braintrust_FailedHTTPResponse: typeof FailedHTTPResponse;
20081
+ type braintrust_FullInitDatasetOptions<IsLegacyDataset extends boolean> = FullInitDatasetOptions<IsLegacyDataset>;
20081
20082
  type braintrust_FullInitOptions<IsOpen extends boolean> = FullInitOptions<IsOpen>;
20082
20083
  type braintrust_FullLoginOptions = FullLoginOptions;
20083
20084
  declare const braintrust_INTERNAL_BTQL_LIMIT: typeof INTERNAL_BTQL_LIMIT;
20084
20085
  type braintrust_IdField = IdField;
20086
+ type braintrust_InitDatasetOptions<IsLegacyDataset extends boolean> = InitDatasetOptions<IsLegacyDataset>;
20087
+ type braintrust_InitLoggerOptions<IsAsyncFlush> = InitLoggerOptions<IsAsyncFlush>;
20085
20088
  type braintrust_InitOptions<IsOpen extends boolean> = InitOptions<IsOpen>;
20086
20089
  type braintrust_InputField = InputField;
20087
20090
  type braintrust_InvokeFunctionArgs<Input, Output, Stream extends boolean = false> = InvokeFunctionArgs<Input, Output, Stream>;
@@ -20091,6 +20094,7 @@ declare const braintrust_JSONAttachment: typeof JSONAttachment;
20091
20094
  declare const braintrust_LEGACY_CACHED_HEADER: typeof LEGACY_CACHED_HEADER;
20092
20095
  type braintrust_LazyValue<T> = LazyValue<T>;
20093
20096
  declare const braintrust_LazyValue: typeof LazyValue;
20097
+ type braintrust_LoadPromptOptions = LoadPromptOptions;
20094
20098
  type braintrust_LogCommentFullArgs = LogCommentFullArgs;
20095
20099
  type braintrust_LogFeedbackFullArgs = LogFeedbackFullArgs;
20096
20100
  type braintrust_LogOptions<IsAsyncFlush> = LogOptions<IsAsyncFlush>;
@@ -20175,7 +20179,7 @@ declare const braintrust_wrapOpenAI: typeof wrapOpenAI;
20175
20179
  declare const braintrust_wrapOpenAIv4: typeof wrapOpenAIv4;
20176
20180
  declare const braintrust_wrapTraced: typeof wrapTraced;
20177
20181
  declare namespace braintrust {
20178
- export { type braintrust_AnyDataset as AnyDataset, braintrust_Attachment as Attachment, type braintrust_AttachmentParams as AttachmentParams, braintrust_AttachmentReference as AttachmentReference, 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, type braintrust_CommentEvent as CommentEvent, 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_DataSummary as DataSummary, braintrust_Dataset as Dataset, type 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, type braintrust_ExperimentLogFullArgs as ExperimentLogFullArgs, type 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, type braintrust_IdField as IdField, type braintrust_InitOptions as InitOptions, type braintrust_InputField as InputField, 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_LogCommentFullArgs as LogCommentFullArgs, type 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, type braintrust_OtherExperimentLogFields as OtherExperimentLogFields, type braintrust_ParentExperimentIds as ParentExperimentIds, type 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, braintrust_TestBackgroundLogger as TestBackgroundLogger, 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_deepCopyEvent as deepCopyEvent, braintrust_deserializePlainStringAsJSON as deserializePlainStringAsJSON, braintrust_devNullWritableStream as devNullWritableStream, braintrust_evaluatorDefinitionSchema as evaluatorDefinitionSchema, braintrust_evaluatorDefinitionsSchema as evaluatorDefinitionsSchema, braintrust_flush as flush, braintrust_getContextManager as getContextManager, braintrust_getPromptVersions as getPromptVersions, 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_setMaskingFunction as setMaskingFunction, 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 };
20182
+ export { type braintrust_AnyDataset as AnyDataset, braintrust_Attachment as Attachment, type braintrust_AttachmentParams as AttachmentParams, braintrust_AttachmentReference as AttachmentReference, 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, type braintrust_CommentEvent as CommentEvent, 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_DataSummary as DataSummary, braintrust_Dataset as Dataset, type 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, type braintrust_ExperimentLogFullArgs as ExperimentLogFullArgs, type 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_FullInitDatasetOptions as FullInitDatasetOptions, type braintrust_FullInitOptions as FullInitOptions, type braintrust_FullLoginOptions as FullLoginOptions, braintrust_INTERNAL_BTQL_LIMIT as INTERNAL_BTQL_LIMIT, type braintrust_IdField as IdField, type braintrust_InitDatasetOptions as InitDatasetOptions, type braintrust_InitLoggerOptions as InitLoggerOptions, type braintrust_InitOptions as InitOptions, type braintrust_InputField as InputField, 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_LoadPromptOptions as LoadPromptOptions, type braintrust_LogCommentFullArgs as LogCommentFullArgs, type 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, type braintrust_OtherExperimentLogFields as OtherExperimentLogFields, type braintrust_ParentExperimentIds as ParentExperimentIds, type 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, braintrust_TestBackgroundLogger as TestBackgroundLogger, 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_deepCopyEvent as deepCopyEvent, braintrust_deserializePlainStringAsJSON as deserializePlainStringAsJSON, braintrust_devNullWritableStream as devNullWritableStream, braintrust_evaluatorDefinitionSchema as evaluatorDefinitionSchema, braintrust_evaluatorDefinitionsSchema as evaluatorDefinitionsSchema, braintrust_flush as flush, braintrust_getContextManager as getContextManager, braintrust_getPromptVersions as getPromptVersions, 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_setMaskingFunction as setMaskingFunction, 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 };
20179
20183
  }
20180
20184
 
20181
- export { type AnyDataset, Attachment, type AttachmentParams, AttachmentReference, type BackgroundLoggerOpts, BaseAttachment, type BaseMetadata, BraintrustState, BraintrustStream, type BraintrustStreamChunk, type ChatPrompt, type CommentEvent, type CompiledPrompt, type CompiledPromptParams, type CompletionPrompt, ContextManager, type ContextParentSpanIds, type DataSummary, Dataset, type DatasetRecord, type DatasetSummary, type DefaultMetadataType, type DefaultPromptArgs, ERR_PERMALINK, type EndSpanArgs, type EvalCase, type EvalParameterSerializedSchema, type EvalParameters, type EvaluatorDefinition, type EvaluatorDefinitions, type EvaluatorManifest, Experiment, type ExperimentLogFullArgs, type ExperimentLogPartialArgs, type ExperimentSummary, type Exportable, ExternalAttachment, type ExternalAttachmentParams, FailedHTTPResponse, type FullInitOptions, type FullLoginOptions, 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, type ObjectMetadata, type OtherExperimentLogFields, type ParentExperimentIds, type ParentProjectLogIds, type PromiseUnless, Prompt, type PromptRowWithId, ReadonlyAttachment, ReadonlyExperiment, type ScoreSummary, type SerializedBraintrustState, type SetCurrentArg, type Span, SpanImpl, type StartSpanArgs, TestBackgroundLogger, type WithTransactionId, X_CACHED_HEADER, _exportsForTestingOnly, _internalGetGlobalState, _internalSetInitialState, braintrustStreamChunkSchema, createFinalValuePassThroughStream, currentExperiment, currentLogger, currentSpan, deepCopyEvent, braintrust as default, deserializePlainStringAsJSON, devNullWritableStream, evaluatorDefinitionSchema, evaluatorDefinitionsSchema, flush, getContextManager, getPromptVersions, getSpanParentObject, init, initDataset, initExperiment, initFunction, initLogger, invoke, loadPrompt, log, logError, login, loginToState, newId, parseCachedHeader, permalink, renderMessage, renderPromptParams, setFetch, setMaskingFunction, spanComponentsToObjectId, startSpan, summarize, traceable, traced, updateSpan, withCurrent, withDataset, withExperiment, withLogger, withParent, wrapOpenAI, wrapOpenAIv4, wrapTraced };
20185
+ export { type AnyDataset, Attachment, type AttachmentParams, AttachmentReference, type BackgroundLoggerOpts, BaseAttachment, type BaseMetadata, BraintrustState, BraintrustStream, type BraintrustStreamChunk, type ChatPrompt, type CommentEvent, type CompiledPrompt, type CompiledPromptParams, type CompletionPrompt, ContextManager, type ContextParentSpanIds, type DataSummary, Dataset, type DatasetRecord, type DatasetSummary, type DefaultMetadataType, type DefaultPromptArgs, ERR_PERMALINK, type EndSpanArgs, type EvalCase, type EvalParameterSerializedSchema, type EvalParameters, type EvaluatorDefinition, type EvaluatorDefinitions, type EvaluatorManifest, Experiment, type ExperimentLogFullArgs, type ExperimentLogPartialArgs, type ExperimentSummary, type Exportable, ExternalAttachment, type ExternalAttachmentParams, FailedHTTPResponse, type FullInitDatasetOptions, type FullInitOptions, type FullLoginOptions, INTERNAL_BTQL_LIMIT, type IdField, type InitDatasetOptions, type InitLoggerOptions, type InitOptions, type InputField, type InvokeFunctionArgs, type InvokeReturn, JSONAttachment, LEGACY_CACHED_HEADER, LazyValue, type LoadPromptOptions, type LogCommentFullArgs, type LogFeedbackFullArgs, type LogOptions, Logger, type LoginOptions, type MetricSummary, NOOP_SPAN, NOOP_SPAN_PERMALINK, NoopSpan, type ObjectMetadata, type OtherExperimentLogFields, type ParentExperimentIds, type ParentProjectLogIds, type PromiseUnless, Prompt, type PromptRowWithId, ReadonlyAttachment, ReadonlyExperiment, type ScoreSummary, type SerializedBraintrustState, type SetCurrentArg, type Span, SpanImpl, type StartSpanArgs, TestBackgroundLogger, type WithTransactionId, X_CACHED_HEADER, _exportsForTestingOnly, _internalGetGlobalState, _internalSetInitialState, braintrustStreamChunkSchema, createFinalValuePassThroughStream, currentExperiment, currentLogger, currentSpan, deepCopyEvent, braintrust as default, deserializePlainStringAsJSON, devNullWritableStream, evaluatorDefinitionSchema, evaluatorDefinitionsSchema, flush, getContextManager, getPromptVersions, getSpanParentObject, init, initDataset, initExperiment, initFunction, initLogger, invoke, loadPrompt, log, logError, login, loginToState, newId, parseCachedHeader, permalink, renderMessage, renderPromptParams, setFetch, setMaskingFunction, spanComponentsToObjectId, startSpan, summarize, traceable, traced, updateSpan, withCurrent, withDataset, withExperiment, withLogger, withParent, wrapOpenAI, wrapOpenAIv4, wrapTraced };
package/dist/browser.d.ts CHANGED
@@ -9803,7 +9803,7 @@ declare class BraintrustStream {
9803
9803
  /**
9804
9804
  * Get the underlying ReadableStream.
9805
9805
  *
9806
- * @returns The underlying ReadableStream<BraintrustStreamChunk>.
9806
+ * @returns The underlying `ReadableStream<BraintrustStreamChunk>`.
9807
9807
  */
9808
9808
  toReadableStream(): ReadableStream<BraintrustStreamChunk>;
9809
9809
  /**
@@ -20078,10 +20078,13 @@ declare const braintrust_ExternalAttachment: typeof ExternalAttachment;
20078
20078
  type braintrust_ExternalAttachmentParams = ExternalAttachmentParams;
20079
20079
  type braintrust_FailedHTTPResponse = FailedHTTPResponse;
20080
20080
  declare const braintrust_FailedHTTPResponse: typeof FailedHTTPResponse;
20081
+ type braintrust_FullInitDatasetOptions<IsLegacyDataset extends boolean> = FullInitDatasetOptions<IsLegacyDataset>;
20081
20082
  type braintrust_FullInitOptions<IsOpen extends boolean> = FullInitOptions<IsOpen>;
20082
20083
  type braintrust_FullLoginOptions = FullLoginOptions;
20083
20084
  declare const braintrust_INTERNAL_BTQL_LIMIT: typeof INTERNAL_BTQL_LIMIT;
20084
20085
  type braintrust_IdField = IdField;
20086
+ type braintrust_InitDatasetOptions<IsLegacyDataset extends boolean> = InitDatasetOptions<IsLegacyDataset>;
20087
+ type braintrust_InitLoggerOptions<IsAsyncFlush> = InitLoggerOptions<IsAsyncFlush>;
20085
20088
  type braintrust_InitOptions<IsOpen extends boolean> = InitOptions<IsOpen>;
20086
20089
  type braintrust_InputField = InputField;
20087
20090
  type braintrust_InvokeFunctionArgs<Input, Output, Stream extends boolean = false> = InvokeFunctionArgs<Input, Output, Stream>;
@@ -20091,6 +20094,7 @@ declare const braintrust_JSONAttachment: typeof JSONAttachment;
20091
20094
  declare const braintrust_LEGACY_CACHED_HEADER: typeof LEGACY_CACHED_HEADER;
20092
20095
  type braintrust_LazyValue<T> = LazyValue<T>;
20093
20096
  declare const braintrust_LazyValue: typeof LazyValue;
20097
+ type braintrust_LoadPromptOptions = LoadPromptOptions;
20094
20098
  type braintrust_LogCommentFullArgs = LogCommentFullArgs;
20095
20099
  type braintrust_LogFeedbackFullArgs = LogFeedbackFullArgs;
20096
20100
  type braintrust_LogOptions<IsAsyncFlush> = LogOptions<IsAsyncFlush>;
@@ -20175,7 +20179,7 @@ declare const braintrust_wrapOpenAI: typeof wrapOpenAI;
20175
20179
  declare const braintrust_wrapOpenAIv4: typeof wrapOpenAIv4;
20176
20180
  declare const braintrust_wrapTraced: typeof wrapTraced;
20177
20181
  declare namespace braintrust {
20178
- export { type braintrust_AnyDataset as AnyDataset, braintrust_Attachment as Attachment, type braintrust_AttachmentParams as AttachmentParams, braintrust_AttachmentReference as AttachmentReference, 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, type braintrust_CommentEvent as CommentEvent, 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_DataSummary as DataSummary, braintrust_Dataset as Dataset, type 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, type braintrust_ExperimentLogFullArgs as ExperimentLogFullArgs, type 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, type braintrust_IdField as IdField, type braintrust_InitOptions as InitOptions, type braintrust_InputField as InputField, 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_LogCommentFullArgs as LogCommentFullArgs, type 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, type braintrust_OtherExperimentLogFields as OtherExperimentLogFields, type braintrust_ParentExperimentIds as ParentExperimentIds, type 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, braintrust_TestBackgroundLogger as TestBackgroundLogger, 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_deepCopyEvent as deepCopyEvent, braintrust_deserializePlainStringAsJSON as deserializePlainStringAsJSON, braintrust_devNullWritableStream as devNullWritableStream, braintrust_evaluatorDefinitionSchema as evaluatorDefinitionSchema, braintrust_evaluatorDefinitionsSchema as evaluatorDefinitionsSchema, braintrust_flush as flush, braintrust_getContextManager as getContextManager, braintrust_getPromptVersions as getPromptVersions, 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_setMaskingFunction as setMaskingFunction, 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 };
20182
+ export { type braintrust_AnyDataset as AnyDataset, braintrust_Attachment as Attachment, type braintrust_AttachmentParams as AttachmentParams, braintrust_AttachmentReference as AttachmentReference, 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, type braintrust_CommentEvent as CommentEvent, 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_DataSummary as DataSummary, braintrust_Dataset as Dataset, type 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, type braintrust_ExperimentLogFullArgs as ExperimentLogFullArgs, type 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_FullInitDatasetOptions as FullInitDatasetOptions, type braintrust_FullInitOptions as FullInitOptions, type braintrust_FullLoginOptions as FullLoginOptions, braintrust_INTERNAL_BTQL_LIMIT as INTERNAL_BTQL_LIMIT, type braintrust_IdField as IdField, type braintrust_InitDatasetOptions as InitDatasetOptions, type braintrust_InitLoggerOptions as InitLoggerOptions, type braintrust_InitOptions as InitOptions, type braintrust_InputField as InputField, 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_LoadPromptOptions as LoadPromptOptions, type braintrust_LogCommentFullArgs as LogCommentFullArgs, type 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, type braintrust_OtherExperimentLogFields as OtherExperimentLogFields, type braintrust_ParentExperimentIds as ParentExperimentIds, type 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, braintrust_TestBackgroundLogger as TestBackgroundLogger, 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_deepCopyEvent as deepCopyEvent, braintrust_deserializePlainStringAsJSON as deserializePlainStringAsJSON, braintrust_devNullWritableStream as devNullWritableStream, braintrust_evaluatorDefinitionSchema as evaluatorDefinitionSchema, braintrust_evaluatorDefinitionsSchema as evaluatorDefinitionsSchema, braintrust_flush as flush, braintrust_getContextManager as getContextManager, braintrust_getPromptVersions as getPromptVersions, 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_setMaskingFunction as setMaskingFunction, 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 };
20179
20183
  }
20180
20184
 
20181
- export { type AnyDataset, Attachment, type AttachmentParams, AttachmentReference, type BackgroundLoggerOpts, BaseAttachment, type BaseMetadata, BraintrustState, BraintrustStream, type BraintrustStreamChunk, type ChatPrompt, type CommentEvent, type CompiledPrompt, type CompiledPromptParams, type CompletionPrompt, ContextManager, type ContextParentSpanIds, type DataSummary, Dataset, type DatasetRecord, type DatasetSummary, type DefaultMetadataType, type DefaultPromptArgs, ERR_PERMALINK, type EndSpanArgs, type EvalCase, type EvalParameterSerializedSchema, type EvalParameters, type EvaluatorDefinition, type EvaluatorDefinitions, type EvaluatorManifest, Experiment, type ExperimentLogFullArgs, type ExperimentLogPartialArgs, type ExperimentSummary, type Exportable, ExternalAttachment, type ExternalAttachmentParams, FailedHTTPResponse, type FullInitOptions, type FullLoginOptions, 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, type ObjectMetadata, type OtherExperimentLogFields, type ParentExperimentIds, type ParentProjectLogIds, type PromiseUnless, Prompt, type PromptRowWithId, ReadonlyAttachment, ReadonlyExperiment, type ScoreSummary, type SerializedBraintrustState, type SetCurrentArg, type Span, SpanImpl, type StartSpanArgs, TestBackgroundLogger, type WithTransactionId, X_CACHED_HEADER, _exportsForTestingOnly, _internalGetGlobalState, _internalSetInitialState, braintrustStreamChunkSchema, createFinalValuePassThroughStream, currentExperiment, currentLogger, currentSpan, deepCopyEvent, braintrust as default, deserializePlainStringAsJSON, devNullWritableStream, evaluatorDefinitionSchema, evaluatorDefinitionsSchema, flush, getContextManager, getPromptVersions, getSpanParentObject, init, initDataset, initExperiment, initFunction, initLogger, invoke, loadPrompt, log, logError, login, loginToState, newId, parseCachedHeader, permalink, renderMessage, renderPromptParams, setFetch, setMaskingFunction, spanComponentsToObjectId, startSpan, summarize, traceable, traced, updateSpan, withCurrent, withDataset, withExperiment, withLogger, withParent, wrapOpenAI, wrapOpenAIv4, wrapTraced };
20185
+ export { type AnyDataset, Attachment, type AttachmentParams, AttachmentReference, type BackgroundLoggerOpts, BaseAttachment, type BaseMetadata, BraintrustState, BraintrustStream, type BraintrustStreamChunk, type ChatPrompt, type CommentEvent, type CompiledPrompt, type CompiledPromptParams, type CompletionPrompt, ContextManager, type ContextParentSpanIds, type DataSummary, Dataset, type DatasetRecord, type DatasetSummary, type DefaultMetadataType, type DefaultPromptArgs, ERR_PERMALINK, type EndSpanArgs, type EvalCase, type EvalParameterSerializedSchema, type EvalParameters, type EvaluatorDefinition, type EvaluatorDefinitions, type EvaluatorManifest, Experiment, type ExperimentLogFullArgs, type ExperimentLogPartialArgs, type ExperimentSummary, type Exportable, ExternalAttachment, type ExternalAttachmentParams, FailedHTTPResponse, type FullInitDatasetOptions, type FullInitOptions, type FullLoginOptions, INTERNAL_BTQL_LIMIT, type IdField, type InitDatasetOptions, type InitLoggerOptions, type InitOptions, type InputField, type InvokeFunctionArgs, type InvokeReturn, JSONAttachment, LEGACY_CACHED_HEADER, LazyValue, type LoadPromptOptions, type LogCommentFullArgs, type LogFeedbackFullArgs, type LogOptions, Logger, type LoginOptions, type MetricSummary, NOOP_SPAN, NOOP_SPAN_PERMALINK, NoopSpan, type ObjectMetadata, type OtherExperimentLogFields, type ParentExperimentIds, type ParentProjectLogIds, type PromiseUnless, Prompt, type PromptRowWithId, ReadonlyAttachment, ReadonlyExperiment, type ScoreSummary, type SerializedBraintrustState, type SetCurrentArg, type Span, SpanImpl, type StartSpanArgs, TestBackgroundLogger, type WithTransactionId, X_CACHED_HEADER, _exportsForTestingOnly, _internalGetGlobalState, _internalSetInitialState, braintrustStreamChunkSchema, createFinalValuePassThroughStream, currentExperiment, currentLogger, currentSpan, deepCopyEvent, braintrust as default, deserializePlainStringAsJSON, devNullWritableStream, evaluatorDefinitionSchema, evaluatorDefinitionsSchema, flush, getContextManager, getPromptVersions, getSpanParentObject, init, initDataset, initExperiment, initFunction, initLogger, invoke, loadPrompt, log, logError, login, loginToState, newId, parseCachedHeader, permalink, renderMessage, renderPromptParams, setFetch, setMaskingFunction, spanComponentsToObjectId, startSpan, summarize, traceable, traced, updateSpan, withCurrent, withDataset, withExperiment, withLogger, withParent, wrapOpenAI, wrapOpenAIv4, wrapTraced };
package/dist/browser.js CHANGED
@@ -2918,7 +2918,7 @@ var init_stream = __esm({
2918
2918
  /**
2919
2919
  * Get the underlying ReadableStream.
2920
2920
  *
2921
- * @returns The underlying ReadableStream<BraintrustStreamChunk>.
2921
+ * @returns The underlying `ReadableStream<BraintrustStreamChunk>`.
2922
2922
  */
2923
2923
  toReadableStream() {
2924
2924
  return this.stream;
@@ -10150,6 +10150,11 @@ function proxyCreate(target, hooks) {
10150
10150
  } else {
10151
10151
  const event = hooks.resultToEventFunc(result);
10152
10152
  const span = timedSpan.span;
10153
+ const ttft = getCurrentUnixTimestamp() - timedSpan.start;
10154
+ if (!event.metrics) {
10155
+ event.metrics = {};
10156
+ }
10157
+ event.metrics.time_to_first_token = ttft;
10153
10158
  span.log(event);
10154
10159
  span.end();
10155
10160
  return result;
package/dist/browser.mjs CHANGED
@@ -2918,7 +2918,7 @@ var init_stream = __esm({
2918
2918
  /**
2919
2919
  * Get the underlying ReadableStream.
2920
2920
  *
2921
- * @returns The underlying ReadableStream<BraintrustStreamChunk>.
2921
+ * @returns The underlying `ReadableStream<BraintrustStreamChunk>`.
2922
2922
  */
2923
2923
  toReadableStream() {
2924
2924
  return this.stream;
@@ -10150,6 +10150,11 @@ function proxyCreate(target, hooks) {
10150
10150
  } else {
10151
10151
  const event = hooks.resultToEventFunc(result);
10152
10152
  const span = timedSpan.span;
10153
+ const ttft = getCurrentUnixTimestamp() - timedSpan.start;
10154
+ if (!event.metrics) {
10155
+ event.metrics = {};
10156
+ }
10157
+ event.metrics.time_to_first_token = ttft;
10153
10158
  span.log(event);
10154
10159
  span.end();
10155
10160
  return result;
package/dist/cli.js CHANGED
@@ -4153,7 +4153,7 @@ var init_stream = __esm({
4153
4153
  /**
4154
4154
  * Get the underlying ReadableStream.
4155
4155
  *
4156
- * @returns The underlying ReadableStream<BraintrustStreamChunk>.
4156
+ * @returns The underlying `ReadableStream<BraintrustStreamChunk>`.
4157
4157
  */
4158
4158
  toReadableStream() {
4159
4159
  return this.stream;
@@ -10233,7 +10233,7 @@ var require_package = __commonJS({
10233
10233
  "package.json"(exports2, module2) {
10234
10234
  module2.exports = {
10235
10235
  name: "braintrust",
10236
- version: "0.4.7",
10236
+ version: "0.4.9",
10237
10237
  description: "SDK for integrating Braintrust",
10238
10238
  repository: {
10239
10239
  type: "git",
@@ -10289,17 +10289,22 @@ var require_package = __commonJS({
10289
10289
  watch: "tsup --watch",
10290
10290
  clean: "rm -r dist/* && rm -r dev/dist/*",
10291
10291
  docs: "npx typedoc --options typedoc.json src/index.ts",
10292
- test: "vitest run --exclude src/wrappers/anthropic.test.ts --exclude src/wrappers/oai.test.ts --exclude src/otel.test.ts --exclude src/otel-no-deps.test.ts --exclude src/wrappers/google-genai.test.ts",
10292
+ test: 'vitest run --exclude "src/wrappers/**/*.test.ts" --exclude "src/otel/**/*.test.ts"',
10293
10293
  "test:anthropic": "vitest run src/wrappers/anthropic.test.ts",
10294
10294
  "test:openai": "vitest run src/wrappers/oai.test.ts",
10295
- "test:otel": "vitest run src/otel.test.ts",
10295
+ "test:otel": "vitest run --dir src/otel",
10296
+ "test:otel-no-deps": "vitest run src/otel-no-deps.test.ts --reporter=verbose",
10296
10297
  "test:google-genai": "vitest run src/wrappers/google-genai.test.ts",
10297
- "test:otel-no-deps": "vitest run src/otel-no-deps.test.ts --reporter=verbose"
10298
+ "test:ai-sdk-v1": "vitest run src/wrappers/ai-sdk-v1.test.ts",
10299
+ "test:ai-sdk-v2": "vitest run src/wrappers/ai-sdk-v2.test.ts src/wrappers/ai-sdk-v1.test.ts",
10300
+ "test:ai-sdk-v3": "vitest run src/wrappers/ai-sdk-v3.test.ts",
10301
+ "test:mastra": "vitest run src/wrappers/mastra.test.ts",
10302
+ "test:claude-agent-sdk": "vitest run src/wrappers/claude-agent-sdk.test.ts"
10298
10303
  },
10299
10304
  author: "",
10300
10305
  license: "MIT",
10301
10306
  devDependencies: {
10302
- "@ai-sdk/anthropic": "^1.0.5",
10307
+ "@ai-sdk/anthropic": "2.0.37",
10303
10308
  "@anthropic-ai/sdk": "^0.60.0",
10304
10309
  "@google/genai": "^1.25.0",
10305
10310
  "@jest/globals": "^29.7.0",
@@ -10326,8 +10331,8 @@ var require_package = __commonJS({
10326
10331
  tinybench: "^4.0.1",
10327
10332
  "ts-jest": "^29.1.4",
10328
10333
  tsup: "^8.3.5",
10329
- typedoc: "^0.28.5",
10330
- "typedoc-plugin-markdown": "^4.6.4",
10334
+ typedoc: "^0.25.13",
10335
+ "typedoc-plugin-markdown": "^3.17.1",
10331
10336
  typescript: "5.4.4",
10332
10337
  "vite-tsconfig-paths": "^4.3.2",
10333
10338
  vitest: "^2.1.9"
package/dist/index.d.mts CHANGED
@@ -16252,7 +16252,7 @@ declare class BraintrustStream {
16252
16252
  /**
16253
16253
  * Get the underlying ReadableStream.
16254
16254
  *
16255
- * @returns The underlying ReadableStream<BraintrustStreamChunk>.
16255
+ * @returns The underlying `ReadableStream<BraintrustStreamChunk>`.
16256
16256
  */
16257
16257
  toReadableStream(): ReadableStream<BraintrustStreamChunk>;
16258
16258
  /**
@@ -21341,6 +21341,42 @@ declare const LEGACY_CACHED_HEADER = "x-cached";
21341
21341
  declare const X_CACHED_HEADER = "x-bt-cached";
21342
21342
  declare function parseCachedHeader(value: string | null | undefined): number | undefined;
21343
21343
 
21344
+ interface WrapAISDKOptions {
21345
+ denyOutputPaths?: string[];
21346
+ }
21347
+ /**
21348
+ * Wraps Vercel AI SDK methods with Braintrust tracing. Returns wrapped versions
21349
+ * of generateText, streamText, generateObject, and streamObject that automatically
21350
+ * create spans and log inputs, outputs, and metrics.
21351
+ *
21352
+ * @param ai - The AI SDK namespace (e.g., import * as ai from "ai")
21353
+ * @returns Object with AI SDK methods with Braintrust tracing
21354
+ *
21355
+ * @example
21356
+ * ```typescript
21357
+ * import { wrapAISDK } from "braintrust";
21358
+ * import * as ai from "ai";
21359
+ *
21360
+ * const { generateText, streamText, generateObject, streamObject } = wrapAISDK(ai);
21361
+ *
21362
+ * const result = await generateText({
21363
+ * model: openai("gpt-4"),
21364
+ * prompt: "Hello world"
21365
+ * });
21366
+ * ```
21367
+ */
21368
+ declare function wrapAISDK(aiSDK: any, options?: WrapAISDKOptions): any;
21369
+
21370
+ /**
21371
+ * Wrap an ai-sdk model (created with `.chat()`, `.completion()`, etc.) to add tracing. If Braintrust is
21372
+ * not configured, this is a no-op
21373
+ *
21374
+ * @param model
21375
+ * @deprecated You should use the new `wrapAISDK`.
21376
+ * @returns The wrapped object.
21377
+ */
21378
+ declare function wrapAISDKModel<T extends object>(model: T): T;
21379
+
21344
21380
  interface LanguageModelV2Middleware<TModel = any, TCallOptions = any> {
21345
21381
  wrapGenerate?: (options: {
21346
21382
  doGenerate: () => any;
@@ -21387,50 +21423,6 @@ interface MiddlewareConfig {
21387
21423
  */
21388
21424
  declare function BraintrustMiddleware(config?: MiddlewareConfig): LanguageModelV2Middleware<any, any>;
21389
21425
 
21390
- /**
21391
- * Wrap an ai-sdk model (created with `.chat()`, `.completion()`, etc.) to add tracing. If Braintrust is
21392
- * not configured, this is a no-op
21393
- *
21394
- * @param model
21395
- * @returns The wrapped object.
21396
- */
21397
- declare function wrapAISDKModel<T extends object>(model: T): T;
21398
-
21399
- interface AISDKMethods {
21400
- wrapLanguageModel: (options: any) => any;
21401
- generateText: (params: any) => Promise<any>;
21402
- streamText: (params: any) => any;
21403
- generateObject: (params: any) => Promise<any>;
21404
- streamObject: (params: any) => any;
21405
- }
21406
- /**
21407
- * Wraps Vercel AI SDK methods with Braintrust tracing. Returns wrapped versions
21408
- * of generateText, streamText, generateObject, and streamObject that automatically
21409
- * create spans and log inputs, outputs, and metrics.
21410
- *
21411
- * @param ai - The AI SDK namespace (e.g., import * as ai from "ai")
21412
- * @returns Object with AI SDK methods with Braintrust tracing
21413
- *
21414
- * @example
21415
- * ```typescript
21416
- * import { wrapAISDK } from "braintrust";
21417
- * import * as ai from "ai";
21418
- *
21419
- * const { generateText, streamText, generateObject, streamObject } = wrapAISDK(ai);
21420
- *
21421
- * const result = await generateText({
21422
- * model: openai("gpt-4"),
21423
- * prompt: "Hello world"
21424
- * });
21425
- * ```
21426
- */
21427
- declare function wrapAISDK<T extends AISDKMethods>(ai: T): {
21428
- generateText: T["generateText"];
21429
- streamText: T["streamText"];
21430
- generateObject: T["generateObject"];
21431
- streamObject: T["streamObject"];
21432
- };
21433
-
21434
21426
  interface MastraAgentMethods {
21435
21427
  name?: string;
21436
21428
  tools?: Record<string, unknown> | unknown[];
@@ -21499,7 +21491,7 @@ declare function wrapAnthropic<T extends object>(anthropic: T): T;
21499
21491
  * // Use normally - tracing is automatic
21500
21492
  * for await (const message of query({
21501
21493
  * prompt: "Hello, Claude!",
21502
- * options: { model: "claude-3-5-sonnet-20241022" }
21494
+ * options: { model: "claude-haiku-4-5-20251001" }
21503
21495
  * })) {
21504
21496
  * console.log(message);
21505
21497
  * }
@@ -21694,6 +21686,43 @@ declare class BraintrustSpanProcessor {
21694
21686
  shutdown(): Promise<void>;
21695
21687
  forceFlush(): Promise<void>;
21696
21688
  }
21689
+ /**
21690
+ * Create an OTEL context from a Braintrust span export string.
21691
+ *
21692
+ * Used for distributed tracing scenarios where a Braintrust span in one service
21693
+ * needs to be the parent of an OTEL span in another service.
21694
+ *
21695
+ * @param exportStr - The string returned from span.export()
21696
+ * @returns OTEL context that can be used when creating child spans
21697
+ *
21698
+ * @example
21699
+ * ```typescript
21700
+ * // Service A: Create BT span and export
21701
+ * const span = logger.startSpan({ name: "service-a" });
21702
+ * const exportStr = await span.export();
21703
+ * // Send exportStr to Service B (e.g., via HTTP header)
21704
+ *
21705
+ * // Service B: Import context and create OTEL child
21706
+ * import * as api from '@opentelemetry/api';
21707
+ * const ctx = otelContextFromSpanExport(exportStr);
21708
+ * await api.context.with(ctx, async () => {
21709
+ * await tracer.startActiveSpan("service-b", async (span) => {
21710
+ * // This span is now a child of the Service A span
21711
+ * span.end();
21712
+ * });
21713
+ * });
21714
+ * ```
21715
+ */
21716
+ declare function otelContextFromSpanExport(exportStr: string): unknown;
21717
+ /**
21718
+ * Construct a braintrust.parent identifier string from span components.
21719
+ *
21720
+ * @param objectType - Type of parent object (PROJECT_LOGS or EXPERIMENT)
21721
+ * @param objectId - Resolved object ID (project_id or experiment_id)
21722
+ * @param computeArgs - Optional dict with project_name/project_id for unresolved cases
21723
+ * @returns String like "project_id:abc", "project_name:my-proj", "experiment_id:exp-123", or undefined
21724
+ */
21725
+ declare function getBraintrustParent(objectType: number, objectId?: string | null, computeArgs?: Record<string, unknown> | null): string | undefined;
21697
21726
  /**
21698
21727
  * A trace exporter that sends OpenTelemetry spans to Braintrust.
21699
21728
  *
@@ -21760,6 +21789,111 @@ declare class BraintrustExporter {
21760
21789
  */
21761
21790
  forceFlush(): Promise<void>;
21762
21791
  }
21792
+ /**
21793
+ * Add braintrust.parent to OTEL baggage.
21794
+ *
21795
+ * This ensures that when using propagation inject() for distributed tracing,
21796
+ * the braintrust.parent will be propagated via baggage to downstream services.
21797
+ *
21798
+ * @param parent - Braintrust parent identifier (e.g., "project_name:my-project",
21799
+ * "project_id:abc123", "experiment_id:exp-456")
21800
+ * @param ctx - Optional OTEL context to use. If not provided, uses current context.
21801
+ * @returns Updated context with braintrust.parent in baggage
21802
+ *
21803
+ * @example
21804
+ * ```typescript
21805
+ * import { otel } from "braintrust";
21806
+ * import { propagation } from "@opentelemetry/api";
21807
+ *
21808
+ * // Set braintrust.parent in baggage
21809
+ * otel.addParentToBaggage("project_name:my-project");
21810
+ *
21811
+ * // Export headers (will include braintrust.parent in baggage)
21812
+ * const headers = {};
21813
+ * propagation.inject(context.active(), headers);
21814
+ * ```
21815
+ */
21816
+ declare function addParentToBaggage(parent: string, ctx?: Context): Context;
21817
+ /**
21818
+ * Copy braintrust.parent from span attribute to OTEL baggage.
21819
+ *
21820
+ * BraintrustSpanProcessor automatically sets braintrust.parent as a span attribute
21821
+ * when OTEL spans are created within Braintrust contexts. This function copies that
21822
+ * attribute to OTEL baggage so it propagates when using inject() for distributed tracing.
21823
+ *
21824
+ * @param span - OTEL span that has braintrust.parent attribute set
21825
+ * @param ctx - Optional OTEL context to use. If not provided, uses current context.
21826
+ * @returns Updated context with braintrust.parent in baggage, or undefined if attribute not found
21827
+ *
21828
+ * @example
21829
+ * ```typescript
21830
+ * import { otel } from "braintrust";
21831
+ * import { propagation } from "@opentelemetry/api";
21832
+ *
21833
+ * tracer.startActiveSpan("service_b", (span) => {
21834
+ * // Copy braintrust.parent from span attribute to baggage
21835
+ * otel.addSpanParentToBaggage(span);
21836
+ *
21837
+ * // Export headers (will include braintrust.parent in baggage)
21838
+ * const headers = {};
21839
+ * propagation.inject(context.active(), headers);
21840
+ * span.end();
21841
+ * });
21842
+ * ```
21843
+ */
21844
+ declare function addSpanParentToBaggage(span: Span, ctx?: Context): Context | undefined;
21845
+ /**
21846
+ * Extract a Braintrust-compatible parent string from W3C Trace Context headers.
21847
+ *
21848
+ * This converts OTEL trace context headers (traceparent/baggage) into a format
21849
+ * that can be passed as the 'parent' parameter to Braintrust's traced() method.
21850
+ *
21851
+ * @param headers - Dictionary with 'traceparent' and optionally 'baggage' keys
21852
+ * @returns Braintrust V4 export string that can be used as parent parameter,
21853
+ * or undefined if no valid span context is found or braintrust.parent is missing.
21854
+ *
21855
+ * @example
21856
+ * ```typescript
21857
+ * import { otel, initLogger } from "braintrust";
21858
+ *
21859
+ * // Service C receives headers from Service B
21860
+ * const headers = { traceparent: '00-trace_id-span_id-01', baggage: '...' };
21861
+ * const parent = otel.parentFromHeaders(headers);
21862
+ *
21863
+ * const logger = initLogger({ projectName: "my-project" });
21864
+ * await logger.traced(async (span) => {
21865
+ * span.log({ input: "BT span as child of OTEL parent" });
21866
+ * }, { name: "service_c", parent });
21867
+ * ```
21868
+ */
21869
+ declare function parentFromHeaders(headers: Record<string, string>): string | undefined;
21870
+ /**
21871
+ * OTEL namespace containing distributed tracing helper functions.
21872
+ *
21873
+ * @example
21874
+ * ```typescript
21875
+ * import { otel } from "braintrust";
21876
+ *
21877
+ * // Export Braintrust span context for OTEL
21878
+ * const ctx = otel.contextFromSpanExport(exportStr);
21879
+ *
21880
+ * // Add parent to baggage before propagating
21881
+ * otel.addParentToBaggage("project_name:my-project");
21882
+ *
21883
+ * // Copy span attribute to baggage
21884
+ * otel.addSpanParentToBaggage(span);
21885
+ *
21886
+ * // Create Braintrust parent from OTEL headers
21887
+ * const parent = otel.parentFromHeaders(headers);
21888
+ * ```
21889
+ */
21890
+ declare const otel: {
21891
+ contextFromSpanExport: typeof otelContextFromSpanExport;
21892
+ getBraintrustParent: typeof getBraintrustParent;
21893
+ addParentToBaggage: typeof addParentToBaggage;
21894
+ addSpanParentToBaggage: typeof addSpanParentToBaggage;
21895
+ parentFromHeaders: typeof parentFromHeaders;
21896
+ };
21763
21897
 
21764
21898
  type braintrust_AISpanProcessor = AISpanProcessor;
21765
21899
  declare const braintrust_AISpanProcessor: typeof AISpanProcessor;
@@ -21824,12 +21958,15 @@ declare const braintrust_ExternalAttachment: typeof ExternalAttachment;
21824
21958
  type braintrust_ExternalAttachmentParams = ExternalAttachmentParams;
21825
21959
  type braintrust_FailedHTTPResponse = FailedHTTPResponse;
21826
21960
  declare const braintrust_FailedHTTPResponse: typeof FailedHTTPResponse;
21961
+ type braintrust_FullInitDatasetOptions<IsLegacyDataset extends boolean> = FullInitDatasetOptions<IsLegacyDataset>;
21827
21962
  type braintrust_FullInitOptions<IsOpen extends boolean> = FullInitOptions<IsOpen>;
21828
21963
  type braintrust_FullLoginOptions = FullLoginOptions;
21829
21964
  type braintrust_FunctionEvent = FunctionEvent;
21830
21965
  type braintrust_IDGenerator = IDGenerator;
21831
21966
  declare const braintrust_IDGenerator: typeof IDGenerator;
21832
21967
  declare const braintrust_INTERNAL_BTQL_LIMIT: typeof INTERNAL_BTQL_LIMIT;
21968
+ type braintrust_InitDatasetOptions<IsLegacyDataset extends boolean> = InitDatasetOptions<IsLegacyDataset>;
21969
+ type braintrust_InitLoggerOptions<IsAsyncFlush> = InitLoggerOptions<IsAsyncFlush>;
21833
21970
  type braintrust_InitOptions<IsOpen extends boolean> = InitOptions<IsOpen>;
21834
21971
  type braintrust_InvokeFunctionArgs<Input, Output, Stream extends boolean = false> = InvokeFunctionArgs<Input, Output, Stream>;
21835
21972
  type braintrust_InvokeReturn<Stream extends boolean, Output> = InvokeReturn<Stream, Output>;
@@ -21838,6 +21975,7 @@ declare const braintrust_JSONAttachment: typeof JSONAttachment;
21838
21975
  declare const braintrust_LEGACY_CACHED_HEADER: typeof LEGACY_CACHED_HEADER;
21839
21976
  type braintrust_LazyValue<T> = LazyValue<T>;
21840
21977
  declare const braintrust_LazyValue: typeof LazyValue;
21978
+ type braintrust_LoadPromptOptions = LoadPromptOptions;
21841
21979
  type braintrust_LogOptions<IsAsyncFlush> = LogOptions<IsAsyncFlush>;
21842
21980
  type braintrust_Logger<IsAsyncFlush extends boolean> = Logger<IsAsyncFlush>;
21843
21981
  declare const braintrust_Logger: typeof Logger;
@@ -21918,6 +22056,7 @@ declare const braintrust_logError: typeof logError;
21918
22056
  declare const braintrust_login: typeof login;
21919
22057
  declare const braintrust_loginToState: typeof loginToState;
21920
22058
  declare const braintrust_newId: typeof newId;
22059
+ declare const braintrust_otel: typeof otel;
21921
22060
  declare const braintrust_parseCachedHeader: typeof parseCachedHeader;
21922
22061
  declare const braintrust_permalink: typeof permalink;
21923
22062
  declare const braintrust_projects: typeof projects;
@@ -21952,7 +22091,7 @@ declare const braintrust_wrapOpenAI: typeof wrapOpenAI;
21952
22091
  declare const braintrust_wrapOpenAIv4: typeof wrapOpenAIv4;
21953
22092
  declare const braintrust_wrapTraced: typeof wrapTraced;
21954
22093
  declare namespace braintrust {
21955
- 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_wrapGoogleGenAI as wrapGoogleGenAI, braintrust_wrapMastraAgent as wrapMastraAgent, braintrust_wrapOpenAI as wrapOpenAI, braintrust_wrapOpenAIv4 as wrapOpenAIv4, braintrust_wrapTraced as wrapTraced };
22094
+ 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_FullInitDatasetOptions as FullInitDatasetOptions, 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_InitDatasetOptions as InitDatasetOptions, type braintrust_InitLoggerOptions as InitLoggerOptions, 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_LoadPromptOptions as LoadPromptOptions, 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_otel as otel, 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_wrapGoogleGenAI as wrapGoogleGenAI, braintrust_wrapMastraAgent as wrapMastraAgent, braintrust_wrapOpenAI as wrapOpenAI, braintrust_wrapOpenAIv4 as wrapOpenAIv4, braintrust_wrapTraced as wrapTraced };
21956
22095
  }
21957
22096
 
21958
22097
  type EvaluatorManifest = Record<string, EvaluatorDef<unknown, unknown, unknown, BaseMetadata>>;
@@ -29009,4 +29148,4 @@ type EvaluatorDefinitions = z.infer<typeof evaluatorDefinitionsSchema>;
29009
29148
  * @module braintrust
29010
29149
  */
29011
29150
 
29012
- 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, wrapGoogleGenAI, wrapMastraAgent, wrapOpenAI, wrapOpenAIv4, wrapTraced };
29151
+ 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 FullInitDatasetOptions, type FullInitOptions, type FullLoginOptions, type FunctionEvent, IDGenerator, INTERNAL_BTQL_LIMIT, type IdField, type InitDatasetOptions, type InitLoggerOptions, type InitOptions, type InputField, type InvokeFunctionArgs, type InvokeReturn, JSONAttachment, LEGACY_CACHED_HEADER, LazyValue, type LoadPromptOptions, 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, otel, 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, wrapGoogleGenAI, wrapMastraAgent, wrapOpenAI, wrapOpenAIv4, wrapTraced };