@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.js
CHANGED
|
@@ -6549,7 +6549,7 @@ Content: ${result.content}`
|
|
|
6549
6549
|
err = e;
|
|
6550
6550
|
} else if (e instanceof AxAIServiceStreamTerminatedError) {
|
|
6551
6551
|
} else {
|
|
6552
|
-
throw enhanceError(e, ai);
|
|
6552
|
+
throw enhanceError(e, ai, this.signature);
|
|
6553
6553
|
}
|
|
6554
6554
|
if (errorFields) {
|
|
6555
6555
|
handleValidationError(
|
|
@@ -6562,9 +6562,17 @@ Content: ${result.content}`
|
|
|
6562
6562
|
}
|
|
6563
6563
|
}
|
|
6564
6564
|
}
|
|
6565
|
-
throw
|
|
6565
|
+
throw enhanceError(
|
|
6566
|
+
new Error(`Unable to fix validation error: ${err?.toString()}`),
|
|
6567
|
+
ai,
|
|
6568
|
+
this.signature
|
|
6569
|
+
);
|
|
6566
6570
|
}
|
|
6567
|
-
throw enhanceError(
|
|
6571
|
+
throw enhanceError(
|
|
6572
|
+
new Error(`Max steps reached: ${maxSteps}`),
|
|
6573
|
+
ai,
|
|
6574
|
+
this.signature
|
|
6575
|
+
);
|
|
6568
6576
|
}
|
|
6569
6577
|
shouldContinueSteps(lastMemItem, stopFunction) {
|
|
6570
6578
|
const stopFunctionExecuted = stopFunction && this.functionsExecuted.has(stopFunction);
|
|
@@ -6635,19 +6643,21 @@ Content: ${result.content}`
|
|
|
6635
6643
|
});
|
|
6636
6644
|
}
|
|
6637
6645
|
};
|
|
6638
|
-
function enhanceError(e, ai) {
|
|
6646
|
+
function enhanceError(e, ai, signature) {
|
|
6639
6647
|
const originalError = e instanceof Error ? e : new Error(String(e));
|
|
6640
6648
|
const model = ai.getLastUsedChatModel();
|
|
6641
6649
|
const modelConfig = ai.getLastUsedModelConfig();
|
|
6642
6650
|
const details = [
|
|
6651
|
+
`name=${ai.getName()}`,
|
|
6643
6652
|
`model=${model}`,
|
|
6644
6653
|
`maxTokens=${modelConfig?.maxTokens ?? "N/A"}`,
|
|
6645
6654
|
`streaming=${modelConfig?.stream ?? false}`
|
|
6646
6655
|
].join(", ");
|
|
6647
|
-
|
|
6648
|
-
|
|
6649
|
-
${
|
|
6650
|
-
|
|
6656
|
+
return new Error(
|
|
6657
|
+
`Generate Failed:${signature.toString()}
|
|
6658
|
+
Details: ${details}`,
|
|
6659
|
+
{ cause: originalError }
|
|
6660
|
+
);
|
|
6651
6661
|
}
|
|
6652
6662
|
|
|
6653
6663
|
// prompts/agent.ts
|