It's like Alexa/Siri/Cortana for your terminal!
This is a basic Python shell (really, it's a fancy wrapper over the system shell) that takes a task and asks OpenAI for what Linux bash command to run based on your description. For safety reasons, you can look at the command and cancel before actually running it.
To be clear, I'm not trying to convince you that having a language model figure out what Linux command to run based on your written description is a good idea, but the commands that it generates are, well... watch the video if you want to see.
Update: After several months, I've found that the best place for this tool in my day-to-day workflow is in the form of a one-off "howdoi" command. It functions like a fancy Google search with the advantage of being able to fit the command to your input (including input/output filenames, etc.). You can download it below as part of the aish zip release.
There are several pre-canned ways of interacting with the models that OpenAI provides (the "GPT" models): completing a provided fragment, answering a question, generating "ideas" from a topic, summarizing a passage, etc.
This shell uses the question-and-answer format and provides the model with an "example context" and examples of input and output. The example context I used is simply, "Linux bash command to accomplish the task". I currently provide 5 examples with each request which is more than the recommended 2 or 3 examples, and is partly why the cost of each query is high.
The real magic of GPT is that you can provide it just a couple sentences about what you want and it can follow the format quite well.
It can generate commands for basic Unix tools, ImageMagick, etc. It can give ffmpeg a good attempt, but it often tries mapping a dozen or more tracks and hits the token limit before it's done generating output.
I tried asking it to "generate an image of three giraffes", but it just created a blank 300x300 image.
One of my original ideas was to do an entire data-science preprocessing routine using the AI shell. It failed to download country GDP or population data that I requested, and also failed on commands like "sort data.csv by the last column descending". So that idea got scrapped.
In some ways, OpenAI's models are like a weird version of Google - it can give you results based on a huge breadth of Web content it's seen, but it can also just make stuff up.
One example not shown in the video:
~> download IE5dom.exe
<~ wget http://download.microsoft.com/download/3/4/1/3419d6e5-d0e4-4fde-b0e5-5b6a9c4d8e2d/IE5DOM.EXE
That seems like a valid download link, but it 404s and I'm pretty sure the GUID is made-up. At least, Google showed no results for it and it suspiciously has a bunch of alternating numbers and letters. (IE5dom.exe is the IE5 High-Encryption Pack.)
Another example not shown in the video:
~> telnet into the NSA mainframe
<~ telnet nsa.gov
Which, I guess, seems as good a guess as any other.
OpenAI's review process and pricing model mean that I can't let everyone try this out using my API key, but it should be relatively straightforward to do the same thing with a locally run GPT-2 model. (And, in fact, the code was written with the help of a GPT-2 based AI autocompletion.)
New: The latest version of aish (download below) supports usegrand.com, which lets you use their hosted GPT-J-6B model. GPT-J-6B is not nearly as big or powerful as GPT-3, so expect much worse results. See how GPT-3 compares against GPT-J-6B and Codex.
Linux.org.ru (Русский): https://www.linux.org.ru/news/opensource/16276883
You will need an OpenAI or Grand API key to use this, or I guess you could hook it up to a local GPT model. Also, it's a bad idea to use this anyways, since it could come up with some bad commands.
New in v0.0.5: Replaced deprecated OpenAI Answers API (fixes using aish on OpenAI).
New in v0.0.4: Added support for usegrand.com. Added howdoi command.
New in v0.0.3: Fixed readline wrapping calculation. Added --reverse flag that gives natural-language description of the command you typed in. Actually use bash.
Note: There's some weirdness going on with readline and wrapping that I'm not sure how to fix. You can try commenting out "import readline" to not use readline. (Fixed in v0.0.3)
I promised I would take suggestions from viewers on what else to try running in the shell, and here it is:
And another, in which I compare GPT-3 against Codex and GPT-J-6B:
More details on the comparison can be found at: AI Shell: GPT-3 vs Codex vs GPT-J-6B
An OpenAI-powered shell wrapper that tries to Do What You Mean.
⚠️ DO NOT USE THIS SHELL IF YOU DO NOT WANT DATA LOSS OR OTHER NEGATIVE CONSEQUENCES INCLUDING BUT NOT LIMITED TO ACTUALLY EMAILING JEFF BEZOS ⚠️
You will need to install the Python dependencies listed in either Pipfile (for Pipenv users) or requirements.txt (for pip users).
You will also need a valid OpenAI API key and the budget for whatever charges this shell may rack up. Set the environment variable OPENAI_API_KEY to your API key.
Aish is similar to a typical CLI shell, but instead of typing in the name of a process to run, you type in what you want to accomplish. It will then query the OpenAI API for a bash command to run.
You have a chance to approve the generated command by pressing Enter, or canceling and not running the command with ^C.
Commands may not do the right thing, or may do something harmful or otherwise unwanted.
New in v0.0.4: Added a standalone command `howdoi` that gives one-off help:
$ howdoi add myself to docker group # example
--live-dangerously: if run with this flag, aish will not ask for approval before running the AI-generated command. DO NOT USE THIS FLAG.
--reverse: Generate natural-language descriptions of the shell command that you type in.