From c72155d8ff3880b75094ec6825e393e6baeb5196 Mon Sep 17 00:00:00 2001 From: "Alaa-eddine K." Date: Tue, 1 Jul 2025 13:32:28 +0200 Subject: [PATCH 1/2] reintroducing legacy credentials loading from env variable to ensure smooth transition of SaaS code --- packages/core/package.json | 2 +- .../LLM.service/LLMCredentials.helper.ts | 28 +++++++++++++++++-- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/packages/core/package.json b/packages/core/package.json index b97afdee..b15824cc 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@smythos/sre", - "version": "1.5.21", + "version": "1.5.22", "description": "Smyth Runtime Environment", "author": "Alaa-eddine KADDOURI", "license": "MIT", diff --git a/packages/core/src/subsystems/LLMManager/LLM.service/LLMCredentials.helper.ts b/packages/core/src/subsystems/LLMManager/LLM.service/LLMCredentials.helper.ts index e6dfe22c..5072763f 100644 --- a/packages/core/src/subsystems/LLMManager/LLM.service/LLMCredentials.helper.ts +++ b/packages/core/src/subsystems/LLMManager/LLM.service/LLMCredentials.helper.ts @@ -1,4 +1,3 @@ -import config from '@sre/config'; import { ConnectorService } from '@sre/Core/ConnectorsService'; import { AccessCandidate } from '@sre/Security/AccessControl/AccessCandidate.class'; import { TBedrockSettings, TCustomLLMModel, TLLMCredentials, TLLMModel, TVertexAISettings } from '@sre/types/LLM.types'; @@ -18,7 +17,11 @@ export async function getLLMCredentials(candidate: AccessCandidate, modelInfo: T case TLLMCredentials.None: { return { apiKey: '' }; } - case TLLMCredentials.Internal: + case TLLMCredentials.Internal: { + const credentials = await getEnvCredentials(candidate, modelInfo as TLLMModel); + if (credentials) return credentials; + break; + } case TLLMCredentials.Vault: { const credentials = await getStandardLLMCredentials(candidate, modelInfo as TLLMModel); if (credentials) return credentials; @@ -40,6 +43,27 @@ export async function getLLMCredentials(candidate: AccessCandidate, modelInfo: T return {}; } +/** + * Legacy API keys + * TODO : move this to a special vault entry + */ +const SMYTHOS_API_KEYS = { + echo: '', + openai: process.env.OPENAI_API_KEY, + anthropic: process.env.ANTHROPIC_API_KEY, + googleai: process.env.GOOGLE_AI_API_KEY, + togetherai: process.env.TOGETHER_AI_API_KEY, + groq: process.env.GROQ_API_KEY, + xai: process.env.XAI_API_KEY, + perplexity: process.env.PERPLEXITY_API_KEY, +}; +async function getEnvCredentials(candidate: AccessCandidate, modelInfo: TLLMModel): Promise<{ apiKey: string }> { + const provider = (modelInfo.provider || modelInfo.llm)?.toLowerCase(); + const apiKey = SMYTHOS_API_KEYS?.[provider] || ''; + if (!apiKey) return null; + return { apiKey }; +} + /** * Retrieves API key credentials for standard LLM providers from the vault * @param candidate - The access candidate requesting the credentials From f8165df4899110b588c03fcc0f96be26eef4cf5d Mon Sep 17 00:00:00 2001 From: "Alaa-eddine K." Date: Tue, 1 Jul 2025 14:57:03 +0200 Subject: [PATCH 2/2] Fix generated types inheritance --- packages/core/package.json | 2 +- packages/core/tsconfig.dts.json | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/core/package.json b/packages/core/package.json index b15824cc..a333fd4c 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@smythos/sre", - "version": "1.5.22", + "version": "1.5.23", "description": "Smyth Runtime Environment", "author": "Alaa-eddine KADDOURI", "license": "MIT", diff --git a/packages/core/tsconfig.dts.json b/packages/core/tsconfig.dts.json index 39e31773..804d5e34 100644 --- a/packages/core/tsconfig.dts.json +++ b/packages/core/tsconfig.dts.json @@ -13,6 +13,8 @@ "resolveJsonModule": true, "experimentalDecorators": true, "emitDecoratorMetadata": true, + "declarationMap": false, + "stripInternal": false, //"noImplicitAny": false, //"ignoreDeprecations": "5.0",