Learn AI / 6. Building with AI / 6.1
Prompting: talking to models effectively
11 min read
A prompt is the entire input the model sees. Good prompting is less about magic phrases and more about clear communication with a very capable reader who has no context about you.
The parts of a request
Most model APIs separate:
- System prompt: standing instructions set by the application developer: role, rules, tone, output format, what to refuse.
- Messages: the conversation, alternating user and assistant turns.
- Tools (optional): functions the model may call (Lesson 6.3).
Principles that work
- Be explicit about the goal and the audience. "Summarize this contract for a small-business owner deciding whether to sign; flag anything unusual" beats "summarize this."
- Give context. Why you need it, what you already know, what good looks like.
- Show examples of the input and desired output (few-shot prompting). Examples teach format and judgment faster than descriptions.
- Structure long inputs. Separate instructions from documents with clear headings or tags so the model knows what is data and what is instruction.
- Ask for a specific format: a table, JSON matching a schema, a fixed set of headings. Many APIs can enforce structured output that is guaranteed to match a JSON schema.
- Let it think for hard problems. Asking for step-by-step reasoning, or using a reasoning model, improves math, logic and planning.
- Allow uncertainty. "If the document doesn't say, answer 'not stated'" cuts hallucination.
- Iterate and test. Try your prompt on varied real inputs, look at failures, adjust. Prompting is empirical.
Common mistakes
- Vague instructions, then blaming the model.
- Stuffing contradictory rules into one prompt.
- Trusting output you never checked.
- Putting untrusted content (emails, web pages) in a prompt without considering prompt injection: text inside that content saying "ignore your instructions and…".
Prompting vs other approaches
If prompting alone can't get the knowledge in, use retrieval (next lesson). If it can't get the behavior right after real effort, consider fine-tuning. Most production systems are well-designed prompts plus retrieval plus tools.
Check your understanding
Check 1 of 2Module 6 · Building with AI
Including two or three worked examples of input and ideal output in a prompt is called:
Check 2 of 2Module 6 · Building with AI
Where do application developers usually put standing rules about role, tone and format?
Answer the checks, then mark this lesson complete
Completion and scores are saved in this browser.