@ax-llm/ax 11.0.32 → 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 +40 -1
- package/index.cjs.map +1 -1
- package/index.d.cts +2 -0
- package/index.d.ts +2 -0
- package/index.js +40 -1
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.cjs
CHANGED
|
@@ -4134,6 +4134,12 @@ var AxAssertionError = class extends Error {
|
|
|
4134
4134
|
});
|
|
4135
4135
|
return extraFields;
|
|
4136
4136
|
};
|
|
4137
|
+
toString() {
|
|
4138
|
+
return `${this.name}: ${this.message}`;
|
|
4139
|
+
}
|
|
4140
|
+
[Symbol.for("nodejs.util.inspect.custom")](_depth, _options) {
|
|
4141
|
+
return this.toString();
|
|
4142
|
+
}
|
|
4137
4143
|
};
|
|
4138
4144
|
var assertAssertions = async (asserts, values) => {
|
|
4139
4145
|
for (const assert of asserts) {
|
|
@@ -5571,6 +5577,17 @@ var ValidationError = class extends Error {
|
|
|
5571
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.`
|
|
5572
5578
|
}));
|
|
5573
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
|
+
}
|
|
5574
5591
|
};
|
|
5575
5592
|
function handleValidationError(mem, errorFields, ai, promptTemplate, sessionId) {
|
|
5576
5593
|
mem.add(
|
|
@@ -6054,6 +6071,15 @@ var AxFunctionError = class extends Error {
|
|
|
6054
6071
|
this.name = this.constructor.name;
|
|
6055
6072
|
}
|
|
6056
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
|
+
}
|
|
6057
6083
|
};
|
|
6058
6084
|
var FunctionError = class extends Error {
|
|
6059
6085
|
constructor(fields, func, funcId) {
|
|
@@ -6082,6 +6108,19 @@ var FunctionError = class extends Error {
|
|
|
6082
6108
|
return `Errors In Function Arguments: Fix the following invalid arguments to '${this.func.name}'
|
|
6083
6109
|
${bulletPoints.join("\n")}`;
|
|
6084
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
|
+
}
|
|
6085
6124
|
};
|
|
6086
6125
|
var AxFunctionProcessor = class {
|
|
6087
6126
|
funcList = [];
|
|
@@ -6596,7 +6635,7 @@ var AxGen = class extends AxProgramWithSignature {
|
|
|
6596
6635
|
}
|
|
6597
6636
|
}
|
|
6598
6637
|
}
|
|
6599
|
-
throw new Error(`Unable to fix validation error: ${err
|
|
6638
|
+
throw new Error(`Unable to fix validation error: ${err}`);
|
|
6600
6639
|
}
|
|
6601
6640
|
throw new Error(`Max steps reached: ${maxSteps}`);
|
|
6602
6641
|
}
|