braintrust 0.0.163 → 0.0.165

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.
@@ -278,6 +278,11 @@ declare function spanComponentsToObjectId({ components, state, }: {
278
278
  components: SpanComponentsV3;
279
279
  state?: BraintrustState;
280
280
  }): Promise<string>;
281
+ declare function permalink(slug: string, opts?: {
282
+ state?: BraintrustState;
283
+ orgName?: string;
284
+ appUrl?: string;
285
+ }): Promise<string>;
281
286
  declare class Logger<IsAsyncFlush extends boolean> implements Exportable {
282
287
  private state;
283
288
  private lazyMetadata;
@@ -458,6 +463,7 @@ type InitDatasetOptions<IsLegacyDataset extends boolean> = FullLoginOptions & {
458
463
  description?: string;
459
464
  version?: string;
460
465
  projectId?: string;
466
+ metadata?: Record<string, unknown>;
461
467
  state?: BraintrustState;
462
468
  } & UseOutputOption<IsLegacyDataset>;
463
469
  type FullInitDatasetOptions<IsLegacyDataset extends boolean> = {
@@ -474,6 +480,7 @@ type FullInitDatasetOptions<IsLegacyDataset extends boolean> = {
474
480
  * @param options.apiKey The API key to use. If the parameter is not specified, will try to use the `BRAINTRUST_API_KEY` environment variable. If no API key is specified, will prompt the user to login.
475
481
  * @param options.orgName (Optional) The name of a specific organization to connect to. This is useful if you belong to multiple.
476
482
  * @param options.projectId The id of the project to create the dataset in. This takes precedence over `project` if specified.
483
+ * @param options.metadata A dictionary with additional data about the dataset. The values in `metadata` can be any JSON-serializable type, but its keys must be strings.
477
484
  * @param options.useOutput (Deprecated) If true, records will be fetched from this dataset in the legacy format, with the "expected" field renamed to "output". This option will be removed in a future version of Braintrust.
478
485
  * @returns The newly created Dataset.
479
486
  */
@@ -1481,6 +1488,7 @@ declare const braintrust_login: typeof login;
1481
1488
  declare const braintrust_loginToState: typeof loginToState;
1482
1489
  declare const braintrust_newId: typeof newId;
1483
1490
  declare const braintrust_parseCachedHeader: typeof parseCachedHeader;
1491
+ declare const braintrust_permalink: typeof permalink;
1484
1492
  declare const braintrust_renderMessage: typeof renderMessage;
1485
1493
  declare const braintrust_setFetch: typeof setFetch;
1486
1494
  declare const braintrust_spanComponentsToObjectId: typeof spanComponentsToObjectId;
@@ -1497,7 +1505,7 @@ declare const braintrust_wrapOpenAI: typeof wrapOpenAI;
1497
1505
  declare const braintrust_wrapOpenAIv4: typeof wrapOpenAIv4;
1498
1506
  declare const braintrust_wrapTraced: typeof wrapTraced;
1499
1507
  declare namespace braintrust {
1500
- export { type braintrust_AnyDataset as AnyDataset, type braintrust_BackgroundLoggerOpts as BackgroundLoggerOpts, 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_CompiledPrompt as CompiledPrompt, type braintrust_CompiledPromptParams as CompiledPromptParams, type braintrust_CompletionPrompt as CompletionPrompt, type braintrust_DataSummary as DataSummary, braintrust_Dataset as Dataset, type braintrust_DatasetSummary as DatasetSummary, type braintrust_DefaultMetadataType as DefaultMetadataType, type braintrust_DefaultPromptArgs as DefaultPromptArgs, type braintrust_EndSpanArgs as EndSpanArgs, type braintrust_EvalCase as EvalCase, braintrust_Experiment as Experiment, type braintrust_ExperimentSummary as ExperimentSummary, type braintrust_Exportable as Exportable, braintrust_FailedHTTPResponse as FailedHTTPResponse, type braintrust_FullInitOptions as FullInitOptions, type braintrust_FullLoginOptions as FullLoginOptions, type braintrust_InitOptions as InitOptions, type braintrust_InvokeFunctionArgs as InvokeFunctionArgs, type braintrust_InvokeReturn as InvokeReturn, braintrust_LEGACY_CACHED_HEADER as LEGACY_CACHED_HEADER, 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_NoopSpan as NoopSpan, type braintrust_ObjectMetadata as ObjectMetadata, type braintrust_PromiseUnless as PromiseUnless, braintrust_Prompt as Prompt, type braintrust_PromptRowWithId as PromptRowWithId, braintrust_ReadonlyExperiment as ReadonlyExperiment, type braintrust_ScoreSummary as ScoreSummary, type braintrust_SerializedBraintrustState as SerializedBraintrustState, type braintrust_SetCurrentArg as SetCurrentArg, type braintrust_Span as Span, braintrust_SpanImpl as SpanImpl, type braintrust_StartSpanArgs as StartSpanArgs, type braintrust_WithTransactionId as WithTransactionId, braintrust_X_CACHED_HEADER as X_CACHED_HEADER, braintrust__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_devNullWritableStream as devNullWritableStream, braintrust_flush as flush, braintrust_getSpanParentObject as getSpanParentObject, braintrust_init as init, braintrust_initDataset as initDataset, braintrust_initExperiment as initExperiment, 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_renderMessage as renderMessage, braintrust_setFetch as setFetch, braintrust_spanComponentsToObjectId as spanComponentsToObjectId, braintrust_startSpan as startSpan, braintrust_summarize as summarize, braintrust_traceable as traceable, braintrust_traced as traced, braintrust_updateSpan as updateSpan, braintrust_withCurrent as withCurrent, braintrust_withDataset as withDataset, braintrust_withExperiment as withExperiment, braintrust_withLogger as withLogger, braintrust_wrapOpenAI as wrapOpenAI, braintrust_wrapOpenAIv4 as wrapOpenAIv4, braintrust_wrapTraced as wrapTraced };
1508
+ export { type braintrust_AnyDataset as AnyDataset, type braintrust_BackgroundLoggerOpts as BackgroundLoggerOpts, 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_CompiledPrompt as CompiledPrompt, type braintrust_CompiledPromptParams as CompiledPromptParams, type braintrust_CompletionPrompt as CompletionPrompt, type braintrust_DataSummary as DataSummary, braintrust_Dataset as Dataset, type braintrust_DatasetSummary as DatasetSummary, type braintrust_DefaultMetadataType as DefaultMetadataType, type braintrust_DefaultPromptArgs as DefaultPromptArgs, type braintrust_EndSpanArgs as EndSpanArgs, type braintrust_EvalCase as EvalCase, braintrust_Experiment as Experiment, type braintrust_ExperimentSummary as ExperimentSummary, type braintrust_Exportable as Exportable, braintrust_FailedHTTPResponse as FailedHTTPResponse, type braintrust_FullInitOptions as FullInitOptions, type braintrust_FullLoginOptions as FullLoginOptions, type braintrust_InitOptions as InitOptions, type braintrust_InvokeFunctionArgs as InvokeFunctionArgs, type braintrust_InvokeReturn as InvokeReturn, braintrust_LEGACY_CACHED_HEADER as LEGACY_CACHED_HEADER, 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_NoopSpan as NoopSpan, type braintrust_ObjectMetadata as ObjectMetadata, type braintrust_PromiseUnless as PromiseUnless, braintrust_Prompt as Prompt, type braintrust_PromptRowWithId as PromptRowWithId, braintrust_ReadonlyExperiment as ReadonlyExperiment, type braintrust_ScoreSummary as ScoreSummary, type braintrust_SerializedBraintrustState as SerializedBraintrustState, type braintrust_SetCurrentArg as SetCurrentArg, type braintrust_Span as Span, braintrust_SpanImpl as SpanImpl, type braintrust_StartSpanArgs as StartSpanArgs, type braintrust_WithTransactionId as WithTransactionId, braintrust_X_CACHED_HEADER as X_CACHED_HEADER, braintrust__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_devNullWritableStream as devNullWritableStream, braintrust_flush as flush, braintrust_getSpanParentObject as getSpanParentObject, braintrust_init as init, braintrust_initDataset as initDataset, braintrust_initExperiment as initExperiment, 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_setFetch as setFetch, braintrust_spanComponentsToObjectId as spanComponentsToObjectId, braintrust_startSpan as startSpan, braintrust_summarize as summarize, braintrust_traceable as traceable, braintrust_traced as traced, braintrust_updateSpan as updateSpan, braintrust_withCurrent as withCurrent, braintrust_withDataset as withDataset, braintrust_withExperiment as withExperiment, braintrust_withLogger as withLogger, braintrust_wrapOpenAI as wrapOpenAI, braintrust_wrapOpenAIv4 as wrapOpenAIv4, braintrust_wrapTraced as wrapTraced };
1501
1509
  }
1502
1510
 
1503
- export { type AnyDataset, type BackgroundLoggerOpts, type BaseMetadata, BraintrustState, BraintrustStream, type BraintrustStreamChunk, type ChatPrompt, type CompiledPrompt, type CompiledPromptParams, type CompletionPrompt, type DataSummary, Dataset, type DatasetSummary, type DefaultMetadataType, type DefaultPromptArgs, type EndSpanArgs, type EvalCase, Experiment, type ExperimentSummary, type Exportable, FailedHTTPResponse, type FullInitOptions, type FullLoginOptions, type InitOptions, type InvokeFunctionArgs, type InvokeReturn, LEGACY_CACHED_HEADER, type LogOptions, Logger, type LoginOptions, type MetricSummary, NOOP_SPAN, NoopSpan, type ObjectMetadata, type PromiseUnless, Prompt, type PromptRowWithId, ReadonlyExperiment, type ScoreSummary, type SerializedBraintrustState, type SetCurrentArg, type Span, SpanImpl, type StartSpanArgs, type WithTransactionId, X_CACHED_HEADER, _internalGetGlobalState, _internalSetInitialState, braintrustStreamChunkSchema, createFinalValuePassThroughStream, currentExperiment, currentLogger, currentSpan, braintrust as default, devNullWritableStream, flush, getSpanParentObject, init, initDataset, initExperiment, initLogger, invoke, loadPrompt, log, logError, login, loginToState, newId, parseCachedHeader, renderMessage, setFetch, spanComponentsToObjectId, startSpan, summarize, traceable, traced, updateSpan, withCurrent, withDataset, withExperiment, withLogger, wrapOpenAI, wrapOpenAIv4, wrapTraced };
1511
+ export { type AnyDataset, type BackgroundLoggerOpts, type BaseMetadata, BraintrustState, BraintrustStream, type BraintrustStreamChunk, type ChatPrompt, type CompiledPrompt, type CompiledPromptParams, type CompletionPrompt, type DataSummary, Dataset, type DatasetSummary, type DefaultMetadataType, type DefaultPromptArgs, type EndSpanArgs, type EvalCase, Experiment, type ExperimentSummary, type Exportable, FailedHTTPResponse, type FullInitOptions, type FullLoginOptions, type InitOptions, type InvokeFunctionArgs, type InvokeReturn, LEGACY_CACHED_HEADER, type LogOptions, Logger, type LoginOptions, type MetricSummary, NOOP_SPAN, NoopSpan, type ObjectMetadata, type PromiseUnless, Prompt, type PromptRowWithId, ReadonlyExperiment, type ScoreSummary, type SerializedBraintrustState, type SetCurrentArg, type Span, SpanImpl, type StartSpanArgs, type WithTransactionId, X_CACHED_HEADER, _internalGetGlobalState, _internalSetInitialState, braintrustStreamChunkSchema, createFinalValuePassThroughStream, currentExperiment, currentLogger, currentSpan, braintrust as default, devNullWritableStream, flush, getSpanParentObject, init, initDataset, initExperiment, initLogger, invoke, loadPrompt, log, logError, login, loginToState, newId, parseCachedHeader, permalink, renderMessage, setFetch, spanComponentsToObjectId, startSpan, summarize, traceable, traced, updateSpan, withCurrent, withDataset, withExperiment, withLogger, wrapOpenAI, wrapOpenAIv4, wrapTraced };
package/dist/browser.d.ts CHANGED
@@ -278,6 +278,11 @@ declare function spanComponentsToObjectId({ components, state, }: {
278
278
  components: SpanComponentsV3;
279
279
  state?: BraintrustState;
280
280
  }): Promise<string>;
281
+ declare function permalink(slug: string, opts?: {
282
+ state?: BraintrustState;
283
+ orgName?: string;
284
+ appUrl?: string;
285
+ }): Promise<string>;
281
286
  declare class Logger<IsAsyncFlush extends boolean> implements Exportable {
282
287
  private state;
283
288
  private lazyMetadata;
@@ -458,6 +463,7 @@ type InitDatasetOptions<IsLegacyDataset extends boolean> = FullLoginOptions & {
458
463
  description?: string;
459
464
  version?: string;
460
465
  projectId?: string;
466
+ metadata?: Record<string, unknown>;
461
467
  state?: BraintrustState;
462
468
  } & UseOutputOption<IsLegacyDataset>;
463
469
  type FullInitDatasetOptions<IsLegacyDataset extends boolean> = {
@@ -474,6 +480,7 @@ type FullInitDatasetOptions<IsLegacyDataset extends boolean> = {
474
480
  * @param options.apiKey The API key to use. If the parameter is not specified, will try to use the `BRAINTRUST_API_KEY` environment variable. If no API key is specified, will prompt the user to login.
475
481
  * @param options.orgName (Optional) The name of a specific organization to connect to. This is useful if you belong to multiple.
476
482
  * @param options.projectId The id of the project to create the dataset in. This takes precedence over `project` if specified.
483
+ * @param options.metadata A dictionary with additional data about the dataset. The values in `metadata` can be any JSON-serializable type, but its keys must be strings.
477
484
  * @param options.useOutput (Deprecated) If true, records will be fetched from this dataset in the legacy format, with the "expected" field renamed to "output". This option will be removed in a future version of Braintrust.
478
485
  * @returns The newly created Dataset.
479
486
  */
@@ -1481,6 +1488,7 @@ declare const braintrust_login: typeof login;
1481
1488
  declare const braintrust_loginToState: typeof loginToState;
1482
1489
  declare const braintrust_newId: typeof newId;
1483
1490
  declare const braintrust_parseCachedHeader: typeof parseCachedHeader;
1491
+ declare const braintrust_permalink: typeof permalink;
1484
1492
  declare const braintrust_renderMessage: typeof renderMessage;
1485
1493
  declare const braintrust_setFetch: typeof setFetch;
1486
1494
  declare const braintrust_spanComponentsToObjectId: typeof spanComponentsToObjectId;
@@ -1497,7 +1505,7 @@ declare const braintrust_wrapOpenAI: typeof wrapOpenAI;
1497
1505
  declare const braintrust_wrapOpenAIv4: typeof wrapOpenAIv4;
1498
1506
  declare const braintrust_wrapTraced: typeof wrapTraced;
1499
1507
  declare namespace braintrust {
1500
- export { type braintrust_AnyDataset as AnyDataset, type braintrust_BackgroundLoggerOpts as BackgroundLoggerOpts, 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_CompiledPrompt as CompiledPrompt, type braintrust_CompiledPromptParams as CompiledPromptParams, type braintrust_CompletionPrompt as CompletionPrompt, type braintrust_DataSummary as DataSummary, braintrust_Dataset as Dataset, type braintrust_DatasetSummary as DatasetSummary, type braintrust_DefaultMetadataType as DefaultMetadataType, type braintrust_DefaultPromptArgs as DefaultPromptArgs, type braintrust_EndSpanArgs as EndSpanArgs, type braintrust_EvalCase as EvalCase, braintrust_Experiment as Experiment, type braintrust_ExperimentSummary as ExperimentSummary, type braintrust_Exportable as Exportable, braintrust_FailedHTTPResponse as FailedHTTPResponse, type braintrust_FullInitOptions as FullInitOptions, type braintrust_FullLoginOptions as FullLoginOptions, type braintrust_InitOptions as InitOptions, type braintrust_InvokeFunctionArgs as InvokeFunctionArgs, type braintrust_InvokeReturn as InvokeReturn, braintrust_LEGACY_CACHED_HEADER as LEGACY_CACHED_HEADER, 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_NoopSpan as NoopSpan, type braintrust_ObjectMetadata as ObjectMetadata, type braintrust_PromiseUnless as PromiseUnless, braintrust_Prompt as Prompt, type braintrust_PromptRowWithId as PromptRowWithId, braintrust_ReadonlyExperiment as ReadonlyExperiment, type braintrust_ScoreSummary as ScoreSummary, type braintrust_SerializedBraintrustState as SerializedBraintrustState, type braintrust_SetCurrentArg as SetCurrentArg, type braintrust_Span as Span, braintrust_SpanImpl as SpanImpl, type braintrust_StartSpanArgs as StartSpanArgs, type braintrust_WithTransactionId as WithTransactionId, braintrust_X_CACHED_HEADER as X_CACHED_HEADER, braintrust__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_devNullWritableStream as devNullWritableStream, braintrust_flush as flush, braintrust_getSpanParentObject as getSpanParentObject, braintrust_init as init, braintrust_initDataset as initDataset, braintrust_initExperiment as initExperiment, 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_renderMessage as renderMessage, braintrust_setFetch as setFetch, braintrust_spanComponentsToObjectId as spanComponentsToObjectId, braintrust_startSpan as startSpan, braintrust_summarize as summarize, braintrust_traceable as traceable, braintrust_traced as traced, braintrust_updateSpan as updateSpan, braintrust_withCurrent as withCurrent, braintrust_withDataset as withDataset, braintrust_withExperiment as withExperiment, braintrust_withLogger as withLogger, braintrust_wrapOpenAI as wrapOpenAI, braintrust_wrapOpenAIv4 as wrapOpenAIv4, braintrust_wrapTraced as wrapTraced };
1508
+ export { type braintrust_AnyDataset as AnyDataset, type braintrust_BackgroundLoggerOpts as BackgroundLoggerOpts, 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_CompiledPrompt as CompiledPrompt, type braintrust_CompiledPromptParams as CompiledPromptParams, type braintrust_CompletionPrompt as CompletionPrompt, type braintrust_DataSummary as DataSummary, braintrust_Dataset as Dataset, type braintrust_DatasetSummary as DatasetSummary, type braintrust_DefaultMetadataType as DefaultMetadataType, type braintrust_DefaultPromptArgs as DefaultPromptArgs, type braintrust_EndSpanArgs as EndSpanArgs, type braintrust_EvalCase as EvalCase, braintrust_Experiment as Experiment, type braintrust_ExperimentSummary as ExperimentSummary, type braintrust_Exportable as Exportable, braintrust_FailedHTTPResponse as FailedHTTPResponse, type braintrust_FullInitOptions as FullInitOptions, type braintrust_FullLoginOptions as FullLoginOptions, type braintrust_InitOptions as InitOptions, type braintrust_InvokeFunctionArgs as InvokeFunctionArgs, type braintrust_InvokeReturn as InvokeReturn, braintrust_LEGACY_CACHED_HEADER as LEGACY_CACHED_HEADER, 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_NoopSpan as NoopSpan, type braintrust_ObjectMetadata as ObjectMetadata, type braintrust_PromiseUnless as PromiseUnless, braintrust_Prompt as Prompt, type braintrust_PromptRowWithId as PromptRowWithId, braintrust_ReadonlyExperiment as ReadonlyExperiment, type braintrust_ScoreSummary as ScoreSummary, type braintrust_SerializedBraintrustState as SerializedBraintrustState, type braintrust_SetCurrentArg as SetCurrentArg, type braintrust_Span as Span, braintrust_SpanImpl as SpanImpl, type braintrust_StartSpanArgs as StartSpanArgs, type braintrust_WithTransactionId as WithTransactionId, braintrust_X_CACHED_HEADER as X_CACHED_HEADER, braintrust__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_devNullWritableStream as devNullWritableStream, braintrust_flush as flush, braintrust_getSpanParentObject as getSpanParentObject, braintrust_init as init, braintrust_initDataset as initDataset, braintrust_initExperiment as initExperiment, 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_setFetch as setFetch, braintrust_spanComponentsToObjectId as spanComponentsToObjectId, braintrust_startSpan as startSpan, braintrust_summarize as summarize, braintrust_traceable as traceable, braintrust_traced as traced, braintrust_updateSpan as updateSpan, braintrust_withCurrent as withCurrent, braintrust_withDataset as withDataset, braintrust_withExperiment as withExperiment, braintrust_withLogger as withLogger, braintrust_wrapOpenAI as wrapOpenAI, braintrust_wrapOpenAIv4 as wrapOpenAIv4, braintrust_wrapTraced as wrapTraced };
1501
1509
  }
1502
1510
 
1503
- export { type AnyDataset, type BackgroundLoggerOpts, type BaseMetadata, BraintrustState, BraintrustStream, type BraintrustStreamChunk, type ChatPrompt, type CompiledPrompt, type CompiledPromptParams, type CompletionPrompt, type DataSummary, Dataset, type DatasetSummary, type DefaultMetadataType, type DefaultPromptArgs, type EndSpanArgs, type EvalCase, Experiment, type ExperimentSummary, type Exportable, FailedHTTPResponse, type FullInitOptions, type FullLoginOptions, type InitOptions, type InvokeFunctionArgs, type InvokeReturn, LEGACY_CACHED_HEADER, type LogOptions, Logger, type LoginOptions, type MetricSummary, NOOP_SPAN, NoopSpan, type ObjectMetadata, type PromiseUnless, Prompt, type PromptRowWithId, ReadonlyExperiment, type ScoreSummary, type SerializedBraintrustState, type SetCurrentArg, type Span, SpanImpl, type StartSpanArgs, type WithTransactionId, X_CACHED_HEADER, _internalGetGlobalState, _internalSetInitialState, braintrustStreamChunkSchema, createFinalValuePassThroughStream, currentExperiment, currentLogger, currentSpan, braintrust as default, devNullWritableStream, flush, getSpanParentObject, init, initDataset, initExperiment, initLogger, invoke, loadPrompt, log, logError, login, loginToState, newId, parseCachedHeader, renderMessage, setFetch, spanComponentsToObjectId, startSpan, summarize, traceable, traced, updateSpan, withCurrent, withDataset, withExperiment, withLogger, wrapOpenAI, wrapOpenAIv4, wrapTraced };
1511
+ export { type AnyDataset, type BackgroundLoggerOpts, type BaseMetadata, BraintrustState, BraintrustStream, type BraintrustStreamChunk, type ChatPrompt, type CompiledPrompt, type CompiledPromptParams, type CompletionPrompt, type DataSummary, Dataset, type DatasetSummary, type DefaultMetadataType, type DefaultPromptArgs, type EndSpanArgs, type EvalCase, Experiment, type ExperimentSummary, type Exportable, FailedHTTPResponse, type FullInitOptions, type FullLoginOptions, type InitOptions, type InvokeFunctionArgs, type InvokeReturn, LEGACY_CACHED_HEADER, type LogOptions, Logger, type LoginOptions, type MetricSummary, NOOP_SPAN, NoopSpan, type ObjectMetadata, type PromiseUnless, Prompt, type PromptRowWithId, ReadonlyExperiment, type ScoreSummary, type SerializedBraintrustState, type SetCurrentArg, type Span, SpanImpl, type StartSpanArgs, type WithTransactionId, X_CACHED_HEADER, _internalGetGlobalState, _internalSetInitialState, braintrustStreamChunkSchema, createFinalValuePassThroughStream, currentExperiment, currentLogger, currentSpan, braintrust as default, devNullWritableStream, flush, getSpanParentObject, init, initDataset, initExperiment, initLogger, invoke, loadPrompt, log, logError, login, loginToState, newId, parseCachedHeader, permalink, renderMessage, setFetch, spanComponentsToObjectId, startSpan, summarize, traceable, traced, updateSpan, withCurrent, withDataset, withExperiment, withLogger, wrapOpenAI, wrapOpenAIv4, wrapTraced };
package/dist/browser.js CHANGED
@@ -66,6 +66,7 @@ __export(browser_exports, {
66
66
  loginToState: () => loginToState,
67
67
  newId: () => newId,
68
68
  parseCachedHeader: () => parseCachedHeader,
69
+ permalink: () => permalink,
69
70
  renderMessage: () => renderMessage,
70
71
  setFetch: () => setFetch,
71
72
  spanComponentsToObjectId: () => spanComponentsToObjectId,
@@ -919,6 +920,44 @@ async function spanComponentsToObjectId({
919
920
  components
920
921
  )();
921
922
  }
923
+ async function permalink(slug, opts) {
924
+ const state = opts?.state ?? _globalState;
925
+ const getOrgName = async () => {
926
+ if (opts?.orgName) {
927
+ return opts.orgName;
928
+ }
929
+ await state.login({});
930
+ if (!state.orgName) {
931
+ throw new Error(
932
+ "Must either provide orgName explicitly or be logged in to a specific org"
933
+ );
934
+ }
935
+ return state.orgName;
936
+ };
937
+ const getAppUrl = async () => {
938
+ if (opts?.appUrl) {
939
+ return opts.appUrl;
940
+ }
941
+ await state.login({});
942
+ if (!state.appUrl) {
943
+ throw new Error("Must either provide appUrl explicitly or be logged in");
944
+ }
945
+ return state.appUrl;
946
+ };
947
+ const components = import_core.SpanComponentsV3.fromStr(slug);
948
+ const object_type = (0, import_core.spanObjectTypeV3ToString)(components.data.object_type);
949
+ const [orgName, appUrl, object_id] = await Promise.all([
950
+ getOrgName(),
951
+ getAppUrl(),
952
+ spanComponentsToObjectId({ components, state })
953
+ ]);
954
+ const id = components.data.row_id;
955
+ if (!id) {
956
+ throw new Error("Span slug does not refer to an individual row");
957
+ }
958
+ const urlParams = new URLSearchParams({ object_type, object_id, id });
959
+ return `${appUrl}/app/${orgName}/object?${urlParams}`;
960
+ }
922
961
  function startSpanParentArgs(args) {
923
962
  let argParentObjectId = void 0;
924
963
  let argParentSpanIds = void 0;
@@ -1699,6 +1738,7 @@ function initDataset(projectOrOptions, optionalOptions) {
1699
1738
  fetch,
1700
1739
  forceLogin,
1701
1740
  projectId,
1741
+ metadata,
1702
1742
  useOutput: legacy,
1703
1743
  state: stateArg
1704
1744
  } = options;
@@ -1717,7 +1757,8 @@ function initDataset(projectOrOptions, optionalOptions) {
1717
1757
  project_name: project,
1718
1758
  project_id: projectId,
1719
1759
  dataset_name: dataset,
1720
- description
1760
+ description,
1761
+ metadata
1721
1762
  };
1722
1763
  const response = await state.appConn().post_json("api/dataset/register", args);
1723
1764
  return {
@@ -3237,6 +3278,7 @@ __export(exports_browser_exports, {
3237
3278
  loginToState: () => loginToState,
3238
3279
  newId: () => newId,
3239
3280
  parseCachedHeader: () => parseCachedHeader,
3281
+ permalink: () => permalink,
3240
3282
  renderMessage: () => renderMessage,
3241
3283
  setFetch: () => setFetch,
3242
3284
  spanComponentsToObjectId: () => spanComponentsToObjectId,
@@ -3741,6 +3783,7 @@ var browser_default = exports_browser_exports;
3741
3783
  loginToState,
3742
3784
  newId,
3743
3785
  parseCachedHeader,
3786
+ permalink,
3744
3787
  renderMessage,
3745
3788
  setFetch,
3746
3789
  spanComponentsToObjectId,
package/dist/browser.mjs CHANGED
@@ -47,6 +47,7 @@ import {
47
47
  batchItems,
48
48
  SpanComponentsV3,
49
49
  SpanObjectTypeV3,
50
+ spanObjectTypeV3ToString,
50
51
  gitMetadataSettingsSchema,
51
52
  _urljoin
52
53
  } from "@braintrust/core";
@@ -869,6 +870,44 @@ async function spanComponentsToObjectId({
869
870
  components
870
871
  )();
871
872
  }
873
+ async function permalink(slug, opts) {
874
+ const state = opts?.state ?? _globalState;
875
+ const getOrgName = async () => {
876
+ if (opts?.orgName) {
877
+ return opts.orgName;
878
+ }
879
+ await state.login({});
880
+ if (!state.orgName) {
881
+ throw new Error(
882
+ "Must either provide orgName explicitly or be logged in to a specific org"
883
+ );
884
+ }
885
+ return state.orgName;
886
+ };
887
+ const getAppUrl = async () => {
888
+ if (opts?.appUrl) {
889
+ return opts.appUrl;
890
+ }
891
+ await state.login({});
892
+ if (!state.appUrl) {
893
+ throw new Error("Must either provide appUrl explicitly or be logged in");
894
+ }
895
+ return state.appUrl;
896
+ };
897
+ const components = SpanComponentsV3.fromStr(slug);
898
+ const object_type = spanObjectTypeV3ToString(components.data.object_type);
899
+ const [orgName, appUrl, object_id] = await Promise.all([
900
+ getOrgName(),
901
+ getAppUrl(),
902
+ spanComponentsToObjectId({ components, state })
903
+ ]);
904
+ const id = components.data.row_id;
905
+ if (!id) {
906
+ throw new Error("Span slug does not refer to an individual row");
907
+ }
908
+ const urlParams = new URLSearchParams({ object_type, object_id, id });
909
+ return `${appUrl}/app/${orgName}/object?${urlParams}`;
910
+ }
872
911
  function startSpanParentArgs(args) {
873
912
  let argParentObjectId = void 0;
874
913
  let argParentSpanIds = void 0;
@@ -1649,6 +1688,7 @@ function initDataset(projectOrOptions, optionalOptions) {
1649
1688
  fetch,
1650
1689
  forceLogin,
1651
1690
  projectId,
1691
+ metadata,
1652
1692
  useOutput: legacy,
1653
1693
  state: stateArg
1654
1694
  } = options;
@@ -1667,7 +1707,8 @@ function initDataset(projectOrOptions, optionalOptions) {
1667
1707
  project_name: project,
1668
1708
  project_id: projectId,
1669
1709
  dataset_name: dataset,
1670
- description
1710
+ description,
1711
+ metadata
1671
1712
  };
1672
1713
  const response = await state.appConn().post_json("api/dataset/register", args);
1673
1714
  return {
@@ -3187,6 +3228,7 @@ __export(exports_browser_exports, {
3187
3228
  loginToState: () => loginToState,
3188
3229
  newId: () => newId,
3189
3230
  parseCachedHeader: () => parseCachedHeader,
3231
+ permalink: () => permalink,
3190
3232
  renderMessage: () => renderMessage,
3191
3233
  setFetch: () => setFetch,
3192
3234
  spanComponentsToObjectId: () => spanComponentsToObjectId,
@@ -3693,6 +3735,7 @@ export {
3693
3735
  loginToState,
3694
3736
  newId,
3695
3737
  parseCachedHeader,
3738
+ permalink,
3696
3739
  renderMessage,
3697
3740
  setFetch,
3698
3741
  spanComponentsToObjectId,
package/dist/cli.js CHANGED
@@ -1236,7 +1236,7 @@ var require_package = __commonJS({
1236
1236
  "package.json"(exports2, module2) {
1237
1237
  module2.exports = {
1238
1238
  name: "braintrust",
1239
- version: "0.0.163",
1239
+ version: "0.0.165",
1240
1240
  description: "SDK for integrating Braintrust",
1241
1241
  repository: {
1242
1242
  type: "git",
@@ -1306,7 +1306,7 @@ var require_package = __commonJS({
1306
1306
  },
1307
1307
  dependencies: {
1308
1308
  "@ai-sdk/provider": "^0.0.11",
1309
- "@braintrust/core": "0.0.59",
1309
+ "@braintrust/core": "0.0.61",
1310
1310
  "@next/env": "^14.2.3",
1311
1311
  "@vercel/functions": "^1.0.2",
1312
1312
  ai: "^3.2.16",
package/dist/index.d.mts CHANGED
@@ -279,6 +279,11 @@ declare function spanComponentsToObjectId({ components, state, }: {
279
279
  components: SpanComponentsV3;
280
280
  state?: BraintrustState;
281
281
  }): Promise<string>;
282
+ declare function permalink(slug: string, opts?: {
283
+ state?: BraintrustState;
284
+ orgName?: string;
285
+ appUrl?: string;
286
+ }): Promise<string>;
282
287
  declare class Logger<IsAsyncFlush extends boolean> implements Exportable {
283
288
  private state;
284
289
  private lazyMetadata;
@@ -459,6 +464,7 @@ type InitDatasetOptions<IsLegacyDataset extends boolean> = FullLoginOptions & {
459
464
  description?: string;
460
465
  version?: string;
461
466
  projectId?: string;
467
+ metadata?: Record<string, unknown>;
462
468
  state?: BraintrustState;
463
469
  } & UseOutputOption<IsLegacyDataset>;
464
470
  type FullInitDatasetOptions<IsLegacyDataset extends boolean> = {
@@ -475,6 +481,7 @@ type FullInitDatasetOptions<IsLegacyDataset extends boolean> = {
475
481
  * @param options.apiKey The API key to use. If the parameter is not specified, will try to use the `BRAINTRUST_API_KEY` environment variable. If no API key is specified, will prompt the user to login.
476
482
  * @param options.orgName (Optional) The name of a specific organization to connect to. This is useful if you belong to multiple.
477
483
  * @param options.projectId The id of the project to create the dataset in. This takes precedence over `project` if specified.
484
+ * @param options.metadata A dictionary with additional data about the dataset. The values in `metadata` can be any JSON-serializable type, but its keys must be strings.
478
485
  * @param options.useOutput (Deprecated) If true, records will be fetched from this dataset in the legacy format, with the "expected" field renamed to "output". This option will be removed in a future version of Braintrust.
479
486
  * @returns The newly created Dataset.
480
487
  */
@@ -1834,6 +1841,7 @@ declare const braintrust_login: typeof login;
1834
1841
  declare const braintrust_loginToState: typeof loginToState;
1835
1842
  declare const braintrust_newId: typeof newId;
1836
1843
  declare const braintrust_parseCachedHeader: typeof parseCachedHeader;
1844
+ declare const braintrust_permalink: typeof permalink;
1837
1845
  declare const braintrust_projects: typeof projects;
1838
1846
  declare const braintrust_renderMessage: typeof renderMessage;
1839
1847
  declare const braintrust_reportFailures: typeof reportFailures;
@@ -1854,7 +1862,7 @@ declare const braintrust_wrapOpenAI: typeof wrapOpenAI;
1854
1862
  declare const braintrust_wrapOpenAIv4: typeof wrapOpenAIv4;
1855
1863
  declare const braintrust_wrapTraced: typeof wrapTraced;
1856
1864
  declare namespace braintrust {
1857
- export { type braintrust_AnyDataset as AnyDataset, type braintrust_BackgroundLoggerOpts as BackgroundLoggerOpts, braintrust_BaseExperiment as BaseExperiment, type braintrust_BaseMetadata as BaseMetadata, braintrust_BraintrustState as BraintrustState, braintrust_BraintrustStream as BraintrustStream, type braintrust_BraintrustStreamChunk as BraintrustStreamChunk, type braintrust_ChatPrompt as ChatPrompt, braintrust_CodeFunction as CodeFunction, braintrust_CodePrompt as CodePrompt, braintrust_CommentEvent as CommentEvent, type braintrust_CompiledPrompt as CompiledPrompt, type braintrust_CompiledPromptParams as CompiledPromptParams, type braintrust_CompletionPrompt as CompletionPrompt, type braintrust_CreateProjectOpts as CreateProjectOpts, type braintrust_DataSummary as DataSummary, braintrust_Dataset as Dataset, braintrust_DatasetRecord as DatasetRecord, type braintrust_DatasetSummary as DatasetSummary, type braintrust_DefaultMetadataType as DefaultMetadataType, type braintrust_DefaultPromptArgs as DefaultPromptArgs, type braintrust_EndSpanArgs as EndSpanArgs, braintrust_Eval as Eval, type braintrust_EvalCase as EvalCase, type braintrust_EvalResult as EvalResult, 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, braintrust_ExperimentLogFullArgs as ExperimentLogFullArgs, braintrust_ExperimentLogPartialArgs as ExperimentLogPartialArgs, type braintrust_ExperimentSummary as ExperimentSummary, type braintrust_Exportable as Exportable, braintrust_FailedHTTPResponse as FailedHTTPResponse, type braintrust_FullInitOptions as FullInitOptions, type braintrust_FullLoginOptions as FullLoginOptions, braintrust_IdField as IdField, type braintrust_InitOptions as InitOptions, braintrust_InputField as InputField, braintrust_InputsField as InputsField, type braintrust_InvokeFunctionArgs as InvokeFunctionArgs, type braintrust_InvokeReturn as InvokeReturn, braintrust_LEGACY_CACHED_HEADER as LEGACY_CACHED_HEADER, braintrust_LazyValue as LazyValue, braintrust_LogCommentFullArgs as LogCommentFullArgs, braintrust_LogFeedbackFullArgs as LogFeedbackFullArgs, type braintrust_LogOptions as LogOptions, braintrust_Logger as Logger, type braintrust_LoginOptions as LoginOptions, type braintrust_MetricSummary as MetricSummary, braintrust_NOOP_SPAN as NOOP_SPAN, braintrust_NoopSpan as NoopSpan, type braintrust_ObjectMetadata as ObjectMetadata, braintrust_OtherExperimentLogFields as OtherExperimentLogFields, braintrust_ParentExperimentIds as ParentExperimentIds, braintrust_ParentProjectLogIds as ParentProjectLogIds, braintrust_Project as Project, type braintrust_PromiseUnless as PromiseUnless, braintrust_Prompt as Prompt, braintrust_PromptBuilder as PromptBuilder, type braintrust_PromptOpts as PromptOpts, type braintrust_PromptRowWithId as PromptRowWithId, braintrust_ReadonlyExperiment as ReadonlyExperiment, braintrust_Reporter as Reporter, type braintrust_ReporterBody as ReporterBody, type braintrust_ScoreSummary as ScoreSummary, type braintrust_SerializedBraintrustState as SerializedBraintrustState, type braintrust_SetCurrentArg as SetCurrentArg, type braintrust_Span as Span, type braintrust_SpanContext as SpanContext, braintrust_SpanImpl as SpanImpl, type braintrust_StartSpanArgs as StartSpanArgs, braintrust_ToolBuilder as ToolBuilder, type braintrust_ToolFunctionDefinition as ToolFunctionDefinition, type braintrust_ToolOpts as ToolOpts, type braintrust_WithTransactionId as WithTransactionId, braintrust_X_CACHED_HEADER as X_CACHED_HEADER, 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_devNullWritableStream as devNullWritableStream, braintrust_flush as flush, braintrust_getSpanParentObject as getSpanParentObject, braintrust_init as init, braintrust_initDataset as initDataset, braintrust_initExperiment as initExperiment, 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_projects as projects, braintrust_renderMessage as renderMessage, braintrust_reportFailures as reportFailures, braintrust_setFetch as setFetch, braintrust_spanComponentsToObjectId as spanComponentsToObjectId, braintrust_startSpan as startSpan, braintrust_summarize as summarize, braintrust_toolFunctionDefinitionSchema 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_wrapAISDKModel as wrapAISDKModel, braintrust_wrapOpenAI as wrapOpenAI, braintrust_wrapOpenAIv4 as wrapOpenAIv4, braintrust_wrapTraced as wrapTraced };
1865
+ export { type braintrust_AnyDataset as AnyDataset, type braintrust_BackgroundLoggerOpts as BackgroundLoggerOpts, braintrust_BaseExperiment as BaseExperiment, type braintrust_BaseMetadata as BaseMetadata, braintrust_BraintrustState as BraintrustState, braintrust_BraintrustStream as BraintrustStream, type braintrust_BraintrustStreamChunk as BraintrustStreamChunk, type braintrust_ChatPrompt as ChatPrompt, braintrust_CodeFunction as CodeFunction, braintrust_CodePrompt as CodePrompt, braintrust_CommentEvent as CommentEvent, type braintrust_CompiledPrompt as CompiledPrompt, type braintrust_CompiledPromptParams as CompiledPromptParams, type braintrust_CompletionPrompt as CompletionPrompt, type braintrust_CreateProjectOpts as CreateProjectOpts, type braintrust_DataSummary as DataSummary, braintrust_Dataset as Dataset, braintrust_DatasetRecord as DatasetRecord, type braintrust_DatasetSummary as DatasetSummary, type braintrust_DefaultMetadataType as DefaultMetadataType, type braintrust_DefaultPromptArgs as DefaultPromptArgs, type braintrust_EndSpanArgs as EndSpanArgs, braintrust_Eval as Eval, type braintrust_EvalCase as EvalCase, type braintrust_EvalResult as EvalResult, 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, braintrust_ExperimentLogFullArgs as ExperimentLogFullArgs, braintrust_ExperimentLogPartialArgs as ExperimentLogPartialArgs, type braintrust_ExperimentSummary as ExperimentSummary, type braintrust_Exportable as Exportable, braintrust_FailedHTTPResponse as FailedHTTPResponse, type braintrust_FullInitOptions as FullInitOptions, type braintrust_FullLoginOptions as FullLoginOptions, braintrust_IdField as IdField, type braintrust_InitOptions as InitOptions, braintrust_InputField as InputField, braintrust_InputsField as InputsField, type braintrust_InvokeFunctionArgs as InvokeFunctionArgs, type braintrust_InvokeReturn as InvokeReturn, braintrust_LEGACY_CACHED_HEADER as LEGACY_CACHED_HEADER, braintrust_LazyValue as LazyValue, braintrust_LogCommentFullArgs as LogCommentFullArgs, braintrust_LogFeedbackFullArgs as LogFeedbackFullArgs, type braintrust_LogOptions as LogOptions, braintrust_Logger as Logger, type braintrust_LoginOptions as LoginOptions, type braintrust_MetricSummary as MetricSummary, braintrust_NOOP_SPAN as NOOP_SPAN, braintrust_NoopSpan as NoopSpan, type braintrust_ObjectMetadata as ObjectMetadata, braintrust_OtherExperimentLogFields as OtherExperimentLogFields, braintrust_ParentExperimentIds as ParentExperimentIds, braintrust_ParentProjectLogIds as ParentProjectLogIds, braintrust_Project as Project, type braintrust_PromiseUnless as PromiseUnless, braintrust_Prompt as Prompt, braintrust_PromptBuilder as PromptBuilder, type braintrust_PromptOpts as PromptOpts, type braintrust_PromptRowWithId as PromptRowWithId, braintrust_ReadonlyExperiment as ReadonlyExperiment, braintrust_Reporter as Reporter, type braintrust_ReporterBody as ReporterBody, type braintrust_ScoreSummary as ScoreSummary, type braintrust_SerializedBraintrustState as SerializedBraintrustState, type braintrust_SetCurrentArg as SetCurrentArg, type braintrust_Span as Span, type braintrust_SpanContext as SpanContext, braintrust_SpanImpl as SpanImpl, type braintrust_StartSpanArgs as StartSpanArgs, braintrust_ToolBuilder as ToolBuilder, type braintrust_ToolFunctionDefinition as ToolFunctionDefinition, type braintrust_ToolOpts as ToolOpts, type braintrust_WithTransactionId as WithTransactionId, braintrust_X_CACHED_HEADER as X_CACHED_HEADER, 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_devNullWritableStream as devNullWritableStream, braintrust_flush as flush, braintrust_getSpanParentObject as getSpanParentObject, braintrust_init as init, braintrust_initDataset as initDataset, braintrust_initExperiment as initExperiment, 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_renderMessage as renderMessage, braintrust_reportFailures as reportFailures, braintrust_setFetch as setFetch, braintrust_spanComponentsToObjectId as spanComponentsToObjectId, braintrust_startSpan as startSpan, braintrust_summarize as summarize, braintrust_toolFunctionDefinitionSchema 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_wrapAISDKModel as wrapAISDKModel, braintrust_wrapOpenAI as wrapOpenAI, braintrust_wrapOpenAIv4 as wrapOpenAIv4, braintrust_wrapTraced as wrapTraced };
1858
1866
  }
1859
1867
 
1860
1868
  /**
@@ -1910,4 +1918,4 @@ declare namespace braintrust {
1910
1918
  * @module braintrust
1911
1919
  */
1912
1920
 
1913
- export { type AnyDataset, type BackgroundLoggerOpts, BaseExperiment, type BaseMetadata, BraintrustState, BraintrustStream, type BraintrustStreamChunk, type ChatPrompt, CodeFunction, CodePrompt, type CompiledPrompt, type CompiledPromptParams, type CompletionPrompt, type CreateProjectOpts, type DataSummary, Dataset, type DatasetSummary, type DefaultMetadataType, type DefaultPromptArgs, type EndSpanArgs, Eval, type EvalCase, type EvalResult, type EvalScorer, type EvalScorerArgs, type EvalTask, type Evaluator, type EvaluatorDef, type EvaluatorFile, Experiment, type ExperimentSummary, type Exportable, FailedHTTPResponse, type FullInitOptions, type FullLoginOptions, type InitOptions, type InvokeFunctionArgs, type InvokeReturn, LEGACY_CACHED_HEADER, LazyValue, type LogOptions, Logger, type LoginOptions, type MetricSummary, NOOP_SPAN, NoopSpan, type ObjectMetadata, Project, type PromiseUnless, Prompt, PromptBuilder, type PromptOpts, type PromptRowWithId, ReadonlyExperiment, Reporter, type ReporterBody, type ScoreSummary, type SerializedBraintrustState, type SetCurrentArg, type Span, type SpanContext, SpanImpl, type StartSpanArgs, ToolBuilder, type ToolFunctionDefinition, type ToolOpts, type WithTransactionId, X_CACHED_HEADER, _internalGetGlobalState, _internalSetInitialState, braintrustStreamChunkSchema, buildLocalSummary, createFinalValuePassThroughStream, currentExperiment, currentLogger, currentSpan, braintrust as default, devNullWritableStream, flush, getSpanParentObject, init, initDataset, initExperiment, initLogger, invoke, loadPrompt, log, logError, login, loginToState, newId, parseCachedHeader, projects, renderMessage, reportFailures, setFetch, spanComponentsToObjectId, startSpan, summarize, toolFunctionDefinitionSchema, traceable, traced, updateSpan, withCurrent, withDataset, withExperiment, withLogger, wrapAISDKModel, wrapOpenAI, wrapOpenAIv4, wrapTraced };
1921
+ export { type AnyDataset, type BackgroundLoggerOpts, BaseExperiment, type BaseMetadata, BraintrustState, BraintrustStream, type BraintrustStreamChunk, type ChatPrompt, CodeFunction, CodePrompt, type CompiledPrompt, type CompiledPromptParams, type CompletionPrompt, type CreateProjectOpts, type DataSummary, Dataset, type DatasetSummary, type DefaultMetadataType, type DefaultPromptArgs, type EndSpanArgs, Eval, type EvalCase, type EvalResult, type EvalScorer, type EvalScorerArgs, type EvalTask, type Evaluator, type EvaluatorDef, type EvaluatorFile, Experiment, type ExperimentSummary, type Exportable, FailedHTTPResponse, type FullInitOptions, type FullLoginOptions, type InitOptions, type InvokeFunctionArgs, type InvokeReturn, LEGACY_CACHED_HEADER, LazyValue, type LogOptions, Logger, type LoginOptions, type MetricSummary, NOOP_SPAN, NoopSpan, type ObjectMetadata, Project, type PromiseUnless, Prompt, PromptBuilder, type PromptOpts, type PromptRowWithId, ReadonlyExperiment, Reporter, type ReporterBody, type ScoreSummary, type SerializedBraintrustState, type SetCurrentArg, type Span, type SpanContext, SpanImpl, type StartSpanArgs, ToolBuilder, type ToolFunctionDefinition, type ToolOpts, type WithTransactionId, X_CACHED_HEADER, _internalGetGlobalState, _internalSetInitialState, braintrustStreamChunkSchema, buildLocalSummary, createFinalValuePassThroughStream, currentExperiment, currentLogger, currentSpan, braintrust as default, devNullWritableStream, flush, getSpanParentObject, init, initDataset, initExperiment, initLogger, invoke, loadPrompt, log, logError, login, loginToState, newId, parseCachedHeader, permalink, projects, renderMessage, reportFailures, setFetch, spanComponentsToObjectId, startSpan, summarize, toolFunctionDefinitionSchema, traceable, traced, updateSpan, withCurrent, withDataset, withExperiment, withLogger, wrapAISDKModel, wrapOpenAI, wrapOpenAIv4, wrapTraced };
package/dist/index.d.ts CHANGED
@@ -279,6 +279,11 @@ declare function spanComponentsToObjectId({ components, state, }: {
279
279
  components: SpanComponentsV3;
280
280
  state?: BraintrustState;
281
281
  }): Promise<string>;
282
+ declare function permalink(slug: string, opts?: {
283
+ state?: BraintrustState;
284
+ orgName?: string;
285
+ appUrl?: string;
286
+ }): Promise<string>;
282
287
  declare class Logger<IsAsyncFlush extends boolean> implements Exportable {
283
288
  private state;
284
289
  private lazyMetadata;
@@ -459,6 +464,7 @@ type InitDatasetOptions<IsLegacyDataset extends boolean> = FullLoginOptions & {
459
464
  description?: string;
460
465
  version?: string;
461
466
  projectId?: string;
467
+ metadata?: Record<string, unknown>;
462
468
  state?: BraintrustState;
463
469
  } & UseOutputOption<IsLegacyDataset>;
464
470
  type FullInitDatasetOptions<IsLegacyDataset extends boolean> = {
@@ -475,6 +481,7 @@ type FullInitDatasetOptions<IsLegacyDataset extends boolean> = {
475
481
  * @param options.apiKey The API key to use. If the parameter is not specified, will try to use the `BRAINTRUST_API_KEY` environment variable. If no API key is specified, will prompt the user to login.
476
482
  * @param options.orgName (Optional) The name of a specific organization to connect to. This is useful if you belong to multiple.
477
483
  * @param options.projectId The id of the project to create the dataset in. This takes precedence over `project` if specified.
484
+ * @param options.metadata A dictionary with additional data about the dataset. The values in `metadata` can be any JSON-serializable type, but its keys must be strings.
478
485
  * @param options.useOutput (Deprecated) If true, records will be fetched from this dataset in the legacy format, with the "expected" field renamed to "output". This option will be removed in a future version of Braintrust.
479
486
  * @returns The newly created Dataset.
480
487
  */
@@ -1834,6 +1841,7 @@ declare const braintrust_login: typeof login;
1834
1841
  declare const braintrust_loginToState: typeof loginToState;
1835
1842
  declare const braintrust_newId: typeof newId;
1836
1843
  declare const braintrust_parseCachedHeader: typeof parseCachedHeader;
1844
+ declare const braintrust_permalink: typeof permalink;
1837
1845
  declare const braintrust_projects: typeof projects;
1838
1846
  declare const braintrust_renderMessage: typeof renderMessage;
1839
1847
  declare const braintrust_reportFailures: typeof reportFailures;
@@ -1854,7 +1862,7 @@ declare const braintrust_wrapOpenAI: typeof wrapOpenAI;
1854
1862
  declare const braintrust_wrapOpenAIv4: typeof wrapOpenAIv4;
1855
1863
  declare const braintrust_wrapTraced: typeof wrapTraced;
1856
1864
  declare namespace braintrust {
1857
- export { type braintrust_AnyDataset as AnyDataset, type braintrust_BackgroundLoggerOpts as BackgroundLoggerOpts, braintrust_BaseExperiment as BaseExperiment, type braintrust_BaseMetadata as BaseMetadata, braintrust_BraintrustState as BraintrustState, braintrust_BraintrustStream as BraintrustStream, type braintrust_BraintrustStreamChunk as BraintrustStreamChunk, type braintrust_ChatPrompt as ChatPrompt, braintrust_CodeFunction as CodeFunction, braintrust_CodePrompt as CodePrompt, braintrust_CommentEvent as CommentEvent, type braintrust_CompiledPrompt as CompiledPrompt, type braintrust_CompiledPromptParams as CompiledPromptParams, type braintrust_CompletionPrompt as CompletionPrompt, type braintrust_CreateProjectOpts as CreateProjectOpts, type braintrust_DataSummary as DataSummary, braintrust_Dataset as Dataset, braintrust_DatasetRecord as DatasetRecord, type braintrust_DatasetSummary as DatasetSummary, type braintrust_DefaultMetadataType as DefaultMetadataType, type braintrust_DefaultPromptArgs as DefaultPromptArgs, type braintrust_EndSpanArgs as EndSpanArgs, braintrust_Eval as Eval, type braintrust_EvalCase as EvalCase, type braintrust_EvalResult as EvalResult, 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, braintrust_ExperimentLogFullArgs as ExperimentLogFullArgs, braintrust_ExperimentLogPartialArgs as ExperimentLogPartialArgs, type braintrust_ExperimentSummary as ExperimentSummary, type braintrust_Exportable as Exportable, braintrust_FailedHTTPResponse as FailedHTTPResponse, type braintrust_FullInitOptions as FullInitOptions, type braintrust_FullLoginOptions as FullLoginOptions, braintrust_IdField as IdField, type braintrust_InitOptions as InitOptions, braintrust_InputField as InputField, braintrust_InputsField as InputsField, type braintrust_InvokeFunctionArgs as InvokeFunctionArgs, type braintrust_InvokeReturn as InvokeReturn, braintrust_LEGACY_CACHED_HEADER as LEGACY_CACHED_HEADER, braintrust_LazyValue as LazyValue, braintrust_LogCommentFullArgs as LogCommentFullArgs, braintrust_LogFeedbackFullArgs as LogFeedbackFullArgs, type braintrust_LogOptions as LogOptions, braintrust_Logger as Logger, type braintrust_LoginOptions as LoginOptions, type braintrust_MetricSummary as MetricSummary, braintrust_NOOP_SPAN as NOOP_SPAN, braintrust_NoopSpan as NoopSpan, type braintrust_ObjectMetadata as ObjectMetadata, braintrust_OtherExperimentLogFields as OtherExperimentLogFields, braintrust_ParentExperimentIds as ParentExperimentIds, braintrust_ParentProjectLogIds as ParentProjectLogIds, braintrust_Project as Project, type braintrust_PromiseUnless as PromiseUnless, braintrust_Prompt as Prompt, braintrust_PromptBuilder as PromptBuilder, type braintrust_PromptOpts as PromptOpts, type braintrust_PromptRowWithId as PromptRowWithId, braintrust_ReadonlyExperiment as ReadonlyExperiment, braintrust_Reporter as Reporter, type braintrust_ReporterBody as ReporterBody, type braintrust_ScoreSummary as ScoreSummary, type braintrust_SerializedBraintrustState as SerializedBraintrustState, type braintrust_SetCurrentArg as SetCurrentArg, type braintrust_Span as Span, type braintrust_SpanContext as SpanContext, braintrust_SpanImpl as SpanImpl, type braintrust_StartSpanArgs as StartSpanArgs, braintrust_ToolBuilder as ToolBuilder, type braintrust_ToolFunctionDefinition as ToolFunctionDefinition, type braintrust_ToolOpts as ToolOpts, type braintrust_WithTransactionId as WithTransactionId, braintrust_X_CACHED_HEADER as X_CACHED_HEADER, 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_devNullWritableStream as devNullWritableStream, braintrust_flush as flush, braintrust_getSpanParentObject as getSpanParentObject, braintrust_init as init, braintrust_initDataset as initDataset, braintrust_initExperiment as initExperiment, 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_projects as projects, braintrust_renderMessage as renderMessage, braintrust_reportFailures as reportFailures, braintrust_setFetch as setFetch, braintrust_spanComponentsToObjectId as spanComponentsToObjectId, braintrust_startSpan as startSpan, braintrust_summarize as summarize, braintrust_toolFunctionDefinitionSchema 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_wrapAISDKModel as wrapAISDKModel, braintrust_wrapOpenAI as wrapOpenAI, braintrust_wrapOpenAIv4 as wrapOpenAIv4, braintrust_wrapTraced as wrapTraced };
1865
+ export { type braintrust_AnyDataset as AnyDataset, type braintrust_BackgroundLoggerOpts as BackgroundLoggerOpts, braintrust_BaseExperiment as BaseExperiment, type braintrust_BaseMetadata as BaseMetadata, braintrust_BraintrustState as BraintrustState, braintrust_BraintrustStream as BraintrustStream, type braintrust_BraintrustStreamChunk as BraintrustStreamChunk, type braintrust_ChatPrompt as ChatPrompt, braintrust_CodeFunction as CodeFunction, braintrust_CodePrompt as CodePrompt, braintrust_CommentEvent as CommentEvent, type braintrust_CompiledPrompt as CompiledPrompt, type braintrust_CompiledPromptParams as CompiledPromptParams, type braintrust_CompletionPrompt as CompletionPrompt, type braintrust_CreateProjectOpts as CreateProjectOpts, type braintrust_DataSummary as DataSummary, braintrust_Dataset as Dataset, braintrust_DatasetRecord as DatasetRecord, type braintrust_DatasetSummary as DatasetSummary, type braintrust_DefaultMetadataType as DefaultMetadataType, type braintrust_DefaultPromptArgs as DefaultPromptArgs, type braintrust_EndSpanArgs as EndSpanArgs, braintrust_Eval as Eval, type braintrust_EvalCase as EvalCase, type braintrust_EvalResult as EvalResult, 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, braintrust_ExperimentLogFullArgs as ExperimentLogFullArgs, braintrust_ExperimentLogPartialArgs as ExperimentLogPartialArgs, type braintrust_ExperimentSummary as ExperimentSummary, type braintrust_Exportable as Exportable, braintrust_FailedHTTPResponse as FailedHTTPResponse, type braintrust_FullInitOptions as FullInitOptions, type braintrust_FullLoginOptions as FullLoginOptions, braintrust_IdField as IdField, type braintrust_InitOptions as InitOptions, braintrust_InputField as InputField, braintrust_InputsField as InputsField, type braintrust_InvokeFunctionArgs as InvokeFunctionArgs, type braintrust_InvokeReturn as InvokeReturn, braintrust_LEGACY_CACHED_HEADER as LEGACY_CACHED_HEADER, braintrust_LazyValue as LazyValue, braintrust_LogCommentFullArgs as LogCommentFullArgs, braintrust_LogFeedbackFullArgs as LogFeedbackFullArgs, type braintrust_LogOptions as LogOptions, braintrust_Logger as Logger, type braintrust_LoginOptions as LoginOptions, type braintrust_MetricSummary as MetricSummary, braintrust_NOOP_SPAN as NOOP_SPAN, braintrust_NoopSpan as NoopSpan, type braintrust_ObjectMetadata as ObjectMetadata, braintrust_OtherExperimentLogFields as OtherExperimentLogFields, braintrust_ParentExperimentIds as ParentExperimentIds, braintrust_ParentProjectLogIds as ParentProjectLogIds, braintrust_Project as Project, type braintrust_PromiseUnless as PromiseUnless, braintrust_Prompt as Prompt, braintrust_PromptBuilder as PromptBuilder, type braintrust_PromptOpts as PromptOpts, type braintrust_PromptRowWithId as PromptRowWithId, braintrust_ReadonlyExperiment as ReadonlyExperiment, braintrust_Reporter as Reporter, type braintrust_ReporterBody as ReporterBody, type braintrust_ScoreSummary as ScoreSummary, type braintrust_SerializedBraintrustState as SerializedBraintrustState, type braintrust_SetCurrentArg as SetCurrentArg, type braintrust_Span as Span, type braintrust_SpanContext as SpanContext, braintrust_SpanImpl as SpanImpl, type braintrust_StartSpanArgs as StartSpanArgs, braintrust_ToolBuilder as ToolBuilder, type braintrust_ToolFunctionDefinition as ToolFunctionDefinition, type braintrust_ToolOpts as ToolOpts, type braintrust_WithTransactionId as WithTransactionId, braintrust_X_CACHED_HEADER as X_CACHED_HEADER, 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_devNullWritableStream as devNullWritableStream, braintrust_flush as flush, braintrust_getSpanParentObject as getSpanParentObject, braintrust_init as init, braintrust_initDataset as initDataset, braintrust_initExperiment as initExperiment, 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_renderMessage as renderMessage, braintrust_reportFailures as reportFailures, braintrust_setFetch as setFetch, braintrust_spanComponentsToObjectId as spanComponentsToObjectId, braintrust_startSpan as startSpan, braintrust_summarize as summarize, braintrust_toolFunctionDefinitionSchema 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_wrapAISDKModel as wrapAISDKModel, braintrust_wrapOpenAI as wrapOpenAI, braintrust_wrapOpenAIv4 as wrapOpenAIv4, braintrust_wrapTraced as wrapTraced };
1858
1866
  }
1859
1867
 
1860
1868
  /**
@@ -1910,4 +1918,4 @@ declare namespace braintrust {
1910
1918
  * @module braintrust
1911
1919
  */
1912
1920
 
1913
- export { type AnyDataset, type BackgroundLoggerOpts, BaseExperiment, type BaseMetadata, BraintrustState, BraintrustStream, type BraintrustStreamChunk, type ChatPrompt, CodeFunction, CodePrompt, type CompiledPrompt, type CompiledPromptParams, type CompletionPrompt, type CreateProjectOpts, type DataSummary, Dataset, type DatasetSummary, type DefaultMetadataType, type DefaultPromptArgs, type EndSpanArgs, Eval, type EvalCase, type EvalResult, type EvalScorer, type EvalScorerArgs, type EvalTask, type Evaluator, type EvaluatorDef, type EvaluatorFile, Experiment, type ExperimentSummary, type Exportable, FailedHTTPResponse, type FullInitOptions, type FullLoginOptions, type InitOptions, type InvokeFunctionArgs, type InvokeReturn, LEGACY_CACHED_HEADER, LazyValue, type LogOptions, Logger, type LoginOptions, type MetricSummary, NOOP_SPAN, NoopSpan, type ObjectMetadata, Project, type PromiseUnless, Prompt, PromptBuilder, type PromptOpts, type PromptRowWithId, ReadonlyExperiment, Reporter, type ReporterBody, type ScoreSummary, type SerializedBraintrustState, type SetCurrentArg, type Span, type SpanContext, SpanImpl, type StartSpanArgs, ToolBuilder, type ToolFunctionDefinition, type ToolOpts, type WithTransactionId, X_CACHED_HEADER, _internalGetGlobalState, _internalSetInitialState, braintrustStreamChunkSchema, buildLocalSummary, createFinalValuePassThroughStream, currentExperiment, currentLogger, currentSpan, braintrust as default, devNullWritableStream, flush, getSpanParentObject, init, initDataset, initExperiment, initLogger, invoke, loadPrompt, log, logError, login, loginToState, newId, parseCachedHeader, projects, renderMessage, reportFailures, setFetch, spanComponentsToObjectId, startSpan, summarize, toolFunctionDefinitionSchema, traceable, traced, updateSpan, withCurrent, withDataset, withExperiment, withLogger, wrapAISDKModel, wrapOpenAI, wrapOpenAIv4, wrapTraced };
1921
+ export { type AnyDataset, type BackgroundLoggerOpts, BaseExperiment, type BaseMetadata, BraintrustState, BraintrustStream, type BraintrustStreamChunk, type ChatPrompt, CodeFunction, CodePrompt, type CompiledPrompt, type CompiledPromptParams, type CompletionPrompt, type CreateProjectOpts, type DataSummary, Dataset, type DatasetSummary, type DefaultMetadataType, type DefaultPromptArgs, type EndSpanArgs, Eval, type EvalCase, type EvalResult, type EvalScorer, type EvalScorerArgs, type EvalTask, type Evaluator, type EvaluatorDef, type EvaluatorFile, Experiment, type ExperimentSummary, type Exportable, FailedHTTPResponse, type FullInitOptions, type FullLoginOptions, type InitOptions, type InvokeFunctionArgs, type InvokeReturn, LEGACY_CACHED_HEADER, LazyValue, type LogOptions, Logger, type LoginOptions, type MetricSummary, NOOP_SPAN, NoopSpan, type ObjectMetadata, Project, type PromiseUnless, Prompt, PromptBuilder, type PromptOpts, type PromptRowWithId, ReadonlyExperiment, Reporter, type ReporterBody, type ScoreSummary, type SerializedBraintrustState, type SetCurrentArg, type Span, type SpanContext, SpanImpl, type StartSpanArgs, ToolBuilder, type ToolFunctionDefinition, type ToolOpts, type WithTransactionId, X_CACHED_HEADER, _internalGetGlobalState, _internalSetInitialState, braintrustStreamChunkSchema, buildLocalSummary, createFinalValuePassThroughStream, currentExperiment, currentLogger, currentSpan, braintrust as default, devNullWritableStream, flush, getSpanParentObject, init, initDataset, initExperiment, initLogger, invoke, loadPrompt, log, logError, login, loginToState, newId, parseCachedHeader, permalink, projects, renderMessage, reportFailures, setFetch, spanComponentsToObjectId, startSpan, summarize, toolFunctionDefinitionSchema, traceable, traced, updateSpan, withCurrent, withDataset, withExperiment, withLogger, wrapAISDKModel, wrapOpenAI, wrapOpenAIv4, wrapTraced };
package/dist/index.js CHANGED
@@ -76,6 +76,7 @@ __export(src_exports, {
76
76
  loginToState: () => loginToState,
77
77
  newId: () => newId,
78
78
  parseCachedHeader: () => parseCachedHeader,
79
+ permalink: () => permalink,
79
80
  projects: () => projects,
80
81
  renderMessage: () => renderMessage,
81
82
  reportFailures: () => reportFailures,
@@ -1152,6 +1153,44 @@ async function spanComponentsToObjectId({
1152
1153
  components
1153
1154
  )();
1154
1155
  }
1156
+ async function permalink(slug, opts) {
1157
+ const state = opts?.state ?? _globalState;
1158
+ const getOrgName = async () => {
1159
+ if (opts?.orgName) {
1160
+ return opts.orgName;
1161
+ }
1162
+ await state.login({});
1163
+ if (!state.orgName) {
1164
+ throw new Error(
1165
+ "Must either provide orgName explicitly or be logged in to a specific org"
1166
+ );
1167
+ }
1168
+ return state.orgName;
1169
+ };
1170
+ const getAppUrl = async () => {
1171
+ if (opts?.appUrl) {
1172
+ return opts.appUrl;
1173
+ }
1174
+ await state.login({});
1175
+ if (!state.appUrl) {
1176
+ throw new Error("Must either provide appUrl explicitly or be logged in");
1177
+ }
1178
+ return state.appUrl;
1179
+ };
1180
+ const components = import_core.SpanComponentsV3.fromStr(slug);
1181
+ const object_type = (0, import_core.spanObjectTypeV3ToString)(components.data.object_type);
1182
+ const [orgName, appUrl, object_id] = await Promise.all([
1183
+ getOrgName(),
1184
+ getAppUrl(),
1185
+ spanComponentsToObjectId({ components, state })
1186
+ ]);
1187
+ const id = components.data.row_id;
1188
+ if (!id) {
1189
+ throw new Error("Span slug does not refer to an individual row");
1190
+ }
1191
+ const urlParams = new URLSearchParams({ object_type, object_id, id });
1192
+ return `${appUrl}/app/${orgName}/object?${urlParams}`;
1193
+ }
1155
1194
  function startSpanParentArgs(args) {
1156
1195
  let argParentObjectId = void 0;
1157
1196
  let argParentSpanIds = void 0;
@@ -1932,6 +1971,7 @@ function initDataset(projectOrOptions, optionalOptions) {
1932
1971
  fetch,
1933
1972
  forceLogin,
1934
1973
  projectId,
1974
+ metadata,
1935
1975
  useOutput: legacy,
1936
1976
  state: stateArg
1937
1977
  } = options;
@@ -1950,7 +1990,8 @@ function initDataset(projectOrOptions, optionalOptions) {
1950
1990
  project_name: project,
1951
1991
  project_id: projectId,
1952
1992
  dataset_name: dataset,
1953
- description
1993
+ description,
1994
+ metadata
1954
1995
  };
1955
1996
  const response = await state.appConn().post_json("api/dataset/register", args);
1956
1997
  return {
@@ -3475,6 +3516,7 @@ __export(exports_node_exports, {
3475
3516
  loginToState: () => loginToState,
3476
3517
  newId: () => newId,
3477
3518
  parseCachedHeader: () => parseCachedHeader,
3519
+ permalink: () => permalink,
3478
3520
  projects: () => projects,
3479
3521
  renderMessage: () => renderMessage,
3480
3522
  reportFailures: () => reportFailures,
@@ -5995,6 +6037,7 @@ var src_default = exports_node_exports;
5995
6037
  loginToState,
5996
6038
  newId,
5997
6039
  parseCachedHeader,
6040
+ permalink,
5998
6041
  projects,
5999
6042
  renderMessage,
6000
6043
  reportFailures,
package/dist/index.mjs CHANGED
@@ -266,6 +266,7 @@ import {
266
266
  batchItems,
267
267
  SpanComponentsV3,
268
268
  SpanObjectTypeV3,
269
+ spanObjectTypeV3ToString,
269
270
  gitMetadataSettingsSchema,
270
271
  _urljoin
271
272
  } from "@braintrust/core";
@@ -1088,6 +1089,44 @@ async function spanComponentsToObjectId({
1088
1089
  components
1089
1090
  )();
1090
1091
  }
1092
+ async function permalink(slug, opts) {
1093
+ const state = opts?.state ?? _globalState;
1094
+ const getOrgName = async () => {
1095
+ if (opts?.orgName) {
1096
+ return opts.orgName;
1097
+ }
1098
+ await state.login({});
1099
+ if (!state.orgName) {
1100
+ throw new Error(
1101
+ "Must either provide orgName explicitly or be logged in to a specific org"
1102
+ );
1103
+ }
1104
+ return state.orgName;
1105
+ };
1106
+ const getAppUrl = async () => {
1107
+ if (opts?.appUrl) {
1108
+ return opts.appUrl;
1109
+ }
1110
+ await state.login({});
1111
+ if (!state.appUrl) {
1112
+ throw new Error("Must either provide appUrl explicitly or be logged in");
1113
+ }
1114
+ return state.appUrl;
1115
+ };
1116
+ const components = SpanComponentsV3.fromStr(slug);
1117
+ const object_type = spanObjectTypeV3ToString(components.data.object_type);
1118
+ const [orgName, appUrl, object_id] = await Promise.all([
1119
+ getOrgName(),
1120
+ getAppUrl(),
1121
+ spanComponentsToObjectId({ components, state })
1122
+ ]);
1123
+ const id = components.data.row_id;
1124
+ if (!id) {
1125
+ throw new Error("Span slug does not refer to an individual row");
1126
+ }
1127
+ const urlParams = new URLSearchParams({ object_type, object_id, id });
1128
+ return `${appUrl}/app/${orgName}/object?${urlParams}`;
1129
+ }
1091
1130
  function startSpanParentArgs(args) {
1092
1131
  let argParentObjectId = void 0;
1093
1132
  let argParentSpanIds = void 0;
@@ -1868,6 +1907,7 @@ function initDataset(projectOrOptions, optionalOptions) {
1868
1907
  fetch,
1869
1908
  forceLogin,
1870
1909
  projectId,
1910
+ metadata,
1871
1911
  useOutput: legacy,
1872
1912
  state: stateArg
1873
1913
  } = options;
@@ -1886,7 +1926,8 @@ function initDataset(projectOrOptions, optionalOptions) {
1886
1926
  project_name: project,
1887
1927
  project_id: projectId,
1888
1928
  dataset_name: dataset,
1889
- description
1929
+ description,
1930
+ metadata
1890
1931
  };
1891
1932
  const response = await state.appConn().post_json("api/dataset/register", args);
1892
1933
  return {
@@ -3411,6 +3452,7 @@ __export(exports_node_exports, {
3411
3452
  loginToState: () => loginToState,
3412
3453
  newId: () => newId,
3413
3454
  parseCachedHeader: () => parseCachedHeader,
3455
+ permalink: () => permalink,
3414
3456
  projects: () => projects,
3415
3457
  renderMessage: () => renderMessage,
3416
3458
  reportFailures: () => reportFailures,
@@ -5933,6 +5975,7 @@ export {
5933
5975
  loginToState,
5934
5976
  newId,
5935
5977
  parseCachedHeader,
5978
+ permalink,
5936
5979
  projects,
5937
5980
  renderMessage,
5938
5981
  reportFailures,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "braintrust",
3
- "version": "0.0.163",
3
+ "version": "0.0.165",
4
4
  "description": "SDK for integrating Braintrust",
5
5
  "repository": {
6
6
  "type": "git",
@@ -70,7 +70,7 @@
70
70
  },
71
71
  "dependencies": {
72
72
  "@ai-sdk/provider": "^0.0.11",
73
- "@braintrust/core": "0.0.59",
73
+ "@braintrust/core": "0.0.61",
74
74
  "@next/env": "^14.2.3",
75
75
  "@vercel/functions": "^1.0.2",
76
76
  "ai": "^3.2.16",