mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 17:00:15 +01:00
🔑 fix: Azure Serverless Support for API Key Header & Version (#4791)
* fix: azure validation/extraction types * fix: typing, add optional chaining for modelGroup and groupMap properties; expect azureOpenAIApiVersion in serverless tests * fix: add support for azureOpenAIApiVersion and api-key in serverless mode across clients * chore: update CONFIG_VERSION to 1.1.8, data-provider bump
This commit is contained in:
parent
07511b3db8
commit
e0a5f879b6
11 changed files with 100 additions and 42 deletions
|
|
@ -94,8 +94,8 @@ describe('validateAzureGroups', () => {
|
|||
expect(isValid).toBe(true);
|
||||
const modelGroup = modelGroupMap['gpt-5-turbo'];
|
||||
expect(modelGroup).toBeDefined();
|
||||
expect(modelGroup.group).toBe('japan-east');
|
||||
expect(groupMap[modelGroup.group]).toBeDefined();
|
||||
expect(modelGroup?.group).toBe('japan-east');
|
||||
expect(groupMap[modelGroup?.group ?? '']).toBeDefined();
|
||||
expect(modelNames).toContain('gpt-5-turbo');
|
||||
const { azureOptions } = mapModelToAzureConfig({
|
||||
modelName: 'gpt-5-turbo',
|
||||
|
|
@ -323,6 +323,7 @@ describe('validateAzureGroups for Serverless Configurations', () => {
|
|||
|
||||
expect(azureOptions).toEqual({
|
||||
azureOpenAIApiKey: 'def456',
|
||||
azureOpenAIApiVersion: '',
|
||||
});
|
||||
expect(baseURL).toEqual('https://new-serverless.example.com/v1/completions');
|
||||
expect(serverless).toBe(true);
|
||||
|
|
@ -381,10 +382,10 @@ describe('validateAzureGroups with modelGroupMap and groupMap', () => {
|
|||
const { isValid, modelGroupMap, groupMap } = validateAzureGroups(validConfigs);
|
||||
expect(isValid).toBe(true);
|
||||
expect(modelGroupMap['gpt-4-turbo']).toBeDefined();
|
||||
expect(modelGroupMap['gpt-4-turbo'].group).toBe('us-east');
|
||||
expect(modelGroupMap['gpt-4-turbo']?.group).toBe('us-east');
|
||||
expect(groupMap['us-east']).toBeDefined();
|
||||
expect(groupMap['us-east'].apiKey).toBe('prod-1234');
|
||||
expect(groupMap['us-east'].models['gpt-4-turbo']).toBeDefined();
|
||||
expect(groupMap['us-east']?.apiKey).toBe('prod-1234');
|
||||
expect(groupMap['us-east']?.models['gpt-4-turbo']).toBeDefined();
|
||||
const { azureOptions, baseURL, headers } = mapModelToAzureConfig({
|
||||
modelName: 'gpt-4-turbo',
|
||||
modelGroupMap,
|
||||
|
|
@ -765,6 +766,7 @@ describe('validateAzureGroups with modelGroupMap and groupMap', () => {
|
|||
);
|
||||
expect(azureOptions7).toEqual({
|
||||
azureOpenAIApiKey: 'mistral-key',
|
||||
azureOpenAIApiVersion: '',
|
||||
});
|
||||
|
||||
const {
|
||||
|
|
@ -782,6 +784,7 @@ describe('validateAzureGroups with modelGroupMap and groupMap', () => {
|
|||
);
|
||||
expect(azureOptions8).toEqual({
|
||||
azureOpenAIApiKey: 'llama-key',
|
||||
azureOpenAIApiVersion: '',
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue