braintrust 1.0.1 → 1.0.2
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/dev/dist/index.d.mts +16 -3
- package/dev/dist/index.d.ts +16 -3
- package/dev/dist/index.js +46 -38
- package/dev/dist/index.mjs +19 -11
- package/dist/browser.d.mts +29 -11
- package/dist/browser.d.ts +29 -11
- package/dist/browser.js +338 -108
- package/dist/browser.mjs +258 -28
- package/dist/cli.js +20 -12
- package/dist/index.d.mts +29 -11
- package/dist/index.d.ts +29 -11
- package/dist/index.js +350 -120
- package/dist/index.mjs +258 -28
- package/package.json +1 -1
package/dev/dist/index.d.mts
CHANGED
|
@@ -8517,11 +8517,24 @@ declare class ObjectFetcher<RecordType> implements AsyncIterable<WithTransaction
|
|
|
8517
8517
|
get id(): Promise<string>;
|
|
8518
8518
|
protected getState(): Promise<BraintrustState>;
|
|
8519
8519
|
private fetchRecordsFromApi;
|
|
8520
|
-
|
|
8520
|
+
/**
|
|
8521
|
+
* Fetch all records from the object.
|
|
8522
|
+
*
|
|
8523
|
+
* @param options Optional parameters for fetching.
|
|
8524
|
+
* @param options.batchSize The number of records to fetch per request. Defaults to 1000.
|
|
8525
|
+
* @returns An async generator of records.
|
|
8526
|
+
*/
|
|
8527
|
+
fetch(options?: {
|
|
8528
|
+
batchSize?: number;
|
|
8529
|
+
}): AsyncGenerator<WithTransactionId<RecordType>>;
|
|
8521
8530
|
[Symbol.asyncIterator](): AsyncIterator<WithTransactionId<RecordType>>;
|
|
8522
|
-
fetchedData(
|
|
8531
|
+
fetchedData(options?: {
|
|
8532
|
+
batchSize?: number;
|
|
8533
|
+
}): Promise<WithTransactionId<RecordType>[]>;
|
|
8523
8534
|
clearCache(): void;
|
|
8524
|
-
version(
|
|
8535
|
+
version(options?: {
|
|
8536
|
+
batchSize?: number;
|
|
8537
|
+
}): Promise<string | undefined>;
|
|
8525
8538
|
}
|
|
8526
8539
|
type BaseMetadata = Record<string, unknown> | void;
|
|
8527
8540
|
type DefaultMetadataType = void;
|
package/dev/dist/index.d.ts
CHANGED
|
@@ -8517,11 +8517,24 @@ declare class ObjectFetcher<RecordType> implements AsyncIterable<WithTransaction
|
|
|
8517
8517
|
get id(): Promise<string>;
|
|
8518
8518
|
protected getState(): Promise<BraintrustState>;
|
|
8519
8519
|
private fetchRecordsFromApi;
|
|
8520
|
-
|
|
8520
|
+
/**
|
|
8521
|
+
* Fetch all records from the object.
|
|
8522
|
+
*
|
|
8523
|
+
* @param options Optional parameters for fetching.
|
|
8524
|
+
* @param options.batchSize The number of records to fetch per request. Defaults to 1000.
|
|
8525
|
+
* @returns An async generator of records.
|
|
8526
|
+
*/
|
|
8527
|
+
fetch(options?: {
|
|
8528
|
+
batchSize?: number;
|
|
8529
|
+
}): AsyncGenerator<WithTransactionId<RecordType>>;
|
|
8521
8530
|
[Symbol.asyncIterator](): AsyncIterator<WithTransactionId<RecordType>>;
|
|
8522
|
-
fetchedData(
|
|
8531
|
+
fetchedData(options?: {
|
|
8532
|
+
batchSize?: number;
|
|
8533
|
+
}): Promise<WithTransactionId<RecordType>[]>;
|
|
8523
8534
|
clearCache(): void;
|
|
8524
|
-
version(
|
|
8535
|
+
version(options?: {
|
|
8536
|
+
batchSize?: number;
|
|
8537
|
+
}): Promise<string | undefined>;
|
|
8525
8538
|
}
|
|
8526
8539
|
type BaseMetadata = Record<string, unknown> | void;
|
|
8527
8540
|
type DefaultMetadataType = void;
|
package/dev/dist/index.js
CHANGED
|
@@ -5852,7 +5852,7 @@ function validateAndSanitizeExperimentLogFullArgs(event, hasDataset) {
|
|
|
5852
5852
|
}
|
|
5853
5853
|
return event;
|
|
5854
5854
|
}
|
|
5855
|
-
var
|
|
5855
|
+
var DEFAULT_FETCH_BATCH_SIZE = 1e3;
|
|
5856
5856
|
var MAX_BTQL_ITERATIONS = 1e4;
|
|
5857
5857
|
var ObjectFetcher = (_class8 = class {
|
|
5858
5858
|
constructor(objectType, pinnedVersion, mutateRecord, _internal_btql) {;_class8.prototype.__init38.call(this);
|
|
@@ -5868,9 +5868,10 @@ var ObjectFetcher = (_class8 = class {
|
|
|
5868
5868
|
async getState() {
|
|
5869
5869
|
throw new Error("ObjectFetcher subclasses must have a 'getState' method");
|
|
5870
5870
|
}
|
|
5871
|
-
async *fetchRecordsFromApi() {
|
|
5871
|
+
async *fetchRecordsFromApi(batchSize) {
|
|
5872
5872
|
const state = await this.getState();
|
|
5873
5873
|
const objectId = await this.id;
|
|
5874
|
+
const limit = _nullishCoalesce(batchSize, () => ( DEFAULT_FETCH_BATCH_SIZE));
|
|
5874
5875
|
let cursor = void 0;
|
|
5875
5876
|
let iterations = 0;
|
|
5876
5877
|
while (true) {
|
|
@@ -5898,7 +5899,7 @@ var ObjectFetcher = (_class8 = class {
|
|
|
5898
5899
|
]
|
|
5899
5900
|
},
|
|
5900
5901
|
cursor,
|
|
5901
|
-
limit
|
|
5902
|
+
limit
|
|
5902
5903
|
},
|
|
5903
5904
|
use_columnstore: false,
|
|
5904
5905
|
brainstore_realtime: true,
|
|
@@ -5924,24 +5925,31 @@ var ObjectFetcher = (_class8 = class {
|
|
|
5924
5925
|
}
|
|
5925
5926
|
}
|
|
5926
5927
|
}
|
|
5927
|
-
|
|
5928
|
+
/**
|
|
5929
|
+
* Fetch all records from the object.
|
|
5930
|
+
*
|
|
5931
|
+
* @param options Optional parameters for fetching.
|
|
5932
|
+
* @param options.batchSize The number of records to fetch per request. Defaults to 1000.
|
|
5933
|
+
* @returns An async generator of records.
|
|
5934
|
+
*/
|
|
5935
|
+
async *fetch(options) {
|
|
5928
5936
|
if (this._fetchedData !== void 0) {
|
|
5929
5937
|
for (const record of this._fetchedData) {
|
|
5930
5938
|
yield record;
|
|
5931
5939
|
}
|
|
5932
5940
|
return;
|
|
5933
5941
|
}
|
|
5934
|
-
for await (const record of this.fetchRecordsFromApi()) {
|
|
5942
|
+
for await (const record of this.fetchRecordsFromApi(_optionalChain([options, 'optionalAccess', _59 => _59.batchSize]))) {
|
|
5935
5943
|
yield record;
|
|
5936
5944
|
}
|
|
5937
5945
|
}
|
|
5938
5946
|
[Symbol.asyncIterator]() {
|
|
5939
5947
|
return this.fetch();
|
|
5940
5948
|
}
|
|
5941
|
-
async fetchedData() {
|
|
5949
|
+
async fetchedData(options) {
|
|
5942
5950
|
if (this._fetchedData === void 0) {
|
|
5943
5951
|
const data = [];
|
|
5944
|
-
for await (const record of this.fetchRecordsFromApi()) {
|
|
5952
|
+
for await (const record of this.fetchRecordsFromApi(_optionalChain([options, 'optionalAccess', _60 => _60.batchSize]))) {
|
|
5945
5953
|
data.push(record);
|
|
5946
5954
|
}
|
|
5947
5955
|
this._fetchedData = data;
|
|
@@ -5951,12 +5959,12 @@ var ObjectFetcher = (_class8 = class {
|
|
|
5951
5959
|
clearCache() {
|
|
5952
5960
|
this._fetchedData = void 0;
|
|
5953
5961
|
}
|
|
5954
|
-
async version() {
|
|
5962
|
+
async version(options) {
|
|
5955
5963
|
if (this.pinnedVersion !== void 0) {
|
|
5956
5964
|
return this.pinnedVersion;
|
|
5957
5965
|
} else {
|
|
5958
5966
|
let maxVersion = void 0;
|
|
5959
|
-
for await (const record of this.fetch()) {
|
|
5967
|
+
for await (const record of this.fetch(options)) {
|
|
5960
5968
|
const xactId = String(_nullishCoalesce(record[TRANSACTION_ID_FIELD], () => ( "0")));
|
|
5961
5969
|
if (maxVersion === void 0 || xactId > maxVersion) {
|
|
5962
5970
|
maxVersion = xactId;
|
|
@@ -6036,7 +6044,7 @@ var Experiment2 = (_class9 = class extends ObjectFetcher {
|
|
|
6036
6044
|
* @returns The `id` of the logged event.
|
|
6037
6045
|
*/
|
|
6038
6046
|
log(event, options) {
|
|
6039
|
-
if (this.calledStartSpan && !_optionalChain([options, 'optionalAccess',
|
|
6047
|
+
if (this.calledStartSpan && !_optionalChain([options, 'optionalAccess', _61 => _61.allowConcurrentWithSpans])) {
|
|
6040
6048
|
throw new Error(
|
|
6041
6049
|
"Cannot run toplevel `log` method while using spans. To log to the span, call `experiment.traced` and then log with `span.log`"
|
|
6042
6050
|
);
|
|
@@ -6089,12 +6097,12 @@ var Experiment2 = (_class9 = class extends ObjectFetcher {
|
|
|
6089
6097
|
state: this.state,
|
|
6090
6098
|
...startSpanParentArgs({
|
|
6091
6099
|
state: this.state,
|
|
6092
|
-
parent: _optionalChain([args, 'optionalAccess',
|
|
6100
|
+
parent: _optionalChain([args, 'optionalAccess', _62 => _62.parent]),
|
|
6093
6101
|
parentObjectType: this.parentObjectType(),
|
|
6094
6102
|
parentObjectId: this.lazyId,
|
|
6095
6103
|
parentComputeObjectMetadataArgs: void 0,
|
|
6096
6104
|
parentSpanIds: void 0,
|
|
6097
|
-
propagatedEvent: _optionalChain([args, 'optionalAccess',
|
|
6105
|
+
propagatedEvent: _optionalChain([args, 'optionalAccess', _63 => _63.propagatedEvent])
|
|
6098
6106
|
}),
|
|
6099
6107
|
defaultRootType: "eval" /* EVAL */
|
|
6100
6108
|
});
|
|
@@ -6264,8 +6272,8 @@ var ReadonlyExperiment = class extends ObjectFetcher {
|
|
|
6264
6272
|
await this.lazyMetadata.get();
|
|
6265
6273
|
return this.state;
|
|
6266
6274
|
}
|
|
6267
|
-
async *asDataset() {
|
|
6268
|
-
const records = this.fetch();
|
|
6275
|
+
async *asDataset(options) {
|
|
6276
|
+
const records = this.fetch(options);
|
|
6269
6277
|
for await (const record of records) {
|
|
6270
6278
|
if (record.root_span_id !== record.span_id) {
|
|
6271
6279
|
continue;
|
|
@@ -6432,10 +6440,10 @@ var SpanImpl = (_class10 = class _SpanImpl {
|
|
|
6432
6440
|
...serializableInternalData,
|
|
6433
6441
|
[IS_MERGE_FIELD]: this.isMerge
|
|
6434
6442
|
});
|
|
6435
|
-
if (_optionalChain([partialRecord, 'access',
|
|
6436
|
-
this.loggedEndTime = _optionalChain([partialRecord, 'access',
|
|
6443
|
+
if (_optionalChain([partialRecord, 'access', _64 => _64.metrics, 'optionalAccess', _65 => _65.end])) {
|
|
6444
|
+
this.loggedEndTime = _optionalChain([partialRecord, 'access', _66 => _66.metrics, 'optionalAccess', _67 => _67.end]);
|
|
6437
6445
|
}
|
|
6438
|
-
if ((_nullishCoalesce(partialRecord.tags, () => ( []))).length > 0 && _optionalChain([this, 'access',
|
|
6446
|
+
if ((_nullishCoalesce(partialRecord.tags, () => ( []))).length > 0 && _optionalChain([this, 'access', _68 => _68._spanParents, 'optionalAccess', _69 => _69.length])) {
|
|
6439
6447
|
throw new Error("Tags can only be logged to the root span");
|
|
6440
6448
|
}
|
|
6441
6449
|
const computeRecord = async () => ({
|
|
@@ -6480,18 +6488,18 @@ var SpanImpl = (_class10 = class _SpanImpl {
|
|
|
6480
6488
|
);
|
|
6481
6489
|
}
|
|
6482
6490
|
startSpan(args) {
|
|
6483
|
-
const parentSpanIds = _optionalChain([args, 'optionalAccess',
|
|
6491
|
+
const parentSpanIds = _optionalChain([args, 'optionalAccess', _70 => _70.parent]) ? void 0 : { spanId: this._spanId, rootSpanId: this._rootSpanId };
|
|
6484
6492
|
return new _SpanImpl({
|
|
6485
6493
|
state: this._state,
|
|
6486
6494
|
...args,
|
|
6487
6495
|
...startSpanParentArgs({
|
|
6488
6496
|
state: this._state,
|
|
6489
|
-
parent: _optionalChain([args, 'optionalAccess',
|
|
6497
|
+
parent: _optionalChain([args, 'optionalAccess', _71 => _71.parent]),
|
|
6490
6498
|
parentObjectType: this.parentObjectType,
|
|
6491
6499
|
parentObjectId: this.parentObjectId,
|
|
6492
6500
|
parentComputeObjectMetadataArgs: this.parentComputeObjectMetadataArgs,
|
|
6493
6501
|
parentSpanIds,
|
|
6494
|
-
propagatedEvent: _nullishCoalesce(_optionalChain([args, 'optionalAccess',
|
|
6502
|
+
propagatedEvent: _nullishCoalesce(_optionalChain([args, 'optionalAccess', _72 => _72.propagatedEvent]), () => ( this.propagatedEvent))
|
|
6495
6503
|
})
|
|
6496
6504
|
});
|
|
6497
6505
|
}
|
|
@@ -6505,12 +6513,12 @@ var SpanImpl = (_class10 = class _SpanImpl {
|
|
|
6505
6513
|
...args,
|
|
6506
6514
|
...startSpanParentArgs({
|
|
6507
6515
|
state: this._state,
|
|
6508
|
-
parent: _optionalChain([args, 'optionalAccess',
|
|
6516
|
+
parent: _optionalChain([args, 'optionalAccess', _73 => _73.parent]),
|
|
6509
6517
|
parentObjectType: this.parentObjectType,
|
|
6510
6518
|
parentObjectId: this.parentObjectId,
|
|
6511
6519
|
parentComputeObjectMetadataArgs: this.parentComputeObjectMetadataArgs,
|
|
6512
6520
|
parentSpanIds,
|
|
6513
|
-
propagatedEvent: _nullishCoalesce(_optionalChain([args, 'optionalAccess',
|
|
6521
|
+
propagatedEvent: _nullishCoalesce(_optionalChain([args, 'optionalAccess', _74 => _74.propagatedEvent]), () => ( this.propagatedEvent))
|
|
6514
6522
|
}),
|
|
6515
6523
|
spanId
|
|
6516
6524
|
});
|
|
@@ -6519,7 +6527,7 @@ var SpanImpl = (_class10 = class _SpanImpl {
|
|
|
6519
6527
|
let endTime;
|
|
6520
6528
|
let internalData = {};
|
|
6521
6529
|
if (!this.loggedEndTime) {
|
|
6522
|
-
endTime = _nullishCoalesce(_optionalChain([args, 'optionalAccess',
|
|
6530
|
+
endTime = _nullishCoalesce(_optionalChain([args, 'optionalAccess', _75 => _75.endTime]), () => ( getCurrentUnixTimestamp()));
|
|
6523
6531
|
internalData = { metrics: { end: endTime } };
|
|
6524
6532
|
} else {
|
|
6525
6533
|
endTime = this.loggedEndTime;
|
|
@@ -6562,8 +6570,8 @@ var SpanImpl = (_class10 = class _SpanImpl {
|
|
|
6562
6570
|
const args = this.parentComputeObjectMetadataArgs;
|
|
6563
6571
|
switch (this.parentObjectType) {
|
|
6564
6572
|
case 2 /* PROJECT_LOGS */: {
|
|
6565
|
-
const projectID = _optionalChain([args, 'optionalAccess',
|
|
6566
|
-
const projectName = _optionalChain([args, 'optionalAccess',
|
|
6573
|
+
const projectID = _optionalChain([args, 'optionalAccess', _76 => _76.project_id]) || this.parentObjectId.getSync().value;
|
|
6574
|
+
const projectName = _optionalChain([args, 'optionalAccess', _77 => _77.project_name]);
|
|
6567
6575
|
if (projectID) {
|
|
6568
6576
|
return `${baseUrl}/object?object_type=project_logs&object_id=${projectID}&id=${this._id}`;
|
|
6569
6577
|
} else if (projectName) {
|
|
@@ -6573,7 +6581,7 @@ var SpanImpl = (_class10 = class _SpanImpl {
|
|
|
6573
6581
|
}
|
|
6574
6582
|
}
|
|
6575
6583
|
case 1 /* EXPERIMENT */: {
|
|
6576
|
-
const expID = _optionalChain([args, 'optionalAccess',
|
|
6584
|
+
const expID = _optionalChain([args, 'optionalAccess', _78 => _78.experiment_id]) || _optionalChain([this, 'access', _79 => _79.parentObjectId, 'optionalAccess', _80 => _80.getSync, 'call', _81 => _81(), 'optionalAccess', _82 => _82.value]);
|
|
6577
6585
|
if (!expID) {
|
|
6578
6586
|
return getErrPermlink("provide-experiment-id");
|
|
6579
6587
|
} else {
|
|
@@ -7029,13 +7037,13 @@ var Prompt2 = (_class12 = class _Prompt {
|
|
|
7029
7037
|
return "slug" in this.metadata ? this.metadata.slug : this.metadata.id;
|
|
7030
7038
|
}
|
|
7031
7039
|
get prompt() {
|
|
7032
|
-
return _optionalChain([this, 'access',
|
|
7040
|
+
return _optionalChain([this, 'access', _83 => _83.getParsedPromptData, 'call', _84 => _84(), 'optionalAccess', _85 => _85.prompt]);
|
|
7033
7041
|
}
|
|
7034
7042
|
get version() {
|
|
7035
7043
|
return this.metadata[TRANSACTION_ID_FIELD];
|
|
7036
7044
|
}
|
|
7037
7045
|
get options() {
|
|
7038
|
-
return _optionalChain([this, 'access',
|
|
7046
|
+
return _optionalChain([this, 'access', _86 => _86.getParsedPromptData, 'call', _87 => _87(), 'optionalAccess', _88 => _88.options]) || {};
|
|
7039
7047
|
}
|
|
7040
7048
|
get promptData() {
|
|
7041
7049
|
return this.getParsedPromptData();
|
|
@@ -7186,7 +7194,7 @@ var Prompt2 = (_class12 = class _Prompt {
|
|
|
7186
7194
|
return {
|
|
7187
7195
|
type: "chat",
|
|
7188
7196
|
messages,
|
|
7189
|
-
..._optionalChain([prompt, 'access',
|
|
7197
|
+
..._optionalChain([prompt, 'access', _89 => _89.tools, 'optionalAccess', _90 => _90.trim, 'call', _91 => _91()]) ? {
|
|
7190
7198
|
tools: render(prompt.tools)
|
|
7191
7199
|
} : void 0
|
|
7192
7200
|
};
|
|
@@ -9056,10 +9064,10 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
9056
9064
|
span,
|
|
9057
9065
|
parameters: _nullishCoalesce(parameters, () => ( {})),
|
|
9058
9066
|
reportProgress: (event) => {
|
|
9059
|
-
_optionalChain([stream, 'optionalCall',
|
|
9067
|
+
_optionalChain([stream, 'optionalCall', _92 => _92({
|
|
9060
9068
|
...event,
|
|
9061
9069
|
id: rootSpan.id,
|
|
9062
|
-
origin: _optionalChain([baseEvent, 'access',
|
|
9070
|
+
origin: _optionalChain([baseEvent, 'access', _93 => _93.event, 'optionalAccess', _94 => _94.origin]),
|
|
9063
9071
|
name: evaluator.evalName,
|
|
9064
9072
|
object_type: "task"
|
|
9065
9073
|
})]);
|
|
@@ -9214,7 +9222,7 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
9214
9222
|
metadata,
|
|
9215
9223
|
scores: mergedScores,
|
|
9216
9224
|
error: error2,
|
|
9217
|
-
origin: _optionalChain([baseEvent, 'access',
|
|
9225
|
+
origin: _optionalChain([baseEvent, 'access', _95 => _95.event, 'optionalAccess', _96 => _96.origin])
|
|
9218
9226
|
});
|
|
9219
9227
|
}
|
|
9220
9228
|
};
|
|
@@ -9247,7 +9255,7 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
9247
9255
|
break;
|
|
9248
9256
|
}
|
|
9249
9257
|
scheduledTrials++;
|
|
9250
|
-
_optionalChain([progressReporter, 'access',
|
|
9258
|
+
_optionalChain([progressReporter, 'access', _97 => _97.setTotal, 'optionalCall', _98 => _98(evaluator.evalName, scheduledTrials)]);
|
|
9251
9259
|
q.push({ datum, trialIndex });
|
|
9252
9260
|
}
|
|
9253
9261
|
}
|
|
@@ -9593,7 +9601,7 @@ async function cachedLogin(options) {
|
|
|
9593
9601
|
}
|
|
9594
9602
|
function makeCheckAuthorized(allowedOrgName) {
|
|
9595
9603
|
return async (req, _res, next) => {
|
|
9596
|
-
if (!_optionalChain([req, 'access',
|
|
9604
|
+
if (!_optionalChain([req, 'access', _99 => _99.ctx, 'optionalAccess', _100 => _100.token])) {
|
|
9597
9605
|
return next(_httperrors2.default.call(void 0, 401, "Unauthorized"));
|
|
9598
9606
|
}
|
|
9599
9607
|
try {
|
|
@@ -9606,7 +9614,7 @@ function makeCheckAuthorized(allowedOrgName) {
|
|
|
9606
9614
|
return next(_httperrors2.default.call(void 0, 403, errorMessage));
|
|
9607
9615
|
}
|
|
9608
9616
|
const state = await cachedLogin({
|
|
9609
|
-
apiKey: _optionalChain([req, 'access',
|
|
9617
|
+
apiKey: _optionalChain([req, 'access', _101 => _101.ctx, 'optionalAccess', _102 => _102.token]),
|
|
9610
9618
|
orgName
|
|
9611
9619
|
});
|
|
9612
9620
|
req.ctx.state = state;
|
|
@@ -9814,7 +9822,7 @@ function runDevServer(evaluators, opts) {
|
|
|
9814
9822
|
scores,
|
|
9815
9823
|
stream
|
|
9816
9824
|
} = evalBodySchema.parse(req.body);
|
|
9817
|
-
if (!_optionalChain([req, 'access',
|
|
9825
|
+
if (!_optionalChain([req, 'access', _103 => _103.ctx, 'optionalAccess', _104 => _104.state])) {
|
|
9818
9826
|
res.status(500).json({ error: "Braintrust state not initialized in request" });
|
|
9819
9827
|
return;
|
|
9820
9828
|
}
|
|
@@ -9871,12 +9879,12 @@ function runDevServer(evaluators, opts) {
|
|
|
9871
9879
|
...evaluator,
|
|
9872
9880
|
data: evalData.data,
|
|
9873
9881
|
scores: evaluator.scores.concat(
|
|
9874
|
-
_nullishCoalesce(_optionalChain([scores, 'optionalAccess',
|
|
9882
|
+
_nullishCoalesce(_optionalChain([scores, 'optionalAccess', _105 => _105.map, 'call', _106 => _106(
|
|
9875
9883
|
(score) => makeScorer(
|
|
9876
9884
|
state,
|
|
9877
9885
|
score.name,
|
|
9878
9886
|
score.function_id,
|
|
9879
|
-
_optionalChain([req, 'access',
|
|
9887
|
+
_optionalChain([req, 'access', _107 => _107.ctx, 'optionalAccess', _108 => _108.projectId])
|
|
9880
9888
|
)
|
|
9881
9889
|
)]), () => ( []))
|
|
9882
9890
|
),
|
package/dev/dist/index.mjs
CHANGED
|
@@ -5852,7 +5852,7 @@ function validateAndSanitizeExperimentLogFullArgs(event, hasDataset) {
|
|
|
5852
5852
|
}
|
|
5853
5853
|
return event;
|
|
5854
5854
|
}
|
|
5855
|
-
var
|
|
5855
|
+
var DEFAULT_FETCH_BATCH_SIZE = 1e3;
|
|
5856
5856
|
var MAX_BTQL_ITERATIONS = 1e4;
|
|
5857
5857
|
var ObjectFetcher = class {
|
|
5858
5858
|
constructor(objectType, pinnedVersion, mutateRecord, _internal_btql) {
|
|
@@ -5868,9 +5868,10 @@ var ObjectFetcher = class {
|
|
|
5868
5868
|
async getState() {
|
|
5869
5869
|
throw new Error("ObjectFetcher subclasses must have a 'getState' method");
|
|
5870
5870
|
}
|
|
5871
|
-
async *fetchRecordsFromApi() {
|
|
5871
|
+
async *fetchRecordsFromApi(batchSize) {
|
|
5872
5872
|
const state = await this.getState();
|
|
5873
5873
|
const objectId = await this.id;
|
|
5874
|
+
const limit = batchSize ?? DEFAULT_FETCH_BATCH_SIZE;
|
|
5874
5875
|
let cursor = void 0;
|
|
5875
5876
|
let iterations = 0;
|
|
5876
5877
|
while (true) {
|
|
@@ -5898,7 +5899,7 @@ var ObjectFetcher = class {
|
|
|
5898
5899
|
]
|
|
5899
5900
|
},
|
|
5900
5901
|
cursor,
|
|
5901
|
-
limit
|
|
5902
|
+
limit
|
|
5902
5903
|
},
|
|
5903
5904
|
use_columnstore: false,
|
|
5904
5905
|
brainstore_realtime: true,
|
|
@@ -5924,24 +5925,31 @@ var ObjectFetcher = class {
|
|
|
5924
5925
|
}
|
|
5925
5926
|
}
|
|
5926
5927
|
}
|
|
5927
|
-
|
|
5928
|
+
/**
|
|
5929
|
+
* Fetch all records from the object.
|
|
5930
|
+
*
|
|
5931
|
+
* @param options Optional parameters for fetching.
|
|
5932
|
+
* @param options.batchSize The number of records to fetch per request. Defaults to 1000.
|
|
5933
|
+
* @returns An async generator of records.
|
|
5934
|
+
*/
|
|
5935
|
+
async *fetch(options) {
|
|
5928
5936
|
if (this._fetchedData !== void 0) {
|
|
5929
5937
|
for (const record of this._fetchedData) {
|
|
5930
5938
|
yield record;
|
|
5931
5939
|
}
|
|
5932
5940
|
return;
|
|
5933
5941
|
}
|
|
5934
|
-
for await (const record of this.fetchRecordsFromApi()) {
|
|
5942
|
+
for await (const record of this.fetchRecordsFromApi(options?.batchSize)) {
|
|
5935
5943
|
yield record;
|
|
5936
5944
|
}
|
|
5937
5945
|
}
|
|
5938
5946
|
[Symbol.asyncIterator]() {
|
|
5939
5947
|
return this.fetch();
|
|
5940
5948
|
}
|
|
5941
|
-
async fetchedData() {
|
|
5949
|
+
async fetchedData(options) {
|
|
5942
5950
|
if (this._fetchedData === void 0) {
|
|
5943
5951
|
const data = [];
|
|
5944
|
-
for await (const record of this.fetchRecordsFromApi()) {
|
|
5952
|
+
for await (const record of this.fetchRecordsFromApi(options?.batchSize)) {
|
|
5945
5953
|
data.push(record);
|
|
5946
5954
|
}
|
|
5947
5955
|
this._fetchedData = data;
|
|
@@ -5951,12 +5959,12 @@ var ObjectFetcher = class {
|
|
|
5951
5959
|
clearCache() {
|
|
5952
5960
|
this._fetchedData = void 0;
|
|
5953
5961
|
}
|
|
5954
|
-
async version() {
|
|
5962
|
+
async version(options) {
|
|
5955
5963
|
if (this.pinnedVersion !== void 0) {
|
|
5956
5964
|
return this.pinnedVersion;
|
|
5957
5965
|
} else {
|
|
5958
5966
|
let maxVersion = void 0;
|
|
5959
|
-
for await (const record of this.fetch()) {
|
|
5967
|
+
for await (const record of this.fetch(options)) {
|
|
5960
5968
|
const xactId = String(record[TRANSACTION_ID_FIELD] ?? "0");
|
|
5961
5969
|
if (maxVersion === void 0 || xactId > maxVersion) {
|
|
5962
5970
|
maxVersion = xactId;
|
|
@@ -6264,8 +6272,8 @@ var ReadonlyExperiment = class extends ObjectFetcher {
|
|
|
6264
6272
|
await this.lazyMetadata.get();
|
|
6265
6273
|
return this.state;
|
|
6266
6274
|
}
|
|
6267
|
-
async *asDataset() {
|
|
6268
|
-
const records = this.fetch();
|
|
6275
|
+
async *asDataset(options) {
|
|
6276
|
+
const records = this.fetch(options);
|
|
6269
6277
|
for await (const record of records) {
|
|
6270
6278
|
if (record.root_span_id !== record.span_id) {
|
|
6271
6279
|
continue;
|
package/dist/browser.d.mts
CHANGED
|
@@ -16629,7 +16629,7 @@ declare function extractAttachments(event: Record<string, any>, attachments: Bas
|
|
|
16629
16629
|
type WithTransactionId<R> = R & {
|
|
16630
16630
|
[TRANSACTION_ID_FIELD]: TransactionId;
|
|
16631
16631
|
};
|
|
16632
|
-
declare const
|
|
16632
|
+
declare const DEFAULT_FETCH_BATCH_SIZE = 1000;
|
|
16633
16633
|
declare class ObjectFetcher<RecordType> implements AsyncIterable<WithTransactionId<RecordType>> {
|
|
16634
16634
|
private objectType;
|
|
16635
16635
|
private pinnedVersion;
|
|
@@ -16640,11 +16640,24 @@ declare class ObjectFetcher<RecordType> implements AsyncIterable<WithTransaction
|
|
|
16640
16640
|
get id(): Promise<string>;
|
|
16641
16641
|
protected getState(): Promise<BraintrustState>;
|
|
16642
16642
|
private fetchRecordsFromApi;
|
|
16643
|
-
|
|
16643
|
+
/**
|
|
16644
|
+
* Fetch all records from the object.
|
|
16645
|
+
*
|
|
16646
|
+
* @param options Optional parameters for fetching.
|
|
16647
|
+
* @param options.batchSize The number of records to fetch per request. Defaults to 1000.
|
|
16648
|
+
* @returns An async generator of records.
|
|
16649
|
+
*/
|
|
16650
|
+
fetch(options?: {
|
|
16651
|
+
batchSize?: number;
|
|
16652
|
+
}): AsyncGenerator<WithTransactionId<RecordType>>;
|
|
16644
16653
|
[Symbol.asyncIterator](): AsyncIterator<WithTransactionId<RecordType>>;
|
|
16645
|
-
fetchedData(
|
|
16654
|
+
fetchedData(options?: {
|
|
16655
|
+
batchSize?: number;
|
|
16656
|
+
}): Promise<WithTransactionId<RecordType>[]>;
|
|
16646
16657
|
clearCache(): void;
|
|
16647
|
-
version(
|
|
16658
|
+
version(options?: {
|
|
16659
|
+
batchSize?: number;
|
|
16660
|
+
}): Promise<string | undefined>;
|
|
16648
16661
|
}
|
|
16649
16662
|
type BaseMetadata = Record<string, unknown> | void;
|
|
16650
16663
|
type DefaultMetadataType = void;
|
|
@@ -16789,7 +16802,9 @@ declare class ReadonlyExperiment extends ObjectFetcher<ExperimentEvent> {
|
|
|
16789
16802
|
get name(): Promise<string>;
|
|
16790
16803
|
get loggingState(): BraintrustState;
|
|
16791
16804
|
protected getState(): Promise<BraintrustState>;
|
|
16792
|
-
asDataset<Input, Expected, Metadata = DefaultMetadataType>(
|
|
16805
|
+
asDataset<Input, Expected, Metadata = DefaultMetadataType>(options?: {
|
|
16806
|
+
batchSize?: number;
|
|
16807
|
+
}): AsyncGenerator<EvalCase<Input, Expected, Metadata>>;
|
|
16793
16808
|
}
|
|
16794
16809
|
declare function newId(): string;
|
|
16795
16810
|
/**
|
|
@@ -17558,8 +17573,8 @@ interface WrapAISDKOptions {
|
|
|
17558
17573
|
}
|
|
17559
17574
|
/**
|
|
17560
17575
|
* Wraps Vercel AI SDK methods with Braintrust tracing. Returns wrapped versions
|
|
17561
|
-
* of generateText, streamText, generateObject,
|
|
17562
|
-
* create spans and log inputs, outputs, and metrics.
|
|
17576
|
+
* of generateText, streamText, generateObject, streamObject, Agent, experimental_Agent,
|
|
17577
|
+
* and ToolLoopAgent that automatically create spans and log inputs, outputs, and metrics.
|
|
17563
17578
|
*
|
|
17564
17579
|
* @param ai - The AI SDK namespace (e.g., import * as ai from "ai")
|
|
17565
17580
|
* @returns Object with AI SDK methods with Braintrust tracing
|
|
@@ -17569,12 +17584,15 @@ interface WrapAISDKOptions {
|
|
|
17569
17584
|
* import { wrapAISDK } from "braintrust";
|
|
17570
17585
|
* import * as ai from "ai";
|
|
17571
17586
|
*
|
|
17572
|
-
* const { generateText, streamText, generateObject, streamObject } = wrapAISDK(ai);
|
|
17587
|
+
* const { generateText, streamText, generateObject, streamObject, Agent } = wrapAISDK(ai);
|
|
17573
17588
|
*
|
|
17574
17589
|
* const result = await generateText({
|
|
17575
17590
|
* model: openai("gpt-4"),
|
|
17576
17591
|
* prompt: "Hello world"
|
|
17577
17592
|
* });
|
|
17593
|
+
*
|
|
17594
|
+
* const agent = new Agent({ model: openai("gpt-4") });
|
|
17595
|
+
* const agentResult = await agent.generate({ prompt: "Hello from agent" });
|
|
17578
17596
|
* ```
|
|
17579
17597
|
*/
|
|
17580
17598
|
declare function wrapAISDK<T>(aiSDK: T, options?: WrapAISDKOptions): T;
|
|
@@ -28713,6 +28731,7 @@ type braintrust_CompletionPrompt = CompletionPrompt;
|
|
|
28713
28731
|
type braintrust_ContextManager = ContextManager;
|
|
28714
28732
|
declare const braintrust_ContextManager: typeof ContextManager;
|
|
28715
28733
|
type braintrust_ContextParentSpanIds = ContextParentSpanIds;
|
|
28734
|
+
declare const braintrust_DEFAULT_FETCH_BATCH_SIZE: typeof DEFAULT_FETCH_BATCH_SIZE;
|
|
28716
28735
|
type braintrust_DataSummary = DataSummary;
|
|
28717
28736
|
type braintrust_Dataset<IsLegacyDataset extends boolean = typeof DEFAULT_IS_LEGACY_DATASET> = Dataset<IsLegacyDataset>;
|
|
28718
28737
|
declare const braintrust_Dataset: typeof Dataset;
|
|
@@ -28744,7 +28763,6 @@ type braintrust_FullInitOptions<IsOpen extends boolean> = FullInitOptions<IsOpen
|
|
|
28744
28763
|
type braintrust_FullLoginOptions = FullLoginOptions;
|
|
28745
28764
|
type braintrust_IDGenerator = IDGenerator;
|
|
28746
28765
|
declare const braintrust_IDGenerator: typeof IDGenerator;
|
|
28747
|
-
declare const braintrust_INTERNAL_BTQL_LIMIT: typeof INTERNAL_BTQL_LIMIT;
|
|
28748
28766
|
type braintrust_IdField = IdField;
|
|
28749
28767
|
type braintrust_InitDatasetOptions<IsLegacyDataset extends boolean> = InitDatasetOptions<IsLegacyDataset>;
|
|
28750
28768
|
type braintrust_InitLoggerOptions<IsAsyncFlush> = InitLoggerOptions<IsAsyncFlush>;
|
|
@@ -28852,7 +28870,7 @@ declare const braintrust_wrapOpenAI: typeof wrapOpenAI;
|
|
|
28852
28870
|
declare const braintrust_wrapOpenAIv4: typeof wrapOpenAIv4;
|
|
28853
28871
|
declare const braintrust_wrapTraced: typeof wrapTraced;
|
|
28854
28872
|
declare namespace braintrust {
|
|
28855
|
-
export { type braintrust_AnyDataset as AnyDataset, braintrust_Attachment as Attachment, type braintrust_AttachmentParams as AttachmentParams, braintrust_AttachmentReference as AttachmentReference, type braintrust_BackgroundLoggerOpts as BackgroundLoggerOpts, braintrust_BaseAttachment as BaseAttachment, type braintrust_BaseMetadata as BaseMetadata, braintrust_BraintrustMiddleware as BraintrustMiddleware, braintrust_BraintrustState as BraintrustState, braintrust_BraintrustStream as BraintrustStream, type braintrust_BraintrustStreamChunk as BraintrustStreamChunk, type braintrust_ChatPrompt as ChatPrompt, type braintrust_CommentEvent as CommentEvent, type braintrust_CompiledPrompt as CompiledPrompt, type braintrust_CompiledPromptParams as CompiledPromptParams, type braintrust_CompletionPrompt as CompletionPrompt, braintrust_ContextManager as ContextManager, type braintrust_ContextParentSpanIds as ContextParentSpanIds, type braintrust_DataSummary as DataSummary, braintrust_Dataset as Dataset, type braintrust_DatasetRecord as DatasetRecord, type braintrust_DatasetSummary as DatasetSummary, type braintrust_DefaultMetadataType as DefaultMetadataType, type braintrust_DefaultPromptArgs as DefaultPromptArgs, braintrust_ERR_PERMALINK as ERR_PERMALINK, type braintrust_EndSpanArgs as EndSpanArgs, type braintrust_EvalCase as EvalCase, type braintrust_EvalParameterSerializedSchema as EvalParameterSerializedSchema, type braintrust_EvalParameters as EvalParameters, type braintrust_EvaluatorDefinition as EvaluatorDefinition, type braintrust_EvaluatorDefinitions as EvaluatorDefinitions, type braintrust_EvaluatorManifest as EvaluatorManifest, braintrust_Experiment as Experiment, type braintrust_ExperimentLogFullArgs as ExperimentLogFullArgs, type braintrust_ExperimentLogPartialArgs as ExperimentLogPartialArgs, type braintrust_ExperimentSummary as ExperimentSummary, type braintrust_Exportable as Exportable, braintrust_ExternalAttachment as ExternalAttachment, type braintrust_ExternalAttachmentParams as ExternalAttachmentParams, braintrust_FailedHTTPResponse as FailedHTTPResponse, type braintrust_FullInitDatasetOptions as FullInitDatasetOptions, type braintrust_FullInitOptions as FullInitOptions, type braintrust_FullLoginOptions as FullLoginOptions, braintrust_IDGenerator as IDGenerator,
|
|
28873
|
+
export { type braintrust_AnyDataset as AnyDataset, braintrust_Attachment as Attachment, type braintrust_AttachmentParams as AttachmentParams, braintrust_AttachmentReference as AttachmentReference, type braintrust_BackgroundLoggerOpts as BackgroundLoggerOpts, braintrust_BaseAttachment as BaseAttachment, type braintrust_BaseMetadata as BaseMetadata, braintrust_BraintrustMiddleware as BraintrustMiddleware, braintrust_BraintrustState as BraintrustState, braintrust_BraintrustStream as BraintrustStream, type braintrust_BraintrustStreamChunk as BraintrustStreamChunk, type braintrust_ChatPrompt as ChatPrompt, type braintrust_CommentEvent as CommentEvent, type braintrust_CompiledPrompt as CompiledPrompt, type braintrust_CompiledPromptParams as CompiledPromptParams, type braintrust_CompletionPrompt as CompletionPrompt, braintrust_ContextManager as ContextManager, type braintrust_ContextParentSpanIds as ContextParentSpanIds, braintrust_DEFAULT_FETCH_BATCH_SIZE as DEFAULT_FETCH_BATCH_SIZE, type braintrust_DataSummary as DataSummary, braintrust_Dataset as Dataset, type braintrust_DatasetRecord as DatasetRecord, type braintrust_DatasetSummary as DatasetSummary, type braintrust_DefaultMetadataType as DefaultMetadataType, type braintrust_DefaultPromptArgs as DefaultPromptArgs, braintrust_ERR_PERMALINK as ERR_PERMALINK, type braintrust_EndSpanArgs as EndSpanArgs, type braintrust_EvalCase as EvalCase, type braintrust_EvalParameterSerializedSchema as EvalParameterSerializedSchema, type braintrust_EvalParameters as EvalParameters, type braintrust_EvaluatorDefinition as EvaluatorDefinition, type braintrust_EvaluatorDefinitions as EvaluatorDefinitions, type braintrust_EvaluatorManifest as EvaluatorManifest, braintrust_Experiment as Experiment, type braintrust_ExperimentLogFullArgs as ExperimentLogFullArgs, type braintrust_ExperimentLogPartialArgs as ExperimentLogPartialArgs, type braintrust_ExperimentSummary as ExperimentSummary, type braintrust_Exportable as Exportable, braintrust_ExternalAttachment as ExternalAttachment, type braintrust_ExternalAttachmentParams as ExternalAttachmentParams, braintrust_FailedHTTPResponse as FailedHTTPResponse, type braintrust_FullInitDatasetOptions as FullInitDatasetOptions, type braintrust_FullInitOptions as FullInitOptions, type braintrust_FullLoginOptions as FullLoginOptions, braintrust_IDGenerator as IDGenerator, type braintrust_IdField as IdField, type braintrust_InitDatasetOptions as InitDatasetOptions, type braintrust_InitLoggerOptions as InitLoggerOptions, type braintrust_InitOptions as InitOptions, type braintrust_InputField as InputField, type braintrust_InvokeFunctionArgs as InvokeFunctionArgs, type braintrust_InvokeReturn as InvokeReturn, braintrust_JSONAttachment as JSONAttachment, braintrust_LEGACY_CACHED_HEADER as LEGACY_CACHED_HEADER, braintrust_LazyValue as LazyValue, type braintrust_LoadPromptOptions as LoadPromptOptions, type braintrust_LogCommentFullArgs as LogCommentFullArgs, type braintrust_LogFeedbackFullArgs as LogFeedbackFullArgs, type braintrust_LogOptions as LogOptions, braintrust_Logger as Logger, braintrust_LoginInvalidOrgError as LoginInvalidOrgError, type braintrust_LoginOptions as LoginOptions, type braintrust_MetricSummary as MetricSummary, braintrust_NOOP_SPAN as NOOP_SPAN, braintrust_NOOP_SPAN_PERMALINK as NOOP_SPAN_PERMALINK, braintrust_NoopSpan as NoopSpan, type braintrust_ObjectMetadata as ObjectMetadata, type braintrust_OtherExperimentLogFields as OtherExperimentLogFields, type braintrust_ParentExperimentIds as ParentExperimentIds, type braintrust_ParentProjectLogIds as ParentProjectLogIds, type braintrust_PromiseUnless as PromiseUnless, braintrust_Prompt as Prompt, type braintrust_PromptRowWithId as PromptRowWithId, braintrust_ReadonlyAttachment as ReadonlyAttachment, braintrust_ReadonlyExperiment as ReadonlyExperiment, type braintrust_ScoreSummary as ScoreSummary, type braintrust_SerializedBraintrustState as SerializedBraintrustState, type braintrust_SetCurrentArg as SetCurrentArg, type braintrust_Span as Span, braintrust_SpanImpl as SpanImpl, type braintrust_StartSpanArgs as StartSpanArgs, braintrust_TestBackgroundLogger as TestBackgroundLogger, braintrust_UUIDGenerator as UUIDGenerator, type braintrust_WithTransactionId as WithTransactionId, braintrust_X_CACHED_HEADER as X_CACHED_HEADER, braintrust__exportsForTestingOnly as _exportsForTestingOnly, braintrust__internalGetGlobalState as _internalGetGlobalState, braintrust__internalSetInitialState as _internalSetInitialState, braintrust_braintrustStreamChunkSchema as braintrustStreamChunkSchema, braintrust_createFinalValuePassThroughStream as createFinalValuePassThroughStream, braintrust_currentExperiment as currentExperiment, braintrust_currentLogger as currentLogger, braintrust_currentSpan as currentSpan, braintrust_deepCopyEvent as deepCopyEvent, braintrust_deserializePlainStringAsJSON as deserializePlainStringAsJSON, braintrust_devNullWritableStream as devNullWritableStream, braintrust_evaluatorDefinitionSchema as evaluatorDefinitionSchema, braintrust_evaluatorDefinitionsSchema as evaluatorDefinitionsSchema, braintrust_flush as flush, braintrust_getContextManager as getContextManager, braintrust_getIdGenerator as getIdGenerator, braintrust_getPromptVersions as getPromptVersions, braintrust_getSpanParentObject as getSpanParentObject, graphFramework as graph, braintrust_init as init, braintrust_initDataset as initDataset, braintrust_initExperiment as initExperiment, braintrust_initFunction as initFunction, braintrust_initLogger as initLogger, braintrust_invoke as invoke, braintrust_loadPrompt as loadPrompt, braintrust_log as log, braintrust_logError as logError, braintrust_login as login, braintrust_loginToState as loginToState, braintrust_newId as newId, braintrust_parseCachedHeader as parseCachedHeader, braintrust_permalink as permalink, braintrust_renderMessage as renderMessage, braintrust_renderPromptParams as renderPromptParams, braintrust_setFetch as setFetch, braintrust_setMaskingFunction as setMaskingFunction, braintrust_spanComponentsToObjectId as spanComponentsToObjectId, braintrust_startSpan as startSpan, braintrust_summarize as summarize, braintrust_traceable as traceable, braintrust_traced as traced, braintrust_updateSpan as updateSpan, braintrust_withCurrent as withCurrent, braintrust_withDataset as withDataset, braintrust_withExperiment as withExperiment, braintrust_withLogger as withLogger, braintrust_withParent as withParent, braintrust_wrapAISDK as wrapAISDK, braintrust_wrapAnthropic as wrapAnthropic, braintrust_wrapClaudeAgentSDK as wrapClaudeAgentSDK, braintrust_wrapGoogleGenAI as wrapGoogleGenAI, braintrust_wrapMastraAgent as wrapMastraAgent, braintrust_wrapOpenAI as wrapOpenAI, braintrust_wrapOpenAIv4 as wrapOpenAIv4, braintrust_wrapTraced as wrapTraced };
|
|
28856
28874
|
}
|
|
28857
28875
|
|
|
28858
|
-
export { type AnyDataset, Attachment, type AttachmentParams, AttachmentReference, type BackgroundLoggerOpts, BaseAttachment, type BaseMetadata, BraintrustMiddleware, BraintrustState, BraintrustStream, type BraintrustStreamChunk, type ChatPrompt, type CommentEvent, type CompiledPrompt, type CompiledPromptParams, type CompletionPrompt, ContextManager, type ContextParentSpanIds, type DataSummary, Dataset, type DatasetRecord, type DatasetSummary, type DefaultMetadataType, type DefaultPromptArgs, ERR_PERMALINK, type EndSpanArgs, type EvalCase, type EvalParameterSerializedSchema, type EvalParameters, type EvaluatorDefinition, type EvaluatorDefinitions, type EvaluatorManifest, Experiment, type ExperimentLogFullArgs, type ExperimentLogPartialArgs, type ExperimentSummary, type Exportable, ExternalAttachment, type ExternalAttachmentParams, FailedHTTPResponse, type FullInitDatasetOptions, type FullInitOptions, type FullLoginOptions, IDGenerator,
|
|
28876
|
+
export { type AnyDataset, Attachment, type AttachmentParams, AttachmentReference, type BackgroundLoggerOpts, BaseAttachment, type BaseMetadata, BraintrustMiddleware, BraintrustState, BraintrustStream, type BraintrustStreamChunk, type ChatPrompt, type CommentEvent, type CompiledPrompt, type CompiledPromptParams, type CompletionPrompt, ContextManager, type ContextParentSpanIds, DEFAULT_FETCH_BATCH_SIZE, type DataSummary, Dataset, type DatasetRecord, type DatasetSummary, type DefaultMetadataType, type DefaultPromptArgs, ERR_PERMALINK, type EndSpanArgs, type EvalCase, type EvalParameterSerializedSchema, type EvalParameters, type EvaluatorDefinition, type EvaluatorDefinitions, type EvaluatorManifest, Experiment, type ExperimentLogFullArgs, type ExperimentLogPartialArgs, type ExperimentSummary, type Exportable, ExternalAttachment, type ExternalAttachmentParams, FailedHTTPResponse, type FullInitDatasetOptions, type FullInitOptions, type FullLoginOptions, IDGenerator, type IdField, type InitDatasetOptions, type InitLoggerOptions, type InitOptions, type InputField, type InvokeFunctionArgs, type InvokeReturn, JSONAttachment, LEGACY_CACHED_HEADER, LazyValue, type LoadPromptOptions, type LogCommentFullArgs, type LogFeedbackFullArgs, type LogOptions, Logger, LoginInvalidOrgError, type LoginOptions, type MetricSummary, NOOP_SPAN, NOOP_SPAN_PERMALINK, NoopSpan, type ObjectMetadata, type OtherExperimentLogFields, type ParentExperimentIds, type ParentProjectLogIds, type PromiseUnless, Prompt, type PromptRowWithId, ReadonlyAttachment, ReadonlyExperiment, type ScoreSummary, type SerializedBraintrustState, type SetCurrentArg, type Span, SpanImpl, type StartSpanArgs, TestBackgroundLogger, UUIDGenerator, type WithTransactionId, X_CACHED_HEADER, _exportsForTestingOnly, _internalGetGlobalState, _internalSetInitialState, braintrustStreamChunkSchema, createFinalValuePassThroughStream, currentExperiment, currentLogger, currentSpan, deepCopyEvent, braintrust as default, deserializePlainStringAsJSON, devNullWritableStream, evaluatorDefinitionSchema, evaluatorDefinitionsSchema, flush, getContextManager, getIdGenerator, getPromptVersions, getSpanParentObject, graphFramework as graph, init, initDataset, initExperiment, initFunction, initLogger, invoke, loadPrompt, log, logError, login, loginToState, newId, parseCachedHeader, permalink, renderMessage, renderPromptParams, setFetch, setMaskingFunction, spanComponentsToObjectId, startSpan, summarize, traceable, traced, updateSpan, withCurrent, withDataset, withExperiment, withLogger, withParent, wrapAISDK, wrapAnthropic, wrapClaudeAgentSDK, wrapGoogleGenAI, wrapMastraAgent, wrapOpenAI, wrapOpenAIv4, wrapTraced };
|