Loading
0x30Lesson 4 of 6

Shape prompts and manage context

Give a model a clear task, useful context, and constraints for its response.

12 min 5-question quiz
By the end of this lesson you can
  • Write prompts that specify the task, relevant context, and a checkable output format.

A prompt is the input context that conditions model behavior. Clear prompts state the task, supply relevant information, and describe useful constraints such as audience or output format. Examples can demonstrate a pattern. A prompt cannot expand the model’s context window, guarantee compliance, or turn untrusted input into reliable evidence.

A small example

Illustrative Python
1task = "Summarize the note in one sentence."
2context = "The release moved from Tuesday to Thursday."
3format_rule = "Mention the new release day."
4print(task, context, format_rule, sep="\n")
Output
Summarize the note in one sentence.
The release moved from Tuesday to Thursday.
Mention the new release day.

Separate instructions from quoted or retrieved data so their roles are clear. For structured outputs, specify the required fields and validate the result in software. Long prompts consume context capacity and may include irrelevant information; use only what helps the task.

Key takeaways

  • Write prompts that specify the task, relevant context, and a checkable output format.

  • Measure behavior with realistic examples and inspect important failures.

Lesson quiz

5 questions · pass with 4 correct · up to 50 XP

Passing this quiz completes the lesson and keeps your streak going. Questions you miss come back in review sessions later.

Questions about this lesson

Stuck? Ask. Figured something out? Share it. Explaining is one of the best ways to learn.

Loading posts…

Did you like the lesson? 😆👍
Consider a donation to support our work: