braintrust 0.3.8 → 0.4.0
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 +21 -2
- package/dev/dist/index.d.ts +21 -2
- package/dev/dist/index.js +385 -123
- package/dev/dist/index.mjs +1291 -1029
- package/dist/browser.d.mts +23 -2
- package/dist/browser.d.ts +23 -2
- package/dist/browser.js +204 -110
- package/dist/browser.mjs +1079 -985
- package/dist/cli.js +1336 -1073
- package/dist/index.d.mts +86 -4
- package/dist/index.d.ts +86 -4
- package/dist/index.js +580 -186
- package/dist/index.mjs +1436 -1042
- package/package.json +4 -3
- package/util/dist/index.d.mts +66 -3
- package/util/dist/index.d.ts +66 -3
- package/util/dist/index.js +229 -17
- package/util/dist/index.mjs +230 -18
package/dist/browser.d.mts
CHANGED
|
@@ -14,6 +14,24 @@ declare class LazyValue<T> {
|
|
|
14
14
|
get hasSucceeded(): boolean;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
+
/**
|
|
18
|
+
* Abstract base class for ID generators
|
|
19
|
+
*/
|
|
20
|
+
declare abstract class IDGenerator {
|
|
21
|
+
/**
|
|
22
|
+
* Generate a span ID
|
|
23
|
+
*/
|
|
24
|
+
abstract getSpanId(): string;
|
|
25
|
+
/**
|
|
26
|
+
* Generate a trace ID
|
|
27
|
+
*/
|
|
28
|
+
abstract getTraceId(): string;
|
|
29
|
+
/**
|
|
30
|
+
* Return true if the generator should use span_id as root_span_id for backwards compatibility
|
|
31
|
+
*/
|
|
32
|
+
abstract shareRootSpanId(): boolean;
|
|
33
|
+
}
|
|
34
|
+
|
|
17
35
|
declare const TRANSACTION_ID_FIELD = "_xact_id";
|
|
18
36
|
declare const IS_MERGE_FIELD = "_is_merge";
|
|
19
37
|
declare const MERGE_PATHS_FIELD = "_merge_paths";
|
|
@@ -7858,8 +7876,6 @@ declare class PromptCache {
|
|
|
7858
7876
|
set(key: PromptKey, value: Prompt): Promise<void>;
|
|
7859
7877
|
}
|
|
7860
7878
|
|
|
7861
|
-
/// <reference lib="dom" />
|
|
7862
|
-
|
|
7863
7879
|
type SetCurrentArg = {
|
|
7864
7880
|
setCurrent?: boolean;
|
|
7865
7881
|
};
|
|
@@ -8107,8 +8123,11 @@ declare class BraintrustState {
|
|
|
8107
8123
|
private _apiConn;
|
|
8108
8124
|
private _proxyConn;
|
|
8109
8125
|
promptCache: PromptCache;
|
|
8126
|
+
private _idGenerator;
|
|
8110
8127
|
constructor(loginParams: LoginOptions);
|
|
8111
8128
|
resetLoginInfo(): void;
|
|
8129
|
+
resetIdGenState(): void;
|
|
8130
|
+
get idGenerator(): IDGenerator;
|
|
8112
8131
|
copyLoginInfo(other: BraintrustState): void;
|
|
8113
8132
|
serialize(): SerializedBraintrustState;
|
|
8114
8133
|
static deserialize(serialized: unknown, opts?: LoginOptions): BraintrustState;
|
|
@@ -9420,6 +9439,7 @@ declare function simulateLogoutForTests(): BraintrustState;
|
|
|
9420
9439
|
* @returns Promise containing the version data
|
|
9421
9440
|
*/
|
|
9422
9441
|
declare function getPromptVersions(projectId: string, promptId: string): Promise<any>;
|
|
9442
|
+
declare function resetIdGenStateForTests(): void;
|
|
9423
9443
|
declare const _exportsForTestingOnly: {
|
|
9424
9444
|
extractAttachments: typeof extractAttachments;
|
|
9425
9445
|
deepCopyEvent: typeof deepCopyEvent;
|
|
@@ -9431,6 +9451,7 @@ declare const _exportsForTestingOnly: {
|
|
|
9431
9451
|
initTestExperiment: typeof initTestExperiment;
|
|
9432
9452
|
isGeneratorFunction: typeof isGeneratorFunction;
|
|
9433
9453
|
isAsyncGeneratorFunction: typeof isAsyncGeneratorFunction;
|
|
9454
|
+
resetIdGenStateForTests: typeof resetIdGenStateForTests;
|
|
9434
9455
|
};
|
|
9435
9456
|
|
|
9436
9457
|
declare const braintrustStreamChunkSchema: z.ZodUnion<[z.ZodObject<{
|
package/dist/browser.d.ts
CHANGED
|
@@ -14,6 +14,24 @@ declare class LazyValue<T> {
|
|
|
14
14
|
get hasSucceeded(): boolean;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
+
/**
|
|
18
|
+
* Abstract base class for ID generators
|
|
19
|
+
*/
|
|
20
|
+
declare abstract class IDGenerator {
|
|
21
|
+
/**
|
|
22
|
+
* Generate a span ID
|
|
23
|
+
*/
|
|
24
|
+
abstract getSpanId(): string;
|
|
25
|
+
/**
|
|
26
|
+
* Generate a trace ID
|
|
27
|
+
*/
|
|
28
|
+
abstract getTraceId(): string;
|
|
29
|
+
/**
|
|
30
|
+
* Return true if the generator should use span_id as root_span_id for backwards compatibility
|
|
31
|
+
*/
|
|
32
|
+
abstract shareRootSpanId(): boolean;
|
|
33
|
+
}
|
|
34
|
+
|
|
17
35
|
declare const TRANSACTION_ID_FIELD = "_xact_id";
|
|
18
36
|
declare const IS_MERGE_FIELD = "_is_merge";
|
|
19
37
|
declare const MERGE_PATHS_FIELD = "_merge_paths";
|
|
@@ -7858,8 +7876,6 @@ declare class PromptCache {
|
|
|
7858
7876
|
set(key: PromptKey, value: Prompt): Promise<void>;
|
|
7859
7877
|
}
|
|
7860
7878
|
|
|
7861
|
-
/// <reference lib="dom" />
|
|
7862
|
-
|
|
7863
7879
|
type SetCurrentArg = {
|
|
7864
7880
|
setCurrent?: boolean;
|
|
7865
7881
|
};
|
|
@@ -8107,8 +8123,11 @@ declare class BraintrustState {
|
|
|
8107
8123
|
private _apiConn;
|
|
8108
8124
|
private _proxyConn;
|
|
8109
8125
|
promptCache: PromptCache;
|
|
8126
|
+
private _idGenerator;
|
|
8110
8127
|
constructor(loginParams: LoginOptions);
|
|
8111
8128
|
resetLoginInfo(): void;
|
|
8129
|
+
resetIdGenState(): void;
|
|
8130
|
+
get idGenerator(): IDGenerator;
|
|
8112
8131
|
copyLoginInfo(other: BraintrustState): void;
|
|
8113
8132
|
serialize(): SerializedBraintrustState;
|
|
8114
8133
|
static deserialize(serialized: unknown, opts?: LoginOptions): BraintrustState;
|
|
@@ -9420,6 +9439,7 @@ declare function simulateLogoutForTests(): BraintrustState;
|
|
|
9420
9439
|
* @returns Promise containing the version data
|
|
9421
9440
|
*/
|
|
9422
9441
|
declare function getPromptVersions(projectId: string, promptId: string): Promise<any>;
|
|
9442
|
+
declare function resetIdGenStateForTests(): void;
|
|
9423
9443
|
declare const _exportsForTestingOnly: {
|
|
9424
9444
|
extractAttachments: typeof extractAttachments;
|
|
9425
9445
|
deepCopyEvent: typeof deepCopyEvent;
|
|
@@ -9431,6 +9451,7 @@ declare const _exportsForTestingOnly: {
|
|
|
9431
9451
|
initTestExperiment: typeof initTestExperiment;
|
|
9432
9452
|
isGeneratorFunction: typeof isGeneratorFunction;
|
|
9433
9453
|
isAsyncGeneratorFunction: typeof isAsyncGeneratorFunction;
|
|
9454
|
+
resetIdGenStateForTests: typeof resetIdGenStateForTests;
|
|
9434
9455
|
};
|
|
9435
9456
|
|
|
9436
9457
|
declare const braintrustStreamChunkSchema: z.ZodUnion<[z.ZodObject<{
|