braintrust 0.0.164 → 0.0.166

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.
@@ -1,5 +1,5 @@
1
- import { GitMetadataSettings, LogFeedbackFullArgs, ExperimentEvent, BackgroundLogEvent, ExperimentLogFullArgs, ExperimentLogPartialArgs, IdField, SpanType, SpanComponentsV3, RepoInfo, DEFAULT_IS_LEGACY_DATASET, TRANSACTION_ID_FIELD, TransactionId, SpanObjectTypeV3, DatasetRecord } from '@braintrust/core';
2
- import { PromptData, OpenAIMessage, Tools, AnyModelParam, Message, Prompt as Prompt$1, PromptSessionEvent, StreamingMode } from '@braintrust/core/typespecs';
1
+ import { LogFeedbackFullArgs, ExperimentEvent, BackgroundLogEvent, ExperimentLogFullArgs, ExperimentLogPartialArgs, IdField, SpanType, SpanComponentsV3, DEFAULT_IS_LEGACY_DATASET, TRANSACTION_ID_FIELD, TransactionId, SpanObjectTypeV3, DatasetRecord } from '@braintrust/core';
2
+ import { GitMetadataSettings, RepoInfo, PromptData, OpenAIMessage, Tools, AnyModelParam, Message, Prompt as Prompt$1, PromptSessionEvent, StreamingMode } from '@braintrust/core/typespecs';
3
3
  import { z } from 'zod';
4
4
 
