Wolverine Gives Your Python Scripts The Ability To Self-Heal bugs using chatGPT

combined Python and a hefty dose of of AI for a fascinating proof of concept: self-healing Python scripts. He shows things working in a video, embedded below the break, but we’ll also describe what happens right here.

The demo Python script is a simple calculator that works from the command line, and [BioBootloader] introduces a few bugs to it. He misspells a variable used as a return value, and deletes the subtract_numbers(a, b) function entirely. Running this script by itself simply crashes, but using Wolverine on it has a very different outcome.In a short time, error messages are analyzed, changes proposed, those same changes applied, and the script re-run.

Wolverine is a wrapper that runs the buggy script, captures any error messages, then sends those errors to GPT-4 to ask it what it thinks went wrong with the code. In the demo, GPT-4 correctly identifies the two bugs (even though only one of them directly led to the crash) but that’s not all! Wolverine actually applies the proposed changes to the buggy script, and re-runs it. This time around there is still an error… because GPT-4’s previous changes included an out of scope return statement. No problem, because Wolverine once again consults with GPT-4, creates and formats a change, applies it, and re-runs the modified script. This time the script runs successfully and Wolverine’s work is done.

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, and you can read it here to gain some insight into the process. Don’t forget to watch the video demonstration just below if you want to see it all in action.

While AI coding capabilities definitely have their limitations, some of the questions it raises are becoming more urgent. Heck, consider that GPT-4 is barely even four weeks old at this writing.

https://platform.twitter.com/embed/Tweet.html?creatorScreenName=hackaday&dnt=true&embedId=twitter-widget-0&features=eyJ0ZndfdGltZWxpbmVfbGlzdCI6eyJidWNrZXQiOltdLCJ2ZXJzaW9uIjpudWxsfSwidGZ3X2ZvbGxvd2VyX2NvdW50X3N1bnNldCI6eyJidWNrZXQiOnRydWUsInZlcnNpb24iOm51bGx9LCJ0ZndfdHdlZXRfZWRpdF9iYWNrZW5kIjp7ImJ1Y2tldCI6Im9uIiwidmVyc2lvbiI6bnVsbH0sInRmd19yZWZzcmNfc2Vzc2lvbiI6eyJidWNrZXQiOiJvbiIsInZlcnNpb24iOm51bGx9LCJ0ZndfbWl4ZWRfbWVkaWFfMTU4OTciOnsiYnVja2V0IjoidHJlYXRtZW50IiwidmVyc2lvbiI6bnVsbH0sInRmd19leHBlcmltZW50c19jb29raWVfZXhwaXJhdGlvbiI6eyJidWNrZXQiOjEyMDk2MDAsInZlcnNpb24iOm51bGx9LCJ0ZndfZHVwbGljYXRlX3NjcmliZXNfdG9fc2V0dGluZ3MiOnsiYnVja2V0Ijoib24iLCJ2ZXJzaW9uIjpudWxsfSwidGZ3X3ZpZGVvX2hsc19keW5hbWljX21hbmlmZXN0c18xNTA4MiI6eyJidWNrZXQiOiJ0cnVlX2JpdHJhdGUiLCJ2ZXJzaW9uIjpudWxsfSwidGZ3X2xlZ2FjeV90aW1lbGluZV9zdW5zZXQiOnsiYnVja2V0Ijp0cnVlLCJ2ZXJzaW9uIjpudWxsfSwidGZ3X3R3ZWV0X2VkaXRfZnJvbnRlbmQiOnsiYnVja2V0Ijoib24iLCJ2ZXJzaW9uIjpudWxsfX0%3D&frame=false&hideCard=false&hideThread=false&id=1636880208304431104&lang=en&origin=https%3A%2F%2Fhackaday.com%2F2023%2F04%2F09%2Fwolverine-gives-your-python-scripts-the-ability-to-self-heal%2F&sessionId=de39ae5f7a5963d32185e4edfa3b5d86374d2d37&siteScreenName=hackaday&theme=light&widgetsVersion=aaf4084522e3a%3A1674595607486&width=550px

