Use System Prompts with Anthropic Claude on Amazon Bedrock
System prompts are a great way to predefine how a generative AI model should respond to subsequent user input. In this post you'll learn what they are and how you can use them for your own applications with Anthropic Claude 2.x and 3.
A system prompt is a way to provide context, instructions, and guidelines to Claude before presenting it with a question or task. By using a system prompt, you can set the stage for the conversation, specifying Claude's role, personality, tone, or any other relevant information that will help it better understand and respond to the user's input.
- Pizza Order Processing: Reduce the scope of the model to focus on taking orders based on the pizza service's menu and location.
- Technical Support Troubleshooting: Inform the model about product details, FAQs, and decision trees to help users solve technical issues with a product.
- Code Debugging: Inject information about libraries, frameworks, and programming language versions to identify and suggest fixes for software bugs.
- The text completion API, used by Claude versions 1 and 2.x.
- The messages API introduced by the new Claude version 3.
Note: You can find fully functional code examples at the end of this post.
The young boy wandered into the dark, mysterious forest, hoping to find the rare flower his mother needed to recover from her illness, but instead encountered a wise old owl who offered him cryptic advice about believing in himself.
Yarrr, 'twas a dark 'n stormy night when Blackbeard 'n his scurvy crew set sail on the seven seas, plunderin' merchant ships fer pieces of eight 'n fine silks, before returnin' to Tortuga fer a night of rum-filled debauchery!
Note: You can find fully functional code examples at the end of this post.
"system"
parameter to the request object like this:- Amazon Bedrock code examples - Our constantly growing list of examples across models and programming languages.
- The inference parameter reference for Claude and all other models on Amazon Bedrock.
- And, of course, the Generative AI Space here on community.aws with a curated list of articles all around Amazon Bedrock and Generative AI.
Any opinions in this post are those of the individual author and may not reflect the opinions of AWS.