5
5
  interface IsoAsyncLocalStorage<T> {
@@ -463,6 +463,7 @@ type InitDatasetOptions<IsLegacyDataset extends boolean> = FullLoginOptions & {
463
463
  description?: string;
464
464
  version?: string;
465
465
  projectId?: string;
466
+ metadata?: Record<string, unknown>;
466
467
  state?: BraintrustState;
467
468
  } & UseOutputOption<IsLegacyDataset>;
468
469
  type FullInitDatasetOptions<IsLegacyDataset extends boolean> = {
@@ -479,6 +480,7 @@ type FullInitDatasetOptions<IsLegacyDataset extends boolean> = {
479
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.
480
481
  * @param options.orgName (Optional) The name of a specific organization to connect to. This is useful if you belong to multiple.
481
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.
482
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.
483
485
  * @returns The newly created Dataset.
484
486
  */
package/dist/browser.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { GitMetadataSettings, LogFeedbackFullArgs, ExperimentEvent, BackgroundLogEvent, ExperimentLogFullArgs, ExperimentLogPartialArgs, IdField, SpanType, SpanComponentsV3, RepoInfo, DEFAULT_IS_LEGACY_DATASET, TRANSACTION_ID_FIELD, TransactionId, SpanObjectTypeV3, DatasetRecord } from '@braintrust/core';
2
- import { PromptData, OpenAIMessage, Tools, AnyModelParam, Message, Prompt as Prompt$1, PromptSessionEvent, StreamingMode } from '@braintrust/core/typespecs';
1
+ import { LogFeedbackFullArgs, ExperimentEvent, BackgroundLogEvent, ExperimentLogFullArgs, ExperimentLogPartialArgs, IdField, SpanType, SpanComponentsV3, DEFAULT_IS_LEGACY_DATASET, TRANSACTION_ID_FIELD, TransactionId, SpanObjectTypeV3, DatasetRecord } from '@braintrust/core';
2
+ import { GitMetadataSettings, RepoInfo, PromptData, OpenAIMessage, Tools, AnyModelParam, Message, Prompt as Prompt$1, PromptSessionEvent, StreamingMode } from '@braintrust/core/typespecs';
3
3
  import { z } from 'zod';
4
4
 
5
5
  interface IsoAsyncLocalStorage<T> {
@@ -463,6 +463,7 @@ type InitDatasetOptions<IsLegacyDataset extends boolean> = FullLoginOptions & {
463
463
  description?: string;
464
464
  version?: string;
465
465
  projectId?: string;
466
+ metadata?: Record<string, unknown>;
466
467
  state?: BraintrustState;
467
468
  } & UseOutputOption<IsLegacyDataset>;
468
469
  type FullInitDatasetOptions<IsLegacyDataset extends boolean> = {
@@ -479,6 +480,7 @@ type FullInitDatasetOptions<IsLegacyDataset extends boolean> = {
479
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.
480
481
  * @param options.orgName (Optional) The name of a specific organization to connect to. This is useful if you belong to multiple.
481
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.
482
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.
483
485
  * @returns The newly created Dataset.
484
486
  */
package/dist/browser.js CHANGED
@@ -463,7 +463,7 @@ var loginSchema = import_zod2.z.strictObject({
463
463
  proxyUrl: import_zod2.z.string(),
464
464
  loginToken: import_zod2.z.string(),
465
465
  orgId: import_zod2.z.string().nullish(),
466
- gitMetadataSettings: import_core.gitMetadataSettingsSchema.nullish()
466
+ gitMetadataSettings: import_typespecs2.gitMetadataSettingsSchema.nullish()
467
467
  });
468
468
  var stateNonce = 0;
469
469
  var BraintrustState = class _BraintrustState {
@@ -1738,6 +1738,7 @@ function initDataset(projectOrOptions, optionalOptions) {
1738
1738
  fetch,
1739
1739
  forceLogin,
1740
1740
  projectId,
1741
+ metadata,
1741
1742
  useOutput: legacy,
1742
1743
  state: stateArg
1743
1744
  } = options;
@@ -1756,7 +1757,8 @@ function initDataset(projectOrOptions, optionalOptions) {
1756
1757
  project_name: project,
1757
1758
  project_id: projectId,
1758
1759
  dataset_name: dataset,
1759
- description
1760
+ description,
1761
+ metadata
1760
1762
  };
1761
1763
  const response = await state.appConn().post_json("api/dataset/register", args);
1762
1764
  return {
package/dist/browser.mjs CHANGED
@@ -48,14 +48,14 @@ import {
48
48
  SpanComponentsV3,
49
49
  SpanObjectTypeV3,
50
50
  spanObjectTypeV3ToString,
51
- gitMetadataSettingsSchema,
52
51
  _urljoin
53
52
  } from "@braintrust/core";
54
53
  import {
55
54
  BRAINTRUST_PARAMS,
56
55
  promptDataSchema,
57
56
  promptSchema,
58
- toolsSchema
57
+ toolsSchema,
58
+ gitMetadataSettingsSchema
59
59
  } from "@braintrust/core/typespecs";
60
60
 
61
61
  // src/util.ts
@@ -1688,6 +1688,7 @@ function initDataset(projectOrOptions, optionalOptions) {
1688
1688
  fetch,
1689
1689
  forceLogin,
1690
1690
  projectId,
1691
+ metadata,
1691
1692
  useOutput: legacy,
1692
1693
  state: stateArg
1693
1694
  } = options;
@@ -1706,7 +1707,8 @@ function initDataset(projectOrOptions, optionalOptions) {
1706
1707
  project_name: project,
1707
1708
  project_id: projectId,
1708
1709
  dataset_name: dataset,
1709
- description
1710
+ description,
1711
+ metadata
1710
1712
  };
1711
1713
  const response = await state.appConn().post_json("api/dataset/register", args);
1712
1714
  return {
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.164",
1239
+ version: "0.0.166",
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.60",
1309
+ "@braintrust/core": "0.0.62",
1310
1310
  "@next/env": "^14.2.3",
1311
1311
  "@vercel/functions": "^1.0.2",
1312
1312
  ai: "^3.2.16",
@@ -1731,7 +1731,7 @@ var loginSchema = import_zod2.z.strictObject({
1731
1731
  proxyUrl: import_zod2.z.string(),
1732
1732
  loginToken: import_zod2.z.string(),
1733
1733
  orgId: import_zod2.z.string().nullish(),
1734
- gitMetadataSettings: import_core.gitMetadataSettingsSchema.nullish()
1734
+ gitMetadataSettings: import_typespecs2.gitMetadataSettingsSchema.nullish()
1735
1735
  });
1736
1736
  var stateNonce = 0;
1737
1737
  var BraintrustState = class _BraintrustState {
package/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
- import { GitMetadataSettings, LogFeedbackFullArgs, ExperimentEvent, BackgroundLogEvent, ExperimentLogFullArgs, ExperimentLogPartialArgs, IdField, SpanType, SpanComponentsV3, RepoInfo, DEFAULT_IS_LEGACY_DATASET, TRANSACTION_ID_FIELD, TransactionId, SpanObjectTypeV3, DatasetRecord, Score, CommentEvent, InputField, InputsField, LogCommentFullArgs, OtherExperimentLogFields, ParentExperimentIds, ParentProjectLogIds } from '@braintrust/core';
1
+ import { LogFeedbackFullArgs, ExperimentEvent, BackgroundLogEvent, ExperimentLogFullArgs, ExperimentLogPartialArgs, IdField, SpanType, SpanComponentsV3, DEFAULT_IS_LEGACY_DATASET, TRANSACTION_ID_FIELD, TransactionId, SpanObjectTypeV3, DatasetRecord, Score, CommentEvent, InputField, InputsField, LogCommentFullArgs, OtherExperimentLogFields, ParentExperimentIds, ParentProjectLogIds } from '@braintrust/core';
2
2
  export { CommentEvent, DatasetRecord, ExperimentLogFullArgs, ExperimentLogPartialArgs, IdField, InputField, InputsField, LogCommentFullArgs, LogFeedbackFullArgs, OtherExperimentLogFields, ParentExperimentIds, ParentProjectLogIds } from '@braintrust/core';
3
- import { PromptData, OpenAIMessage, Tools, AnyModelParam, Message, Prompt as Prompt$1, PromptSessionEvent, StreamingMode, FunctionType, IfExists, SavedFunctionId, ModelParams } from '@braintrust/core/typespecs';
3
+ import { GitMetadataSettings, RepoInfo, PromptData, OpenAIMessage, Tools, AnyModelParam, Message, Prompt as Prompt$1, PromptSessionEvent, StreamingMode, FunctionType, IfExists, SavedFunctionId, ModelParams } from '@braintrust/core/typespecs';
4
4
  import { z } from 'zod';
5
5
 
6
6
  interface IsoAsyncLocalStorage<T> {
@@ -464,6 +464,7 @@ type InitDatasetOptions<IsLegacyDataset extends boolean> = FullLoginOptions & {
464
464
  description?: string;
465
465
  version?: string;
466
466
  projectId?: string;
467
+ metadata?: Record<string, unknown>;
467
468
  state?: BraintrustState;
468
469
  } & UseOutputOption<IsLegacyDataset>;
469
470
  type FullInitDatasetOptions<IsLegacyDataset extends boolean> = {
@@ -480,6 +481,7 @@ type FullInitDatasetOptions<IsLegacyDataset extends boolean> = {
480
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.
481
482
  * @param options.orgName (Optional) The name of a specific organization to connect to. This is useful if you belong to multiple.
482
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.
483
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.
484
486
  * @returns The newly created Dataset.
485
487
  */
@@ -1604,6 +1606,14 @@ interface Evaluator<Input, Output, Expected, Metadata extends BaseMetadata = Def
1604
1606
  * and compared to this experiment. This takes precedence over `baseExperimentName` if specified.
1605
1607
  */
1606
1608
  baseExperimentId?: string;
1609
+ /**
1610
+ * Optional settings for collecting git metadata. By default, will collect all git metadata fields allowed in org-level settings.
1611
+ */
1612
+ gitMetadataSettings?: GitMetadataSettings;
1613
+ /**
1614
+ * Optionally explicitly specify the git metadata for this experiment. This takes precedence over `gitMetadataSettings` if specified.
1615
+ */
1616
+ repoInfo?: RepoInfo;
1607
1617
  }
1608
1618
  declare class EvalResultWithSummary<Input, Output, Expected, Metadata extends BaseMetadata = DefaultMetadataType> {
1609
1619
  summary: ExperimentSummary;
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { GitMetadataSettings, LogFeedbackFullArgs, ExperimentEvent, BackgroundLogEvent, ExperimentLogFullArgs, ExperimentLogPartialArgs, IdField, SpanType, SpanComponentsV3, RepoInfo, DEFAULT_IS_LEGACY_DATASET, TRANSACTION_ID_FIELD, TransactionId, SpanObjectTypeV3, DatasetRecord, Score, CommentEvent, InputField, InputsField, LogCommentFullArgs, OtherExperimentLogFields, ParentExperimentIds, ParentProjectLogIds } from '@braintrust/core';
1
+ import { LogFeedbackFullArgs, ExperimentEvent, BackgroundLogEvent, ExperimentLogFullArgs, ExperimentLogPartialArgs, IdField, SpanType, SpanComponentsV3, DEFAULT_IS_LEGACY_DATASET, TRANSACTION_ID_FIELD, TransactionId, SpanObjectTypeV3, DatasetRecord, Score, CommentEvent, InputField, InputsField, LogCommentFullArgs, OtherExperimentLogFields, ParentExperimentIds, ParentProjectLogIds } from '@braintrust/core';
2
2
  export { CommentEvent, DatasetRecord, ExperimentLogFullArgs, ExperimentLogPartialArgs, IdField, InputField, InputsField, LogCommentFullArgs, LogFeedbackFullArgs, OtherExperimentLogFields, ParentExperimentIds, ParentProjectLogIds } from '@braintrust/core';
3
- import { PromptData, OpenAIMessage, Tools, AnyModelParam, Message, Prompt as Prompt$1, PromptSessionEvent, StreamingMode, FunctionType, IfExists, SavedFunctionId, ModelParams } from '@braintrust/core/typespecs';
3
+ import { GitMetadataSettings, RepoInfo, PromptData, OpenAIMessage, Tools, AnyModelParam, Message, Prompt as Prompt$1, PromptSessionEvent, StreamingMode, FunctionType, IfExists, SavedFunctionId, ModelParams } from '@braintrust/core/typespecs';
4
4
  import { z } from 'zod';
5
5
 
6
6
  interface IsoAsyncLocalStorage<T> {
@@ -464,6 +464,7 @@ type InitDatasetOptions<IsLegacyDataset extends boolean> = FullLoginOptions & {
464
464
  description?: string;
465
465
  version?: string;
466
466
  projectId?: string;
467
+ metadata?: Record<string, unknown>;
467
468
  state?: BraintrustState;
468
469
  } & UseOutputOption<IsLegacyDataset>;
469
470
  type FullInitDatasetOptions<IsLegacyDataset extends boolean> = {
@@ -480,6 +481,7 @@ type FullInitDatasetOptions<IsLegacyDataset extends boolean> = {
480
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.
481
482
  * @param options.orgName (Optional) The name of a specific organization to connect to. This is useful if you belong to multiple.
482
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.
483
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.
484
486
  * @returns The newly created Dataset.
485
487
  */
@@ -1604,6 +1606,14 @@ interface Evaluator<Input, Output, Expected, Metadata extends BaseMetadata = Def
1604
1606
  * and compared to this experiment. This takes precedence over `baseExperimentName` if specified.
1605
1607
  */
1606
1608
  baseExperimentId?: string;
1609
+ /**
1610
+ * Optional settings for collecting git metadata. By default, will collect all git metadata fields allowed in org-level settings.
1611
+ */
1612
+ gitMetadataSettings?: GitMetadataSettings;
1613
+ /**
1614
+ * Optionally explicitly specify the git metadata for this experiment. This takes precedence over `gitMetadataSettings` if specified.
1615
+ */
1616
+ repoInfo?: RepoInfo;
1607
1617
  }
1608
1618
  declare class EvalResultWithSummary<Input, Output, Expected, Metadata extends BaseMetadata = DefaultMetadataType> {
1609
1619
  summary: ExperimentSummary;
package/dist/index.js CHANGED
@@ -696,7 +696,7 @@ var loginSchema = import_zod2.z.strictObject({
696
696
  proxyUrl: import_zod2.z.string(),
697
697
  loginToken: import_zod2.z.string(),
698
698
  orgId: import_zod2.z.string().nullish(),
699
- gitMetadataSettings: import_core.gitMetadataSettingsSchema.nullish()
699
+ gitMetadataSettings: import_typespecs2.gitMetadataSettingsSchema.nullish()
700
700
  });
701
701
  var stateNonce = 0;
702
702
  var BraintrustState = class _BraintrustState {
@@ -1971,6 +1971,7 @@ function initDataset(projectOrOptions, optionalOptions) {
1971
1971
  fetch,
1972
1972
  forceLogin,
1973
1973
  projectId,
1974
+ metadata,
1974
1975
  useOutput: legacy,
1975
1976
  state: stateArg
1976
1977
  } = options;
@@ -1989,7 +1990,8 @@ function initDataset(projectOrOptions, optionalOptions) {
1989
1990
  project_name: project,
1990
1991
  project_id: projectId,
1991
1992
  dataset_name: dataset,
1992
- description
1993
+ description,
1994
+ metadata
1993
1995
  };
1994
1996
  const response = await state.appConn().post_json("api/dataset/register", args);
1995
1997
  return {
@@ -4847,7 +4849,9 @@ async function Eval(name, evaluator, reporterOrOpts) {
4847
4849
  isPublic: evaluator.isPublic,
4848
4850
  update: evaluator.update,
4849
4851
  baseExperiment: evaluator.baseExperimentName ?? defaultBaseExperiment,
4850
- baseExperimentId: evaluator.baseExperimentId
4852
+ baseExperimentId: evaluator.baseExperimentId,
4853
+ gitMetadataSettings: evaluator.gitMetadataSettings,
4854
+ repoInfo: evaluator.repoInfo
4851
4855
  });
4852
4856
  if (options.onStart) {
4853
4857
  experiment.summarize({ summarizeScores: false }).then(options.onStart);
package/dist/index.mjs CHANGED
@@ -267,14 +267,14 @@ import {
267
267
  SpanComponentsV3,
268
268
  SpanObjectTypeV3,
269
269
  spanObjectTypeV3ToString,
270
- gitMetadataSettingsSchema,
271
270
  _urljoin
272
271
  } from "@braintrust/core";
273
272
  import {
274
273
  BRAINTRUST_PARAMS,
275
274
  promptDataSchema,
276
275
  promptSchema,
277
- toolsSchema
276
+ toolsSchema,
277
+ gitMetadataSettingsSchema
278
278
  } from "@braintrust/core/typespecs";
279
279
 
280
280
  // src/util.ts
@@ -1907,6 +1907,7 @@ function initDataset(projectOrOptions, optionalOptions) {
1907
1907
  fetch,
1908
1908
  forceLogin,
1909
1909
  projectId,
1910
+ metadata,
1910
1911
  useOutput: legacy,
1911
1912
  state: stateArg
1912
1913
  } = options;
@@ -1925,7 +1926,8 @@ function initDataset(projectOrOptions, optionalOptions) {
1925
1926
  project_name: project,
1926
1927
  project_id: projectId,
1927
1928
  dataset_name: dataset,
1928
- description
1929
+ description,
1930
+ metadata
1929
1931
  };
1930
1932
  const response = await state.appConn().post_json("api/dataset/register", args);
1931
1933
  return {
@@ -4785,7 +4787,9 @@ async function Eval(name, evaluator, reporterOrOpts) {
4785
4787
  isPublic: evaluator.isPublic,
4786
4788
  update: evaluator.update,
4787
4789
  baseExperiment: evaluator.baseExperimentName ?? defaultBaseExperiment,
4788
- baseExperimentId: evaluator.baseExperimentId
4790
+ baseExperimentId: evaluator.baseExperimentId,
4791
+ gitMetadataSettings: evaluator.gitMetadataSettings,
4792
+ repoInfo: evaluator.repoInfo
4789
4793
  });
4790
4794
  if (options.onStart) {
4791
4795
  experiment.summarize({ summarizeScores: false }).then(options.onStart);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "braintrust",
3
- "version": "0.0.164",
3
+ "version": "0.0.166",
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.60",
73
+ "@braintrust/core": "0.0.62",
74
74
  "@next/env": "^14.2.3",
75
75
  "@vercel/functions": "^1.0.2",
76
76
  "ai": "^3.2.16",