Merge pull request #21051 from BerriAI/revert-20569-fix/20557-gemini-multiturn-tool-calling

Revert "Fix #20557: Fix Gemini multi-turn tool calling message formatting"
This commit is contained in:
Sameer Kankute 2026-02-12 21:17:04 +05:30 • committed by GitHub
commit 5471b14c56
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -500,7 +500,7 @@ def _gemini_convert_messages_with_history( # noqa: PLR0915
messages[msg_i]["role"] not in tool_call_message_roles
):
if len(tool_call_responses) > 0:
contents.append(ContentType(role="user", parts=tool_call_responses))
contents.append(ContentType(parts=tool_call_responses))
tool_call_responses = []
if msg_i == init_msg_i: # prevent infinite loops
@ -510,7 +510,7 @@ def _gemini_convert_messages_with_history( # noqa: PLR0915
)
)
if len(tool_call_responses) > 0:
contents.append(ContentType(role="user", parts=tool_call_responses))
contents.append(ContentType(parts=tool_call_responses))
if len(contents) == 0:
verbose_logger.warning(