braintrust
Advanced tools
Comparing version 0.0.26 to 0.0.27
@@ -18,3 +18,3 @@ /** | ||
* | ||
* const experiment = await braintrust.init("NodeTest", {api_key: "YOUR_API_KEY"}); | ||
* const experiment = await braintrust.init("NodeTest", {apiKey: "YOUR_API_KEY"}); | ||
* experiment.log({ | ||
@@ -21,0 +21,0 @@ * inputs: {test: 1}, |
@@ -19,3 +19,3 @@ "use strict"; | ||
* | ||
* const experiment = await braintrust.init("NodeTest", {api_key: "YOUR_API_KEY"}); | ||
* const experiment = await braintrust.init("NodeTest", {apiKey: "YOUR_API_KEY"}); | ||
* experiment.log({ | ||
@@ -22,0 +22,0 @@ * inputs: {test: 1}, |
@@ -239,2 +239,11 @@ export declare class Project { | ||
delete(id: string): string; | ||
/** | ||
* Summarize the dataset, including high level metrics about its size and other metadata. | ||
* @param summarizeData Whether to summarize the data. If false, only the metadata will be returned. | ||
* @returns `DatasetSummary` | ||
* @returns A summary of the dataset. | ||
*/ | ||
summarize(options?: { | ||
readonly summarizeData?: boolean; | ||
}): Promise<DatasetSummary>; | ||
} | ||
@@ -273,1 +282,27 @@ /** | ||
} | ||
/** | ||
* Summary of a dataset's data. | ||
* | ||
* @property newRecords New or updated records added in this session. | ||
* @property totalRecords Total records in the dataset. | ||
*/ | ||
export interface DataSummary { | ||
newRecords: number; | ||
totalRecords: number; | ||
} | ||
/** | ||
* Summary of a dataset's scores and metadata. | ||
* | ||
* @property projectName Name of the project that the dataset belongs to. | ||
* @property datasetName Name of the dataset. | ||
* @property projectUrl URL to the project's page in the BrainTrust app. | ||
* @property datasetUrl URL to the experiment's page in the BrainTrust app. | ||
* @property dataSummary Summary of the dataset's data. | ||
*/ | ||
export interface DatasetSummary { | ||
projectName: string; | ||
datasetName: string; | ||
projectUrl: string; | ||
datasetUrl: string; | ||
dataSummary: DataSummary; | ||
} |
@@ -799,3 +799,30 @@ "use strict"; | ||
} | ||
/** | ||
* Summarize the dataset, including high level metrics about its size and other metadata. | ||
* @param summarizeData Whether to summarize the data. If false, only the metadata will be returned. | ||
* @returns `DatasetSummary` | ||
* @returns A summary of the dataset. | ||
*/ | ||
summarize(options = {}) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
let { summarizeData = true } = options || {}; | ||
yield this.logger.flush(); | ||
const projectUrl = `${API_URL}/app/${encodeURIComponent(ORG_NAME)}/p/${encodeURIComponent(this.project.name)}`; | ||
const datasetUrl = `${projectUrl}/d/${encodeURIComponent(this.name)}`; | ||
let dataSummary = undefined; | ||
if (summarizeData) { | ||
dataSummary = yield log_conn().get_json("dataset-summary", { | ||
dataset_id: this.id, | ||
}, 3); | ||
} | ||
return { | ||
projectName: this.project.name, | ||
datasetName: this.name, | ||
projectUrl, | ||
datasetUrl, | ||
dataSummary, | ||
}; | ||
}); | ||
} | ||
} | ||
exports.Dataset = Dataset; |
{ | ||
"name": "braintrust", | ||
"version": "0.0.26", | ||
"version": "0.0.27", | ||
"description": "SDK for integrating BrainTrust", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -18,3 +18,3 @@ A Node.js library for logging data to BrainTrust. | ||
const experiment = await braintrust.init("NodeTest", { | ||
api_key: "YOUR_API_KEY", | ||
apiKey: "YOUR_API_KEY", | ||
}); | ||
@@ -21,0 +21,0 @@ experiment.log({ |
Sorry, the diff of this file is not supported yet
126235
2205