@ax-llm/ax 10.0.46 → 10.0.47

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/index.d.cts CHANGED
@@ -8,79 +8,58 @@ interface RetryConfig {
8
8
  backoffFactor: number;
9
9
  retryableStatusCodes: number[];
10
10
  }
11
- /**
12
- * Base Error class with enhanced error tracking
13
- */
11
+ interface RequestValidation {
12
+ validateRequest?: (request: unknown) => boolean | Promise<boolean>;
13
+ }
14
+ interface ResponseValidation {
15
+ validateResponse?: (response: unknown) => boolean | Promise<boolean>;
16
+ }
17
+ interface AxAPI {
18
+ name?: string;
19
+ headers?: Record<string, string>;
20
+ put?: boolean;
21
+ }
22
+ interface AxAPIConfig extends AxAPI, RequestValidation, ResponseValidation {
23
+ url: string | URL;
24
+ stream?: boolean;
25
+ debug?: boolean;
26
+ fetch?: typeof fetch;
27
+ span?: Span;
28
+ timeout?: number;
29
+ retry?: Partial<RetryConfig>;
30
+ }
14
31
  declare class AxAIServiceError extends Error {
15
32
  readonly url: string;
16
33
  readonly requestBody?: unknown | undefined;
17
- readonly context: Record<string, unknown>;
18
34
  readonly timestamp: string;
19
35
  readonly errorId: string;
36
+ readonly context: Record<string, unknown>;
20
37
  constructor(message: string, url: string, requestBody?: unknown | undefined, context?: Record<string, unknown>);
21
38
  toString(): string;
22
39
  toJSON(): Record<string, unknown>;
23
40
  }
24
- /**
25
- * HTTP Status Error with enhanced context
26
- */
27
41
  declare class AxAIServiceStatusError extends AxAIServiceError {
28
42
  readonly status: number;
29
43
  readonly statusText: string;
30
44
  constructor(status: number, statusText: string, url: string, requestBody?: unknown, context?: Record<string, unknown>);
31
45
  }
32
- /**
33
- * Network/IO Error with enhanced context
34
- */
35
46
  declare class AxAIServiceNetworkError extends AxAIServiceError {
36
47
  readonly originalError: Error;
37
48
  constructor(originalError: Error, url: string, requestBody?: unknown, context?: Record<string, unknown>);
38
49
  }
39
- /**
40
- * Response Processing Error with validation context
41
- */
42
50
  declare class AxAIServiceResponseError extends AxAIServiceError {
43
51
  constructor(message: string, url: string, requestBody?: unknown, context?: Record<string, unknown>);
44
52
  }
45
- /**
46
- * Stream Terminated Error with enhanced context
47
- */
48
53
  declare class AxAIServiceStreamTerminatedError extends AxAIServiceError {
49
54
  readonly lastChunk?: unknown | undefined;
50
55
  constructor(url: string, requestBody?: unknown, lastChunk?: unknown | undefined, context?: Record<string, unknown>);
51
56
  }
52
- /**
53
- * Request timeout error
54
- */
55
57
  declare class AxAIServiceTimeoutError extends AxAIServiceError {
56
58
  constructor(url: string, timeoutMs: number, requestBody?: unknown, context?: Record<string, unknown>);
57
59
  }
58
- /**
59
- * Authentication error
60
- */
61
60
  declare class AxAIServiceAuthenticationError extends AxAIServiceError {
62
61
  constructor(url: string, requestBody?: unknown, context?: Record<string, unknown>);
63
62
  }
64
- /**
65
- * API Configuration interface
66
- */
67
- interface AxAPI {
68
- name?: string;
69
- headers?: Record<string, string>;
70
- put?: boolean;
71
- }
72
- /**
73
- * Extended API Configuration
74
- */
75
- interface AxAPIConfig extends AxAPI {
76
- url: string | URL;
77
- stream?: boolean;
78
- debug?: boolean;
79
- fetch?: typeof fetch;
80
- span?: Span;
81
- timeout?: number;
82
- retry?: Partial<RetryConfig>;
83
- }
84
63
 
85
64
  type AxAIModelMap = Record<string, string>;
