- Newest
- Most votes
- Most comments
Hi, the short answer:
For Claude 2.1, which is using the Text Completion API, you have to add "System: Your system prompt" in front of "\n\nHuman", like in this example:
system_prompt = "All your output must be pirate speech 🦜" user_prompt = "Tell me a story." prompt = "System:" + system_prompt + "\n\nHuman: " + user_prompt + "\n\nAssistant:"
For Claude 3, which uses the new Messages API, you can add a system parameter to the request body, like in this example:
{ "system": "All your output must be pirate speech 🦜", "anthropic_version": "bedrock-2023-05-31", "max_tokens": 1024, "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Tell me a story." } ] } ] }
For fully functional code examples, check out my blog post on the topic: Use System Prompts with Anthropic Claude on Amazon Bedrock
Thank you for your question. It is supported as Amazon Bedrock is simply an access point for using various FMs. Taking a look at the Anthropic documentation and without looking at your code in depth it seems that maybe there is a formatting issue in your prompt. There is still a need for a human prompt to be part of the request.
Relevant content
- Accepted Answerasked 6 months ago
- AWS OFFICIALUpdated a month ago
- AWS OFFICIALUpdated 8 days ago
- AWS OFFICIALUpdated a month ago
- AWS OFFICIALUpdated 3 months ago