Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation refresh #471

Merged
merged 8 commits into from
Feb 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,9 @@ These commands are grouped, so each group has a prefix, but you can easily tab c
- `/index discord_backup` - Use the last 3000 messages of every channel on your Discord server as an index. Needs both an admin and an index role.
- `/index chat user_index:<user_index> search_index:<search_index>` - Chat with your documents that you've indexed previously!

### DALL-E2 Commands
- `/dalle draw <prompt>` - Have DALL-E generate images based on a prompt.
### DALL-E Commands
- `/dalle draw <prompt>` - Have DALL-E 3 generate images based on a prompt.
- `/dalle draw_old <prompt>` - Have DALL-E 2 generate images based on a prompt.
- `/dalle optimize <image prompt text>` - Optimize a given prompt text for DALL-E image generation.

### System and Settings
Expand All @@ -135,8 +136,8 @@ These commands are grouped, so each group has a prefix, but you can easily tab c
- `/system usage` - Estimate current usage details (based on Davinci).
- `/system settings low_usage_mode True/False` - Turn low usage mode on and off. If on, it will use the curie-001 model, and if off, it will use the Davinci-003 model.
- `/system delete-conversation-threads` - Delete all threads related to this bot across all servers.
- `/system local-size` - Get the size of the local dalleimages folder.
- `/system clear-local` - Clear all the local dalleimages.
- `/system local-size` - Get the size of the local `/dalleimages` folder.
- `/system clear-local` - Delete all the contents of `/dalleimages`.

