liveBook · Manning

Continuous improvement

As explained in Coding with AI

Iterative evaluation is the repeated assessment of generated results followed by changes intended to improve their quality or accuracy.

An iterative feedback loop treats AI output as a draft: assess each result, revise the prompt or implementation, and evaluate again. This keeps work aligned with accuracy, best practices, and the actual task. section 9.5.1

Use the loop to develop a small HTTP API request in Python:

  • Split the task into initialization, response display, and error handling. section 9.5.1
  • Prompt for each focused implementation, such as a requests-based GET request with best-practice error handling. section 9.5.1
  • Review the generated code for efficiency, clarity, response formats, connection failures, timeouts, and non-200 status codes. section 9.5.1
  • Rewrite the prompt when the result is weak, then use the same or another LLM as a sanity check. section 9.5.1

Reviewing an API request

After generating a requests-based HTTP GET function, ask: “Is the code efficient, does it follow best practices, and is error handling sufficiently robust?” For response handling, check whether it supports JSON and text clearly; for failures, check connection issues, timeouts, and non-200 responses. Revise the implementation or prompt wherever the review finds a gap. 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.
A diagram of a diagram

Description automatically generated

A figure illustrates breaking a problem down, experimenting with answers, and iterating until the result meets the desired outcome. section 9.5.1

How Coding with AI covers it

How deep it goes
Explains a repeatable cycle of decomposition, generation, review, prompt refinement, and sanity checking.
Examples
Demonstrates Python requests through HTTP GET initialization, response display, and checks for network, timeout, and status-code failures.
What you can do after
Diagnose/debug with it by reviewing generated API code, identifying shortcomings, and directing successive improvements.
How it connects
Connects prompt engineering with chain-of-thought prompting, HTTP requests, API responses, and error handling.

Also explained in

Compare how 30 books explain continuous improvement →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Coding with AI. The section links point to the parts of the book it draws on.