Squashed commit of the following:

commit 7b16b63f5f269baa0441ee171d906419585d2526
Author: wunderwuzzi23 <johannr@wunderwuzzi.net>
Date:   Sat Mar 18 19:34:34 2023 -0700

    update text

commit d99b7ebf211a517d74fcf3241843e78a71e99d05
Author: wunderwuzzi23 <johannr@wunderwuzzi.net>
Date:   Sat Mar 18 19:31:28 2023 -0700

    fix formatting

commit 65b1f6218cc32f0a0001637b22b9f1b4640de983
Author: wunderwuzzi23 <johannr@wunderwuzzi.net>
Date:   Sat Mar 18 19:17:08 2023 -0700

    updating messages

commit 314071228395a595503dc3a15fda2b3c8b5e6095
Author: wunderwuzzi23 <johannr@wunderwuzzi.net>
Date:   Sat Mar 18 19:13:40 2023 -0700

    updating install.bat for yolo.yaml settings

commit 85c9f381415c86e7c95572bdcbd98d6478f616ef
Author: wunderwuzzi23 <johannr@wunderwuzzi.net>
Date:   Sat Mar 18 19:08:09 2023 -0700

    load yolo.yaml from executing directory

commit d9ee70035e186c8b21875d58e7a7bf3f980eaa60
Author: wunderwuzzi23 <johannr@wunderwuzzi.net>
Date:   Sat Mar 18 18:43:45 2023 -0700

    update readme

commit f2ae85827c675e3f2c87bf4d455709e227e1bfb4
Author: wunderwuzzi23 <johannr@wunderwuzzi.net>
Date:   Sat Mar 18 18:37:41 2023 -0700

    cleanup

commit fc5cf55982dd6de3a4e81de2b0286f18788bc87c
Author: wunderwuzzi23 <johannr@wunderwuzzi.net>
Date:   Sat Mar 18 18:31:00 2023 -0700

    fix formatting

commit 3ec4cf959cf4a43d061b0d579c863af5bb495631
Author: wunderwuzzi23 <johannr@wunderwuzzi.net>
Date:   Sat Mar 18 18:27:49 2023 -0700

    set safety: True in config

commit d13153141bbdb4ada5d9bf742b19fd9c10624c86
Author: wunderwuzzi23 <johannr@wunderwuzzi.net>
Date:   Sat Mar 18 18:25:07 2023 -0700

    update readme

commit 39f82ee8cf744ef6fbfbe6622e4d39cc6323d69a
Author: wunderwuzzi23 <johannr@wunderwuzzi.net>
Date:   Sat Mar 18 18:24:43 2023 -0700

    update readme

commit 944046c11bdcd3b01b33798dae5ca33e8ddda9db
Author: wunderwuzzi23 <johannr@wunderwuzzi.net>
Date:   Sat Mar 18 18:21:47 2023 -0700

    update requirements

commit 0c22313bdc6b3a9f272faf99b9998930ede9502a
Author: wunderwuzzi23 <johannr@wunderwuzzi.net>
Date:   Sat Mar 18 18:15:17 2023 -0700

    formatting

commit 08e16c67ad8fd588962f9bf22fe0588ac4c0ec3a
Author: wunderwuzzi23 <johannr@wunderwuzzi.net>
Date:   Sat Mar 18 17:39:35 2023 -0700

    default gpt-3.5-turbo (gpt-4 is waitlist for many)

commit eec224fe3b34a2627d771682cde291ccdf96bcac
Author: wunderwuzzi23 <johannr@wunderwuzzi.net>
Date:   Sat Mar 18 17:16:57 2023 -0700

    add yolo.yaml, gpt-4 support, improve install.sh
