braintrust 0.0.158 → 0.0.159
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/dist/browser.d.mts +201 -11
- package/dist/browser.d.ts +201 -11
- package/dist/browser.js +137 -18
- package/dist/browser.mjs +146 -19
- package/dist/cli.js +1432 -354
- package/dist/index.d.mts +436 -13
- package/dist/index.d.ts +436 -13
- package/dist/index.js +364 -34
- package/dist/index.mjs +366 -35
- package/package.json +5 -3
- package/tsup.config.ts +1 -1
- package/turbo.json +2 -1
package/dist/browser.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { GitMetadataSettings, LogFeedbackFullArgs, ExperimentEvent, BackgroundLogEvent, ExperimentLogFullArgs, ExperimentLogPartialArgs, IdField, SpanType, RepoInfo, DEFAULT_IS_LEGACY_DATASET, TRANSACTION_ID_FIELD, TransactionId, SpanObjectTypeV3, DatasetRecord } from '@braintrust/core';
|
|
2
|
-
import { PromptData, OpenAIMessage, Tools, AnyModelParam, Message, Prompt as Prompt$1, PromptSessionEvent } from '@braintrust/core/typespecs';
|
|
2
|
+
import { PromptData, OpenAIMessage, Tools, AnyModelParam, Message, Prompt as Prompt$1, PromptSessionEvent, StreamingMode } from '@braintrust/core/typespecs';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
5
5
|
interface IsoAsyncLocalStorage<T> {
|
|
@@ -213,6 +213,12 @@ declare class BraintrustState {
|
|
|
213
213
|
}
|
|
214
214
|
declare function _internalSetInitialState(): void;
|
|
215
215
|
declare const _internalGetGlobalState: () => BraintrustState;
|
|
216
|
+
declare class FailedHTTPResponse extends Error {
|
|
217
|
+
status: number;
|
|
218
|
+
text: string;
|
|
219
|
+
data: any;
|
|
220
|
+
constructor(status: number, text: string, data?: any);
|
|
221
|
+
}
|
|
216
222
|
declare class HTTPConnection {
|
|
217
223
|
base_url: string;
|
|
218
224
|
token: string | null;
|
|
@@ -225,9 +231,9 @@ declare class HTTPConnection {
|
|
|
225
231
|
static sanitize_token(token: string): string;
|
|
226
232
|
set_token(token: string): void;
|
|
227
233
|
_reset(): void;
|
|
228
|
-
get(path: string, params?: Record<string, string | undefined> | undefined, config?: RequestInit): Promise<Response>;
|
|
234
|
+
get(path: string, params?: Record<string, string | string[] | undefined> | undefined, config?: RequestInit): Promise<Response>;
|
|
229
235
|
post(path: string, params?: Record<string, unknown> | string, config?: RequestInit): Promise<Response>;
|
|
230
|
-
get_json(object_type: string, args?: Record<string, string | undefined> | undefined, retries?: number): Promise<any>;
|
|
236
|
+
get_json(object_type: string, args?: Record<string, string | string[] | undefined> | undefined, retries?: number): Promise<any>;
|
|
231
237
|
post_json(object_type: string, args?: Record<string, unknown> | string | undefined): Promise<any>;
|
|
232
238
|
}
|
|
233
239
|
interface ObjectMetadata {
|
|
@@ -538,7 +544,7 @@ type LoadPromptOptions = FullLoginOptions & {
|
|
|
538
544
|
* });
|
|
539
545
|
* ```
|
|
540
546
|
*/
|
|
541
|
-
declare function loadPrompt({ projectName, projectId, slug, version, defaults, noTrace, appUrl, apiKey, orgName, fetch, forceLogin, state: stateArg, }: LoadPromptOptions): Promise<Prompt
|
|
547
|
+
declare function loadPrompt({ projectName, projectId, slug, version, defaults, noTrace, appUrl, apiKey, orgName, fetch, forceLogin, state: stateArg, }: LoadPromptOptions): Promise<Prompt<true, true>>;
|
|
542
548
|
/**
|
|
543
549
|
* Options for logging in to Braintrust.
|
|
544
550
|
*/
|
|
@@ -982,19 +988,20 @@ type CompiledPrompt<Flavor extends "chat" | "completion"> = CompiledPromptParams
|
|
|
982
988
|
} & (Flavor extends "chat" ? ChatPrompt : Flavor extends "completion" ? CompletionPrompt : {});
|
|
983
989
|
type DefaultPromptArgs = Partial<CompiledPromptParams & AnyModelParam & ChatPrompt & CompletionPrompt>;
|
|
984
990
|
declare function renderMessage<T extends Message>(render: (template: string) => string, message: T): T;
|
|
985
|
-
|
|
991
|
+
type PromptRowWithId<HasId extends boolean = true, HasVersion extends boolean = true> = Omit<Prompt$1, "log_id" | "org_id" | "project_id" | "id" | "_xact_id"> & Partial<Pick<Prompt$1, "project_id">> & (HasId extends true ? Pick<Prompt$1, "id"> : Partial<Pick<Prompt$1, "id">>) & (HasVersion extends true ? Pick<Prompt$1, "_xact_id"> : Partial<Pick<Prompt$1, "_xact_id">>);
|
|
992
|
+
declare class Prompt<HasId extends boolean = true, HasVersion extends boolean = true> {
|
|
986
993
|
private metadata;
|
|
987
994
|
private defaults;
|
|
988
995
|
private noTrace;
|
|
989
996
|
private parsedPromptData;
|
|
990
997
|
private hasParsedPromptData;
|
|
991
|
-
constructor(metadata:
|
|
992
|
-
get id(): string;
|
|
993
|
-
get projectId(): string;
|
|
998
|
+
constructor(metadata: PromptRowWithId<HasId, HasVersion> | PromptSessionEvent, defaults: DefaultPromptArgs, noTrace: boolean);
|
|
999
|
+
get id(): HasId extends true ? string : string | undefined;
|
|
1000
|
+
get projectId(): string | undefined;
|
|
994
1001
|
get name(): string;
|
|
995
1002
|
get slug(): string;
|
|
996
1003
|
get prompt(): PromptData["prompt"];
|
|
997
|
-
get version(): TransactionId;
|
|
1004
|
+
get version(): HasId extends true ? TransactionId : TransactionId | undefined;
|
|
998
1005
|
get options(): NonNullable<PromptData["options"]>;
|
|
999
1006
|
/**
|
|
1000
1007
|
* Build the prompt with the given formatting options. The args you pass in will
|
|
@@ -1005,6 +1012,7 @@ declare class Prompt {
|
|
|
1005
1012
|
*/
|
|
1006
1013
|
build<Flavor extends "chat" | "completion" = "chat">(buildArgs: unknown, options?: {
|
|
1007
1014
|
flavor?: Flavor;
|
|
1015
|
+
messages?: Message[];
|
|
1008
1016
|
}): CompiledPrompt<Flavor>;
|
|
1009
1017
|
private runBuild;
|
|
1010
1018
|
private getParsedPromptData;
|
|
@@ -1108,6 +1116,82 @@ declare const braintrustStreamChunkSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
1108
1116
|
}, {
|
|
1109
1117
|
data: string;
|
|
1110
1118
|
type: "json_delta";
|
|
1119
|
+
}>, z.ZodObject<{
|
|
1120
|
+
type: z.ZodLiteral<"error">;
|
|
1121
|
+
data: z.ZodString;
|
|
1122
|
+
}, "strip", z.ZodTypeAny, {
|
|
1123
|
+
data: string;
|
|
1124
|
+
type: "error";
|
|
1125
|
+
}, {
|
|
1126
|
+
data: string;
|
|
1127
|
+
type: "error";
|
|
1128
|
+
}>, z.ZodObject<{
|
|
1129
|
+
type: z.ZodLiteral<"progress">;
|
|
1130
|
+
data: z.ZodObject<{
|
|
1131
|
+
id: z.ZodString;
|
|
1132
|
+
object_type: z.ZodEnum<["prompt", "tool", "scorer", "task"]>;
|
|
1133
|
+
format: z.ZodEnum<["llm", "code", "global"]>;
|
|
1134
|
+
output_type: z.ZodEnum<["completion", "score", "any"]>;
|
|
1135
|
+
name: z.ZodString;
|
|
1136
|
+
event: z.ZodEnum<["text_delta", "json_delta", "error", "start", "done"]>;
|
|
1137
|
+
data: z.ZodString;
|
|
1138
|
+
}, "strip", z.ZodTypeAny, {
|
|
1139
|
+
format: "code" | "global" | "llm";
|
|
1140
|
+
data: string;
|
|
1141
|
+
name: string;
|
|
1142
|
+
id: string;
|
|
1143
|
+
object_type: "prompt" | "tool" | "scorer" | "task";
|
|
1144
|
+
event: "error" | "text_delta" | "json_delta" | "start" | "done";
|
|
1145
|
+
output_type: "completion" | "score" | "any";
|
|
1146
|
+
}, {
|
|
1147
|
+
format: "code" | "global" | "llm";
|
|
1148
|
+
data: string;
|
|
1149
|
+
name: string;
|
|
1150
|
+
id: string;
|
|
1151
|
+
object_type: "prompt" | "tool" | "scorer" | "task";
|
|
1152
|
+
event: "error" | "text_delta" | "json_delta" | "start" | "done";
|
|
1153
|
+
output_type: "completion" | "score" | "any";
|
|
1154
|
+
}>;
|
|
1155
|
+
}, "strip", z.ZodTypeAny, {
|
|
1156
|
+
data: {
|
|
1157
|
+
format: "code" | "global" | "llm";
|
|
1158
|
+
data: string;
|
|
1159
|
+
name: string;
|
|
1160
|
+
id: string;
|
|
1161
|
+
object_type: "prompt" | "tool" | "scorer" | "task";
|
|
1162
|
+
event: "error" | "text_delta" | "json_delta" | "start" | "done";
|
|
1163
|
+
output_type: "completion" | "score" | "any";
|
|
1164
|
+
};
|
|
1165
|
+
type: "progress";
|
|
1166
|
+
}, {
|
|
1167
|
+
data: {
|
|
1168
|
+
format: "code" | "global" | "llm";
|
|
1169
|
+
data: string;
|
|
1170
|
+
name: string;
|
|
1171
|
+
id: string;
|
|
1172
|
+
object_type: "prompt" | "tool" | "scorer" | "task";
|
|
1173
|
+
event: "error" | "text_delta" | "json_delta" | "start" | "done";
|
|
1174
|
+
output_type: "completion" | "score" | "any";
|
|
1175
|
+
};
|
|
1176
|
+
type: "progress";
|
|
1177
|
+
}>, z.ZodObject<{
|
|
1178
|
+
type: z.ZodLiteral<"start">;
|
|
1179
|
+
data: z.ZodString;
|
|
1180
|
+
}, "strip", z.ZodTypeAny, {
|
|
1181
|
+
data: string;
|
|
1182
|
+
type: "start";
|
|
1183
|
+
}, {
|
|
1184
|
+
data: string;
|
|
1185
|
+
type: "start";
|
|
1186
|
+
}>, z.ZodObject<{
|
|
1187
|
+
type: z.ZodLiteral<"done">;
|
|
1188
|
+
data: z.ZodString;
|
|
1189
|
+
}, "strip", z.ZodTypeAny, {
|
|
1190
|
+
data: string;
|
|
1191
|
+
type: "done";
|
|
1192
|
+
}, {
|
|
1193
|
+
data: string;
|
|
1194
|
+
type: "done";
|
|
1111
1195
|
}>]>;
|
|
1112
1196
|
/**
|
|
1113
1197
|
* A chunk of data from a Braintrust stream. Each chunk type matches
|
|
@@ -1168,7 +1252,7 @@ declare class BraintrustStream {
|
|
|
1168
1252
|
* @param onFinal A function to call with the final value of the stream.
|
|
1169
1253
|
* @returns A new stream that passes through the final value of the stream.
|
|
1170
1254
|
*/
|
|
1171
|
-
declare function createFinalValuePassThroughStream<T extends BraintrustStreamChunk | string | Uint8Array>(onFinal: (result: unknown) => void): TransformStream<T, BraintrustStreamChunk>;
|
|
1255
|
+
declare function createFinalValuePassThroughStream<T extends BraintrustStreamChunk | string | Uint8Array>(onFinal: (result: unknown) => void, onError: (error: unknown) => void): TransformStream<T, BraintrustStreamChunk>;
|
|
1172
1256
|
declare function devNullWritableStream(): WritableStream;
|
|
1173
1257
|
|
|
1174
1258
|
/**
|
|
@@ -1207,6 +1291,10 @@ interface InvokeFunctionArgs<Input, Output, Stream extends boolean = false> {
|
|
|
1207
1291
|
* The input to the function. This will be logged as the `input` field in the span.
|
|
1208
1292
|
*/
|
|
1209
1293
|
input: Input;
|
|
1294
|
+
/**
|
|
1295
|
+
* Additional OpenAI-style messages to add to the prompt (only works for llm functions).
|
|
1296
|
+
*/
|
|
1297
|
+
messages?: Message[];
|
|
1210
1298
|
/**
|
|
1211
1299
|
* The parent of the function. This can be an existing span, logger, or experiment, or
|
|
1212
1300
|
* the output of `.export()` if you are distributed tracing. If unspecified, will use
|
|
@@ -1220,6 +1308,12 @@ interface InvokeFunctionArgs<Input, Output, Stream extends boolean = false> {
|
|
|
1220
1308
|
* object.
|
|
1221
1309
|
*/
|
|
1222
1310
|
stream?: Stream;
|
|
1311
|
+
/**
|
|
1312
|
+
* The mode of the function. If "auto", will return a string if the function returns a string,
|
|
1313
|
+
* and a JSON object otherwise. If "parallel", will return an array of JSON objects with one
|
|
1314
|
+
* object per tool call.
|
|
1315
|
+
*/
|
|
1316
|
+
mode?: StreamingMode;
|
|
1223
1317
|
/**
|
|
1224
1318
|
* A Zod schema to validate the output of the function and return a typed value. This
|
|
1225
1319
|
* is only used if `stream` is false.
|
|
@@ -1281,4 +1375,100 @@ declare const LEGACY_CACHED_HEADER = "x-cached";
|
|
|
1281
1375
|
declare const X_CACHED_HEADER = "x-bt-cached";
|
|
1282
1376
|
declare function parseCachedHeader(value: string | null | undefined): number | undefined;
|
|
1283
1377
|
|
|
1284
|
-
|
|
1378
|
+
type braintrust_AnyDataset = AnyDataset;
|
|
1379
|
+
type braintrust_BackgroundLoggerOpts = BackgroundLoggerOpts;
|
|
1380
|
+
type braintrust_BaseMetadata = BaseMetadata;
|
|
1381
|
+
type braintrust_BraintrustState = BraintrustState;
|
|
1382
|
+
declare const braintrust_BraintrustState: typeof BraintrustState;
|
|
1383
|
+
type braintrust_BraintrustStream = BraintrustStream;
|
|
1384
|
+
declare const braintrust_BraintrustStream: typeof BraintrustStream;
|
|
1385
|
+
type braintrust_BraintrustStreamChunk = BraintrustStreamChunk;
|
|
1386
|
+
type braintrust_ChatPrompt = ChatPrompt;
|
|
1387
|
+
type braintrust_CompiledPrompt<Flavor extends "chat" | "completion"> = CompiledPrompt<Flavor>;
|
|
1388
|
+
type braintrust_CompiledPromptParams = CompiledPromptParams;
|
|
1389
|
+
type braintrust_CompletionPrompt = CompletionPrompt;
|
|
1390
|
+
type braintrust_DataSummary = DataSummary;
|
|
1391
|
+
type braintrust_Dataset<IsLegacyDataset extends boolean = typeof DEFAULT_IS_LEGACY_DATASET> = Dataset<IsLegacyDataset>;
|
|
1392
|
+
declare const braintrust_Dataset: typeof Dataset;
|
|
1393
|
+
type braintrust_DatasetSummary = DatasetSummary;
|
|
1394
|
+
type braintrust_DefaultMetadataType = DefaultMetadataType;
|
|
1395
|
+
type braintrust_DefaultPromptArgs = DefaultPromptArgs;
|
|
1396
|
+
type braintrust_EndSpanArgs = EndSpanArgs;
|
|
1397
|
+
type braintrust_EvalCase<Input, Expected, Metadata> = EvalCase<Input, Expected, Metadata>;
|
|
1398
|
+
type braintrust_Experiment = Experiment;
|
|
1399
|
+
declare const braintrust_Experiment: typeof Experiment;
|
|
1400
|
+
type braintrust_ExperimentSummary = ExperimentSummary;
|
|
1401
|
+
type braintrust_Exportable = Exportable;
|
|
1402
|
+
type braintrust_FailedHTTPResponse = FailedHTTPResponse;
|
|
1403
|
+
declare const braintrust_FailedHTTPResponse: typeof FailedHTTPResponse;
|
|
1404
|
+
type braintrust_FullInitOptions<IsOpen extends boolean> = FullInitOptions<IsOpen>;
|
|
1405
|
+
type braintrust_FullLoginOptions = FullLoginOptions;
|
|
1406
|
+
type braintrust_InitOptions<IsOpen extends boolean> = InitOptions<IsOpen>;
|
|
1407
|
+
type braintrust_InvokeFunctionArgs<Input, Output, Stream extends boolean = false> = InvokeFunctionArgs<Input, Output, Stream>;
|
|
1408
|
+
type braintrust_InvokeReturn<Stream extends boolean, Output> = InvokeReturn<Stream, Output>;
|
|
1409
|
+
declare const braintrust_LEGACY_CACHED_HEADER: typeof LEGACY_CACHED_HEADER;
|
|
1410
|
+
type braintrust_LogOptions<IsAsyncFlush> = LogOptions<IsAsyncFlush>;
|
|
1411
|
+
type braintrust_Logger<IsAsyncFlush extends boolean> = Logger<IsAsyncFlush>;
|
|
1412
|
+
declare const braintrust_Logger: typeof Logger;
|
|
1413
|
+
type braintrust_LoginOptions = LoginOptions;
|
|
1414
|
+
type braintrust_MetricSummary = MetricSummary;
|
|
1415
|
+
declare const braintrust_NOOP_SPAN: typeof NOOP_SPAN;
|
|
1416
|
+
type braintrust_NoopSpan = NoopSpan;
|
|
1417
|
+
declare const braintrust_NoopSpan: typeof NoopSpan;
|
|
1418
|
+
type braintrust_ObjectMetadata = ObjectMetadata;
|
|
1419
|
+
type braintrust_PromiseUnless<B, R> = PromiseUnless<B, R>;
|
|
1420
|
+
type braintrust_Prompt<HasId extends boolean = true, HasVersion extends boolean = true> = Prompt<HasId, HasVersion>;
|
|
1421
|
+
declare const braintrust_Prompt: typeof Prompt;
|
|
1422
|
+
type braintrust_PromptRowWithId<HasId extends boolean = true, HasVersion extends boolean = true> = PromptRowWithId<HasId, HasVersion>;
|
|
1423
|
+
type braintrust_ReadonlyExperiment = ReadonlyExperiment;
|
|
1424
|
+
declare const braintrust_ReadonlyExperiment: typeof ReadonlyExperiment;
|
|
1425
|
+
type braintrust_ScoreSummary = ScoreSummary;
|
|
1426
|
+
type braintrust_SerializedBraintrustState = SerializedBraintrustState;
|
|
1427
|
+
type braintrust_SetCurrentArg = SetCurrentArg;
|
|
1428
|
+
type braintrust_Span = Span;
|
|
1429
|
+
type braintrust_SpanImpl = SpanImpl;
|
|
1430
|
+
declare const braintrust_SpanImpl: typeof SpanImpl;
|
|
1431
|
+
type braintrust_StartSpanArgs = StartSpanArgs;
|
|
1432
|
+
type braintrust_WithTransactionId<R> = WithTransactionId<R>;
|
|
1433
|
+
declare const braintrust_X_CACHED_HEADER: typeof X_CACHED_HEADER;
|
|
1434
|
+
declare const braintrust__internalGetGlobalState: typeof _internalGetGlobalState;
|
|
1435
|
+
declare const braintrust__internalSetInitialState: typeof _internalSetInitialState;
|
|
1436
|
+
declare const braintrust_braintrustStreamChunkSchema: typeof braintrustStreamChunkSchema;
|
|
1437
|
+
declare const braintrust_createFinalValuePassThroughStream: typeof createFinalValuePassThroughStream;
|
|
1438
|
+
declare const braintrust_currentExperiment: typeof currentExperiment;
|
|
1439
|
+
declare const braintrust_currentLogger: typeof currentLogger;
|
|
1440
|
+
declare const braintrust_currentSpan: typeof currentSpan;
|
|
1441
|
+
declare const braintrust_devNullWritableStream: typeof devNullWritableStream;
|
|
1442
|
+
declare const braintrust_flush: typeof flush;
|
|
1443
|
+
declare const braintrust_getSpanParentObject: typeof getSpanParentObject;
|
|
1444
|
+
declare const braintrust_init: typeof init;
|
|
1445
|
+
declare const braintrust_initDataset: typeof initDataset;
|
|
1446
|
+
declare const braintrust_initExperiment: typeof initExperiment;
|
|
1447
|
+
declare const braintrust_initLogger: typeof initLogger;
|
|
1448
|
+
declare const braintrust_invoke: typeof invoke;
|
|
1449
|
+
declare const braintrust_loadPrompt: typeof loadPrompt;
|
|
1450
|
+
declare const braintrust_log: typeof log;
|
|
1451
|
+
declare const braintrust_logError: typeof logError;
|
|
1452
|
+
declare const braintrust_login: typeof login;
|
|
1453
|
+
declare const braintrust_loginToState: typeof loginToState;
|
|
1454
|
+
declare const braintrust_newId: typeof newId;
|
|
1455
|
+
declare const braintrust_parseCachedHeader: typeof parseCachedHeader;
|
|
1456
|
+
declare const braintrust_renderMessage: typeof renderMessage;
|
|
1457
|
+
declare const braintrust_setFetch: typeof setFetch;
|
|
1458
|
+
declare const braintrust_startSpan: typeof startSpan;
|
|
1459
|
+
declare const braintrust_summarize: typeof summarize;
|
|
1460
|
+
declare const braintrust_traceable: typeof traceable;
|
|
1461
|
+
declare const braintrust_traced: typeof traced;
|
|
1462
|
+
declare const braintrust_updateSpan: typeof updateSpan;
|
|
1463
|
+
declare const braintrust_withCurrent: typeof withCurrent;
|
|
1464
|
+
declare const braintrust_withDataset: typeof withDataset;
|
|
1465
|
+
declare const braintrust_withExperiment: typeof withExperiment;
|
|
1466
|
+
declare const braintrust_withLogger: typeof withLogger;
|
|
1467
|
+
declare const braintrust_wrapOpenAI: typeof wrapOpenAI;
|
|
1468
|
+
declare const braintrust_wrapOpenAIv4: typeof wrapOpenAIv4;
|
|
1469
|
+
declare const braintrust_wrapTraced: typeof wrapTraced;
|
|
1470
|
+
declare namespace braintrust {
|
|
1471
|
+
export { type braintrust_AnyDataset as AnyDataset, type braintrust_BackgroundLoggerOpts as BackgroundLoggerOpts, type braintrust_BaseMetadata as BaseMetadata, braintrust_BraintrustState as BraintrustState, braintrust_BraintrustStream as BraintrustStream, type braintrust_BraintrustStreamChunk as BraintrustStreamChunk, type braintrust_ChatPrompt as ChatPrompt, type braintrust_CompiledPrompt as CompiledPrompt, type braintrust_CompiledPromptParams as CompiledPromptParams, type braintrust_CompletionPrompt as CompletionPrompt, type braintrust_DataSummary as DataSummary, braintrust_Dataset as Dataset, type braintrust_DatasetSummary as DatasetSummary, type braintrust_DefaultMetadataType as DefaultMetadataType, type braintrust_DefaultPromptArgs as DefaultPromptArgs, type braintrust_EndSpanArgs as EndSpanArgs, type braintrust_EvalCase as EvalCase, braintrust_Experiment as Experiment, type braintrust_ExperimentSummary as ExperimentSummary, type braintrust_Exportable as Exportable, braintrust_FailedHTTPResponse as FailedHTTPResponse, type braintrust_FullInitOptions as FullInitOptions, type braintrust_FullLoginOptions as FullLoginOptions, type braintrust_InitOptions as InitOptions, type braintrust_InvokeFunctionArgs as InvokeFunctionArgs, type braintrust_InvokeReturn as InvokeReturn, braintrust_LEGACY_CACHED_HEADER as LEGACY_CACHED_HEADER, type braintrust_LogOptions as LogOptions, braintrust_Logger as Logger, type braintrust_LoginOptions as LoginOptions, type braintrust_MetricSummary as MetricSummary, braintrust_NOOP_SPAN as NOOP_SPAN, braintrust_NoopSpan as NoopSpan, type braintrust_ObjectMetadata as ObjectMetadata, type braintrust_PromiseUnless as PromiseUnless, braintrust_Prompt as Prompt, type braintrust_PromptRowWithId as PromptRowWithId, 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, type braintrust_WithTransactionId as WithTransactionId, braintrust_X_CACHED_HEADER as X_CACHED_HEADER, 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_devNullWritableStream as devNullWritableStream, braintrust_flush as flush, braintrust_getSpanParentObject as getSpanParentObject, braintrust_init as init, braintrust_initDataset as initDataset, braintrust_initExperiment as initExperiment, 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_renderMessage as renderMessage, braintrust_setFetch as setFetch, 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_wrapOpenAI as wrapOpenAI, braintrust_wrapOpenAIv4 as wrapOpenAIv4, braintrust_wrapTraced as wrapTraced };
|
|
1472
|
+
}
|
|
1473
|
+
|
|
1474
|
+
export { type AnyDataset, type BackgroundLoggerOpts, type BaseMetadata, BraintrustState, BraintrustStream, type BraintrustStreamChunk, type ChatPrompt, type CompiledPrompt, type CompiledPromptParams, type CompletionPrompt, type DataSummary, Dataset, type DatasetSummary, type DefaultMetadataType, type DefaultPromptArgs, type EndSpanArgs, type EvalCase, Experiment, type ExperimentSummary, type Exportable, FailedHTTPResponse, type FullInitOptions, type FullLoginOptions, type InitOptions, type InvokeFunctionArgs, type InvokeReturn, LEGACY_CACHED_HEADER, type LogOptions, Logger, type LoginOptions, type MetricSummary, NOOP_SPAN, NoopSpan, type ObjectMetadata, type PromiseUnless, Prompt, type PromptRowWithId, ReadonlyExperiment, type ScoreSummary, type SerializedBraintrustState, type SetCurrentArg, type Span, SpanImpl, type StartSpanArgs, type WithTransactionId, X_CACHED_HEADER, _internalGetGlobalState, _internalSetInitialState, braintrustStreamChunkSchema, createFinalValuePassThroughStream, currentExperiment, currentLogger, currentSpan, braintrust as default, devNullWritableStream, flush, getSpanParentObject, init, initDataset, initExperiment, initLogger, invoke, loadPrompt, log, logError, login, loginToState, newId, parseCachedHeader, renderMessage, setFetch, startSpan, summarize, traceable, traced, updateSpan, withCurrent, withDataset, withExperiment, withLogger, wrapOpenAI, wrapOpenAIv4, wrapTraced };
|
package/dist/browser.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { GitMetadataSettings, LogFeedbackFullArgs, ExperimentEvent, BackgroundLogEvent, ExperimentLogFullArgs, ExperimentLogPartialArgs, IdField, SpanType, RepoInfo, DEFAULT_IS_LEGACY_DATASET, TRANSACTION_ID_FIELD, TransactionId, SpanObjectTypeV3, DatasetRecord } from '@braintrust/core';
|
|
2
|
-
import { PromptData, OpenAIMessage, Tools, AnyModelParam, Message, Prompt as Prompt$1, PromptSessionEvent } from '@braintrust/core/typespecs';
|
|
2
|
+
import { PromptData, OpenAIMessage, Tools, AnyModelParam, Message, Prompt as Prompt$1, PromptSessionEvent, StreamingMode } from '@braintrust/core/typespecs';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
5
5
|
interface IsoAsyncLocalStorage<T> {
|
|
@@ -213,6 +213,12 @@ declare class BraintrustState {
|
|
|
213
213
|
}
|
|
214
214
|
declare function _internalSetInitialState(): void;
|
|
215
215
|
declare const _internalGetGlobalState: () => BraintrustState;
|
|
216
|
+
declare class FailedHTTPResponse extends Error {
|
|
217
|
+
status: number;
|
|
218
|
+
text: string;
|
|
219
|
+
data: any;
|
|
220
|
+
constructor(status: number, text: string, data?: any);
|
|
221
|
+
}
|
|
216
222
|
declare class HTTPConnection {
|
|
217
223
|
base_url: string;
|
|
218
224
|
token: string | null;
|
|
@@ -225,9 +231,9 @@ declare class HTTPConnection {
|
|
|
225
231
|
static sanitize_token(token: string): string;
|
|
226
232
|
set_token(token: string): void;
|
|
227
233
|
_reset(): void;
|
|
228
|
-
get(path: string, params?: Record<string, string | undefined> | undefined, config?: RequestInit): Promise<Response>;
|
|
234
|
+
get(path: string, params?: Record<string, string | string[] | undefined> | undefined, config?: RequestInit): Promise<Response>;
|
|
229
235
|
post(path: string, params?: Record<string, unknown> | string, config?: RequestInit): Promise<Response>;
|
|
230
|
-
get_json(object_type: string, args?: Record<string, string | undefined> | undefined, retries?: number): Promise<any>;
|
|
236
|
+
get_json(object_type: string, args?: Record<string, string | string[] | undefined> | undefined, retries?: number): Promise<any>;
|
|
231
237
|
post_json(object_type: string, args?: Record<string, unknown> | string | undefined): Promise<any>;
|
|
232
238
|
}
|
|
233
239
|
interface ObjectMetadata {
|
|
@@ -538,7 +544,7 @@ type LoadPromptOptions = FullLoginOptions & {
|
|
|
538
544
|
* });
|
|
539
545
|
* ```
|
|
540
546
|
*/
|
|
541
|
-
declare function loadPrompt({ projectName, projectId, slug, version, defaults, noTrace, appUrl, apiKey, orgName, fetch, forceLogin, state: stateArg, }: LoadPromptOptions): Promise<Prompt
|
|
547
|
+
declare function loadPrompt({ projectName, projectId, slug, version, defaults, noTrace, appUrl, apiKey, orgName, fetch, forceLogin, state: stateArg, }: LoadPromptOptions): Promise<Prompt<true, true>>;
|
|
542
548
|
/**
|
|
543
549
|
* Options for logging in to Braintrust.
|
|
544
550
|
*/
|
|
@@ -982,19 +988,20 @@ type CompiledPrompt<Flavor extends "chat" | "completion"> = CompiledPromptParams
|
|
|
982
988
|
} & (Flavor extends "chat" ? ChatPrompt : Flavor extends "completion" ? CompletionPrompt : {});
|
|
983
989
|
type DefaultPromptArgs = Partial<CompiledPromptParams & AnyModelParam & ChatPrompt & CompletionPrompt>;
|
|
984
990
|
declare function renderMessage<T extends Message>(render: (template: string) => string, message: T): T;
|
|
985
|
-
|
|
991
|
+
type PromptRowWithId<HasId extends boolean = true, HasVersion extends boolean = true> = Omit<Prompt$1, "log_id" | "org_id" | "project_id" | "id" | "_xact_id"> & Partial<Pick<Prompt$1, "project_id">> & (HasId extends true ? Pick<Prompt$1, "id"> : Partial<Pick<Prompt$1, "id">>) & (HasVersion extends true ? Pick<Prompt$1, "_xact_id"> : Partial<Pick<Prompt$1, "_xact_id">>);
|
|
992
|
+
declare class Prompt<HasId extends boolean = true, HasVersion extends boolean = true> {
|
|
986
993
|
private metadata;
|
|
987
994
|
private defaults;
|
|
988
995
|
private noTrace;
|
|
989
996
|
private parsedPromptData;
|
|
990
997
|
private hasParsedPromptData;
|
|
991
|
-
constructor(metadata:
|
|
992
|
-
get id(): string;
|
|
993
|
-
get projectId(): string;
|
|
998
|
+
constructor(metadata: PromptRowWithId<HasId, HasVersion> | PromptSessionEvent, defaults: DefaultPromptArgs, noTrace: boolean);
|
|
999
|
+
get id(): HasId extends true ? string : string | undefined;
|
|
1000
|
+
get projectId(): string | undefined;
|
|
994
1001
|
get name(): string;
|
|
995
1002
|
get slug(): string;
|
|
996
1003
|
get prompt(): PromptData["prompt"];
|
|
997
|
-
get version(): TransactionId;
|
|
1004
|
+
get version(): HasId extends true ? TransactionId : TransactionId | undefined;
|
|
998
1005
|
get options(): NonNullable<PromptData["options"]>;
|
|
999
1006
|
/**
|
|
1000
1007
|
* Build the prompt with the given formatting options. The args you pass in will
|
|
@@ -1005,6 +1012,7 @@ declare class Prompt {
|
|
|
1005
1012
|
*/
|
|
1006
1013
|
build<Flavor extends "chat" | "completion" = "chat">(buildArgs: unknown, options?: {
|
|
1007
1014
|
flavor?: Flavor;
|
|
1015
|
+
messages?: Message[];
|
|
1008
1016
|
}): CompiledPrompt<Flavor>;
|
|
1009
1017
|
private runBuild;
|
|
1010
1018
|
private getParsedPromptData;
|
|
@@ -1108,6 +1116,82 @@ declare const braintrustStreamChunkSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
1108
1116
|
}, {
|
|
1109
1117
|
data: string;
|
|
1110
1118
|
type: "json_delta";
|
|
1119
|
+
}>, z.ZodObject<{
|
|
1120
|
+
type: z.ZodLiteral<"error">;
|
|
1121
|
+
data: z.ZodString;
|
|
1122
|
+
}, "strip", z.ZodTypeAny, {
|
|
1123
|
+
data: string;
|
|
1124
|
+
type: "error";
|
|
1125
|
+
}, {
|
|
1126
|
+
data: string;
|
|
1127
|
+
type: "error";
|
|
1128
|
+
}>, z.ZodObject<{
|
|
1129
|
+
type: z.ZodLiteral<"progress">;
|
|
1130
|
+
data: z.ZodObject<{
|
|
1131
|
+
id: z.ZodString;
|
|
1132
|
+
object_type: z.ZodEnum<["prompt", "tool", "scorer", "task"]>;
|
|
1133
|
+
format: z.ZodEnum<["llm", "code", "global"]>;
|
|
1134
|
+
output_type: z.ZodEnum<["completion", "score", "any"]>;
|
|
1135
|
+
name: z.ZodString;
|
|
1136
|
+
event: z.ZodEnum<["text_delta", "json_delta", "error", "start", "done"]>;
|
|
1137
|
+
data: z.ZodString;
|
|
1138
|
+
}, "strip", z.ZodTypeAny, {
|
|
1139
|
+
format: "code" | "global" | "llm";
|
|
1140
|
+
data: string;
|
|
1141
|
+
name: string;
|
|
1142
|
+
id: string;
|
|
1143
|
+
object_type: "prompt" | "tool" | "scorer" | "task";
|
|
1144
|
+
event: "error" | "text_delta" | "json_delta" | "start" | "done";
|
|
1145
|
+
output_type: "completion" | "score" | "any";
|
|
1146
|
+
}, {
|
|
1147
|
+
format: "code" | "global" | "llm";
|
|
1148
|
+
data: string;
|
|
1149
|
+
name: string;
|
|
1150
|
+
id: string;
|
|
1151
|
+
object_type: "prompt" | "tool" | "scorer" | "task";
|
|
1152
|
+
event: "error" | "text_delta" | "json_delta" | "start" | "done";
|
|
1153
|
+
output_type: "completion" | "score" | "any";
|
|
1154
|
+
}>;
|
|
1155
|
+
}, "strip", z.ZodTypeAny, {
|
|
1156
|
+
data: {
|
|
1157
|
+
format: "code" | "global" | "llm";
|
|
1158
|
+
data: string;
|
|
1159
|
+
name: string;
|
|
1160
|
+
id: string;
|
|
1161
|
+
object_type: "prompt" | "tool" | "scorer" | "task";
|
|
1162
|
+
event: "error" | "text_delta" | "json_delta" | "start" | "done";
|
|
1163
|
+
output_type: "completion" | "score" | "any";
|
|
1164
|
+
};
|
|
1165
|
+
type: "progress";
|
|
1166
|
+
}, {
|
|
1167
|
+
data: {
|
|
1168
|
+
format: "code" | "global" | "llm";
|
|
1169
|
+
data: string;
|
|
1170
|
+
name: string;
|
|
1171
|
+
id: string;
|
|
1172
|
+
object_type: "prompt" | "tool" | "scorer" | "task";
|
|
1173
|
+
event: "error" | "text_delta" | "json_delta" | "start" | "done";
|
|
1174
|
+
output_type: "completion" | "score" | "any";
|
|
1175
|
+
};
|
|
1176
|
+
type: "progress";
|
|
1177
|
+
}>, z.ZodObject<{
|
|
1178
|
+
type: z.ZodLiteral<"start">;
|
|
1179
|
+
data: z.ZodString;
|
|
1180
|
+
}, "strip", z.ZodTypeAny, {
|
|
1181
|
+
data: string;
|
|
1182
|
+
type: "start";
|
|
1183
|
+
}, {
|
|
1184
|
+
data: string;
|
|
1185
|
+
type: "start";
|
|
1186
|
+
}>, z.ZodObject<{
|
|
1187
|
+
type: z.ZodLiteral<"done">;
|
|
1188
|
+
data: z.ZodString;
|
|
1189
|
+
}, "strip", z.ZodTypeAny, {
|
|
1190
|
+
data: string;
|
|
1191
|
+
type: "done";
|
|
1192
|
+
}, {
|
|
1193
|
+
data: string;
|
|
1194
|
+
type: "done";
|
|
1111
1195
|
}>]>;
|
|
1112
1196
|
/**
|
|
1113
1197
|
* A chunk of data from a Braintrust stream. Each chunk type matches
|
|
@@ -1168,7 +1252,7 @@ declare class BraintrustStream {
|
|
|
1168
1252
|
* @param onFinal A function to call with the final value of the stream.
|
|
1169
1253
|
* @returns A new stream that passes through the final value of the stream.
|
|
1170
1254
|
*/
|
|
1171
|
-
declare function createFinalValuePassThroughStream<T extends BraintrustStreamChunk | string | Uint8Array>(onFinal: (result: unknown) => void): TransformStream<T, BraintrustStreamChunk>;
|
|
1255
|
+
declare function createFinalValuePassThroughStream<T extends BraintrustStreamChunk | string | Uint8Array>(onFinal: (result: unknown) => void, onError: (error: unknown) => void): TransformStream<T, BraintrustStreamChunk>;
|
|
1172
1256
|
declare function devNullWritableStream(): WritableStream;
|
|
1173
1257
|
|
|
1174
1258
|
/**
|
|
@@ -1207,6 +1291,10 @@ interface InvokeFunctionArgs<Input, Output, Stream extends boolean = false> {
|
|
|
1207
1291
|
* The input to the function. This will be logged as the `input` field in the span.
|
|
1208
1292
|
*/
|
|
1209
1293
|
input: Input;
|
|
1294
|
+
/**
|
|
1295
|
+
* Additional OpenAI-style messages to add to the prompt (only works for llm functions).
|
|
1296
|
+
*/
|
|
1297
|
+
messages?: Message[];
|
|
1210
1298
|
/**
|
|
1211
1299
|
* The parent of the function. This can be an existing span, logger, or experiment, or
|
|
1212
1300
|
* the output of `.export()` if you are distributed tracing. If unspecified, will use
|
|
@@ -1220,6 +1308,12 @@ interface InvokeFunctionArgs<Input, Output, Stream extends boolean = false> {
|
|
|
1220
1308
|
* object.
|
|
1221
1309
|
*/
|
|
1222
1310
|
stream?: Stream;
|
|
1311
|
+
/**
|
|
1312
|
+
* The mode of the function. If "auto", will return a string if the function returns a string,
|
|
1313
|
+
* and a JSON object otherwise. If "parallel", will return an array of JSON objects with one
|
|
1314
|
+
* object per tool call.
|
|
1315
|
+
*/
|
|
1316
|
+
mode?: StreamingMode;
|
|
1223
1317
|
/**
|
|
1224
1318
|
* A Zod schema to validate the output of the function and return a typed value. This
|
|
1225
1319
|
* is only used if `stream` is false.
|
|
@@ -1281,4 +1375,100 @@ declare const LEGACY_CACHED_HEADER = "x-cached";
|
|
|
1281
1375
|
declare const X_CACHED_HEADER = "x-bt-cached";
|
|
1282
1376
|
declare function parseCachedHeader(value: string | null | undefined): number | undefined;
|
|
1283
1377
|
|
|
1284
|
-
|
|
1378
|
+
type braintrust_AnyDataset = AnyDataset;
|
|
1379
|
+
type braintrust_BackgroundLoggerOpts = BackgroundLoggerOpts;
|
|
1380
|
+
type braintrust_BaseMetadata = BaseMetadata;
|
|
1381
|
+
type braintrust_BraintrustState = BraintrustState;
|
|
1382
|
+
declare const braintrust_BraintrustState: typeof BraintrustState;
|
|
1383
|
+
type braintrust_BraintrustStream = BraintrustStream;
|
|
1384
|
+
declare const braintrust_BraintrustStream: typeof BraintrustStream;
|
|
1385
|
+
type braintrust_BraintrustStreamChunk = BraintrustStreamChunk;
|
|
1386
|
+
type braintrust_ChatPrompt = ChatPrompt;
|
|
1387
|
+
type braintrust_CompiledPrompt<Flavor extends "chat" | "completion"> = CompiledPrompt<Flavor>;
|
|
1388
|
+
type braintrust_CompiledPromptParams = CompiledPromptParams;
|
|
1389
|
+
type braintrust_CompletionPrompt = CompletionPrompt;
|
|
1390
|
+
type braintrust_DataSummary = DataSummary;
|
|
1391
|
+
type braintrust_Dataset<IsLegacyDataset extends boolean = typeof DEFAULT_IS_LEGACY_DATASET> = Dataset<IsLegacyDataset>;
|
|
1392
|
+
declare const braintrust_Dataset: typeof Dataset;
|
|
1393
|
+
type braintrust_DatasetSummary = DatasetSummary;
|
|
1394
|
+
type braintrust_DefaultMetadataType = DefaultMetadataType;
|
|
1395
|
+
type braintrust_DefaultPromptArgs = DefaultPromptArgs;
|
|
1396
|
+
type braintrust_EndSpanArgs = EndSpanArgs;
|
|
1397
|
+
type braintrust_EvalCase<Input, Expected, Metadata> = EvalCase<Input, Expected, Metadata>;
|
|
1398
|
+
type braintrust_Experiment = Experiment;
|
|
1399
|
+
declare const braintrust_Experiment: typeof Experiment;
|
|
1400
|
+
type braintrust_ExperimentSummary = ExperimentSummary;
|
|
1401
|
+
type braintrust_Exportable = Exportable;
|
|
1402
|
+
type braintrust_FailedHTTPResponse = FailedHTTPResponse;
|
|
1403
|
+
declare const braintrust_FailedHTTPResponse: typeof FailedHTTPResponse;
|
|
1404
|
+
type braintrust_FullInitOptions<IsOpen extends boolean> = FullInitOptions<IsOpen>;
|
|
1405
|
+
type braintrust_FullLoginOptions = FullLoginOptions;
|
|
1406
|
+
type braintrust_InitOptions<IsOpen extends boolean> = InitOptions<IsOpen>;
|
|
1407
|
+
type braintrust_InvokeFunctionArgs<Input, Output, Stream extends boolean = false> = InvokeFunctionArgs<Input, Output, Stream>;
|
|
1408
|
+
type braintrust_InvokeReturn<Stream extends boolean, Output> = InvokeReturn<Stream, Output>;
|
|
1409
|
+
declare const braintrust_LEGACY_CACHED_HEADER: typeof LEGACY_CACHED_HEADER;
|
|
1410
|
+
type braintrust_LogOptions<IsAsyncFlush> = LogOptions<IsAsyncFlush>;
|
|
1411
|
+
type braintrust_Logger<IsAsyncFlush extends boolean> = Logger<IsAsyncFlush>;
|
|
1412
|
+
declare const braintrust_Logger: typeof Logger;
|
|
1413
|
+
type braintrust_LoginOptions = LoginOptions;
|
|
1414
|
+
type braintrust_MetricSummary = MetricSummary;
|
|
1415
|
+
declare const braintrust_NOOP_SPAN: typeof NOOP_SPAN;
|
|
1416
|
+
type braintrust_NoopSpan = NoopSpan;
|
|
1417
|
+
declare const braintrust_NoopSpan: typeof NoopSpan;
|
|
1418
|
+
type braintrust_ObjectMetadata = ObjectMetadata;
|
|
1419
|
+
type braintrust_PromiseUnless<B, R> = PromiseUnless<B, R>;
|
|
1420
|
+
type braintrust_Prompt<HasId extends boolean = true, HasVersion extends boolean = true> = Prompt<HasId, HasVersion>;
|
|
1421
|
+
declare const braintrust_Prompt: typeof Prompt;
|
|
1422
|
+
type braintrust_PromptRowWithId<HasId extends boolean = true, HasVersion extends boolean = true> = PromptRowWithId<HasId, HasVersion>;
|
|
1423
|
+
type braintrust_ReadonlyExperiment = ReadonlyExperiment;
|
|
1424
|
+
declare const braintrust_ReadonlyExperiment: typeof ReadonlyExperiment;
|
|
1425
|
+
type braintrust_ScoreSummary = ScoreSummary;
|
|
1426
|
+
type braintrust_SerializedBraintrustState = SerializedBraintrustState;
|
|
1427
|
+
type braintrust_SetCurrentArg = SetCurrentArg;
|
|
1428
|
+
type braintrust_Span = Span;
|
|
1429
|
+
type braintrust_SpanImpl = SpanImpl;
|
|
1430
|
+
declare const braintrust_SpanImpl: typeof SpanImpl;
|
|
1431
|
+
type braintrust_StartSpanArgs = StartSpanArgs;
|
|
1432
|
+
type braintrust_WithTransactionId<R> = WithTransactionId<R>;
|
|
1433
|
+
declare const braintrust_X_CACHED_HEADER: typeof X_CACHED_HEADER;
|
|
1434
|
+
declare const braintrust__internalGetGlobalState: typeof _internalGetGlobalState;
|
|
1435
|
+
declare const braintrust__internalSetInitialState: typeof _internalSetInitialState;
|
|
1436
|
+
declare const braintrust_braintrustStreamChunkSchema: typeof braintrustStreamChunkSchema;
|
|
1437
|
+
declare const braintrust_createFinalValuePassThroughStream: typeof createFinalValuePassThroughStream;
|
|
1438
|
+
declare const braintrust_currentExperiment: typeof currentExperiment;
|
|
1439
|
+
declare const braintrust_currentLogger: typeof currentLogger;
|
|
1440
|
+
declare const braintrust_currentSpan: typeof currentSpan;
|
|
1441
|
+
declare const braintrust_devNullWritableStream: typeof devNullWritableStream;
|
|
1442
|
+
declare const braintrust_flush: typeof flush;
|
|
1443
|
+
declare const braintrust_getSpanParentObject: typeof getSpanParentObject;
|
|
1444
|
+
declare const braintrust_init: typeof init;
|
|
1445
|
+
declare const braintrust_initDataset: typeof initDataset;
|
|
1446
|
+
declare const braintrust_initExperiment: typeof initExperiment;
|
|
1447
|
+
declare const braintrust_initLogger: typeof initLogger;
|
|
1448
|
+
declare const braintrust_invoke: typeof invoke;
|
|
1449
|
+
declare const braintrust_loadPrompt: typeof loadPrompt;
|
|
1450
|
+
declare const braintrust_log: typeof log;
|
|
1451
|
+
declare const braintrust_logError: typeof logError;
|
|
1452
|
+
declare const braintrust_login: typeof login;
|
|
1453
|
+
declare const braintrust_loginToState: typeof loginToState;
|
|
1454
|
+
declare const braintrust_newId: typeof newId;
|
|
1455
|
+
declare const braintrust_parseCachedHeader: typeof parseCachedHeader;
|
|
1456
|
+
declare const braintrust_renderMessage: typeof renderMessage;
|
|
1457
|
+
declare const braintrust_setFetch: typeof setFetch;
|
|
1458
|
+
declare const braintrust_startSpan: typeof startSpan;
|
|
1459
|
+
declare const braintrust_summarize: typeof summarize;
|
|
1460
|
+
declare const braintrust_traceable: typeof traceable;
|
|
1461
|
+
declare const braintrust_traced: typeof traced;
|
|
1462
|
+
declare const braintrust_updateSpan: typeof updateSpan;
|
|
1463
|
+
declare const braintrust_withCurrent: typeof withCurrent;
|
|
1464
|
+
declare const braintrust_withDataset: typeof withDataset;
|
|
1465
|
+
declare const braintrust_withExperiment: typeof withExperiment;
|
|
1466
|
+
declare const braintrust_withLogger: typeof withLogger;
|
|
1467
|
+
declare const braintrust_wrapOpenAI: typeof wrapOpenAI;
|
|
1468
|
+
declare const braintrust_wrapOpenAIv4: typeof wrapOpenAIv4;
|
|
1469
|
+
declare const braintrust_wrapTraced: typeof wrapTraced;
|
|
1470
|
+
declare namespace braintrust {
|
|
1471
|
+
export { type braintrust_AnyDataset as AnyDataset, type braintrust_BackgroundLoggerOpts as BackgroundLoggerOpts, type braintrust_BaseMetadata as BaseMetadata, braintrust_BraintrustState as BraintrustState, braintrust_BraintrustStream as BraintrustStream, type braintrust_BraintrustStreamChunk as BraintrustStreamChunk, type braintrust_ChatPrompt as ChatPrompt, type braintrust_CompiledPrompt as CompiledPrompt, type braintrust_CompiledPromptParams as CompiledPromptParams, type braintrust_CompletionPrompt as CompletionPrompt, type braintrust_DataSummary as DataSummary, braintrust_Dataset as Dataset, type braintrust_DatasetSummary as DatasetSummary, type braintrust_DefaultMetadataType as DefaultMetadataType, type braintrust_DefaultPromptArgs as DefaultPromptArgs, type braintrust_EndSpanArgs as EndSpanArgs, type braintrust_EvalCase as EvalCase, braintrust_Experiment as Experiment, type braintrust_ExperimentSummary as ExperimentSummary, type braintrust_Exportable as Exportable, braintrust_FailedHTTPResponse as FailedHTTPResponse, type braintrust_FullInitOptions as FullInitOptions, type braintrust_FullLoginOptions as FullLoginOptions, type braintrust_InitOptions as InitOptions, type braintrust_InvokeFunctionArgs as InvokeFunctionArgs, type braintrust_InvokeReturn as InvokeReturn, braintrust_LEGACY_CACHED_HEADER as LEGACY_CACHED_HEADER, type braintrust_LogOptions as LogOptions, braintrust_Logger as Logger, type braintrust_LoginOptions as LoginOptions, type braintrust_MetricSummary as MetricSummary, braintrust_NOOP_SPAN as NOOP_SPAN, braintrust_NoopSpan as NoopSpan, type braintrust_ObjectMetadata as ObjectMetadata, type braintrust_PromiseUnless as PromiseUnless, braintrust_Prompt as Prompt, type braintrust_PromptRowWithId as PromptRowWithId, 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, type braintrust_WithTransactionId as WithTransactionId, braintrust_X_CACHED_HEADER as X_CACHED_HEADER, 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_devNullWritableStream as devNullWritableStream, braintrust_flush as flush, braintrust_getSpanParentObject as getSpanParentObject, braintrust_init as init, braintrust_initDataset as initDataset, braintrust_initExperiment as initExperiment, 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_renderMessage as renderMessage, braintrust_setFetch as setFetch, 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_wrapOpenAI as wrapOpenAI, braintrust_wrapOpenAIv4 as wrapOpenAIv4, braintrust_wrapTraced as wrapTraced };
|
|
1472
|
+
}
|
|
1473
|
+
|
|
1474
|
+
export { type AnyDataset, type BackgroundLoggerOpts, type BaseMetadata, BraintrustState, BraintrustStream, type BraintrustStreamChunk, type ChatPrompt, type CompiledPrompt, type CompiledPromptParams, type CompletionPrompt, type DataSummary, Dataset, type DatasetSummary, type DefaultMetadataType, type DefaultPromptArgs, type EndSpanArgs, type EvalCase, Experiment, type ExperimentSummary, type Exportable, FailedHTTPResponse, type FullInitOptions, type FullLoginOptions, type InitOptions, type InvokeFunctionArgs, type InvokeReturn, LEGACY_CACHED_HEADER, type LogOptions, Logger, type LoginOptions, type MetricSummary, NOOP_SPAN, NoopSpan, type ObjectMetadata, type PromiseUnless, Prompt, type PromptRowWithId, ReadonlyExperiment, type ScoreSummary, type SerializedBraintrustState, type SetCurrentArg, type Span, SpanImpl, type StartSpanArgs, type WithTransactionId, X_CACHED_HEADER, _internalGetGlobalState, _internalSetInitialState, braintrustStreamChunkSchema, createFinalValuePassThroughStream, currentExperiment, currentLogger, currentSpan, braintrust as default, devNullWritableStream, flush, getSpanParentObject, init, initDataset, initExperiment, initLogger, invoke, loadPrompt, log, logError, login, loginToState, newId, parseCachedHeader, renderMessage, setFetch, startSpan, summarize, traceable, traced, updateSpan, withCurrent, withDataset, withExperiment, withLogger, wrapOpenAI, wrapOpenAIv4, wrapTraced };
|