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.
This commit is contained in:
Danny Avila 2023-08-15 18:27:54 -04:00 committed by GitHub
parent b85f3bf91e
commit ae5b7d3d53
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -150,6 +150,7 @@ Only respond with your conversational reply to the following User Message:
} }
createLLM(modelOptions, configOptions) { createLLM(modelOptions, configOptions) {
let azure = {};
let credentials = { openAIApiKey: this.openAIApiKey }; let credentials = { openAIApiKey: this.openAIApiKey };
let configuration = { let configuration = {
apiKey: this.openAIApiKey, apiKey: this.openAIApiKey,
@ -158,6 +159,7 @@ Only respond with your conversational reply to the following User Message:
if (this.azure) { if (this.azure) {
credentials = {}; credentials = {};
configuration = {}; configuration = {};
({ azure } = this);
} }
if (this.options.debug) { if (this.options.debug) {
@ -165,7 +167,7 @@ Only respond with your conversational reply to the following User Message:
console.debug(configOptions); 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 }) { async initialize({ user, message, onAgentAction, onChainEnd, signal }) {