@ax-llm/ax 11.0.39 → 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 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,
@@ -6794,21 +6795,31 @@ Content: ${result.content}`
6794
6795
  });
6795
6796
  }
6796
6797
  };
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
+ };
6797
6806
  function enhanceError(e, ai, signature) {
6798
6807
  const originalError = e instanceof Error ? e : new Error(String(e));
6799
6808
  const model = ai.getLastUsedChatModel();
6800
6809
  const modelConfig = ai.getLastUsedModelConfig();
6801
- const details = [
6802
- `name=${ai.getName()}`,
6803
- `model=${model}`,
6804
- `maxTokens=${modelConfig?.maxTokens ?? "N/A"}`,
6805
- `streaming=${modelConfig?.stream ?? false}`
6806
- ].join(", ");
6807
- return new Error(
6808
- `Generate Failed:${signature.toString()}
6809
- Details: ${details}`,
6810
- { cause: originalError }
6811
- );
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
+ });
6812
6823
  }
6813
6824
 
6814
6825
  // prompts/agent.ts
@@ -11560,6 +11571,7 @@ var AxRAG = class extends AxChainOfThought {
11560
11571
  AxFunctionError,
11561
11572
  AxFunctionProcessor,
11562
11573
  AxGen,
11574
+ AxGenerateError,
11563
11575
  AxHFDataLoader,
11564
11576
  AxInstanceRegistry,
11565
11577
  AxJSInterpreter,