Fix Gemini functionCall test expectations

This commit is contained in:
Julian von der Goltz 2026-05-20 15:56:12 +02:00
parent 3b45b170fe
commit 9ffa1c136f
3 changed files with 10 additions and 12 deletions

View file

@ -991,9 +991,8 @@ def _gemini_convert_messages_with_history( # noqa: PLR0915
# copy it to parallel function calls missing thoughtSignature.
turn_thought_signature = None
for existing_part in assistant_content:
if (
isinstance(existing_part, dict)
and existing_part.get("thoughtSignature")
if isinstance(existing_part, dict) and existing_part.get(
"thoughtSignature"
):
turn_thought_signature = existing_part.get(
"thoughtSignature"

View file

@ -563,7 +563,9 @@ def test_parallel_tool_calls_copy_thought_signature_from_thinking_block():
assert len(contents) == 1
model_parts = contents[0]["parts"]
function_parts = [
p for p in model_parts if p.get("functionCall") is not None or p.get("function_call") is not None
p
for p in model_parts
if p.get("functionCall") is not None or p.get("function_call") is not None
]
assert len(function_parts) == 2
assert all(p.get("thoughtSignature") == "sig-turn-123" for p in function_parts)
@ -613,9 +615,7 @@ def test_parallel_tool_calls_copy_thought_signature_from_text_thinking_block():
if p.get("functionCall") is not None or p.get("function_call") is not None
]
assert len(function_parts) == 2
assert all(
p.get("thoughtSignature") == "sig-text-thinking" for p in function_parts
)
assert all(p.get("thoughtSignature") == "sig-text-thinking" for p in function_parts)
def test_thought_signature_with_function_call_mode():

View file

@ -393,8 +393,8 @@ def test_multiple_function_call():
"role": "model",
"parts": [
{"text": "test"},
{"function_call": {"name": "test", "args": {"arg": "test"}}},
{"function_call": {"name": "test2", "args": {"arg": "test2"}}},
{"functionCall": {"name": "test", "args": {"arg": "test"}}},
{"functionCall": {"name": "test2", "args": {"arg": "test2"}}},
],
},
{
@ -502,8 +502,8 @@ def test_multiple_function_call_changed_text_pos():
"role": "model",
"parts": [
{"text": "test"},
{"function_call": {"name": "test", "args": {"arg": "test"}}},
{"function_call": {"name": "test2", "args": {"arg": "test2"}}},
{"functionCall": {"name": "test", "args": {"arg": "test"}}},
{"functionCall": {"name": "test2", "args": {"arg": "test2"}}},
],
},
{
@ -1282,7 +1282,6 @@ def test_process_gemini_media():
assert base64_result["inline_data"]["data"] == "/9j/4AAQSkZJRg..."
def test_get_image_mime_type_from_url():
"""Test the _get_image_mime_type_from_url function for different image URLs"""
from litellm.llms.vertex_ai.gemini.transformation import (