@superatomai/sdk-node 0.0.32-mds → 0.0.33-mds
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 +13 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -7903,12 +7903,13 @@ function validateAndCleanQuery(query, config) {
|
|
|
7903
7903
|
cleanedQuery = { ...cleanedQuery, sql: fixedQuery };
|
|
7904
7904
|
}
|
|
7905
7905
|
}
|
|
7906
|
+
const maxLimit = config.maxLimit ?? MAX_AGENT_QUERY_LIMIT;
|
|
7906
7907
|
if (typeof cleanedQuery === "string") {
|
|
7907
|
-
const limitedQuery = ensureQueryLimit(cleanedQuery, config.defaultLimit,
|
|
7908
|
+
const limitedQuery = ensureQueryLimit(cleanedQuery, config.defaultLimit, maxLimit);
|
|
7908
7909
|
if (limitedQuery !== cleanedQuery) wasModified = true;
|
|
7909
7910
|
cleanedQuery = limitedQuery;
|
|
7910
7911
|
} else if (cleanedQuery?.sql) {
|
|
7911
|
-
const limitedSql = ensureQueryLimit(cleanedQuery.sql, config.defaultLimit,
|
|
7912
|
+
const limitedSql = ensureQueryLimit(cleanedQuery.sql, config.defaultLimit, maxLimit);
|
|
7912
7913
|
if (limitedSql !== cleanedQuery.sql) wasModified = true;
|
|
7913
7914
|
cleanedQuery = { ...cleanedQuery, sql: limitedSql };
|
|
7914
7915
|
}
|
|
@@ -8064,7 +8065,7 @@ ${executedToolsText}`);
|
|
|
8064
8065
|
const cleanedProps = processComponentProps(
|
|
8065
8066
|
mc.props,
|
|
8066
8067
|
executedTools,
|
|
8067
|
-
{ providerName: "AgentComponentGen", defaultLimit:
|
|
8068
|
+
{ providerName: "AgentComponentGen", defaultLimit: DEFAULT_QUERY_LIMIT, maxLimit: MAX_COMPONENT_QUERY_LIMIT }
|
|
8068
8069
|
);
|
|
8069
8070
|
return {
|
|
8070
8071
|
...originalComponent,
|
|
@@ -8203,10 +8204,16 @@ function tryStreamAnswerComponent(text, components, executedTools, collections,
|
|
|
8203
8204
|
props: { ...original.props, ...answerData.props }
|
|
8204
8205
|
};
|
|
8205
8206
|
const answerProps = answerComponent.props;
|
|
8206
|
-
|
|
8207
|
+
let sql = answerProps?.externalTool?.parameters?.sql;
|
|
8207
8208
|
if (sql && collections?.["external-tools"]?.["execute"]) {
|
|
8208
8209
|
const toolId = answerProps.externalTool.toolId;
|
|
8209
8210
|
const toolName = answerProps.externalTool.toolName;
|
|
8211
|
+
const executedTool = executedTools.find((t) => t.id === toolId);
|
|
8212
|
+
const dbType = executedTool?.sourceType;
|
|
8213
|
+
if (dbType) {
|
|
8214
|
+
sql = ensureQueryLimit(sql, DEFAULT_QUERY_LIMIT, MAX_COMPONENT_QUERY_LIMIT, dbType);
|
|
8215
|
+
answerProps.externalTool.parameters.sql = sql;
|
|
8216
|
+
}
|
|
8210
8217
|
(async () => {
|
|
8211
8218
|
try {
|
|
8212
8219
|
const result = await collections["external-tools"]["execute"]({
|
|
@@ -8309,7 +8316,7 @@ async function validateSingleExternalToolQuery(component, collections, executedT
|
|
|
8309
8316
|
const executedTool = executedTools.find((t) => t.id === toolId);
|
|
8310
8317
|
const dbType = executedTool?.sourceType;
|
|
8311
8318
|
if (dbType) {
|
|
8312
|
-
currentSql = ensureQueryLimit(currentSql,
|
|
8319
|
+
currentSql = ensureQueryLimit(currentSql, DEFAULT_QUERY_LIMIT, MAX_COMPONENT_QUERY_LIMIT, dbType);
|
|
8313
8320
|
}
|
|
8314
8321
|
let attempts = 0;
|
|
8315
8322
|
while (attempts < MAX_QUERY_VALIDATION_RETRIES) {
|
|
@@ -8360,7 +8367,7 @@ async function validateSingleExternalToolQuery(component, collections, executedT
|
|
|
8360
8367
|
apiKey
|
|
8361
8368
|
);
|
|
8362
8369
|
if (fixedSql && fixedSql !== currentSql) {
|
|
8363
|
-
currentSql = dbType ? ensureQueryLimit(fixedSql,
|
|
8370
|
+
currentSql = dbType ? ensureQueryLimit(fixedSql, DEFAULT_QUERY_LIMIT, MAX_COMPONENT_QUERY_LIMIT, dbType) : fixedSql;
|
|
8364
8371
|
logger.info(`[AgentComponentGen] LLM provided fix for ${component.name}, retrying...`);
|
|
8365
8372
|
} else {
|
|
8366
8373
|
logger.warn(`[AgentComponentGen] LLM returned same or empty query, stopping retries`);
|