@ax-llm/ax 11.0.31 → 11.0.33

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
@@ -904,6 +904,7 @@ declare class AxAIDeepSeek extends AxAIOpenAIBase<AxAIDeepSeekModel, undefined>
904
904
  }
905
905
 
906
906
  declare enum AxAIGoogleGeminiModel {
907
+ Gemini25Pro = "gemini-2.5-pro-exp-03-25",
907
908
  Gemini20Pro = "gemini-2.0-pro-exp-02-05",
908
909
  Gemini20Flash = "gemini-2.0-flash",
909
910
  Gemini20FlashLite = "gemini-2.0-flash-lite-preview-02-05",
@@ -912,12 +913,11 @@ declare enum AxAIGoogleGeminiModel {
912
913
  Gemini15Flash = "gemini-1.5-flash",
913
914
  Gemini15Flash002 = "gemini-1.5-flash-002",
914
915
  Gemini15Flash8B = "gemini-1.5-flash-8b",
915
- Gemini15Pro = "gemini-1.5-pro",
916
- Gemma2 = "gemma-2-27b-it",
917
- AQA = "aqa"
916
+ Gemini15Pro = "gemini-1.5-pro"
918
917
  }
919
918
  declare enum AxAIGoogleGeminiEmbedModel {
920
919
  GeminiEmbedding = "gemini-embedding-exp-03-07",
920
+ TextEmbeddingLarge = "text-embedding-large-exp-03-07",
921
921
  TextEmbedding004 = "text-embedding-004",
922
922
  TextEmbedding005 = "text-embedding-005"
923
923
  }
@@ -1055,6 +1055,7 @@ type AxAIGoogleGeminiConfig = AxModelConfig & {
1055
1055
  safetySettings?: AxAIGoogleGeminiSafetySettings;
1056
1056
  embedType?: AxAIGoogleGeminiEmbedTypes;
1057
1057
  dimensions?: number;
1058
+ autoTruncate?: boolean;
1058
1059
  };
1059
1060
  /**
1060
1061
  * AxAIGoogleGeminiEmbedRequest: Structure for making an embedding request to the Google Gemini API.
@@ -1083,7 +1084,12 @@ type AxAIGoogleGeminiBatchEmbedResponse = {
1083
1084
  type AxAIGoogleVertexBatchEmbedRequest = {
1084
1085
  instances: {
1085
1086
  content: string;
1087
+ task_type?: AxAIGoogleGeminiEmbedTypes;
1086
1088
  }[];
1089
+ parameters: {
1090
+ autoTruncate?: boolean;
1091
+ outputDimensionality?: number;
1092
+ };
1087
1093
  };
1088
1094
  /**
1089
1095
  * AxAIGoogleVertexBatchEmbedResponse: Structure for handling responses from the Google Vertex API embedding requests.
@@ -1482,6 +1488,7 @@ declare class AxFunctionError extends Error {
1482
1488
  field: string;
1483
1489
  message: string;
1484
1490
  }[];
1491
+ toString(): string;
1485
1492
  }
1486
1493
  type AxChatResponseFunctionCall = {
1487
1494
  id: string;
@@ -1665,6 +1672,7 @@ declare class AxAssertionError extends Error {
1665
1672
  title: string;
1666
1673
  description: string;
1667
1674
  }[];
1675
+ toString(): string;
1668
1676
  }
1669
1677
 
1670
1678
  type AxFieldProcessorProcess = (value: AxFieldValue, context?: Readonly<{
package/index.d.ts CHANGED
@@ -904,6 +904,7 @@ declare class AxAIDeepSeek extends AxAIOpenAIBase<AxAIDeepSeekModel, undefined>
904
904
  }
905
905
 
906
906
  declare enum AxAIGoogleGeminiModel {
907
+ Gemini25Pro = "gemini-2.5-pro-exp-03-25",
907
908
  Gemini20Pro = "gemini-2.0-pro-exp-02-05",
908
909
  Gemini20Flash = "gemini-2.0-flash",
909
910
  Gemini20FlashLite = "gemini-2.0-flash-lite-preview-02-05",
@@ -912,12 +913,11 @@ declare enum AxAIGoogleGeminiModel {
912
913
  Gemini15Flash = "gemini-1.5-flash",
913
914
  Gemini15Flash002 = "gemini-1.5-flash-002",
914
915
  Gemini15Flash8B = "gemini-1.5-flash-8b",
915
- Gemini15Pro = "gemini-1.5-pro",
916
- Gemma2 = "gemma-2-27b-it",
917
- AQA = "aqa"
916
+ Gemini15Pro = "gemini-1.5-pro"
918
917
  }
919
918
  declare enum AxAIGoogleGeminiEmbedModel {
920
919
  GeminiEmbedding = "gemini-embedding-exp-03-07",
920
+ TextEmbeddingLarge = "text-embedding-large-exp-03-07",
921
921
  TextEmbedding004 = "text-embedding-004",
922
922
  TextEmbedding005 = "text-embedding-005"
923
923
  }
@@ -1055,6 +1055,7 @@ type AxAIGoogleGeminiConfig = AxModelConfig & {
1055
1055
  safetySettings?: AxAIGoogleGeminiSafetySettings;
1056
1056
  embedType?: AxAIGoogleGeminiEmbedTypes;
1057
1057
  dimensions?: number;
1058
+ autoTruncate?: boolean;
1058
1059
  };
1059
1060
  /**
1060
1061
  * AxAIGoogleGeminiEmbedRequest: Structure for making an embedding request to the Google Gemini API.
@@ -1083,7 +1084,12 @@ type AxAIGoogleGeminiBatchEmbedResponse = {
1083
1084
  type AxAIGoogleVertexBatchEmbedRequest = {
1084
1085
  instances: {
1085
1086
  content: string;
1087
+ task_type?: AxAIGoogleGeminiEmbedTypes;
1086
1088
  }[];
1089
+ parameters: {
1090
+ autoTruncate?: boolean;
1091
+ outputDimensionality?: number;
1092
+ };
1087
1093
  };
1088
1094
  /**
1089
1095
  * AxAIGoogleVertexBatchEmbedResponse: Structure for handling responses from the Google Vertex API embedding requests.
@@ -1482,6 +1488,7 @@ declare class AxFunctionError extends Error {
1482
1488
  field: string;
1483
1489
  message: string;
1484
1490
  }[];
1491
+ toString(): string;
1485
1492
  }
1486
1493
  type AxChatResponseFunctionCall = {
1487
1494
  id: string;
@@ -1665,6 +1672,7 @@ declare class AxAssertionError extends Error {
1665
1672
  title: string;
1666
1673
  description: string;
1667
1674
  }[];
1675
+ toString(): string;
1668
1676
  }
1669
1677
 
1670
1678
  type AxFieldProcessorProcess = (value: AxFieldValue, context?: Readonly<{
package/index.js CHANGED
@@ -2503,6 +2503,7 @@ var AxAIDeepSeek = class extends AxAIOpenAIBase {
2503
2503
 
2504
2504
  // ai/google-gemini/types.ts
2505
2505
  var AxAIGoogleGeminiModel = /* @__PURE__ */ ((AxAIGoogleGeminiModel2) => {
2506
+ AxAIGoogleGeminiModel2["Gemini25Pro"] = "gemini-2.5-pro-exp-03-25";
2506
2507
  AxAIGoogleGeminiModel2["Gemini20Pro"] = "gemini-2.0-pro-exp-02-05";
2507
2508
  AxAIGoogleGeminiModel2["Gemini20Flash"] = "gemini-2.0-flash";
2508
2509
  AxAIGoogleGeminiModel2["Gemini20FlashLite"] = "gemini-2.0-flash-lite-preview-02-05";
@@ -2512,12 +2513,11 @@ var AxAIGoogleGeminiModel = /* @__PURE__ */ ((AxAIGoogleGeminiModel2) => {
2512
2513
  AxAIGoogleGeminiModel2["Gemini15Flash002"] = "gemini-1.5-flash-002";
2513
2514
  AxAIGoogleGeminiModel2["Gemini15Flash8B"] = "gemini-1.5-flash-8b";
2514
2515
  AxAIGoogleGeminiModel2["Gemini15Pro"] = "gemini-1.5-pro";
2515
- AxAIGoogleGeminiModel2["Gemma2"] = "gemma-2-27b-it";
2516
- AxAIGoogleGeminiModel2["AQA"] = "aqa";
2517
2516
  return AxAIGoogleGeminiModel2;
2518
2517
  })(AxAIGoogleGeminiModel || {});
2519
2518
  var AxAIGoogleGeminiEmbedModel = /* @__PURE__ */ ((AxAIGoogleGeminiEmbedModel2) => {
2520
2519
  AxAIGoogleGeminiEmbedModel2["GeminiEmbedding"] = "gemini-embedding-exp-03-07";
2520
+ AxAIGoogleGeminiEmbedModel2["TextEmbeddingLarge"] = "text-embedding-large-exp-03-07";
2521
2521
  AxAIGoogleGeminiEmbedModel2["TextEmbedding004"] = "text-embedding-004";
2522
2522
  AxAIGoogleGeminiEmbedModel2["TextEmbedding005"] = "text-embedding-005";
2523
2523
  return AxAIGoogleGeminiEmbedModel2;
@@ -2647,6 +2647,9 @@ var AxAIGoogleGeminiImpl = class {
2647
2647
  this.endpointId = endpointId;
2648
2648
  this.apiKey = apiKey;
2649
2649
  this.options = options;
2650
+ if (!this.isVertex && this.config.autoTruncate) {
2651
+ throw new Error("Auto truncate is not supported for GoogleGemini");
2652
+ }
2650
2653
  }
2651
2654
  getModelConfig() {
2652
2655
  const { config } = this;
@@ -2842,8 +2845,13 @@ var AxAIGoogleGeminiImpl = class {
2842
2845
  }
2843
2846
  reqValue = {
2844
2847
  instances: req.texts.map((text) => ({
2845
- content: text
2846
- }))
2848
+ content: text,
2849
+ ...this.config.embedType && { taskType: this.config.embedType }
2850
+ })),
2851
+ parameters: {
2852
+ autoTruncate: this.config.autoTruncate,
2853
+ outputDimensionality: this.config.dimensions
2854
+ }
2847
2855
  };
2848
2856
  } else {
2849
2857
  apiConfig = {
@@ -2854,7 +2862,7 @@ var AxAIGoogleGeminiImpl = class {
2854
2862
  model: "models/" + model,
2855
2863
  content: { parts: [{ text }] },
2856
2864
  outputDimensionality: this.config.dimensions,
2857
- taskType: this.config.embedType
2865
+ ...this.config.embedType && { taskType: this.config.embedType }
2858
2866
  }))
2859
2867
  };
2860
2868
  }
