Ask a computer! A toy powered by GPT-3 and reckless abandon

• ~300 words • 1 minute read

I made an ill-advised toy that you really should not use:

It's a tool that you can use for natural-language queries from the command-line asking your computer questions about your system.

Watch it in action:

Behind the scenes it works like this:

  • We ask OpenAI to look at the prompt and generate a command-line script for a specified platform that's most likely to return information we could use to answer the question.
  • ‼️ The completely reckless part: Whatever that returns, we run and collect the output.
  • We take the output from that command-line script and ask OpenAI to now try and answer the original prompt based on the information the script provided.

It works remarkably well for certain types of queries:

  • What type of monitor do I have connected? (This was actually a genuine question I had and the impetus for the end-of-day, cowboy-coded hack)
  • Do I need to charge my battery? What's it at?
  • When was the last time I restarted this machine?
  • How many packages did I install with brew?
  • Which ports are currently in use?
  • Am I running any Nodejs processes right now?
  • Do I have any system updates waiting to be installed?
  • Tell me about the (processor/gpu/peripherals/etc)?

Caveat emptor: You could really screw something up here if you're not careful! I added debug and a dry-run mode that doesn't actually execute the command (but shows you what it would have run). But if you asked it to do something like "Delete all the important system files" it... 100% would try to.

So don't. Please.

Or... do and tell me about it! 😈

(Just don't blame me! 🙈)

Update: I've setup a project over at Glitch that you could remix and run remotely:

That is probably a little safer, though might be less sastifying and/or capable. Just change the platform variable to "Ubuntu".