braintrust 1.0.0 → 1.0.2
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.d.mts +16 -3
- package/dev/dist/index.d.ts +16 -3
- package/dev/dist/index.js +69 -44
- package/dev/dist/index.mjs +43 -18
- package/dist/browser.d.mts +29 -11
- package/dist/browser.d.ts +29 -11
- package/dist/browser.js +338 -108
- package/dist/browser.mjs +258 -28
- package/dist/cli.js +49 -20
- package/dist/index.d.mts +29 -11
- package/dist/index.d.ts +29 -11
- package/dist/index.js +356 -121
- package/dist/index.mjs +264 -29
- package/package.json +2 -1
package/dist/browser.d.mts
CHANGED
|
@@ -16629,7 +16629,7 @@ declare function extractAttachments(event: Record<string, any>, attachments: Bas
|
|
|
16629
16629
|
type WithTransactionId<R> = R & {
|
|
16630
16630
|
[TRANSACTION_ID_FIELD]: TransactionId;
|
|
16631
16631
|
};
|
|
16632
|
-
declare const
|
|
16632
|
+
declare const DEFAULT_FETCH_BATCH_SIZE = 1000;
|
|
16633
16633
|
declare class ObjectFetcher<RecordType> implements AsyncIterable<WithTransactionId<RecordType>> {
|
|
16634
16634
|
private objectType;
|
|
16635
16635
|
private pinnedVersion;
|
|
@@ -16640,11 +16640,24 @@ declare class ObjectFetcher<RecordType> implements AsyncIterable<WithTransaction
|
|
|
16640
16640
|
get id(): Promise<string>;
|
|
16641
16641
|
protected getState(): Promise<BraintrustState>;
|
|
16642
16642
|
private fetchRecordsFromApi;
|
|
16643
|
-
|
|
16643
|
+
/**
|
|
16644
|
+
* Fetch all records from the object.
|
|
16645
|
+
*
|
|
16646
|
+
* @param options Optional parameters for fetching.
|
|
16647
|
+
* @param options.batchSize The number of records to fetch per request. Defaults to 1000.
|
|
16648
|
+
* @returns An async generator of records.
|
|
16649
|
+
*/
|
|
16650
|
+
fetch(options?: {
|
|
16651
|
+
batchSize?: number;
|
|
16652
|
+
}): AsyncGenerator<WithTransactionId<RecordType>>;
|
|
16644
16653
|
[Symbol.asyncIterator](): AsyncIterator<WithTransactionId<RecordType>>;
|
|
16645
|
-
fetchedData(
|
|
16654
|
+
fetchedData(options?: {
|
|
16655
|
+
batchSize?: number;
|
|
16656
|
+
}): Promise<WithTransactionId<RecordType>[]>;
|
|
16646
16657
|
clearCache(): void;
|
|
16647
|
-
version(
|
|
16658
|
+
version(options?: {
|
|
16659
|
+
batchSize?: number;
|
|
16660
|
+
}): Promise<string | undefined>;
|
|
16648
16661
|
}
|
|
16649
16662
|
type BaseMetadata = Record<string, unknown> | void;
|
|
16650
16663
|
type DefaultMetadataType = void;
|
|
@@ -16789,7 +16802,9 @@ declare class ReadonlyExperiment extends ObjectFetcher<ExperimentEvent> {
|
|
|
16789
16802
|
get name(): Promise<string>;
|
|
16790
16803
|
get loggingState(): BraintrustState;
|
|
16791
16804
|
protected getState(): Promise<BraintrustState>;
|
|
16792
|
-
asDataset<Input, Expected, Metadata = DefaultMetadataType>(
|
|
16805
|
+
asDataset<Input, Expected, Metadata = DefaultMetadataType>(options?: {
|
|
16806
|
+
batchSize?: number;
|
|
16807
|
+
}): AsyncGenerator<EvalCase<Input, Expected, Metadata>>;
|
|
16793
16808
|
}
|
|
16794
16809
|
declare function newId(): string;
|
|
16795
16810
|
/**
|
|
@@ -17558,8 +17573,8 @@ interface WrapAISDKOptions {
|
|
|
17558
17573
|
}
|
|
17559
17574
|
/**
|
|
17560
17575
|
* Wraps Vercel AI SDK methods with Braintrust tracing. Returns wrapped versions
|
|
17561
|
-
* of generateText, streamText, generateObject,
|
|
17562
|
-
* create spans and log inputs, outputs, and metrics.
|
|
17576
|
+
* of generateText, streamText, generateObject, streamObject, Agent, experimental_Agent,
|
|
17577
|
+
* and ToolLoopAgent that automatically create spans and log inputs, outputs, and metrics.
|
|
17563
17578
|
*
|
|
17564
17579
|
* @param ai - The AI SDK namespace (e.g., import * as ai from "ai")
|
|
17565
17580
|
* @returns Object with AI SDK methods with Braintrust tracing
|
|
@@ -17569,12 +17584,15 @@ interface WrapAISDKOptions {
|
|
|
17569
17584
|
* import { wrapAISDK } from "braintrust";
|
|
17570
17585
|
* import * as ai from "ai";
|
|
17571
17586
|
*
|
|
17572
|
-
* const { generateText, streamText, generateObject, streamObject } = wrapAISDK(ai);
|
|
17587
|
+
* const { generateText, streamText, generateObject, streamObject, Agent } = wrapAISDK(ai);
|
|
17573
17588
|
*
|
|
17574
17589
|
* const result = await generateText({
|
|
17575
17590
|
* model: openai("gpt-4"),
|
|
17576
17591
|
* prompt: "Hello world"
|
|
17577
17592
|
* });
|
|
17593
|
+
*
|
|
17594
|
+
* const agent = new Agent({ model: openai("gpt-4") });
|
|
17595
|
+
* const agentResult = await agent.generate({ prompt: "Hello from agent" });
|
|
17578
17596
|
* ```
|
|
17579
17597
|
*/
|
|
17580
17598
|
declare function wrapAISDK<T>(aiSDK: T, options?: WrapAISDKOptions): T;
|
|
@@ -28713,6 +28731,7 @@ type braintrust_CompletionPrompt = CompletionPrompt;
|
|
|
28713
28731
|
type braintrust_ContextManager = ContextManager;
|
|
28714
28732
|
declare const braintrust_ContextManager: typeof ContextManager;
|
|
28715
28733
|
type braintrust_ContextParentSpanIds = ContextParentSpanIds;
|
|
28734
|
+
declare const braintrust_DEFAULT_FETCH_BATCH_SIZE: typeof DEFAULT_FETCH_BATCH_SIZE;
|
|
28716
28735
|
type braintrust_DataSummary = DataSummary;
|
|
28717
28736
|
type braintrust_Dataset<IsLegacyDataset extends boolean = typeof DEFAULT_IS_LEGACY_DATASET> = Dataset<IsLegacyDataset>;
|
|
28718
28737
|
declare const braintrust_Dataset: typeof Dataset;
|
|
@@ -28744,7 +28763,6 @@ type braintrust_FullInitOptions<IsOpen extends boolean> = FullInitOptions<IsOpen
|
|
|
28744
28763
|
type braintrust_FullLoginOptions = FullLoginOptions;
|
|
28745
28764
|
type braintrust_IDGenerator = IDGenerator;
|
|
28746
28765
|
declare const braintrust_IDGenerator: typeof IDGenerator;
|
|
28747
|
-
declare const braintrust_INTERNAL_BTQL_LIMIT: typeof INTERNAL_BTQL_LIMIT;
|
|
28748
28766
|
type braintrust_IdField = IdField;
|
|
28749
28767
|
type braintrust_InitDatasetOptions<IsLegacyDataset extends boolean> = InitDatasetOptions<IsLegacyDataset>;
|
|
28750
28768
|
type braintrust_InitLoggerOptions<IsAsyncFlush> = InitLoggerOptions<IsAsyncFlush>;
|
|
@@ -28852,7 +28870,7 @@ declare const braintrust_wrapOpenAI: typeof wrapOpenAI;
|
|
|
28852
28870
|
declare const braintrust_wrapOpenAIv4: typeof wrapOpenAIv4;
|
|
28853
28871
|
declare const braintrust_wrapTraced: typeof wrapTraced;
|
|
28854
28872
|
declare namespace braintrust {
|
|
28855
|
-
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_BraintrustMiddleware as BraintrustMiddleware, 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_IDGenerator as IDGenerator,
|
|
28873
|
+
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_BraintrustMiddleware as BraintrustMiddleware, 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, braintrust_DEFAULT_FETCH_BATCH_SIZE as DEFAULT_FETCH_BATCH_SIZE, 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_IDGenerator as IDGenerator, 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, braintrust_LoginInvalidOrgError as LoginInvalidOrgError, 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, 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_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_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_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_wrapAISDK as wrapAISDK, 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 };
|
|
28856
28874
|
}
|
|
28857
28875
|
|
|
28858
|
-
export { type AnyDataset, Attachment, type AttachmentParams, AttachmentReference, type BackgroundLoggerOpts, BaseAttachment, type BaseMetadata, BraintrustMiddleware, 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, IDGenerator,
|
|
28876
|
+
export { type AnyDataset, Attachment, type AttachmentParams, AttachmentReference, type BackgroundLoggerOpts, BaseAttachment, type BaseMetadata, BraintrustMiddleware, BraintrustState, BraintrustStream, type BraintrustStreamChunk, type ChatPrompt, type CommentEvent, type CompiledPrompt, type CompiledPromptParams, type CompletionPrompt, ContextManager, type ContextParentSpanIds, DEFAULT_FETCH_BATCH_SIZE, 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, IDGenerator, 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, LoginInvalidOrgError, 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, UUIDGenerator, type WithTransactionId, X_CACHED_HEADER, _exportsForTestingOnly, _internalGetGlobalState, _internalSetInitialState, braintrustStreamChunkSchema, createFinalValuePassThroughStream, currentExperiment, currentLogger, currentSpan, deepCopyEvent, braintrust as default, 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, renderMessage, renderPromptParams, setFetch, setMaskingFunction, spanComponentsToObjectId, startSpan, summarize, traceable, traced, updateSpan, withCurrent, withDataset, withExperiment, withLogger, withParent, wrapAISDK, wrapAnthropic, wrapClaudeAgentSDK, wrapGoogleGenAI, wrapMastraAgent, wrapOpenAI, wrapOpenAIv4, wrapTraced };
|
package/dist/browser.d.ts
CHANGED
|
@@ -16629,7 +16629,7 @@ declare function extractAttachments(event: Record<string, any>, attachments: Bas
|
|
|
16629
16629
|
type WithTransactionId<R> = R & {
|
|
16630
16630
|
[TRANSACTION_ID_FIELD]: TransactionId;
|
|
16631
16631
|
};
|
|
16632
|
-
declare const
|
|
16632
|
+
declare const DEFAULT_FETCH_BATCH_SIZE = 1000;
|
|
16633
16633
|
declare class ObjectFetcher<RecordType> implements AsyncIterable<WithTransactionId<RecordType>> {
|
|
16634
16634
|
private objectType;
|
|
16635
16635
|
private pinnedVersion;
|
|
@@ -16640,11 +16640,24 @@ declare class ObjectFetcher<RecordType> implements AsyncIterable<WithTransaction
|
|
|
16640
16640
|
get id(): Promise<string>;
|
|
16641
16641
|
protected getState(): Promise<BraintrustState>;
|
|
16642
16642
|
private fetchRecordsFromApi;
|
|
16643
|
-
|
|
16643
|
+
/**
|
|
16644
|
+
* Fetch all records from the object.
|
|
16645
|
+
*
|
|
16646
|
+
* @param options Optional parameters for fetching.
|
|
16647
|
+
* @param options.batchSize The number of records to fetch per request. Defaults to 1000.
|
|
16648
|
+
* @returns An async generator of records.
|
|
16649
|
+
*/
|
|
16650
|
+
fetch(options?: {
|
|
16651
|
+
batchSize?: number;
|
|
16652
|
+
}): AsyncGenerator<WithTransactionId<RecordType>>;
|
|
16644
16653
|
[Symbol.asyncIterator](): AsyncIterator<WithTransactionId<RecordType>>;
|
|
16645
|
-
fetchedData(
|
|
16654
|
+
fetchedData(options?: {
|
|
16655
|
+
batchSize?: number;
|
|
16656
|
+
}): Promise<WithTransactionId<RecordType>[]>;
|
|
16646
16657
|
clearCache(): void;
|
|
16647
|
-
version(
|
|
16658
|
+
version(options?: {
|
|
16659
|
+
batchSize?: number;
|
|
16660
|
+
}): Promise<string | undefined>;
|
|
16648
16661
|
}
|
|
16649
16662
|
type BaseMetadata = Record<string, unknown> | void;
|
|
16650
16663
|
type DefaultMetadataType = void;
|
|
@@ -16789,7 +16802,9 @@ declare class ReadonlyExperiment extends ObjectFetcher<ExperimentEvent> {
|
|
|
16789
16802
|
get name(): Promise<string>;
|
|
16790
16803
|
get loggingState(): BraintrustState;
|
|
16791
16804
|
protected getState(): Promise<BraintrustState>;
|
|
16792
|
-
asDataset<Input, Expected, Metadata = DefaultMetadataType>(
|
|
16805
|
+
asDataset<Input, Expected, Metadata = DefaultMetadataType>(options?: {
|
|
16806
|
+
batchSize?: number;
|
|
16807
|
+
}): AsyncGenerator<EvalCase<Input, Expected, Metadata>>;
|
|
16793
16808
|
}
|
|
16794
16809
|
declare function newId(): string;
|
|
16795
16810
|
/**
|
|
@@ -17558,8 +17573,8 @@ interface WrapAISDKOptions {
|
|
|
17558
17573
|
}
|
|
17559
17574
|
/**
|
|
17560
17575
|
* Wraps Vercel AI SDK methods with Braintrust tracing. Returns wrapped versions
|
|
17561
|
-
* of generateText, streamText, generateObject,
|
|
17562
|
-
* create spans and log inputs, outputs, and metrics.
|
|
17576
|
+
* of generateText, streamText, generateObject, streamObject, Agent, experimental_Agent,
|
|
17577
|
+
* and ToolLoopAgent that automatically create spans and log inputs, outputs, and metrics.
|
|
17563
17578
|
*
|
|
17564
17579
|
* @param ai - The AI SDK namespace (e.g., import * as ai from "ai")
|
|
17565
17580
|
* @returns Object with AI SDK methods with Braintrust tracing
|
|
@@ -17569,12 +17584,15 @@ interface WrapAISDKOptions {
|
|
|
17569
17584
|
* import { wrapAISDK } from "braintrust";
|
|
17570
17585
|
* import * as ai from "ai";
|
|
17571
17586
|
*
|
|
17572
|
-
* const { generateText, streamText, generateObject, streamObject } = wrapAISDK(ai);
|
|
17587
|
+
* const { generateText, streamText, generateObject, streamObject, Agent } = wrapAISDK(ai);
|
|
17573
17588
|
*
|
|
17574
17589
|
* const result = await generateText({
|
|
17575
17590
|
* model: openai("gpt-4"),
|
|
17576
17591
|
* prompt: "Hello world"
|
|
17577
17592
|
* });
|
|
17593
|
+
*
|
|
17594
|
+
* const agent = new Agent({ model: openai("gpt-4") });
|
|
17595
|
+
* const agentResult = await agent.generate({ prompt: "Hello from agent" });
|
|
17578
17596
|
* ```
|
|
17579
17597
|
*/
|
|
17580
17598
|
declare function wrapAISDK<T>(aiSDK: T, options?: WrapAISDKOptions): T;
|
|
@@ -28713,6 +28731,7 @@ type braintrust_CompletionPrompt = CompletionPrompt;
|
|
|
28713
28731
|
type braintrust_ContextManager = ContextManager;
|
|
28714
28732
|
declare const braintrust_ContextManager: typeof ContextManager;
|
|
28715
28733
|
type braintrust_ContextParentSpanIds = ContextParentSpanIds;
|
|
28734
|
+
declare const braintrust_DEFAULT_FETCH_BATCH_SIZE: typeof DEFAULT_FETCH_BATCH_SIZE;
|
|
28716
28735
|
type braintrust_DataSummary = DataSummary;
|
|
28717
28736
|
type braintrust_Dataset<IsLegacyDataset extends boolean = typeof DEFAULT_IS_LEGACY_DATASET> = Dataset<IsLegacyDataset>;
|
|
28718
28737
|
declare const braintrust_Dataset: typeof Dataset;
|
|
@@ -28744,7 +28763,6 @@ type braintrust_FullInitOptions<IsOpen extends boolean> = FullInitOptions<IsOpen
|
|
|
28744
28763
|
type braintrust_FullLoginOptions = FullLoginOptions;
|
|
28745
28764
|
type braintrust_IDGenerator = IDGenerator;
|
|
28746
28765
|
declare const braintrust_IDGenerator: typeof IDGenerator;
|
|
28747
|
-
declare const braintrust_INTERNAL_BTQL_LIMIT: typeof INTERNAL_BTQL_LIMIT;
|
|
28748
28766
|
type braintrust_IdField = IdField;
|
|
28749
28767
|
type braintrust_InitDatasetOptions<IsLegacyDataset extends boolean> = InitDatasetOptions<IsLegacyDataset>;
|
|
28750
28768
|
type braintrust_InitLoggerOptions<IsAsyncFlush> = InitLoggerOptions<IsAsyncFlush>;
|
|
@@ -28852,7 +28870,7 @@ declare const braintrust_wrapOpenAI: typeof wrapOpenAI;
|
|
|
28852
28870
|
declare const braintrust_wrapOpenAIv4: typeof wrapOpenAIv4;
|
|
28853
28871
|
declare const braintrust_wrapTraced: typeof wrapTraced;
|
|
28854
28872
|
declare namespace braintrust {
|
|
28855
|
-
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_BraintrustMiddleware as BraintrustMiddleware, 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_IDGenerator as IDGenerator,
|
|
28873
|
+
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_BraintrustMiddleware as BraintrustMiddleware, 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, braintrust_DEFAULT_FETCH_BATCH_SIZE as DEFAULT_FETCH_BATCH_SIZE, 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_IDGenerator as IDGenerator, 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, braintrust_LoginInvalidOrgError as LoginInvalidOrgError, 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, 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_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_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_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_wrapAISDK as wrapAISDK, 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 };
|
|
28856
28874
|
}
|
|
28857
28875
|
|
|
28858
|
-
export { type AnyDataset, Attachment, type AttachmentParams, AttachmentReference, type BackgroundLoggerOpts, BaseAttachment, type BaseMetadata, BraintrustMiddleware, 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, IDGenerator,
|
|
28876
|
+
export { type AnyDataset, Attachment, type AttachmentParams, AttachmentReference, type BackgroundLoggerOpts, BaseAttachment, type BaseMetadata, BraintrustMiddleware, BraintrustState, BraintrustStream, type BraintrustStreamChunk, type ChatPrompt, type CommentEvent, type CompiledPrompt, type CompiledPromptParams, type CompletionPrompt, ContextManager, type ContextParentSpanIds, DEFAULT_FETCH_BATCH_SIZE, 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, IDGenerator, 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, LoginInvalidOrgError, 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, UUIDGenerator, type WithTransactionId, X_CACHED_HEADER, _exportsForTestingOnly, _internalGetGlobalState, _internalSetInitialState, braintrustStreamChunkSchema, createFinalValuePassThroughStream, currentExperiment, currentLogger, currentSpan, deepCopyEvent, braintrust as default, 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, renderMessage, renderPromptParams, setFetch, setMaskingFunction, spanComponentsToObjectId, startSpan, summarize, traceable, traced, updateSpan, withCurrent, withDataset, withExperiment, withLogger, withParent, wrapAISDK, wrapAnthropic, wrapClaudeAgentSDK, wrapGoogleGenAI, wrapMastraAgent, wrapOpenAI, wrapOpenAIv4, wrapTraced };
|