@ax-llm/ax 11.0.38 → 11.0.41
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 +35 -13
- package/index.cjs.map +1 -1
- package/index.d.cts +15 -1
- package/index.d.ts +15 -1
- package/index.js +34 -13
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.cjs
CHANGED
|
@@ -90,6 +90,7 @@ __export(index_exports, {
|
|
|
90
90
|
AxFunctionError: () => AxFunctionError,
|
|
91
91
|
AxFunctionProcessor: () => AxFunctionProcessor,
|
|
92
92
|
AxGen: () => AxGen,
|
|
93
|
+
AxGenerateError: () => AxGenerateError,
|
|
93
94
|
AxHFDataLoader: () => AxHFDataLoader,
|
|
94
95
|
AxInstanceRegistry: () => AxInstanceRegistry,
|
|
95
96
|
AxJSInterpreter: () => AxJSInterpreter,
|
|
@@ -6700,7 +6701,7 @@ Content: ${result.content}`
|
|
|
6700
6701
|
err = e;
|
|
6701
6702
|
} else if (e instanceof AxAIServiceStreamTerminatedError) {
|
|
6702
6703
|
} else {
|
|
6703
|
-
throw enhanceError(e, ai);
|
|
6704
|
+
throw enhanceError(e, ai, this.signature);
|
|
6704
6705
|
}
|
|
6705
6706
|
if (errorFields) {
|
|
6706
6707
|
handleValidationError(
|
|
@@ -6713,9 +6714,17 @@ Content: ${result.content}`
|
|
|
6713
6714
|
}
|
|
6714
6715
|
}
|
|
6715
6716
|
}
|
|
6716
|
-
throw
|
|
6717
|
+
throw enhanceError(
|
|
6718
|
+
new Error(`Unable to fix validation error: ${err?.toString()}`),
|
|
6719
|
+
ai,
|
|
6720
|
+
this.signature
|
|
6721
|
+
);
|
|
6717
6722
|
}
|
|
6718
|
-
throw enhanceError(
|
|
6723
|
+
throw enhanceError(
|
|
6724
|
+
new Error(`Max steps reached: ${maxSteps}`),
|
|
6725
|
+
ai,
|
|
6726
|
+
this.signature
|
|
6727
|
+
);
|
|
6719
6728
|
}
|
|
6720
6729
|
shouldContinueSteps(lastMemItem, stopFunction) {
|
|
6721
6730
|
const stopFunctionExecuted = stopFunction && this.functionsExecuted.has(stopFunction);
|
|
@@ -6786,19 +6795,31 @@ Content: ${result.content}`
|
|
|
6786
6795
|
});
|
|
6787
6796
|
}
|
|
6788
6797
|
};
|
|
6789
|
-
|
|
6798
|
+
var AxGenerateError = class extends Error {
|
|
6799
|
+
details;
|
|
6800
|
+
constructor(message, details, options) {
|
|
6801
|
+
super(message, options);
|
|
6802
|
+
this.name = "AxGenerateError";
|
|
6803
|
+
this.details = details;
|
|
6804
|
+
}
|
|
6805
|
+
};
|
|
6806
|
+
function enhanceError(e, ai, signature) {
|
|
6790
6807
|
const originalError = e instanceof Error ? e : new Error(String(e));
|
|
6791
6808
|
const model = ai.getLastUsedChatModel();
|
|
6792
6809
|
const modelConfig = ai.getLastUsedModelConfig();
|
|
6793
|
-
const details =
|
|
6794
|
-
|
|
6795
|
-
|
|
6796
|
-
|
|
6797
|
-
|
|
6798
|
-
|
|
6799
|
-
|
|
6800
|
-
|
|
6801
|
-
|
|
6810
|
+
const details = {
|
|
6811
|
+
model,
|
|
6812
|
+
maxTokens: modelConfig?.maxTokens,
|
|
6813
|
+
streaming: modelConfig?.stream ?? false,
|
|
6814
|
+
signature: {
|
|
6815
|
+
input: signature.getInputFields(),
|
|
6816
|
+
output: signature.getOutputFields(),
|
|
6817
|
+
description: signature.getDescription()
|
|
6818
|
+
}
|
|
6819
|
+
};
|
|
6820
|
+
return new AxGenerateError("Generate failed", details, {
|
|
6821
|
+
cause: originalError
|
|
6822
|
+
});
|
|
6802
6823
|
}
|
|
6803
6824
|
|
|
6804
6825
|
// prompts/agent.ts
|
|
@@ -11550,6 +11571,7 @@ var AxRAG = class extends AxChainOfThought {
|
|
|
11550
11571
|
AxFunctionError,
|
|
11551
11572
|
AxFunctionProcessor,
|
|
11552
11573
|
AxGen,
|
|
11574
|
+
AxGenerateError,
|
|
11553
11575
|
AxHFDataLoader,
|
|
11554
11576
|
AxInstanceRegistry,
|
|
11555
11577
|
AxJSInterpreter,
|