braintrust 0.0.3 → 0.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +32 -0
- package/dist/cache.d.ts +3 -0
- package/dist/cache.js +31 -0
- package/dist/gitutil.d.ts +25 -0
- package/dist/gitutil.js +136 -0
- package/dist/index.d.ts +27 -34
- package/dist/index.js +135 -120
- package/dist/oai.d.ts +3 -0
- package/dist/oai.js +102 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/docs/interfaces/_meta.json +4 -0
- package/package.json +7 -3
- package/typedoc.json +18 -0
- package/docs/.nojekyll +0 -1
- package/docs/assets/highlight.css +0 -57
- package/docs/assets/main.js +0 -58
- package/docs/assets/search.js +0 -1
- package/docs/assets/style.css +0 -1367
- package/docs/classes/Experiment.html +0 -250
- package/docs/classes/HTTPConnection.html +0 -191
- package/docs/functions/init.html +0 -67
- package/docs/functions/initProject.html +0 -58
- package/docs/functions/log.html +0 -73
- package/docs/functions/login.html +0 -63
- package/docs/functions/summarize.html +0 -63
- package/docs/index.html +0 -111
- package/docs/interfaces/Project.html +0 -87
- package/docs/modules.html +0 -63
package/README.md
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
A Node.js library for logging data to BrainTrust.
|
|
2
|
+
|
|
3
|
+
### Quickstart
|
|
4
|
+
|
|
5
|
+
Install the library with npm (or yarn).
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install braintrust
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Then, run a simple experiment with the following code (replace `YOUR_API_KEY` with
|
|
12
|
+
your BrainTrust API key):
|
|
13
|
+
|
|
14
|
+
```javascript
|
|
15
|
+
const braintrust = require("braintrust");
|
|
16
|
+
|
|
17
|
+
const experiment = await braintrust.init("NodeTest", {
|
|
18
|
+
api_key: "YOUR_API_KEY",
|
|
19
|
+
});
|
|
20
|
+
experiment.log({
|
|
21
|
+
inputs: { test: 1 },
|
|
22
|
+
output: "foo",
|
|
23
|
+
expected: "bar",
|
|
24
|
+
scores: {
|
|
25
|
+
n: 0.5,
|
|
26
|
+
},
|
|
27
|
+
metadata: {
|
|
28
|
+
id: 1,
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
console.log(await experiment.summarize());
|
|
32
|
+
```
|
package/dist/cache.d.ts
ADDED
package/dist/cache.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.LOGIN_INFO_PATH = exports.EXPERIMENTS_PATH = exports.CACHE_PATH = void 0;
|
|
27
|
+
const os = __importStar(require("os"));
|
|
28
|
+
const path = __importStar(require("path"));
|
|
29
|
+
exports.CACHE_PATH = path.join(os.homedir(), ".cache", "braintrust");
|
|
30
|
+
exports.EXPERIMENTS_PATH = path.join(exports.CACHE_PATH, "experiments");
|
|
31
|
+
exports.LOGIN_INFO_PATH = path.join(exports.CACHE_PATH, "api_info.json");
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Information about the current HEAD of the repo.
|
|
3
|
+
*/
|
|
4
|
+
export interface RepoStatus {
|
|
5
|
+
commit?: string;
|
|
6
|
+
branch?: string;
|
|
7
|
+
tag?: string;
|
|
8
|
+
dirty: boolean;
|
|
9
|
+
author_name?: string;
|
|
10
|
+
author_email?: string;
|
|
11
|
+
commit_message?: string;
|
|
12
|
+
commit_time?: string;
|
|
13
|
+
}
|
|
14
|
+
export declare function currentRepo(): Promise<import("simple-git").SimpleGit | null>;
|
|
15
|
+
export declare function getPastNAncestors(n?: number, remote?: string | undefined): Promise<string[]>;
|
|
16
|
+
export declare function getRepoStatus(): Promise<{
|
|
17
|
+
commit: string | undefined;
|
|
18
|
+
branch: string | undefined;
|
|
19
|
+
tag: string | undefined;
|
|
20
|
+
dirty: boolean;
|
|
21
|
+
author_name: string | undefined;
|
|
22
|
+
author_email: string | undefined;
|
|
23
|
+
commit_message: string | undefined;
|
|
24
|
+
commit_time: string | undefined;
|
|
25
|
+
} | undefined>;
|
package/dist/gitutil.js
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.getRepoStatus = exports.getPastNAncestors = exports.currentRepo = void 0;
|
|
13
|
+
const simple_git_1 = require("simple-git");
|
|
14
|
+
function currentRepo() {
|
|
15
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
16
|
+
const git = (0, simple_git_1.simpleGit)();
|
|
17
|
+
if (yield git.checkIsRepo()) {
|
|
18
|
+
return git;
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
exports.currentRepo = currentRepo;
|
|
26
|
+
let _baseBranch = null;
|
|
27
|
+
function getBaseBranch(remote = undefined) {
|
|
28
|
+
var _a;
|
|
29
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
30
|
+
if (_baseBranch === null) {
|
|
31
|
+
const git = yield currentRepo();
|
|
32
|
+
if (git === null) {
|
|
33
|
+
throw new Error("Not in a git repo");
|
|
34
|
+
}
|
|
35
|
+
const remoteName = remote !== null && remote !== void 0 ? remote : (_a = (yield git.getRemotes())[0]) === null || _a === void 0 ? void 0 : _a.name;
|
|
36
|
+
if (!remoteName) {
|
|
37
|
+
// TODO: We should fix this in the Python SDK too. If you have a repo with no remotes, it will
|
|
38
|
+
// fail with a cryptic error message.
|
|
39
|
+
throw new Error("No remote found");
|
|
40
|
+
}
|
|
41
|
+
const remoteInfo = yield git.remote(["show", remoteName]);
|
|
42
|
+
if (!remoteInfo) {
|
|
43
|
+
throw new Error(`Could not find remote ${remoteName}`);
|
|
44
|
+
}
|
|
45
|
+
const match = remoteInfo.match(/\s*HEAD branch:\s*(.*)$/m);
|
|
46
|
+
if (!match) {
|
|
47
|
+
throw new Error(`Could not find HEAD branch in remote ${remoteName}`);
|
|
48
|
+
}
|
|
49
|
+
_baseBranch = { remote: remoteName, branch: match[1] };
|
|
50
|
+
}
|
|
51
|
+
return _baseBranch;
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
function getBaseBranchAncestor(remote = undefined) {
|
|
55
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
56
|
+
const git = yield currentRepo();
|
|
57
|
+
if (git === null) {
|
|
58
|
+
throw new Error("Not in a git repo");
|
|
59
|
+
}
|
|
60
|
+
const { remote: remoteName, branch: baseBranch } = yield getBaseBranch(remote);
|
|
61
|
+
const isDirty = (yield git.diffSummary()).files.length > 0;
|
|
62
|
+
const head = isDirty ? "HEAD" : "HEAD^";
|
|
63
|
+
try {
|
|
64
|
+
const ancestor = yield git.raw([
|
|
65
|
+
"merge-base",
|
|
66
|
+
head,
|
|
67
|
+
`${remoteName}/${baseBranch}`,
|
|
68
|
+
]);
|
|
69
|
+
return ancestor.trim();
|
|
70
|
+
}
|
|
71
|
+
catch (e) {
|
|
72
|
+
console.warn(`Could not find a common ancestor with ${remoteName}/${baseBranch}`, e);
|
|
73
|
+
return undefined;
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
function getPastNAncestors(n = 10, remote = undefined) {
|
|
78
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
79
|
+
const git = yield currentRepo();
|
|
80
|
+
if (git === null) {
|
|
81
|
+
return [];
|
|
82
|
+
}
|
|
83
|
+
const ancestor = yield getBaseBranchAncestor(remote);
|
|
84
|
+
const commits = yield git.log({ from: ancestor, to: "HEAD" });
|
|
85
|
+
return commits.all.map((c) => c.hash);
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
exports.getPastNAncestors = getPastNAncestors;
|
|
89
|
+
function attempt(fn) {
|
|
90
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
91
|
+
try {
|
|
92
|
+
return yield fn();
|
|
93
|
+
}
|
|
94
|
+
catch (e) {
|
|
95
|
+
return undefined;
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
function getRepoStatus() {
|
|
100
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
101
|
+
const git = yield currentRepo();
|
|
102
|
+
if (git === null) {
|
|
103
|
+
return undefined;
|
|
104
|
+
}
|
|
105
|
+
let commit = undefined;
|
|
106
|
+
let commit_message = undefined;
|
|
107
|
+
let commit_time = undefined;
|
|
108
|
+
let author_name = undefined;
|
|
109
|
+
let author_email = undefined;
|
|
110
|
+
let tag = undefined;
|
|
111
|
+
let branch = undefined;
|
|
112
|
+
const dirty = (yield git.diffSummary()).files.length > 0;
|
|
113
|
+
if (!dirty) {
|
|
114
|
+
commit = yield attempt(() => __awaiter(this, void 0, void 0, function* () { return yield git.revparse(["HEAD"]); }));
|
|
115
|
+
commit_message = yield attempt(() => __awaiter(this, void 0, void 0, function* () { return (yield git.raw(["log", "-1", "--pretty=%B"])).trim(); }));
|
|
116
|
+
commit_time = yield attempt(() => __awaiter(this, void 0, void 0, function* () { return (yield git.raw(["log", "-1", "--pretty=%cI"])).trim(); }));
|
|
117
|
+
author_name = yield attempt(() => __awaiter(this, void 0, void 0, function* () { return (yield git.raw(["log", "-1", "--pretty=%aN"])).trim(); }));
|
|
118
|
+
author_email = yield attempt(() => __awaiter(this, void 0, void 0, function* () { return (yield git.raw(["log", "-1", "--pretty=%aE"])).trim(); }));
|
|
119
|
+
tag = yield attempt(() => __awaiter(this, void 0, void 0, function* () {
|
|
120
|
+
return (yield git.raw(["describe", "--tags", "--exact-match", "--always"])).trim();
|
|
121
|
+
}));
|
|
122
|
+
}
|
|
123
|
+
branch = yield attempt(() => __awaiter(this, void 0, void 0, function* () { return (yield git.raw(["rev-parse", "--abbrev-ref", "HEAD"])).trim(); }));
|
|
124
|
+
return {
|
|
125
|
+
commit,
|
|
126
|
+
branch,
|
|
127
|
+
tag,
|
|
128
|
+
dirty,
|
|
129
|
+
author_name,
|
|
130
|
+
author_email,
|
|
131
|
+
commit_message,
|
|
132
|
+
commit_time,
|
|
133
|
+
};
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
exports.getRepoStatus = getRepoStatus;
|
package/dist/index.d.ts
CHANGED
|
@@ -52,7 +52,7 @@ export declare class Project {
|
|
|
52
52
|
* key is specified, will prompt the user to login.
|
|
53
53
|
* @param options.org_name (Optional) The name of a specific organization to connect to. This is useful if you belong to multiple.
|
|
54
54
|
* @param options.disable_cache Do not use cached login information.
|
|
55
|
-
* @returns The
|
|
55
|
+
* @returns The newly created Experiment.
|
|
56
56
|
*/
|
|
57
57
|
export declare function init(project: string, options?: {
|
|
58
58
|
readonly experiment?: string;
|
|
@@ -67,14 +67,13 @@ export declare function init(project: string, options?: {
|
|
|
67
67
|
* Log into BrainTrust. This will prompt you for your API token, which you can find at
|
|
68
68
|
* https://www.braintrustdata.com/app/token. This method is called automatically by `init()`.
|
|
69
69
|
*
|
|
70
|
-
* @param options
|
|
70
|
+
* @param options Options for configuring login().
|
|
71
71
|
* @param options.api_url The URL of the BrainTrust API. Defaults to https://www.braintrustdata.com.
|
|
72
72
|
* @param options.api_key The API key to use. If the parameter is not specified, will try to use the `BRAINTRUST_API_KEY` environment variable. If no API
|
|
73
73
|
* key is specified, will prompt the user to login.
|
|
74
74
|
* @param options.org_name (Optional) The name of a specific organization to connect to. This is useful if you belong to multiple.
|
|
75
75
|
* @param options.disable_cache Do not use cached login information.
|
|
76
76
|
* @param options.force_login Login again, even if you have already logged in (by default, this function will exit quickly if you have already logged in)
|
|
77
|
-
* @returns
|
|
78
77
|
*/
|
|
79
78
|
export declare function login(options?: {
|
|
80
79
|
api_url?: string;
|
|
@@ -82,30 +81,30 @@ export declare function login(options?: {
|
|
|
82
81
|
org_name?: string;
|
|
83
82
|
disable_cache?: boolean;
|
|
84
83
|
force_login?: boolean;
|
|
85
|
-
}
|
|
84
|
+
}): Promise<void>;
|
|
86
85
|
/**
|
|
87
86
|
* Log a single event to the current experiment. The event will be batched and uploaded behind the scenes.
|
|
88
87
|
*
|
|
89
|
-
* @param
|
|
90
|
-
* @param
|
|
88
|
+
* @param event The event to log.
|
|
89
|
+
* @param event.inputs The arguments that uniquely define a test case (an arbitrary, JSON serializable object). Later on,
|
|
91
90
|
* BrainTrust will use the `inputs` to know whether two test casess are the same between experiments, so they should
|
|
92
91
|
* not contain experiment-specific state. A simple rule of thumb is that if you run the same experiment twice, the
|
|
93
92
|
* `inputs` should be identical.
|
|
94
|
-
* @param
|
|
93
|
+
* @param event.output The output of your application, including post-processing (an arbitrary, JSON serializable object),
|
|
95
94
|
* that allows you to determine whether the result is correct or not. For example, in an app that generates SQL queries,
|
|
96
95
|
* the `output` should be the _result_ of the SQL query generated by the model, not the query itself, because there may
|
|
97
96
|
* be multiple valid queries that answer a single question.
|
|
98
|
-
* @param
|
|
97
|
+
* @param event.expected The ground truth value (an arbitrary, JSON serializable object) that you'd compare to `output` to
|
|
99
98
|
* determine if your `output` value is correct or not. BrainTrust currently does not compare `output` to `expected` for
|
|
100
99
|
* you, since there are so many different ways to do that correctly. Instead, these values are just used to help you
|
|
101
100
|
* navigate your experiments while digging into analyses. However, we may later use these values to re-score outputs or
|
|
102
101
|
* fine-tune your models.
|
|
103
|
-
* @param
|
|
102
|
+
* @param event.scores A dictionary of numeric values (between 0 and 1) to log. The scores should give you a variety of signals
|
|
104
103
|
* that help you determine how accurate the outputs are compared to what you expect and diagnose failures. For example, a
|
|
105
104
|
* summarization app might have one score that tells you how accurate the summary is, and another that measures the word similarity
|
|
106
105
|
* between the generated and grouth truth summary. The word similarity score could help you determine whether the summarization was
|
|
107
106
|
* covering similar concepts or not. You can use these scores to help you sort, filter, and compare experiments.
|
|
108
|
-
* @param
|
|
107
|
+
* @param event.metadata (Optional) a dictionary with additional data about the test example, model outputs, or just
|
|
109
108
|
* about anything else that's relevant, that you can use to help find and analyze examples later. For example, you could log the
|
|
110
109
|
* `prompt`, example's `id`, or anything else that would be useful to slice/dice later. The values in `metadata` can be any
|
|
111
110
|
* JSON-serializable type, but its keys must be strings.
|
|
@@ -121,15 +120,15 @@ export declare function log(options: {
|
|
|
121
120
|
/**
|
|
122
121
|
* Summarize the current experiment, including the scores (compared to the closest reference experiment) and metadata.
|
|
123
122
|
*
|
|
124
|
-
* @param options
|
|
125
|
-
* @param
|
|
126
|
-
* @param
|
|
127
|
-
* @returns
|
|
123
|
+
* @param options Options for summarizing the experiment.
|
|
124
|
+
* @param options.summarizeScores Whether to summarize the scores. If False, only the metadata will be returned.
|
|
125
|
+
* @param options.comparisonExperimentId The experiment to compare against. If None, the most recent experiment on the origin's main branch will be used.
|
|
126
|
+
* @returns A summary of the experiment, including the scores (compared to the closest reference experiment) and metadata.
|
|
128
127
|
*/
|
|
129
128
|
export declare function summarize(options?: {
|
|
130
129
|
readonly summarizeScores?: boolean;
|
|
131
130
|
readonly comparisonExperimentId?: string;
|
|
132
|
-
}
|
|
131
|
+
}): Promise<ExperimentSummary>;
|
|
133
132
|
/**
|
|
134
133
|
* An experiment is a collection of logged events, such as model inputs and outputs, which represent
|
|
135
134
|
* a snapshot of your application at a particular point in time. An experiment is meant to capture more
|
|
@@ -149,34 +148,29 @@ export declare class Experiment {
|
|
|
149
148
|
readonly user_id: string;
|
|
150
149
|
private logger;
|
|
151
150
|
constructor(project: Project, id: string, name: string, user_id: string);
|
|
152
|
-
static init(project: Project, { name, description, base_experiment, }?: {
|
|
153
|
-
name?: string;
|
|
154
|
-
description?: string;
|
|
155
|
-
base_experiment?: string;
|
|
156
|
-
}): Promise<Experiment>;
|
|
157
151
|
/**
|
|
158
152
|
* Log a single event to the experiment. The event will be batched and uploaded behind the scenes.
|
|
159
153
|
*
|
|
160
|
-
* @param
|
|
161
|
-
* @param
|
|
154
|
+
* @param event The event to log.
|
|
155
|
+
* @param event.inputs The arguments that uniquely define a test case (an arbitrary, JSON serializable object). Later on,
|
|
162
156
|
* BrainTrust will use the `inputs` to know whether two test casess are the same between experiments, so they should
|
|
163
157
|
* not contain experiment-specific state. A simple rule of thumb is that if you run the same experiment twice, the
|
|
164
158
|
* `inputs` should be identical.
|
|
165
|
-
* @param
|
|
159
|
+
* @param event.output The output of your application, including post-processing (an arbitrary, JSON serializable object),
|
|
166
160
|
* that allows you to determine whether the result is correct or not. For example, in an app that generates SQL queries,
|
|
167
161
|
* the `output` should be the _result_ of the SQL query generated by the model, not the query itself, because there may
|
|
168
162
|
* be multiple valid queries that answer a single question.
|
|
169
|
-
* @param
|
|
163
|
+
* @param event.expected The ground truth value (an arbitrary, JSON serializable object) that you'd compare to `output` to
|
|
170
164
|
* determine if your `output` value is correct or not. BrainTrust currently does not compare `output` to `expected` for
|
|
171
165
|
* you, since there are so many different ways to do that correctly. Instead, these values are just used to help you
|
|
172
166
|
* navigate your experiments while digging into analyses. However, we may later use these values to re-score outputs or
|
|
173
167
|
* fine-tune your models.
|
|
174
|
-
* @param
|
|
168
|
+
* @param event.scores A dictionary of numeric values (between 0 and 1) to log. The scores should give you a variety of signals
|
|
175
169
|
* that help you determine how accurate the outputs are compared to what you expect and diagnose failures. For example, a
|
|
176
170
|
* summarization app might have one score that tells you how accurate the summary is, and another that measures the word similarity
|
|
177
171
|
* between the generated and grouth truth summary. The word similarity score could help you determine whether the summarization was
|
|
178
172
|
* covering similar concepts or not. You can use these scores to help you sort, filter, and compare experiments.
|
|
179
|
-
* @param
|
|
173
|
+
* @param event.metadata (Optional) a dictionary with additional data about the test example, model outputs, or just
|
|
180
174
|
* about anything else that's relevant, that you can use to help find and analyze examples later. For example, you could log the
|
|
181
175
|
* `prompt`, example's `id`, or anything else that would be useful to slice/dice later. The values in `metadata` can be any
|
|
182
176
|
* JSON-serializable type, but its keys must be strings.
|
|
@@ -192,15 +186,15 @@ export declare class Experiment {
|
|
|
192
186
|
/**
|
|
193
187
|
* Summarize the experiment, including the scores (compared to the closest reference experiment) and metadata.
|
|
194
188
|
*
|
|
195
|
-
* @param options
|
|
196
|
-
* @param
|
|
197
|
-
* @param
|
|
198
|
-
* @returns
|
|
189
|
+
* @param options Options for summarizing the experiment.
|
|
190
|
+
* @param options.summarizeScores Whether to summarize the scores. If False, only the metadata will be returned.
|
|
191
|
+
* @param options.comparisonExperimentId The experiment to compare against. If None, the most recent experiment on the origin's main branch will be used.
|
|
192
|
+
* @returns A summary of the experiment, including the scores (compared to the closest reference experiment) and metadata.
|
|
199
193
|
*/
|
|
200
194
|
summarize(options?: {
|
|
201
195
|
readonly summarizeScores?: boolean;
|
|
202
196
|
readonly comparisonExperimentId?: string;
|
|
203
|
-
}
|
|
197
|
+
}): Promise<ExperimentSummary>;
|
|
204
198
|
}
|
|
205
199
|
/**
|
|
206
200
|
* Summary of a score's performance.
|
|
@@ -210,7 +204,7 @@ export declare class Experiment {
|
|
|
210
204
|
* @property improvements Number of improvements in the score.
|
|
211
205
|
* @property regressions Number of regressions in the score.
|
|
212
206
|
*/
|
|
213
|
-
interface ScoreSummary {
|
|
207
|
+
export interface ScoreSummary {
|
|
214
208
|
name: string;
|
|
215
209
|
score: number;
|
|
216
210
|
diff: number;
|
|
@@ -226,7 +220,7 @@ interface ScoreSummary {
|
|
|
226
220
|
* @property comparisonExperimentName The experiment scores are baselined against.
|
|
227
221
|
* @property scores Summary of the experiment's scores.
|
|
228
222
|
*/
|
|
229
|
-
interface ExperimentSummary {
|
|
223
|
+
export interface ExperimentSummary {
|
|
230
224
|
projectName: string;
|
|
231
225
|
experimentName: string;
|
|
232
226
|
projectUrl: string;
|
|
@@ -234,4 +228,3 @@ interface ExperimentSummary {
|
|
|
234
228
|
comparisonExperimentName: string | undefined;
|
|
235
229
|
scores: Record<string, ScoreSummary> | undefined;
|
|
236
230
|
}
|
|
237
|
-
export {};
|