@superatomai/sdk-node 0.0.69 → 0.0.71

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.mjs CHANGED
@@ -6131,7 +6131,7 @@ Fixed SQL query:`;
6131
6131
  {
6132
6132
  model: this.getModelForTask("simple"),
6133
6133
  maxTokens: 2048,
6134
- temperature: 0.1,
6134
+ temperature: 0,
6135
6135
  apiKey: this.getApiKey(apiKey)
6136
6136
  }
6137
6137
  );
@@ -6377,12 +6377,13 @@ ${executedToolsText}`);
6377
6377
  },
6378
6378
  apiKey
6379
6379
  );
6380
+ const limitedFixedQuery = ensureQueryLimit(fixedQueryStr, this.defaultLimit, 10);
6380
6381
  if (typeof currentQuery === "string") {
6381
- currentQuery = fixedQueryStr;
6382
+ currentQuery = limitedFixedQuery;
6382
6383
  } else {
6383
- currentQuery = { ...currentQuery, sql: fixedQueryStr };
6384
+ currentQuery = { ...currentQuery, sql: limitedFixedQuery };
6384
6385
  }
6385
- currentQueryStr = fixedQueryStr;
6386
+ currentQueryStr = limitedFixedQuery;
6386
6387
  logger.info(`[${this.getProviderName()}] LLM provided fixed query for answer component, retrying...`);
6387
6388
  } catch (fixError) {
6388
6389
  const fixErrorMsg = fixError instanceof Error ? fixError.message : String(fixError);
@@ -6418,7 +6419,7 @@ ${executedToolsText}`);
6418
6419
  {
6419
6420
  model: this.getModelForTask("complex"),
6420
6421
  maxTokens: 8192,
6421
- temperature: 0.2,
6422
+ temperature: 0,
6422
6423
  apiKey: this.getApiKey(apiKey),
6423
6424
  partial: partialCallback
6424
6425
  },
@@ -6561,6 +6562,26 @@ ${executedToolsText}`);
6561
6562
  }
6562
6563
  }
6563
6564
  }
6565
+ if (cleanedProps.query) {
6566
+ if (typeof cleanedProps.query === "string") {
6567
+ cleanedProps.query = ensureQueryLimit(
6568
+ cleanedProps.query,
6569
+ this.defaultLimit,
6570
+ 10
6571
+ // maxLimit - enforce maximum of 10 rows for component queries
6572
+ );
6573
+ } else if (cleanedProps.query?.sql) {
6574
+ cleanedProps.query = {
6575
+ ...cleanedProps.query,
6576
+ sql: ensureQueryLimit(
6577
+ cleanedProps.query.sql,
6578
+ this.defaultLimit,
6579
+ 10
6580
+ // maxLimit - enforce maximum of 10 rows for component queries
6581
+ )
6582
+ };
6583
+ }
6584
+ }
6564
6585
  if (cleanedProps.query && cleanedProps.externalTool) {
6565
6586
  logger.info(`[${this.getProviderName()}] Both query and externalTool exist, keeping both - frontend will decide`);
6566
6587
  }
@@ -6681,11 +6702,12 @@ ${executedToolsText}`);
6681
6702
  );
6682
6703
  if (fixedQueryStr && fixedQueryStr !== currentQueryStr) {
6683
6704
  logger.info(`[${this.getProviderName()}] Received fixed query for ${component.name}, retrying...`);
6684
- currentQueryStr = fixedQueryStr;
6705
+ const limitedFixedQuery = ensureQueryLimit(fixedQueryStr, this.defaultLimit, 10);
6706
+ currentQueryStr = limitedFixedQuery;
6685
6707
  if (typeof currentQuery === "string") {
6686
- currentQuery = fixedQueryStr;
6708
+ currentQuery = limitedFixedQuery;
6687
6709
  } else {
6688
- currentQuery = { ...currentQuery, sql: fixedQueryStr };
6710
+ currentQuery = { ...currentQuery, sql: limitedFixedQuery };
6689
6711
  }
6690
6712
  } else {
6691
6713
  logger.warn(`[${this.getProviderName()}] LLM returned same or empty query, stopping retries`);
@@ -6813,7 +6835,7 @@ ${executedToolsText}`);
6813
6835
  {
6814
6836
  model: this.getModelForTask("simple"),
6815
6837
  maxTokens: 1500,
6816
- temperature: 0.2,
6838
+ temperature: 0,
6817
6839
  apiKey: this.getApiKey(apiKey)
6818
6840
  },
6819
6841
  true
@@ -6886,7 +6908,7 @@ ${executedToolsText}`);
6886
6908
  {
6887
6909
  model: this.getModelForTask("complex"),
6888
6910
  maxTokens: 8192,
6889
- temperature: 0.2,
6911
+ temperature: 0,
6890
6912
  apiKey: this.getApiKey(apiKey)
6891
6913
  },
6892
6914
  true
@@ -7471,7 +7493,7 @@ ${errorMsg}
7471
7493
  {
7472
7494
  model: this.getModelForTask("complex"),
7473
7495
  maxTokens: 4e3,
7474
- temperature: 0.7,
7496
+ temperature: 0,
7475
7497
  apiKey: this.getApiKey(apiKey),
7476
7498
  partial: wrappedStreamCallback
7477
7499
  // Pass the wrapped streaming callback to LLM
@@ -7881,7 +7903,7 @@ ${errorMsg}
7881
7903
  {
7882
7904
  model: this.getModelForTask("simple"),
7883
7905
  maxTokens: 1200,
7884
- temperature: 0.7,
7906
+ temperature: 0,
7885
7907
  apiKey: this.getApiKey(apiKey)
7886
7908
  },
7887
7909
  true
@@ -8661,6 +8683,12 @@ var get_user_request = async (data, components, sendMessage, anthropicApiKey, gr
8661
8683
  };
8662
8684
  async function handleUserPromptRequest(data, components, sendMessage, anthropicApiKey, groqApiKey, geminiApiKey, openaiApiKey, llmProviders, collections, externalTools) {
8663
8685
  const response = await get_user_request(data, components, sendMessage, anthropicApiKey, groqApiKey, geminiApiKey, openaiApiKey, llmProviders, collections, externalTools);
8686
+ if (response.data?.component?.props?.config?.components) {
8687
+ response.data.component.props.config.components = response.data.component.props.config.components.map((comp) => ({
8688
+ ...comp,
8689
+ id: `comp_${Math.random().toString(36).substring(2, 8)}`
8690
+ }));
8691
+ }
8664
8692
  sendDataResponse4(
8665
8693
  response.id || data.id,
8666
8694
  {