@deepagents/text2sql 0.9.0 → 0.10.1

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/dist/index.js CHANGED
@@ -1729,6 +1729,7 @@ var InMemoryTeachablesStore = class extends SqliteTeachablesStore {
1729
1729
 
1730
1730
  // packages/text2sql/src/lib/sql.ts
1731
1731
  import {
1732
+ APICallError as APICallError2,
1732
1733
  InvalidToolInputError,
1733
1734
  NoSuchToolError,
1734
1735
  ToolCallRepairError,
@@ -3018,8 +3019,11 @@ var Text2Sql = class {
3018
3019
  return "The model called a tool with invalid arguments.";
3019
3020
  } else if (ToolCallRepairError.isInstance(error)) {
3020
3021
  return "The model tried to call a tool with invalid arguments, but it was repaired.";
3022
+ } else if (APICallError2.isInstance(error)) {
3023
+ console.error("Upstream API call failed:", error);
3024
+ return `Upstream API call failed with status ${error.statusCode}: ${error.message}`;
3021
3025
  } else {
3022
- return "An unknown error occurred.";
3026
+ return JSON.stringify(error);
3023
3027
  }
3024
3028
  },
3025
3029
  sendStart: true,
@@ -3071,6 +3075,9 @@ async function withChat(history, params, messages, streamFn) {
3071
3075
  return "The model called a tool with invalid arguments.";
3072
3076
  } else if (ToolCallRepairError.isInstance(error)) {
3073
3077
  return "The model tried to call a tool with invalid arguments, but it was repaired.";
3078
+ } else if (APICallError2.isInstance(error)) {
3079
+ console.error("Upstream API call failed:", error);
3080
+ return `Upstream API call failed with status ${error.statusCode}: ${error.message}`;
3074
3081
  } else {
3075
3082
  return JSON.stringify(error);
3076
3083
  }