@superatomai/sdk-node 0.0.44 → 0.0.46

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.d.mts CHANGED
@@ -2005,10 +2005,12 @@ declare abstract class BaseLLM {
2005
2005
  /**
2006
2006
  * Adapt UI block parameters based on current user question
2007
2007
  * Takes a matched UI block from semantic search and modifies its props to answer the new question
2008
+ * Also adapts the cached text response to match the new question
2008
2009
  */
2009
- adaptUIBlockParameters(currentUserPrompt: string, originalUserPrompt: string, matchedUIBlock: any, apiKey?: string, logCollector?: any): Promise<{
2010
+ adaptUIBlockParameters(currentUserPrompt: string, originalUserPrompt: string, matchedUIBlock: any, apiKey?: string, logCollector?: any, cachedTextResponse?: string): Promise<{
2010
2011
  success: boolean;
2011
2012
  adaptedComponent?: Component;
2013
+ adaptedTextResponse?: string;
2012
2014
  parametersChanged?: Array<{
2013
2015
  field: string;
2014
2016
  reason: string;
package/dist/index.d.ts CHANGED
@@ -2005,10 +2005,12 @@ declare abstract class BaseLLM {
2005
2005
  /**
2006
2006
  * Adapt UI block parameters based on current user question
2007
2007
  * Takes a matched UI block from semantic search and modifies its props to answer the new question
2008
+ * Also adapts the cached text response to match the new question
2008
2009
  */
2009
- adaptUIBlockParameters(currentUserPrompt: string, originalUserPrompt: string, matchedUIBlock: any, apiKey?: string, logCollector?: any): Promise<{
2010
+ adaptUIBlockParameters(currentUserPrompt: string, originalUserPrompt: string, matchedUIBlock: any, apiKey?: string, logCollector?: any, cachedTextResponse?: string): Promise<{
2010
2011
  success: boolean;
2011
2012
  adaptedComponent?: Component;
2013
+ adaptedTextResponse?: string;
2012
2014
  parametersChanged?: Array<{
2013
2015
  field: string;
2014
2016
  reason: string;
package/dist/index.js CHANGED
@@ -5976,8 +5976,9 @@ ${JSON.stringify(tool.requiredFields || [], null, 2)}`;
5976
5976
  /**
5977
5977
  * Adapt UI block parameters based on current user question
5978
5978
  * Takes a matched UI block from semantic search and modifies its props to answer the new question
5979
+ * Also adapts the cached text response to match the new question
5979
5980
  */
5980
- async adaptUIBlockParameters(currentUserPrompt, originalUserPrompt, matchedUIBlock, apiKey, logCollector) {
5981
+ async adaptUIBlockParameters(currentUserPrompt, originalUserPrompt, matchedUIBlock, apiKey, logCollector, cachedTextResponse) {
5981
5982
  try {
5982
5983
  const component = matchedUIBlock?.generatedComponentMetadata || matchedUIBlock?.component;
5983
5984
  if (!matchedUIBlock || !component) {
@@ -5993,6 +5994,7 @@ ${JSON.stringify(tool.requiredFields || [], null, 2)}`;
5993
5994
  CURRENT_USER_PROMPT: currentUserPrompt,
5994
5995
  MATCHED_UI_BLOCK_COMPONENT: JSON.stringify(component, null, 2),
5995
5996
  COMPONENT_PROPS: JSON.stringify(component.props, null, 2),
5997
+ CACHED_TEXT_RESPONSE: cachedTextResponse || "No cached text response available",
5996
5998
  SCHEMA_DOC: schemaDoc || "No schema available",
5997
5999
  DATABASE_RULES: databaseRules
5998
6000
  });
@@ -6003,7 +6005,7 @@ ${JSON.stringify(tool.requiredFields || [], null, 2)}`;
6003
6005
  },
6004
6006
  {
6005
6007
  model: this.getModelForTask("complex"),
6006
- maxTokens: 3e3,
6008
+ maxTokens: 8192,
6007
6009
  temperature: 0.2,
6008
6010
  apiKey: this.getApiKey(apiKey)
6009
6011
  },
@@ -6041,6 +6043,7 @@ ${JSON.stringify(tool.requiredFields || [], null, 2)}`;
6041
6043
  return {
6042
6044
  success: true,
6043
6045
  adaptedComponent: result.adaptedComponent,
6046
+ adaptedTextResponse: result.adaptedTextResponse,
6044
6047
  parametersChanged: result.parametersChanged,
6045
6048
  explanation: result.explanation || "Parameters adapted successfully"
6046
6049
  };
@@ -6736,7 +6739,8 @@ ${errorMsg}
6736
6739
  originalPrompt,
6737
6740
  conversationMatch.uiBlock,
6738
6741
  apiKey,
6739
- logCollector
6742
+ logCollector,
6743
+ cachedTextResponse
6740
6744
  );
6741
6745
  if (adaptResult.success && adaptResult.adaptedComponent) {
6742
6746
  const elapsedTime2 = Date.now() - startTime;
@@ -6744,15 +6748,16 @@ ${errorMsg}
6744
6748
  logger.info(`[${this.getProviderName()}] Total time taken: ${elapsedTime2}ms (${(elapsedTime2 / 1e3).toFixed(2)}s)`);
6745
6749
  logCollector?.info(`\u2713 UI block adapted successfully`);
6746
6750
  logCollector?.info(`Total time taken: ${elapsedTime2}ms (${(elapsedTime2 / 1e3).toFixed(2)}s)`);
6747
- if (streamCallback && cachedTextResponse) {
6748
- logger.info(`[${this.getProviderName()}] Streaming cached text response to frontend (adapted match)`);
6749
- streamCallback(cachedTextResponse);
6751
+ const textResponseToUse = adaptResult.adaptedTextResponse || cachedTextResponse;
6752
+ if (streamCallback && textResponseToUse) {
6753
+ logger.info(`[${this.getProviderName()}] Streaming ${adaptResult.adaptedTextResponse ? "adapted" : "cached"} text response to frontend`);
6754
+ streamCallback(textResponseToUse);
6750
6755
  }
6751
6756
  const cachedActions = conversationMatch.uiBlock?.actions || [];
6752
6757
  return {
6753
6758
  success: true,
6754
6759
  data: {
6755
- text: cachedTextResponse,
6760
+ text: textResponseToUse,
6756
6761
  component: adaptResult.adaptedComponent,
6757
6762
  matchedComponents: adaptResult.adaptedComponent?.props?.config?.components || [],
6758
6763
  actions: cachedActions,