---
title: Ask a computer! A toy powered by GPT-3 and reckless abandon
author: George Mandis <george@mand.is>
date: 2022-12-15
tags: post, post, computer, hacks, gpt-3
---

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

* <https://github.com/georgemandis/ask-a-computer>

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

W﻿atch it in action:

<iframe width="560" height="315" src="https://www.youtube.com/embed/qTT8-COvkGk" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>

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.
* W﻿e 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.

I﻿t 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?
* T﻿ell me about the (processor/gpu/peripherals/etc)?

**C﻿aveat 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.

S﻿o don't. Please.

O﻿r... 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:

* <https://glitch.com/edit/#!/ask-a-computer>

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