@superatomai/sdk-node 0.0.44-mds → 0.0.45-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/README.md +942 -942
- package/dist/index.js +33 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +33 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3827,6 +3827,12 @@ You MUST respond with ONLY a valid JSON object (no markdown, no code blocks):
|
|
|
3827
3827
|
---
|
|
3828
3828
|
|
|
3829
3829
|
## CONTEXT
|
|
3830
|
+
|
|
3831
|
+
### Global Knowledge Base
|
|
3832
|
+
{{GLOBAL_KNOWLEDGE_BASE}}
|
|
3833
|
+
|
|
3834
|
+
### Knowledge Base Context
|
|
3835
|
+
{{KNOWLEDGE_BASE_CONTEXT}}
|
|
3830
3836
|
`,
|
|
3831
3837
|
user: `{{USER_PROMPT}}`
|
|
3832
3838
|
},
|
|
@@ -14654,7 +14660,7 @@ function sendDashCompResponse(id, res, sendMessage, clientId) {
|
|
|
14654
14660
|
}
|
|
14655
14661
|
|
|
14656
14662
|
// src/dashComp/pick-component.ts
|
|
14657
|
-
async function pickComponentWithLLM(prompt, components, anthropicApiKey, groqApiKey, geminiApiKey, openaiApiKey, llmProviders, collections, tools, dashCompModels, conversationHistory) {
|
|
14663
|
+
async function pickComponentWithLLM(prompt, components, anthropicApiKey, groqApiKey, geminiApiKey, openaiApiKey, llmProviders, collections, tools, dashCompModels, conversationHistory, userId) {
|
|
14658
14664
|
const errors = [];
|
|
14659
14665
|
const availableComponentsText = formatComponentsForPrompt(components);
|
|
14660
14666
|
const availableToolsText = formatToolsForPrompt(tools);
|
|
@@ -14670,6 +14676,25 @@ async function pickComponentWithLLM(prompt, components, anthropicApiKey, groqApi
|
|
|
14670
14676
|
schemaDoc = schema.generateSchemaDocumentation();
|
|
14671
14677
|
}
|
|
14672
14678
|
const databaseRules = await promptLoader.loadDatabaseRules();
|
|
14679
|
+
let globalKnowledgeBase = "No global knowledge base available.";
|
|
14680
|
+
let knowledgeBaseContext = "No additional knowledge base context available.";
|
|
14681
|
+
if (collections) {
|
|
14682
|
+
const kbResult = await knowledge_base_default.getAllKnowledgeBase({
|
|
14683
|
+
prompt,
|
|
14684
|
+
collections,
|
|
14685
|
+
userId,
|
|
14686
|
+
topK: KNOWLEDGE_BASE_TOP_K
|
|
14687
|
+
});
|
|
14688
|
+
globalKnowledgeBase = kbResult.globalContext || globalKnowledgeBase;
|
|
14689
|
+
const dynamicParts = [];
|
|
14690
|
+
if (kbResult.userContext) {
|
|
14691
|
+
dynamicParts.push("## User-Specific Knowledge Base\n" + kbResult.userContext);
|
|
14692
|
+
}
|
|
14693
|
+
if (kbResult.queryContext) {
|
|
14694
|
+
dynamicParts.push("## Relevant Knowledge Base (Query-Matched)\n" + kbResult.queryContext);
|
|
14695
|
+
}
|
|
14696
|
+
knowledgeBaseContext = dynamicParts.join("\n\n") || knowledgeBaseContext;
|
|
14697
|
+
}
|
|
14673
14698
|
const prompts = await promptLoader.loadPrompts("dash-comp-picker", {
|
|
14674
14699
|
USER_PROMPT: prompt,
|
|
14675
14700
|
AVAILABLE_COMPONENTS: availableComponentsText,
|
|
@@ -14677,8 +14702,12 @@ async function pickComponentWithLLM(prompt, components, anthropicApiKey, groqApi
|
|
|
14677
14702
|
DATABASE_RULES: databaseRules,
|
|
14678
14703
|
AVAILABLE_TOOLS: availableToolsText,
|
|
14679
14704
|
CURRENT_DATETIME: getCurrentDateTimeForPrompt(),
|
|
14680
|
-
CONVERSATION_HISTORY: conversationHistory || "No previous conversation"
|
|
14705
|
+
CONVERSATION_HISTORY: conversationHistory || "No previous conversation",
|
|
14706
|
+
GLOBAL_KNOWLEDGE_BASE: globalKnowledgeBase,
|
|
14707
|
+
KNOWLEDGE_BASE_CONTEXT: knowledgeBaseContext
|
|
14681
14708
|
});
|
|
14709
|
+
logger.logLLMPrompt("dashCompPicker", "system", extractPromptText(prompts.system));
|
|
14710
|
+
logger.logLLMPrompt("dashCompPicker", "user", prompts.user);
|
|
14682
14711
|
logger.debug("[DASH_COMP_REQ] Loaded dash-comp-picker prompts with schema and tools");
|
|
14683
14712
|
const { apiKey, model } = getApiKeyAndModel(
|
|
14684
14713
|
anthropicApiKey,
|
|
@@ -15506,7 +15535,8 @@ var processDashCompRequest = async (data, components, _sendMessage, anthropicApi
|
|
|
15506
15535
|
collections,
|
|
15507
15536
|
tools,
|
|
15508
15537
|
dashCompModels,
|
|
15509
|
-
conversationHistory
|
|
15538
|
+
conversationHistory,
|
|
15539
|
+
userId
|
|
15510
15540
|
);
|
|
15511
15541
|
}
|
|
15512
15542
|
if (llmResponse.success && dashboardId && prompt) {
|