An HTTP GET request retrieves a resource or representation from a specified server endpoint. A practical use is requesting an API response with Python’s requests library, displaying the response, and handling failures. section 9.5.1
Use a small, testable workflow:
- Decompose the task into initializing the request, displaying the response body, and handling errors. section 9.5.1
- Ask targeted questions about requests-library best practices, response display, network errors, and non-200 responses. section 9.5.1
- Evaluate the result repeatedly and refine the prompt when the response does not meet the goal. section 9.5.1
Request an API response
Prompt an assistant to decompose a task that sends an HTTP GET request with Python’s requests library, displays the response, and handles potential errors. Follow with separate prompts for request initialization, response-body display, and handling network errors or non-200 responses; revise the prompts as needed. 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.
Use the chain-of-thought prompting diagram to follow decomposition, experimentation, and iterative refinement around an HTTP GET task. section 9.5.1