https://platform.twitter.com/embed/Tweet.html?creatorScreenName=hackaday&dnt=true&embedId=twitter-widget-0&features=eyJ0ZndfdGltZWxpbmVfbGlzdCI6eyJidWNrZXQiOltdLCJ2ZXJzaW9uIjpudWxsfSwidGZ3X2ZvbGxvd2VyX2NvdW50X3N1bnNldCI6eyJidWNrZXQiOnRydWUsInZlcnNpb24iOm51bGx9LCJ0ZndfdHdlZXRfZWRpdF9iYWNrZW5kIjp7ImJ1Y2tldCI6Im9uIiwidmVyc2lvbiI6bnVsbH0sInRmd19yZWZzcmNfc2Vzc2lvbiI6eyJidWNrZXQiOiJvbiIsInZlcnNpb24iOm51bGx9LCJ0ZndfbWl4ZWRfbWVkaWFfMTU4OTciOnsiYnVja2V0IjoidHJlYXRtZW50IiwidmVyc2lvbiI6bnVsbH0sInRmd19leHBlcmltZW50c19jb29raWVfZXhwaXJhdGlvbiI6eyJidWNrZXQiOjEyMDk2MDAsInZlcnNpb24iOm51bGx9LCJ0ZndfZHVwbGljYXRlX3NjcmliZXNfdG9fc2V0dGluZ3MiOnsiYnVja2V0Ijoib24iLCJ2ZXJzaW9uIjpudWxsfSwidGZ3X3ZpZGVvX2hsc19keW5hbWljX21hbmlmZXN0c18xNTA4MiI6eyJidWNrZXQiOiJ0cnVlX2JpdHJhdGUiLCJ2ZXJzaW9uIjpudWxsfSwidGZ3X2xlZ2FjeV90aW1lbGluZV9zdW5zZXQiOnsiYnVja2V0Ijp0cnVlLCJ2ZXJzaW9uIjpudWxsfSwidGZ3X3R3ZWV0X2VkaXRfZnJvbnRlbmQiOnsiYnVja2V0Ijoib24iLCJ2ZXJzaW9uIjpudWxsfX0%3D&frame=false&hideCard=false&hideThread=false&id=1636880208304431104&lang=en&origin=https%3A%2F%2Fhackaday.com%2F2023%2F04%2F09%2Fwolverine-gives-your-python-scripts-the-ability-to-self-heal%2F&sessionId=de39ae5f7a5963d32185e4edfa3b5d86374d2d37&siteScreenName=hackaday&theme=light&widgetsVersion=aaf4084522e3a%3A1674595607486&width=550px

https://hackaday.com/2023/04/09/wolverine-gives-your-python-scripts-the-ability-to-self-heal/

Blach hole streaking through galaxy leaves wake of new stars

There’s an invisible monster on the loose, barreling through intergalactic space so fast that if it were in our solar system, it could travel from Earth to the Moon in 14 minutes. This supermassive black hole, weighing as much as 20 million Suns, has left behind a never-before-seen 200,000-light-year-long “contrail” of newborn stars, twice the diameter of our Milky Way galaxy. It’s likely the result of a rare, bizarre game of galactic billiards among three massive black holes.

Rather than gobbling up stars ahead of it, like a cosmic Pac-Man, the speedy black hole is plowing into gas in front of it to trigger new star formation along a narrow corridor. The black hole is streaking too fast to take time for a snack. Nothing like it has ever been seen before, but it was captured accidentally by NASA’s Hubble Space Telescope.

Illustration of a black field with white, yellow, and red galaxies. A black hole near bottom left corner plows through space, leaving a diagonal trail of newborn stars stretching back to the black hole's parent galaxy in the upper right corner.

This is an artist’s impression of a runaway supermassive black hole that was ejected from its host galaxy as a result of a tussle between it and two other black holes. As the black hole plows through intergalactic space it compresses tenuous gas in front to it. This precipitates the birth of hot blue stars. This illustration is based on Hubble Space Telescope observations of a 200,000-light-year-long “contrail” of stars behind an escaping black hole. For more details, read the Extended Text Description.

