An isomorphic JS library for logging data to Braintrust.
Install the library with npm (or yarn).
npm install braintrust
Then, run a simple experiment with the following code (replace YOUR_API_KEY
with
your Braintrust API key):
import * as braintrust from "braintrust";
const experiment = await braintrust.init("NodeTest", {
apiKey: "YOUR_API_KEY",
});
experiment.log({
inputs: { test: 1 },
output: "foo",
expected: "bar",
scores: {
n: 0.5,
},
metadata: {
id: 1,
},
});
console.log(await experiment.summarize());