Prompt engineering
Definition
Designing, testing and refining prompts so a model produces the output you need reliably, across many inputs and not just one.
In more detail
Most of the gains come from clarity: state the task, audience, constraints and format, give an example, and say what to do when information is missing. Then test the prompt on several inputs, not just one.
Related terms
Context engineering
Deciding what information, tools and history a model sees at each step, and what to leave out, to get the result you want.
Few-shot prompting
Including a few input and output examples in the prompt so the model can copy their pattern, format and level of detail.
Prompt
The input given to a model: instructions, context, examples and the question or task itself, sent as one or more messages in a request.
Role prompting
Telling a model to take on a role, such as a security reviewer or a patient tutor, to shape its focus, tone and level of detail.
Structured outputs
Constraining or validating model output so it matches a schema, usually JSON Schema, and can be parsed reliably by your code.
Zero-shot prompting
Asking a model to perform a task from instructions alone, without giving it any worked examples of the inputs and outputs.
Read more about Prompt engineering
- Prompt engineering
Writing clear, testable instructions for models and checking them on real inputs.
- Prompting fundamentals: clear tasks, examples and formats
How to write a good prompt: frame the task, say who the output is for, show an example and specify the format, so a model's answers are useful and repeatable.