Contextual awareness preserves task-relevant information so an AI model can interpret nuances, identify missing details, and produce a more relevant response. In prompt engineering, this means supplying specific language, contextual clues, audience expectations, tone, and constraints rather than relying on a bare request. section 9.3 section 9.5.1
Use contextual awareness alongside these prompt practices:
- State the task and its relevant circumstances clearly. section 9.3
- Ask clarifying questions when audience, tone, constraints, or other information is missing. section 9.3
- Break complex work into logical steps and refine the response as new information appears. section 9.5.1
Diagnosing a Python application in Docker
A context-aware troubleshooting prompt asks whether the container is running, requests interpretation of docker ps -a, checks docker logs, examines application logs, verifies the Python version and dependencies, and reviews the Dockerfile for misconfiguration. This preserves the diagnostic context instead of asking only for a generic fix. section 9.5.1
Figure 9.6 A chain-of-thought prompt gets the model to reason out a problem like a human would. You break down the problem and experiment with answers until you get the results you desire.
The figure shows contextual awareness working within chain-of-thought prompting: break down the problem, test possible answers, and refine the result. section 9.5.1


