Introducing Hey! - Your AI-powered Pair Programming Friend
AI command-line tool that speeds up your productivity!
Introduction
Hey (/heɪ/) is an AI friend that helps you alongside your coding projects' development. It's powered by the OpenAI's GPT models that MindsDB supports. This command-line tool can easily act like your non-human pair programming partner that's smart enough to clean your codes, refactor them, and give solutions based on different cases.
I named this project "Hey" because I thought that would be a nice sweet way to start a conversation with an AI.
I had been using some free services that used to give me free limited access to OpenAI's services, ChatGPT as such. Since I'm more of a CLI guy, I had to switch back and forth between my terminal and browser just for a quick answer to my question from ChatGPT. With the help of MindsDB, I easily implemented a secure interface and named it Hey, and since then, I can ask the model MindsDB trained for me, whatever I want from wherever I have access to a CLI shell. It could be either a VScode terminal panel, the system's terminal app, or even TTYs.
Pair Programming
Pair Programming relates to collaborating (programming) on a project with a human partner. You initially team up with someone, it could be your friend or colleague, and develop the same codebase on a single machine but this time, Hey is meant to be there for the rescue. You can easily develop the codebase solo with the help of this AI tool.
Installation
This section includes steps you need to take in order to install Hey on your machine.
Note: This quick tutorial is designed for Hey version 0.1.0 and this version is not stable on Windows machines yet. It's highly recommended to use Hey on Unix-like operating systems like Linux distros or MacOS.
Sign up on MindsDB
First thing first, you need a free MindsDB account. Sign up at https://cloud.mindsdb.com and keep your credentials (email and password) safe. We'll need them later on.
Prepare your GPT model
Once you're logged into your account, open up the editor by heading to https://cloud.mindsdb.com/editor. Now, it's time to prepare your desired version of the ChatGPT model by running the following SQL query.
CREATE MODEL mindsdb.gpt_model
PREDICT response
USING
engine = 'openai',
model_name = 'gpt-4', -- you can also use 'text-davinci-003' or 'gpt-3.5-turbo'
prompt_template = 'respond to {{text}} by {{author_username}} and act like a pair programming partner.';
You can change your model_name
to other GPT versions as well.
Once you execute the query, you see the following result moments later meaning your gpt_model
table is ready to use.
At this point, we're almost done with the MindsDB dashboard. Let's get Hey installed on our system.
- Check this quick tutorial for more details and options about creating a GPT model on MindsDB.
Install Hey
Make sure you have python>=3.6
and pip
installed on your computer. Run the following command and it'll install Hey on your system.
$ pip install hey-mindsdb
Optional: If you can't download from PyPI servers by any chance, you can try GitHub servers via git
.
$ pip install git+https://github.com/lnxpy/hey.git
Just to make sure the installation process was successful, print out Hey's version number as follows.
$ hey --version
_ _ _
| || |___ _ _| |
| __ / -_| || |_|
|_||_\___|\_, (_)
|__/ --> v0.1.0
Authentication and configuration
Create a MINDSDB_EMAIL_ADDRESS
environment variable filled with your MindsDB account email address. The following command does the trick for you. Just replace <EMAIL>
with your actual email address.
$ echo "export MINDSDB_EMAIL_ADDRESS=<EMAIL>" >> ~/.bashrc
If you're using Zshell (ZSH), run the following command instead.
$ echo "export MINDSDB_EMAIL_ADDRESS=<EMAIL>" >> ~/.zshrc
Close the terminal and reopen it to redefine the environment variables. Run hey --set-password
followed by your MindsDB account password.
$ hey --set-password <PASSWORD>
Password successfully set for your@email.com!
Now, you're all good to go.
Usage
Simply call your friend by typing hey
followed by your question. You can start by asking simple programming questions about concepts as I've done here.
This time, I ask Hey to help me add proper annotations to my Python function which exists in a file called code.py
.
This feature (using files' content as input) is not officially supported as you may face issues but that's nice knowing this trick.
Notice that Hey is not returning the full answer. It's because of the limitation over gpt-4
. You can still prepare your model in different versions as we saw earlier. If you want to re-train your GPT model, make sure to drop mindsdb.gpt_model
table first.
Development Process
Well, everything starts with git init
. So did the whole creation of the world maybe. Just kidding..
Hey uses mindsdb_sdk in order to make connections to the MindsDB cloud dashboard. One of the main goals behind Hey v0.1.0 is to let users get their hands on the MindsDB services by heading through the editor, running some SQL queries, and working with tables and structures.
Next Steps..
In this section, I'm going to talk about the futuristic ideas and features I have in mind for Hey.
Features & New Implementations |
Adding function and class as input feature |
Adding file-as-input feature officially |
Caching already-answered questions locally |
Giving ChatGPT permissions to read/write through files |
No authorization required |
Tech Stacks
Useful Links
Special Thanks 🔥
I'm truly happy about the partnership between Hashnode and MindsDB that made up this amazing hackathon. Their great services and wholesome support are appreciatable. 🍺