# Step-by-Step Guides for GPTDiscord
[**GPTDiscord Guides**](https://github.com/Kav-K/GPTDiscord/tree/main/detailed_guides)
Expand Down
9 changes: 3 additions & 6 deletions detailed_guides/AI-MODERATION.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
### Automatic AI Moderation
***
`/mod set status:on` - Turn on automatic chat moderations.

`/mod set status:off` - Turn off automatic chat moderations
Expand All @@ -12,15 +12,12 @@

The bot needs Administrative permissions for this, and you need to set `MODERATIONS_ALERT_CHANNEL` to the channel ID of a desired channel in your .env file if you want to receive alerts about moderated messages.

This uses the OpenAI Moderations endpoint to check for messages, requests are only sent to the moderations endpoint at a MINIMUM request gap of 0.5 seconds, to ensure you don't get blocked and to ensure reliability.
This uses the OpenAI Moderations endpoint to check for messages; requests are only sent to the moderations endpoint at a MINIMUM request gap of 0.5 seconds, to ensure you don't get blocked and to ensure reliability.

The bot uses numerical thresholds to determine whether a message is toxic or not, and I have manually tested and fine tuned these thresholds to a point that I think is good, please open an issue if you have any suggestions for the thresholds!

There are two thresholds for the bot, there are instances in which the bot will outright delete a message and an instance where the bot will send a message to the alert channel notifying admins and giving them quick options to delete and timeout the user (check out the screenshots at the beginning of the README to see this).
There are two thresholds for the bot, there are instances in which the bot will outright delete a message and an instance where the bot will send a message to the alert channel notifying admins and giving them quick options to delete and timeout the user.

To set a certain role immune to moderations, add the line `CHAT_BYPASS_ROLES="Role1,Role2,etc"` to your `.env file.

If you want to have the bot pre-moderate things sent to commands like /gpt ask, /gpt edit, /dalle draw, etc, you can set `PRE_MODERATE="True"` in the `.env` file.

**The above server is NOT for support or discussions about GPT3Discord**

60 changes: 43 additions & 17 deletions detailed_guides/AI-SEARCH.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,74 +5,100 @@ GOOGLE_SEARCH_API_KEY="...."
GOOGLE_SEARCH_ENGINE_ID="...."
```

You first need to create a programmable search engine and get the search engine ID: https://developers.google.com/custom-search/docs/tutorial/creatingcse
You first need to create a programmable search engine and get the search engine ID [here](https://developers.google.com/custom-search/docs/tutorial/creatingcse).

Then you can get the API key, click the "Get a key" button on this page: https://developers.google.com/custom-search/v1/introduction
Then you can get the API key, click the "Get a key" button [on this page](https://developers.google.com/custom-search/v1/introduction).

You can limit the max price that is charged for a single search request by setting `MAX_SEARCH_PRICE` in your `.env` file.


Step by Step Guide:
---


1\. Go to the [Programmable Search Engine docs](https://developers.google.com/custom-search/docs/tutorial/creatingcse) to get a Search engine ID
----------------------------------------------------------------------

1\. Go to the [Programmable Search Engine docs](https://developers.google.com/custom-search/docs/tutorial/creatingcse) to get a Search engine ID.
---

2\. Click on "Control Panel" under "Defining a Programmable Engine in Control Panel"
----------------------------------------
a. Click on "Control Panel" under "Defining a Programmable Engine in Control Panel"

Click to sign in(make a Google acct if you do not have one):
b. Click to sign in(make a Google account if you do not have one):

![image](https://user-images.githubusercontent.com/23362597/233266042-98098ed5-72b2-41b3-9495-1a9f4d7e1101.png)


3\. Register yourself a new account/Login to the Control Panel
2\. Register yourself a new account/Login to the Control Panel
-----------------------------------

After logging in, you will be redirected to the Control Panel to create a new search engine:

![image](https://user-images.githubusercontent.com/23362597/233266323-53232468-2590-4820-b55f-08c78529d752.png)


4\. Create a new search engine
3\. Create a new search engine
------------------------------

Fill in a name, select to "Search the entire web" and hit "Create":

![image](https://user-images.githubusercontent.com/23362597/233266738-b70f004d-4324-482e-a945-9b0193b60158.png)


5\. Copy your Search engine ID to your .env file
4\. Copy your Search engine ID to your .env file
--------------------------

![image](https://user-images.githubusercontent.com/23362597/233267123-ea25a3bb-6cdb-4d46-a893-846ea4933632.png)


6\. Go to [custom-search docs](https://developers.google.com/custom-search/v1/introduction) to get a Google search API key
5\. Go to [custom-search docs](https://developers.google.com/custom-search/v1/introduction) to get a Google search API key
-------------------------------------------------

Click "Get a Key":

![image](https://user-images.githubusercontent.com/23362597/233267659-f82621f4-1f0b-46bf-8994-be443dd79932.png)


7\. Name your project and agree to the Terms of Service
6\. Name your project and agree to the Terms of Service
------------------------------------

![image](https://user-images.githubusercontent.com/23362597/233267793-ca3c273d-ebc6-44a5-a49d-0d4c3223c992.png)


8\. Copy your Google search API key to your .env file
7\. Copy your Google search API key to your .env file
------------------------------------

![image](https://user-images.githubusercontent.com/23362597/233268067-5a6cfaf1-bec0-48b3-8add-70b218fb4264.png)


9\. Enable Cloud Vision API for image recognition
8\. Enable Cloud Vision API for image recognition
------------------------------------
a. Navigate to the Google Cloud API console [here](https://console.cloud.google.com/apis/api/vision.googleapis.com/).

b. Click on 'Create Project':

![image](https://github.com/Raecaug/GPTDiscord/assets/23362597/f128cc80-2a53-4578-9f4e-99791d7f8ffe)


c. Give it a name and create it:

![image](https://github.com/Raecaug/GPTDiscord/assets/23362597/35050805-f2ad-4489-8d8c-dacbd961c0b1)


d. Now, navigate to the API Library:

![image](https://github.com/Raecaug/GPTDiscord/assets/23362597/0eff23c1-09c1-4e65-a08a-a56af5515727)


e. Search for the 'Cloud Vision API' and enable it:

![image](https://github.com/Raecaug/GPTDiscord/assets/23362597/ef225dbe-4385-4263-b0aa-7100bbfed0e8)


9\. Enable Custom Search API for Google search
------------------------------------

https://console.cloud.google.com/apis/api/vision.googleapis.com/
You can follow [this link](https://console.cloud.google.com/apis/api/customsearch.googleapis.com/) to quickly jump to the page to enable the custom search API. You may need to first selet the project you created before:

![image](https://github.com/Raecaug/GPTDiscord/assets/23362597/875039dc-88b8-47a2-ad6e-4d39be26781d)

10\. Enable Custom Search API for Google search
![image](https://github.com/Raecaug/GPTDiscord/assets/23362597/3a0f4200-7319-4a2f-8fb1-9d85bffb387a)

https://console.cloud.google.com/apis/api/customsearch.googleapis.com/
23 changes: 17 additions & 6 deletions detailed_guides/CODE-INTERPRETER.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,28 @@
# Code Interpreter
This bot supports a full fledged version of Code Interpreter, where code in various languages can be executed directly in discord. You can even install python and system packages. Python is the preferred language for code interpreter, although it will still work relatively nicely with other popular languages.
This bot supports a full fledged version of Code Interpreter, where code in various languages can be executed directly in Discord. You can even install Python and system packages. Python is the preferred language for code interpreter, although it will still work relatively nicely with other popular languages.

To get started with code interpreter, you need an E2B API key. You can find an E2B API key at https://e2b.dev/docs/getting-started/api-key
To get started with code interpreter, you need an E2B API key. You can find an E2B API key & more info on FoundryLabs [here](https://e2b.dev/docs/getting-started/api-key).
```env
E2B_API_KEY="...."
```

Like above, add the E2B API key to your `.env` file. E2B is a cloud-based isolated execution environment, so that you can run code safely and have a containerized environment to install packages and etc in.
Like above, add the E2B API key to your `.env` file. E2B is a cloud-based isolated execution environment, so that you can run code safely and have a containerized environment to install packages and execute code, etc in.

Afterwards, to use code interpreter, simply use `/code chat`.

When you begin a code interpreter instance, a new isolated environment to run your code is automatically created. Inside your chat, you can ask GPT to install python or system packages into this environment, and ask GPT to run any sort of python (and other language) code within it as well. Unlike ChatGPT's code interpreter / advanced data analysis, this also has access to the internet so you can work with code that uses the network as well.
When you begin a code interpreter instance, a new isolated environment to run your code is automatically created. Inside your chat, you can ask GPT to install Python or system packages into this environment, and ask GPT to run any sort of python (and other language) code within it as well. Unlike ChatGPT's code interpreter / advanced data analysis, this also has access to the internet so you can work with code that uses the network as well.

When ChatGPT executes code, sometimes it will create files (especially if you ask it to). If files are created, they can be downloaded from the "Download Artifacts" button that will pop up after the code is executed.

Sometimes, ChatGPT will create files that are not in the upstream `artifacts` folder. To remedy this, simply ask it to ensure all files it makes are within `artifacts`.
As per the E2B documentation, the free tier provides the following resources to a sandboxed code instance:

> - 2 vCPU
> - 512 MB RAM
> - 1 GB free disk storage
> - 24 hours max sandbox session length

Given that it is possible to maintain and use a thread over multiple days with GPTDiscord, exceeding the instance limits of your E2B API key will cause the thread to break and not reply. In this case, you will need to end & restart the thread to continue conversing.


When ChatGPT executes code, sometimes it will create files (especially if you ask it to within your instructions) in a folder called `artifacts`. If files are created, they can be downloaded from the "Download Artifacts" button that will pop up after the code is executed.

Sometimes, ChatGPT will create files that are not placed in the upstream `artifacts` folder. To remedy this, simply ask it to ensure all files it makes are within `artifacts`.
11 changes: 10 additions & 1 deletion detailed_guides/INSTALLATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,18 +111,27 @@ curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python3.9 get-pip.py
```

#### Create a Python Virtual Enviroment
```shell
pip install virtualenv
python3.9 -m venv venv
source venv/bin/activate
```


#### Install project dependencies
```
python3.9 -m pip install --ignore-installed PyYAML
python3.9 -m pip install torch==1.13.1+cpu torchvision==0.14.1+cpu -f https://download.pytorch.org/whl/torch_stable.html
python3.9 -m pip install urllib3==1.26.7
python3.9 -m pip install git+https://github.com/openai/whisper.git
python3.9 -m pip install -r requirements.txt
python3.9 -m pip install .
```

#### Copy the sample.env file into a regular .env file. `DEBUG_GUILD` and the ID for `ALLOWED_GUILDS` can be found by right-clicking your server and choosing "Copy ID". Similarly, `DEBUG_CHANNEL` can be found by right-clicking your debug channel.
```shell
cp .env .env
cp sample.env .env
```

#### The command below is used to edit the .env file and to put in your API keys. You can right click within the editor after running this command to paste. When you are done editing, press CTRL + X, and then type Y, to save.
Expand Down
12 changes: 5 additions & 7 deletions detailed_guides/INTERNET-CONNECTED-CHAT.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,21 @@ Follow the on-screen instructions to register a new account.
![image](https://user-images.githubusercontent.com/23362597/232921997-1c6ed4dc-7aea-459b-8d76-95fdf86ee108.png)


4\. Access the Wolfram Developer Portal
4\. Access the [Wolfram Developer Portal](https://developer.wolframalpha.com/access)
------------------------------

After successful registration, you will be redirected to the Developer Portal:
After successful registration, you will be redirected to the Developer Portal, or follow the link above:

![image](https://user-images.githubusercontent.com/23362597/232922409-92af9237-1230-43dc-836a-7425f31b4f56.png)
![image](https://github.com/Raecaug/GPTDiscord/assets/23362597/a32542c8-7060-4411-a92e-e3eb5ae06433)


5\. Click on "Get an AppID"
--------------------------

![image](https://user-images.githubusercontent.com/23362597/232922639-919f6d5a-da05-4f2c-af4b-5c517a926e78.png)

6\. Fill in a name and description:
6\. Fill in a name and description and select "Full Results API" from the dropdown:
-------------------------------------------------

![image](https://user-images.githubusercontent.com/23362597/232922798-25b21534-4452-4851-ae72-940b9f9d1fae.png)
![image](https://github.com/Raecaug/GPTDiscord/assets/23362597/173de276-74d9-472c-a513-2420a14e34a7)


8\. Copy the newly generated AppID to your ".env" file
Expand Down
3 changes: 3 additions & 0 deletions sample.env
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,6 @@ PRE_MODERATE = "False"

## Force only english to be spoken in the server
FORCE_ENGLISH = "False"

## Launch a HTTP endpoint at <host>:8181/ that will return a json response of the bot's status and uptime(good for cloud app containers)
HEALTH_SERVICE_ENABLED="False"
Loading