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:
Danny Avila 2023-11-04 15:03:31 -04:00 committed by GitHub
parent a7b5639da1
commit 0886441461
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 562 additions and 38 deletions

View file

@ -16,6 +16,7 @@ const fetchOpenAIModels = async (opts = { azure: false, plugins: false }, _model
let models = _models.slice() ?? [];
let apiKey = openAIApiKey;
let basePath = 'https://api.openai.com/v1';
let reverseProxyUrl = OPENAI_REVERSE_PROXY;
if (opts.azure) {
return models;
// const azure = getAzureCredentials();
@ -23,11 +24,7 @@ const fetchOpenAIModels = async (opts = { azure: false, plugins: false }, _model
// .split('/deployments')[0]
// .concat(`/models?api-version=${azure.azureOpenAIApiVersion}`);
// apiKey = azureOpenAIApiKey;
}
let reverseProxyUrl = OPENAI_REVERSE_PROXY;
if (OPENROUTER_API_KEY) {
} else if (OPENROUTER_API_KEY) {
reverseProxyUrl = 'https://openrouter.ai/api/v1';
apiKey = OPENROUTER_API_KEY;
}