test fix: gcp deprecated gemini-1.5-flash
This commit is contained in:
parent
596592599a
commit
eeed03a78f
@ -58,10 +58,10 @@ VERTEX_MODELS_TO_NOT_TEST = [
|
||||
"gemini-1.5-pro-preview-0215",
|
||||
"gemini-pro-experimental",
|
||||
"gemini-flash-experimental",
|
||||
"gemini-1.5-flash-exp-0827",
|
||||
"gemini-2.5-flash-lite-exp-0827",
|
||||
"gemini-2.0-pro-exp-02-05",
|
||||
"gemini-pro-flash",
|
||||
"gemini-1.5-flash-exp-0827",
|
||||
"gemini-2.5-flash-lite-exp-0827",
|
||||
"gemini-2.0-flash-exp",
|
||||
"gemini-2.0-flash-thinking-exp",
|
||||
"gemini-2.0-flash-thinking-exp-01-21",
|
||||
@ -149,7 +149,7 @@ async def test_get_response():
|
||||
prompt = '\ndef count_nums(arr):\n """\n Write a function count_nums which takes an array of integers and returns\n the number of elements which has a sum of digits > 0.\n If a number is negative, then its first signed digit will be negative:\n e.g. -123 has signed digits -1, 2, and 3.\n >>> count_nums([]) == 0\n >>> count_nums([-1, 11, -11]) == 1\n >>> count_nums([1, 1, 2]) == 3\n """\n'
|
||||
try:
|
||||
response = await acompletion(
|
||||
model="gemini-1.5-flash",
|
||||
model="gemini-2.5-flash-lite",
|
||||
messages=[
|
||||
{
|
||||
"role": "system",
|
||||
@ -518,7 +518,7 @@ async def test_gemini_pro_vision(provider, sync_mode):
|
||||
litellm.num_retries = 3
|
||||
if sync_mode:
|
||||
resp = litellm.completion(
|
||||
model="{}/gemini-1.5-flash-preview-0514".format(provider),
|
||||
model="{}/gemini-2.5-flash-lite-preview-0514".format(provider),
|
||||
messages=[
|
||||
{"role": "system", "content": "Be a good bot"},
|
||||
{
|
||||
@ -537,7 +537,7 @@ async def test_gemini_pro_vision(provider, sync_mode):
|
||||
)
|
||||
else:
|
||||
resp = await litellm.acompletion(
|
||||
model="{}/gemini-1.5-flash-preview-0514".format(provider),
|
||||
model="{}/gemini-2.5-flash-lite-preview-0514".format(provider),
|
||||
messages=[
|
||||
{"role": "system", "content": "Be a good bot"},
|
||||
{
|
||||
@ -605,7 +605,7 @@ def test_completion_function_plus_pdf(load_pdf):
|
||||
image_message = {"role": "user", "content": image_content}
|
||||
|
||||
response = completion(
|
||||
model="vertex_ai_beta/gemini-1.5-flash-preview-0514",
|
||||
model="vertex_ai_beta/gemini-2.5-flash-lite-preview-0514",
|
||||
messages=[image_message],
|
||||
stream=False,
|
||||
)
|
||||
@ -1194,7 +1194,7 @@ Using this JSON schema:
|
||||
|
||||
with patch.object(client, "post", side_effect=_side_effect) as mock_call:
|
||||
response = completion(
|
||||
model="vertex_ai_beta/gemini-1.5-flash",
|
||||
model="vertex_ai_beta/gemini-2.5-flash-lite",
|
||||
messages=messages,
|
||||
response_format={"type": "json_object"},
|
||||
client=client,
|
||||
@ -1383,7 +1383,7 @@ def vertex_httpx_mock_post_invalid_schema_response_anthropic(*args, **kwargs):
|
||||
[
|
||||
("vertex_ai_beta/gemini-1.5-pro-001", "us-central1", True),
|
||||
("gemini/gemini-1.5-pro", None, True),
|
||||
("vertex_ai_beta/gemini-1.5-flash", "us-central1", True),
|
||||
("vertex_ai_beta/gemini-2.5-flash-lite", "us-central1", True),
|
||||
("vertex_ai/claude-3-5-sonnet@20240620", "us-east5", False),
|
||||
],
|
||||
)
|
||||
@ -1572,7 +1572,7 @@ async def test_anthropic_message_via_anthropic_messages():
|
||||
[
|
||||
("vertex_ai_beta/gemini-1.5-pro-001", "us-central1", True),
|
||||
("gemini/gemini-1.5-pro", None, True),
|
||||
("vertex_ai_beta/gemini-1.5-flash", "us-central1", True),
|
||||
("vertex_ai_beta/gemini-2.5-flash-lite", "us-central1", True),
|
||||
("vertex_ai/claude-3-5-sonnet@20240620", "us-east5", False),
|
||||
],
|
||||
)
|
||||
@ -1680,7 +1680,7 @@ async def test_gemini_pro_json_schema_args_sent_httpx_openai_schema(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"model", ["gemini-1.5-flash", "claude-3-5-sonnet@20240620"]
|
||||
"model", ["gemini-2.5-flash-lite", "claude-3-5-sonnet@20240620"]
|
||||
) # "vertex_ai",
|
||||
@pytest.mark.asyncio
|
||||
async def test_gemini_pro_httpx_custom_api_base(model):
|
||||
@ -1820,7 +1820,7 @@ async def test_gemini_pro_function_calling_streaming(sync_mode):
|
||||
load_vertex_ai_credentials()
|
||||
litellm.set_verbose = True
|
||||
data = {
|
||||
"model": "vertex_ai/gemini-1.5-flash",
|
||||
"model": "vertex_ai/gemini-2.5-flash-lite",
|
||||
"messages": [
|
||||
{
|
||||
"role": "user",
|
||||
@ -2541,7 +2541,7 @@ def mock_gemini_request(*args, **kwargs):
|
||||
if "cachedContents" in kwargs["url"]:
|
||||
mock_response.json.return_value = {
|
||||
"name": "cachedContents/4d2kd477o3pg",
|
||||
"model": "models/gemini-1.5-flash-001",
|
||||
"model": "models/gemini-2.5-flash-lite-001",
|
||||
"createTime": "2024-08-26T22:31:16.147190Z",
|
||||
"updateTime": "2024-08-26T22:31:16.147190Z",
|
||||
"expireTime": "2024-08-26T22:36:15.548934784Z",
|
||||
@ -2671,7 +2671,7 @@ async def test_gemini_context_caching_anthropic_format(sync_mode):
|
||||
try:
|
||||
if sync_mode:
|
||||
response = litellm.completion(
|
||||
model="gemini/gemini-1.5-flash-001",
|
||||
model="gemini/gemini-2.5-flash-lite-001",
|
||||
messages=gemini_context_caching_messages,
|
||||
temperature=0.2,
|
||||
max_tokens=10,
|
||||
@ -2679,7 +2679,7 @@ async def test_gemini_context_caching_anthropic_format(sync_mode):
|
||||
)
|
||||
else:
|
||||
response = await litellm.acompletion(
|
||||
model="gemini/gemini-1.5-flash-001",
|
||||
model="gemini/gemini-2.5-flash-lite-001",
|
||||
messages=gemini_context_caching_messages,
|
||||
temperature=0.2,
|
||||
max_tokens=10,
|
||||
|
||||
@ -72,7 +72,7 @@ def test_batch_completions_models():
|
||||
def test_batch_completion_models_all_responses():
|
||||
try:
|
||||
responses = batch_completion_models_all_responses(
|
||||
models=["gemini/gemini-1.5-flash", "claude-3-haiku-20240307"],
|
||||
models=["gemini/gemini-2.5-flash-lite", "claude-3-haiku-20240307"],
|
||||
messages=[{"role": "user", "content": "write a poem"}],
|
||||
max_tokens=10,
|
||||
)
|
||||
|
||||
@ -3696,7 +3696,7 @@ def test_completion_volcengine():
|
||||
[
|
||||
# "gemini-1.0-pro",
|
||||
"gemini-1.5-pro",
|
||||
# "gemini-1.5-flash",
|
||||
# "gemini-2.5-flash-lite",
|
||||
],
|
||||
)
|
||||
@pytest.mark.flaky(retries=3, delay=1)
|
||||
@ -3750,7 +3750,7 @@ def test_completion_gemini(model):
|
||||
@pytest.mark.asyncio
|
||||
async def test_acompletion_gemini():
|
||||
litellm.set_verbose = True
|
||||
model_name = "gemini/gemini-1.5-flash"
|
||||
model_name = "gemini/gemini-2.5-flash-lite"
|
||||
messages = [{"role": "user", "content": "Hey, how's it going?"}]
|
||||
try:
|
||||
response = await litellm.acompletion(model=model_name, messages=messages)
|
||||
|
||||
@ -2133,7 +2133,7 @@ def test_router_correctly_reraise_error():
|
||||
"""
|
||||
User feedback: There is a problem with my messages array, but the error exception thrown is a Rate Limit error.
|
||||
```
|
||||
Rate Limit: Error code: 429 - {'error': {'message': 'No deployments available for selected model, Try again in 60 seconds. Passed model=gemini-1.5-flash..
|
||||
Rate Limit: Error code: 429 - {'error': {'message': 'No deployments available for selected model, Try again in 60 seconds. Passed model=gemini-2.5-flash-lite..
|
||||
```
|
||||
What they want? Propagation of the real error.
|
||||
"""
|
||||
|
||||
@ -198,7 +198,7 @@ def test_stream_chunk_builder_litellm_usage_chunks():
|
||||
# make a streaming gemini call
|
||||
try:
|
||||
response = completion(
|
||||
model="gemini/gemini-1.5-flash",
|
||||
model="gemini/gemini-2.5-flash-lite",
|
||||
messages=messages,
|
||||
stream=True,
|
||||
complete_response=True,
|
||||
|
||||
@ -709,7 +709,7 @@ async def test_completion_gemini_stream(sync_mode):
|
||||
chunks = []
|
||||
if sync_mode:
|
||||
response = completion(
|
||||
model="gemini/gemini-1.5-flash",
|
||||
model="gemini/gemini-2.5-flash-lite",
|
||||
messages=messages,
|
||||
stream=True,
|
||||
functions=function1,
|
||||
@ -726,7 +726,7 @@ async def test_completion_gemini_stream(sync_mode):
|
||||
complete_response += chunk
|
||||
else:
|
||||
response = await litellm.acompletion(
|
||||
model="gemini/gemini-1.5-flash",
|
||||
model="gemini/gemini-2.5-flash-lite",
|
||||
messages=messages,
|
||||
stream=True,
|
||||
functions=function1,
|
||||
@ -829,7 +829,7 @@ async def test_completion_gemini_stream_accumulated_json(sync_mode):
|
||||
client, "post", side_effect=gemini_mock_post_streaming
|
||||
) as mock_client:
|
||||
response = completion(
|
||||
model="gemini/gemini-1.5-flash",
|
||||
model="gemini/gemini-2.5-flash-lite",
|
||||
messages=messages,
|
||||
stream=True,
|
||||
functions=function1,
|
||||
@ -854,7 +854,7 @@ async def test_completion_gemini_stream_accumulated_json(sync_mode):
|
||||
client, "post", side_effect=gemini_mock_post_streaming
|
||||
) as mock_client:
|
||||
response = await litellm.acompletion(
|
||||
model="gemini/gemini-1.5-flash",
|
||||
model="gemini/gemini-2.5-flash-lite",
|
||||
messages=messages,
|
||||
stream=True,
|
||||
functions=function1,
|
||||
@ -2982,7 +2982,7 @@ def test_completion_claude_3_function_call_with_streaming():
|
||||
@pytest.mark.parametrize(
|
||||
"model",
|
||||
[
|
||||
"gemini/gemini-1.5-flash",
|
||||
"gemini/gemini-2.5-flash-lite",
|
||||
], # "claude-3-opus-20240229"
|
||||
) #
|
||||
@pytest.mark.asyncio
|
||||
@ -3669,7 +3669,7 @@ def test_unit_test_custom_stream_wrapper_function_call():
|
||||
)
|
||||
],
|
||||
created=1720755257,
|
||||
model="gemini-1.5-flash",
|
||||
model="gemini-2.5-flash-lite",
|
||||
object="chat.completion.chunk",
|
||||
system_fingerprint=None,
|
||||
usage=Usage(prompt_tokens=67, completion_tokens=55, total_tokens=122),
|
||||
|
||||
@ -4152,7 +4152,7 @@ def test_completion_vllm(provider):
|
||||
client.completions.with_raw_response, "create", side_effect=mock_post
|
||||
) as mock_call:
|
||||
response = text_completion(
|
||||
model="{provider}/gemini-1.5-flash".format(provider=provider),
|
||||
model="{provider}/gemini-2.5-flash-lite".format(provider=provider),
|
||||
prompt="ping",
|
||||
client=client,
|
||||
hello="world",
|
||||
|
||||
@ -15,7 +15,7 @@ class TestGoogleGenAIStudio(BaseGoogleGenAITest):
|
||||
@property
|
||||
def model_config(self):
|
||||
return {
|
||||
"model": "gemini/gemini-1.5-flash",
|
||||
"model": "gemini/gemini-2.5-flash-lite",
|
||||
}
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@ -86,7 +86,7 @@ async def test_mock_stream_generate_content_with_tools():
|
||||
|
||||
print("\n--- Testing async agenerate_content_stream with function call parsing ---")
|
||||
response = await litellm.google_genai.agenerate_content_stream(
|
||||
model="gemini/gemini-1.5-flash",
|
||||
model="gemini/gemini-2.5-flash-lite",
|
||||
contents=contents,
|
||||
tools=[
|
||||
{
|
||||
@ -299,7 +299,7 @@ async def test_validate_post_request_parameters():
|
||||
|
||||
# Make the API call
|
||||
response = await litellm.google_genai.agenerate_content_stream(
|
||||
model="gemini/gemini-1.5-flash",
|
||||
model="gemini/gemini-2.5-flash-lite",
|
||||
contents=contents,
|
||||
tools=tools
|
||||
)
|
||||
@ -341,9 +341,9 @@ async def test_validate_post_request_parameters():
|
||||
|
||||
# Validate model field
|
||||
assert "model" in request_data, "Expected 'model' field in request data"
|
||||
# Model might be transformed, but should contain gemini-1.5-flash
|
||||
# Model might be transformed, but should contain gemini-2.5-flash-lite
|
||||
model_value = request_data["model"]
|
||||
assert "gemini-1.5-flash" in model_value, f"Expected model to contain 'gemini-1.5-flash', got: {model_value}"
|
||||
assert "gemini-2.5-flash-lite" in model_value, f"Expected model to contain 'gemini-2.5-flash-lite', got: {model_value}"
|
||||
print(f"✅ Model validation passed: {model_value}")
|
||||
|
||||
# Validate contents field
|
||||
|
||||
@ -6,5 +6,5 @@ class TestVertexAIGenerateContent(BaseGoogleGenAITest):
|
||||
@property
|
||||
def model_config(self):
|
||||
return {
|
||||
"model": "vertex_ai/gemini-1.5-flash",
|
||||
"model": "vertex_ai/gemini-2.5-flash-lite",
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user