This commit is contained in:
wunderwuzzi23
2023-03-18 19:38:38 -07:00
parent 39a010c48e
commit d42082f8fe
6 changed files with 154 additions and 107 deletions
+34 -13
View File
@@ -2,6 +2,27 @@
![Animated GIF](https://github.com/wunderwuzzi23/blog/raw/master/static/images/2023/yolo-shell-anim-gif.gif)
# Update Yolo v0.2 - Support for GPT-4 API
This update introduces the `yolo.yaml` configuration file. In this file you can specify which OpenAI model you want to query, and other settings. The safety switch also moved into this configuration file.
For now the default model is still `gpt-3.5-turbo`, but you can update to `gpt-4` if you have gotten access already!
```
Yolo v0.2 - by @wunderwuzzi23
Usage: yolo [-a] list the current directory information
Argument: -a: Prompt the user before running the command (only useful when safety is off)
Current configuration per yolo.yaml:
* Model : gpt-3.5-turbo
* Temperature : 0
* Max. Tokens : 500
* Safety : on
```
Happy Hacking!
# Installation on Linux and macOS
```
@@ -17,17 +38,18 @@ yolo show me some funny unicode characters
## OpenAI API Key configuration
There are two ways to configure the key on Linux and macOS:
There are three ways to configure the key on Linux and macOS:
- You can either `export OPENAI_API_KEY=<yourkey>`, or have a `.env` file in the same directory as `yolo.py` with `OPENAI_API_KEY="<yourkey>"` as a line
- Create a file at `~/.openai.apikey` with the key in it
- Add the key to the `yolo.yaml` configuration file
## Aliases
To set the alias, like `yolo` or `computer` on each login, add them to your .bashrc or .bash_aliases file. (zsh on macOS)
To set the alias, like `yolo` or `computer` on each login, add them to .bash_aliases (or .zshrc on macOS) file. Make sure the path is the one you want to use.
```
echo "alias yolo=$TARGET_FULLPATH" >> ~/.bash_aliases
echo "alias computer=$TARGET_FULLPATH" >> ~/.bash_aliases
echo "alias yolo=$(pwd)/yolo.py" >> ~/.bash_aliases
echo "alias computer=$(pwd)/yolo.py" >> ~/.bash_aliases
```
## Installation script
@@ -35,21 +57,20 @@ echo "alias computer=$TARGET_FULLPATH" >> ~/.bash_aliases
Another option is to run `source install.sh` after cloning the repo. That does the following:
1. Copies the necessary files to `~/yolo-ai-cmdbot/`
2. Creates two aliases `yolo` and `computer` pointint to `~/yolo-ai-cmdbot/yolo.py`
3. Adds the aliases to the `~/bash_aliases` file (only tested on Ubuntu)
3. Adds the aliases to the `~/.bash_aliases` or `~/.zshrc` file
That's it for Linux and macOS. Now make sure you have an OpenAI API key set.
# Windows Installation
On Windows run `.\install.bat` (or double-click) after cloning the repo. By default it does the following:
On Windows you can run `.\install.bat` (or double-click) after cloning the repo. By default it does the following:
1. Copies the necessary files to `~\yolo-ai-cmdbot\`
2. Creates a `yolo.bat` file in `~` that lets you run equivalent to `python.exe ~\yolo-ai-cmdbot\yolo.py`
You also have the option to:
1. Change the location where `yolo-ai-cmdbot\` and `yolo.bat` will be created
2. Skip creating `yolo-ai-cmdbot\` and use the folder of the cloned repository instead.
3. Create a `.openai.apikey` and/or `.yolo-safety-off` file in your `~` directory
3. Create a `.openai.apikey` file in your `~` directory
That's it basically.
@@ -60,6 +81,8 @@ On Windows `export OPENAI_API_KEY=<yourkey>` will not work instead:
- Or, Run PowerShell as administrator and run `setx OPENAI_API_KEY "<yourkey>"`
- Or, Go to `Start` and search `edit environment variables for your account` and manually create the variable with name `OPENAI_API_KEY` and value `<yourkey>`
Optionally (since v.0.2), the key can also be stored in `yolo.yaml`.
## Running yolo on Windows
Windows is less tested, it does work though and will use PowerShell.
@@ -88,13 +111,11 @@ Have fun.
# Disabling the safety switch! **Caution!**
By default `yolo` will prompt the user before executing commands. To have yolo run commands right away when they come back from ChatGPT create a file named `~/.yolo-safety-off`.
By default `yolo` will prompt the user before executing commands.
A simple command to do that on Linux would be:
Since v.0.2 the safety switch setting moved to `yolo.yaml`, the old `~/.yolo-safety-off` is not used anymore.
```
touch ~/.yolo-safety-off
```
To have yolo run commands right away when they come back from ChatGPT change the `safety` in the `yolo.yaml` to `False`.
If you still want to inspect the command that is executed when safety is off, add the `-a` argument, e.g `yolo -a delete the file test.txt`.