86
65
  type AxModelInfo = {
@@ -551,8 +530,9 @@ declare class AxAIAnthropic extends AxBaseAI<AxAIAnthropicChatRequest, unknown,
551
530
  }
552
531
 
553
532
  declare enum AxAIOpenAIModel {
554
- O1Preview = "o1-preview",
533
+ O1 = "o1",
555
534
  O1Mini = "o1-mini",
535
+ O3Mini = "o3-mini",
556
536
  GPT4 = "gpt-4",
557
537
  GPT4O = "gpt-4o",
558
538
  GPT4OMini = "gpt-4o-mini",
@@ -581,6 +561,8 @@ type AxAIOpenAIConfig = Omit<AxModelConfig, 'topK'> & {
581
561
  logprobs?: number;
582
562
  echo?: boolean;
583
563
  dimensions?: number;
564
+ reasoningEffort?: 'low' | 'medium' | 'high';
565
+ store?: boolean;
584
566
  };
585
567
  type AxAIOpenAILogprob = {
586
568
  tokens: string[];
@@ -608,6 +590,8 @@ interface AxAIOpenAIResponseDelta<T> {
608
590
  }
609
591
  type AxAIOpenAIChatRequest = {
610
592
  model: string;
593
+ reasoning_effort?: 'low' | 'medium' | 'high';
594
+ store?: boolean;
611
595
  messages: ({
612
596
  role: 'system';
613
597
  content: string;
@@ -1702,6 +1686,7 @@ declare class AxApacheTika {
1702
1686
  */
1703
1687
  type AxBalancerOptions = {
1704
1688
  comparator?: (a: AxAIService, b: AxAIService) => number;
1689
+ debug?: boolean;
1705
1690
  };
1706
1691
  /**
1707
1692
  * Balancer that rotates through services.
@@ -1710,6 +1695,7 @@ declare class AxBalancer implements AxAIService {
1710
1695
  private services;
1711
1696
  private currentServiceIndex;
1712
1697
  private currentService;
1698
+ private debug;
1713
1699
  constructor(services: readonly AxAIService[], options?: AxBalancerOptions);
1714
1700
  /**
1715
1701
  * Service comparator that respects the input order of services.
package/index.d.ts CHANGED
@@ -8,79 +8,58 @@ interface RetryConfig {
8
8
  backoffFactor: number;
9
9
  retryableStatusCodes: number[];
10
10
  }
11
- /**
12
- * Base Error class with enhanced error tracking
13
- */
11
+ interface RequestValidation {
12
+ validateRequest?: (request: unknown) => boolean | Promise<boolean>;
13
+ }
14
+ interface ResponseValidation {
15
+ validateResponse?: (response: unknown) => boolean | Promise<boolean>;
16
+ }
17
+ interface AxAPI {
18
+ name?: string;
19
+ headers?: Record<string, string>;
20
+ put?: boolean;
21
+ }
22
+ interface AxAPIConfig extends AxAPI, RequestValidation, ResponseValidation {
23
+ url: string | URL;
24
+ stream?: boolean;
25
+ debug?: boolean;
26
+ fetch?: typeof fetch;
27
+ span?: Span;
28
+ timeout?: number;
29
+ retry?: Partial<RetryConfig>;
30
+ }
14
31
  declare class AxAIServiceError extends Error {
15
32
  readonly url: string;
16
33
  readonly requestBody?: unknown | undefined;
17
- readonly context: Record<string, unknown>;
18
34
  readonly timestamp: string;
19
35
  readonly errorId: string;
36
+ readonly context: Record<string, unknown>;
20
37
  constructor(message: string, url: string, requestBody?: unknown | undefined, context?: Record<string, unknown>);
21
38
  toString(): string;
22
39
  toJSON(): Record<string, unknown>;
23
40
  }
24
- /**
25
- * HTTP Status Error with enhanced context
26
- */
27
41
  declare class AxAIServiceStatusError extends AxAIServiceError {
28
42
  readonly status: number;
29
43
  readonly statusText: string;
30
44
  constructor(status: number, statusText: string, url: string, requestBody?: unknown, context?: Record<string, unknown>);
31
45
  }
32
- /**
33
- * Network/IO Error with enhanced context
34
- */
35
46
  declare class AxAIServiceNetworkError extends AxAIServiceError {
36
47
  readonly originalError: Error;
37
48
  constructor(originalError: Error, url: string, requestBody?: unknown, context?: Record<string, unknown>);
38
49
  }
39
- /**
40
- * Response Processing Error with validation context
41
- */
42
50
  declare class AxAIServiceResponseError extends AxAIServiceError {
43
51
  constructor(message: string, url: string, requestBody?: unknown, context?: Record<string, unknown>);
44
52
  }
45
- /**
46
- * Stream Terminated Error with enhanced context
47
- */
48
53
  declare class AxAIServiceStreamTerminatedError extends AxAIServiceError {
49
54
  readonly lastChunk?: unknown | undefined;
50
55
  constructor(url: string, requestBody?: unknown, lastChunk?: unknown | undefined, context?: Record<string, unknown>);
51
56
  }
52
- /**
53
- * Request timeout error
54
- */
55
57
  declare class AxAIServiceTimeoutError extends AxAIServiceError {
56
58
  constructor(url: string, timeoutMs: number, requestBody?: unknown, context?: Record<string, unknown>);
57
59
  }
58
- /**
59
- * Authentication error
60
- */
61
60
  declare class AxAIServiceAuthenticationError extends AxAIServiceError {
62
61
  constructor(url: string, requestBody?: unknown, context?: Record<string, unknown>);
63
62
  }
64
- /**
65
- * API Configuration interface
66
- */
67
- interface AxAPI {
68
- name?: string;
69
- headers?: Record<string, string>;
70
- put?: boolean;
71
- }
72
- /**
73
- * Extended API Configuration
74
- */
75
- interface AxAPIConfig extends AxAPI {
76
- url: string | URL;
77
- stream?: boolean;
78
- debug?: boolean;
79
- fetch?: typeof fetch;
80
- span?: Span;
81
- timeout?: number;
82
- retry?: Partial<RetryConfig>;
83
- }
84
63
 
85
64
  type AxAIModelMap = Record<string, string>;
86
65
  type AxModelInfo = {
@@ -551,8 +530,9 @@ declare class AxAIAnthropic extends AxBaseAI<AxAIAnthropicChatRequest, unknown,
551
530
  }
552
531
 
553
532
  declare enum AxAIOpenAIModel {
554
- O1Preview = "o1-preview",
533
+ O1 = "o1",
555
534
  O1Mini = "o1-mini",
535
+ O3Mini = "o3-mini",
556
536
  GPT4 = "gpt-4",
557
537
  GPT4O = "gpt-4o",
558
538
  GPT4OMini = "gpt-4o-mini",
@@ -581,6 +561,8 @@ type AxAIOpenAIConfig = Omit<AxModelConfig, 'topK'> & {
581
561
  logprobs?: number;
582
562
  echo?: boolean;
583
563
  dimensions?: number;
564
+ reasoningEffort?: 'low' | 'medium' | 'high';
565
+ store?: boolean;
584
566
  };
585
567
  type AxAIOpenAILogprob = {
586
568
  tokens: string[];
@@ -608,6 +590,8 @@ interface AxAIOpenAIResponseDelta<T> {
608
590
  }
609
591
  type AxAIOpenAIChatRequest = {
610
592
  model: string;
593
+ reasoning_effort?: 'low' | 'medium' | 'high';
594
+ store?: boolean;
611
595
  messages: ({
612
596
  role: 'system';
613
597
  content: string;
@@ -1702,6 +1686,7 @@ declare class AxApacheTika {
1702
1686
  */
1703
1687
  type AxBalancerOptions = {
1704
1688
  comparator?: (a: AxAIService, b: AxAIService) => number;
1689
+ debug?: boolean;
1705
1690
  };
1706
1691
  /**
1707
1692
  * Balancer that rotates through services.
@@ -1710,6 +1695,7 @@ declare class AxBalancer implements AxAIService {
1710
1695
  private services;
1711
1696
  private currentServiceIndex;
1712
1697
  private currentService;
1698
+ private debug;
1713
1699
  constructor(services: readonly AxAIService[], options?: AxBalancerOptions);
1714
1700
  /**
1715
1701
  * Service comparator that respects the input order of services.