@superatomai/sdk-node 0.0.72 → 0.0.75
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 +14 -13
- package/dist/index.d.ts +14 -13
- package/dist/index.js +430 -604
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +430 -603
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1337,6 +1337,11 @@ declare class LLM {
|
|
|
1337
1337
|
private static _groqStream;
|
|
1338
1338
|
private static _geminiText;
|
|
1339
1339
|
private static _geminiStream;
|
|
1340
|
+
/**
|
|
1341
|
+
* Recursively strip unsupported JSON Schema properties for Gemini
|
|
1342
|
+
* Gemini doesn't support: additionalProperties, $schema, etc.
|
|
1343
|
+
*/
|
|
1344
|
+
private static _cleanSchemaForGemini;
|
|
1340
1345
|
private static _geminiStreamWithTools;
|
|
1341
1346
|
private static _openaiText;
|
|
1342
1347
|
private static _openaiStream;
|
|
@@ -2098,19 +2103,17 @@ declare class QueryExecutionService {
|
|
|
2098
2103
|
* @param component - The component to validate
|
|
2099
2104
|
* @param collections - Collections object containing database execute function
|
|
2100
2105
|
* @param apiKey - Optional API key for LLM calls
|
|
2101
|
-
* @param logCollector - Optional log collector for logging
|
|
2102
2106
|
* @returns Validation result with component, query key, and result
|
|
2103
2107
|
*/
|
|
2104
|
-
validateSingleQuery(component: Component, collections: any, apiKey?: string
|
|
2108
|
+
validateSingleQuery(component: Component, collections: any, apiKey?: string): Promise<QueryValidationResult>;
|
|
2105
2109
|
/**
|
|
2106
2110
|
* Validate multiple component queries in parallel
|
|
2107
2111
|
* @param components - Array of components with potential queries
|
|
2108
2112
|
* @param collections - Collections object containing database execute function
|
|
2109
2113
|
* @param apiKey - Optional API key for LLM calls
|
|
2110
|
-
* @param logCollector - Optional log collector for logging
|
|
2111
2114
|
* @returns Object with validated components and query results map
|
|
2112
2115
|
*/
|
|
2113
|
-
validateComponentQueries(components: Component[], collections: any, apiKey?: string
|
|
2116
|
+
validateComponentQueries(components: Component[], collections: any, apiKey?: string): Promise<BatchValidationResult>;
|
|
2114
2117
|
}
|
|
2115
2118
|
|
|
2116
2119
|
/**
|
|
@@ -2207,11 +2210,10 @@ declare abstract class BaseLLM {
|
|
|
2207
2210
|
* @param analysisContent - The text response containing component suggestions
|
|
2208
2211
|
* @param components - List of available components
|
|
2209
2212
|
* @param apiKey - Optional API key
|
|
2210
|
-
* @param logCollector - Optional log collector
|
|
2211
2213
|
* @param componentStreamCallback - Optional callback to stream primary KPI component as soon as it's identified
|
|
2212
2214
|
* @returns Object containing matched components, layout title/description, and follow-up actions
|
|
2213
2215
|
*/
|
|
2214
|
-
matchComponentsFromAnalysis(analysisContent: string, components: Component[], userPrompt: string, apiKey?: string,
|
|
2216
|
+
matchComponentsFromAnalysis(analysisContent: string, components: Component[], userPrompt: string, apiKey?: string, componentStreamCallback?: (component: Component) => void, deferredTools?: any[], executedTools?: any[], collections?: any, userId?: string): Promise<{
|
|
2215
2217
|
components: Component[];
|
|
2216
2218
|
layoutTitle: string;
|
|
2217
2219
|
layoutDescription: string;
|
|
@@ -2221,7 +2223,7 @@ declare abstract class BaseLLM {
|
|
|
2221
2223
|
* Classify user question into category and detect external tools needed
|
|
2222
2224
|
* Determines if question is for data analysis, requires external tools, or needs text response
|
|
2223
2225
|
*/
|
|
2224
|
-
classifyQuestionCategory(userPrompt: string, apiKey?: string,
|
|
2226
|
+
classifyQuestionCategory(userPrompt: string, apiKey?: string, conversationHistory?: string, externalTools?: any[]): Promise<{
|
|
2225
2227
|
category: 'data_analysis' | 'data_modification' | 'general';
|
|
2226
2228
|
externalTools: Array<{
|
|
2227
2229
|
type: string;
|
|
@@ -2238,7 +2240,7 @@ declare abstract class BaseLLM {
|
|
|
2238
2240
|
* Takes a matched UI block from semantic search and modifies its props to answer the new question
|
|
2239
2241
|
* Also adapts the cached text response to match the new question
|
|
2240
2242
|
*/
|
|
2241
|
-
adaptUIBlockParameters(currentUserPrompt: string, originalUserPrompt: string, matchedUIBlock: any, apiKey?: string,
|
|
2243
|
+
adaptUIBlockParameters(currentUserPrompt: string, originalUserPrompt: string, matchedUIBlock: any, apiKey?: string, cachedTextResponse?: string): Promise<{
|
|
2242
2244
|
success: boolean;
|
|
2243
2245
|
adaptedComponent?: Component;
|
|
2244
2246
|
adaptedTextResponse?: string;
|
|
@@ -2254,7 +2256,7 @@ declare abstract class BaseLLM {
|
|
|
2254
2256
|
* Supports tool calling for query execution with automatic retry on errors (max 3 attempts)
|
|
2255
2257
|
* After generating text response, if components are provided, matches suggested components
|
|
2256
2258
|
*/
|
|
2257
|
-
generateTextResponse(userPrompt: string, apiKey?: string,
|
|
2259
|
+
generateTextResponse(userPrompt: string, apiKey?: string, conversationHistory?: string, streamCallback?: (chunk: string) => void, collections?: any, components?: Component[], externalTools?: any[], category?: 'data_analysis' | 'data_modification' | 'general', userId?: string): Promise<T_RESPONSE>;
|
|
2258
2260
|
/**
|
|
2259
2261
|
* Main orchestration function with semantic search and multi-step classification
|
|
2260
2262
|
* NEW FLOW (Recommended):
|
|
@@ -2263,13 +2265,13 @@ declare abstract class BaseLLM {
|
|
|
2263
2265
|
* 2. Category classification: Determine if data_analysis, requires_external_tools, or text_response
|
|
2264
2266
|
* 3. Route appropriately based on category and response mode
|
|
2265
2267
|
*/
|
|
2266
|
-
handleUserRequest(userPrompt: string, components: Component[], apiKey?: string,
|
|
2268
|
+
handleUserRequest(userPrompt: string, components: Component[], apiKey?: string, conversationHistory?: string, responseMode?: 'component' | 'text', streamCallback?: (chunk: string) => void, collections?: any, externalTools?: any[], userId?: string): Promise<T_RESPONSE>;
|
|
2267
2269
|
/**
|
|
2268
2270
|
* Generate next questions that the user might ask based on the original prompt and generated component
|
|
2269
2271
|
* This helps provide intelligent suggestions for follow-up queries
|
|
2270
2272
|
* For general/conversational questions without components, pass textResponse instead
|
|
2271
2273
|
*/
|
|
2272
|
-
generateNextQuestions(originalUserPrompt: string, component?: Component | null, componentData?: Record<string, unknown>, apiKey?: string,
|
|
2274
|
+
generateNextQuestions(originalUserPrompt: string, component?: Component | null, componentData?: Record<string, unknown>, apiKey?: string, conversationHistory?: string, textResponse?: string): Promise<string[]>;
|
|
2273
2275
|
}
|
|
2274
2276
|
|
|
2275
2277
|
interface AnthropicLLMConfig extends BaseLLMConfig {
|
|
@@ -2385,7 +2387,6 @@ declare class QueryCache {
|
|
|
2385
2387
|
}
|
|
2386
2388
|
declare const queryCache: QueryCache;
|
|
2387
2389
|
|
|
2388
|
-
declare const SDK_VERSION = "0.0.8";
|
|
2389
2390
|
type MessageTypeHandler = (message: IncomingMessage) => void | Promise<void>;
|
|
2390
2391
|
declare class SuperatomSDK {
|
|
2391
2392
|
private ws;
|
|
@@ -2536,4 +2537,4 @@ declare class SuperatomSDK {
|
|
|
2536
2537
|
getConversationSimilarityThreshold(): number;
|
|
2537
2538
|
}
|
|
2538
2539
|
|
|
2539
|
-
export { type Action, BM25L, type BM25LOptions, type BaseLLMConfig, CONTEXT_CONFIG, type CapturedLog, CleanupService, type CollectionHandler, type CollectionOperation, type DBUIBlock, type DatabaseType, type HybridSearchOptions, type IncomingMessage, type KbNodesQueryFilters, type KbNodesRequestPayload, LLM, type LLMUsageEntry, type LogLevel, type Message, type ModelStrategy, type OutputField, type RerankedResult,
|
|
2540
|
+
export { type Action, BM25L, type BM25LOptions, type BaseLLMConfig, CONTEXT_CONFIG, type CapturedLog, CleanupService, type CollectionHandler, type CollectionOperation, type DBUIBlock, type DatabaseType, type HybridSearchOptions, type IncomingMessage, type KbNodesQueryFilters, type KbNodesRequestPayload, LLM, type LLMUsageEntry, type LogLevel, type Message, type ModelStrategy, type OutputField, type RerankedResult, STORAGE_CONFIG, SuperatomSDK, type SuperatomSDKConfig, type TaskType, Thread, ThreadManager, type Tool$1 as Tool, type ToolOutputSchema, UIBlock, UILogCollector, type User, UserManager, type UsersData, anthropicLLM, geminiLLM, groqLLM, hybridRerank, llmUsageLogger, logger, openaiLLM, queryCache, rerankChromaResults, rerankConversationResults, userPromptErrorLogger };
|
package/dist/index.d.ts
CHANGED
|
@@ -1337,6 +1337,11 @@ declare class LLM {
|
|
|
1337
1337
|
private static _groqStream;
|
|
1338
1338
|
private static _geminiText;
|
|
1339
1339
|
private static _geminiStream;
|
|
1340
|
+
/**
|
|
1341
|
+
* Recursively strip unsupported JSON Schema properties for Gemini
|
|
1342
|
+
* Gemini doesn't support: additionalProperties, $schema, etc.
|
|
1343
|
+
*/
|
|
1344
|
+
private static _cleanSchemaForGemini;
|
|
1340
1345
|
private static _geminiStreamWithTools;
|
|
1341
1346
|
private static _openaiText;
|
|
1342
1347
|
private static _openaiStream;
|
|
@@ -2098,19 +2103,17 @@ declare class QueryExecutionService {
|
|
|
2098
2103
|
* @param component - The component to validate
|
|
2099
2104
|
* @param collections - Collections object containing database execute function
|
|
2100
2105
|
* @param apiKey - Optional API key for LLM calls
|
|
2101
|
-
* @param logCollector - Optional log collector for logging
|
|
2102
2106
|
* @returns Validation result with component, query key, and result
|
|
2103
2107
|
*/
|
|
2104
|
-
validateSingleQuery(component: Component, collections: any, apiKey?: string
|
|
2108
|
+
validateSingleQuery(component: Component, collections: any, apiKey?: string): Promise<QueryValidationResult>;
|
|
2105
2109
|
/**
|
|
2106
2110
|
* Validate multiple component queries in parallel
|
|
2107
2111
|
* @param components - Array of components with potential queries
|
|
2108
2112
|
* @param collections - Collections object containing database execute function
|
|
2109
2113
|
* @param apiKey - Optional API key for LLM calls
|
|
2110
|
-
* @param logCollector - Optional log collector for logging
|
|
2111
2114
|
* @returns Object with validated components and query results map
|
|
2112
2115
|
*/
|
|
2113
|
-
validateComponentQueries(components: Component[], collections: any, apiKey?: string
|
|
2116
|
+
validateComponentQueries(components: Component[], collections: any, apiKey?: string): Promise<BatchValidationResult>;
|
|
2114
2117
|
}
|
|
2115
2118
|
|
|
2116
2119
|
/**
|
|
@@ -2207,11 +2210,10 @@ declare abstract class BaseLLM {
|
|
|
2207
2210
|
* @param analysisContent - The text response containing component suggestions
|
|
2208
2211
|
* @param components - List of available components
|
|
2209
2212
|
* @param apiKey - Optional API key
|
|
2210
|
-
* @param logCollector - Optional log collector
|
|
2211
2213
|
* @param componentStreamCallback - Optional callback to stream primary KPI component as soon as it's identified
|
|
2212
2214
|
* @returns Object containing matched components, layout title/description, and follow-up actions
|
|
2213
2215
|
*/
|
|
2214
|
-
matchComponentsFromAnalysis(analysisContent: string, components: Component[], userPrompt: string, apiKey?: string,
|
|
2216
|
+
matchComponentsFromAnalysis(analysisContent: string, components: Component[], userPrompt: string, apiKey?: string, componentStreamCallback?: (component: Component) => void, deferredTools?: any[], executedTools?: any[], collections?: any, userId?: string): Promise<{
|
|
2215
2217
|
components: Component[];
|
|
2216
2218
|
layoutTitle: string;
|
|
2217
2219
|
layoutDescription: string;
|
|
@@ -2221,7 +2223,7 @@ declare abstract class BaseLLM {
|
|
|
2221
2223
|
* Classify user question into category and detect external tools needed
|
|
2222
2224
|
* Determines if question is for data analysis, requires external tools, or needs text response
|
|
2223
2225
|
*/
|
|
2224
|
-
classifyQuestionCategory(userPrompt: string, apiKey?: string,
|
|
2226
|
+
classifyQuestionCategory(userPrompt: string, apiKey?: string, conversationHistory?: string, externalTools?: any[]): Promise<{
|
|
2225
2227
|
category: 'data_analysis' | 'data_modification' | 'general';
|
|
2226
2228
|
externalTools: Array<{
|
|
2227
2229
|
type: string;
|
|
@@ -2238,7 +2240,7 @@ declare abstract class BaseLLM {
|
|
|
2238
2240
|
* Takes a matched UI block from semantic search and modifies its props to answer the new question
|
|
2239
2241
|
* Also adapts the cached text response to match the new question
|
|
2240
2242
|
*/
|
|
2241
|
-
adaptUIBlockParameters(currentUserPrompt: string, originalUserPrompt: string, matchedUIBlock: any, apiKey?: string,
|
|
2243
|
+
adaptUIBlockParameters(currentUserPrompt: string, originalUserPrompt: string, matchedUIBlock: any, apiKey?: string, cachedTextResponse?: string): Promise<{
|
|
2242
2244
|
success: boolean;
|
|
2243
2245
|
adaptedComponent?: Component;
|
|
2244
2246
|
adaptedTextResponse?: string;
|
|
@@ -2254,7 +2256,7 @@ declare abstract class BaseLLM {
|
|
|
2254
2256
|
* Supports tool calling for query execution with automatic retry on errors (max 3 attempts)
|
|
2255
2257
|
* After generating text response, if components are provided, matches suggested components
|
|
2256
2258
|
*/
|
|
2257
|
-
generateTextResponse(userPrompt: string, apiKey?: string,
|
|
2259
|
+
generateTextResponse(userPrompt: string, apiKey?: string, conversationHistory?: string, streamCallback?: (chunk: string) => void, collections?: any, components?: Component[], externalTools?: any[], category?: 'data_analysis' | 'data_modification' | 'general', userId?: string): Promise<T_RESPONSE>;
|
|
2258
2260
|
/**
|
|
2259
2261
|
* Main orchestration function with semantic search and multi-step classification
|
|
2260
2262
|
* NEW FLOW (Recommended):
|
|
@@ -2263,13 +2265,13 @@ declare abstract class BaseLLM {
|
|
|
2263
2265
|
* 2. Category classification: Determine if data_analysis, requires_external_tools, or text_response
|
|
2264
2266
|
* 3. Route appropriately based on category and response mode
|
|
2265
2267
|
*/
|
|
2266
|
-
handleUserRequest(userPrompt: string, components: Component[], apiKey?: string,
|
|
2268
|
+
handleUserRequest(userPrompt: string, components: Component[], apiKey?: string, conversationHistory?: string, responseMode?: 'component' | 'text', streamCallback?: (chunk: string) => void, collections?: any, externalTools?: any[], userId?: string): Promise<T_RESPONSE>;
|
|
2267
2269
|
/**
|
|
2268
2270
|
* Generate next questions that the user might ask based on the original prompt and generated component
|
|
2269
2271
|
* This helps provide intelligent suggestions for follow-up queries
|
|
2270
2272
|
* For general/conversational questions without components, pass textResponse instead
|
|
2271
2273
|
*/
|
|
2272
|
-
generateNextQuestions(originalUserPrompt: string, component?: Component | null, componentData?: Record<string, unknown>, apiKey?: string,
|
|
2274
|
+
generateNextQuestions(originalUserPrompt: string, component?: Component | null, componentData?: Record<string, unknown>, apiKey?: string, conversationHistory?: string, textResponse?: string): Promise<string[]>;
|
|
2273
2275
|
}
|
|
2274
2276
|
|
|
2275
2277
|
interface AnthropicLLMConfig extends BaseLLMConfig {
|
|
@@ -2385,7 +2387,6 @@ declare class QueryCache {
|
|
|
2385
2387
|
}
|
|
2386
2388
|
declare const queryCache: QueryCache;
|
|
2387
2389
|
|
|
2388
|
-
declare const SDK_VERSION = "0.0.8";
|
|
2389
2390
|
type MessageTypeHandler = (message: IncomingMessage) => void | Promise<void>;
|
|
2390
2391
|
declare class SuperatomSDK {
|
|
2391
2392
|
private ws;
|
|
@@ -2536,4 +2537,4 @@ declare class SuperatomSDK {
|
|
|
2536
2537
|
getConversationSimilarityThreshold(): number;
|
|
2537
2538
|
}
|
|
2538
2539
|
|
|
2539
|
-
export { type Action, BM25L, type BM25LOptions, type BaseLLMConfig, CONTEXT_CONFIG, type CapturedLog, CleanupService, type CollectionHandler, type CollectionOperation, type DBUIBlock, type DatabaseType, type HybridSearchOptions, type IncomingMessage, type KbNodesQueryFilters, type KbNodesRequestPayload, LLM, type LLMUsageEntry, type LogLevel, type Message, type ModelStrategy, type OutputField, type RerankedResult,
|
|
2540
|
+
export { type Action, BM25L, type BM25LOptions, type BaseLLMConfig, CONTEXT_CONFIG, type CapturedLog, CleanupService, type CollectionHandler, type CollectionOperation, type DBUIBlock, type DatabaseType, type HybridSearchOptions, type IncomingMessage, type KbNodesQueryFilters, type KbNodesRequestPayload, LLM, type LLMUsageEntry, type LogLevel, type Message, type ModelStrategy, type OutputField, type RerankedResult, STORAGE_CONFIG, SuperatomSDK, type SuperatomSDKConfig, type TaskType, Thread, ThreadManager, type Tool$1 as Tool, type ToolOutputSchema, UIBlock, UILogCollector, type User, UserManager, type UsersData, anthropicLLM, geminiLLM, groqLLM, hybridRerank, llmUsageLogger, logger, openaiLLM, queryCache, rerankChromaResults, rerankConversationResults, userPromptErrorLogger };
|