Yolo: Natural Language to Shell Commands with ChatGPT API · Embrace The Red

Yolo Gif Animation

Once in a while I go build some fun new tools to adopt new tech. Just last week OpenAI made their gpt-3.5-turbo model accessible via API endpoints.

Update: The latest version also supports GPT-4.

So, I thought it’s time to start building a tool to leverage it.

What is yolo?

Do you know those moments when you can’t remember a shell command, or some arguments to it? How do you pipe all errors to /dev/null again? Things along those lines. This is where yolo comes to the rescue.

You live only once!

Yolo Gif Animation

Yolo translates your question to a shell command (like bash, zsh or PowerShell on Windows), and then executes the command. By default, it won’t right away execute the command (but that can be overwritten, if you desire the true yolo-style).

This project was created for fun, but it’s actually kind of useful.

I started building yolo some time ago, and now upgraded it from the GPT-3 completion API to the brand new ChatCompletion (ChatGPT) API.

How to install and use yourself

The code is here yolo-ai-cmdbot Github repo.

Easy install, don’t forget to set your OpenAI API key.

I mostly use it on Linux and some macOS, Windows is less tested.

Detailed walk-through and demonstration

There is also a YouTube Video that shows it in action:
Video

Happy hacking!

References

Source link

Leave a Comment

Your email address will not be published. Required fields are marked *


Scroll to Top