mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-18 01:10:14 +01:00
feat(azureOpenAI): Allow Switching Deployment Name by Model Name (#1137)
* feat(azureOpenAI): allow switching deployment name by model name * ci: add unit tests and throw error on no api key provided to avoid API call * fix(gptPlugins/initializeClient): check if azure is enabled; ci: add unit tests for gptPlugins/initializeClient * fix(ci): fix expected error message for partial regex match: unexpected token
This commit is contained in:
parent
a7b5639da1
commit
0886441461
8 changed files with 562 additions and 38 deletions
|
|
@ -1,4 +1,5 @@
|
|||
const { ChatOpenAI } = require('langchain/chat_models/openai');
|
||||
const { sanitizeModelName } = require('../../../utils');
|
||||
|
||||
function createLLM({
|
||||
modelOptions,
|
||||
|
|
@ -13,9 +14,12 @@ function createLLM({
|
|||
apiKey: openAIApiKey,
|
||||
};
|
||||
|
||||
let azureOptions = {};
|
||||
if (azure) {
|
||||
credentials = {};
|
||||
configuration = {};
|
||||
azureOptions = azure;
|
||||
azureOptions.azureOpenAIApiDeploymentName = sanitizeModelName(modelOptions.modelName);
|
||||
}
|
||||
|
||||
// console.debug('createLLM: configOptions');
|
||||
|
|
@ -27,7 +31,7 @@ function createLLM({
|
|||
verbose: true,
|
||||
credentials,
|
||||
configuration,
|
||||
...azure,
|
||||
...azureOptions,
|
||||
...modelOptions,
|
||||
callbacks,
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue