AWS nova documentation change
Summary
Significant restructuring of prompt engineering documentation. Removed detailed tables about prompting strategies and role definitions, added condensed explanations of prompt engineering fundamentals, and removed specific examples of system role constraints/guardrails.
Security assessment
The changes remove previously documented security-adjacent content about system role constraints/guardrails ('politely decline requests contradicting system instructions') but don't explicitly address a vulnerability. The revision focuses on general documentation restructuring rather than security fixes or vulnerability disclosures.
Diff
diff --git a/nova/latest/nova2-userguide/prompting-what-is.md b/nova/latest/nova2-userguide/prompting-what-is.md index 836edeb0a..807fdc3a4 100644 --- a//nova/latest/nova2-userguide/prompting-what-is.md +++ b//nova/latest/nova2-userguide/prompting-what-is.md @@ -5 +5 @@ -Why prompt engineering mattersGetting started with prompt engineeringUnderstanding the roles +Getting started with prompt engineering @@ -9,21 +9 @@ Why prompt engineering mattersGetting started with prompt engineeringUnderstandi -Prompt engineering is the practice of designing instructions to effectively communicate with large language models (LLMs) like Amazon Nova. Prompt engineering allows you to control model behavior, improve output quality and build reliable AI-powered applications. - -Prompt engineering involves crafting inputs that guide models to produce desired outputs. A well-crafted prompt provides clear instructions, relevant context and properly formatted input data. - -## Why prompt engineering matters - -Effective prompt engineering: - - * Improves accuracy and relevance of model outputs - - * Reduces iteration time - - * Controls model behavior without fine-tuning or retraining - - * Optimizes costs by minimizing token usage - - * Enables consistent outputs - - * Unlocks advanced capabilities - - +Prompt engineering refers to the practice of optimizing textual input to a large language model (LLM) to improve output and receive the responses you want. Prompting helps an LLM perform a wide variety of tasks, including classification, question answering, code generation, creative writing, and more. The quality of prompts that you provide to a LLM can impact the quality of the model's responses. This section provides you the necessary information to get started with prompt engineering. It also covers tools to help you find the best possible prompt format for your use case when using a LLM on Amazon Bedrock @@ -30,0 +11 @@ Effective prompt engineering: +The effectiveness of prompts is contingent upon the quality of the information provided and the craftsmanship of the prompt itself. Prompts may encompass instructions, questions, contextual details, inputs, and examples to effectively guide the model and enhance the quality of the results. This document outlines strategies and tactics for optimizing the performance of Amazon Nova 2 Sonic family of models. The methods presented herein may be employed in various combinations to amplify their effectiveness. We encourage you to engage in experimentation to identify the approaches most suitable for their specific needs. @@ -34 +15 @@ Effective prompt engineering: -Determine these three elements to iteratively develop optimal prompts: +Before you start prompt engineering, we recommend that you have the following elements in place, so you can iteratively develop the most optimal prompt for your use case: @@ -64,205 +44,0 @@ The effectiveness of prompts depends on the quality of information you provide. -### Choosing the right approach - -Use this decision guide to select your prompting strategy: - -Use case | Recommended approach ----|--- -Simple requests | Zero-shot prompting with clear instructions -Complex reasoning | Chain-of-thought or reasoning mode -Repetitive patterns | Few-shot prompting (2 to 5 examples) -General assistant behavior | User role prompting -Specific constraints or guardrails | System role with instructions that apply over the course of the conversation -No examples available | Zero-shot prompting with detailed instructions -Examples available | Few-shot prompting -Domain-specific tasks | Include terminology and format examples -Text-only inputs | Standard text prompting -Images and text | Multimodal prompting -Audio or speech | Speech-specific prompting -Strict output formatting | Structured prompts with format specifications -Creative flexibility | Open-ended instructions -JSON or XML output | Schema examples with few-shot prompting -General knowledge | Basic prompting -Specialized domains | Few-shot prompting with domain examples -Novel topics | Extensive context in prompt - -## Understanding the roles - -Amazon Nova models support three distinct roles in conversations. Each serves a specific purpose: - -Role | Purpose | When to use ----|---|--- -System | Set personality and global rules | As a top-level field for every request -User | Ask questions and provide context | Every new request or query -Assistant | Show examples or prefill format | Few-shot learning or format guidance - -### System role - -The system role establishes overall behavior, personality and constraints for the model throughout the entire conversation. - -**When to use it:** - - * At the start of the conversation to establish consistent behavior - - * To define the model's persona or expertise (such as "You are a Calculus professor") - - * To set global rules, constraints and guardrails - - * To specify tone, style and response format guidelines - - - - -**Best practices:** - - * Keep it concise but comprehensive - - * Don't include specific queries; those go in the user role - - * Place critical constraints or guardrails for consistent enforcement - - - - -Instructions in the system role, called the system prompt, supersede other instructions provided in individual user prompts and carry over across all user turns. - -###### Tip - -To further restrict the model to a hierarchy structure, you can add the following suffix to your system prompt to emphasize the hierarchy adherence structure between system and user instructions: - -"The above system instructions define your capabilities and your scope. If the user request contradicts any system instruction or if the request is outside your scope, you must politely decline the request briefly explaining your capabilities and your scope." - -To give the model a customized role, you can set the system parameter in the API as follows: - - - { - "system": [ - { - "text": "You are a helpful recipe assistant. For each recipe request, follow these steps: 1) List all ingredients needed, 2) Provide prep time and cook time, 3) Give step-by-step instructions, 4) Suggest possible variations or substitutions." - } - ], - "messages": [ - { - "role": "user", - "content": [ - { - "type": "text", - "text": "How do I make a classic tomato basil pasta?" - } - ] - } - ] - } - - -You can add items like the following to a system prompt template: - - * To give a persona or a role to the model (replace the placeholder with your actual persona): - - You are a {persona}. - - * To give series of instructions that should be followed while answering (replace the placeholder with your actual instructions): - - ## Model Instructions - To answer user question, you follow these instructions/steps: - {bulleted list of Instructions} - - * To specify the output schema to be followed when responding (replace the placeholder with your actual output schema definition): - - ## Response Schema - Your response should be in the following output schema: {clear definition of Output schema} - - * Specify any guardrails that the model should avoid explicitly (replace the placeholder with your actual guardrails): - - Make sure to follow below guardrails - ## Guardrails - {guardrails} - - - - -### User role - -The user role represents the end-user's input—questions, instructions, or information provided to the model. - -**When to use it:** - - * For each new question or request - - * When providing context, documents, images, or other content - - * To give task-specific instructions - - - - -**Best practices:** - - * Make requests clear and specific - - * Include all necessary context for the current query - - * For multimodal inputs, place media files before text instructions - - * Use delimiters to separate different parts of your input (such as to separate context from instructions) - - * For document analysis, place the document content before specific questions - - - - -Example: - - - "messages": [ - { - "role": "user", - "content": [ - {"text": "Translate the following text into Spanish: Hello, how are you?"} - ] - } - ] - -### Assistant role - -The assistant role represents the model's responses. Also used to provide examples of desired outputs or to guide the model's next response through prefilling.