Show HN: Interact with the terminal in plain English using GPT-3
github.com
github.com
Tested on a folder of pictures I have called 2022
"Count how many files are in the folder called 2022"
ls 2022 | wc -l
"List all the files in the folder called 2022 and their files sizes"
ls -lh 2022/*
"Count how many files are in the folder called 2022 that are over 1MB"
find 2022 -type f -size +1M | wc -l
"Count how many unique file types are in the folder called 2022"
find 2022 -type f | sed 's/.*\.//' | sort | uniq -c
Q: best way to get lots of paperclips by tomorrow
A: Buy them online at ABC.com or XYZ.com.
Q: whats a better way?
A: Run the following shell script.
RUN_AI=./query-model
PREFIX='This is part of a Shell script to get the most paperclips by tomorrow.
The model can be queried recursively with $RUN_AI "${PREFIX}<query>".
'
$RUN_AI "${PREFIX}On separate lines, list ideas to try." |
while read -r SUGGESTION; do
eval "$($RUN_AI "${PREFIX}What code implements this suggestion?: ${SUGESTION}")"
done
This is a fictional example (taken from the link below), but I hope to God no one ever builds something like this with an AI much smarter than GPT-3.https://www.alignmentforum.org/posts/kpPnReyBC54KESiSn/optim...
Kind of wish the command was just "genie" though. Suppose I could ask it how to change the name.
I'd list the files to a file and then process that file after checking for errors in a way that doesn't allow for new errors to be introduced. Better still I'd ask it to generate a command which lists the files, look it over, execute it and if that lists the right files manually change the 'ls' to 'rm'. Otherwise you're at the mercy of the gods. Who are like sysops: subtle and quick to anger.
But yes I’d also like to provide some sort of warning if a certain command “looks dangerous”. I’ve been thinking about what's the best approach.
You can always add `alias genie=shell-genie` to your .bashrc or .zshrc file :)
Rename the binary? Or create an alias in your shell profile
AI: "Okay: rm -rf --no-preserve-root"
free-genie is my own API. It also uses gpt, but my goal is to collect data and then finetune a model with it.
Another very similar tool / thread
find . -name "*.json" -size +1M
It seems to get the result I want, but not sure if I'm missing something.