Skip to lesson

AWSAWS Certified Generative AI Developer - Professional2026-100 Prerequisites

Choose instructions and examples deliberately

Completed by the knowledge check

Learning objective

Understand role instructions, zero-shot, few-shot, and structured prompts. You should be able to identify what each pattern contributes and choose the smallest prompt that expresses the task reliably. Detailed message construction belongs to 1.3.6; production prompt versioning belongs to 1.6.2.

Core idea

A prompt supplies a task contract to a model: what to do, what input to use, what response to produce, and how to handle missing information. A role instruction sets perspective or behavior. Examples demonstrate how to apply the contract. Structure separates those elements so their relationships are clear.

These are independent choices. A structured prompt can be zero-shot, and a few-shot prompt can include a role instruction. None of them grants access to a database, changes model weights, or proves that the resulting answer is correct. Choose a pattern by the failure you need to address, then test it on inputs that were not used to write the prompt.

How it works

Assign a role with a task

A role instruction describes the behavior you want, such as a support analyst who extracts customer-reported symptoms without diagnosing their cause. Pair that perspective with a concrete task, allowed outputs, and evidence requirements. An impressive job title without those details leaves the decision ambiguous.

For an ordinary Amazon Bedrock Converse request, the system field supplies instructions or context about the task and persona. The messages field supplies the conversation. Use the request’s instruction channel for application-owned behavior and keep customer text identifiable as input data. Follow the selected model’s capabilities; a consistent API does not make every model support every optional feature.

Distinguish a persona from a message role. Asking the model to act as an analyst is prose about behavior. A message’s role identifies its place in the conversation. Saying that a customer is an administrator inside their message is neither authentication nor authorization. Those checks belong to the application; see 3.2.2.

Start with zero-shot instructions

Zero-shot prompting gives the task without worked input-output examples. A request can still include definitions, permitted labels, and the document being classified. Here, “shot” counts demonstrations, not the amount of context. Providing a policy passage to answer a question does not automatically make the prompt few-shot.

For ticket classification, define categories in words and request one label. Include an explicit outcome for insufficient information rather than forcing every ticket into a category. AWS prompt-design guidance emphasizes clear task instructions and specified output choices. Use that clarity before adding examples; examples should resolve an ambiguity you can identify.

A zero-shot baseline is useful because you can inspect which cases fail. If the model returns explanations when you need labels, tighten the output instruction. If it confuses two business categories, clarify their definitions. Add examples when definitions alone fail to express the distinction consistently.

Add demonstrations with few-shot prompting

Few-shot prompting places worked input-response pairs in the prompt. The examples show how to apply labels, format an extraction, or handle an exception. They are in-context demonstrations, not a training job that updates the model’s weights. AWS suggests that 3–5 examples can suffice for simple classification tasks, while harder tasks such as question answering without context need more examples. It also recommends examples semantically similar to real-world data to improve performance. Treat this as a starting point and verify the benefit on your task.

Choose demonstrations that expose decisions: a routine case, a boundary between categories, and an input that lacks enough information. Keep the examples consistent with the written instructions. If the instructions say to preserve uncertainty but every example invents a missing value, you have supplied conflicting evidence about the expected behavior.

Examples consume the same finite input budget as other prompt content. Measure whether they improve held-out cases before retaining them. For a narrow classification task, a small set that teaches the actual ambiguity can be more useful than a large set of easy duplicates. Token budgeting is covered in 0.2 and 1.3.9.

Structure the prompt and the response separately

A structured prompt separates task, definitions, examples, reference material, user input, and requested output. Headings and delimiters make the relationship between sections legible. For example, distinguish “Examples” from “Ticket to classify” so the model is not asked to classify a demonstration as the live case. Preserve that distinction when assembling system and messages.

A structured prompt is not the same as Bedrock structured outputs. Saying “return JSON” expresses a formatting preference. For supported models, Bedrock’s structured-output capability uses outputConfig.textFormat with the Converse APIs to constrain responses to a supplied JSON schema. A schema can establish shape without establishing the truth of the values inside it. Validate the business meaning separately; see 3.1.4.

Delimiters also do not make untrusted text safe. A quoted ticket can contain instructions that conflict with your application task. Treat source text as data and enforce tool and data permissions outside the prompt; injection boundaries are covered in 3.1.8.

Key distinctions and trade-offs

The following choices solve different problems:

PatternContributionMain trade-off
Role instructionSets perspective and behavioral expectationsA vague persona can leave the task underspecified
Zero-shot promptExpresses the task without demonstrationsSubtle label boundaries may remain ambiguous
Few-shot promptDemonstrates representative input-output decisionsExamples add tokens and can teach inconsistent behavior
Structured promptSeparates instructions, evidence, and live inputOrganization does not enforce response validity
Structured outputConstrains supported output shapeValid structure still needs semantic checks

Prefer a clear zero-shot baseline when the task is easy to define. Add few-shot examples when their measured value exceeds the context they occupy. Apply structure in either case; it makes assembly and review easier to reason about.

Architecture / decision scenario

A support service assigns tickets to billing, technical, or needs_review. Its first prompt says only “Act as an expert support agent,” and responses vary between labels and free-form advice.

The team puts its role and category definitions in the system instructions of an ordinary Converse request. It separates the customer ticket from those instructions in messages and establishes a zero-shot baseline. When mixed billing-and-outage tickets remain inconsistent, it adds worked examples showing which cases require needs_review, including an incomplete ticket.

The receiving service requires machine-readable output, so the team chooses a model that supports structured outputs and configures outputConfig.textFormat. It still checks the classification against reviewed labels. The role guides behavior, examples teach the boundary, prompt structure separates the content, and the schema constrains output shape. None substitutes for the others.

Common exam traps

  • Counting supplied reference text as a few-shot example without a worked response.
  • Treating a role instruction as proof of expertise or access permission.
  • Describing few-shot examples as fine-tuning model weights.
  • Assuming headings or delimiters enforce valid JSON or prevent prompt injection.
  • Treating schema-valid output as a verified business decision.
  • Adding demonstrations without testing whether they resolve the observed failure.

What to remember

  • Role, examples, and structure are separate prompt-design decisions.
  • Zero-shot means no worked demonstrations, not no context.
  • Few-shot examples demonstrate behavior within the invocation’s input context.
  • Use explicit task and output instructions before adding complexity.
  • Separate prompt organization, output-shape enforcement, and business validation.

Knowledge check

References