@ax-llm/ax 11.0.38 → 11.0.39
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 +18 -8
- package/index.cjs.map +1 -1
- package/index.js +18 -8
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.cjs
CHANGED
|
@@ -6700,7 +6700,7 @@ Content: ${result.content}`
|
|
|
6700
6700
|
err = e;
|
|
6701
6701
|
} else if (e instanceof AxAIServiceStreamTerminatedError) {
|
|
6702
6702
|
} else {
|
|
6703
|
-
throw enhanceError(e, ai);
|
|
6703
|
+
throw enhanceError(e, ai, this.signature);
|
|
6704
6704
|
}
|
|
6705
6705
|
if (errorFields) {
|
|
6706
6706
|
handleValidationError(
|
|
@@ -6713,9 +6713,17 @@ Content: ${result.content}`
|
|
|
6713
6713
|
}
|
|
6714
6714
|
}
|
|
6715
6715
|
}
|
|
6716
|
-
throw
|
|
6716
|
+
throw enhanceError(
|
|
6717
|
+
new Error(`Unable to fix validation error: ${err?.toString()}`),
|
|
6718
|
+
ai,
|
|
6719
|
+
this.signature
|
|
6720
|
+
);
|
|
6717
6721
|
}
|
|
6718
|
-
throw enhanceError(
|
|
6722
|
+
throw enhanceError(
|
|
6723
|
+
new Error(`Max steps reached: ${maxSteps}`),
|
|
6724
|
+
ai,
|
|
6725
|
+
this.signature
|
|
6726
|
+
);
|
|
6719
6727
|
}
|
|
6720
6728
|
shouldContinueSteps(lastMemItem, stopFunction) {
|
|
6721
6729
|
const stopFunctionExecuted = stopFunction && this.functionsExecuted.has(stopFunction);
|
|
@@ -6786,19 +6794,21 @@ Content: ${result.content}`
|
|
|
6786
6794
|
});
|
|
6787
6795
|
}
|
|
6788
6796
|
};
|
|
6789
|
-
function enhanceError(e, ai) {
|
|
6797
|
+
function enhanceError(e, ai, signature) {
|
|
6790
6798
|
const originalError = e instanceof Error ? e : new Error(String(e));
|
|
6791
6799
|
const model = ai.getLastUsedChatModel();
|
|
6792
6800
|
const modelConfig = ai.getLastUsedModelConfig();
|
|
6793
6801
|
const details = [
|
|
6802
|
+
`name=${ai.getName()}`,
|
|
6794
6803
|
`model=${model}`,
|
|
6795
6804
|
`maxTokens=${modelConfig?.maxTokens ?? "N/A"}`,
|
|
6796
6805
|
`streaming=${modelConfig?.stream ?? false}`
|
|
6797
6806
|
].join(", ");
|
|
6798
|
-
|
|
6799
|
-
|
|
6800
|
-
${
|
|
6801
|
-
|
|
6807
|
+
return new Error(
|
|
6808
|
+
`Generate Failed:${signature.toString()}
|
|
6809
|
+
Details: ${details}`,
|
|
6810
|
+
{ cause: originalError }
|
|
6811
|
+
);
|
|
6802
6812
|
}
|
|
6803
6813
|
|
|
6804
6814
|
// prompts/agent.ts
|