@smythos/sre 1.7.18 → 1.7.40
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.js +120 -82
- package/dist/index.js.map +1 -1
- package/dist/types/Components/DataSourceIndexer.class.d.ts +4 -12
- package/dist/types/Components/GenAILLM.class.d.ts +5 -5
- package/dist/types/Components/RAG/DataSourceCleaner.class.d.ts +37 -0
- package/dist/types/Components/RAG/DataSourceComponent.class.d.ts +30 -0
- package/dist/types/Components/RAG/DataSourceIndexer.class.d.ts +14 -0
- package/dist/types/Components/RAG/DataSourceLookup.class.d.ts +36 -0
- package/dist/types/Components/index.d.ts +3 -3
- package/dist/types/helpers/Conversation.helper.d.ts +3 -0
- package/dist/types/index.d.ts +3 -3
- package/dist/types/subsystems/IO/VectorDB.service/connectors/MilvusVectorDB.class.d.ts +1 -0
- package/dist/types/subsystems/IO/VectorDB.service/connectors/PineconeVectorDB.class.d.ts +11 -4
- package/dist/types/subsystems/IO/VectorDB.service/embed/index.d.ts +5 -0
- package/dist/types/subsystems/LLMManager/LLM.inference.d.ts +10 -3
- package/dist/types/subsystems/LLMManager/LLM.service/connectors/GoogleAI.class.d.ts +4 -2
- package/dist/types/subsystems/LLMManager/ModelsProvider.service/connectors/JSONModelsProvider.class.d.ts +35 -0
- package/dist/types/subsystems/Security/Account.service/AccountConnector.d.ts +2 -2
- package/dist/types/subsystems/Security/ManagedVault.service/connectors/SecretManagerManagedVault.d.ts +10 -0
- package/dist/types/subsystems/Security/Vault.service/connectors/SecretsManager.class.d.ts +6 -2
- package/dist/types/types/LLM.types.d.ts +2 -0
- package/dist/types/types/VectorDB.types.d.ts +4 -0
- package/dist/types/utils/array.utils.d.ts +4 -0
- package/dist/types/utils/string.utils.d.ts +1 -0
- package/package.json +3 -3
- package/src/Components/APIEndpoint.class.ts +1 -6
- package/src/Components/Component.class.ts +14 -1
- package/src/Components/DataSourceIndexer.class.ts +148 -34
- package/src/Components/GenAILLM.class.ts +21 -11
- package/src/Components/RAG/DataSourceCleaner.class.ts +178 -0
- package/src/Components/RAG/DataSourceComponent.class.ts +111 -0
- package/src/Components/RAG/DataSourceIndexer.class.ts +254 -0
- package/src/Components/{DataSourceLookup.class.ts → RAG/DataSourceLookup.class.ts} +92 -3
- package/src/Components/ServerlessCode.class.ts +1 -4
- package/src/Components/index.ts +3 -3
- package/src/helpers/AWSLambdaCode.helper.ts +40 -45
- package/src/helpers/Conversation.helper.ts +14 -10
- package/src/helpers/S3Cache.helper.ts +2 -1
- package/src/index.ts +212 -212
- package/src/index.ts.bak +212 -212
- package/src/subsystems/IO/NKV.service/connectors/NKVRedis.class.ts +3 -1
- package/src/subsystems/IO/VectorDB.service/connectors/MilvusVectorDB.class.ts +145 -19
- package/src/subsystems/IO/VectorDB.service/connectors/PineconeVectorDB.class.ts +56 -22
- package/src/subsystems/IO/VectorDB.service/embed/GoogleEmbedding.ts +1 -0
- package/src/subsystems/IO/VectorDB.service/embed/OpenAIEmbedding.ts +2 -1
- package/src/subsystems/IO/VectorDB.service/embed/index.ts +18 -0
- package/src/subsystems/LLMManager/LLM.inference.ts +63 -47
- package/src/subsystems/LLMManager/LLM.service/connectors/Anthropic.class.ts +35 -10
- package/src/subsystems/LLMManager/LLM.service/connectors/Bedrock.class.ts +12 -4
- package/src/subsystems/LLMManager/LLM.service/connectors/Echo.class.ts +4 -4
- package/src/subsystems/LLMManager/LLM.service/connectors/GoogleAI.class.ts +105 -23
- package/src/subsystems/LLMManager/LLM.service/connectors/Groq.class.ts +17 -5
- package/src/subsystems/LLMManager/LLM.service/connectors/Ollama.class.ts +18 -3
- package/src/subsystems/LLMManager/LLM.service/connectors/Perplexity.class.ts +14 -5
- package/src/subsystems/LLMManager/LLM.service/connectors/VertexAI.class.ts +6 -4
- package/src/subsystems/LLMManager/LLM.service/connectors/openai/apiInterfaces/ChatCompletionsApiInterface.ts +5 -5
- package/src/subsystems/LLMManager/LLM.service/connectors/openai/apiInterfaces/ResponsesApiInterface.ts +8 -3
- package/src/subsystems/LLMManager/LLM.service/connectors/xAI.class.ts +9 -8
- package/src/subsystems/LLMManager/ModelsProvider.service/connectors/JSONModelsProvider.class.ts +126 -28
- package/src/subsystems/ObservabilityManager/Telemetry.service/connectors/OTel/OTel.class.ts +38 -6
- package/src/subsystems/Security/Account.service/AccountConnector.ts +3 -3
- package/src/subsystems/Security/ManagedVault.service/connectors/SecretManagerManagedVault.ts +111 -48
- package/src/subsystems/Security/Vault.service/connectors/SecretsManager.class.ts +41 -66
- package/src/types/LLM.types.ts +5 -0
- package/src/types/VectorDB.types.ts +4 -0
- package/src/utils/array.utils.ts +11 -0
- package/src/utils/base64.utils.ts +1 -1
- package/src/utils/string.utils.ts +3 -192
- package/src/Components/DataSourceCleaner.class.ts +0 -92
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import { IAgent as Agent } from '@sre/types/Agent.types';
|
|
2
|
-
import { Component } from './Component.class';
|
|
3
|
-
import { TemplateString } from '@sre/helpers/TemplateString.helper';
|
|
4
|
-
import Joi from 'joi';
|
|
5
|
-
import { validateCharacterSet } from '../utils';
|
|
6
|
-
import { ConnectorService } from '@sre/Core/ConnectorsService';
|
|
7
|
-
import { AccessCandidate } from '@sre/Security/AccessControl/AccessCandidate.class';
|
|
8
|
-
|
|
9
|
-
import { DataSourceIndexer } from './DataSourceIndexer.class';
|
|
10
|
-
|
|
11
|
-
export class DataSourceCleaner extends Component {
|
|
12
|
-
protected configSchema = Joi.object({
|
|
13
|
-
namespaceId: Joi.string().max(50).allow('').label('namespace'),
|
|
14
|
-
id: Joi.string().custom(validateCharacterSet, 'custom validation characterSet').allow('').label('source identifier'),
|
|
15
|
-
});
|
|
16
|
-
constructor() {
|
|
17
|
-
super();
|
|
18
|
-
}
|
|
19
|
-
init() {}
|
|
20
|
-
async process(input, config, agent: Agent) {
|
|
21
|
-
await super.process(input, config, agent);
|
|
22
|
-
const teamId = agent.teamId;
|
|
23
|
-
const agentId = agent.id;
|
|
24
|
-
let debugOutput = agent.agentRuntime?.debug ? '== Source Indexer Log ==\n' : null;
|
|
25
|
-
|
|
26
|
-
try {
|
|
27
|
-
const configSchema = this.validateConfigData(config.data);
|
|
28
|
-
if (configSchema.error) {
|
|
29
|
-
throw new Error(`Config data validation error: ${configSchema.error}\n EXITING...`);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const outputs = {};
|
|
33
|
-
for (let con of config.outputs) {
|
|
34
|
-
if (con.default) continue;
|
|
35
|
-
outputs[con.name] = con?.description ? `<${con?.description}>` : '';
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
const inputSchema = this.validateInput(input);
|
|
39
|
-
if (inputSchema.error) {
|
|
40
|
-
throw new Error(`Input validation error: ${inputSchema.error}\n EXITING...`);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
const namespaceId = configSchema.value.namespaceId.split('_')?.slice(1).join('_') || configSchema.value.namespaceId;
|
|
44
|
-
|
|
45
|
-
let vectorDbConnector = ConnectorService.getVectorDBConnector();
|
|
46
|
-
|
|
47
|
-
let existingnamespace = await vectorDbConnector.requester(AccessCandidate.team(teamId)).namespaceExists(namespaceId);
|
|
48
|
-
if (!existingnamespace) {
|
|
49
|
-
throw new Error(`Namespace ${namespaceId} does not exist`);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
const providedId = TemplateString(config.data.id).parse(input).result;
|
|
53
|
-
const idRegex = /^[a-zA-Z0-9\-\_\.]+$/;
|
|
54
|
-
if (!idRegex.test(providedId)) {
|
|
55
|
-
throw new Error(`Invalid id. Accepted characters: 'a-z', 'A-Z', '0-9', '-', '_', '.'`);
|
|
56
|
-
}
|
|
57
|
-
debugOutput += `Searching for data source with id: ${providedId}\n`;
|
|
58
|
-
|
|
59
|
-
const dsId = DataSourceIndexer.genDsId(providedId, teamId, namespaceId);
|
|
60
|
-
|
|
61
|
-
await vectorDbConnector.requester(AccessCandidate.team(teamId)).deleteDatasource(namespaceId, dsId);
|
|
62
|
-
|
|
63
|
-
debugOutput += `Deleted data source with id: ${providedId}\n`;
|
|
64
|
-
|
|
65
|
-
return {
|
|
66
|
-
_debug: debugOutput,
|
|
67
|
-
Success: true,
|
|
68
|
-
// _error,
|
|
69
|
-
};
|
|
70
|
-
} catch (err: any) {
|
|
71
|
-
debugOutput += `Failed to delete data source: \n Error: ${err?.message}\n`;
|
|
72
|
-
|
|
73
|
-
return {
|
|
74
|
-
_debug: debugOutput,
|
|
75
|
-
_error: err?.message || "Couldn't delete data source",
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
validateInput(input: any) {
|
|
81
|
-
return Joi.object({}).unknown(true).validate(input);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
validateConfigData(data: any) {
|
|
85
|
-
return Joi.object({
|
|
86
|
-
namespaceId: Joi.string().required(),
|
|
87
|
-
id: Joi.string().optional().allow('').allow(null),
|
|
88
|
-
})
|
|
89
|
-
.unknown(true)
|
|
90
|
-
.validate(data);
|
|
91
|
-
}
|
|
92
|
-
}
|