Merge pull request #499 from canada4663/bedrock-anthropic-changes

add bedrock.anthropic support for system prompt using <admin> tag
This commit is contained in:
Krish Dholakia 2023-10-02 06:47:33 -07:00 • committed by GitHub
commit 8381bb19a9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View file

@ -52,6 +52,10 @@ def completion(
prompt += (
f"{AnthropicConstants.HUMAN_PROMPT.value}{message['content']}"
)
elif message["role"] == "system":
prompt += (
f"{AnthropicConstants.HUMAN_PROMPT.value}<admin>{message['content']}</admin>"
)
else:
prompt += (
f"{AnthropicConstants.AI_PROMPT.value}{message['content']}"

View file

@ -40,6 +40,10 @@ def convert_messages_to_prompt(messages, provider):
prompt += (
f"{AnthropicConstants.HUMAN_PROMPT.value}{message['content']}"
)
elif message["role"] == "system":
prompt += (
f"{AnthropicConstants.HUMAN_PROMPT.value}<admin>{message['content']}</admin>"
)
else:
prompt += (
f"{AnthropicConstants.AI_PROMPT.value}{message['content']}"