Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/soft-eagles-protect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"braintrust": patch
---

Do not collect git metadata when org-level metadata settings are absent.
2 changes: 1 addition & 1 deletion js/src/framework.ts
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ export interface Evaluator<
baseExperimentId?: string;

/**
* Optional settings for collecting git metadata. By default, will collect all git metadata fields allowed in org-level settings.
* Optional settings for collecting git metadata. By default, will collect git metadata fields allowed in org-level settings. If org settings are absent, git metadata is not collected.
*/
gitMetadataSettings?: GitMetadataSettings;

Expand Down
4 changes: 2 additions & 2 deletions js/src/gitutil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,12 @@ function truncateToByteLimit(s: string, byteLimit: number = 65536): string {
}

export async function getRepoInfo(settings?: GitMetadataSettings) {
if (settings && settings.collect === "none") {
if (!settings || settings.collect === "none") {
return undefined;
}

const repo = await repoInfo();
if (!repo || !settings || settings.collect === "all") {
if (!repo || settings.collect === "all") {
return repo;
}

Expand Down
8 changes: 3 additions & 5 deletions js/src/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3545,7 +3545,7 @@ type InitializedExperiment<IsOpen extends boolean | undefined> =
* @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.
* @param options.orgName (Optional) The name of a specific organization to connect to. This is useful if you belong to multiple.
* @param options.metadata (Optional) A dictionary with additional data about the test example, model outputs, or just about anything else that's relevant, that you can use to help find and analyze examples later. For example, you could log the `prompt`, example's `id`, or anything else that would be useful to slice/dice later. The values in `metadata` can be any JSON-serializable type, but its keys must be strings.
* @param options.gitMetadataSettings (Optional) Settings for collecting git metadata. By default, will collect all git metadata fields allowed in org-level settings.
* @param options.gitMetadataSettings (Optional) Settings for collecting git metadata. By default, will collect git metadata fields allowed in org-level settings. If org settings are absent, git metadata is not collected.
* @param setCurrent If true (the default), set the global current-experiment to the newly-created one.
* @param options.open If the experiment already exists, open it in read-only mode. Throws an error if the experiment does not already exist.
* @param options.projectId The id of the project to create the experiment in. This takes precedence over `project` if specified.
Expand Down Expand Up @@ -3699,9 +3699,7 @@ export function init<IsOpen extends boolean = false>(
return repoInfo;
}
let mergedGitMetadataSettings = {
...(state.gitMetadataSettings || {
collect: "all",
}),
...(state.gitMetadataSettings || { collect: "none" as const }),
};
if (gitMetadataSettings) {
mergedGitMetadataSettings = mergeGitMetadataSettings(
Expand Down Expand Up @@ -5709,7 +5707,7 @@ function _saveOrgInfo(
state.orgName = org.name;
state.apiUrl = iso.getEnv("BRAINTRUST_API_URL") ?? org.api_url;
state.proxyUrl = iso.getEnv("BRAINTRUST_PROXY_URL") ?? org.proxy_url;
state.gitMetadataSettings = org.git_metadata || undefined;
state.gitMetadataSettings = org.git_metadata || { collect: "none" };
break;
}
}
Expand Down
Loading