@superatomai/sdk-node 0.0.61 → 0.0.62
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.d.mts +39 -0
- package/dist/index.d.ts +39 -0
- package/dist/index.js +50 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +50 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +48 -49
package/dist/index.mjs
CHANGED
|
@@ -5960,6 +5960,7 @@ var BaseLLM = class {
|
|
|
5960
5960
|
this.defaultLimit = config?.defaultLimit || 50;
|
|
5961
5961
|
this.apiKey = config?.apiKey;
|
|
5962
5962
|
this.modelStrategy = config?.modelStrategy || "fast";
|
|
5963
|
+
this.conversationSimilarityThreshold = config?.conversationSimilarityThreshold || 0.8;
|
|
5963
5964
|
}
|
|
5964
5965
|
/**
|
|
5965
5966
|
* Get the appropriate model based on task type and model strategy
|
|
@@ -5992,6 +5993,26 @@ var BaseLLM = class {
|
|
|
5992
5993
|
getModelStrategy() {
|
|
5993
5994
|
return this.modelStrategy;
|
|
5994
5995
|
}
|
|
5996
|
+
/**
|
|
5997
|
+
* Set the conversation similarity threshold at runtime
|
|
5998
|
+
* @param threshold - Value between 0 and 1 (e.g., 0.8 = 80% similarity required)
|
|
5999
|
+
*/
|
|
6000
|
+
setConversationSimilarityThreshold(threshold) {
|
|
6001
|
+
if (threshold < 0 || threshold > 1) {
|
|
6002
|
+
logger.warn(`[${this.getProviderName()}] Invalid threshold ${threshold}, must be between 0 and 1. Using default 0.8`);
|
|
6003
|
+
this.conversationSimilarityThreshold = 0.8;
|
|
6004
|
+
return;
|
|
6005
|
+
}
|
|
6006
|
+
this.conversationSimilarityThreshold = threshold;
|
|
6007
|
+
logger.info(`[${this.getProviderName()}] Conversation similarity threshold set to: ${threshold}`);
|
|
6008
|
+
}
|
|
6009
|
+
/**
|
|
6010
|
+
* Get the current conversation similarity threshold
|
|
6011
|
+
* @returns The current threshold value
|
|
6012
|
+
*/
|
|
6013
|
+
getConversationSimilarityThreshold() {
|
|
6014
|
+
return this.conversationSimilarityThreshold;
|
|
6015
|
+
}
|
|
5995
6016
|
/**
|
|
5996
6017
|
* Get the API key (from instance, parameter, or environment)
|
|
5997
6018
|
*/
|
|
@@ -7293,8 +7314,7 @@ ${errorMsg}
|
|
|
7293
7314
|
userPrompt,
|
|
7294
7315
|
collections,
|
|
7295
7316
|
userId,
|
|
7296
|
-
similarityThreshold:
|
|
7297
|
-
// 80% threshold
|
|
7317
|
+
similarityThreshold: this.conversationSimilarityThreshold
|
|
7298
7318
|
});
|
|
7299
7319
|
if (conversationMatch) {
|
|
7300
7320
|
logger.info(`[${this.getProviderName()}] \u2713 Found matching conversation with ${(conversationMatch.similarity * 100).toFixed(2)}% similarity`);
|
|
@@ -12874,8 +12894,10 @@ var SuperatomSDK = class {
|
|
|
12874
12894
|
this.llmProviders = config.LLM_PROVIDERS || getLLMProviders();
|
|
12875
12895
|
this.databaseType = config.databaseType || "postgresql";
|
|
12876
12896
|
this.modelStrategy = config.modelStrategy || "fast";
|
|
12897
|
+
this.conversationSimilarityThreshold = config.conversationSimilarityThreshold ?? 0.8;
|
|
12877
12898
|
this.applyModelStrategy(this.modelStrategy);
|
|
12878
|
-
|
|
12899
|
+
this.applyConversationSimilarityThreshold(this.conversationSimilarityThreshold);
|
|
12900
|
+
logger.info(`Initializing Superatom SDK v${SDK_VERSION} for project ${this.projectId}, llm providers: ${this.llmProviders.join(", ")}, database type: ${this.databaseType}, model strategy: ${this.modelStrategy}, conversation similarity threshold: ${this.conversationSimilarityThreshold}`);
|
|
12879
12901
|
this.userManager = new UserManager(this.projectId, 5e3);
|
|
12880
12902
|
this.dashboardManager = new DashboardManager(this.projectId);
|
|
12881
12903
|
this.reportManager = new ReportManager(this.projectId);
|
|
@@ -13288,6 +13310,31 @@ var SuperatomSDK = class {
|
|
|
13288
13310
|
getModelStrategy() {
|
|
13289
13311
|
return this.modelStrategy;
|
|
13290
13312
|
}
|
|
13313
|
+
/**
|
|
13314
|
+
* Apply conversation similarity threshold to all LLM provider singletons
|
|
13315
|
+
* @param threshold - Value between 0 and 1 (e.g., 0.8 = 80% similarity required)
|
|
13316
|
+
*/
|
|
13317
|
+
applyConversationSimilarityThreshold(threshold) {
|
|
13318
|
+
anthropicLLM.setConversationSimilarityThreshold(threshold);
|
|
13319
|
+
groqLLM.setConversationSimilarityThreshold(threshold);
|
|
13320
|
+
geminiLLM.setConversationSimilarityThreshold(threshold);
|
|
13321
|
+
openaiLLM.setConversationSimilarityThreshold(threshold);
|
|
13322
|
+
logger.info(`Conversation similarity threshold '${threshold}' applied to all LLM providers`);
|
|
13323
|
+
}
|
|
13324
|
+
/**
|
|
13325
|
+
* Set conversation similarity threshold at runtime
|
|
13326
|
+
* @param threshold - Value between 0 and 1 (e.g., 0.8 = 80% similarity required)
|
|
13327
|
+
*/
|
|
13328
|
+
setConversationSimilarityThreshold(threshold) {
|
|
13329
|
+
this.conversationSimilarityThreshold = threshold;
|
|
13330
|
+
this.applyConversationSimilarityThreshold(threshold);
|
|
13331
|
+
}
|
|
13332
|
+
/**
|
|
13333
|
+
* Get current conversation similarity threshold
|
|
13334
|
+
*/
|
|
13335
|
+
getConversationSimilarityThreshold() {
|
|
13336
|
+
return this.conversationSimilarityThreshold;
|
|
13337
|
+
}
|
|
13291
13338
|
};
|
|
13292
13339
|
export {
|
|
13293
13340
|
BM25L,
|