Credits: NASA, ESA, Leah Hustak (STScI)

“We think we’re seeing a wake behind the black hole where the gas cools and is able to form stars. So, we’re looking at star formation trailing the black hole,” said Pieter van Dokkum of Yale University in New Haven, Connecticut. “What we’re seeing is the aftermath. Like the wake behind a ship we’re seeing the wake behind the black hole.” The trail must have lots of new stars, given that it is almost half as bright as the host galaxy it is linked to.

The black hole lies at one end of the column, which stretches back to its parent galaxy. There is a remarkably bright knot of ionized oxygen at the outermost tip of the column. Researchers believe gas is probably being shocked and heated from the motion of the black hole hitting the gas, or it could be radiation from an accretion disk around the black hole. “Gas in front of it gets shocked because of this supersonic, very high-velocity impact of the black hole moving through the gas. How it works exactly is not really known,” said van Dokkum.

“This is pure serendipity that we stumbled across it,” van Dokkum added. He was looking for globular star clusters in a nearby dwarf galaxy. “I was just scanning through the Hubble image and then I noticed that we have a little streak. I immediately thought, ‘oh, a cosmic ray hitting the camera detector and causing a linear imaging artifact.’ When we eliminated cosmic rays we realized it was still there. It didn’t look like anything we’ve seen before.”

Hubble image of black, deep-space field with white, yellow, and reddish galaxies. Image center: small, white-bordered, boxed area that contains one, long, thin, diagonal streak of whitish-blue stars. Two galaxies also reside within the box.

This Hubble Space Telescope archival photo captures a curious linear feature that is so unusual it was first dismissed as an imaging artifact from Hubble’s cameras. But follow-up spectroscopic observations reveal it is a 200,000-light-year-long chain of young blue stars. A supermassive black hole lies at the tip of the bridge at lower left. The black hole was ejected from the galaxy at upper right. It compressed gas in its wake to leave a long trail of young blue stars. Nothing like this has ever been seen before in the universe. This unusual event happened when the universe was approximately half its current age.

Credits: NASA, ESA, Pieter van Dokkum (Yale); Image Processing: Joseph DePasquale (STScI)

Because it was so weird, van Dokkum and his team did follow-up spectroscopy with the W. M. Keck Observatories in Hawaii. He describes the star trail as “quite astonishing, very, very bright and very unusual.” This led to the conclusion that he was looking at the aftermath of a black hole flying through a halo of gas surrounding the host galaxy.

This intergalactic skyrocket is likely the result of multiple collisions of supermassive black holes. Astronomers suspect the first two galaxies merged perhaps 50 million years ago. That brought together two supermassive black holes at their centers. They whirled around each other as a binary black hole.

Then another galaxy came along with its own supermassive black hole. This follows the old idiom: “two’s company and three’s a crowd.” The three black holes mixing it up led to a chaotic and unstable configuration. One of the black holes robbed momentum from the other two black holes and got thrown out of the host galaxy. The original binary may have remained intact, or the new interloper black hole may have replaced one of the two that were in the original binary, and kicked out the previous companion.

When the single black hole took off in one direction, the binary black holes shot off in the opposite direction. There is a feature seen on the opposite side of the host galaxy that might be the runaway binary black hole. Circumstantial evidence for this is that there is no sign of an active black hole remaining at the galaxy’s core. The next step is to do follow-up observations with NASA’s James Webb Space Telescope and the Chandra X-ray Observatory to confirm the black hole explanation.

https://youtube.com/watch?v=aPAP2ewFR0A%3Frel%3D0

There’s an invisible monster on the loose! It’s barreling through intergalactic space fast enough to travel from Earth to the Moon in 14 minutes. But don’t worry, luckily this beast is very, very far away! This potential supermassive black hole, weighing as much as 20 million Suns, has left behind a never-before-seen 200,000 light-year-long trail of newborn stars. The streamer is twice the diameter of our Milky Way galaxy. It’s likely the result of a rare, bizarre game of galactic billiards among three massive black holes.

