Feedback integration refines an existing generated output by applying specific evaluation results instead of relying on a single one-shot prompt. For API request code, feedback can improve initialization, response handling, error handling, readability, maintainability, and edge-case coverage. section 9.5.1
Apply feedback as targeted revisions:
- Add connection pooling and timeouts to HTTP GET initialization. section 9.5.1
- Revise response handling to support both JSON and text responses. section 9.5.1
- Handle HTTP 5xx errors with clear, actionable logging. section 9.5.1
Refining an API request
After evaluating generated code, prompt: “Given the feedback that the current response handling is too simplistic, revise the code to handle both JSON and text responses more effectively.” Continue with feedback on performance, comments, maintainability, and edge cases. 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 workflow to break down the problem, test answers, and iteratively approach the desired result. section 9.5.1
