Skip to content
/ shai Public

CLI interface to Google's Gemini Pro model to generate and execute sh commands

License

Notifications You must be signed in to change notification settings

galuque/shai

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SHAI

Command line tool that uses Google's Gemini Pro model with Google AI Studio's rest API to generate a shell command from a natural language description of a task.

shai.mp4

Warning

This tools is just a toy project, and always remember to be careful when running commands generated by an AI model. Never run commands that you don't understand.

Only you are responsible for the commands you run on your system.

Getting the CLI tool

Prerequisites

You need a an API key to use the Gemini API, you can get one by following the instructions here.

Then you need to set the GOOGLE_AI_STUDIO_API_KEY environment variable to the value of your API key.

export GOOGLE_AI_STUDIO_API_KEY=<your API key>

or add the following line to your ~/.bashrc or ~/.zshrc file:

echo "export GOOGLE_AI_STUDIO_API_KEY=<your API key>" >> ~/.bashrc
source ~/.bashrc

Downloading the tool from GitHub

curl -LO https://github.com/galuque/shai/releases/download/v0.1.29/shai-0.1.29-linux-static-amd64 > shai
chmod +x shai
./shai <query>

# or move the file to a directory in your PATH to make it available from anywhere
sudo mv shai /usr/local/bin

Running the tool from source

Clone the repository and navigate to the project directory:

git clone https://github.com/galuque/shai.git
cd shai

Also, you need to have the following installed:

  • Clojure CLI
  • Babashka (Optional, for running the tool with babashka)
  • GraalVM (Optional, for building native executables with the native-image command)

Clojure

clojure -M -m shai.cli <query>

Babashka

Ensure that you have the bb (babashka) command line tool installed. Then run the following command:

bb -m shai.cli <query>

Java JAR

First build the JAR file with the following command:

clojure -T:build uber

Then run the JAR file with the following command:

java -jar target/shai.cli-*.jar <query>

Native Executable

First build the native executable with the following command:

clojure -T:build uber && bash native.sh

Then run the native executable with the following command:

./target/shai <query>