Credits: NASA’s Goddard Space Flight Center; Lead Producer: Paul Morris

NASA’s upcoming Nancy Grace Roman Space Telescope will have a wide-angle view of the universe with Hubble’s exquisite resolution. As a survey telescope, the Roman observations might find more of these rare and improbable “star streaks” elsewhere in the universe. This may require machine learning using algorithms that are very good at finding specific weird shapes in a sea of other astronomical data, according to van Dokkum.

The research paper will be published on April 6 in The Astrophysical Journal Letters.

https://www.nasa.gov/feature/goddard/2023/hubble-sees-possible-runaway-black-hole-creating-a-trail-of-stars

Tired Of Web Scraping? Make The AI Do It

a novel approach to the problem of scraping web content in a structured way without needing to write the kind of page-specific code web scrapers usually have to deal with. How? Just enlist the help of a natural language AI. Scrapeghost relies on OpenAI’s GPT API to parse a web page’s content, pull out and classify any salient bits, and format it in a useful way.

What makes Scrapeghost different is how data gets organized. For example, when instantiating scrapeghost one defines the data one wishes to extract. For example:

from scrapeghost importSchemaScraper

scrape_legislators = SchemaScraper(

schema={

"name": "string",

"url": "url",

"district": "string",

"party": "string",

"photo_url": "url",

"offices": [{"name": "string", "address": "string", "phone": "string"}],

}

)

The kicker is that this format is entirely up to you! The GPT models are very, very good at processing natural language, and scrapeghost uses GPT to process the scraped data and find (using the example above) whatever looks like a name, district, party, photo, and office address and format it exactly as requested.

It’s an experimental tool and you’ll need an API key from OpenAI to use it, but it has useful features and is certainly a novel approach. There’s a tutorial and even a command-line interface, so check it out.

https://hackaday.com/2023/04/09/tired-of-web-scraping-make-the-ai-do-it/

Triggering Blinks i n VR, a useful thing to do

In VR, a blink can be a window of opportunity to improve the user’s experience. We’ll explain how in a moment, but blinks are tough to capitalize on because they are unpredictable and don’t last very long. That’s why researchers spent time figuring out how to induce eye blinks on demand in VR (video) and the details are available in a full PDF report. Turns out there are some novel, VR-based ways to reliably induce blinks. If an application can induce them, it makes it easier to use them to fudge details in helpful ways.

It turns out that humans experience a form of change blindness during blinks, and this can be used to sneak small changes into a scene in useful ways. Two examples are hand redirection (HR), and redirected walking (RDW). Both are ways to subtly break the implicit one-to-one mapping of physical and virtual motions. Redirected walking can nudge a user to stay inside a physical boundary without realizing it, leading the user to feel the area is larger than it actually is. Hand redirection can be used to improve haptics and ergonomics. For example, VR experiences that use physical controls (like a steering wheel in a driving simulator, or maybe a starship simulator project like this one) rely on physical and virtual controls overlapping each other perfectly. Hand redirection can improve the process by covering up mismatches in a way that is imperceptible to the user.

There are several known ways to induce a blink reflex, but it turns out that one novel method is particularly suited to implementing in VR: triggering the menace reflex by simulating a fast-approaching object. In VR, a small shadow appears in the field of view and rapidly seems to approach one’s eyes. This very brief event is hardly noticeable, yet reliably triggers a blink. There are other approaches as well such as flashes, sudden noise, or simulating the gradual blurring of vision, but to be useful a method must be unobtrusive and reliable.

We’ve already seen saccadic movement of the eyes used to implement redirected walking, but it turns out that leveraging eye blinks allows for even larger adjustments and changes to go unnoticed by the user. Who knew blinks could be so useful to exploit?

https://youtube.com/watch?v=cxapHXQysh8%3Fversion%3D3%26rel%3D1%26showsearch%3D0%26showinfo%3D1%26iv_load_policy%3D1%26fs%3D1%26hl%3Den-US%26autohide%3D2%26wmode%3Dtransparent

https://hackaday.com/2023/04/09/blinks-are-useful-in-vr-but-triggering-blinks-is-tricky/