This program is a Python script that interacts with OpenAI's GPT-4 model. It performs the following tasks:
- Creates a directory named ~/.jussiai if it doesn't already exist.
- Manages environment variables by creating and loading an .env file within the ~/.jussiai directory.
- Sanitizes and processes user input for interaction with the GPT-4 model.
- Sends a user's input message to the GPT-4 model using the OpenAI API.
- Displays the response generated by the GPT-4 model.
Overall, this script serves as an CLI interface for interacting with the GPT-4 model, allowing users to engage in conversations and receive responses generated by the model.
Follow these instructions to install the Jussi program:
-
Download: Download the Jussi-file to your computer.
-
Dependencies: This program requires a few dependencies to function. You can install them like this:
pip install openai dotenv
Make sure you're in an activated virtual environment (if needed) before installing the dependencies.
- Environment Variables: The program uses the OPENAI_API_KEY environment variable to set the OpenAI API key. Create a .env file in the root directory of the program. If you prefer to store the .env file in a specific directory, such as ~/.jussiai/.env, you can do the following:
Create the ~/.jussiai directory if it doesn't exist:
mkdir -p ~/.jussiai
Create or edit the .env file in that directory and add your key like this:
OPENAI_API_KEY=YOUR_KEY_HERE
- Running the Program: You can run the program from the command line like this:
./Jussi User-provided text
Replace "User-provided text" with your actual input.
Note: This option requires elevated privileges and should be used with caution.
- Clone this repository to your local machine:
git clone https://github.com/jrajaniemi/JussiAI.git
cd Jussi
-
Make sure you have Python 3 and pip3 installed.
-
Run the installation script as a superuser (root):
sudo ./install_jussi.sh
This will install the required libraries and copy Jussi to a system-wide directory (e.g., /usr/local/bin/) that is accessible by all users. You can use Jussi by running Jussi from any directory.
To use Jussi, follow these steps:
-
Open a terminal or command prompt.
-
Navigate to the directory where Jussi is installed.
-
Run Jussi by executing the following command:
./Jussi "Your input text here"
System-wide install usage:
JussiAI "Your input text here"
$ git diff | JussiAI Create a git commit message for these changes:
$ cat language_en.json | JussiAI Translate this JSON file into German:
$ cat captions_en.sbv | JussiAI Translate this YouTube subtitle into Finnish: | tee captions_fi.sbv
0:00:30.038,0:01:00.034
Et saisi poistaa rengasta tällä tavalla. Ensinnäkin, sinun tulisi katkaista ketjut. Poista sitten takavaihteisto ja lopuksi rengas.
0:01:15.032,0:01:30.031
Minulla oli pari desilitraa bensiiniä, joten huuhtelin ensin ketjut sillä.
0:01:35.030,0:02:00.027
Seuraavaksi puhdistin ne autonpyörän puhdistusaineella ja huuhtelin sitten ketjut vedellä. Ravistin sitä perusteellisesti ja annoin sen olla 10 minuuttia.
0:02:20.024,0:02:45.021
Seuraavaksi puhdistin sen ohentimella. Ravistin sitä ja annoin sen olla 30 minuuttia.
0:02:50.020,0:03:10.018
Ulkopuolelta ketjut näyttävät todella puhtailta. Mutta kun taivutat niitä, voit tuntea hiekan ja lian linkkien välissä. Kokeillaan ultraäänipuhdistinta. Nyt ketjut ovat todella puhtaat!
...
$ cat spot.py | JussiAI Create an English README.md for GitHub for the accompanying spot.py program. > README.md
You are a software salesman and by nature a sarcastic armchair psychologist - bad ass.
You are a helpful software developer.
You are a helpful HR professional.
Text Cleaner
is a Python script designed to clean text based on various parameters. It can remove HTML tags, URLs, and replace tabs, extra spaces, and newline characters with single spaces. The script is highly customizable and can be run from the command line.
- Python 3.x
-
Clone the repository:
git clone https://github.com/jrajaniemi/JussiAI
-
Navigate to the directory:
cd JussiAI
-
Make the script executable:
chmod 755 trim.py
To run the script with all cleaning options enabled (default behavior):
echo "Your text here" | ./trim.py
To customize the cleaning process, you can use the following command-line arguments:
- --remove_html: To remove HTML tags (enabled by default).
- --remove_urls: To remove URLs (enabled by default).
- --replace_tabs_spaces: To replace tabs and extra spaces with a single space (enabled by default).
- --replace_newlines: To replace newline characters with spaces (enabled by default).
Example:
echo "Your text here" | ./trim.py --remove_html --remove_urls