From ae5b7d3d53a39764c301ad24bf1b7bad216ab97b Mon Sep 17 00:00:00 2001 From: Danny Avila <110412045+danny-avila@users.noreply.github.com> Date: Tue, 15 Aug 2023 18:27:54 -0400 Subject: [PATCH] fix(PluginsClient.js): fix ChatOpenAI Azure Config Issue (#812) * fix(PluginsClient.js): fix issue with creating LLM when using Azure * chore(PluginsClient.js): omit azure logging * refactor(PluginsClient.js): simplify assignment of azure variable The code was simplified by directly assigning the value of `this.azure` to the `azure` variable using object destructuring. This makes the code cleaner and more concise. --- api/app/clients/PluginsClient.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/api/app/clients/PluginsClient.js b/api/app/clients/PluginsClient.js index 680fbfea0d..d29f03517a 100644 --- a/api/app/clients/PluginsClient.js +++ b/api/app/clients/PluginsClient.js @@ -150,6 +150,7 @@ Only respond with your conversational reply to the following User Message: } createLLM(modelOptions, configOptions) { + let azure = {}; let credentials = { openAIApiKey: this.openAIApiKey }; let configuration = { apiKey: this.openAIApiKey, @@ -158,6 +159,7 @@ Only respond with your conversational reply to the following User Message: if (this.azure) { credentials = {}; configuration = {}; + ({ azure } = this); } if (this.options.debug) { @@ -165,7 +167,7 @@ Only respond with your conversational reply to the following User Message: console.debug(configOptions); } - return new ChatOpenAI({ credentials, configuration, ...modelOptions }, configOptions); + return new ChatOpenAI({ credentials, configuration, ...azure, ...modelOptions }, configOptions); } async initialize({ user, message, onAgentAction, onChainEnd, signal }) {