mirror of
https://github.com/voideditor/void
synced 2026-05-23 01:18:25 +00:00
Merge pull request #595 from zpg6/fix/azure-model-selection
fix: select AzureOpenAI deployment based on selected model
This commit is contained in:
commit
a8bc42b524
1 changed files with 8 additions and 1 deletions
|
|
@ -116,7 +116,10 @@ const newOpenAICompatibleSDK = async ({ settingsOfProvider, providerName, includ
|
|||
// https://learn.microsoft.com/en-us/rest/api/aifoundry/model-inference/get-chat-completions/get-chat-completions?view=rest-aifoundry-model-inference-2024-05-01-preview&tabs=HTTP
|
||||
// https://github.com/openai/openai-node?tab=readme-ov-file#microsoft-azure-openai
|
||||
const thisConfig = settingsOfProvider[providerName]
|
||||
return new AzureOpenAI({ apiKey: thisConfig.apiKey, apiVersion: thisConfig.azureApiVersion, project: thisConfig.project, ...commonPayloadOpts })
|
||||
const endpoint = `https://${thisConfig.project}.openai.azure.com/`;
|
||||
const apiVersion = thisConfig.azureApiVersion ?? '2024-04-01-preview';
|
||||
const options = { endpoint, apiKey: thisConfig.apiKey, apiVersion };
|
||||
return new AzureOpenAI({ ...options, ...commonPayloadOpts });
|
||||
}
|
||||
|
||||
else if (providerName === 'deepseek') {
|
||||
|
|
@ -263,6 +266,10 @@ const _sendOpenAICompatibleChat = async ({ messages, onText, onFinalMessage, onE
|
|||
|
||||
// instance
|
||||
const openai: OpenAI = await newOpenAICompatibleSDK({ providerName, settingsOfProvider, includeInPayload })
|
||||
if (providerName === 'microsoftAzure') {
|
||||
// Required to select the model
|
||||
(openai as AzureOpenAI).deploymentName = modelName;
|
||||
}
|
||||
const options: OpenAI.Chat.Completions.ChatCompletionCreateParamsStreaming = {
|
||||
model: modelName,
|
||||
messages: messages as any,
|
||||
|
|
|
|||
Loading…
Reference in a new issue