Merge master to fixes_gpt3

This commit is contained in:
Taylor Brown
2023-04-02 18:30:28 -05:00
12 changed files with 55 additions and 32 deletions

2
.env.template Normal file
View File

@@ -0,0 +1,2 @@
OPENAI_API_KEY=your-openai-api-key
ELEVENLABS_API_KEY=your-elevenlabs-api-key

3
.gitignore vendored
View File

@@ -5,4 +5,5 @@ scripts/__pycache__/keys.cpython-310.pyc
package-lock.json package-lock.json
*.pyc *.pyc
scripts/auto_gpt_workspace/* scripts/auto_gpt_workspace/*
*.mpeg *.mpeg
.env

8
Dockerfile Normal file
View File

@@ -0,0 +1,8 @@
FROM python:3.11
WORKDIR /app
COPY scripts/ /app
RUN pip install -r requirements.txt
CMD ["python", "main.py"]

View File

@@ -65,9 +65,9 @@ git clone https://github.com/Torantulino/Auto-GPT.git
``` ```
2. Navigate to the project directory: 2. Navigate to the project directory:
*(Type this into your CMD window, you're aiming to navigate the CMD window to the "scripts" folder you just downloaded)* *(Type this into your CMD window, you're aiming to navigate the CMD window to the repository you just downloaded)*
``` ```
$ cd 'Auto-GPT/scripts' $ cd 'Auto-GPT'
``` ```
3. Install the required dependencies: 3. Install the required dependencies:
@@ -76,22 +76,24 @@ $ cd 'Auto-GPT/scripts'
pip install -r requirements.txt pip install -r requirements.txt
``` ```
4. Edit the file named "keys.py" in the "scripts" directory to add your OpenAI API key (and eleven labs key if you want speech): 4. Rename `.env.template` to `.env` and fill in your `OPENAI_API_KEY`. If you plan to use Speech Mode, fill in your `ELEVEN_LABS_API_KEY` as well.
*(Open the keys.py file in a text editor and follow the instructions inside, save it after)* - Obtain your OpenAI API key from: https://platform.openai.com/account/api-keys.
- Obtain your ElevenLabs API key from: https://elevenlabs.io. You can view your xi-api-key using the "Profile" tab on the website.
## 🔧 Usage ## 🔧 Usage
1. Run the Python script in your terminal: 1. Run the `main.py` Python script in your terminal:
*(Type this into your CMD window)* *(Type this into your CMD window)*
``` ```
python main.py python scripts/main.py
``` ```
2. After each of AUTO-GPT's actions, type "NEXT COMMAND" to authorise them to continue. 2. After each of AUTO-GPT's actions, type "NEXT COMMAND" to authorise them to continue.
3. To exit the program, type "exit" and press Enter. 3. To exit the program, type "exit" and press Enter.
## 🗣️ Speech Mode ## 🗣️ Speech Mode
Use this to use TTS for Auto-GPT
``` ```
python main.py speach-mode python scripts/main.py speak-mode
``` ```
## 💀 Continuous Mode ⚠️ ## 💀 Continuous Mode ⚠️
@@ -100,9 +102,9 @@ Continuous mode is not recommended.
It is potentially dangerous and may cause your AI to run forever or carry out actions you would not usually authorise. It is potentially dangerous and may cause your AI to run forever or carry out actions you would not usually authorise.
Use at your own risk. Use at your own risk.
1. Run the Python script in your terminal: 1. Run the `main.py` Python script in your terminal:
``` ```
python main.py continuous-mode python scripts/main.py continuous-mode
``` ```
2. To exit the program, press Ctrl + C 2. To exit the program, press Ctrl + C

11
requirements.txt Normal file
View File

@@ -0,0 +1,11 @@
beautifulsoup4==4.9.3
colorama==0.4.6
dirtyjson==1.0.8
docker==5.0.3
googlesearch-python==1.1.0
openai==0.27.2
playsound==1.3.0
python-dotenv==1.0.0
pyyaml==6.0
readability-lxml==0.8.1
requests==2.25.1

View File

@@ -88,7 +88,7 @@ def summarize_text(text, is_website=True):
messages = [ messages = [
{ {
"role": "user", "role": "user",
"content": "Please summarize the following website text, do not describe the general website, but instead concisely extract the specifc information this subpage contains.: " + "content": "Please summarize the following website text, do not describe the general website, but instead concisely extract the specific information this subpage contains.: " +
chunk}, chunk},
] ]
else: else:
@@ -116,7 +116,7 @@ def summarize_text(text, is_website=True):
messages = [ messages = [
{ {
"role": "user", "role": "user",
"content": "Please summarize the following website text, do not describe the general website, but instead concisely extract the specifc information this subpage contains.: " + "content": "Please summarize the following website text, do not describe the general website, but instead concisely extract the specific information this subpage contains.: " +
combined_summary}, combined_summary},
] ]
else: else:

View File

@@ -1,9 +1,13 @@
import os
import time import time
import openai import openai
import keys from dotenv import load_dotenv
# Load environment variables from .env file
load_dotenv()
# Initialize the OpenAI API client # Initialize the OpenAI API client
openai.api_key = keys.OPENAI_API_KEY openai.api_key = os.getenv("OPENAI_API_KEY")
def create_chat_message(role, content): def create_chat_message(role, content):

View File

@@ -1,5 +0,0 @@
# Get yours from: https://beta.openai.com/account/api-keys
OPENAI_API_KEY = "YOUR-OPENAI-KEY"
# To access your ElevenLabs API key, head to https://elevenlabs.io, you
# can view your xi-api-key using the 'Profile' tab on the website.
ELEVENLABS_API_KEY = "YOUR-ELEVENLABS-KEY"

View File

@@ -11,11 +11,17 @@ import speak
from enum import Enum, auto from enum import Enum, auto
import sys import sys
from config import Config from config import Config
from dotenv import load_dotenv
from json_parser import fix_and_parse_json from json_parser import fix_and_parse_json
from ai_config import AIConfig from ai_config import AIConfig
import traceback import traceback
import yaml import yaml
# Load environment variables from .env file
load_dotenv()
class Argument(Enum): class Argument(Enum):
CONTINUOUS_MODE = "continuous-mode" CONTINUOUS_MODE = "continuous-mode"
SPEAK_MODE = "speak-mode" SPEAK_MODE = "speak-mode"

View File

@@ -1,10 +0,0 @@
beautifulsoup4==4.9.3
colorama==0.4.6
dirtyjson==1.0.8
docker==6.0.1
googlesearch_python==1.1.0
openai==0.27.0
playsound==1.2.2
pyyaml==6.0
readability_lxml==0.8.1
requests==2.25.1

View File

@@ -1,13 +1,17 @@
import os import os
from playsound import playsound from playsound import playsound
import requests import requests
import keys from dotenv import load_dotenv
# Load environment variables from .env file
load_dotenv()
voices = ["ErXwobaYiN019PkySvjV", "EXAVITQu4vr4xnSDxMaL"] voices = ["ErXwobaYiN019PkySvjV", "EXAVITQu4vr4xnSDxMaL"]
tts_headers = { tts_headers = {
"Content-Type": "application/json", "Content-Type": "application/json",
"xi-api-key": keys.ELEVENLABS_API_KEY "xi-api-key": os.getenv("ELEVENLABS_API_KEY")
} }