@@ -3976,6 +3984,12 @@ var AxAssertionError = class extends Error {
3976
3984
  });
3977
3985
  return extraFields;
3978
3986
  };
3987
+ toString() {
3988
+ return `${this.name}: ${this.message}`;
3989
+ }
3990
+ [Symbol.for("nodejs.util.inspect.custom")](_depth, _options) {
3991
+ return this.toString();
3992
+ }
3979
3993
  };
3980
3994
  var assertAssertions = async (asserts, values) => {
3981
3995
  for (const assert of asserts) {
@@ -5413,6 +5427,17 @@ var ValidationError = class extends Error {
5413
5427
  description: `The section labeled '${field.title}' either was not generated by the LLM or does not match the expected format of '${toFieldType(field.type)}'. ${this.message} Please revise your response to ensure it conforms to the specified format.`
5414
5428
  }));
5415
5429
  };
5430
+ toString() {
5431
+ return [
5432
+ `${this.name}: ${this.message}`,
5433
+ ...this.fields.map(
5434
+ (field) => ` - ${field.title}: Expected format '${toFieldType(field.type)}'`
5435
+ )
5436
+ ].join("\n");
5437
+ }
5438
+ [Symbol.for("nodejs.util.inspect.custom")](_depth, _options) {
5439
+ return this.toString();
5440
+ }
5416
5441
  };
5417
5442
  function handleValidationError(mem, errorFields, ai, promptTemplate, sessionId) {
5418
5443
  mem.add(
@@ -5896,6 +5921,15 @@ var AxFunctionError = class extends Error {
5896
5921
  this.name = this.constructor.name;
5897
5922
  }
5898
5923
  getFields = () => this.fields;
5924
+ toString() {
5925
+ return [
5926
+ `${this.name}: Function validation error`,
5927
+ ...this.fields.map((field) => ` - ${field.field}: ${field.message}`)
5928
+ ].join("\n");
5929
+ }
5930
+ [Symbol.for("nodejs.util.inspect.custom")](_depth, _options) {
5931
+ return this.toString();
5932
+ }
5899
5933
  };
5900
5934
  var FunctionError = class extends Error {
5901
5935
  constructor(fields, func, funcId) {
@@ -5924,6 +5958,19 @@ var FunctionError = class extends Error {
5924
5958
  return `Errors In Function Arguments: Fix the following invalid arguments to '${this.func.name}'
5925
5959
  ${bulletPoints.join("\n")}`;
5926
5960
  };
5961
+ toString() {
5962
+ return [
5963
+ `${this.name}: Function execution error in '${this.func.name}'`,
5964
+ ...this.fields.map((field) => {
5965
+ const description = this.getFieldDescription(field.field);
5966
+ return ` - ${field.field}: ${field.message}${description ? ` (${description})` : ""}`;
5967
+ }),
5968
+ this.funcId ? ` Function ID: ${this.funcId}` : ""
5969
+ ].join("\n");
5970
+ }
5971
+ [Symbol.for("nodejs.util.inspect.custom")](_depth, _options) {
5972
+ return this.toString();
5973
+ }
5927
5974
  };
5928
5975
  var AxFunctionProcessor = class {
5929
5976
  funcList = [];
@@ -6438,7 +6485,7 @@ var AxGen = class extends AxProgramWithSignature {
6438
6485
  }
6439
6486
  }
6440
6487
  }
6441
- throw new Error(`Unable to fix validation error: ${err?.message}`);
6488
+ throw new Error(`Unable to fix validation error: ${err}`);
6442
6489
  }
6443
6490
  throw new Error(`Max steps reached: ${maxSteps}`);
6444
6491
  }