@deepagents/text2sql 0.8.1 → 0.10.0
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 +10 -12
- package/dist/index.js.map +4 -4
- package/dist/lib/adapters/groundings/index.js +42 -44
- package/dist/lib/adapters/groundings/index.js.map +2 -2
- package/dist/lib/adapters/groundings/report.grounding.d.ts.map +1 -1
- package/dist/lib/adapters/mysql/index.js +46 -45
- package/dist/lib/adapters/mysql/index.js.map +2 -2
- package/dist/lib/adapters/mysql/info.mysql.grounding.d.ts.map +1 -1
- package/dist/lib/adapters/postgres/index.js +46 -45
- package/dist/lib/adapters/postgres/index.js.map +2 -2
- package/dist/lib/adapters/postgres/info.postgres.grounding.d.ts.map +1 -1
- package/dist/lib/adapters/spreadsheet/index.d.ts +4 -0
- package/dist/lib/adapters/spreadsheet/index.d.ts.map +1 -0
- package/dist/lib/adapters/spreadsheet/parser.d.ts +41 -0
- package/dist/lib/adapters/spreadsheet/parser.d.ts.map +1 -0
- package/dist/lib/adapters/spreadsheet/spreadsheet.d.ts +52 -0
- package/dist/lib/adapters/spreadsheet/spreadsheet.d.ts.map +1 -0
- package/dist/lib/adapters/sqlite/index.js +46 -45
- package/dist/lib/adapters/sqlite/index.js.map +2 -2
- package/dist/lib/adapters/sqlite/info.sqlite.grounding.d.ts.map +1 -1
- package/dist/lib/adapters/sqlserver/index.js +46 -45
- package/dist/lib/adapters/sqlserver/index.js.map +2 -2
- package/dist/lib/adapters/sqlserver/info.sqlserver.grounding.d.ts.map +1 -1
- package/dist/lib/sql.d.ts.map +1 -1
- package/dist/lib/synthesis/extractors/last-query-extractor.d.ts +1 -1
- package/dist/lib/synthesis/index.js.map +1 -1
- package/package.json +12 -4
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,
|
|
@@ -2372,15 +2373,6 @@ Break the question into its semantic aspects, and let the SQL specialist figure
|
|
|
2372
2373
|
}
|
|
2373
2374
|
});
|
|
2374
2375
|
|
|
2375
|
-
// packages/text2sql/src/lib/synthesis/types.ts
|
|
2376
|
-
async function toPairs(producer) {
|
|
2377
|
-
const pairs = [];
|
|
2378
|
-
for await (const chunk of producer.produce()) {
|
|
2379
|
-
pairs.push(...chunk);
|
|
2380
|
-
}
|
|
2381
|
-
return pairs;
|
|
2382
|
-
}
|
|
2383
|
-
|
|
2384
2376
|
// packages/text2sql/src/lib/teach/teachings.ts
|
|
2385
2377
|
function guidelines(options = {}) {
|
|
2386
2378
|
const { date = "strict" } = options;
|
|
@@ -2618,7 +2610,7 @@ var Text2Sql = class {
|
|
|
2618
2610
|
*/
|
|
2619
2611
|
async toPairs(factory) {
|
|
2620
2612
|
const producer = factory(this.#config.adapter);
|
|
2621
|
-
return toPairs(
|
|
2613
|
+
return producer.toPairs();
|
|
2622
2614
|
}
|
|
2623
2615
|
// public async suggest() {
|
|
2624
2616
|
// const [introspection, adapterInfo] = await Promise.all([
|
|
@@ -3027,8 +3019,11 @@ var Text2Sql = class {
|
|
|
3027
3019
|
return "The model called a tool with invalid arguments.";
|
|
3028
3020
|
} else if (ToolCallRepairError.isInstance(error)) {
|
|
3029
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}`;
|
|
3030
3025
|
} else {
|
|
3031
|
-
return
|
|
3026
|
+
return JSON.stringify(error);
|
|
3032
3027
|
}
|
|
3033
3028
|
},
|
|
3034
3029
|
sendStart: true,
|
|
@@ -3080,8 +3075,11 @@ async function withChat(history, params, messages, streamFn) {
|
|
|
3080
3075
|
return "The model called a tool with invalid arguments.";
|
|
3081
3076
|
} else if (ToolCallRepairError.isInstance(error)) {
|
|
3082
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}`;
|
|
3083
3081
|
} else {
|
|
3084
|
-
return
|
|
3082
|
+
return JSON.stringify(error);
|
|
3085
3083
|
}
|
|
3086
3084
|
},
|
|
3087
3085
|
sendStart: true,
|