@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.cjs +53 -6
- package/index.cjs.map +1 -1
- package/index.d.cts +11 -3
- package/index.d.ts +11 -3
- package/index.js +53 -6
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.cjs
CHANGED
|
@@ -2653,6 +2653,7 @@ var AxAIDeepSeek = class extends AxAIOpenAIBase {
|
|
|
2653
2653
|
|
|
2654
2654
|
// ai/google-gemini/types.ts
|
|
2655
2655
|
var AxAIGoogleGeminiModel = /* @__PURE__ */ ((AxAIGoogleGeminiModel2) => {
|
|
2656
|
+
AxAIGoogleGeminiModel2["Gemini25Pro"] = "gemini-2.5-pro-exp-03-25";
|
|
2656
2657
|
AxAIGoogleGeminiModel2["Gemini20Pro"] = "gemini-2.0-pro-exp-02-05";
|
|
2657
2658
|
AxAIGoogleGeminiModel2["Gemini20Flash"] = "gemini-2.0-flash";
|
|
2658
2659
|
AxAIGoogleGeminiModel2["Gemini20FlashLite"] = "gemini-2.0-flash-lite-preview-02-05";
|
|
@@ -2662,12 +2663,11 @@ var AxAIGoogleGeminiModel = /* @__PURE__ */ ((AxAIGoogleGeminiModel2) => {
|
|
|
2662
2663
|
AxAIGoogleGeminiModel2["Gemini15Flash002"] = "gemini-1.5-flash-002";
|
|
2663
2664
|
AxAIGoogleGeminiModel2["Gemini15Flash8B"] = "gemini-1.5-flash-8b";
|
|
2664
2665
|
AxAIGoogleGeminiModel2["Gemini15Pro"] = "gemini-1.5-pro";
|
|
2665
|
-
AxAIGoogleGeminiModel2["Gemma2"] = "gemma-2-27b-it";
|
|
2666
|
-
AxAIGoogleGeminiModel2["AQA"] = "aqa";
|
|
2667
2666
|
return AxAIGoogleGeminiModel2;
|
|
2668
2667
|
})(AxAIGoogleGeminiModel || {});
|
|
2669
2668
|
var AxAIGoogleGeminiEmbedModel = /* @__PURE__ */ ((AxAIGoogleGeminiEmbedModel2) => {
|
|
2670
2669
|
AxAIGoogleGeminiEmbedModel2["GeminiEmbedding"] = "gemini-embedding-exp-03-07";
|
|
2670
|
+
AxAIGoogleGeminiEmbedModel2["TextEmbeddingLarge"] = "text-embedding-large-exp-03-07";
|
|
2671
2671
|
AxAIGoogleGeminiEmbedModel2["TextEmbedding004"] = "text-embedding-004";
|
|
2672
2672
|
AxAIGoogleGeminiEmbedModel2["TextEmbedding005"] = "text-embedding-005";
|
|
2673
2673
|
return AxAIGoogleGeminiEmbedModel2;
|
|
@@ -2797,6 +2797,9 @@ var AxAIGoogleGeminiImpl = class {
|
|
|
2797
2797
|
this.endpointId = endpointId;
|
|
2798
2798
|
this.apiKey = apiKey;
|
|
2799
2799
|
this.options = options;
|
|
2800
|
+
if (!this.isVertex && this.config.autoTruncate) {
|
|
2801
|
+
throw new Error("Auto truncate is not supported for GoogleGemini");
|
|
2802
|
+
}
|
|
2800
2803
|
}
|
|
2801
2804
|
getModelConfig() {
|
|
2802
2805
|
const { config } = this;
|
|
@@ -2992,8 +2995,13 @@ var AxAIGoogleGeminiImpl = class {
|
|
|
2992
2995
|
}
|
|
2993
2996
|
reqValue = {
|
|
2994
2997
|
instances: req.texts.map((text) => ({
|
|
2995
|
-
content: text
|
|
2996
|
-
|
|
2998
|
+
content: text,
|
|
2999
|
+
...this.config.embedType && { taskType: this.config.embedType }
|
|
3000
|
+
})),
|
|
3001
|
+
parameters: {
|
|
3002
|
+
autoTruncate: this.config.autoTruncate,
|
|
3003
|
+
outputDimensionality: this.config.dimensions
|
|
3004
|
+
}
|
|
2997
3005
|
};
|
|
2998
3006
|
} else {
|
|
2999
3007
|
apiConfig = {
|
|
@@ -3004,7 +3012,7 @@ var AxAIGoogleGeminiImpl = class {
|
|
|
3004
3012
|
model: "models/" + model,
|
|
3005
3013
|
content: { parts: [{ text }] },
|
|
3006
3014
|
outputDimensionality: this.config.dimensions,
|
|
3007
|
-
taskType: this.config.embedType
|
|
3015
|
+
...this.config.embedType && { taskType: this.config.embedType }
|
|
3008
3016
|
}))
|
|
3009
3017
|
};
|
|
3010
3018
|
}
|
|
@@ -4126,6 +4134,12 @@ var AxAssertionError = class extends Error {
|
|
|
4126
4134
|
});
|
|
4127
4135
|
return extraFields;
|
|
4128
4136
|
};
|
|
4137
|
+
toString() {
|
|
4138
|
+
return `${this.name}: ${this.message}`;
|
|
4139
|
+
}
|
|
4140
|
+
[Symbol.for("nodejs.util.inspect.custom")](_depth, _options) {
|
|
4141
|
+
return this.toString();
|
|
4142
|
+
}
|
|
4129
4143
|
};
|
|
4130
4144
|
var assertAssertions = async (asserts, values) => {
|
|
4131
4145
|
for (const assert of asserts) {
|
|
@@ -5563,6 +5577,17 @@ var ValidationError = class extends Error {
|
|
|
5563
5577
|
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.`
|
|
5564
5578
|
}));
|
|
5565
5579
|
};
|
|
5580
|
+
toString() {
|
|
5581
|
+
return [
|
|
5582
|
+
`${this.name}: ${this.message}`,
|
|
5583
|
+
...this.fields.map(
|
|
5584
|
+
(field) => ` - ${field.title}: Expected format '${toFieldType(field.type)}'`
|
|
5585
|
+
)
|
|
5586
|
+
].join("\n");
|
|
5587
|
+
}
|
|
5588
|
+
[Symbol.for("nodejs.util.inspect.custom")](_depth, _options) {
|
|
5589
|
+
return this.toString();
|
|
5590
|
+
}
|
|
5566
5591
|
};
|
|
5567
5592
|
function handleValidationError(mem, errorFields, ai, promptTemplate, sessionId) {
|
|
5568
5593
|
mem.add(
|
|
@@ -6046,6 +6071,15 @@ var AxFunctionError = class extends Error {
|
|
|
6046
6071
|
this.name = this.constructor.name;
|
|
6047
6072
|
}
|
|
6048
6073
|
getFields = () => this.fields;
|
|
6074
|
+
toString() {
|
|
6075
|
+
return [
|
|
6076
|
+
`${this.name}: Function validation error`,
|
|
6077
|
+
...this.fields.map((field) => ` - ${field.field}: ${field.message}`)
|
|
6078
|
+
].join("\n");
|
|
6079
|
+
}
|
|
6080
|
+
[Symbol.for("nodejs.util.inspect.custom")](_depth, _options) {
|
|
6081
|
+
return this.toString();
|
|
6082
|
+
}
|
|
6049
6083
|
};
|
|
6050
6084
|
var FunctionError = class extends Error {
|
|
6051
6085
|
constructor(fields, func, funcId) {
|
|
@@ -6074,6 +6108,19 @@ var FunctionError = class extends Error {
|
|
|
6074
6108
|
return `Errors In Function Arguments: Fix the following invalid arguments to '${this.func.name}'
|
|
6075
6109
|
${bulletPoints.join("\n")}`;
|
|
6076
6110
|
};
|
|
6111
|
+
toString() {
|
|
6112
|
+
return [
|
|
6113
|
+
`${this.name}: Function execution error in '${this.func.name}'`,
|
|
6114
|
+
...this.fields.map((field) => {
|
|
6115
|
+
const description = this.getFieldDescription(field.field);
|
|
6116
|
+
return ` - ${field.field}: ${field.message}${description ? ` (${description})` : ""}`;
|
|
6117
|
+
}),
|
|
6118
|
+
this.funcId ? ` Function ID: ${this.funcId}` : ""
|
|
6119
|
+
].join("\n");
|
|
6120
|
+
}
|
|
6121
|
+
[Symbol.for("nodejs.util.inspect.custom")](_depth, _options) {
|
|
6122
|
+
return this.toString();
|
|
6123
|
+
}
|
|
6077
6124
|
};
|
|
6078
6125
|
var AxFunctionProcessor = class {
|
|
6079
6126
|
funcList = [];
|
|
@@ -6588,7 +6635,7 @@ var AxGen = class extends AxProgramWithSignature {
|
|
|
6588
6635
|
}
|
|
6589
6636
|
}
|
|
6590
6637
|
}
|
|
6591
|
-
throw new Error(`Unable to fix validation error: ${err
|
|
6638
|
+
throw new Error(`Unable to fix validation error: ${err}`);
|
|
6592
6639
|
}
|
|
6593
6640
|
throw new Error(`Max steps reached: ${maxSteps}`);
|
|
6594
6641
|
}
|