🌐 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:
Danny Avila 2026-08-27 06:50:23 -04:00 committed by GitHub
parent 3d808dc906
commit 8b1fcc0fc2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 287 additions and 34 deletions

View file

@ -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 });