From 06d1aec49ef6f30601ebf6043b8af8de071d005d Mon Sep 17 00:00:00 2001 From: nkvch Date: Tue, 7 May 2024 13:42:42 +0200 Subject: [PATCH] * fix(factory.py): fix conditional statement for merging messages with previous ones --- litellm/llms/prompt_templates/factory.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/litellm/llms/prompt_templates/factory.py b/litellm/llms/prompt_templates/factory.py index 6e8589d581..bce472ea06 100644 --- a/litellm/llms/prompt_templates/factory.py +++ b/litellm/llms/prompt_templates/factory.py @@ -1019,7 +1019,7 @@ def anthropic_messages_pt(messages: list): merge_with_previous = False else: new_messages.append({"role": "user", "content": user_content}) - else: + elif msg_i > 0: merge_with_previous = True assistant_content = [] @@ -1053,7 +1053,7 @@ def anthropic_messages_pt(messages: list): merge_with_previous = False else: new_messages.append({"role": "assistant", "content": assistant_content}) - else: + elif msg_i > 0: merge_with_previous = True if msg_i == init_msg_i: # prevent infinite loops