test(pass-through): move Gemini pass-through tests to gemini-3.1-flash-lite (#29595)
* test(pass-through): move Gemini pass-through tests to gemini-3.1-flash-lite gemini-2.5-flash-lite is a generation behind and is slated for discontinuation on Vertex AI no earlier than October 16, 2026, so the pass-through suite was exercising an aging model. Every reference now points at gemini-3.1-flash-lite, which is GA and already priced in the cost map so the spend-logging assertions still compute a real cost test_vertex.test.js also gains jest.retryTimes(3) to match the sibling spend tests. The CI failures were intermittent 429 RESOURCE_EXHAUSTED from Vertex quota pressure, and that file was the only one without a retry, so a single rate-limited request was failing the whole job * test(pass-through): point Vertex tests at the global endpoint for gemini-3.1-flash-lite gemini-3.1-flash-lite is not served on the Vertex us-central1 regional endpoint for the CI project, so the Vertex pass-through tests were returning a deterministic 404 "Publisher Model ... was not found or your project does not have access to it" while the Gemini API tests passed. Move the Vertex clients to the global location, which the pass-through router maps to aiplatform.googleapis.com, where the 3.1 family is served
This commit is contained in:
parent
b11833c737
commit
f3e2167730
@ -32,7 +32,7 @@ describe('Gemini AI Tests', () => {
|
||||
};
|
||||
|
||||
const model = genAI.getGenerativeModel({
|
||||
model: 'gemini-2.5-flash-lite'
|
||||
model: 'gemini-3.1-flash-lite'
|
||||
}, requestOptions);
|
||||
|
||||
const prompt = 'Say "hello test" and nothing else';
|
||||
@ -83,7 +83,7 @@ describe('Gemini AI Tests', () => {
|
||||
};
|
||||
|
||||
const model = genAI.getGenerativeModel({
|
||||
model: 'gemini-2.5-flash-lite'
|
||||
model: 'gemini-3.1-flash-lite'
|
||||
}, requestOptions);
|
||||
|
||||
const prompt = 'Say "hello test" and nothing else';
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
const { GoogleGenerativeAI, ModelParams, RequestOptions } = require("@google/generative-ai");
|
||||
|
||||
const modelParams = {
|
||||
model: 'gemini-2.5-flash-lite',
|
||||
model: 'gemini-3.1-flash-lite',
|
||||
};
|
||||
|
||||
const requestOptions = {
|
||||
baseUrl: 'http://127.0.0.1:4000/gemini',
|
||||
customHeaders: {
|
||||
"tags": "gemini-js-sdk,gemini-2.5-flash-lite"
|
||||
"tags": "gemini-js-sdk,gemini-3.1-flash-lite"
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -4,7 +4,7 @@ const { VertexAI, RequestOptions } = require('@google-cloud/vertexai');
|
||||
|
||||
const vertexAI = new VertexAI({
|
||||
project: 'litellm-ci-cd',
|
||||
location: 'us-central1',
|
||||
location: 'global',
|
||||
apiEndpoint: "127.0.0.1:4000/vertex-ai"
|
||||
});
|
||||
|
||||
@ -20,7 +20,7 @@ const requestOptions = {
|
||||
};
|
||||
|
||||
const generativeModel = vertexAI.getGenerativeModel(
|
||||
{ model: 'gemini-2.5-flash-lite' },
|
||||
{ model: 'gemini-3.1-flash-lite' },
|
||||
requestOptions
|
||||
);
|
||||
|
||||
|
||||
@ -56,6 +56,9 @@ beforeAll(() => {
|
||||
loadVertexAiCredentials();
|
||||
});
|
||||
|
||||
// Configure Jest to retry flaky tests up to 3 times (useful for 429 rate limiting)
|
||||
jest.retryTimes(3);
|
||||
|
||||
// Non-streaming Vertex generateContent can exceed 5s in CI / under load
|
||||
const VERTEX_TEST_TIMEOUT_MS = 30000;
|
||||
|
||||
@ -65,7 +68,7 @@ describe('Vertex AI Tests', () => {
|
||||
async () => {
|
||||
const vertexAI = new VertexAI({
|
||||
project: 'litellm-ci-cd',
|
||||
location: 'us-central1',
|
||||
location: 'global',
|
||||
apiEndpoint: "localhost:4000/vertex-ai"
|
||||
});
|
||||
|
||||
@ -78,7 +81,7 @@ describe('Vertex AI Tests', () => {
|
||||
};
|
||||
|
||||
const generativeModel = vertexAI.getGenerativeModel(
|
||||
{ model: 'gemini-2.5-flash-lite' },
|
||||
{ model: 'gemini-3.1-flash-lite' },
|
||||
requestOptions
|
||||
);
|
||||
|
||||
@ -108,13 +111,13 @@ describe('Vertex AI Tests', () => {
|
||||
async () => {
|
||||
const vertexAI = new VertexAI({
|
||||
project: 'litellm-ci-cd',
|
||||
location: 'us-central1',
|
||||
location: 'global',
|
||||
apiEndpoint: "localhost:4000/vertex-ai"
|
||||
});
|
||||
const customHeaders = new Headers({"x-litellm-api-key": "sk-1234"});
|
||||
const requestOptions = {customHeaders: customHeaders};
|
||||
const generativeModel = vertexAI.getGenerativeModel(
|
||||
{model: 'gemini-2.5-flash-lite'},
|
||||
{model: 'gemini-3.1-flash-lite'},
|
||||
requestOptions
|
||||
);
|
||||
const request = {contents: [{role: 'user', parts: [{text: 'What is 2+2?'}]}]};
|
||||
|
||||
@ -103,12 +103,12 @@ async def test_basic_vertex_ai_pass_through_with_spendlog():
|
||||
|
||||
vertexai.init(
|
||||
project="litellm-ci-cd",
|
||||
location="us-central1",
|
||||
location="global",
|
||||
api_endpoint=f"{LITE_LLM_ENDPOINT}/vertex_ai",
|
||||
api_transport="rest",
|
||||
)
|
||||
|
||||
model = GenerativeModel(model_name="gemini-2.5-flash-lite")
|
||||
model = GenerativeModel(model_name="gemini-3.1-flash-lite")
|
||||
response = model.generate_content("hi")
|
||||
|
||||
print("response", response)
|
||||
@ -143,12 +143,12 @@ async def test_basic_vertex_ai_pass_through_streaming_with_spendlog():
|
||||
|
||||
vertexai.init(
|
||||
project="litellm-ci-cd",
|
||||
location="us-central1",
|
||||
location="global",
|
||||
api_endpoint=f"{LITE_LLM_ENDPOINT}/vertex_ai",
|
||||
api_transport="rest",
|
||||
)
|
||||
|
||||
model = GenerativeModel(model_name="gemini-2.5-flash-lite")
|
||||
model = GenerativeModel(model_name="gemini-3.1-flash-lite")
|
||||
response = model.generate_content("hi", stream=True)
|
||||
|
||||
for chunk in response:
|
||||
@ -182,7 +182,7 @@ async def test_vertex_ai_pass_through_endpoint_context_caching():
|
||||
|
||||
vertexai.init(
|
||||
project="litellm-ci-cd",
|
||||
location="us-central1",
|
||||
location="global",
|
||||
api_endpoint=f"{LITE_LLM_ENDPOINT}/vertex_ai",
|
||||
api_transport="rest",
|
||||
)
|
||||
@ -204,7 +204,7 @@ async def test_vertex_ai_pass_through_endpoint_context_caching():
|
||||
]
|
||||
|
||||
cached_content = caching.CachedContent.create(
|
||||
model_name="gemini-2.5-flash-lite-001",
|
||||
model_name="gemini-3.1-flash-lite",
|
||||
system_instruction=system_instruction,
|
||||
contents=contents,
|
||||
ttl=datetime.timedelta(minutes=60),
|
||||
|
||||
@ -71,7 +71,7 @@ describe('Vertex AI Tests', () => {
|
||||
test('should successfully generate non-streaming content with tags', async () => {
|
||||
const vertexAI = new VertexAI({
|
||||
project: 'litellm-ci-cd',
|
||||
location: 'us-central1',
|
||||
location: 'global',
|
||||
apiEndpoint: "127.0.0.1:4000/vertex_ai"
|
||||
});
|
||||
|
||||
@ -85,7 +85,7 @@ describe('Vertex AI Tests', () => {
|
||||
};
|
||||
|
||||
const generativeModel = vertexAI.getGenerativeModel(
|
||||
{ model: 'gemini-2.5-flash-lite' },
|
||||
{ model: 'gemini-3.1-flash-lite' },
|
||||
requestOptions
|
||||
);
|
||||
|
||||
@ -130,7 +130,7 @@ describe('Vertex AI Tests', () => {
|
||||
test('should successfully generate streaming content with tags', async () => {
|
||||
const vertexAI = new VertexAI({
|
||||
project: 'litellm-ci-cd',
|
||||
location: 'us-central1',
|
||||
location: 'global',
|
||||
apiEndpoint: "127.0.0.1:4000/vertex_ai"
|
||||
});
|
||||
|
||||
@ -144,7 +144,7 @@ describe('Vertex AI Tests', () => {
|
||||
};
|
||||
|
||||
const generativeModel = vertexAI.getGenerativeModel(
|
||||
{ model: 'gemini-2.5-flash-lite' },
|
||||
{ model: 'gemini-3.1-flash-lite' },
|
||||
requestOptions
|
||||
);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user