From 2896df26455ed5f280dbad643ce88f0064f15b4a Mon Sep 17 00:00:00 2001 From: canada4663 <3118399+canada4663@users.noreply.github.com> Date: Sun, 1 Oct 2023 20:54:36 -0700 Subject: [PATCH] added similar changes to anthropic.py based on recommendation from @krrishdholakia --- litellm/llms/anthropic.py | 4 ++++ litellm/llms/bedrock.py | 1 - 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/litellm/llms/anthropic.py b/litellm/llms/anthropic.py index 89793d4cd1..a5e50a654e 100644 --- a/litellm/llms/anthropic.py +++ b/litellm/llms/anthropic.py @@ -52,6 +52,10 @@ def completion( prompt += ( f"{AnthropicConstants.HUMAN_PROMPT.value}{message['content']}" ) + elif message["role"] == "system": + prompt += ( + f"{AnthropicConstants.HUMAN_PROMPT.value}{message['content']}" + ) else: prompt += ( f"{AnthropicConstants.AI_PROMPT.value}{message['content']}" diff --git a/litellm/llms/bedrock.py b/litellm/llms/bedrock.py index 3af434fc7b..82ba2e55a0 100644 --- a/litellm/llms/bedrock.py +++ b/litellm/llms/bedrock.py @@ -44,7 +44,6 @@ def convert_messages_to_prompt(messages, provider): prompt += ( f"{AnthropicConstants.HUMAN_PROMPT.value}{message['content']}" ) - else: prompt += ( f"{AnthropicConstants.AI_PROMPT.value}{message['content']}"