@querypanel/node-sdk 1.2.7 → 1.2.8
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.cjs +13 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -1
- package/dist/index.d.ts +11 -1
- package/dist/index.js +13 -7
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -1842,7 +1842,6 @@ async function ask(client, queryEngine, question, options, signal) {
|
|
|
1842
1842
|
let previousSql = options.previousSql;
|
|
1843
1843
|
const queryEndpoint = options.pipeline === "v2" ? "/v2/query" : "/query";
|
|
1844
1844
|
while (attempt <= maxRetry) {
|
|
1845
|
-
console.log({ lastError, previousSql });
|
|
1846
1845
|
const databaseName = options.database ?? queryEngine.getDefaultDatabase();
|
|
1847
1846
|
const metadata = databaseName ? queryEngine.getDatabaseMetadata(databaseName) : void 0;
|
|
1848
1847
|
let tenantSettings;
|
|
@@ -1865,7 +1864,8 @@ async function ask(client, queryEngine, question, options, signal) {
|
|
|
1865
1864
|
...databaseName ? { database: databaseName } : {},
|
|
1866
1865
|
...metadata?.dialect ? { dialect: metadata.dialect } : {},
|
|
1867
1866
|
...options.model?.trim() ? { model: options.model.trim() } : {},
|
|
1868
|
-
...options.pipeline === "v2" && options.systemPrompt?.trim() ? { system_prompt: options.systemPrompt.trim() } : {}
|
|
1867
|
+
...options.pipeline === "v2" && options.systemPrompt?.trim() ? { system_prompt: options.systemPrompt.trim() } : {},
|
|
1868
|
+
debug: options.debug ?? false
|
|
1869
1869
|
},
|
|
1870
1870
|
tenantId,
|
|
1871
1871
|
options.userId,
|
|
@@ -1986,9 +1986,14 @@ async function ask(client, queryEngine, question, options, signal) {
|
|
|
1986
1986
|
}
|
|
1987
1987
|
lastError = error instanceof Error ? error.message : String(error);
|
|
1988
1988
|
previousSql = queryResponse.data.sql ?? previousSql;
|
|
1989
|
-
console.warn(
|
|
1990
|
-
|
|
1991
|
-
|
|
1989
|
+
console.warn("SQL execution failed, retrying query generation", {
|
|
1990
|
+
attempt,
|
|
1991
|
+
maxAttempts: maxRetry + 1,
|
|
1992
|
+
error: lastError,
|
|
1993
|
+
sql: queryResponse.data.sql ?? null,
|
|
1994
|
+
paramMetadata,
|
|
1995
|
+
params: paramValues
|
|
1996
|
+
});
|
|
1992
1997
|
}
|
|
1993
1998
|
}
|
|
1994
1999
|
throw new Error("Unexpected error in ask retry loop");
|
|
@@ -2214,7 +2219,8 @@ async function modifyChart(client, queryEngine, input, options, signal) {
|
|
|
2214
2219
|
...options?.maxRetry ? { max_retry: options.maxRetry } : {},
|
|
2215
2220
|
...tenantSettings ? { tenant_settings: tenantSettings } : {},
|
|
2216
2221
|
...databaseName ? { database: databaseName } : {},
|
|
2217
|
-
...metadata?.dialect ? { dialect: metadata.dialect } : {}
|
|
2222
|
+
...metadata?.dialect ? { dialect: metadata.dialect } : {},
|
|
2223
|
+
debug: options?.debug ?? false
|
|
2218
2224
|
},
|
|
2219
2225
|
tenantId,
|
|
2220
2226
|
options?.userId,
|
|
@@ -2595,7 +2601,7 @@ var QueryPanelSdkAPI = class _QueryPanelSdkAPI {
|
|
|
2595
2601
|
* It handles the complete flow: SQL generation → validation → execution → chart generation.
|
|
2596
2602
|
*
|
|
2597
2603
|
* @param question - Natural language question (e.g., "Show revenue by country")
|
|
2598
|
-
* @param options - Query options including tenantId, database, and
|
|
2604
|
+
* @param options - Query options including tenantId, database, retry settings, and optional `debug` for engineer-style rationale
|
|
2599
2605
|
* @param signal - Optional AbortSignal for cancellation
|
|
2600
2606
|
* @returns Response with SQL, executed data rows, and generated chart
|
|
2601
2607
|
* @throws {Error} When SQL generation or execution fails after all retries
|