From 8df4ef20786ec3d1f416038d103ff1e07ba142ce Mon Sep 17 00:00:00 2001 From: Anish Gurjar <50738829+anishgurjar@users.noreply.github.com> Date: Thu, 22 Oct 2026 06:30:17 -0400 Subject: [PATCH] test(gemini): add inline-data parts helper to media shape tests --- .../test_factory_gemini_tool_media.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/unit/litellm_core_utils/prompt_templates/test_factory_gemini_tool_media.py b/tests/unit/litellm_core_utils/prompt_templates/test_factory_gemini_tool_media.py index 5a52e74e690..a505f833695 100644 --- a/tests/unit/litellm_core_utils/prompt_templates/test_factory_gemini_tool_media.py +++ b/tests/unit/litellm_core_utils/prompt_templates/test_factory_gemini_tool_media.py @@ -191,5 +191,14 @@ def test_gemini_convert_messages_sibling_file_block_for_pre_gemini_3(): ) new_fr = next(p["function_response"] for p in new_parts if "function_response" in p) nested = new_fr.get("parts") or [] - assert any(p.get("inline_data", {}).get("mime_type") == "application/pdf" for p in nested) + assert any(p.get("inline_data", {}).get("mime_type") == "application/pdf" for p in nested] + +def _get_gemini_function_response_inline_data_parts(result): + assert isinstance(result, list), "expected Gemini parts list" + assert len(result) == 1, "multimodal function responses should stay in one part" + function_response_part = result[0] + assert "inline_data" not in function_response_part, "inline_data should be nested under function_response.parts" + function_response = function_response_part["function_response"] + nested_parts = function_response["parts"] + return [part["inline_data"] for part in nested_parts if "inline_data" in part]