mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-09-21 07:36:25 +00:00
🌐 fix: Expose Gemini Models to Vertex AI Agents (#15234)
* 🌐 fix: Expose Gemini Models to Vertex AI Agents * ♻️ refactor: Resolve Shared Vertex Model Catalogs * fix: Preserve Exact Vertex Model Catalogs * style: Format Agent Model Selection * test: Preserve Native FS in Stable Diffusion Spec
This commit is contained in:
parent
3d808dc906
commit
8b1fcc0fc2
16 changed files with 287 additions and 34 deletions
|
|
@ -1,4 +1,4 @@
|
|||
const { ViolationTypes } = require('librechat-data-provider');
|
||||
const { EModelEndpoint, Providers, ViolationTypes } = require('librechat-data-provider');
|
||||
|
||||
jest.mock('@librechat/api', () => ({
|
||||
handleError: jest.fn(),
|
||||
|
|
@ -159,6 +159,42 @@ describe('validateModel', () => {
|
|||
expect(handleError).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('accepts a Vertex model from the shared Google catalog', async () => {
|
||||
req.body = { model: 'gemini-3.7-flash', endpoint: Providers.VERTEXAI };
|
||||
getEndpointsConfig.mockResolvedValue({ [Providers.VERTEXAI]: { userProvide: false } });
|
||||
getModelsConfig.mockResolvedValue({ [EModelEndpoint.google]: ['gemini-3.7-flash'] });
|
||||
|
||||
await validateModel(req, res, next);
|
||||
|
||||
expect(next).toHaveBeenCalled();
|
||||
expect(handleError).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('accepts a model from an exact Vertex AI catalog', async () => {
|
||||
req.body = { model: 'custom-vertex-model', endpoint: Providers.VERTEXAI };
|
||||
getEndpointsConfig.mockResolvedValue({ [Providers.VERTEXAI]: { userProvide: false } });
|
||||
getModelsConfig.mockResolvedValue({
|
||||
[EModelEndpoint.google]: ['gemini-3.7-flash'],
|
||||
[Providers.VERTEXAI]: ['custom-vertex-model'],
|
||||
});
|
||||
|
||||
await validateModel(req, res, next);
|
||||
|
||||
expect(next).toHaveBeenCalled();
|
||||
expect(handleError).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('rejects a Vertex model absent from the shared Google catalog', async () => {
|
||||
req.body = { model: 'gemini-not-available', endpoint: Providers.VERTEXAI };
|
||||
getEndpointsConfig.mockResolvedValue({ [Providers.VERTEXAI]: { userProvide: false } });
|
||||
getModelsConfig.mockResolvedValue({ [EModelEndpoint.google]: ['gemini-3.7-flash'] });
|
||||
|
||||
await validateModel(req, res, next);
|
||||
|
||||
expect(handleError).toHaveBeenCalledWith(res, { text: 'Illegal model request' });
|
||||
expect(next).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('rejects when endpoint has no models loaded', async () => {
|
||||
getModelsConfig.mockResolvedValue({ openAI: undefined });
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue