braintrust 0.3.7 → 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.
@@ -7097,6 +7097,24 @@ type ToolFunctionDefinitionType = z.infer<typeof ToolFunctionDefinition>;
7097
7097
 
7098
7098
  type GenericFunction<Input, Output> = ((input: Input) => Output) | ((input: Input) => Promise<Output>);
7099
7099
 
7100
+ /**
7101
+ * Abstract base class for ID generators
7102
+ */
7103
+ declare abstract class IDGenerator {
7104
+ /**
7105
+ * Generate a span ID
7106
+ */
7107
+ abstract getSpanId(): string;
7108
+ /**
7109
+ * Generate a trace ID
7110
+ */
7111
+ abstract getTraceId(): string;
7112
+ /**
7113
+ * Return true if the generator should use span_id as root_span_id for backwards compatibility
7114
+ */
7115
+ abstract shareRootSpanId(): boolean;
7116
+ }
7117
+
7100
7118
  interface IsoAsyncLocalStorage<T> {
7101
7119
  enterWith(store: T): void;
7102
7120
  run<R>(store: T | undefined, callback: () => R): R;
@@ -7457,6 +7475,7 @@ declare class NoopSpan implements Span {
7457
7475
  setAttributes(_args: Omit<StartSpanArgs, "event">): void;
7458
7476
  startSpanWithParents(_spanId: string, _spanParents: string[], _args?: StartSpanArgs): Span;
7459
7477
  state(): BraintrustState;
7478
+ toString(): string;
7460
7479
  }
7461
7480
  declare const NOOP_SPAN: NoopSpan;
7462
7481
  declare global {
@@ -7529,8 +7548,11 @@ declare class BraintrustState {
7529
7548
  private _apiConn;
7530
7549
  private _proxyConn;
7531
7550
  promptCache: PromptCache;
7551
+ private _idGenerator;
7532
7552
  constructor(loginParams: LoginOptions);
7533
7553
  resetLoginInfo(): void;
7554
+ resetIdGenState(): void;
7555
+ get idGenerator(): IDGenerator;
7534
7556
  copyLoginInfo(other: BraintrustState): void;
7535
7557
  serialize(): SerializedBraintrustState;
7536
7558
  static deserialize(serialized: unknown, opts?: LoginOptions): BraintrustState;
@@ -7548,6 +7570,8 @@ declare class BraintrustState {
7548
7570
  loginReplaceApiConn(apiConn: HTTPConnection): void;
7549
7571
  disable(): void;
7550
7572
  enforceQueueSizeLimit(enforce: boolean): void;
7573
+ toJSON(): Record<string, any>;
7574
+ toString(): string;
7551
7575
  }
7552
7576
  declare class HTTPConnection {
7553
7577
  base_url: string;
@@ -7565,6 +7589,7 @@ declare class HTTPConnection {
7565
7589
  post(path: string, params?: Record<string, unknown> | string, config?: RequestInit): Promise<Response>;
7566
7590
  get_json(object_type: string, args?: Record<string, string | string[] | undefined> | undefined, retries?: number): Promise<any>;
7567
7591
  post_json(object_type: string, args?: Record<string, unknown> | string | undefined): Promise<any>;
7592
+ toString(): string;
7568
7593
  }
7569
7594
  interface ObjectMetadata {
7570
7595
  id: string;
@@ -7097,6 +7097,24 @@ type ToolFunctionDefinitionType = z.infer<typeof ToolFunctionDefinition>;
7097
7097
 
7098
7098
  type GenericFunction<Input, Output> = ((input: Input) => Output) | ((input: Input) => Promise<Output>);
7099
7099
 
7100
+ /**
7101
+ * Abstract base class for ID generators
7102
+ */
7103
+ declare abstract class IDGenerator {
7104
+ /**
7105
+ * Generate a span ID
7106
+ */
7107
+ abstract getSpanId(): string;
7108
+ /**
7109
+ * Generate a trace ID
7110
+ */
7111
+ abstract getTraceId(): string;
7112
+ /**
7113
+ * Return true if the generator should use span_id as root_span_id for backwards compatibility
7114
+ */
7115
+ abstract shareRootSpanId(): boolean;
7116
+ }
7117
+
7100
7118
  interface IsoAsyncLocalStorage<T> {
7101
7119
  enterWith(store: T): void;
7102
7120
  run<R>(store: T | undefined, callback: () => R): R;
@@ -7457,6 +7475,7 @@ declare class NoopSpan implements Span {
7457
7475
  setAttributes(_args: Omit<StartSpanArgs, "event">): void;
7458
7476
  startSpanWithParents(_spanId: string, _spanParents: string[], _args?: StartSpanArgs): Span;
7459
7477
  state(): BraintrustState;
7478
+ toString(): string;
7460
7479
  }
7461
7480
  declare const NOOP_SPAN: NoopSpan;
7462
7481
  declare global {
@@ -7529,8 +7548,11 @@ declare class BraintrustState {
7529
7548
  private _apiConn;
7530
7549
  private _proxyConn;
7531
7550
  promptCache: PromptCache;
7551
+ private _idGenerator;
7532
7552
  constructor(loginParams: LoginOptions);
7533
7553
  resetLoginInfo(): void;
7554
+ resetIdGenState(): void;
7555
+ get idGenerator(): IDGenerator;
7534
7556
  copyLoginInfo(other: BraintrustState): void;
7535
7557
  serialize(): SerializedBraintrustState;
7536
7558
  static deserialize(serialized: unknown, opts?: LoginOptions): BraintrustState;
@@ -7548,6 +7570,8 @@ declare class BraintrustState {
7548
7570
  loginReplaceApiConn(apiConn: HTTPConnection): void;
7549
7571
  disable(): void;
7550
7572
  enforceQueueSizeLimit(enforce: boolean): void;
7573
+ toJSON(): Record<string, any>;
7574
+ toString(): string;
7551
7575
  }
7552
7576
  declare class HTTPConnection {
7553
7577
  base_url: string;
@@ -7565,6 +7589,7 @@ declare class HTTPConnection {
7565
7589
  post(path: string, params?: Record<string, unknown> | string, config?: RequestInit): Promise<Response>;
7566
7590
  get_json(object_type: string, args?: Record<string, string | string[] | undefined> | undefined, retries?: number): Promise<any>;
7567
7591
  post_json(object_type: string, args?: Record<string, unknown> | string | undefined): Promise<any>;
7592
+ toString(): string;
7568
7593
  }
7569
7594
  interface ObjectMetadata {
7570
7595
  id: string;