@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.mjs
CHANGED
|
@@ -3767,6 +3767,12 @@ You MUST respond with ONLY a valid JSON object (no markdown, no code blocks):
|
|
|
3767
3767
|
---
|
|
3768
3768
|
|
|
3769
3769
|
## CONTEXT
|
|
3770
|
+
|
|
3771
|
+
### Global Knowledge Base
|
|
3772
|
+
{{GLOBAL_KNOWLEDGE_BASE}}
|
|
3773
|
+
|
|
3774
|
+
### Knowledge Base Context
|
|
3775
|
+
{{KNOWLEDGE_BASE_CONTEXT}}
|
|
3770
3776
|
`,
|
|
3771
3777
|
user: `{{USER_PROMPT}}`
|
|
3772
3778
|
},
|
|
@@ -14594,7 +14600,7 @@ function sendDashCompResponse(id, res, sendMessage, clientId) {
|
|
|
14594
14600
|
}
|
|
14595
14601
|
|
|
14596
14602
|
// src/dashComp/pick-component.ts
|
|
14597
|
-
async function pickComponentWithLLM(prompt, components, anthropicApiKey, groqApiKey, geminiApiKey, openaiApiKey, llmProviders, collections, tools, dashCompModels, conversationHistory) {
|
|
14603
|
+
async function pickComponentWithLLM(prompt, components, anthropicApiKey, groqApiKey, geminiApiKey, openaiApiKey, llmProviders, collections, tools, dashCompModels, conversationHistory, userId) {
|
|
14598
14604
|
const errors = [];
|
|
14599
14605
|
const availableComponentsText = formatComponentsForPrompt(components);
|
|
14600
14606
|
const availableToolsText = formatToolsForPrompt(tools);
|
|
@@ -14610,6 +14616,25 @@ async function pickComponentWithLLM(prompt, components, anthropicApiKey, groqApi
|
|
|
14610
14616
|
schemaDoc = schema.generateSchemaDocumentation();
|
|
14611
14617
|
}
|
|
14612
14618
|
const databaseRules = await promptLoader.loadDatabaseRules();
|
|
14619
|
+
let globalKnowledgeBase = "No global knowledge base available.";
|
|
14620
|
+
let knowledgeBaseContext = "No additional knowledge base context available.";
|
|
14621
|
+
if (collections) {
|
|
14622
|
+
const kbResult = await knowledge_base_default.getAllKnowledgeBase({
|
|
14623
|
+
prompt,
|
|
14624
|
+
collections,
|
|
14625
|
+
userId,
|
|
14626
|
+
topK: KNOWLEDGE_BASE_TOP_K
|
|
14627
|
+
});
|
|
14628
|
+
globalKnowledgeBase = kbResult.globalContext || globalKnowledgeBase;
|
|
14629
|
+
const dynamicParts = [];
|
|
14630
|
+
if (kbResult.userContext) {
|
|
14631
|
+
dynamicParts.push("## User-Specific Knowledge Base\n" + kbResult.userContext);
|
|
14632
|
+
}
|
|
14633
|
+
if (kbResult.queryContext) {
|
|
14634
|
+
dynamicParts.push("## Relevant Knowledge Base (Query-Matched)\n" + kbResult.queryContext);
|
|
14635
|
+
}
|
|
14636
|
+
knowledgeBaseContext = dynamicParts.join("\n\n") || knowledgeBaseContext;
|
|
14637
|
+
}
|
|
14613
14638
|
const prompts = await promptLoader.loadPrompts("dash-comp-picker", {
|
|
14614
14639
|
USER_PROMPT: prompt,
|
|
14615
14640
|
AVAILABLE_COMPONENTS: availableComponentsText,
|
|
@@ -14617,8 +14642,12 @@ async function pickComponentWithLLM(prompt, components, anthropicApiKey, groqApi
|
|
|
14617
14642
|
DATABASE_RULES: databaseRules,
|
|
14618
14643
|
AVAILABLE_TOOLS: availableToolsText,
|
|
14619
14644
|
CURRENT_DATETIME: getCurrentDateTimeForPrompt(),
|
|
14620
|
-
CONVERSATION_HISTORY: conversationHistory || "No previous conversation"
|
|
14645
|
+
CONVERSATION_HISTORY: conversationHistory || "No previous conversation",
|
|
14646
|
+
GLOBAL_KNOWLEDGE_BASE: globalKnowledgeBase,
|
|
14647
|
+
KNOWLEDGE_BASE_CONTEXT: knowledgeBaseContext
|
|
14621
14648
|
});
|
|
14649
|
+
logger.logLLMPrompt("dashCompPicker", "system", extractPromptText(prompts.system));
|
|
14650
|
+
logger.logLLMPrompt("dashCompPicker", "user", prompts.user);
|
|
14622
14651
|
logger.debug("[DASH_COMP_REQ] Loaded dash-comp-picker prompts with schema and tools");
|
|
14623
14652
|
const { apiKey, model } = getApiKeyAndModel(
|
|
14624
14653
|
anthropicApiKey,
|
|
@@ -15446,7 +15475,8 @@ var processDashCompRequest = async (data, components, _sendMessage, anthropicApi
|
|
|
15446
15475
|
collections,
|
|
15447
15476
|
tools,
|
|
15448
15477
|
dashCompModels,
|
|
15449
|
-
conversationHistory
|
|
15478
|
+
conversationHistory,
|
|
15479
|
+
userId
|
|
15450
15480
|
);
|
|
15451
15481
|
}
|
|
15452
15482
|
if (llmResponse.success && dashboardId && prompt) {
|