Prompting Fundamentals and Roles
Prompt components
- Instruction: what task to do.
- Context: background facts or constraints.
- Input data: actual text/data to process.
- Output indicator: expected format/template.
Role-based prompting in chat APIs
- system/developer: behavior, policy, tone, boundaries.
- user: task and input.
- assistant: prior context/history for multi-turn continuity.
Good prompt design checklist
- Specify output format (JSON/table/bullets).
- Define success criteria ("include X, avoid Y").
- Add examples for few-shot style transfer.
- Keep instructions deterministic for production workflows.
- Use explicit fallback phrase when uncertain.
Example pattern
Classify the sentiment as Positive, Neutral, or Negative.
Text: "I think the food was okay."
Sentiment: