@ax-llm/ax 11.0.41 → 11.0.44

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
@@ -65,6 +65,7 @@ interface AxAIFeatures {
65
65
  functions: boolean;
66
66
  streaming: boolean;
67
67
  functionCot?: boolean;
68
+ thinkingTokenBudget?: boolean;
68
69
  }
69
70
  interface AxBaseAIArgs<TModel, TEmbedModel> {
70
71
  name: string;
@@ -87,6 +88,8 @@ declare class AxBaseAI<TModel, TEmbedModel, TChatRequest, TEmbedRequest, TChatRe
87
88
  private rt?;
88
89
  private fetch?;
89
90
  private tracer?;
91
+ private timeout?;
92
+ private excludeContentFromTrace?;
90
93
  private models?;
91
94
  private modelInfo;
92
95
  private modelUsage?;
@@ -159,6 +162,7 @@ type AxTokenUsage = {
159
162
  promptTokens: number;
160
163
  completionTokens: number;
161
164
  totalTokens: number;
165
+ thoughtsTokens?: number;
162
166
  };
163
167
  type AxModelConfig = {
164
168
  maxTokens?: number;
@@ -195,6 +199,7 @@ type AxFunction = {
195
199
  };
196
200
  type AxChatResponseResult = {
197
201
  content?: string;
202
+ thought?: string;
198
203
  name?: string;
199
204
  id?: string;
200
205
  functionCalls?: {
@@ -324,17 +329,21 @@ type AxRateLimiterFunction = <T = unknown>(reqFunc: () => Promise<T | ReadableSt
324
329
  }>) => Promise<T | ReadableStream$1<T>>;
325
330
  type AxAIPromptConfig = {
326
331
  stream?: boolean;
332
+ thinkingTokenBudget?: number;
327
333
  };
328
334
  type AxAIServiceOptions = {
329
335
  debug?: boolean;
330
336
  rateLimiter?: AxRateLimiterFunction;
331
337
  fetch?: typeof fetch;
332
338
  tracer?: Tracer;
339
+ timeout?: number;
340
+ excludeContentFromTrace?: boolean;
333
341
  };
334
342
  type AxAIServiceActionOptions<TModel = unknown, TEmbedModel = unknown> = {
335
343
  ai?: Readonly<AxAIService<TModel, TEmbedModel>>;
336
344
  sessionId?: string;
337
345
  traceId?: string;
346
+ timeout?: number;
338
347
  rateLimiter?: AxRateLimiterFunction;
339
348
  debug?: boolean;
340
349
  debugHideSystemPrompt?: boolean;
@@ -923,7 +932,7 @@ declare class AxAIDeepSeek extends AxAIOpenAIBase<AxAIDeepSeekModel, undefined>
923
932
  }
924
933
 
925
934
  declare enum AxAIGoogleGeminiModel {
926
- Gemini25Pro = "gemini-2.5-pro-preview-03-25",
935
+ Gemini25Pro = "gemini-2.5-pro-preview-05-06",
927
936
  Gemini25Flash = "gemini-2.5-flash-preview-04-17",
928
937
  Gemini20Flash = "gemini-2.0-flash",
929
938
  Gemini20FlashLite = "gemini-2.0-flash-lite-preview-02-05",
@@ -967,6 +976,7 @@ type AxAIGoogleGeminiContent = {
967
976
  role: 'user';
968
977
  parts: ({
969
978
  text: string;
979
+ thought?: string;
970
980
  } | {
971
981
  inlineData: {
972
982
  mimeType: string;
@@ -1012,6 +1022,7 @@ type AxAIGoogleGeminiTool = {
1012
1022
  function_declarations?: AxAIGoogleGeminiToolFunctionDeclaration[];
1013
1023
  code_execution?: object;
1014
1024
  google_search_retrieval?: AxAIGoogleGeminiToolGoogleSearchRetrieval;
1025
+ url_context?: object;
1015
1026
  };
1016
1027
  type AxAIGoogleGeminiToolConfig = {
1017
1028
  function_calling_config: {
@@ -1023,9 +1034,15 @@ type AxAIGoogleGeminiGenerationConfig = {
1023
1034
  temperature?: number;
1024
1035
  topP?: number;
1025
1036
  topK?: number;
1037
+ frequencyPenalty?: number;
1026
1038
  candidateCount?: number;
1027
1039
  maxOutputTokens?: number;
1028
1040
  stopSequences?: readonly string[];
1041
+ responseMimeType?: string;
1042
+ thinkingConfig?: {
1043
+ thinkingBudget?: number;
1044
+ includeThoughts?: boolean;
1045
+ };
1029
1046
  };
1030
1047
  type AxAIGoogleGeminiSafetySettings = {
1031
1048
  category: AxAIGoogleGeminiSafetyCategory;
@@ -1062,11 +1079,13 @@ type AxAIGoogleGeminiChatResponse = {
1062
1079
  promptTokenCount: number;
1063
1080
  candidatesTokenCount: number;
1064
1081
  totalTokenCount: number;
1082
+ thoughtsTokenCount: number;
1065
1083
  };
1066
1084
  };
1067
1085
  type AxAIGoogleGeminiChatResponseDelta = AxAIGoogleGeminiChatResponse;
1068
1086
  type AxAIGoogleGeminiThinkingConfig = {
1069
- thinkingBudget: number;
1087
+ thinkingTokenBudget?: number;
1088
+ includeThoughts?: boolean;
1070
1089
  };
1071
1090
  /**
1072
1091
  * AxAIGoogleGeminiConfig: Configuration options for Google Gemini API
@@ -1078,7 +1097,8 @@ type AxAIGoogleGeminiConfig = AxModelConfig & {
1078
1097
  embedType?: AxAIGoogleGeminiEmbedTypes;
1079
1098
  dimensions?: number;
1080
1099
  autoTruncate?: boolean;
1081
- thinkingConfig?: AxAIGoogleGeminiThinkingConfig;
1100
+ thinking?: AxAIGoogleGeminiThinkingConfig;
1101
+ urlContext?: string;
1082
1102
  };
1083
1103
  /**
1084
1104
  * AxAIGoogleGeminiEmbedRequest: Structure for making an embedding request to the Google Gemini API.
@@ -1137,6 +1157,7 @@ interface AxAIGoogleGeminiOptionsTools {
1137
1157
  dynamicThreshold?: number;
1138
1158
  };
1139
1159
  googleSearch?: boolean;
1160
+ urlContext?: boolean;
1140
1161
  }
1141
1162
  interface AxAIGoogleGeminiArgs {
1142
1163
  name: 'google-gemini';
@@ -1564,6 +1585,12 @@ declare class AxSignature {
1564
1585
  private updateHash;
1565
1586
  hash: () => string;
1566
1587
  toString: () => string;
1588
+ toJSON: () => {
1589
+ id: string;
1590
+ description: string | undefined;
1591
+ inputFields: AxIField[];
1592
+ outputFields: AxIField[];
1593
+ };
1567
1594
  }
1568
1595
 
1569
1596
  type AxFieldValue = string | string[] | number | boolean | object | null | undefined | {
@@ -1610,6 +1637,8 @@ type AxProgramForwardOptions = {
1610
1637
  fastFail?: boolean;
1611
1638
  debug?: boolean;
1612
1639
  debugHideSystemPrompt?: boolean;
1640
+ thinkingTokenBudget?: number;
1641
+ traceLabel?: string;
1613
1642
  };
1614
1643
  type AxProgramStreamingForwardOptions = Omit<AxProgramForwardOptions, 'stream'>;
1615
1644
  type AxGenDeltaOut<OUT> = {
@@ -1774,9 +1803,11 @@ interface AxGenOptions {
1774
1803
  asserts?: AxAssertion[];
1775
1804
  streamingAsserts?: AxStreamingAssertion[];
1776
1805
  fastFail?: boolean;
1806
+ excludeContentFromTrace?: boolean;
1807
+ traceLabel?: string;
1777
1808
  }
1778
1809
  type AxGenerateResult<OUT extends AxGenOut> = OUT & {
1779
- functions?: AxChatResponseFunctionCall[];
1810
+ thought?: string;
1780
1811
  };
1781
1812
  interface AxResponseHandlerArgs<T> {
1782
1813
  ai: Readonly<AxAIService>;
@@ -1787,6 +1818,7 @@ interface AxResponseHandlerArgs<T> {
1787
1818
  traceId?: string;
1788
1819
  functions?: Readonly<AxFunction[]>;
1789
1820
  fastFail?: boolean;
1821
+ span?: Span;
1790
1822
  }
1791
1823
  interface AxStreamingEvent<T> {
1792
1824
  event: 'delta' | 'done' | 'error';
@@ -1806,6 +1838,8 @@ declare class AxGen<IN extends AxGenIn = AxGenIn, OUT extends AxGenerateResult<A
1806
1838
  private functionsExecuted;
1807
1839
  private fieldProcessors;
1808
1840
  private streamingFieldProcessors;
1841
+ private values;
1842
+ private excludeContentFromTrace;
1809
1843
  constructor(signature: Readonly<AxSignature | string>, options?: Readonly<AxGenOptions>);
1810
1844
  addAssert: (fn: AxAssertion["fn"], message?: string) => void;
1811
1845
  addStreamingAssert: (fieldName: string, fn: AxStreamingAssertion["fn"], message?: string) => void;
@@ -2379,6 +2413,7 @@ declare class AxJSInterpreter {
2379
2413
 
2380
2414
  declare const axSpanAttributes: {
2381
2415
  LLM_SYSTEM: string;
2416
+ LLM_OPERATION_NAME: string;
2382
2417
  LLM_REQUEST_MODEL: string;
2383
2418
  LLM_REQUEST_MAX_TOKENS: string;
2384
2419
  LLM_REQUEST_TEMPERATURE: string;
@@ -2388,8 +2423,10 @@ declare const axSpanAttributes: {
2388
2423
  LLM_REQUEST_STOP_SEQUENCES: string;
2389
2424
  LLM_REQUEST_LLM_IS_STREAMING: string;
2390
2425
  LLM_REQUEST_TOP_P: string;
2391
- LLM_USAGE_PROMPT_TOKENS: string;
2392
- LLM_USAGE_COMPLETION_TOKENS: string;
2426
+ LLM_USAGE_INPUT_TOKENS: string;
2427
+ LLM_USAGE_OUTPUT_TOKENS: string;
2428
+ LLM_USAGE_TOTAL_TOKENS: string;
2429
+ LLM_USAGE_THOUGHTS_TOKENS: string;
2393
2430
  DB_SYSTEM: string;
2394
2431
  DB_TABLE: string;
2395
2432
  DB_NAMESPACE: string;
@@ -2409,7 +2446,12 @@ declare const axSpanAttributes: {
2409
2446
  DB_QUERY_RESULT_DOCUMENT: string;
2410
2447
  };
2411
2448
  declare const axSpanEvents: {
2412
- LLM_PROMPT: string;
2449
+ GEN_AI_USER_MESSAGE: string;
2450
+ GEN_AI_SYSTEM_MESSAGE: string;
2451
+ GEN_AI_ASSISTANT_MESSAGE: string;
2452
+ GEN_AI_TOOL_MESSAGE: string;
2453
+ GEN_AI_CHOICE: string;
2454
+ GEN_AI_USAGE: string;
2413
2455
  };
2414
2456
  declare enum AxLLMRequestTypeValues {
2415
2457
  COMPLETION = "completion",
package/index.d.ts CHANGED
@@ -65,6 +65,7 @@ interface AxAIFeatures {
65
65
  functions: boolean;
66
66
  streaming: boolean;
67
67
  functionCot?: boolean;
68
+ thinkingTokenBudget?: boolean;
68
69
  }
69
70
  interface AxBaseAIArgs<TModel, TEmbedModel> {
70
71
  name: string;
@@ -87,6 +88,8 @@ declare class AxBaseAI<TModel, TEmbedModel, TChatRequest, TEmbedRequest, TChatRe
87
88
  private rt?;
88
89
  private fetch?;
89
90
  private tracer?;
91
+ private timeout?;
92
+ private excludeContentFromTrace?;
90
93
  private models?;
91
94
  private modelInfo;
92
95
  private modelUsage?;
@@ -159,6 +162,7 @@ type AxTokenUsage = {
159
162
  promptTokens: number;
160
163
  completionTokens: number;
161
164
  totalTokens: number;
165
+ thoughtsTokens?: number;
162
166
  };
163
167
  type AxModelConfig = {
164
168
  maxTokens?: number;
@@ -195,6 +199,7 @@ type AxFunction = {
195
199
  };
196
200
  type AxChatResponseResult = {
197
201
  content?: string;
202
+ thought?: string;
198
203
  name?: string;
199
204
  id?: string;
200
205
  functionCalls?: {
@@ -324,17 +329,21 @@ type AxRateLimiterFunction = <T = unknown>(reqFunc: () => Promise<T | ReadableSt
324
329
  }>) => Promise<T | ReadableStream$1<T>>;
325
330
  type AxAIPromptConfig = {
326
331
  stream?: boolean;
332
+ thinkingTokenBudget?: number;
327
333
  };
328
334
  type AxAIServiceOptions = {
329
335
  debug?: boolean;
330
336
  rateLimiter?: AxRateLimiterFunction;
331
337
  fetch?: typeof fetch;
332
338
  tracer?: Tracer;
339
+ timeout?: number;
340
+ excludeContentFromTrace?: boolean;
333
341
  };
334
342
  type AxAIServiceActionOptions<TModel = unknown, TEmbedModel = unknown> = {
335
343
  ai?: Readonly<AxAIService<TModel, TEmbedModel>>;
336
344
  sessionId?: string;
337
345
  traceId?: string;
346
+ timeout?: number;
338
347
  rateLimiter?: AxRateLimiterFunction;
339
348
  debug?: boolean;
340
349
  debugHideSystemPrompt?: boolean;
@@ -923,7 +932,7 @@ declare class AxAIDeepSeek extends AxAIOpenAIBase<AxAIDeepSeekModel, undefined>
923
932
  }
924
933
 
925
934
  declare enum AxAIGoogleGeminiModel {
926
- Gemini25Pro = "gemini-2.5-pro-preview-03-25",
935
+ Gemini25Pro = "gemini-2.5-pro-preview-05-06",
927
936
  Gemini25Flash = "gemini-2.5-flash-preview-04-17",
928
937
  Gemini20Flash = "gemini-2.0-flash",
929
938
  Gemini20FlashLite = "gemini-2.0-flash-lite-preview-02-05",
@@ -967,6 +976,7 @@ type AxAIGoogleGeminiContent = {
967
976
  role: 'user';
968
977
  parts: ({
969
978
  text: string;
979
+ thought?: string;
970
980
  } | {
971
981
  inlineData: {
972
982
  mimeType: string;
@@ -1012,6 +1022,7 @@ type AxAIGoogleGeminiTool = {
1012
1022
  function_declarations?: AxAIGoogleGeminiToolFunctionDeclaration[];
1013
1023
  code_execution?: object;
1014
1024
  google_search_retrieval?: AxAIGoogleGeminiToolGoogleSearchRetrieval;
1025
+ url_context?: object;
1015
1026
  };
1016
1027
  type AxAIGoogleGeminiToolConfig = {
1017
1028
  function_calling_config: {
@@ -1023,9 +1034,15 @@ type AxAIGoogleGeminiGenerationConfig = {
1023
1034
  temperature?: number;
1024
1035
  topP?: number;
1025
1036
  topK?: number;
1037
+ frequencyPenalty?: number;
1026
1038
  candidateCount?: number;
1027
1039
  maxOutputTokens?: number;
1028
1040
  stopSequences?: readonly string[];
1041
+ responseMimeType?: string;
1042
+ thinkingConfig?: {
1043
+ thinkingBudget?: number;
1044
+ includeThoughts?: boolean;
1045
+ };
1029
1046
  };
1030
1047
  type AxAIGoogleGeminiSafetySettings = {
1031
1048
  category: AxAIGoogleGeminiSafetyCategory;
@@ -1062,11 +1079,13 @@ type AxAIGoogleGeminiChatResponse = {
1062
1079
  promptTokenCount: number;
1063
1080
  candidatesTokenCount: number;
1064
1081
  totalTokenCount: number;
1082
+ thoughtsTokenCount: number;
1065
1083
  };
1066
1084
  };
1067
1085
  type AxAIGoogleGeminiChatResponseDelta = AxAIGoogleGeminiChatResponse;
1068
1086
  type AxAIGoogleGeminiThinkingConfig = {
1069
- thinkingBudget: number;
1087
+ thinkingTokenBudget?: number;
1088
+ includeThoughts?: boolean;
1070
1089
  };
1071
1090
  /**
1072
1091
  * AxAIGoogleGeminiConfig: Configuration options for Google Gemini API
@@ -1078,7 +1097,8 @@ type AxAIGoogleGeminiConfig = AxModelConfig & {
1078
1097
  embedType?: AxAIGoogleGeminiEmbedTypes;
1079
1098
  dimensions?: number;
1080
1099
  autoTruncate?: boolean;
1081
- thinkingConfig?: AxAIGoogleGeminiThinkingConfig;
1100
+ thinking?: AxAIGoogleGeminiThinkingConfig;
1101
+ urlContext?: string;
1082
1102
  };
1083
1103
  /**
1084
1104
  * AxAIGoogleGeminiEmbedRequest: Structure for making an embedding request to the Google Gemini API.
@@ -1137,6 +1157,7 @@ interface AxAIGoogleGeminiOptionsTools {
1137
1157
  dynamicThreshold?: number;
1138
1158
  };
1139
1159
  googleSearch?: boolean;
1160
+ urlContext?: boolean;
1140
1161
  }
1141
1162
  interface AxAIGoogleGeminiArgs {
1142
1163
  name: 'google-gemini';
@@ -1564,6 +1585,12 @@ declare class AxSignature {
1564
1585
  private updateHash;
1565
1586
  hash: () => string;
1566
1587
  toString: () => string;
1588
+ toJSON: () => {
1589
+ id: string;
1590
+ description: string | undefined;
1591
+ inputFields: AxIField[];
1592
+ outputFields: AxIField[];
1593
+ };
1567
1594
  }
1568
1595
 
1569
1596
  type AxFieldValue = string | string[] | number | boolean | object | null | undefined | {
@@ -1610,6 +1637,8 @@ type AxProgramForwardOptions = {
1610
1637
  fastFail?: boolean;
1611
1638
  debug?: boolean;
1612
1639
  debugHideSystemPrompt?: boolean;
1640
+ thinkingTokenBudget?: number;
1641
+ traceLabel?: string;
1613
1642
  };
1614
1643
  type AxProgramStreamingForwardOptions = Omit<AxProgramForwardOptions, 'stream'>;
1615
1644
  type AxGenDeltaOut<OUT> = {
@@ -1774,9 +1803,11 @@ interface AxGenOptions {
1774
1803
  asserts?: AxAssertion[];
1775
1804
  streamingAsserts?: AxStreamingAssertion[];
1776
1805
  fastFail?: boolean;
1806
+ excludeContentFromTrace?: boolean;
1807
+ traceLabel?: string;
1777
1808
  }
1778
1809
  type AxGenerateResult<OUT extends AxGenOut> = OUT & {
1779
- functions?: AxChatResponseFunctionCall[];
1810
+ thought?: string;
1780
1811
  };
1781
1812
  interface AxResponseHandlerArgs<T> {
1782
1813
  ai: Readonly<AxAIService>;
@@ -1787,6 +1818,7 @@ interface AxResponseHandlerArgs<T> {
1787
1818
  traceId?: string;
1788
1819
  functions?: Readonly<AxFunction[]>;
1789
1820
  fastFail?: boolean;
1821
+ span?: Span;
1790
1822
  }
1791
1823
  interface AxStreamingEvent<T> {
1792
1824
  event: 'delta' | 'done' | 'error';
@@ -1806,6 +1838,8 @@ declare class AxGen<IN extends AxGenIn = AxGenIn, OUT extends AxGenerateResult<A
1806
1838
  private functionsExecuted;
1807
1839
  private fieldProcessors;
1808
1840
  private streamingFieldProcessors;
1841
+ private values;
1842
+ private excludeContentFromTrace;
1809
1843
  constructor(signature: Readonly<AxSignature | string>, options?: Readonly<AxGenOptions>);
1810
1844
  addAssert: (fn: AxAssertion["fn"], message?: string) => void;
1811
1845
  addStreamingAssert: (fieldName: string, fn: AxStreamingAssertion["fn"], message?: string) => void;
@@ -2379,6 +2413,7 @@ declare class AxJSInterpreter {
2379
2413
 
2380
2414
  declare const axSpanAttributes: {
2381
2415
  LLM_SYSTEM: string;
2416
+ LLM_OPERATION_NAME: string;
2382
2417
  LLM_REQUEST_MODEL: string;
2383
2418
  LLM_REQUEST_MAX_TOKENS: string;
2384
2419
  LLM_REQUEST_TEMPERATURE: string;
@@ -2388,8 +2423,10 @@ declare const axSpanAttributes: {
2388
2423
  LLM_REQUEST_STOP_SEQUENCES: string;
2389
2424
  LLM_REQUEST_LLM_IS_STREAMING: string;
2390
2425
  LLM_REQUEST_TOP_P: string;
2391
- LLM_USAGE_PROMPT_TOKENS: string;
2392
- LLM_USAGE_COMPLETION_TOKENS: string;
2426
+ LLM_USAGE_INPUT_TOKENS: string;
2427
+ LLM_USAGE_OUTPUT_TOKENS: string;
2428
+ LLM_USAGE_TOTAL_TOKENS: string;
2429
+ LLM_USAGE_THOUGHTS_TOKENS: string;
2393
2430
  DB_SYSTEM: string;
2394
2431
  DB_TABLE: string;
2395
2432
  DB_NAMESPACE: string;
@@ -2409,7 +2446,12 @@ declare const axSpanAttributes: {
2409
2446
  DB_QUERY_RESULT_DOCUMENT: string;
2410
2447
  };
2411
2448
  declare const axSpanEvents: {
2412
- LLM_PROMPT: string;
2449
+ GEN_AI_USER_MESSAGE: string;
2450
+ GEN_AI_SYSTEM_MESSAGE: string;
2451
+ GEN_AI_ASSISTANT_MESSAGE: string;
2452
+ GEN_AI_TOOL_MESSAGE: string;
2453
+ GEN_AI_CHOICE: string;
2454
+ GEN_AI_USAGE: string;
2413
2455
  };
2414
2456
  declare enum AxLLMRequestTypeValues {
2415
2457
  COMPLETION = "completion",