diff --git a/examples/10-custom-sre-config/01-custom-models.ts b/examples/10-custom-sre-config/01-custom-models.ts index 3c49815a..e986974e 100644 --- a/examples/10-custom-sre-config/01-custom-models.ts +++ b/examples/10-custom-sre-config/01-custom-models.ts @@ -1,4 +1,4 @@ -import { SRE } from '@smythos/sre'; //Since we'ill +import { SRE } from '@smythos/sre'; import { Agent } from '@smythos/sdk'; import path from 'path'; import { fileURLToPath } from 'url'; diff --git a/packages/core/src/subsystems/LLMManager/LLM.service/connectors/openai/apiInterfaces/ChatCompletionsApiInterface.ts b/packages/core/src/subsystems/LLMManager/LLM.service/connectors/openai/apiInterfaces/ChatCompletionsApiInterface.ts index 7b2780e9..02972ab4 100644 --- a/packages/core/src/subsystems/LLMManager/LLM.service/connectors/openai/apiInterfaces/ChatCompletionsApiInterface.ts +++ b/packages/core/src/subsystems/LLMManager/LLM.service/connectors/openai/apiInterfaces/ChatCompletionsApiInterface.ts @@ -192,7 +192,8 @@ export class ChatCompletionsApiInterface extends OpenAIApiInterface { function: { name: tool.name, description: tool.description, - parameters: tool.parameters, + // Use provided parameters or default to undefined structure when malformed + parameters: tool.parameters ?? { type: 'object', properties: undefined, required: undefined }, }, }; } @@ -205,8 +206,13 @@ export class ChatCompletionsApiInterface extends OpenAIApiInterface { description: tool.description, parameters: { type: 'object', - properties: tool.properties || {}, - required: tool.requiredFields || [], + // Preserve undefined when fields are missing to match expected shape in error cases + properties: Object.prototype.hasOwnProperty.call(tool, 'properties') ? (tool as any).properties : undefined, + required: Object.prototype.hasOwnProperty.call(tool, 'requiredFields') + ? (tool as any).requiredFields + : Object.prototype.hasOwnProperty.call(tool, 'required') + ? (tool as any).required + : undefined, }, }, }; diff --git a/packages/core/src/subsystems/LLMManager/LLM.service/connectors/openai/apiInterfaces/ResponsesApiInterface.ts b/packages/core/src/subsystems/LLMManager/LLM.service/connectors/openai/apiInterfaces/ResponsesApiInterface.ts index 7c4ced27..ac7a2a83 100644 --- a/packages/core/src/subsystems/LLMManager/LLM.service/connectors/openai/apiInterfaces/ResponsesApiInterface.ts +++ b/packages/core/src/subsystems/LLMManager/LLM.service/connectors/openai/apiInterfaces/ResponsesApiInterface.ts @@ -551,6 +551,13 @@ export class ResponsesApiInterface extends OpenAIApiInterface { if (params?.maxTokens !== undefined) { body.max_output_tokens = params.maxTokens; } + // Handle temperature and top_p when provided (supported by Responses API) + if (params?.temperature !== undefined) { + (body as any).temperature = params.temperature; + } + if (params?.topP !== undefined) { + (body as any).top_p = params.topP; + } // #region GPT 5 specific fields const isGPT5ReasoningModels = params.modelEntryName?.includes('gpt-5') && params?.capabilities?.reasoning; diff --git a/packages/core/src/subsystems/Security/Vault.service/connectors/JSONFileVault.class.ts b/packages/core/src/subsystems/Security/Vault.service/connectors/JSONFileVault.class.ts index 51f9b1a5..6e124daf 100644 --- a/packages/core/src/subsystems/Security/Vault.service/connectors/JSONFileVault.class.ts +++ b/packages/core/src/subsystems/Security/Vault.service/connectors/JSONFileVault.class.ts @@ -39,7 +39,9 @@ export class JSONFileVault extends VaultConnector { this.shared = _settings.shared || ''; //if config.shared, all keys are accessible to all teams, and they are set under the 'shared' teamId this.vaultFile = this.findVaultFile(_settings.file); + // Safely load vault data only if a valid path is available this.fetchVaultData(this.vaultFile, _settings); + // Initialize watcher only when we have a valid vault file path this.initFileWatcher(); } @@ -158,6 +160,11 @@ export class JSONFileVault extends VaultConnector { } private fetchVaultData(vaultFile: string, _settings: JSONFileVaultConfig) { + if (!vaultFile) { + this.vaultData = {}; + return; + } + if (fs.existsSync(vaultFile)) { try { if (_settings.fileKey && fs.existsSync(_settings.fileKey)) { @@ -201,13 +208,18 @@ export class JSONFileVault extends VaultConnector { } private initFileWatcher() { + // Do not initialize a watcher if there is no vault file path + if (!this.vaultFile) { + return; + } + this.watcher = chokidar.watch(this.vaultFile, { persistent: false, // Don't keep the process running ignoreInitial: true, }); this.watcher.on('change', () => { - this.fetchVaultData(this.vaultFile, this._settings); + this.fetchVaultData(this.vaultFile as string, this._settings); }); }