This ‘self-healing’ program can debug Python code in seconds

2 Min Read

In the Wolverine demo video, BioBootloader displays a side-by-side window display with “Wolverine” results in a terminal on the right and Python code on the left. It loads a customized calculator script, introduces a few flaws, and runs it.

“It runs it, it sees the crash, but then it goes and talks to GPT-4 to figure out how to fix it,” he says. GPT-4 returns an explanation for the program’s errors, shows the changes it tries to make, then re-runs the program. Upon seeing new errors, GPT-4 fixes the code and runs correctly. The original Python file is then updated with the changes added by GPT-4.

“LLMs (Large Language Models) like GPT-4 are “programmed” in natural language, and these instructions are referred to as prompts. A large chunk of what Wolverine does is thanks to a carefully-written prompt,” explains Hackaday.

The creator thinks the method could be used with other programming languages, and the source is accessible on GitHub. “Wolverine” must be used with an OpenAI API token for GPT-3.5 or GPT-4, which does attract fees. Anyone with an OpenAI account can access the GPT 3.5 API. However, GPT-4 access is still limited by a queue.

Share this Article