From f60c1857687d4de2a49d778e8c98ca612c083fe0 Mon Sep 17 00:00:00 2001 From: Anton Dubovik Date: Fri, 6 Sep 2024 12:47:54 +0200 Subject: [PATCH] fix: [Gemini] preserved custom_content of the 2nd message when 1st is a system (#121) --- .../chat/gemini/prompt/gemini_1_0_pro.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/aidial_adapter_vertexai/chat/gemini/prompt/gemini_1_0_pro.py b/aidial_adapter_vertexai/chat/gemini/prompt/gemini_1_0_pro.py index 5137cd3..3ec0f67 100644 --- a/aidial_adapter_vertexai/chat/gemini/prompt/gemini_1_0_pro.py +++ b/aidial_adapter_vertexai/chat/gemini/prompt/gemini_1_0_pro.py @@ -65,5 +65,7 @@ def accommodate_first_system_message(messages: List[Message]) -> List[Message]: if first_message.content is None or second_message.content is None: return messages - content = first_message.content + "\n" + second_message.content - return [Message(role=Role.USER, content=content)] + messages[2:] + new_message = second_message.copy() + new_message.content = first_message.content + "\n" + second_message.content + + return [new_message] + messages[2:]