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.
@@ -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<{