From 9a85ffceffa528b561170f804435359fdb02b4ce Mon Sep 17 00:00:00 2001 From: Sameer Kankute Date: Wed, 26 Nov 2025 21:45:50 +0530 Subject: [PATCH] Fix tests related to mediaResolution --- tests/llm_translation/test_prompt_factory.py | 4 ++-- ...test_vertex_and_google_ai_studio_gemini.py | 20 +++++++++---------- .../llms/vertex_ai/test_vertex.py | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/tests/llm_translation/test_prompt_factory.py b/tests/llm_translation/test_prompt_factory.py index 1ed1e327ec2..abd8ae52157 100644 --- a/tests/llm_translation/test_prompt_factory.py +++ b/tests/llm_translation/test_prompt_factory.py @@ -567,7 +567,7 @@ def test_vertex_only_image_user_message(): }, ] - response = _gemini_convert_messages_with_history(messages=messages) + response = _gemini_convert_messages_with_history(messages=messages, model="gemini-1.5-pro") expected_response = [ { @@ -576,7 +576,7 @@ def test_vertex_only_image_user_message(): { "inline_data": { "data": "/9j/2wCEAAgGBgcGBQ", - "mimeType": "image/jpeg", + "mime_type": "image/jpeg", } }, {"text": " "}, diff --git a/tests/test_litellm/llms/vertex_ai/gemini/test_vertex_and_google_ai_studio_gemini.py b/tests/test_litellm/llms/vertex_ai/gemini/test_vertex_and_google_ai_studio_gemini.py index 6bd0fb52f1d..92be385c04f 100644 --- a/tests/test_litellm/llms/vertex_ai/gemini/test_vertex_and_google_ai_studio_gemini.py +++ b/tests/test_litellm/llms/vertex_ai/gemini/test_vertex_and_google_ai_studio_gemini.py @@ -1811,9 +1811,9 @@ def test_media_resolution_from_detail_parameter(): break assert image_part is not None assert "inline_data" in image_part - # The TypedDict uses snake_case internally, but mediaResolution is camelCase in the dict - assert "mediaResolution" in image_part["inline_data"] - assert image_part["inline_data"]["mediaResolution"] == "high" + # The TypedDict uses snake_case internally, and we keep it as snake_case + assert "media_resolution" in image_part["inline_data"] + assert image_part["inline_data"]["media_resolution"] == "high" def test_media_resolution_low_detail(): @@ -1851,7 +1851,7 @@ def test_media_resolution_low_detail(): break assert image_part is not None assert "inline_data" in image_part - assert image_part["inline_data"]["mediaResolution"] == "low" + assert image_part["inline_data"]["media_resolution"] == "low" def test_media_resolution_auto_detail(): @@ -1888,8 +1888,8 @@ def test_media_resolution_auto_detail(): break assert image_part is not None assert "inline_data" in image_part - # mediaResolution should not be set for auto - assert "mediaResolution" not in image_part["inline_data"] or image_part["inline_data"].get("mediaResolution") is None + # media_resolution should not be set for auto + assert "media_resolution" not in image_part["inline_data"] or image_part["inline_data"].get("media_resolution") is None # Test with None messages_none = [ @@ -1915,8 +1915,8 @@ def test_media_resolution_auto_detail(): break assert image_part is not None assert "inline_data" in image_part - # mediaResolution should not be set - assert "mediaResolution" not in image_part["inline_data"] or image_part["inline_data"].get("mediaResolution") is None + # media_resolution should not be set + assert "media_resolution" not in image_part["inline_data"] or image_part["inline_data"].get("media_resolution") is None def test_media_resolution_per_part(): @@ -1966,12 +1966,12 @@ def test_media_resolution_per_part(): # First image should have low resolution (first part is the image) image1_part = contents[0]["parts"][0] assert "inline_data" in image1_part - assert image1_part["inline_data"]["mediaResolution"] == "low" + assert image1_part["inline_data"]["media_resolution"] == "low" # Second image should have high resolution (third part is the second image) image2_part = contents[0]["parts"][2] assert "inline_data" in image2_part - assert image2_part["inline_data"]["mediaResolution"] == "high" + assert image2_part["inline_data"]["media_resolution"] == "high" def test_media_resolution_only_for_gemini_3_models(): diff --git a/tests/test_litellm/llms/vertex_ai/test_vertex.py b/tests/test_litellm/llms/vertex_ai/test_vertex.py index 394cd2978bd..39ed09f81be 100644 --- a/tests/test_litellm/llms/vertex_ai/test_vertex.py +++ b/tests/test_litellm/llms/vertex_ai/test_vertex.py @@ -1241,7 +1241,7 @@ def test_process_gemini_image(): base64_image = "data:image/jpeg;base64,/9j/4AAQSkZJRg..." base64_result = _process_gemini_image(base64_image) print("base64_result", base64_result) - assert base64_result["inline_data"]["mimeType"] == "image/jpeg" + assert base64_result["inline_data"]["mime_type"] == "image/jpeg" assert base64_result["inline_data"]["data"] == "/9j/4AAQSkZJRg..."