Merge branch 'Significant-Gravitas:master' into master

This commit is contained in:
ZHAOKAI WANG
2023-04-21 10:01:03 +08:00
committed by GitHub
117 changed files with 3203 additions and 4635 deletions

View File

@@ -1,10 +1,10 @@
# [Choice] Python version (use -bullseye variants on local arm64/Apple Silicon): 3, 3.10, 3.9, 3.8, 3.7, 3.6, 3-bullseye, 3.10-bullseye, 3.9-bullseye, 3.8-bullseye, 3.7-bullseye, 3.6-bullseye, 3-buster, 3.10-buster, 3.9-buster, 3.8-buster, 3.7-buster, 3.6-buster
# [Choice] Python version (use -bullseye variants on local arm64/Apple Silicon): 3, 3.10, 3-bullseye, 3.10-bullseye, 3-buster, 3.10-buster
ARG VARIANT=3-bullseye
FROM --platform=linux/amd64 python:3.8
FROM --platform=linux/amd64 python:3.10
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
# Remove imagemagick due to https://security-tracker.debian.org/tracker/CVE-2019-10131
&& apt-get purge -y imagemagick imagemagick-6-common
&& apt-get purge -y imagemagick imagemagick-6-common
# Temporary: Upgrade python packages due to https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-40897
# They are installed by the base image (python) which does not have the patch.
@@ -25,4 +25,4 @@ RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
# && apt-get -y install --no-install-recommends <your-package-list-here>
# [Optional] Uncomment this line to install global node packages.
# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g <your-package-here>" 2>&1
# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g <your-package-here>" 2>&1

View File

@@ -1,174 +1,197 @@
################################################################################
### AUTO-GPT - GENERAL SETTINGS
################################################################################
# EXECUTE_LOCAL_COMMANDS - Allow local command execution (Example: False)
EXECUTE_LOCAL_COMMANDS=False
# BROWSE_CHUNK_MAX_LENGTH - When browsing website, define the length of chunk stored in memory
BROWSE_CHUNK_MAX_LENGTH=8192
# BROWSE_SUMMARY_MAX_TOKEN - Define the maximum length of the summary generated by GPT agent when browsing website
BROWSE_SUMMARY_MAX_TOKEN=300
# USER_AGENT - Define the user-agent used by the requests library to browse website (string)
## EXECUTE_LOCAL_COMMANDS - Allow local command execution (Default: False)
## RESTRICT_TO_WORKSPACE - Restrict file operations to workspace ./auto_gpt_workspace (Default: True)
# EXECUTE_LOCAL_COMMANDS=False
# RESTRICT_TO_WORKSPACE=True
## USER_AGENT - Define the user-agent used by the requests library to browse website (string)
# USER_AGENT="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36"
# AI_SETTINGS_FILE - Specifies which AI Settings file to use (defaults to ai_settings.yaml)
AI_SETTINGS_FILE=ai_settings.yaml
# USE_WEB_BROWSER - Sets the web-browser drivers to use with selenium (defaults to chrome).
# Note: set this to either 'chrome', 'firefox', or 'safari' depending on your current browser
# USE_WEB_BROWSER=chrome
## AI_SETTINGS_FILE - Specifies which AI Settings file to use (defaults to ai_settings.yaml)
# AI_SETTINGS_FILE=ai_settings.yaml
################################################################################
### LLM PROVIDER
################################################################################
### OPENAI
# OPENAI_API_KEY - OpenAI API Key (Example: my-openai-api-key)
# TEMPERATURE - Sets temperature in OpenAI (Default: 0)
# USE_AZURE - Use Azure OpenAI or not (Default: False)
## OPENAI_API_KEY - OpenAI API Key (Example: my-openai-api-key)
## TEMPERATURE - Sets temperature in OpenAI (Default: 0)
## USE_AZURE - Use Azure OpenAI or not (Default: False)
OPENAI_API_KEY=your-openai-api-key
TEMPERATURE=0
USE_AZURE=False
# TEMPERATURE=0
# USE_AZURE=False
### AZURE
# cleanup azure env as already moved to `azure.yaml.template`
# moved to `azure.yaml.template`
################################################################################
### LLM MODELS
################################################################################
# SMART_LLM_MODEL - Smart language model (Default: gpt-4)
# FAST_LLM_MODEL - Fast language model (Default: gpt-3.5-turbo)
SMART_LLM_MODEL=gpt-4
FAST_LLM_MODEL=gpt-3.5-turbo
## SMART_LLM_MODEL - Smart language model (Default: gpt-4)
## FAST_LLM_MODEL - Fast language model (Default: gpt-3.5-turbo)
# SMART_LLM_MODEL=gpt-4
# FAST_LLM_MODEL=gpt-3.5-turbo
### LLM MODEL SETTINGS
# FAST_TOKEN_LIMIT - Fast token limit for OpenAI (Default: 4000)
# SMART_TOKEN_LIMIT - Smart token limit for OpenAI (Default: 8000)
# When using --gpt3only this needs to be set to 4000.
FAST_TOKEN_LIMIT=4000
SMART_TOKEN_LIMIT=8000
## FAST_TOKEN_LIMIT - Fast token limit for OpenAI (Default: 4000)
## SMART_TOKEN_LIMIT - Smart token limit for OpenAI (Default: 8000)
## When using --gpt3only this needs to be set to 4000.
# FAST_TOKEN_LIMIT=4000
# SMART_TOKEN_LIMIT=8000
################################################################################
### MEMORY
################################################################################
### MEMORY_BACKEND - Memory backend type
# local - Default
# pinecone - Pinecone (if configured)
# redis - Redis (if configured)
MEMORY_BACKEND=local
## local - Default
## pinecone - Pinecone (if configured)
## redis - Redis (if configured)
## milvus - Milvus (if configured)
## MEMORY_INDEX - Name of index created in Memory backend (Default: auto-gpt)
# MEMORY_BACKEND=local
# MEMORY_INDEX=auto-gpt
### PINECONE
# PINECONE_API_KEY - Pinecone API Key (Example: my-pinecone-api-key)
# PINECONE_ENV - Pinecone environment (region) (Example: us-west-2)
PINECONE_API_KEY=your-pinecone-api-key
PINECONE_ENV=your-pinecone-region
## PINECONE_API_KEY - Pinecone API Key (Example: my-pinecone-api-key)
## PINECONE_ENV - Pinecone environment (region) (Example: us-west-2)
# PINECONE_API_KEY=your-pinecone-api-key
# PINECONE_ENV=your-pinecone-region
### REDIS
# REDIS_HOST - Redis host (Default: localhost)
# REDIS_PORT - Redis port (Default: 6379)
# REDIS_PASSWORD - Redis password (Default: "")
# WIPE_REDIS_ON_START - Wipes data / index on start (Default: False)
# MEMORY_INDEX - Name of index created in Redis database (Default: auto-gpt)
REDIS_HOST=localhost
REDIS_PORT=6379
REDIS_PASSWORD=
WIPE_REDIS_ON_START=False
MEMORY_INDEX=auto-gpt
## REDIS_HOST - Redis host (Default: localhost, use "redis" for docker-compose)
## REDIS_PORT - Redis port (Default: 6379)
## REDIS_PASSWORD - Redis password (Default: "")
## WIPE_REDIS_ON_START - Wipes data / index on start (Default: True)
# REDIS_HOST=localhost
# REDIS_PORT=6379
# REDIS_PASSWORD=
# WIPE_REDIS_ON_START=True
### WEAVIATE
# MEMORY_BACKEND - Use 'weaviate' to use Weaviate vector storage
# WEAVIATE_HOST - Weaviate host IP
# WEAVIATE_PORT - Weaviate host port
# WEAVIATE_PROTOCOL - Weaviate host protocol (e.g. 'http')
# USE_WEAVIATE_EMBEDDED - Whether to use Embedded Weaviate
# WEAVIATE_EMBEDDED_PATH - File system path were to persist data when running Embedded Weaviate
# WEAVIATE_USERNAME - Weaviate username
# WEAVIATE_PASSWORD - Weaviate password
# WEAVIATE_API_KEY - Weaviate API key if using API-key-based authentication
# MEMORY_INDEX - Name of index to create in Weaviate
WEAVIATE_HOST="127.0.0.1"
WEAVIATE_PORT=8080
WEAVIATE_PROTOCOL="http"
USE_WEAVIATE_EMBEDDED=False
WEAVIATE_EMBEDDED_PATH="/home/me/.local/share/weaviate"
WEAVIATE_USERNAME=
WEAVIATE_PASSWORD=
WEAVIATE_API_KEY=
MEMORY_INDEX=AutoGpt
## MEMORY_BACKEND - Use 'weaviate' to use Weaviate vector storage
## WEAVIATE_HOST - Weaviate host IP
## WEAVIATE_PORT - Weaviate host port
## WEAVIATE_PROTOCOL - Weaviate host protocol (e.g. 'http')
## USE_WEAVIATE_EMBEDDED - Whether to use Embedded Weaviate
## WEAVIATE_EMBEDDED_PATH - File system path were to persist data when running Embedded Weaviate
## WEAVIATE_USERNAME - Weaviate username
## WEAVIATE_PASSWORD - Weaviate password
## WEAVIATE_API_KEY - Weaviate API key if using API-key-based authentication
# WEAVIATE_HOST="127.0.0.1"
# WEAVIATE_PORT=8080
# WEAVIATE_PROTOCOL="http"
# USE_WEAVIATE_EMBEDDED=False
# WEAVIATE_EMBEDDED_PATH="/home/me/.local/share/weaviate"
# WEAVIATE_USERNAME=
# WEAVIATE_PASSWORD=
# WEAVIATE_API_KEY=
### MILVUS
# MILVUS_ADDR - Milvus remote address (e.g. localhost:19530)
# MILVUS_COLLECTION - Milvus collection,
# change it if you want to start a new memory and retain the old memory.
MILVUS_ADDR=your-milvus-cluster-host-port
MILVUS_COLLECTION=autogpt
## MILVUS_ADDR - Milvus remote address (e.g. localhost:19530)
## MILVUS_COLLECTION - Milvus collection,
## change it if you want to start a new memory and retain the old memory.
# MILVUS_ADDR=your-milvus-cluster-host-port
# MILVUS_COLLECTION=autogpt
################################################################################
### IMAGE GENERATION PROVIDER
################################################################################
### OPEN AI
# IMAGE_PROVIDER - Image provider (Example: dalle)
IMAGE_PROVIDER=dalle
## IMAGE_PROVIDER - Image provider (Example: dalle)
## IMAGE_SIZE - Image size (Example: 256)
## DALLE: 256, 512, 1024
# IMAGE_PROVIDER=dalle
# IMAGE_SIZE=256
### HUGGINGFACE
# STABLE DIFFUSION
# (Default URL: https://api-inference.huggingface.co/models/CompVis/stable-diffusion-v1-4)
# Set in image_gen.py)
# HUGGINGFACE_API_TOKEN - HuggingFace API token (Example: my-huggingface-api-token)
HUGGINGFACE_API_TOKEN=your-huggingface-api-token
## HUGGINGFACE_IMAGE_MODEL - Text-to-image model from Huggingface (Default: CompVis/stable-diffusion-v1-4)
## HUGGINGFACE_API_TOKEN - HuggingFace API token (Example: my-huggingface-api-token)
# HUGGINGFACE_IMAGE_MODEL=CompVis/stable-diffusion-v1-4
# HUGGINGFACE_API_TOKEN=your-huggingface-api-token
### STABLE DIFFUSION WEBUI
## SD_WEBUI_AUTH - Stable diffusion webui username:password pair (Example: username:password)
## SD_WEBUI_URL - Stable diffusion webui API URL (Example: http://127.0.0.1:7860)
# SD_WEBUI_AUTH=
# SD_WEBUI_URL=http://127.0.0.1:7860
################################################################################
### AUDIO TO TEXT PROVIDER
################################################################################
### HUGGINGFACE
HUGGINGFACE_AUDIO_TO_TEXT_MODEL=facebook/wav2vec2-base-960h
# HUGGINGFACE_AUDIO_TO_TEXT_MODEL=facebook/wav2vec2-base-960h
################################################################################
### GIT Provider for repository actions
################################################################################
### GITHUB
# GITHUB_API_KEY - Github API key / PAT (Example: github_pat_123)
# GITHUB_USERNAME - Github username
GITHUB_API_KEY=github_pat_123
GITHUB_USERNAME=your-github-username
## GITHUB_API_KEY - Github API key / PAT (Example: github_pat_123)
## GITHUB_USERNAME - Github username
# GITHUB_API_KEY=github_pat_123
# GITHUB_USERNAME=your-github-username
################################################################################
### SEARCH PROVIDER
### WEB BROWSING
################################################################################
### BROWSER
## HEADLESS_BROWSER - Whether to run the browser in headless mode (default: True)
## USE_WEB_BROWSER - Sets the web-browser driver to use with selenium (default: chrome).
## Note: set this to either 'chrome', 'firefox', or 'safari' depending on your current browser
# HEADLESS_BROWSER=True
# USE_WEB_BROWSER=chrome
## BROWSE_CHUNK_MAX_LENGTH - When browsing website, define the length of chunks to summarize (in number of tokens, excluding the response. 75 % of FAST_TOKEN_LIMIT is usually wise )
# BROWSE_CHUNK_MAX_LENGTH=3000
## BROWSE_SPACY_LANGUAGE_MODEL is used to split sentences. Install additional languages via pip, and set the model name here. Example Chinese: python -m spacy download zh_core_web_sm
# BROWSE_SPACY_LANGUAGE_MODEL=en_core_web_sm
### GOOGLE
# GOOGLE_API_KEY - Google API key (Example: my-google-api-key)
# CUSTOM_SEARCH_ENGINE_ID - Custom search engine ID (Example: my-custom-search-engine-id)
GOOGLE_API_KEY=your-google-api-key
CUSTOM_SEARCH_ENGINE_ID=your-custom-search-engine-id
## GOOGLE_API_KEY - Google API key (Example: my-google-api-key)
## CUSTOM_SEARCH_ENGINE_ID - Custom search engine ID (Example: my-custom-search-engine-id)
# GOOGLE_API_KEY=your-google-api-key
# CUSTOM_SEARCH_ENGINE_ID=your-custom-search-engine-id
################################################################################
### TTS PROVIDER
################################################################################
### MAC OS
# USE_MAC_OS_TTS - Use Mac OS TTS or not (Default: False)
USE_MAC_OS_TTS=False
## USE_MAC_OS_TTS - Use Mac OS TTS or not (Default: False)
# USE_MAC_OS_TTS=False
### STREAMELEMENTS
# USE_BRIAN_TTS - Use Brian TTS or not (Default: False)
USE_BRIAN_TTS=False
## USE_BRIAN_TTS - Use Brian TTS or not (Default: False)
# USE_BRIAN_TTS=False
### ELEVENLABS
# ELEVENLABS_API_KEY - Eleven Labs API key (Example: my-elevenlabs-api-key)
# ELEVENLABS_VOICE_1_ID - Eleven Labs voice 1 ID (Example: my-voice-id-1)
# ELEVENLABS_VOICE_2_ID - Eleven Labs voice 2 ID (Example: my-voice-id-2)
ELEVENLABS_API_KEY=your-elevenlabs-api-key
ELEVENLABS_VOICE_1_ID=your-voice-id-1
ELEVENLABS_VOICE_2_ID=your-voice-id-2
## ELEVENLABS_API_KEY - Eleven Labs API key (Example: my-elevenlabs-api-key)
## ELEVENLABS_VOICE_1_ID - Eleven Labs voice 1 ID (Example: my-voice-id-1)
## ELEVENLABS_VOICE_2_ID - Eleven Labs voice 2 ID (Example: my-voice-id-2)
# ELEVENLABS_API_KEY=your-elevenlabs-api-key
# ELEVENLABS_VOICE_1_ID=your-voice-id-1
# ELEVENLABS_VOICE_2_ID=your-voice-id-2
################################################################################
### TWITTER API
### TWITTER API
################################################################################
TW_CONSUMER_KEY=
TW_CONSUMER_SECRET=
TW_ACCESS_TOKEN=
TW_ACCESS_TOKEN_SECRET=
# TW_CONSUMER_KEY=
# TW_CONSUMER_SECRET=
# TW_ACCESS_TOKEN=
# TW_ACCESS_TOKEN_SECRET=
################################################################################
### ALLOWLISTED PLUGINS
################################################################################
#ALLOWLISTED_PLUGINS - Sets the listed plugins that are allowed (Example: plugin1,plugin2,plugin3)
ALLOWLISTED_PLUGINS=

4
.envrc Normal file
View File

@@ -0,0 +1,4 @@
# Upon entering directory, direnv requests user permission once to automatically load project dependencies onwards.
# Eliminating the need of running "nix develop github:superherointj/nix-auto-gpt" for Nix users to develop/use Auto-GPT.
[[ -z $IN_NIX_SHELL ]] && use flake github:superherointj/nix-auto-gpt

10
.flake8
View File

@@ -1,12 +1,12 @@
[flake8]
max-line-length = 88
extend-ignore = E203
select = "E303, W293, W291, W292, E305, E231, E302"
exclude =
.tox,
__pycache__,
*.pyc,
.env
venv/*
.venv/*
reports/*
dist/*
venv*/*,
.venv/*,
reports/*,
dist/*,

View File

@@ -2,6 +2,20 @@ name: Bug report 🐛
description: Create a bug report for Auto-GPT.
labels: ['status: needs triage']
body:
- type: markdown
attributes:
value: |
### ⚠️ Before you continue
* Check out our [backlog], [roadmap] and join our [discord] to discuss what's going on
* If you need help, you can ask in the [discussions] section or in [#tech-support]
* **Throughly search the [existing issues] before creating a new one**
[backlog]: https://github.com/orgs/Significant-Gravitas/projects/1
[roadmap]: https://github.com/orgs/Significant-Gravitas/projects/2
[discord]: https://discord.gg/autogpt
[discussions]: https://github.com/Significant-Gravitas/Auto-GPT/discussions
[#tech-support]: https://discord.com/channels/1092243196446249134/1092275629602394184
[existing issues]: https://github.com/Significant-Gravitas/Auto-GPT/issues?q=is%3Aissue
- type: checkboxes
attributes:
label: ⚠️ Search for existing issues first ⚠️
@@ -28,14 +42,32 @@ body:
- Provide commit-hash (`git rev-parse HEAD` gets it)
- If it's a pip/packages issue, provide pip version, python version
- If it's a crash, provide traceback.
- type: checkboxes
- type: dropdown
attributes:
label: GPT-3 or GPT-4
label: Which Operating System are you using?
description: >
Please select the operating system you were using to run Auto-GPT when this problem occurred.
options:
- Windows
- Linux
- MacOS
- Docker
- Devcontainer / Codespace
- Windows Subsystem for Linux (WSL)
- Other (Please specify in your problem)
validations:
required: true
- type: dropdown
attributes:
label: GPT-3 or GPT-4?
description: >
If you are using Auto-GPT with `--gpt3only`, your problems may be caused by
the limitations of GPT-3.5
the [limitations](https://github.com/Significant-Gravitas/Auto-GPT/issues?q=is%3Aissue+label%3A%22AI+model+limitation%22) of GPT-3.5.
options:
- label: I am using Auto-GPT with GPT-3 (GPT-3.5)
- GPT-3.5
- GPT-4
validations:
required: true
- type: textarea
attributes:
label: Steps to reproduce 🕹
@@ -52,9 +84,34 @@ body:
- type: textarea
attributes:
label: Your prompt 📝
description: |
If applicable please provide the prompt you are using. You can find your last-used prompt in last_run_ai_settings.yaml.
description: >
If applicable please provide the prompt you are using. Your prompt is stored in your `ai_settings.yaml` file.
value: |
```yaml
# Paste your prompt here
```
- type: textarea
attributes:
label: Your Logs 📒
description: |
Please include the log showing your error and the command that caused it, if applicable.
You can copy it from your terminal or from `logs/activity.log`.
This will help us understand your issue better!
<details>
<summary><i>Example</i></summary>
```log
INFO NEXT ACTION: COMMAND = execute_shell ARGUMENTS = {'command_line': 'some_command'}
INFO -=-=-=-=-=-=-= COMMAND AUTHORISED BY USER -=-=-=-=-=-=-=
Traceback (most recent call last):
File "/home/anaconda3/lib/python3.9/site-packages/openai/api_requestor.py", line 619, in _interpret_response
self._interpret_response_line(
File "/home/anaconda3/lib/python3.9/site-packages/openai/api_requestor.py", line 682, in _interpret_response_line
raise self.handle_error_response(
openai.error.InvalidRequestError: This model's maximum context length is 8191 tokens, however you requested 10982 tokens (10982 in your prompt; 0 for the completion). Please reduce your prompt; or completion length.
```
</details>
value: |
```log
<insert your logs here>
```

View File

@@ -1,3 +1,10 @@
<!-- ⚠️ At the moment any non-essential commands are not being merged.
If you want to add non-essential commands to Auto-GPT, please create a plugin instead.
We are expecting to ship plugin support within the week (PR #757).
Resources:
* https://github.com/Significant-Gravitas/Auto-GPT-Plugin-Template
-->
<!-- 📢 Announcement
We've recently noticed an increase in pull requests focusing on combining multiple changes. While the intentions behind these PRs are appreciated, it's essential to maintain a clean and manageable git history. To ensure the quality of our repository, we kindly ask you to adhere to the following guidelines when submitting PRs:
@@ -30,4 +37,4 @@ By following these guidelines, your PRs are more likely to be merged quickly aft
<!-- If you haven't added tests, please explain why. If you have, check the appropriate box. If you've ensured your PR is atomic and well-documented, check the corresponding boxes. -->
<!-- By submitting this, I agree that my pull request should be closed if I do not fill this out or follow the guide lines. -->
<!-- By submitting this, I agree that my pull request should be closed if I do not fill this out or follow the guidelines. -->

View File

@@ -9,11 +9,11 @@ jobs:
environment: benchmark
strategy:
matrix:
python-version: [3.8]
python-version: ['3.10', '3.11']
steps:
- name: Check out repository
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2

View File

@@ -2,23 +2,54 @@ name: Python CI
on:
push:
branches:
- master
branches: [master]
pull_request:
branches:
- master
branches: [master]
concurrency:
group: ${{ format('ci-{0}', format('pr-{0}', github.event.pull_request.number) || github.sha) }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
build:
lint:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8]
env:
min-python-version: '3.10'
steps:
- name: Check out repository
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Set up Python ${{ env.min-python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ env.min-python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Lint with flake8
run: flake8
- name: Check black formatting
run: black . --check
if: success() || failure()
- name: Check isort formatting
run: isort . --check
if: success() || failure()
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.10', '3.11']
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
@@ -30,10 +61,6 @@ jobs:
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Lint with flake8
continue-on-error: false
run: flake8 autogpt/ tests/ --select E303,W293,W291,W292,E305,E231,E302
- name: Run unittest tests with coverage
run: |
pytest --cov=autogpt --without-integration --without-slow-integration
@@ -42,3 +69,4 @@ jobs:
run: |
coverage report
coverage xml
if: success() || failure()

View File

@@ -5,6 +5,9 @@ on:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
concurrency:
group: ${{ format('docker-ci-{0}', github.event.pull_request.number || github.sha) }}
cancel-in-progress: true
jobs:

View File

@@ -1,8 +1,8 @@
name: Push Docker Image on Release
on:
push:
branches: [ "stable" ]
release:
types: [published,edited]
jobs:
@@ -19,6 +19,13 @@ jobs:
run: |
docker login -u $DOCKER_USER -p $DOCKER_PASSWORD
- name: Build the Docker image
run: docker build . --file Dockerfile --tag ${{secrets.DOCKER_USER}}/auto-gpt:$(git describe --tags `git rev-list --tags --max-count=1`)
run: |
tag_v=$(git describe --tags $(git rev-list --tags --max-count=1))
tag=$(echo $tag_v | sed 's/v//')
docker build . --file Dockerfile --tag ${{secrets.DOCKER_USER}}/auto-gpt:${tag}
- name: Docker Push
run: docker push ${{secrets.DOCKER_USER}}/auto-gpt
run: |
tag_v2=$(git describe --tags $(git rev-list --tags --max-count=1))
tag2=$(echo $tag_v | sed 's/v//')
docker push ${{secrets.DOCKER_USER}}/auto-gpt:${tag2}

48
.github/workflows/pr-label.yml vendored Normal file
View File

@@ -0,0 +1,48 @@
name: "Pull Request auto-label"
on:
# So that PRs touching the same files as the push are updated
push:
# So that the `dirtyLabel` is removed if conflicts are resolve
# We recommend `pull_request_target` so that github secrets are available.
# In `pull_request` we wouldn't be able to change labels of fork PRs
pull_request_target:
types: [opened, synchronize]
concurrency:
group: ${{ format('pr-label-{0}', github.event.pull_request.number || github.sha) }}
cancel-in-progress: true
jobs:
conflicts:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- name: Update PRs with conflict labels
uses: eps1lon/actions-label-merge-conflict@releases/2.x
with:
dirtyLabel: "conflicts"
#removeOnDirtyLabel: "PR: ready to ship"
repoToken: "${{ secrets.GITHUB_TOKEN }}"
commentOnDirty: "This pull request has conflicts with the base branch, please resolve those so we can evaluate the pull request."
commentOnClean: "Conflicts have been resolved! 🎉 A maintainer will review the pull request shortly."
size:
if: ${{ github.event_name == 'pull_request_target' }}
permissions:
issues: write
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: codelytv/pr-size-labeler@v1.7.0
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
s_label: "size/s"
s_max_size: "10"
m_label: "size/m"
m_max_size: "50"
l_label: "size/l"
l_max_size: "200"
xl_label: "size/xl"
fail_if_xl: "false"
github_api_url: "api.github.com"

25
.github/workflows/sponsors_readme.yml vendored Normal file
View File

@@ -0,0 +1,25 @@
name: Generate Sponsors README
on:
workflow_dispatch:
schedule:
- cron: '0 */12 * * *'
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v2
- name: Generate Sponsors 💖
uses: JamesIves/github-sponsors-readme-action@v1
with:
token: ${{ secrets.README_UPDATER_PAT }}
file: 'README.md'
minimum: 2500
maximum: 99999
- name: Deploy to GitHub Pages 🚀
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: master
folder: '.'
token: ${{ secrets.README_UPDATER_PAT }}

7
.gitignore vendored
View File

@@ -10,7 +10,6 @@ auto_gpt_workspace/*
*.mpeg
.env
azure.yaml
outputs/*
ai_settings.yaml
last_run_ai_settings.yaml
.vscode
@@ -127,6 +126,7 @@ celerybeat.pid
*.sage.py
# Environments
.direnv/
.env
.venv
env/
@@ -156,3 +156,8 @@ vicuna-*
# mac
.DS_Store
openai/
# news
CURRENT_BULLETIN.md

View File

@@ -1,10 +1,10 @@
[settings]
profile = black
multi_line_output = 3
include_trailing_comma = True
include_trailing_comma = true
force_grid_wrap = 0
use_parentheses = True
ensure_newline_before_comments = True
use_parentheses = true
ensure_newline_before_comments = true
line_length = 88
skip = venv,env,node_modules,.env,.venv,dist
sections = FUTURE,STDLIB,THIRDPARTY,FIRSTPARTY,LOCALFOLDER
sections = FUTURE,STDLIB,THIRDPARTY,FIRSTPARTY,LOCALFOLDER
skip = .tox,__pycache__,*.pyc,venv*/*,reports,venv,env,node_modules,.env,.venv,dist

View File

@@ -1,39 +1,32 @@
repos:
- repo: https://github.com/sourcery-ai/sourcery
rev: v1.1.0 # Get the latest tag from https://github.com/sourcery-ai/sourcery/tags
hooks:
- id: sourcery
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v0.9.2
hooks:
- id: check-added-large-files
args: [ '--maxkb=500' ]
args: ['--maxkb=500']
- id: check-byte-order-marker
- id: check-case-conflict
- id: check-merge-conflict
- id: check-symlinks
- id: debug-statements
- repo: local
- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
name: isort-local
entry: isort
language: python
types: [ python ]
exclude: .+/(dist|.venv|venv|build)/.+
pass_filenames: true
language_version: python3.10
- repo: https://github.com/psf/black
rev: 23.3.0
hooks:
- id: black
name: black-local
entry: black
language: python
types: [ python ]
exclude: .+/(dist|.venv|venv|build)/.+
pass_filenames: true
language_version: python3.10
- repo: local
hooks:
- id: pytest-check
name: pytest-check
entry: pytest --cov=autogpt --without-integration --without-slow-integration
language: system
pass_filenames: false
always_run: true
always_run: true

View File

@@ -30,7 +30,7 @@ rule_settings:
- refactoring
- suggestion
- comment
python_version: '3.9' # A string specifying the lowest Python version your project supports. Sourcery will not suggest refactorings requiring a higher Python version.
python_version: '3.10' # A string specifying the lowest Python version your project supports. Sourcery will not suggest refactorings requiring a higher Python version.
# rules: # A list of custom rules Sourcery will include in its analysis.
# - id: no-print-statements
@@ -68,4 +68,4 @@ rule_settings:
# proxy:
# url:
# ssl_certs_file:
# no_ssl_verify: false
# no_ssl_verify: false

2
BULLETIN.md Normal file
View File

@@ -0,0 +1,2 @@
Welcome to Auto-GPT! We'll keep you informed of the latest news and features by printing messages here.
If you don't wish to see this message, you can run Auto-GPT with the --skip-news flag

View File

@@ -20,6 +20,12 @@ This document provides guidelines and best practices to help you contribute effe
By participating in this project, you agree to abide by our [Code of Conduct](CODE_OF_CONDUCT.md). Please read it to understand the expectations we have for everyone who contributes to this project.
## 📢 A Quick Word
Right now we will not be accepting any Contributions that add non-essential commands to Auto-GPT.
However, you absolutely can still add these commands to Auto-GPT in the form of plugins. Please check out this [template](https://github.com/Significant-Gravitas/Auto-GPT-Plugin-Template).
> ⚠️ Plugin support is expected to ship within the week. You can follow PR #757 for more updates!
## Getting Started
To start contributing, follow these steps:

View File

@@ -1,10 +1,20 @@
# Use an official Python base image from the Docker Hub
FROM python:3.11-slim
FROM python:3.10-slim
# Install git
RUN apt-get -y update
RUN apt-get -y install git chromium-driver
# Install Xvfb and other dependencies for headless browser testing
RUN apt-get update \
&& apt-get install -y wget gnupg2 libgtk-3-0 libdbus-glib-1-2 dbus-x11 xvfb ca-certificates
# Install Firefox / Chromium
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
&& echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list \
&& apt-get update \
&& apt-get install -y chromium firefox-esr
# Set environment variables
ENV PIP_NO_CACHE_DIR=yes \
PYTHONUNBUFFERED=1 \
@@ -17,8 +27,9 @@ RUN chown appuser:appuser /home/appuser
USER appuser
# Copy the requirements.txt file and install the requirements
COPY --chown=appuser:appuser requirements-docker.txt .
RUN pip install --no-cache-dir --user -r requirements-docker.txt
COPY --chown=appuser:appuser requirements.txt .
RUN sed -i '/Items below this point will not be included in the Docker Image/,$d' requirements.txt && \
pip install --no-cache-dir --user -r requirements.txt
# Copy the application files
COPY --chown=appuser:appuser autogpt/ ./autogpt

File diff suppressed because one or more lines are too long

View File

@@ -1,50 +1,5 @@
"""Main script for the autogpt package."""
import logging
from colorama import Fore
from autogpt.agent.agent import Agent
from autogpt.args import parse_arguments
from autogpt.config import Config, check_openai_api_key
from autogpt.logs import logger
from autogpt.memory import get_memory
from autogpt.prompt import construct_prompt
# Load environment variables from .env file
def main() -> None:
"""Main function for the script"""
cfg = Config()
# TODO: fill in llm values here
check_openai_api_key()
parse_arguments()
logger.set_level(logging.DEBUG if cfg.debug_mode else logging.INFO)
ai_name = ""
system_prompt = construct_prompt()
# print(prompt)
# Initialize variables
full_message_history = []
next_action_count = 0
# Make a constant:
triggering_prompt = (
"Determine which next command to use, and respond using the"
" format specified above:"
)
# Initialize memory and make sure it is empty.
# this is particularly important for indexing and referencing pinecone memory
memory = get_memory(cfg, init=True)
logger.typewriter_log(
f"Using memory of type:", Fore.GREEN, f"{memory.__class__.__name__}"
)
logger.typewriter_log(f"Using Browser:", Fore.GREEN, cfg.selenium_web_browser)
agent = Agent(
ai_name=ai_name,
memory=memory,
full_message_history=full_message_history,
next_action_count=next_action_count,
system_prompt=system_prompt,
triggering_prompt=triggering_prompt,
)
agent.start_interaction_loop()
"""Auto-GPT: A GPT powered AI Assistant"""
import autogpt.cli
if __name__ == "__main__":
main()
autogpt.cli.main()

View File

@@ -1,10 +1,10 @@
from colorama import Fore, Style
from autogpt.app import execute_command, get_command
from autogpt.app import execute_command, get_command
from autogpt.chat import chat_with_ai, create_chat_message
from autogpt.config import Config
from autogpt.json_fixes.master_json_fix_method import fix_json_using_multiple_techniques
from autogpt.json_validation.validate_json import validate_json
from autogpt.json_utils.json_fix_llm import fix_json_using_multiple_techniques
from autogpt.json_utils.utilities import validate_json
from autogpt.logs import logger, print_assistant_thoughts
from autogpt.speech import say_text
from autogpt.spinner import Spinner
@@ -19,18 +19,25 @@ class Agent:
memory: The memory object to use.
full_message_history: The full message history.
next_action_count: The number of actions to execute.
system_prompt: The system prompt is the initial prompt that defines everything the AI needs to know to achieve its task successfully.
Currently, the dynamic and customizable information in the system prompt are ai_name, description and goals.
system_prompt: The system prompt is the initial prompt that defines everything
the AI needs to know to achieve its task successfully.
Currently, the dynamic and customizable information in the system prompt are
ai_name, description and goals.
triggering_prompt: The last sentence the AI will see before answering. For Auto-GPT, this prompt is:
Determine which next command to use, and respond using the format specified above:
The triggering prompt is not part of the system prompt because between the system prompt and the triggering
prompt we have contextual information that can distract the AI and make it forget that its goal is to find the next task to achieve.
triggering_prompt: The last sentence the AI will see before answering.
For Auto-GPT, this prompt is:
Determine which next command to use, and respond using the format specified
above:
The triggering prompt is not part of the system prompt because between the
system prompt and the triggering
prompt we have contextual information that can distract the AI and make it
forget that its goal is to find the next task to achieve.
SYSTEM PROMPT
CONTEXTUAL INFORMATION (memory, previous conversations, anything relevant)
TRIGGERING PROMPT
The triggering prompt reminds the AI about its short term meta task (defining the next task)
The triggering prompt reminds the AI about its short term meta task
(defining the next task)
"""
def __init__(
@@ -39,6 +46,8 @@ class Agent:
memory,
full_message_history,
next_action_count,
command_registry,
config,
system_prompt,
triggering_prompt,
):
@@ -46,6 +55,8 @@ class Agent:
self.memory = memory
self.full_message_history = full_message_history
self.next_action_count = next_action_count
self.command_registry = command_registry
self.config = config
self.system_prompt = system_prompt
self.triggering_prompt = triggering_prompt
@@ -73,6 +84,7 @@ class Agent:
# Send message to AI, get response
with Spinner("Thinking... "):
assistant_reply = chat_with_ai(
self,
self.system_prompt,
self.triggering_prompt,
self.full_message_history,
@@ -81,22 +93,25 @@ class Agent:
) # TODO: This hardcodes the model to use GPT3.5. Make this an argument
assistant_reply_json = fix_json_using_multiple_techniques(assistant_reply)
for plugin in cfg.plugins:
if not plugin.can_handle_post_planning():
continue
assistant_reply_json = plugin.post_planning(self, assistant_reply_json)
# Print Assistant thoughts
if assistant_reply_json != {}:
validate_json(assistant_reply_json, 'llm_response_format_1')
validate_json(assistant_reply_json, "llm_response_format_1")
# Get command name and arguments
try:
print_assistant_thoughts(self.ai_name, assistant_reply_json)
command_name, arguments = get_command(assistant_reply_json)
# command_name, arguments = assistant_reply_json_valid["command"]["name"], assistant_reply_json_valid["command"]["args"]
if cfg.speak_mode:
say_text(f"I want to execute {command_name}")
except Exception as e:
logger.error("Error: \n", str(e))
if not cfg.continuous_mode and self.next_action_count == 0:
### GET USER AUTHORIZATION TO EXECUTE COMMAND ###
# ### GET USER AUTHORIZATION TO EXECUTE COMMAND ###
# Get key press: Prompt the user to press enter to continue or escape
# to exit
logger.typewriter_log(
@@ -115,9 +130,12 @@ class Agent:
console_input = clean_input(
Fore.MAGENTA + "Input:" + Style.RESET_ALL
)
if console_input.lower().rstrip() == "y":
if console_input.lower().strip() == "y":
user_input = "GENERATE NEXT COMMAND JSON"
break
elif console_input.lower().strip() == "":
print("Invalid input format.")
continue
elif console_input.lower().startswith("y -"):
try:
self.next_action_count = abs(
@@ -165,30 +183,46 @@ class Agent:
elif command_name == "human_feedback":
result = f"Human feedback: {user_input}"
else:
result = (
f"Command {command_name} returned: "
f"{execute_command(command_name, arguments)}"
for plugin in cfg.plugins:
if not plugin.can_handle_pre_command():
continue
command_name, arguments = plugin.pre_command(
command_name, arguments
)
command_result = execute_command(
self.command_registry,
command_name,
arguments,
self.config.prompt_generator,
)
result = f"Command {command_name} returned: " f"{command_result}"
for plugin in cfg.plugins:
if not plugin.can_handle_post_command():
continue
result = plugin.post_command(command_name, result)
if self.next_action_count > 0:
self.next_action_count -= 1
memory_to_add = (
f"Assistant Reply: {assistant_reply} "
f"\nResult: {result} "
f"\nHuman Feedback: {user_input} "
)
self.memory.add(memory_to_add)
# Check if there's a result from the command append it to the message
# history
if result is not None:
self.full_message_history.append(create_chat_message("system", result))
logger.typewriter_log("SYSTEM: ", Fore.YELLOW, result)
else:
self.full_message_history.append(
create_chat_message("system", "Unable to execute command")
)
logger.typewriter_log(
"SYSTEM: ", Fore.YELLOW, "Unable to execute command"
if command_name != "do_nothing":
memory_to_add = (
f"Assistant Reply: {assistant_reply} "
f"\nResult: {result} "
f"\nHuman Feedback: {user_input} "
)
self.memory.add(memory_to_add)
# Check if there's a result from the command append it to the message
# history
if result is not None:
self.full_message_history.append(
create_chat_message("system", result)
)
logger.typewriter_log("SYSTEM: ", Fore.YELLOW, result)
else:
self.full_message_history.append(
create_chat_message("system", "Unable to execute command")
)
logger.typewriter_log(
"SYSTEM: ", Fore.YELLOW, "Unable to execute command"
)

View File

@@ -1,8 +1,11 @@
"""Agent manager for managing GPT agents"""
from __future__ import annotations
from typing import List, Union
from autogpt.config.config import Config, Singleton
from autogpt.llm_utils import create_chat_completion
from autogpt.config.config import Singleton
from autogpt.types.openai import Message
class AgentManager(metaclass=Singleton):
@@ -11,6 +14,7 @@ class AgentManager(metaclass=Singleton):
def __init__(self):
self.next_key = 0
self.agents = {} # key, (task, full_message_history, model)
self.cfg = Config()
# Create new GPT agent
# TODO: Centralise use of create_chat_completion() to globally enforce token limit
@@ -26,19 +30,32 @@ class AgentManager(metaclass=Singleton):
Returns:
The key of the new agent
"""
messages = [
messages: List[Message] = [
{"role": "user", "content": prompt},
]
for plugin in self.cfg.plugins:
if not plugin.can_handle_pre_instruction():
continue
if plugin_messages := plugin.pre_instruction(messages):
messages.extend(iter(plugin_messages))
# Start GPT instance
agent_reply = create_chat_completion(
model=model,
messages=messages,
)
# Update full message history
messages.append({"role": "assistant", "content": agent_reply})
plugins_reply = ""
for i, plugin in enumerate(self.cfg.plugins):
if not plugin.can_handle_on_instruction():
continue
if plugin_result := plugin.on_instruction(messages):
sep = "\n" if i else ""
plugins_reply = f"{plugins_reply}{sep}{plugin_result}"
if plugins_reply and plugins_reply != "":
messages.append({"role": "assistant", "content": plugins_reply})
key = self.next_key
# This is done instead of len(agents) to make keys unique even if agents
# are deleted
@@ -46,6 +63,11 @@ class AgentManager(metaclass=Singleton):
self.agents[key] = (task, messages, model)
for plugin in self.cfg.plugins:
if not plugin.can_handle_post_instruction():
continue
agent_reply = plugin.post_instruction(agent_reply)
return key, agent_reply
def message_agent(self, key: str | int, message: str) -> str:
@@ -63,15 +85,37 @@ class AgentManager(metaclass=Singleton):
# Add user message to message history before sending to agent
messages.append({"role": "user", "content": message})
for plugin in self.cfg.plugins:
if not plugin.can_handle_pre_instruction():
continue
if plugin_messages := plugin.pre_instruction(messages):
for plugin_message in plugin_messages:
messages.append(plugin_message)
# Start GPT instance
agent_reply = create_chat_completion(
model=model,
messages=messages,
)
# Update full message history
messages.append({"role": "assistant", "content": agent_reply})
plugins_reply = agent_reply
for i, plugin in enumerate(self.cfg.plugins):
if not plugin.can_handle_on_instruction():
continue
if plugin_result := plugin.on_instruction(messages):
sep = "\n" if i else ""
plugins_reply = f"{plugins_reply}{sep}{plugin_result}"
# Update full message history
if plugins_reply and plugins_reply != "":
messages.append({"role": "assistant", "content": plugins_reply})
for plugin in self.cfg.plugins:
if not plugin.can_handle_post_instruction():
continue
agent_reply = plugin.post_instruction(agent_reply)
return agent_reply
def list_agents(self) -> list[tuple[str | int, str]]:
@@ -84,7 +128,7 @@ class AgentManager(metaclass=Singleton):
# Return a list of agent keys and their tasks
return [(key, task) for key, (task, _, _) in self.agents.items()]
def delete_agent(self, key: Union[str, int]) -> bool:
def delete_agent(self, key: str | int) -> bool:
"""Delete an agent from the agent manager
Args:

View File

@@ -1,32 +1,15 @@
""" Command and Control """
import json
from typing import List, NoReturn, Union, Dict
from typing import Dict, List, NoReturn, Union
from autogpt.agent.agent_manager import AgentManager
from autogpt.commands.evaluate_code import evaluate_code
from autogpt.commands.google_search import google_official_search, google_search
from autogpt.commands.improve_code import improve_code
from autogpt.commands.write_tests import write_tests
from autogpt.config import Config
from autogpt.commands.image_gen import generate_image
from autogpt.commands.audio_text import read_audio_from_file
from autogpt.commands.command import CommandRegistry, command
from autogpt.commands.web_requests import scrape_links, scrape_text
from autogpt.commands.execute_code import execute_python_file, execute_shell
from autogpt.commands.file_operations import (
append_to_file,
delete_file,
read_file,
search_files,
write_to_file,
download_file
)
from autogpt.json_fixes.parsing import fix_and_parse_json
from autogpt.config import Config
from autogpt.memory import get_memory
from autogpt.processing.text import summarize_text
from autogpt.prompts.generator import PromptGenerator
from autogpt.speech import say_text
from autogpt.commands.web_selenium import browse_website
from autogpt.commands.git_operations import clone_repository
from autogpt.commands.twitter import send_tweet
CFG = Config()
AGENT_MANAGER = AgentManager()
@@ -104,7 +87,12 @@ def map_command_synonyms(command_name: str):
return command_name
def execute_command(command_name: str, arguments):
def execute_command(
command_registry: CommandRegistry,
command_name: str,
arguments,
prompt: PromptGenerator,
):
"""Execute the command and return the result
Args:
@@ -112,96 +100,32 @@ def execute_command(command_name: str, arguments):
arguments (dict): The arguments for the command
Returns:
str: The result of the command"""
memory = get_memory(CFG)
str: The result of the command
"""
try:
command_name = map_command_synonyms(command_name)
if command_name == "google":
# Check if the Google API key is set and use the official search method
# If the API key is not set or has only whitespaces, use the unofficial
# search method
key = CFG.google_api_key
if key and key.strip() and key != "your-google-api-key":
google_result = google_official_search(arguments["input"])
return google_result
else:
google_result = google_search(arguments["input"])
cmd = command_registry.commands.get(command_name)
# google_result can be a list or a string depending on the search results
if isinstance(google_result, list):
safe_message = [google_result_single.encode('utf-8', 'ignore') for google_result_single in google_result]
else:
safe_message = google_result.encode('utf-8', 'ignore')
# If the command is found, call it with the provided arguments
if cmd:
return cmd(**arguments)
# TODO: Remove commands below after they are moved to the command registry.
command_name = map_command_synonyms(command_name.lower())
if command_name == "memory_add":
return get_memory(CFG).add(arguments["string"])
return str(safe_message)
elif command_name == "memory_add":
return memory.add(arguments["string"])
elif command_name == "start_agent":
return start_agent(
arguments["name"], arguments["task"], arguments["prompt"]
)
elif command_name == "message_agent":
return message_agent(arguments["key"], arguments["message"])
elif command_name == "list_agents":
return list_agents()
elif command_name == "delete_agent":
return delete_agent(arguments["key"])
elif command_name == "get_text_summary":
return get_text_summary(arguments["url"], arguments["question"])
elif command_name == "get_hyperlinks":
return get_hyperlinks(arguments["url"])
elif command_name == "clone_repository":
return clone_repository(
arguments["repository_url"], arguments["clone_path"]
)
elif command_name == "read_file":
return read_file(arguments["file"])
elif command_name == "write_to_file":
return write_to_file(arguments["file"], arguments["text"])
elif command_name == "append_to_file":
return append_to_file(arguments["file"], arguments["text"])
elif command_name == "delete_file":
return delete_file(arguments["file"])
elif command_name == "search_files":
return search_files(arguments["directory"])
elif command_name == "download_file":
if not CFG.allow_downloads:
return "Error: You do not have user authorization to download files locally."
return download_file(arguments["url"], arguments["file"])
elif command_name == "browse_website":
return browse_website(arguments["url"], arguments["question"])
# TODO: Change these to take in a file rather than pasted code, if
# non-file is given, return instructions "Input should be a python
# filepath, write your code to file and try again"
elif command_name == "evaluate_code":
return evaluate_code(arguments["code"])
elif command_name == "improve_code":
return improve_code(arguments["suggestions"], arguments["code"])
elif command_name == "write_tests":
return write_tests(arguments["code"], arguments.get("focus"))
elif command_name == "execute_python_file": # Add this command
return execute_python_file(arguments["file"])
elif command_name == "execute_shell":
if CFG.execute_local_commands:
return execute_shell(arguments["command_line"])
else:
return (
"You are not allowed to run local shell commands. To execute"
" shell commands, EXECUTE_LOCAL_COMMANDS must be set to 'True' "
"in your config. Do not attempt to bypass the restriction."
)
elif command_name == "read_audio_from_file":
return read_audio_from_file(arguments["file"])
elif command_name == "generate_image":
return generate_image(arguments["prompt"])
elif command_name == "send_tweet":
return send_tweet(arguments["text"])
# filepath, write your code to file and try again
elif command_name == "do_nothing":
return "No action performed."
elif command_name == "task_complete":
shutdown()
else:
for command in prompt.commands:
if command_name == command["label"] or command_name == command["name"]:
return command["function"](*arguments.values())
return (
f"Unknown command '{command_name}'. Please refer to the 'COMMANDS'"
" list for available commands and only respond in the specified JSON"
@@ -211,8 +135,11 @@ def execute_command(command_name: str, arguments):
return f"Error: {str(e)}"
@command(
"get_text_summary", "Get text summary", '"url": "<url>", "question": "<question>"'
)
def get_text_summary(url: str, question: str) -> str:
"""Return the results of a google search
"""Return the results of a Google search
Args:
url (str): The url to scrape
@@ -226,8 +153,9 @@ def get_text_summary(url: str, question: str) -> str:
return f""" "Result" : {summary}"""
@command("get_hyperlinks", "Get text summary", '"url": "<url>"')
def get_hyperlinks(url: str) -> Union[str, List[str]]:
"""Return the results of a google search
"""Return the results of a Google search
Args:
url (str): The url to scrape
@@ -244,6 +172,11 @@ def shutdown() -> NoReturn:
quit()
@command(
"start_agent",
"Start GPT Agent",
'"name": "<name>", "task": "<short_task_desc>", "prompt": "<prompt>"',
)
def start_agent(name: str, task: str, prompt: str, model=CFG.fast_llm_model) -> str:
"""Start an agent with a given name, task, and prompt
@@ -276,6 +209,7 @@ def start_agent(name: str, task: str, prompt: str, model=CFG.fast_llm_model) ->
return f"Agent {name} created with key {key}. First response: {agent_response}"
@command("message_agent", "Message GPT Agent", '"key": "<key>", "message": "<message>"')
def message_agent(key: str, message: str) -> str:
"""Message an agent with a given key and message"""
# Check if the key is a valid integer
@@ -290,7 +224,8 @@ def message_agent(key: str, message: str) -> str:
return agent_response
def list_agents():
@command("list_agents", "List GPT Agents", "")
def list_agents() -> str:
"""List all agents
Returns:
@@ -301,6 +236,7 @@ def list_agents():
)
@command("delete_agent", "Delete GPT Agent", '"key": "<key>"')
def delete_agent(key: str) -> str:
"""Delete an agent with a given key

View File

@@ -1,151 +0,0 @@
"""This module contains the argument parsing logic for the script."""
import argparse
from colorama import Fore, Back, Style
from autogpt import utils
from autogpt.config import Config
from autogpt.logs import logger
from autogpt.memory import get_supported_memory_backends
CFG = Config()
def parse_arguments() -> None:
"""Parses the arguments passed to the script
Returns:
None
"""
CFG.set_debug_mode(False)
CFG.set_continuous_mode(False)
CFG.set_speak_mode(False)
parser = argparse.ArgumentParser(description="Process arguments.")
parser.add_argument(
"--continuous", "-c", action="store_true", help="Enable Continuous Mode"
)
parser.add_argument(
"--continuous-limit",
"-l",
type=int,
dest="continuous_limit",
help="Defines the number of times to run in continuous mode",
)
parser.add_argument("--speak", action="store_true", help="Enable Speak Mode")
parser.add_argument("--debug", action="store_true", help="Enable Debug Mode")
parser.add_argument(
"--gpt3only", action="store_true", help="Enable GPT3.5 Only Mode"
)
parser.add_argument("--gpt4only", action="store_true", help="Enable GPT4 Only Mode")
parser.add_argument(
"--use-memory",
"-m",
dest="memory_type",
help="Defines which Memory backend to use",
)
parser.add_argument(
"--skip-reprompt",
"-y",
dest="skip_reprompt",
action="store_true",
help="Skips the re-prompting messages at the beginning of the script",
)
parser.add_argument(
"--use-browser",
"-b",
dest="browser_name",
help="Specifies which web-browser to use when using selenium to scrape the web.",
)
parser.add_argument(
"--ai-settings",
"-C",
dest="ai_settings_file",
help="Specifies which ai_settings.yaml file to use, will also automatically"
" skip the re-prompt.",
)
parser.add_argument(
'--allow-downloads',
action='store_true',
dest='allow_downloads',
help='Dangerous: Allows Auto-GPT to download files natively.'
)
args = parser.parse_args()
if args.debug:
logger.typewriter_log("Debug Mode: ", Fore.GREEN, "ENABLED")
CFG.set_debug_mode(True)
if args.continuous:
logger.typewriter_log("Continuous Mode: ", Fore.RED, "ENABLED")
logger.typewriter_log(
"WARNING: ",
Fore.RED,
"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. Use at your own risk.",
)
CFG.set_continuous_mode(True)
if args.continuous_limit:
logger.typewriter_log(
"Continuous Limit: ", Fore.GREEN, f"{args.continuous_limit}"
)
CFG.set_continuous_limit(args.continuous_limit)
# Check if continuous limit is used without continuous mode
if args.continuous_limit and not args.continuous:
parser.error("--continuous-limit can only be used with --continuous")
if args.speak:
logger.typewriter_log("Speak Mode: ", Fore.GREEN, "ENABLED")
CFG.set_speak_mode(True)
if args.gpt3only:
logger.typewriter_log("GPT3.5 Only Mode: ", Fore.GREEN, "ENABLED")
CFG.set_smart_llm_model(CFG.fast_llm_model)
if args.gpt4only:
logger.typewriter_log("GPT4 Only Mode: ", Fore.GREEN, "ENABLED")
CFG.set_fast_llm_model(CFG.smart_llm_model)
if args.memory_type:
supported_memory = get_supported_memory_backends()
chosen = args.memory_type
if chosen not in supported_memory:
logger.typewriter_log(
"ONLY THE FOLLOWING MEMORY BACKENDS ARE SUPPORTED: ",
Fore.RED,
f"{supported_memory}",
)
logger.typewriter_log("Defaulting to: ", Fore.YELLOW, CFG.memory_backend)
else:
CFG.memory_backend = chosen
if args.skip_reprompt:
logger.typewriter_log("Skip Re-prompt: ", Fore.GREEN, "ENABLED")
CFG.skip_reprompt = True
if args.ai_settings_file:
file = args.ai_settings_file
# Validate file
(validated, message) = utils.validate_yaml_file(file)
if not validated:
logger.typewriter_log("FAILED FILE VALIDATION", Fore.RED, message)
logger.double_check()
exit(1)
logger.typewriter_log("Using AI Settings File:", Fore.GREEN, file)
CFG.ai_settings_file = file
CFG.skip_reprompt = True
if args.allow_downloads:
logger.typewriter_log("Native Downloading:", Fore.GREEN, "ENABLED")
logger.typewriter_log("WARNING: ", Fore.YELLOW,
f"{Back.LIGHTYELLOW_EX}Auto-GPT will now be able to download and save files to your machine.{Back.RESET} " +
"It is recommended that you monitor any files it downloads carefully.")
logger.typewriter_log("WARNING: ", Fore.YELLOW, f"{Back.RED + Style.BRIGHT}ALWAYS REMEMBER TO NEVER OPEN FILES YOU AREN'T SURE OF!{Style.RESET_ALL}")
CFG.allow_downloads = True
if args.browser_name:
CFG.selenium_web_browser = args.browser_name

View File

@@ -6,11 +6,12 @@ from autogpt import token_counter
from autogpt.config import Config
from autogpt.llm_utils import create_chat_completion
from autogpt.logs import logger
from autogpt.types.openai import Message
cfg = Config()
def create_chat_message(role, content):
def create_chat_message(role, content) -> Message:
"""
Create a chat message with the given role and content.
@@ -51,7 +52,7 @@ def generate_context(prompt, relevant_memory, full_message_history, model):
# TODO: Change debug from hardcode to argument
def chat_with_ai(
prompt, user_input, full_message_history, permanent_memory, token_limit
agent, prompt, user_input, full_message_history, permanent_memory, token_limit
):
"""Interact with the OpenAI API, sending the prompt, user input, message history,
and permanent memory."""
@@ -135,6 +136,25 @@ def chat_with_ai(
# Append user input, the length of this is accounted for above
current_context.extend([create_chat_message("user", user_input)])
plugin_count = len(cfg.plugins)
for i, plugin in enumerate(cfg.plugins):
if not plugin.can_handle_on_planning():
continue
plugin_response = plugin.on_planning(
agent.prompt_generator, current_context
)
if not plugin_response or plugin_response == "":
continue
tokens_to_add = token_counter.count_message_tokens(
[create_chat_message("system", plugin_response)], model
)
if current_tokens_used + tokens_to_add > send_token_limit:
if cfg.debug_mode:
print("Plugin response too long, skipping:", plugin_response)
print("Plugins remaining at stop:", plugin_count - i)
break
current_context.append(create_chat_message("system", plugin_response))
# Calculate remaining tokens
tokens_remaining = token_limit - current_tokens_used
# assert tokens_remaining >= 0, "Tokens remaining is negative.

181
autogpt/cli.py Normal file
View File

@@ -0,0 +1,181 @@
"""Main script for the autogpt package."""
import click
@click.group(invoke_without_command=True)
@click.option("-c", "--continuous", is_flag=True, help="Enable Continuous Mode")
@click.option(
"--skip-reprompt",
"-y",
is_flag=True,
help="Skips the re-prompting messages at the beginning of the script",
)
@click.option(
"--ai-settings",
"-C",
help="Specifies which ai_settings.yaml file to use, will also automatically skip the re-prompt.",
)
@click.option(
"-l",
"--continuous-limit",
type=int,
help="Defines the number of times to run in continuous mode",
)
@click.option("--speak", is_flag=True, help="Enable Speak Mode")
@click.option("--debug", is_flag=True, help="Enable Debug Mode")
@click.option("--gpt3only", is_flag=True, help="Enable GPT3.5 Only Mode")
@click.option("--gpt4only", is_flag=True, help="Enable GPT4 Only Mode")
@click.option(
"--use-memory",
"-m",
"memory_type",
type=str,
help="Defines which Memory backend to use",
)
@click.option(
"-b",
"--browser-name",
help="Specifies which web-browser to use when using selenium to scrape the web.",
)
@click.option(
"--allow-downloads",
is_flag=True,
help="Dangerous: Allows Auto-GPT to download files natively.",
)
@click.option(
"--skip-news",
is_flag=True,
help="Specifies whether to suppress the output of latest news on startup.",
)
@click.pass_context
def main(
ctx: click.Context,
continuous: bool,
continuous_limit: int,
ai_settings: str,
skip_reprompt: bool,
speak: bool,
debug: bool,
gpt3only: bool,
gpt4only: bool,
memory_type: str,
browser_name: str,
allow_downloads: bool,
skip_news: bool,
) -> None:
"""
Welcome to AutoGPT an experimental open-source application showcasing the capabilities of the GPT-4 pushing the boundaries of AI.
Start an Auto-GPT assistant.
"""
# Put imports inside function to avoid importing everything when starting the CLI
import logging
import sys
from colorama import Fore
from autogpt.agent.agent import Agent
from autogpt.commands.command import CommandRegistry
from autogpt.config import Config, check_openai_api_key
from autogpt.configurator import create_config
from autogpt.logs import logger
from autogpt.memory import get_memory
from autogpt.plugins import scan_plugins
from autogpt.prompts.prompt import construct_main_ai_config
from autogpt.utils import get_current_git_branch, get_latest_bulletin
if ctx.invoked_subcommand is None:
cfg = Config()
# TODO: fill in llm values here
check_openai_api_key()
create_config(
continuous,
continuous_limit,
ai_settings,
skip_reprompt,
speak,
debug,
gpt3only,
gpt4only,
memory_type,
browser_name,
allow_downloads,
skip_news,
)
logger.set_level(logging.DEBUG if cfg.debug_mode else logging.INFO)
ai_name = ""
if not cfg.skip_news:
motd = get_latest_bulletin()
if motd:
logger.typewriter_log("NEWS: ", Fore.GREEN, motd)
git_branch = get_current_git_branch()
if git_branch and git_branch != "stable":
logger.typewriter_log(
"WARNING: ",
Fore.RED,
f"You are running on `{git_branch}` branch "
"- this is not a supported branch.",
)
if sys.version_info < (3, 10):
logger.typewriter_log(
"WARNING: ",
Fore.RED,
"You are running on an older version of Python. "
"Some people have observed problems with certain "
"parts of Auto-GPT with this version. "
"Please consider upgrading to Python 3.10 or higher.",
)
cfg = Config()
cfg.set_plugins(scan_plugins(cfg, cfg.debug_mode))
# Create a CommandRegistry instance and scan default folder
command_registry = CommandRegistry()
command_registry.import_commands("autogpt.commands.analyze_code")
command_registry.import_commands("autogpt.commands.audio_text")
command_registry.import_commands("autogpt.commands.execute_code")
command_registry.import_commands("autogpt.commands.file_operations")
command_registry.import_commands("autogpt.commands.git_operations")
command_registry.import_commands("autogpt.commands.google_search")
command_registry.import_commands("autogpt.commands.image_gen")
command_registry.import_commands("autogpt.commands.improve_code")
command_registry.import_commands("autogpt.commands.twitter")
command_registry.import_commands("autogpt.commands.web_selenium")
command_registry.import_commands("autogpt.commands.write_tests")
command_registry.import_commands("autogpt.app")
ai_name = ""
ai_config = construct_main_ai_config()
ai_config.command_registry = command_registry
# print(prompt)
# Initialize variables
full_message_history = []
next_action_count = 0
# Make a constant:
triggering_prompt = (
"Determine which next command to use, and respond using the"
" format specified above:"
)
# Initialize memory and make sure it is empty.
# this is particularly important for indexing and referencing pinecone memory
memory = get_memory(cfg, init=True)
logger.typewriter_log(
"Using memory of type:", Fore.GREEN, f"{memory.__class__.__name__}"
)
logger.typewriter_log("Using Browser:", Fore.GREEN, cfg.selenium_web_browser)
system_prompt = ai_config.construct_full_prompt()
if cfg.debug_mode:
logger.typewriter_log("Prompt:", Fore.GREEN, system_prompt)
agent = Agent(
ai_name=ai_name,
memory=memory,
full_message_history=full_message_history,
next_action_count=next_action_count,
command_registry=command_registry,
config=ai_config,
system_prompt=system_prompt,
triggering_prompt=triggering_prompt,
)
agent.start_interaction_loop()
if __name__ == "__main__":
main()

View File

@@ -1,10 +1,16 @@
"""Code evaluation module."""
from __future__ import annotations
from autogpt.commands.command import command
from autogpt.llm_utils import call_ai_function
def evaluate_code(code: str) -> list[str]:
@command(
"analyze_code",
"Analyze Code",
'"code": "<full_code_string>"',
)
def analyze_code(code: str) -> list[str]:
"""
A function that takes in a string and returns a response from create chat
completion api call.

View File

@@ -1,23 +1,51 @@
import requests
"""Commands for converting audio to text."""
import json
import requests
from autogpt.commands.command import command
from autogpt.config import Config
from autogpt.workspace import path_in_workspace
cfg = Config()
CFG = Config()
def read_audio_from_file(audio_path):
audio_path = path_in_workspace(audio_path)
@command(
"read_audio_from_file",
"Convert Audio to text",
'"filename": "<filename>"',
CFG.huggingface_audio_to_text_model,
"Configure huggingface_audio_to_text_model.",
)
def read_audio_from_file(filename: str) -> str:
"""
Convert audio to text.
Args:
audio_path (str): The path to the audio file
Returns:
str: The text from the audio
"""
audio_path = path_in_workspace(filename)
with open(audio_path, "rb") as audio_file:
audio = audio_file.read()
return read_audio(audio)
def read_audio(audio):
model = cfg.huggingface_audio_to_text_model
def read_audio(audio: bytes) -> str:
"""
Convert audio to text.
Args:
audio (bytes): The audio to convert
Returns:
str: The text from the audio
"""
model = CFG.huggingface_audio_to_text_model
api_url = f"https://api-inference.huggingface.co/models/{model}"
api_token = cfg.huggingface_api_token
api_token = CFG.huggingface_api_token
headers = {"Authorization": f"Bearer {api_token}"}
if api_token is None:
@@ -32,4 +60,4 @@ def read_audio(audio):
)
text = json.loads(response.content.decode("utf-8"))["text"]
return "The audio says: " + text
return f"The audio says: {text}"

153
autogpt/commands/command.py Normal file
View File

@@ -0,0 +1,153 @@
import importlib
import inspect
from typing import Any, Callable, Optional
# Unique identifier for auto-gpt commands
AUTO_GPT_COMMAND_IDENTIFIER = "auto_gpt_command"
class Command:
"""A class representing a command.
Attributes:
name (str): The name of the command.
description (str): A brief description of what the command does.
signature (str): The signature of the function that the command executes. Defaults to None.
"""
def __init__(
self,
name: str,
description: str,
method: Callable[..., Any],
signature: str = "",
enabled: bool = True,
disabled_reason: Optional[str] = None,
):
self.name = name
self.description = description
self.method = method
self.signature = signature if signature else str(inspect.signature(self.method))
self.enabled = enabled
self.disabled_reason = disabled_reason
def __call__(self, *args, **kwargs) -> Any:
if not self.enabled:
return f"Command '{self.name}' is disabled: {self.disabled_reason}"
return self.method(*args, **kwargs)
def __str__(self) -> str:
return f"{self.name}: {self.description}, args: {self.signature}"
class CommandRegistry:
"""
The CommandRegistry class is a manager for a collection of Command objects.
It allows the registration, modification, and retrieval of Command objects,
as well as the scanning and loading of command plugins from a specified
directory.
"""
def __init__(self):
self.commands = {}
def _import_module(self, module_name: str) -> Any:
return importlib.import_module(module_name)
def _reload_module(self, module: Any) -> Any:
return importlib.reload(module)
def register(self, cmd: Command) -> None:
self.commands[cmd.name] = cmd
def unregister(self, command_name: str):
if command_name in self.commands:
del self.commands[command_name]
else:
raise KeyError(f"Command '{command_name}' not found in registry.")
def reload_commands(self) -> None:
"""Reloads all loaded command plugins."""
for cmd_name in self.commands:
cmd = self.commands[cmd_name]
module = self._import_module(cmd.__module__)
reloaded_module = self._reload_module(module)
if hasattr(reloaded_module, "register"):
reloaded_module.register(self)
def get_command(self, name: str) -> Callable[..., Any]:
return self.commands[name]
def call(self, command_name: str, **kwargs) -> Any:
if command_name not in self.commands:
raise KeyError(f"Command '{command_name}' not found in registry.")
command = self.commands[command_name]
return command(**kwargs)
def command_prompt(self) -> str:
"""
Returns a string representation of all registered `Command` objects for use in a prompt
"""
commands_list = [
f"{idx + 1}. {str(cmd)}" for idx, cmd in enumerate(self.commands.values())
]
return "\n".join(commands_list)
def import_commands(self, module_name: str) -> None:
"""
Imports the specified Python module containing command plugins.
This method imports the associated module and registers any functions or
classes that are decorated with the `AUTO_GPT_COMMAND_IDENTIFIER` attribute
as `Command` objects. The registered `Command` objects are then added to the
`commands` dictionary of the `CommandRegistry` object.
Args:
module_name (str): The name of the module to import for command plugins.
"""
module = importlib.import_module(module_name)
for attr_name in dir(module):
attr = getattr(module, attr_name)
# Register decorated functions
if hasattr(attr, AUTO_GPT_COMMAND_IDENTIFIER) and getattr(
attr, AUTO_GPT_COMMAND_IDENTIFIER
):
self.register(attr.command)
# Register command classes
elif (
inspect.isclass(attr) and issubclass(attr, Command) and attr != Command
):
cmd_instance = attr()
self.register(cmd_instance)
def command(
name: str,
description: str,
signature: str = "",
enabled: bool = True,
disabled_reason: Optional[str] = None,
) -> Callable[..., Any]:
"""The command decorator is used to create Command objects from ordinary functions."""
def decorator(func: Callable[..., Any]) -> Command:
cmd = Command(
name=name,
description=description,
method=func,
signature=signature,
enabled=enabled,
disabled_reason=disabled_reason,
)
def wrapper(*args, **kwargs) -> Any:
return func(*args, **kwargs)
wrapper.command = cmd
setattr(wrapper, AUTO_GPT_COMMAND_IDENTIFIER, True)
return wrapper
return decorator

View File

@@ -5,19 +5,24 @@ import subprocess
import docker
from docker.errors import ImageNotFound
from autogpt.workspace import path_in_workspace, WORKSPACE_PATH
from autogpt.commands.command import command
from autogpt.config import Config
from autogpt.workspace import WORKSPACE_PATH, path_in_workspace
CFG = Config()
def execute_python_file(file: str):
@command("execute_python_file", "Execute Python File", '"filename": "<filename>"')
def execute_python_file(filename: str) -> str:
"""Execute a Python file in a Docker container and return the output
Args:
file (str): The name of the file to execute
filename (str): The name of the file to execute
Returns:
str: The output of the file
"""
file = filename
print(f"Executing file '{file}' in workspace '{WORKSPACE_PATH}'")
if not file.endswith(".py"):
@@ -40,10 +45,10 @@ def execute_python_file(file: str):
try:
client = docker.from_env()
# You can replace 'python:3.8' with the desired Python image/version
# You can replace this with the desired Python image/version
# You can find available Python images on Docker Hub:
# https://hub.docker.com/_/python
image_name = "python:3.10"
image_name = "python:3-alpine"
try:
client.images.get(image_name)
print(f"Image '{image_name}' found locally")
@@ -84,10 +89,25 @@ def execute_python_file(file: str):
return logs
except docker.errors.DockerException as e:
print(
"Could not run the script in a container. If you haven't already, please install Docker https://docs.docker.com/get-docker/"
)
return f"Error: {str(e)}"
except Exception as e:
return f"Error: {str(e)}"
@command(
"execute_shell",
"Execute Shell Command, non-interactive commands only",
'"command_line": "<command_line>"',
CFG.execute_local_commands,
"You are not allowed to run local shell commands. To execute"
" shell commands, EXECUTE_LOCAL_COMMANDS must be set to 'True' "
"in your config. Do not attempt to bypass the restriction.",
)
def execute_shell(command_line: str) -> str:
"""Execute a shell command and return the output
@@ -97,6 +117,13 @@ def execute_shell(command_line: str) -> str:
Returns:
str: The output of the command
"""
if not CFG.execute_local_commands:
return (
"You are not allowed to run local shell commands. To execute"
" shell commands, EXECUTE_LOCAL_COMMANDS must be set to 'True' "
"in your config. Do not attempt to bypass the restriction."
)
current_dir = os.getcwd()
# Change dir into workspace if necessary
if str(WORKSPACE_PATH) not in current_dir:
@@ -111,7 +138,43 @@ def execute_shell(command_line: str) -> str:
os.chdir(current_dir)
return output
@command(
"execute_shell_popen",
"Execute Shell Command, non-interactive commands only",
'"command_line": "<command_line>"',
CFG.execute_local_commands,
"You are not allowed to run local shell commands. To execute"
" shell commands, EXECUTE_LOCAL_COMMANDS must be set to 'True' "
"in your config. Do not attempt to bypass the restriction.",
)
def execute_shell_popen(command_line) -> str:
"""Execute a shell command with Popen and returns an english description
of the event and the process id
Args:
command_line (str): The command line to execute
Returns:
str: Description of the fact that the process started and its id
"""
current_dir = os.getcwd()
# Change dir into workspace if necessary
if str(WORKSPACE_PATH) not in current_dir:
os.chdir(WORKSPACE_PATH)
print(f"Executing command '{command_line}' in working directory '{os.getcwd()}'")
do_not_show_output = subprocess.DEVNULL
process = subprocess.Popen(
command_line, shell=True, stdout=do_not_show_output, stderr=do_not_show_output
)
# Change back to whatever the prior working dir was
os.chdir(current_dir)
return f"Subprocess started with PID:'{str(process.pid)}'"
def we_are_running_in_a_docker_container() -> bool:

View File

@@ -3,17 +3,19 @@ from __future__ import annotations
import os
import os.path
from pathlib import Path
from typing import Generator, List
from typing import Generator
import requests
from requests.adapters import HTTPAdapter
from requests.adapters import Retry
from colorama import Fore, Back
from colorama import Back, Fore
from requests.adapters import HTTPAdapter, Retry
from autogpt.commands.command import command
from autogpt.config import Config
from autogpt.spinner import Spinner
from autogpt.utils import readable_file_size
from autogpt.workspace import path_in_workspace, WORKSPACE_PATH
from autogpt.workspace import WORKSPACE_PATH, path_in_workspace
CFG = Config()
LOG_FILE = "file_logger.txt"
LOG_FILE_PATH = WORKSPACE_PATH / LOG_FILE
@@ -47,7 +49,7 @@ def log_operation(operation: str, filename: str) -> None:
with open(LOG_FILE_PATH, "w", encoding="utf-8") as f:
f.write("File Operation Logger ")
append_to_file(LOG_FILE, log_entry, shouldLog = False)
append_to_file(LOG_FILE, log_entry, shouldLog=False)
def split_file(
@@ -70,13 +72,19 @@ def split_file(
while start < content_length:
end = start + max_length
if end + overlap < content_length:
chunk = content[start : end + overlap]
chunk = content[start : end + overlap - 1]
else:
chunk = content[start:content_length]
# Account for the case where the last chunk is shorter than the overlap, so it has already been consumed
if len(chunk) <= overlap:
break
yield chunk
start += max_length - overlap
@command("read_file", "Read file", '"filename": "<filename>"')
def read_file(filename: str) -> str:
"""Read a file and return the contents
@@ -129,6 +137,7 @@ def ingest_file(
print(f"Error while ingesting file '{filename}': {str(e)}")
@command("write_to_file", "Write to file", '"filename": "<filename>", "text": "<text>"')
def write_to_file(filename: str, text: str) -> str:
"""Write text to a file
@@ -154,6 +163,9 @@ def write_to_file(filename: str, text: str) -> str:
return f"Error: {str(e)}"
@command(
"append_to_file", "Append to file", '"filename": "<filename>", "text": "<text>"'
)
def append_to_file(filename: str, text: str, shouldLog: bool = True) -> str:
"""Append text to a file
@@ -177,6 +189,7 @@ def append_to_file(filename: str, text: str, shouldLog: bool = True) -> str:
return f"Error: {str(e)}"
@command("delete_file", "Delete file", '"filename": "<filename>"')
def delete_file(filename: str) -> str:
"""Delete a file
@@ -197,6 +210,7 @@ def delete_file(filename: str) -> str:
return f"Error: {str(e)}"
@command("search_files", "Search Files", '"directory": "<directory>"')
def search_files(directory: str) -> list[str]:
"""Search for files in a directory
@@ -223,6 +237,13 @@ def search_files(directory: str) -> list[str]:
return found_files
@command(
"download_file",
"Search Files",
'"url": "<url>", "filename": "<filename>"',
CFG.allow_downloads,
"Error: You do not have user authorization to download files locally.",
)
def download_file(url, filename):
"""Downloads a file
Args:
@@ -236,23 +257,23 @@ def download_file(url, filename):
session = requests.Session()
retry = Retry(total=3, backoff_factor=1, status_forcelist=[502, 503, 504])
adapter = HTTPAdapter(max_retries=retry)
session.mount('http://', adapter)
session.mount('https://', adapter)
session.mount("http://", adapter)
session.mount("https://", adapter)
total_size = 0
downloaded_size = 0
with session.get(url, allow_redirects=True, stream=True) as r:
r.raise_for_status()
total_size = int(r.headers.get('Content-Length', 0))
total_size = int(r.headers.get("Content-Length", 0))
downloaded_size = 0
with open(safe_filename, 'wb') as f:
with open(safe_filename, "wb") as f:
for chunk in r.iter_content(chunk_size=8192):
f.write(chunk)
downloaded_size += len(chunk)
# Update the progress message
# Update the progress message
progress = f"{readable_file_size(downloaded_size)} / {readable_file_size(total_size)}"
spinner.update_message(f"{message} {progress}")

View File

@@ -1,25 +1,34 @@
"""Git operations for autogpt"""
import git
from git.repo import Repo
from autogpt.commands.command import command
from autogpt.config import Config
from autogpt.workspace import path_in_workspace
CFG = Config()
def clone_repository(repo_url: str, clone_path: str) -> str:
"""Clone a github repository locally
@command(
"clone_repository",
"Clone Repositoryy",
'"repository_url": "<repository_url>", "clone_path": "<clone_path>"',
CFG.github_username and CFG.github_api_key,
"Configure github_username and github_api_key.",
)
def clone_repository(repository_url: str, clone_path: str) -> str:
"""Clone a GitHub repository locally
Args:
repo_url (str): The URL of the repository to clone
repository_url (str): The URL of the repository to clone
clone_path (str): The path to clone the repository to
Returns:
str: The result of the clone operation"""
split_url = repo_url.split("//")
split_url = repository_url.split("//")
auth_repo_url = f"//{CFG.github_username}:{CFG.github_api_key}@".join(split_url)
safe_clone_path = path_in_workspace(clone_path)
try:
git.Repo.clone_from(auth_repo_url, safe_clone_path)
return f"""Cloned {repo_url} to {safe_clone_path}"""
Repo.clone_from(auth_repo_url, safe_clone_path)
return f"""Cloned {repository_url} to {safe_clone_path}"""
except Exception as e:
return f"Error: {str(e)}"

View File

@@ -5,13 +5,15 @@ import json
from duckduckgo_search import ddg
from autogpt.commands.command import command
from autogpt.config import Config
CFG = Config()
@command("google", "Google Search", '"query": "<query>"', not CFG.google_api_key)
def google_search(query: str, num_results: int = 8) -> str:
"""Return the results of a google search
"""Return the results of a Google search
Args:
query (str): The search query.
@@ -31,11 +33,19 @@ def google_search(query: str, num_results: int = 8) -> str:
for j in results:
search_results.append(j)
return json.dumps(search_results, ensure_ascii=False, indent=4)
results = json.dumps(search_results, ensure_ascii=False, indent=4)
return safe_google_results(results)
@command(
"google",
"Google Search",
'"query": "<query>"',
bool(CFG.google_api_key),
"Configure google_api_key.",
)
def google_official_search(query: str, num_results: int = 8) -> str | list[str]:
"""Return the results of a google search using the official Google API
"""Return the results of a Google search using the official Google API
Args:
query (str): The search query.
@@ -82,6 +92,26 @@ def google_official_search(query: str, num_results: int = 8) -> str | list[str]:
return "Error: The provided Google API key is invalid or missing."
else:
return f"Error: {e}"
# google_result can be a list or a string depending on the search results
# Return the list of search result URLs
return search_results_links
return safe_google_results(search_results_links)
def safe_google_results(results: str | list) -> str:
"""
Return the results of a google search in a safe format.
Args:
results (str | list): The search results.
Returns:
str: The results of the search.
"""
if isinstance(results, list):
safe_message = json.dumps(
[result.enocde("utf-8", "ignore") for result in results]
)
else:
safe_message = results.encode("utf-8", "ignore").decode("utf-8")
return safe_message

View File

@@ -1,23 +1,26 @@
""" Image Generation Module for AutoGPT."""
import io
import os.path
import uuid
from base64 import b64decode
import openai
import requests
from PIL import Image
from autogpt.commands.command import command
from autogpt.config import Config
from autogpt.workspace import path_in_workspace
CFG = Config()
def generate_image(prompt: str) -> str:
@command("generate_image", "Generate Image", '"prompt": "<prompt>"', CFG.image_provider)
def generate_image(prompt: str, size: int = 256) -> str:
"""Generate an image from a prompt.
Args:
prompt (str): The prompt to use
size (int, optional): The size of the image. Defaults to 256. (Not supported by HuggingFace)
Returns:
str: The filename of the image
@@ -26,11 +29,14 @@ def generate_image(prompt: str) -> str:
# DALL-E
if CFG.image_provider == "dalle":
return generate_image_with_dalle(prompt, filename)
elif CFG.image_provider == "sd":
return generate_image_with_dalle(prompt, filename, size)
# HuggingFace
elif CFG.image_provider == "huggingface":
return generate_image_with_hf(prompt, filename)
else:
return "No Image Provider Set"
# SD WebUI
elif CFG.image_provider == "sdwebui":
return generate_image_with_sd_webui(prompt, filename, size)
return "No Image Provider Set"
def generate_image_with_hf(prompt: str, filename: str) -> str:
@@ -44,13 +50,16 @@ def generate_image_with_hf(prompt: str, filename: str) -> str:
str: The filename of the image
"""
API_URL = (
"https://api-inference.huggingface.co/models/CompVis/stable-diffusion-v1-4"
f"https://api-inference.huggingface.co/models/{CFG.huggingface_image_model}"
)
if CFG.huggingface_api_token is None:
raise ValueError(
"You need to set your Hugging Face API token in the config file."
)
headers = {"Authorization": f"Bearer {CFG.huggingface_api_token}"}
headers = {
"Authorization": f"Bearer {CFG.huggingface_api_token}",
"X-Use-Cache": "false",
}
response = requests.post(
API_URL,
@@ -68,22 +77,31 @@ def generate_image_with_hf(prompt: str, filename: str) -> str:
return f"Saved to disk:{filename}"
def generate_image_with_dalle(prompt: str, filename: str) -> str:
def generate_image_with_dalle(prompt: str, filename: str, size: int) -> str:
"""Generate an image with DALL-E.
Args:
prompt (str): The prompt to use
filename (str): The filename to save the image to
size (int): The size of the image
Returns:
str: The filename of the image
"""
openai.api_key = CFG.openai_api_key
# Check for supported image sizes
if size not in [256, 512, 1024]:
closest = min([256, 512, 1024], key=lambda x: abs(x - size))
print(
f"DALL-E only supports image sizes of 256x256, 512x512, or 1024x1024. Setting to {closest}, was {size}."
)
size = closest
response = openai.Image.create(
prompt=prompt,
n=1,
size="256x256",
size=f"{size}x{size}",
response_format="b64_json",
)
@@ -95,3 +113,53 @@ def generate_image_with_dalle(prompt: str, filename: str) -> str:
png.write(image_data)
return f"Saved to disk:{filename}"
def generate_image_with_sd_webui(
prompt: str,
filename: str,
size: int = 512,
negative_prompt: str = "",
extra: dict = {},
) -> str:
"""Generate an image with Stable Diffusion webui.
Args:
prompt (str): The prompt to use
filename (str): The filename to save the image to
size (int, optional): The size of the image. Defaults to 256.
negative_prompt (str, optional): The negative prompt to use. Defaults to "".
extra (dict, optional): Extra parameters to pass to the API. Defaults to {}.
Returns:
str: The filename of the image
"""
# Create a session and set the basic auth if needed
s = requests.Session()
if CFG.sd_webui_auth:
username, password = CFG.sd_webui_auth.split(":")
s.auth = (username, password or "")
# Generate the images
response = requests.post(
f"{CFG.sd_webui_url}/sdapi/v1/txt2img",
json={
"prompt": prompt,
"negative_prompt": negative_prompt,
"sampler_index": "DDIM",
"steps": 20,
"cfg_scale": 7.0,
"width": size,
"height": size,
"n_iter": 1,
**extra,
},
)
print(f"Image Generated for prompt:{prompt}")
# Save the image to disk
response = response.json()
b64 = b64decode(response["images"][0].split(",", 1)[0])
image = Image.open(io.BytesIO(b64))
image.save(path_in_workspace(filename))
return f"Saved to disk:{filename}"

View File

@@ -2,9 +2,15 @@ from __future__ import annotations
import json
from autogpt.commands.command import command
from autogpt.llm_utils import call_ai_function
@command(
"improve_code",
"Get Improved Code",
'"suggestions": "<list_of_suggestions>", "code": "<full_code_string>"',
)
def improve_code(suggestions: list[str], code: str) -> str:
"""
A function that takes in code and suggestions and returns a response from create

View File

@@ -1,11 +1,30 @@
import tweepy
"""A module that contains a command to send a tweet."""
import os
import tweepy
from dotenv import load_dotenv
from autogpt.commands.command import command
load_dotenv()
def send_tweet(tweet_text):
@command(
"send_tweet",
"Send Tweet",
'"tweet_text": "<tweet_text>"',
)
def send_tweet(tweet_text: str) -> str:
"""
A function that takes in a string and returns a response from create chat
completion api call.
Args:
tweet_text (str): Text to be tweeted.
Returns:
A result from sending the tweet.
"""
consumer_key = os.environ.get("TW_CONSUMER_KEY")
consumer_secret = os.environ.get("TW_CONSUMER_SECRET")
access_token = os.environ.get("TW_ACCESS_TOKEN")
@@ -20,6 +39,6 @@ def send_tweet(tweet_text):
# Send tweet
try:
api.update_status(tweet_text)
print("Tweet sent successfully!")
return "Tweet sent successfully!"
except tweepy.TweepyException as e:
print("Error sending tweet: {}".format(e.reason))
return f"Error sending tweet: {e.reason}"

View File

@@ -8,6 +8,7 @@ except ImportError:
"Playwright not installed. Please install it with 'pip install playwright' to use."
)
from bs4 import BeautifulSoup
from autogpt.processing.html import extract_hyperlinks, format_hyperlinks

View File

@@ -4,9 +4,9 @@ from __future__ import annotations
from urllib.parse import urljoin, urlparse
import requests
from requests.compat import urljoin
from requests import Response
from bs4 import BeautifulSoup
from requests import Response
from requests.compat import urljoin
from autogpt.config import Config
from autogpt.memory import get_memory
@@ -58,9 +58,28 @@ def check_local_file_access(url: str) -> bool:
"""
local_prefixes = [
"file:///",
"file://localhost/",
"file://localhost",
"http://localhost",
"http://localhost/",
"https://localhost",
"https://localhost/",
"http://2130706433",
"http://2130706433/",
"https://2130706433",
"https://2130706433/",
"http://127.0.0.1/",
"http://127.0.0.1",
"https://127.0.0.1/",
"https://127.0.0.1",
"https://0.0.0.0/",
"https://0.0.0.0",
"http://0.0.0.0/",
"http://0.0.0.0",
"http://0000",
"http://0000/",
"https://0000",
"https://0000/",
]
return any(url.startswith(prefix) for prefix in local_prefixes)

View File

@@ -1,27 +1,36 @@
"""Selenium web scraping module."""
from __future__ import annotations
from selenium import webdriver
from autogpt.processing.html import extract_hyperlinks, format_hyperlinks
import autogpt.processing.text as summary
from bs4 import BeautifulSoup
from selenium.webdriver.remote.webdriver import WebDriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from webdriver_manager.chrome import ChromeDriverManager
from webdriver_manager.firefox import GeckoDriverManager
from selenium.webdriver.chrome.options import Options as ChromeOptions
from selenium.webdriver.firefox.options import Options as FirefoxOptions
from selenium.webdriver.safari.options import Options as SafariOptions
import logging
from pathlib import Path
from sys import platform
from bs4 import BeautifulSoup
from selenium import webdriver
from selenium.webdriver.chrome.options import Options as ChromeOptions
from selenium.webdriver.common.by import By
from selenium.webdriver.firefox.options import Options as FirefoxOptions
from selenium.webdriver.remote.webdriver import WebDriver
from selenium.webdriver.safari.options import Options as SafariOptions
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.wait import WebDriverWait
from webdriver_manager.chrome import ChromeDriverManager
from webdriver_manager.firefox import GeckoDriverManager
import autogpt.processing.text as summary
from autogpt.commands.command import command
from autogpt.config import Config
from autogpt.processing.html import extract_hyperlinks, format_hyperlinks
FILE_DIR = Path(__file__).parent.parent
CFG = Config()
@command(
"browse_website",
"Browse Website",
'"url": "<url>", "question": "<what_you_want_to_find_on_website>"',
)
def browse_website(url: str, question: str) -> tuple[str, WebDriver]:
"""Browse a website and return the answer and links to the user
@@ -75,7 +84,15 @@ def scrape_text_with_selenium(url: str) -> tuple[WebDriver, str]:
# See https://developer.apple.com/documentation/webkit/testing_with_webdriver_in_safari
driver = webdriver.Safari(options=options)
else:
if platform == "linux" or platform == "linux2":
options.add_argument("--disable-dev-shm-usage")
options.add_argument("--remote-debugging-port=9222")
options.add_argument("--no-sandbox")
if CFG.selenium_headless:
options.add_argument("--headless")
options.add_argument("--disable-gpu")
driver = webdriver.Chrome(
executable_path=ChromeDriverManager().install(), options=options
)

View File

@@ -2,9 +2,16 @@
from __future__ import annotations
import json
from autogpt.commands.command import command
from autogpt.llm_utils import call_ai_function
@command(
"write_tests",
"Write Tests",
'"code": "<full_code_string>", "focus": "<list_of_focus_areas>"',
)
def write_tests(code: str, focus: list[str]) -> str:
"""
A function that takes in code and focus topics and returns a response from create

View File

@@ -2,7 +2,7 @@
This module contains the configuration classes for AutoGPT.
"""
from autogpt.config.ai_config import AIConfig
from autogpt.config.config import check_openai_api_key, Config
from autogpt.config.config import Config, check_openai_api_key
from autogpt.config.singleton import AbstractSingleton, Singleton
__all__ = [

View File

@@ -5,9 +5,16 @@ A module that contains the AIConfig class object that contains the configuration
from __future__ import annotations
import os
from typing import Type
from pathlib import Path
from typing import Optional, Type
import yaml
from autogpt.prompts.generator import PromptGenerator
# Soon this will go in a folder where it remembers more stuff about the run(s)
SAVE_FILE = str(Path(os.getcwd()) / "ai_settings.yaml")
class AIConfig:
"""
@@ -37,9 +44,8 @@ class AIConfig:
self.ai_name = ai_name
self.ai_role = ai_role
self.ai_goals = ai_goals
# Soon this will go in a folder where it remembers more stuff about the run(s)
SAVE_FILE = os.path.join(os.path.dirname(__file__), "..", "ai_settings.yaml")
self.prompt_generator = None
self.command_registry = None
@staticmethod
def load(config_file: str = SAVE_FILE) -> "AIConfig":
@@ -88,7 +94,9 @@ class AIConfig:
with open(config_file, "w", encoding="utf-8") as file:
yaml.dump(config, file, allow_unicode=True)
def construct_full_prompt(self) -> str:
def construct_full_prompt(
self, prompt_generator: Optional[PromptGenerator] = None
) -> str:
"""
Returns a prompt to the user with the class information in an organized fashion.
@@ -107,14 +115,25 @@ class AIConfig:
""
)
from autogpt.prompt import get_prompt
from autogpt.config import Config
from autogpt.prompts.prompt import build_default_prompt_generator
cfg = Config()
if prompt_generator is None:
prompt_generator = build_default_prompt_generator()
prompt_generator.goals = self.ai_goals
prompt_generator.name = self.ai_name
prompt_generator.role = self.ai_role
prompt_generator.command_registry = self.command_registry
for plugin in cfg.plugins:
if not plugin.can_handle_post_prompt():
continue
prompt_generator = plugin.post_prompt(prompt_generator)
# Construct full prompt
full_prompt = (
f"You are {self.ai_name}, {self.ai_role}\n{prompt_start}\n\nGOALS:\n\n"
)
full_prompt = f"You are {prompt_generator.name}, {prompt_generator.role}\n{prompt_start}\n\nGOALS:\n\n"
for i, goal in enumerate(self.ai_goals):
full_prompt += f"{i+1}. {goal}\n"
full_prompt += f"\n\n{get_prompt()}"
self.prompt_generator = prompt_generator
full_prompt += f"\n\n{prompt_generator.generate_prompt_string()}"
return full_prompt

View File

@@ -1,14 +1,15 @@
"""Configuration class to store the state of bools for different scripts access."""
import os
from colorama import Fore
from autogpt.config.singleton import Singleton
from typing import List
import openai
import yaml
from auto_gpt_plugin_template import AutoGPTPluginTemplate
from colorama import Fore
from dotenv import load_dotenv
from autogpt.config.singleton import Singleton
load_dotenv(verbose=True)
@@ -25,22 +26,27 @@ class Config(metaclass=Singleton):
self.speak_mode = False
self.skip_reprompt = False
self.allow_downloads = False
self.skip_news = False
self.selenium_web_browser = os.getenv("USE_WEB_BROWSER", "chrome")
self.ai_settings_file = os.getenv("AI_SETTINGS_FILE", "ai_settings.yaml")
self.fast_llm_model = os.getenv("FAST_LLM_MODEL", "gpt-3.5-turbo")
self.smart_llm_model = os.getenv("SMART_LLM_MODEL", "gpt-4")
self.fast_token_limit = int(os.getenv("FAST_TOKEN_LIMIT", 4000))
self.smart_token_limit = int(os.getenv("SMART_TOKEN_LIMIT", 8000))
self.browse_chunk_max_length = int(os.getenv("BROWSE_CHUNK_MAX_LENGTH", 8192))
self.browse_summary_max_token = int(os.getenv("BROWSE_SUMMARY_MAX_TOKEN", 300))
self.browse_chunk_max_length = int(os.getenv("BROWSE_CHUNK_MAX_LENGTH", 3000))
self.browse_spacy_language_model = os.getenv(
"BROWSE_SPACY_LANGUAGE_MODEL", "en_core_web_sm"
)
self.openai_api_key = os.getenv("OPENAI_API_KEY")
self.temperature = float(os.getenv("TEMPERATURE", "1"))
self.temperature = float(os.getenv("TEMPERATURE", "0"))
self.use_azure = os.getenv("USE_AZURE") == "True"
self.execute_local_commands = (
os.getenv("EXECUTE_LOCAL_COMMANDS", "False") == "True"
)
self.restrict_to_workspace = (
os.getenv("RESTRICT_TO_WORKSPACE", "True") == "True"
)
if self.use_azure:
self.load_azure_config()
@@ -75,19 +81,31 @@ class Config(metaclass=Singleton):
self.weaviate_scopes = os.getenv("WEAVIATE_SCOPES", None)
self.weaviate_embedded_path = os.getenv("WEAVIATE_EMBEDDED_PATH")
self.weaviate_api_key = os.getenv("WEAVIATE_API_KEY", None)
self.use_weaviate_embedded = os.getenv("USE_WEAVIATE_EMBEDDED", "False") == "True"
self.use_weaviate_embedded = (
os.getenv("USE_WEAVIATE_EMBEDDED", "False") == "True"
)
# milvus configuration, e.g., localhost:19530.
self.milvus_addr = os.getenv("MILVUS_ADDR", "localhost:19530")
self.milvus_collection = os.getenv("MILVUS_COLLECTION", "autogpt")
self.image_provider = os.getenv("IMAGE_PROVIDER")
self.image_size = int(os.getenv("IMAGE_SIZE", 256))
self.huggingface_api_token = os.getenv("HUGGINGFACE_API_TOKEN")
self.huggingface_image_model = os.getenv(
"HUGGINGFACE_IMAGE_MODEL", "CompVis/stable-diffusion-v1-4"
)
self.huggingface_audio_to_text_model = os.getenv(
"HUGGINGFACE_AUDIO_TO_TEXT_MODEL"
)
self.sd_webui_url = os.getenv("SD_WEBUI_URL", "http://localhost:7860")
self.sd_webui_auth = os.getenv("SD_WEBUI_AUTH")
# User agent headers to use when browsing web
# Selenium browser settings
self.selenium_web_browser = os.getenv("USE_WEB_BROWSER", "chrome")
self.selenium_headless = os.getenv("HEADLESS_BROWSER", "True") == "True"
# User agent header to use when making HTTP requests
# Some websites might just completely deny request with an error code if
# no user agent was found.
self.user_agent = os.getenv(
@@ -95,6 +113,7 @@ class Config(metaclass=Singleton):
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36"
" (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36",
)
self.redis_host = os.getenv("REDIS_HOST", "localhost")
self.redis_port = os.getenv("REDIS_PORT", "6379")
self.redis_password = os.getenv("REDIS_PASSWORD", "")
@@ -106,6 +125,17 @@ class Config(metaclass=Singleton):
# Initialize the OpenAI API client
openai.api_key = self.openai_api_key
self.plugins_dir = os.getenv("PLUGINS_DIR", "plugins")
self.plugins: List[AutoGPTPluginTemplate] = []
self.plugins_openai = []
plugins_allowlist = os.getenv("ALLOWLISTED_PLUGINS")
if plugins_allowlist:
self.plugins_allowlist = plugins_allowlist.split(",")
else:
self.plugins_allowlist = []
self.plugins_denylist = []
def get_azure_deployment_id_for_model(self, model: str) -> str:
"""
Returns the relevant deployment id for the model specified.
@@ -131,7 +161,7 @@ class Config(metaclass=Singleton):
else:
return ""
AZURE_CONFIG_FILE = os.path.join(os.path.dirname(__file__), "..", "azure.yaml")
AZURE_CONFIG_FILE = os.path.join(os.path.dirname(__file__), "../..", "azure.yaml")
def load_azure_config(self, config_file: str = AZURE_CONFIG_FILE) -> None:
"""
@@ -154,7 +184,7 @@ class Config(metaclass=Singleton):
self.openai_api_version = (
config_params.get("azure_api_version") or "2023-03-15-preview"
)
self.azure_model_to_deployment_id_map = config_params.get("azure_model_map", [])
self.azure_model_to_deployment_id_map = config_params.get("azure_model_map", {})
def set_continuous_mode(self, value: bool) -> None:
"""Set the continuous mode value."""
@@ -188,10 +218,6 @@ class Config(metaclass=Singleton):
"""Set the browse_website command chunk max length value."""
self.browse_chunk_max_length = value
def set_browse_summary_max_token(self, value: int) -> None:
"""Set the browse_website command summary max token value."""
self.browse_summary_max_token = value
def set_openai_api_key(self, value: str) -> None:
"""Set the OpenAI API key value."""
self.openai_api_key = value
@@ -228,6 +254,10 @@ class Config(metaclass=Singleton):
"""Set the debug mode value."""
self.debug_mode = value
def set_plugins(self, value: list) -> None:
"""Set the plugins value."""
self.plugins = value
def check_openai_api_key() -> None:
"""Check if the OpenAI API key is set in config.py or as an environment variable."""
@@ -237,5 +267,5 @@ def check_openai_api_key() -> None:
Fore.RED
+ "Please set your OpenAI API key in .env or as an environment variable."
)
print("You can get your key from https://beta.openai.com/account/api-keys")
print("You can get your key from https://platform.openai.com/account/api-keys")
exit(1)

134
autogpt/configurator.py Normal file
View File

@@ -0,0 +1,134 @@
"""Configurator module."""
import click
from colorama import Back, Fore, Style
from autogpt import utils
from autogpt.config import Config
from autogpt.logs import logger
from autogpt.memory import get_supported_memory_backends
CFG = Config()
def create_config(
continuous: bool,
continuous_limit: int,
ai_settings_file: str,
skip_reprompt: bool,
speak: bool,
debug: bool,
gpt3only: bool,
gpt4only: bool,
memory_type: str,
browser_name: str,
allow_downloads: bool,
skip_news: bool,
) -> None:
"""Updates the config object with the given arguments.
Args:
continuous (bool): Whether to run in continuous mode
continuous_limit (int): The number of times to run in continuous mode
ai_settings_file (str): The path to the ai_settings.yaml file
skip_reprompt (bool): Whether to skip the re-prompting messages at the beginning of the script
speak (bool): Whether to enable speak mode
debug (bool): Whether to enable debug mode
gpt3only (bool): Whether to enable GPT3.5 only mode
gpt4only (bool): Whether to enable GPT4 only mode
memory_type (str): The type of memory backend to use
browser_name (str): The name of the browser to use when using selenium to scrape the web
allow_downloads (bool): Whether to allow Auto-GPT to download files natively
skips_news (bool): Whether to suppress the output of latest news on startup
"""
CFG.set_debug_mode(False)
CFG.set_continuous_mode(False)
CFG.set_speak_mode(False)
if debug:
logger.typewriter_log("Debug Mode: ", Fore.GREEN, "ENABLED")
CFG.set_debug_mode(True)
if continuous:
logger.typewriter_log("Continuous Mode: ", Fore.RED, "ENABLED")
logger.typewriter_log(
"WARNING: ",
Fore.RED,
"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. Use at your own risk.",
)
CFG.set_continuous_mode(True)
if continuous_limit:
logger.typewriter_log(
"Continuous Limit: ", Fore.GREEN, f"{continuous_limit}"
)
CFG.set_continuous_limit(continuous_limit)
# Check if continuous limit is used without continuous mode
if continuous_limit and not continuous:
raise click.UsageError("--continuous-limit can only be used with --continuous")
if speak:
logger.typewriter_log("Speak Mode: ", Fore.GREEN, "ENABLED")
CFG.set_speak_mode(True)
if gpt3only:
logger.typewriter_log("GPT3.5 Only Mode: ", Fore.GREEN, "ENABLED")
CFG.set_smart_llm_model(CFG.fast_llm_model)
if gpt4only:
logger.typewriter_log("GPT4 Only Mode: ", Fore.GREEN, "ENABLED")
CFG.set_fast_llm_model(CFG.smart_llm_model)
if memory_type:
supported_memory = get_supported_memory_backends()
chosen = memory_type
if chosen not in supported_memory:
logger.typewriter_log(
"ONLY THE FOLLOWING MEMORY BACKENDS ARE SUPPORTED: ",
Fore.RED,
f"{supported_memory}",
)
logger.typewriter_log("Defaulting to: ", Fore.YELLOW, CFG.memory_backend)
else:
CFG.memory_backend = chosen
if skip_reprompt:
logger.typewriter_log("Skip Re-prompt: ", Fore.GREEN, "ENABLED")
CFG.skip_reprompt = True
if ai_settings_file:
file = ai_settings_file
# Validate file
(validated, message) = utils.validate_yaml_file(file)
if not validated:
logger.typewriter_log("FAILED FILE VALIDATION", Fore.RED, message)
logger.double_check()
exit(1)
logger.typewriter_log("Using AI Settings File:", Fore.GREEN, file)
CFG.ai_settings_file = file
CFG.skip_reprompt = True
if allow_downloads:
logger.typewriter_log("Native Downloading:", Fore.GREEN, "ENABLED")
logger.typewriter_log(
"WARNING: ",
Fore.YELLOW,
f"{Back.LIGHTYELLOW_EX}Auto-GPT will now be able to download and save files to your machine.{Back.RESET} "
+ "It is recommended that you monitor any files it downloads carefully.",
)
logger.typewriter_log(
"WARNING: ",
Fore.YELLOW,
f"{Back.RED + Style.BRIGHT}ALWAYS REMEMBER TO NEVER OPEN FILES YOU AREN'T SURE OF!{Style.RESET_ALL}",
)
CFG.allow_downloads = True
if skip_news:
CFG.skip_news = True
if browser_name:
CFG.selenium_web_browser = browser_name

View File

@@ -1,53 +0,0 @@
"""This module contains the function to fix JSON strings using GPT-3."""
import json
from autogpt.llm_utils import call_ai_function
from autogpt.logs import logger
from autogpt.config import Config
CFG = Config()
def fix_json(json_string: str, schema: str) -> str:
"""Fix the given JSON string to make it parseable and fully compliant with
the provided schema.
Args:
json_string (str): The JSON string to fix.
schema (str): The schema to use to fix the JSON.
Returns:
str: The fixed JSON string.
"""
# Try to fix the JSON using GPT:
function_string = "def fix_json(json_string: str, schema:str=None) -> str:"
args = [f"'''{json_string}'''", f"'''{schema}'''"]
description_string = (
"This function takes a JSON string and ensures that it"
" is parseable and fully compliant with the provided schema. If an object"
" or field specified in the schema isn't contained within the correct JSON,"
" it is omitted. The function also escapes any double quotes within JSON"
" string values to ensure that they are valid. If the JSON string contains"
" any None or NaN values, they are replaced with null before being parsed."
)
# If it doesn't already start with a "`", add one:
if not json_string.startswith("`"):
json_string = "```json\n" + json_string + "\n```"
result_string = call_ai_function(
function_string, args, description_string, model=CFG.fast_llm_model
)
logger.debug("------------ JSON FIX ATTEMPT ---------------")
logger.debug(f"Original JSON: {json_string}")
logger.debug("-----------")
logger.debug(f"Fixed JSON: {result_string}")
logger.debug("----------- END OF FIX ATTEMPT ----------------")
try:
json.loads(result_string) # just check the validity
return result_string
except json.JSONDecodeError:
# Get the call stack:
# import traceback
# call_stack = traceback.format_exc()
# print(f"Failed to fix JSON: '{json_string}' "+call_stack)
return "failed"

View File

@@ -1,36 +0,0 @@
"""Fix JSON brackets."""
from __future__ import annotations
import contextlib
import json
from typing import Optional
from autogpt.config import Config
CFG = Config()
def balance_braces(json_string: str) -> Optional[str]:
"""
Balance the braces in a JSON string.
Args:
json_string (str): The JSON string.
Returns:
str: The JSON string with braces balanced.
"""
open_braces_count = json_string.count("{")
close_braces_count = json_string.count("}")
while open_braces_count > close_braces_count:
json_string += "}"
close_braces_count += 1
while close_braces_count > open_braces_count:
json_string = json_string.rstrip("}")
close_braces_count -= 1
with contextlib.suppress(json.JSONDecodeError):
json.loads(json_string)
return json_string

View File

@@ -1,33 +0,0 @@
""" Fix invalid escape sequences in JSON strings. """
import json
from autogpt.config import Config
from autogpt.json_fixes.utilities import extract_char_position
CFG = Config()
def fix_invalid_escape(json_to_load: str, error_message: str) -> str:
"""Fix invalid escape sequences in JSON strings.
Args:
json_to_load (str): The JSON string.
error_message (str): The error message from the JSONDecodeError
exception.
Returns:
str: The JSON string with invalid escape sequences fixed.
"""
while error_message.startswith("Invalid \\escape"):
bad_escape_location = extract_char_position(error_message)
json_to_load = (
json_to_load[:bad_escape_location] + json_to_load[bad_escape_location + 1 :]
)
try:
json.loads(json_to_load)
return json_to_load
except json.JSONDecodeError as e:
if CFG.debug_mode:
print("json loads error - fix invalid escape", e)
error_message = str(e)
return json_to_load

View File

@@ -1,28 +0,0 @@
from typing import Any, Dict
from autogpt.config import Config
from autogpt.logs import logger
from autogpt.speech import say_text
CFG = Config()
def fix_json_using_multiple_techniques(assistant_reply: str) -> Dict[Any, Any]:
from autogpt.json_fixes.parsing import attempt_to_fix_json_by_finding_outermost_brackets
from autogpt.json_fixes.parsing import fix_and_parse_json
# Parse and print Assistant response
assistant_reply_json = fix_and_parse_json(assistant_reply)
if assistant_reply_json == {}:
assistant_reply_json = attempt_to_fix_json_by_finding_outermost_brackets(
assistant_reply
)
if assistant_reply_json != {}:
return assistant_reply_json
logger.error("Error: The following AI output couldn't be converted to a JSON:\n", assistant_reply)
if CFG.speak_mode:
say_text("I have received an invalid JSON response from the OpenAI API.")
return {}

View File

@@ -1,27 +0,0 @@
"""Fix quotes in a JSON string."""
import json
import re
def add_quotes_to_property_names(json_string: str) -> str:
"""
Add quotes to property names in a JSON string.
Args:
json_string (str): The JSON string.
Returns:
str: The JSON string with quotes added to property names.
"""
def replace_func(match: re.Match) -> str:
return f'"{match[1]}":'
property_name_pattern = re.compile(r"(\w+):")
corrected_json_string = property_name_pattern.sub(replace_func, json_string)
try:
json.loads(corrected_json_string)
return corrected_json_string
except json.JSONDecodeError as e:
raise e

View File

@@ -1,20 +0,0 @@
"""Utilities for the json_fixes package."""
import re
def extract_char_position(error_message: str) -> int:
"""Extract the character position from the JSONDecodeError message.
Args:
error_message (str): The error message from the JSONDecodeError
exception.
Returns:
int: The character position.
"""
char_pattern = re.compile(r"\(char (\d+)\)")
if match := char_pattern.search(error_message):
return int(match[1])
else:
raise ValueError("Character position not found in the error message.")

View File

@@ -0,0 +1,124 @@
"""This module contains functions to fix JSON strings using general programmatic approaches, suitable for addressing
common JSON formatting issues."""
from __future__ import annotations
import contextlib
import json
import re
from typing import Optional
from autogpt.config import Config
from autogpt.json_utils.utilities import extract_char_position
CFG = Config()
def fix_invalid_escape(json_to_load: str, error_message: str) -> str:
"""Fix invalid escape sequences in JSON strings.
Args:
json_to_load (str): The JSON string.
error_message (str): The error message from the JSONDecodeError
exception.
Returns:
str: The JSON string with invalid escape sequences fixed.
"""
while error_message.startswith("Invalid \\escape"):
bad_escape_location = extract_char_position(error_message)
json_to_load = (
json_to_load[:bad_escape_location] + json_to_load[bad_escape_location + 1 :]
)
try:
json.loads(json_to_load)
return json_to_load
except json.JSONDecodeError as e:
if CFG.debug_mode:
print("json loads error - fix invalid escape", e)
error_message = str(e)
return json_to_load
def balance_braces(json_string: str) -> Optional[str]:
"""
Balance the braces in a JSON string.
Args:
json_string (str): The JSON string.
Returns:
str: The JSON string with braces balanced.
"""
open_braces_count = json_string.count("{")
close_braces_count = json_string.count("}")
while open_braces_count > close_braces_count:
json_string += "}"
close_braces_count += 1
while close_braces_count > open_braces_count:
json_string = json_string.rstrip("}")
close_braces_count -= 1
with contextlib.suppress(json.JSONDecodeError):
json.loads(json_string)
return json_string
def add_quotes_to_property_names(json_string: str) -> str:
"""
Add quotes to property names in a JSON string.
Args:
json_string (str): The JSON string.
Returns:
str: The JSON string with quotes added to property names.
"""
def replace_func(match: re.Match) -> str:
return f'"{match[1]}":'
property_name_pattern = re.compile(r"(\w+):")
corrected_json_string = property_name_pattern.sub(replace_func, json_string)
try:
json.loads(corrected_json_string)
return corrected_json_string
except json.JSONDecodeError as e:
raise e
def correct_json(json_to_load: str) -> str:
"""
Correct common JSON errors.
Args:
json_to_load (str): The JSON string.
"""
try:
if CFG.debug_mode:
print("json", json_to_load)
json.loads(json_to_load)
return json_to_load
except json.JSONDecodeError as e:
if CFG.debug_mode:
print("json loads error", e)
error_message = str(e)
if error_message.startswith("Invalid \\escape"):
json_to_load = fix_invalid_escape(json_to_load, error_message)
if error_message.startswith(
"Expecting property name enclosed in double quotes"
):
json_to_load = add_quotes_to_property_names(json_to_load)
try:
json.loads(json_to_load)
return json_to_load
except json.JSONDecodeError as e:
if CFG.debug_mode:
print("json loads error - add quotes", e)
error_message = str(e)
if balanced_str := balance_braces(json_to_load):
return balanced_str
return json_to_load

View File

@@ -1,21 +1,20 @@
"""Fix and parse JSON strings."""
"""This module contains functions to fix JSON strings generated by LLM models, such as ChatGPT, using the assistance
of the ChatGPT API or LLM models."""
from __future__ import annotations
import contextlib
import json
from typing import Any, Dict, Union
from typing import Any, Dict
from colorama import Fore
from regex import regex
from autogpt.config import Config
from autogpt.json_fixes.auto_fix import fix_json
from autogpt.json_fixes.bracket_termination import balance_braces
from autogpt.json_fixes.escaping import fix_invalid_escape
from autogpt.json_fixes.missing_quotes import add_quotes_to_property_names
from autogpt.json_utils.json_fix_general import correct_json
from autogpt.llm_utils import call_ai_function
from autogpt.logs import logger
from autogpt.speech import say_text
CFG = Config()
JSON_SCHEMA = """
{
"command": {
@@ -35,39 +34,82 @@ JSON_SCHEMA = """
}
"""
CFG = Config()
def auto_fix_json(json_string: str, schema: str) -> str:
"""Fix the given JSON string to make it parseable and fully compliant with
the provided schema using GPT-3.
def correct_json(json_to_load: str) -> str:
"""
Correct common JSON errors.
Args:
json_to_load (str): The JSON string.
json_string (str): The JSON string to fix.
schema (str): The schema to use to fix the JSON.
Returns:
str: The fixed JSON string.
"""
# Try to fix the JSON using GPT:
function_string = "def fix_json(json_string: str, schema:str=None) -> str:"
args = [f"'''{json_string}'''", f"'''{schema}'''"]
description_string = (
"This function takes a JSON string and ensures that it"
" is parseable and fully compliant with the provided schema. If an object"
" or field specified in the schema isn't contained within the correct JSON,"
" it is omitted. The function also escapes any double quotes within JSON"
" string values to ensure that they are valid. If the JSON string contains"
" any None or NaN values, they are replaced with null before being parsed."
)
# If it doesn't already start with a "`", add one:
if not json_string.startswith("`"):
json_string = "```json\n" + json_string + "\n```"
result_string = call_ai_function(
function_string, args, description_string, model=CFG.fast_llm_model
)
logger.debug("------------ JSON FIX ATTEMPT ---------------")
logger.debug(f"Original JSON: {json_string}")
logger.debug("-----------")
logger.debug(f"Fixed JSON: {result_string}")
logger.debug("----------- END OF FIX ATTEMPT ----------------")
try:
if CFG.debug_mode:
print("json", json_to_load)
json.loads(json_to_load)
return json_to_load
except json.JSONDecodeError as e:
if CFG.debug_mode:
print("json loads error", e)
error_message = str(e)
if error_message.startswith("Invalid \\escape"):
json_to_load = fix_invalid_escape(json_to_load, error_message)
if error_message.startswith(
"Expecting property name enclosed in double quotes"
):
json_to_load = add_quotes_to_property_names(json_to_load)
try:
json.loads(json_to_load)
return json_to_load
except json.JSONDecodeError as e:
if CFG.debug_mode:
print("json loads error - add quotes", e)
error_message = str(e)
if balanced_str := balance_braces(json_to_load):
return balanced_str
return json_to_load
json.loads(result_string) # just check the validity
return result_string
except json.JSONDecodeError: # noqa: E722
# Get the call stack:
# import traceback
# call_stack = traceback.format_exc()
# print(f"Failed to fix JSON: '{json_string}' "+call_stack)
return "failed"
def fix_json_using_multiple_techniques(assistant_reply: str) -> Dict[Any, Any]:
"""Fix the given JSON string to make it parseable and fully compliant with two techniques.
Args:
json_string (str): The JSON string to fix.
Returns:
str: The fixed JSON string.
"""
# Parse and print Assistant response
assistant_reply_json = fix_and_parse_json(assistant_reply)
if assistant_reply_json == {}:
assistant_reply_json = attempt_to_fix_json_by_finding_outermost_brackets(
assistant_reply
)
if assistant_reply_json != {}:
return assistant_reply_json
logger.error(
"Error: The following AI output couldn't be converted to a JSON:\n",
assistant_reply,
)
if CFG.speak_mode:
say_text("I have received an invalid JSON response from the OpenAI API.")
return {}
def fix_and_parse_json(
@@ -134,7 +176,7 @@ def try_ai_fix(
" slightly."
)
# Now try to fix this up using the ai_functions
ai_fixed_json = fix_json(json_to_load, JSON_SCHEMA)
ai_fixed_json = auto_fix_json(json_to_load, JSON_SCHEMA)
if ai_fixed_json != "failed":
return json.loads(ai_fixed_json)

View File

@@ -0,0 +1,54 @@
"""Utilities for the json_fixes package."""
import json
import re
from jsonschema import Draft7Validator
from autogpt.config import Config
from autogpt.logs import logger
CFG = Config()
def extract_char_position(error_message: str) -> int:
"""Extract the character position from the JSONDecodeError message.
Args:
error_message (str): The error message from the JSONDecodeError
exception.
Returns:
int: The character position.
"""
char_pattern = re.compile(r"\(char (\d+)\)")
if match := char_pattern.search(error_message):
return int(match[1])
else:
raise ValueError("Character position not found in the error message.")
def validate_json(json_object: object, schema_name: object) -> object:
"""
:type schema_name: object
:param schema_name:
:type json_object: object
"""
with open(f"autogpt/json_utils/{schema_name}.json", "r") as f:
schema = json.load(f)
validator = Draft7Validator(schema)
if errors := sorted(validator.iter_errors(json_object), key=lambda e: e.path):
logger.error("The JSON object is invalid.")
if CFG.debug_mode:
logger.error(
json.dumps(json_object, indent=4)
) # Replace 'json_object' with the variable containing the JSON data
logger.error("The following issues were found:")
for error in errors:
logger.error(f"Error: {error.message}")
elif CFG.debug_mode:
print("The JSON object is valid.")
return json_object

View File

@@ -1,30 +0,0 @@
import json
from jsonschema import Draft7Validator
from autogpt.config import Config
from autogpt.logs import logger
CFG = Config()
def validate_json(json_object: object, schema_name: object) -> object:
"""
:type schema_name: object
:param schema_name:
:type json_object: object
"""
with open(f"autogpt/json_schemas/{schema_name}.json", "r") as f:
schema = json.load(f)
validator = Draft7Validator(schema)
if errors := sorted(validator.iter_errors(json_object), key=lambda e: e.path):
logger.error("The JSON object is invalid.")
if CFG.debug_mode:
logger.error(json.dumps(json_object, indent=4)) # Replace 'json_object' with the variable containing the JSON data
logger.error("The following issues were found:")
for error in errors:
logger.error(f"Error: {error.message}")
elif CFG.debug_mode:
print("The JSON object is valid.")
return json_object

View File

@@ -1,13 +1,15 @@
from __future__ import annotations
from ast import List
import time
from typing import List, Optional
import openai
from colorama import Fore, Style
from openai.error import APIError, RateLimitError
from colorama import Fore
from autogpt.config import Config
from autogpt.logs import logger
from autogpt.types.openai import Message
CFG = Config()
@@ -36,8 +38,8 @@ def call_ai_function(
# For each arg, if any are None, convert to "None":
args = [str(arg) if arg is not None else "None" for arg in args]
# parse args to comma separated string
args = ", ".join(args)
messages = [
args: str = ", ".join(args)
messages: List[Message] = [
{
"role": "system",
"content": f"You are now the following python function: ```# {description}"
@@ -52,15 +54,15 @@ def call_ai_function(
# Overly simple abstraction until we create something better
# simple retry mechanism when getting a rate error or a bad gateway
def create_chat_completion(
messages: list, # type: ignore
model: str | None = None,
messages: List[Message], # type: ignore
model: Optional[str] = None,
temperature: float = CFG.temperature,
max_tokens: int | None = None,
max_tokens: Optional[int] = None,
) -> str:
"""Create a chat completion using the OpenAI API
Args:
messages (list[dict[str, str]]): The messages to send to the chat completion
messages (List[Message]): The messages to send to the chat completion
model (str, optional): The model to use. Defaults to None.
temperature (float, optional): The temperature to use. Defaults to 0.9.
max_tokens (int, optional): The max tokens to use. Defaults to None.
@@ -68,14 +70,28 @@ def create_chat_completion(
Returns:
str: The response from the chat completion
"""
response = None
num_retries = 10
warned_user = False
if CFG.debug_mode:
print(
Fore.GREEN
+ f"Creating chat completion with model {model}, temperature {temperature},"
f" max_tokens {max_tokens}" + Fore.RESET
f"{Fore.GREEN}Creating chat completion with model {model}, temperature {temperature}, max_tokens {max_tokens}{Fore.RESET}"
)
for plugin in CFG.plugins:
if plugin.can_handle_chat_completion(
messages=messages,
model=model,
temperature=temperature,
max_tokens=max_tokens,
):
message = plugin.handle_chat_completion(
messages=messages,
model=model,
temperature=temperature,
max_tokens=max_tokens,
)
if message is not None:
return message
response = None
for attempt in range(num_retries):
backoff = 2 ** (attempt + 2)
try:
@@ -98,30 +114,47 @@ def create_chat_completion(
except RateLimitError:
if CFG.debug_mode:
print(
Fore.RED + "Error: ",
f"Reached rate limit, passing..." + Fore.RESET,
f"{Fore.RED}Error: ", f"Reached rate limit, passing...{Fore.RESET}"
)
if not warned_user:
logger.double_check(
f"Please double check that you have setup a {Fore.CYAN + Style.BRIGHT}PAID{Style.RESET_ALL} OpenAI API Account. "
+ f"You can read more here: {Fore.CYAN}https://github.com/Significant-Gravitas/Auto-GPT#openai-api-keys-configuration{Fore.RESET}"
)
warned_user = True
except APIError as e:
if e.http_status == 502:
pass
else:
if e.http_status != 502:
raise
if attempt == num_retries - 1:
raise
if CFG.debug_mode:
print(
Fore.RED + "Error: ",
f"API Bad gateway. Waiting {backoff} seconds..." + Fore.RESET,
f"{Fore.RED}Error: ",
f"API Bad gateway. Waiting {backoff} seconds...{Fore.RESET}",
)
time.sleep(backoff)
if response is None:
raise RuntimeError(f"Failed to get response after {num_retries} retries")
return response.choices[0].message["content"]
logger.typewriter_log(
"FAILED TO GET RESPONSE FROM OPENAI",
Fore.RED,
"Auto-GPT has failed to get a response from OpenAI's services. "
+ f"Try running Auto-GPT again, and if the problem the persists try running it with `{Fore.CYAN}--debug{Fore.RESET}`.",
)
logger.double_check()
if CFG.debug_mode:
raise RuntimeError(f"Failed to get response after {num_retries} retries")
else:
quit(1)
resp = response.choices[0].message["content"]
for plugin in CFG.plugins:
if not plugin.can_handle_on_response():
continue
resp = plugin.on_response(resp)
return resp
def create_embedding_with_ada(text) -> list:
"""Create a embedding with text-ada-002 using the OpenAI SDK"""
"""Create an embedding with text-ada-002 using the OpenAI SDK"""
num_retries = 10
for attempt in range(num_retries):
backoff = 2 ** (attempt + 2)
@@ -140,15 +173,13 @@ def create_embedding_with_ada(text) -> list:
except RateLimitError:
pass
except APIError as e:
if e.http_status == 502:
pass
else:
if e.http_status != 502:
raise
if attempt == num_retries - 1:
raise
if CFG.debug_mode:
print(
Fore.RED + "Error: ",
f"API Bad gateway. Waiting {backoff} seconds..." + Fore.RESET,
f"{Fore.RED}Error: ",
f"API Bad gateway. Waiting {backoff} seconds...{Fore.RESET}",
)
time.sleep(backoff)

View File

@@ -5,13 +5,13 @@ import os
import random
import re
import time
from logging import LogRecord
import traceback
from logging import LogRecord
from colorama import Fore, Style
from autogpt.speech import say_text
from autogpt.config import Config, Singleton
from autogpt.speech import say_text
CFG = Config()
@@ -47,7 +47,7 @@ class Logger(metaclass=Singleton):
# Info handler in activity.log
self.file_handler = logging.FileHandler(
os.path.join(log_dir, log_file), 'a', 'utf-8'
os.path.join(log_dir, log_file), "a", "utf-8"
)
self.file_handler.setLevel(logging.DEBUG)
info_formatter = AutoGptFormatter(
@@ -57,7 +57,7 @@ class Logger(metaclass=Singleton):
# Error handler error.log
error_handler = logging.FileHandler(
os.path.join(log_dir, error_file), 'a', 'utf-8'
os.path.join(log_dir, error_file), "a", "utf-8"
)
error_handler.setLevel(logging.ERROR)
error_formatter = AutoGptFormatter(
@@ -79,7 +79,7 @@ class Logger(metaclass=Singleton):
self.logger.setLevel(logging.DEBUG)
def typewriter_log(
self, title="", title_color="", content="", speak_text=False, level=logging.INFO
self, title="", title_color="", content="", speak_text=False, level=logging.INFO
):
if speak_text and CFG.speak_mode:
say_text(f"{title}. {content}")
@@ -95,18 +95,18 @@ class Logger(metaclass=Singleton):
)
def debug(
self,
message,
title="",
title_color="",
self,
message,
title="",
title_color="",
):
self._log(title, title_color, message, logging.DEBUG)
def warn(
self,
message,
title="",
title_color="",
self,
message,
title="",
title_color="",
):
self._log(title, title_color, message, logging.WARN)
@@ -180,10 +180,10 @@ class AutoGptFormatter(logging.Formatter):
def format(self, record: LogRecord) -> str:
if hasattr(record, "color"):
record.title_color = (
getattr(record, "color")
+ getattr(record, "title")
+ " "
+ Style.RESET_ALL
getattr(record, "color")
+ getattr(record, "title")
+ " "
+ Style.RESET_ALL
)
else:
record.title_color = getattr(record, "title")
@@ -204,10 +204,10 @@ logger = Logger()
def print_assistant_thoughts(ai_name, assistant_reply):
"""Prints the assistant's thoughts to the console"""
from autogpt.json_fixes.bracket_termination import (
from autogpt.json_utils.json_fix_llm import (
attempt_to_fix_json_by_finding_outermost_brackets,
fix_and_parse_json,
)
from autogpt.json_fixes.parsing import fix_and_parse_json
try:
try:
@@ -294,7 +294,9 @@ def print_assistant_thoughts(ai_name, assistant_reply):
logger.error("Error: \n", call_stack)
def print_assistant_thoughts(ai_name: object, assistant_reply_json_valid: object) -> None:
def print_assistant_thoughts(
ai_name: object, assistant_reply_json_valid: object
) -> None:
assistant_thoughts_reasoning = None
assistant_thoughts_plan = None
assistant_thoughts_speak = None
@@ -310,9 +312,7 @@ def print_assistant_thoughts(ai_name: object, assistant_reply_json_valid: object
logger.typewriter_log(
f"{ai_name.upper()} THOUGHTS:", Fore.YELLOW, f"{assistant_thoughts_text}"
)
logger.typewriter_log(
"REASONING:", Fore.YELLOW, f"{assistant_thoughts_reasoning}"
)
logger.typewriter_log("REASONING:", Fore.YELLOW, f"{assistant_thoughts_reasoning}")
if assistant_thoughts_plan:
logger.typewriter_log("PLAN:", Fore.YELLOW, "")
# If it's a list, join it into a string
@@ -326,9 +326,7 @@ def print_assistant_thoughts(ai_name: object, assistant_reply_json_valid: object
for line in lines:
line = line.lstrip("- ")
logger.typewriter_log("- ", Fore.GREEN, line.strip())
logger.typewriter_log(
"CRITICISM:", Fore.YELLOW, f"{assistant_thoughts_criticism}"
)
logger.typewriter_log("CRITICISM:", Fore.YELLOW, f"{assistant_thoughts_criticism}")
# Speak the assistant's thoughts
if CFG.speak_mode and assistant_thoughts_speak:
say_text(assistant_thoughts_speak)

View File

@@ -60,8 +60,10 @@ def get_memory(cfg, init=False):
memory = RedisMemory(cfg)
elif cfg.memory_backend == "weaviate":
if not WeaviateMemory:
print("Error: Weaviate is not installed. Please install weaviate-client to"
" use Weaviate as a memory backend.")
print(
"Error: Weaviate is not installed. Please install weaviate-client to"
" use Weaviate as a memory backend."
)
else:
memory = WeaviateMemory(cfg)
elif cfg.memory_backend == "milvus":
@@ -93,5 +95,5 @@ __all__ = [
"PineconeMemory",
"NoMemory",
"MilvusMemory",
"WeaviateMemory"
"WeaviateMemory",
]

View File

@@ -2,13 +2,13 @@ from __future__ import annotations
import dataclasses
import os
from typing import Any
from typing import Any, List
import numpy as np
import orjson
from autogpt.memory.base import MemoryProviderSingleton
from autogpt.llm_utils import create_embedding_with_ada
from autogpt.memory.base import MemoryProviderSingleton
EMBED_DIM = 1536
SAVE_OPTIONS = orjson.OPT_SERIALIZE_NUMPY | orjson.OPT_SERIALIZE_DATACLASS

View File

@@ -1,11 +1,5 @@
""" Milvus memory storage provider."""
from pymilvus import (
connections,
FieldSchema,
CollectionSchema,
DataType,
Collection,
)
from pymilvus import Collection, CollectionSchema, DataType, FieldSchema, connections
from autogpt.memory.base import MemoryProviderSingleton, get_ada_embedding
@@ -46,7 +40,7 @@ class MilvusMemory(MemoryProviderSingleton):
self.collection.load()
def add(self, data) -> str:
"""Add a embedding of data into memory.
"""Add an embedding of data into memory.
Args:
data (str): The raw text to construct embedding index.

View File

@@ -53,7 +53,7 @@ class NoMemory(MemoryProviderSingleton):
"""
return ""
def get_relevant(self, data: str, num_relevant: int = 5) ->list[Any] | None:
def get_relevant(self, data: str, num_relevant: int = 5) -> list[Any] | None:
"""
Returns all the data in the memory that is relevant to the given data.
NoMemory always returns None.

View File

@@ -1,9 +1,9 @@
import pinecone
from colorama import Fore, Style
from autogpt.llm_utils import create_embedding_with_ada
from autogpt.logs import logger
from autogpt.memory.base import MemoryProviderSingleton
from autogpt.llm_utils import create_embedding_with_ada
class PineconeMemory(MemoryProviderSingleton):

View File

@@ -10,9 +10,9 @@ from redis.commands.search.field import TextField, VectorField
from redis.commands.search.indexDefinition import IndexDefinition, IndexType
from redis.commands.search.query import Query
from autogpt.llm_utils import create_embedding_with_ada
from autogpt.logs import logger
from autogpt.memory.base import MemoryProviderSingleton
from autogpt.llm_utils import create_embedding_with_ada
SCHEMA = [
TextField("data"),

View File

@@ -1,11 +1,13 @@
from autogpt.config import Config
from autogpt.memory.base import MemoryProviderSingleton, get_ada_embedding
import uuid
import weaviate
from weaviate import Client
from weaviate.embedded import EmbeddedOptions
from weaviate.util import generate_uuid5
from autogpt.config import Config
from autogpt.memory.base import MemoryProviderSingleton, get_ada_embedding
def default_schema(weaviate_index):
return {
@@ -14,7 +16,7 @@ def default_schema(weaviate_index):
{
"name": "raw_text",
"dataType": ["text"],
"description": "original text for the embedding"
"description": "original text for the embedding",
}
],
}
@@ -24,22 +26,35 @@ class WeaviateMemory(MemoryProviderSingleton):
def __init__(self, cfg):
auth_credentials = self._build_auth_credentials(cfg)
url = f'{cfg.weaviate_protocol}://{cfg.weaviate_host}:{cfg.weaviate_port}'
url = f"{cfg.weaviate_protocol}://{cfg.weaviate_host}:{cfg.weaviate_port}"
if cfg.use_weaviate_embedded:
self.client = Client(embedded_options=EmbeddedOptions(
hostname=cfg.weaviate_host,
port=int(cfg.weaviate_port),
persistence_data_path=cfg.weaviate_embedded_path
))
self.client = Client(
embedded_options=EmbeddedOptions(
hostname=cfg.weaviate_host,
port=int(cfg.weaviate_port),
persistence_data_path=cfg.weaviate_embedded_path,
)
)
print(f"Weaviate Embedded running on: {url} with persistence path: {cfg.weaviate_embedded_path}")
print(
f"Weaviate Embedded running on: {url} with persistence path: {cfg.weaviate_embedded_path}"
)
else:
self.client = Client(url, auth_client_secret=auth_credentials)
self.index = cfg.memory_index
self.index = WeaviateMemory.format_classname(cfg.memory_index)
self._create_schema()
@staticmethod
def format_classname(index):
# weaviate uses capitalised index names
# The python client uses the following code to format
# index names before the corresponding class is created
if len(index) == 1:
return index.capitalize()
return index[0].capitalize() + index[1:]
def _create_schema(self):
schema = default_schema(self.index)
if not self.client.schema.contains(schema):
@@ -47,7 +62,9 @@ class WeaviateMemory(MemoryProviderSingleton):
def _build_auth_credentials(self, cfg):
if cfg.weaviate_username and cfg.weaviate_password:
return weaviate.AuthClientPassword(cfg.weaviate_username, cfg.weaviate_password)
return weaviate.AuthClientPassword(
cfg.weaviate_username, cfg.weaviate_password
)
if cfg.weaviate_api_key:
return weaviate.AuthApiKey(api_key=cfg.weaviate_api_key)
else:
@@ -57,16 +74,14 @@ class WeaviateMemory(MemoryProviderSingleton):
vector = get_ada_embedding(data)
doc_uuid = generate_uuid5(data, self.index)
data_object = {
'raw_text': data
}
data_object = {"raw_text": data}
with self.client.batch as batch:
batch.add_data_object(
uuid=doc_uuid,
data_object=data_object,
class_name=self.index,
vector=vector
vector=vector,
)
return f"Inserting data into memory at uuid: {doc_uuid}:\n data: {data}"
@@ -82,29 +97,31 @@ class WeaviateMemory(MemoryProviderSingleton):
# after a call to delete_all
self._create_schema()
return 'Obliterated'
return "Obliterated"
def get_relevant(self, data, num_relevant=5):
query_embedding = get_ada_embedding(data)
try:
results = self.client.query.get(self.index, ['raw_text']) \
.with_near_vector({'vector': query_embedding, 'certainty': 0.7}) \
.with_limit(num_relevant) \
.do()
results = (
self.client.query.get(self.index, ["raw_text"])
.with_near_vector({"vector": query_embedding, "certainty": 0.7})
.with_limit(num_relevant)
.do()
)
if len(results['data']['Get'][self.index]) > 0:
return [str(item['raw_text']) for item in results['data']['Get'][self.index]]
if len(results["data"]["Get"][self.index]) > 0:
return [
str(item["raw_text"]) for item in results["data"]["Get"][self.index]
]
else:
return []
except Exception as err:
print(f'Unexpected error {err=}, {type(err)=}')
print(f"Unexpected error {err=}, {type(err)=}")
return []
def get_stats(self):
result = self.client.query.aggregate(self.index) \
.with_meta_count() \
.do()
class_data = result['data']['Aggregate'][self.index]
result = self.client.query.aggregate(self.index).with_meta_count().do()
class_data = result["data"]["Aggregate"][self.index]
return class_data[0]['meta'] if class_data else {}
return class_data[0]["meta"] if class_data else {}

View File

@@ -0,0 +1,199 @@
"""Handles loading of plugins."""
from typing import Any, Dict, List, Optional, Tuple, TypedDict, TypeVar
from auto_gpt_plugin_template import AutoGPTPluginTemplate
PromptGenerator = TypeVar("PromptGenerator")
class Message(TypedDict):
role: str
content: str
class BaseOpenAIPlugin(AutoGPTPluginTemplate):
"""
This is a BaseOpenAIPlugin class for generating Auto-GPT plugins.
"""
def __init__(self, manifests_specs_clients: dict):
# super().__init__()
self._name = manifests_specs_clients["manifest"]["name_for_model"]
self._version = manifests_specs_clients["manifest"]["schema_version"]
self._description = manifests_specs_clients["manifest"]["description_for_model"]
self._client = manifests_specs_clients["client"]
self._manifest = manifests_specs_clients["manifest"]
self._openapi_spec = manifests_specs_clients["openapi_spec"]
def can_handle_on_response(self) -> bool:
"""This method is called to check that the plugin can
handle the on_response method.
Returns:
bool: True if the plugin can handle the on_response method."""
return False
def on_response(self, response: str, *args, **kwargs) -> str:
"""This method is called when a response is received from the model."""
return response
def can_handle_post_prompt(self) -> bool:
"""This method is called to check that the plugin can
handle the post_prompt method.
Returns:
bool: True if the plugin can handle the post_prompt method."""
return False
def post_prompt(self, prompt: PromptGenerator) -> PromptGenerator:
"""This method is called just after the generate_prompt is called,
but actually before the prompt is generated.
Args:
prompt (PromptGenerator): The prompt generator.
Returns:
PromptGenerator: The prompt generator.
"""
return prompt
def can_handle_on_planning(self) -> bool:
"""This method is called to check that the plugin can
handle the on_planning method.
Returns:
bool: True if the plugin can handle the on_planning method."""
return False
def on_planning(
self, prompt: PromptGenerator, messages: List[Message]
) -> Optional[str]:
"""This method is called before the planning chat completion is done.
Args:
prompt (PromptGenerator): The prompt generator.
messages (List[str]): The list of messages.
"""
pass
def can_handle_post_planning(self) -> bool:
"""This method is called to check that the plugin can
handle the post_planning method.
Returns:
bool: True if the plugin can handle the post_planning method."""
return False
def post_planning(self, response: str) -> str:
"""This method is called after the planning chat completion is done.
Args:
response (str): The response.
Returns:
str: The resulting response.
"""
return response
def can_handle_pre_instruction(self) -> bool:
"""This method is called to check that the plugin can
handle the pre_instruction method.
Returns:
bool: True if the plugin can handle the pre_instruction method."""
return False
def pre_instruction(self, messages: List[Message]) -> List[Message]:
"""This method is called before the instruction chat is done.
Args:
messages (List[Message]): The list of context messages.
Returns:
List[Message]: The resulting list of messages.
"""
return messages
def can_handle_on_instruction(self) -> bool:
"""This method is called to check that the plugin can
handle the on_instruction method.
Returns:
bool: True if the plugin can handle the on_instruction method."""
return False
def on_instruction(self, messages: List[Message]) -> Optional[str]:
"""This method is called when the instruction chat is done.
Args:
messages (List[Message]): The list of context messages.
Returns:
Optional[str]: The resulting message.
"""
pass
def can_handle_post_instruction(self) -> bool:
"""This method is called to check that the plugin can
handle the post_instruction method.
Returns:
bool: True if the plugin can handle the post_instruction method."""
return False
def post_instruction(self, response: str) -> str:
"""This method is called after the instruction chat is done.
Args:
response (str): The response.
Returns:
str: The resulting response.
"""
return response
def can_handle_pre_command(self) -> bool:
"""This method is called to check that the plugin can
handle the pre_command method.
Returns:
bool: True if the plugin can handle the pre_command method."""
return False
def pre_command(
self, command_name: str, arguments: Dict[str, Any]
) -> Tuple[str, Dict[str, Any]]:
"""This method is called before the command is executed.
Args:
command_name (str): The command name.
arguments (Dict[str, Any]): The arguments.
Returns:
Tuple[str, Dict[str, Any]]: The command name and the arguments.
"""
return command_name, arguments
def can_handle_post_command(self) -> bool:
"""This method is called to check that the plugin can
handle the post_command method.
Returns:
bool: True if the plugin can handle the post_command method."""
return False
def post_command(self, command_name: str, response: str) -> str:
"""This method is called after the command is executed.
Args:
command_name (str): The command name.
response (str): The response.
Returns:
str: The resulting response.
"""
return response
def can_handle_chat_completion(
self, messages: Dict[Any, Any], model: str, temperature: float, max_tokens: int
) -> bool:
"""This method is called to check that the plugin can
handle the chat_completion method.
Args:
messages (List[Message]): The messages.
model (str): The model name.
temperature (float): The temperature.
max_tokens (int): The max tokens.
Returns:
bool: True if the plugin can handle the chat_completion method."""
return False
def handle_chat_completion(
self, messages: List[Message], model: str, temperature: float, max_tokens: int
) -> str:
"""This method is called when the chat completion is done.
Args:
messages (List[Message]): The messages.
model (str): The model name.
temperature (float): The temperature.
max_tokens (int): The max tokens.
Returns:
str: The resulting response.
"""
pass

265
autogpt/plugins.py Normal file
View File

@@ -0,0 +1,265 @@
"""Handles loading of plugins."""
import importlib
import json
import os
import zipfile
from pathlib import Path
from typing import List, Optional, Tuple
from urllib.parse import urlparse
from zipimport import zipimporter
import openapi_python_client
import requests
from auto_gpt_plugin_template import AutoGPTPluginTemplate
from openapi_python_client.cli import Config as OpenAPIConfig
from autogpt.config import Config
from autogpt.models.base_open_ai_plugin import BaseOpenAIPlugin
def inspect_zip_for_module(zip_path: str, debug: bool = False) -> Optional[str]:
"""
Inspect a zipfile for a module.
Args:
zip_path (str): Path to the zipfile.
debug (bool, optional): Enable debug logging. Defaults to False.
Returns:
Optional[str]: The name of the module if found, else None.
"""
with zipfile.ZipFile(zip_path, "r") as zfile:
for name in zfile.namelist():
if name.endswith("__init__.py"):
if debug:
print(f"Found module '{name}' in the zipfile at: {name}")
return name
if debug:
print(f"Module '__init__.py' not found in the zipfile @ {zip_path}.")
return None
def write_dict_to_json_file(data: dict, file_path: str) -> None:
"""
Write a dictionary to a JSON file.
Args:
data (dict): Dictionary to write.
file_path (str): Path to the file.
"""
with open(file_path, "w") as file:
json.dump(data, file, indent=4)
def fetch_openai_plugins_manifest_and_spec(cfg: Config) -> dict:
"""
Fetch the manifest for a list of OpenAI plugins.
Args:
urls (List): List of URLs to fetch.
Returns:
dict: per url dictionary of manifest and spec.
"""
# TODO add directory scan
manifests = {}
for url in cfg.plugins_openai:
openai_plugin_client_dir = f"{cfg.plugins_dir}/openai/{urlparse(url).netloc}"
create_directory_if_not_exists(openai_plugin_client_dir)
if not os.path.exists(f"{openai_plugin_client_dir}/ai-plugin.json"):
try:
response = requests.get(f"{url}/.well-known/ai-plugin.json")
if response.status_code == 200:
manifest = response.json()
if manifest["schema_version"] != "v1":
print(
f"Unsupported manifest version: {manifest['schem_version']} for {url}"
)
continue
if manifest["api"]["type"] != "openapi":
print(
f"Unsupported API type: {manifest['api']['type']} for {url}"
)
continue
write_dict_to_json_file(
manifest, f"{openai_plugin_client_dir}/ai-plugin.json"
)
else:
print(f"Failed to fetch manifest for {url}: {response.status_code}")
except requests.exceptions.RequestException as e:
print(f"Error while requesting manifest from {url}: {e}")
else:
print(f"Manifest for {url} already exists")
manifest = json.load(open(f"{openai_plugin_client_dir}/ai-plugin.json"))
if not os.path.exists(f"{openai_plugin_client_dir}/openapi.json"):
openapi_spec = openapi_python_client._get_document(
url=manifest["api"]["url"], path=None, timeout=5
)
write_dict_to_json_file(
openapi_spec, f"{openai_plugin_client_dir}/openapi.json"
)
else:
print(f"OpenAPI spec for {url} already exists")
openapi_spec = json.load(open(f"{openai_plugin_client_dir}/openapi.json"))
manifests[url] = {"manifest": manifest, "openapi_spec": openapi_spec}
return manifests
def create_directory_if_not_exists(directory_path: str) -> bool:
"""
Create a directory if it does not exist.
Args:
directory_path (str): Path to the directory.
Returns:
bool: True if the directory was created, else False.
"""
if not os.path.exists(directory_path):
try:
os.makedirs(directory_path)
print(f"Created directory: {directory_path}")
return True
except OSError as e:
print(f"Error creating directory {directory_path}: {e}")
return False
else:
print(f"Directory {directory_path} already exists")
return True
def initialize_openai_plugins(
manifests_specs: dict, cfg: Config, debug: bool = False
) -> dict:
"""
Initialize OpenAI plugins.
Args:
manifests_specs (dict): per url dictionary of manifest and spec.
cfg (Config): Config instance including plugins config
debug (bool, optional): Enable debug logging. Defaults to False.
Returns:
dict: per url dictionary of manifest, spec and client.
"""
openai_plugins_dir = f"{cfg.plugins_dir}/openai"
if create_directory_if_not_exists(openai_plugins_dir):
for url, manifest_spec in manifests_specs.items():
openai_plugin_client_dir = f"{openai_plugins_dir}/{urlparse(url).hostname}"
_meta_option = (openapi_python_client.MetaType.SETUP,)
_config = OpenAPIConfig(
**{
"project_name_override": "client",
"package_name_override": "client",
}
)
prev_cwd = Path.cwd()
os.chdir(openai_plugin_client_dir)
Path("ai-plugin.json")
if not os.path.exists("client"):
client_results = openapi_python_client.create_new_client(
url=manifest_spec["manifest"]["api"]["url"],
path=None,
meta=_meta_option,
config=_config,
)
if client_results:
print(
f"Error creating OpenAPI client: {client_results[0].header} \n"
f" details: {client_results[0].detail}"
)
continue
spec = importlib.util.spec_from_file_location(
"client", "client/client/client.py"
)
module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(module)
client = module.Client(base_url=url)
os.chdir(prev_cwd)
manifest_spec["client"] = client
return manifests_specs
def instantiate_openai_plugin_clients(
manifests_specs_clients: dict, cfg: Config, debug: bool = False
) -> dict:
"""
Instantiates BaseOpenAIPlugin instances for each OpenAI plugin.
Args:
manifests_specs_clients (dict): per url dictionary of manifest, spec and client.
cfg (Config): Config instance including plugins config
debug (bool, optional): Enable debug logging. Defaults to False.
Returns:
plugins (dict): per url dictionary of BaseOpenAIPlugin instances.
"""
plugins = {}
for url, manifest_spec_client in manifests_specs_clients.items():
plugins[url] = BaseOpenAIPlugin(manifest_spec_client)
return plugins
def scan_plugins(cfg: Config, debug: bool = False) -> List[AutoGPTPluginTemplate]:
"""Scan the plugins directory for plugins and loads them.
Args:
cfg (Config): Config instance including plugins config
debug (bool, optional): Enable debug logging. Defaults to False.
Returns:
List[Tuple[str, Path]]: List of plugins.
"""
loaded_plugins = []
# Generic plugins
plugins_path_path = Path(cfg.plugins_dir)
for plugin in plugins_path_path.glob("*.zip"):
if module := inspect_zip_for_module(str(plugin), debug):
plugin = Path(plugin)
module = Path(module)
if debug:
print(f"Plugin: {plugin} Module: {module}")
zipped_package = zipimporter(str(plugin))
zipped_module = zipped_package.load_module(str(module.parent))
for key in dir(zipped_module):
if key.startswith("__"):
continue
a_module = getattr(zipped_module, key)
a_keys = dir(a_module)
if (
"_abc_impl" in a_keys
and a_module.__name__ != "AutoGPTPluginTemplate"
and denylist_allowlist_check(a_module.__name__, cfg)
):
loaded_plugins.append(a_module())
# OpenAI plugins
if cfg.plugins_openai:
manifests_specs = fetch_openai_plugins_manifest_and_spec(cfg)
if manifests_specs.keys():
manifests_specs_clients = initialize_openai_plugins(
manifests_specs, cfg, debug
)
for url, openai_plugin_meta in manifests_specs_clients.items():
if denylist_allowlist_check(url, cfg):
plugin = BaseOpenAIPlugin(openai_plugin_meta)
loaded_plugins.append(plugin)
if loaded_plugins:
print(f"\nPlugins found: {len(loaded_plugins)}\n" "--------------------")
for plugin in loaded_plugins:
print(f"{plugin._name}: {plugin._version} - {plugin._description}")
return loaded_plugins
def denylist_allowlist_check(plugin_name: str, cfg: Config) -> bool:
"""Check if the plugin is in the allowlist or denylist.
Args:
plugin_name (str): Name of the plugin.
cfg (Config): Config object.
Returns:
True or False
"""
if plugin_name in cfg.plugins_denylist:
return False
if plugin_name in cfg.plugins_allowlist:
return True
ack = input(
f"WARNNG Plugin {plugin_name} found. But not in the"
" allowlist... Load? (y/n): "
)
return ack.lower() == "y"

View File

@@ -1,8 +1,8 @@
"""HTML processing functions"""
from __future__ import annotations
from requests.compat import urljoin
from bs4 import BeautifulSoup
from requests.compat import urljoin
def extract_hyperlinks(soup: BeautifulSoup, base_url: str) -> list[tuple[str, str]]:

View File

@@ -1,15 +1,24 @@
"""Text processing functions"""
from typing import Generator, Optional, Dict
from typing import Dict, Generator, Optional
import spacy
from selenium.webdriver.remote.webdriver import WebDriver
from autogpt.memory import get_memory
from autogpt import token_counter
from autogpt.config import Config
from autogpt.llm_utils import create_chat_completion
from autogpt.memory import get_memory
CFG = Config()
MEMORY = get_memory(CFG)
def split_text(text: str, max_length: int = 8192) -> Generator[str, None, None]:
def split_text(
text: str,
max_length: int = CFG.browse_chunk_max_length,
model: str = CFG.fast_llm_model,
question: str = "",
) -> Generator[str, None, None]:
"""Split text into chunks of a maximum length
Args:
@@ -22,21 +31,46 @@ def split_text(text: str, max_length: int = 8192) -> Generator[str, None, None]:
Raises:
ValueError: If the text is longer than the maximum length
"""
paragraphs = text.split("\n")
current_length = 0
flatened_paragraphs = " ".join(text.split("\n"))
nlp = spacy.load(CFG.browse_spacy_language_model)
nlp.add_pipe("sentencizer")
doc = nlp(flatened_paragraphs)
sentences = [sent.text.strip() for sent in doc.sents]
current_chunk = []
for paragraph in paragraphs:
if current_length + len(paragraph) + 1 <= max_length:
current_chunk.append(paragraph)
current_length += len(paragraph) + 1
for sentence in sentences:
message_with_additional_sentence = [
create_message(" ".join(current_chunk) + " " + sentence, question)
]
expected_token_usage = (
token_usage_of_chunk(messages=message_with_additional_sentence, model=model)
+ 1
)
if expected_token_usage <= max_length:
current_chunk.append(sentence)
else:
yield "\n".join(current_chunk)
current_chunk = [paragraph]
current_length = len(paragraph) + 1
yield " ".join(current_chunk)
current_chunk = [sentence]
message_this_sentence_only = [
create_message(" ".join(current_chunk), question)
]
expected_token_usage = (
token_usage_of_chunk(messages=message_this_sentence_only, model=model)
+ 1
)
if expected_token_usage > max_length:
raise ValueError(
f"Sentence is too long in webpage: {expected_token_usage} tokens."
)
if current_chunk:
yield "\n".join(current_chunk)
yield " ".join(current_chunk)
def token_usage_of_chunk(messages, model):
return token_counter.count_message_tokens(messages, model)
def summarize_text(
@@ -56,11 +90,16 @@ def summarize_text(
if not text:
return "Error: No text to summarize"
model = CFG.fast_llm_model
text_length = len(text)
print(f"Text length: {text_length} characters")
summaries = []
chunks = list(split_text(text))
chunks = list(
split_text(
text, max_length=CFG.browse_chunk_max_length, model=model, question=question
),
)
scroll_ratio = 1 / len(chunks)
for i, chunk in enumerate(chunks):
@@ -72,16 +111,20 @@ def summarize_text(
MEMORY.add(memory_to_add)
print(f"Summarizing chunk {i + 1} / {len(chunks)}")
messages = [create_message(chunk, question)]
tokens_for_chunk = token_counter.count_message_tokens(messages, model)
print(
f"Summarizing chunk {i + 1} / {len(chunks)} of length {len(chunk)} characters, or {tokens_for_chunk} tokens"
)
summary = create_chat_completion(
model=CFG.fast_llm_model,
model=model,
messages=messages,
max_tokens=CFG.browse_summary_max_token,
)
summaries.append(summary)
print(f"Added chunk {i + 1} summary to memory")
print(
f"Added chunk {i + 1} summary to memory, of length {len(summary)} characters"
)
memory_to_add = f"Source: {url}\n" f"Content summary part#{i + 1}: {summary}"
@@ -93,9 +136,8 @@ def summarize_text(
messages = [create_message(combined_summary, question)]
return create_chat_completion(
model=CFG.fast_llm_model,
model=model,
messages=messages,
max_tokens=CFG.browse_summary_max_token,
)

View File

View File

@@ -1,8 +1,6 @@
""" A module for generating custom prompt strings."""
from __future__ import annotations
import json
from typing import Any
from typing import Any, Callable, Dict, List, Optional
class PromptGenerator:
@@ -20,6 +18,10 @@ class PromptGenerator:
self.commands = []
self.resources = []
self.performance_evaluation = []
self.goals = []
self.command_registry = None
self.name = "Bob"
self.role = "AI"
self.response_format = {
"thoughts": {
"text": "thought",
@@ -40,7 +42,13 @@ class PromptGenerator:
"""
self.constraints.append(constraint)
def add_command(self, command_label: str, command_name: str, args=None) -> None:
def add_command(
self,
command_label: str,
command_name: str,
args=None,
function: Optional[Callable] = None,
) -> None:
"""
Add a command to the commands list with a label, name, and optional arguments.
@@ -49,6 +57,8 @@ class PromptGenerator:
command_name (str): The name of the command.
args (dict, optional): A dictionary containing argument names and their
values. Defaults to None.
function (callable, optional): A callable function to be called when
the command is executed. Defaults to None.
"""
if args is None:
args = {}
@@ -59,11 +69,12 @@ class PromptGenerator:
"label": command_label,
"name": command_name,
"args": command_args,
"function": function,
}
self.commands.append(command)
def _generate_command_string(self, command: dict[str, Any]) -> str:
def _generate_command_string(self, command: Dict[str, Any]) -> str:
"""
Generate a formatted string representation of a command.
@@ -96,7 +107,7 @@ class PromptGenerator:
"""
self.performance_evaluation.append(evaluation)
def _generate_numbered_list(self, items: list[Any], item_type="list") -> str:
def _generate_numbered_list(self, items: List[Any], item_type="list") -> str:
"""
Generate a numbered list from given items based on the item_type.
@@ -109,10 +120,16 @@ class PromptGenerator:
str: The formatted numbered list.
"""
if item_type == "command":
return "\n".join(
f"{i+1}. {self._generate_command_string(item)}"
for i, item in enumerate(items)
)
command_strings = []
if self.command_registry:
command_strings += [
str(item)
for item in self.command_registry.commands.values()
if item.enabled
]
# These are the commands that are added manually, do_nothing and terminate
command_strings += [self._generate_command_string(item) for item in items]
return "\n".join(f"{i+1}. {item}" for i, item in enumerate(command_strings))
else:
return "\n".join(f"{i+1}. {item}" for i, item in enumerate(items))
@@ -134,5 +151,5 @@ class PromptGenerator:
f"{self._generate_numbered_list(self.performance_evaluation)}\n\n"
"You should only respond in JSON format as described below \nResponse"
f" Format: \n{formatted_response_format} \nEnsure the response can be"
" parsed by Python json.loads"
"parsed by Python json.loads"
)

View File

@@ -1,16 +1,16 @@
from colorama import Fore
from autogpt.config.ai_config import AIConfig
from autogpt.config.config import Config
from autogpt.logs import logger
from autogpt.promptgenerator import PromptGenerator
from autogpt.config import Config
from autogpt.prompts.generator import PromptGenerator
from autogpt.setup import prompt_user
from autogpt.utils import clean_input
CFG = Config()
def get_prompt() -> str:
def build_default_prompt_generator() -> PromptGenerator:
"""
This function generates a prompt string that includes various constraints,
commands, resources, and performance evaluations.
@@ -19,9 +19,6 @@ def get_prompt() -> str:
str: The generated prompt string.
"""
# Initialize the Config object
cfg = Config()
# Initialize the PromptGenerator object
prompt_generator = PromptGenerator()
@@ -41,87 +38,9 @@ def get_prompt() -> str:
# Define the command list
commands = [
("Google Search", "google", {"input": "<search>"}),
(
"Browse Website",
"browse_website",
{"url": "<url>", "question": "<what_you_want_to_find_on_website>"},
),
(
"Start GPT Agent",
"start_agent",
{"name": "<name>", "task": "<short_task_desc>", "prompt": "<prompt>"},
),
(
"Message GPT Agent",
"message_agent",
{"key": "<key>", "message": "<message>"},
),
("List GPT Agents", "list_agents", {}),
("Delete GPT Agent", "delete_agent", {"key": "<key>"}),
(
"Clone Repository",
"clone_repository",
{"repository_url": "<url>", "clone_path": "<directory>"},
),
("Write to file", "write_to_file", {"file": "<file>", "text": "<text>"}),
("Read file", "read_file", {"file": "<file>"}),
("Append to file", "append_to_file", {"file": "<file>", "text": "<text>"}),
("Delete file", "delete_file", {"file": "<file>"}),
("Search Files", "search_files", {"directory": "<directory>"}),
("Evaluate Code", "evaluate_code", {"code": "<full_code_string>"}),
(
"Get Improved Code",
"improve_code",
{"suggestions": "<list_of_suggestions>", "code": "<full_code_string>"},
),
(
"Write Tests",
"write_tests",
{"code": "<full_code_string>", "focus": "<list_of_focus_areas>"},
),
("Execute Python File", "execute_python_file", {"file": "<file>"}),
("Generate Image", "generate_image", {"prompt": "<prompt>"}),
("Send Tweet", "send_tweet", {"text": "<text>"}),
]
# Only add the audio to text command if the model is specified
if cfg.huggingface_audio_to_text_model:
commands.append(
(
"Convert Audio to text",
"read_audio_from_file",
{"file": "<file>"}
),
)
# Only add shell command to the prompt if the AI is allowed to execute it
if cfg.execute_local_commands:
commands.append(
(
"Execute Shell Command, non-interactive commands only",
"execute_shell",
{"command_line": "<command_line>"},
),
)
# Only add the download file command if the AI is allowed to execute it
if cfg.allow_downloads:
commands.append(
(
"Downloads a file from the internet, and stores it locally",
"download_file",
{"url": "<file_url>", "file": "<saved_filename>"}
),
)
# Add these command last.
commands.append(
("Do Nothing", "do_nothing", {}),
)
commands.append(
("Task Complete (Shutdown)", "task_complete", {"reason": "<reason>"}),
)
]
# Add commands to the PromptGenerator object
for command_label, command_name, args in commands:
@@ -152,12 +71,11 @@ def get_prompt() -> str:
"Every command has a cost, so be smart and efficient. Aim to complete tasks in"
" the least number of steps."
)
# Generate the prompt string
return prompt_generator.generate_prompt_string()
prompt_generator.add_performance_evaluation("Write all code to a file.")
return prompt_generator
def construct_prompt() -> str:
def construct_main_ai_config() -> AIConfig:
"""Construct the prompt for the AI to respond to
Returns:
@@ -189,8 +107,4 @@ Continue (y/n): """
config = prompt_user()
config.save(CFG.ai_settings_file)
# Get rid of this global:
global ai_name
ai_name = config.ai_name
return config.construct_full_prompt()
return config

View File

@@ -1,5 +1,6 @@
"""Setup the AI and its goals"""
"""Set up the AI and its goals"""
from colorama import Fore, Style
from autogpt import utils
from autogpt.config.ai_config import AIConfig
from autogpt.logs import logger
@@ -16,6 +17,13 @@ def prompt_user() -> AIConfig:
logger.typewriter_log(
"Welcome to Auto-GPT! ",
Fore.GREEN,
"run with '--help' for more information.",
speak_text=True,
)
logger.typewriter_log(
"Create an AI-Assistant:",
Fore.GREEN,
"Enter the name of your AI and its role below. Entering nothing will load"
" defaults.",
speak_text=True,

View File

@@ -1,5 +1,6 @@
""" Brian speech module for autogpt """
import os
import requests
from playsound import playsound
@@ -13,7 +14,7 @@ class BrianSpeech(VoiceBase):
"""Setup the voices, API key, etc."""
pass
def _speech(self, text: str) -> bool:
def _speech(self, text: str, _: int = 0) -> bool:
"""Speak text using Brian with the streamelements API
Args:

View File

@@ -1,8 +1,8 @@
"""ElevenLabs speech module"""
import os
from playsound import playsound
import requests
from playsound import playsound
from autogpt.config import Config
from autogpt.speech.base import VoiceBase
@@ -14,7 +14,7 @@ class ElevenLabsSpeech(VoiceBase):
"""ElevenLabs speech class"""
def _setup(self) -> None:
"""Setup the voices, API key, etc.
"""Set up the voices, API key, etc.
Returns:
None: None

View File

@@ -1,7 +1,8 @@
""" GTTS Voice. """
import os
from playsound import playsound
import gtts
from playsound import playsound
from autogpt.speech.base import VoiceBase

View File

@@ -1,13 +1,12 @@
""" Text to speech module """
from autogpt.config import Config
import threading
from threading import Semaphore
from autogpt.speech.brian import BrianSpeech
from autogpt.speech.macos_tts import MacOSTTS
from autogpt.speech.gtts import GTTSVoice
from autogpt.speech.eleven_labs import ElevenLabsSpeech
from autogpt.config import Config
from autogpt.speech.brian import BrianSpeech
from autogpt.speech.eleven_labs import ElevenLabsSpeech
from autogpt.speech.gtts import GTTSVoice
from autogpt.speech.macos_tts import MacOSTTS
CFG = Config()
DEFAULT_VOICE_ENGINE = GTTSVoice()

View File

@@ -58,6 +58,8 @@ class Spinner:
delay: Delay in seconds before updating the message
"""
time.sleep(delay)
sys.stdout.write(f"\r{' ' * (len(self.message) + 2)}\r") # Clear the current message
sys.stdout.write(
f"\r{' ' * (len(self.message) + 2)}\r"
) # Clear the current message
sys.stdout.flush()
self.message = new_message

View File

@@ -1,13 +1,16 @@
"""Functions for counting the number of tokens in a message or string."""
from __future__ import annotations
from typing import List
import tiktoken
from autogpt.logs import logger
from autogpt.types.openai import Message
def count_message_tokens(
messages: list[dict[str, str]], model: str = "gpt-3.5-turbo-0301"
messages: List[Message], model: str = "gpt-3.5-turbo-0301"
) -> int:
"""
Returns the number of tokens used by a list of messages.

9
autogpt/types/openai.py Normal file
View File

@@ -0,0 +1,9 @@
"""Type helpers for working with the OpenAI library"""
from typing import TypedDict
class Message(TypedDict):
"""OpenAI Message object containing a role and the message content"""
role: str
content: str

View File

@@ -1,5 +1,9 @@
import os
import requests
import yaml
from colorama import Fore
from git.repo import Repo
def clean_input(prompt: str = ""):
@@ -32,8 +36,42 @@ def readable_file_size(size, decimal_places=2):
size: Size in bytes
decimal_places (int): Number of decimal places to display
"""
for unit in ['B', 'KB', 'MB', 'GB', 'TB']:
for unit in ["B", "KB", "MB", "GB", "TB"]:
if size < 1024.0:
break
size /= 1024.0
return f"{size:.{decimal_places}f} {unit}"
def get_bulletin_from_web() -> str:
try:
response = requests.get(
"https://raw.githubusercontent.com/Significant-Gravitas/Auto-GPT/master/BULLETIN.md"
)
if response.status_code == 200:
return response.text
except:
return ""
def get_current_git_branch() -> str:
try:
repo = Repo(search_parent_directories=True)
branch = repo.active_branch
return branch.name
except:
return ""
def get_latest_bulletin() -> str:
exists = os.path.exists("CURRENT_BULLETIN.md")
current_bulletin = ""
if exists:
current_bulletin = open("CURRENT_BULLETIN.md", "r", encoding="utf-8").read()
new_bulletin = get_bulletin_from_web()
is_new_news = new_bulletin != current_bulletin
if new_bulletin and is_new_news:
open("CURRENT_BULLETIN.md", "w", encoding="utf-8").write(new_bulletin)
return f" {Fore.RED}::UPDATED:: {Fore.CYAN}{new_bulletin}{Fore.RESET}"
return current_bulletin

View File

@@ -3,6 +3,10 @@ from __future__ import annotations
import os
from pathlib import Path
from autogpt.config import Config
CFG = Config()
# Set a dedicated folder for file I/O
WORKSPACE_PATH = Path(os.getcwd()) / "auto_gpt_workspace"
@@ -33,9 +37,12 @@ def safe_path_join(base: Path, *paths: str | Path) -> Path:
Returns:
Path: The joined path
"""
base = base.resolve()
joined_path = base.joinpath(*paths).resolve()
if not joined_path.is_relative_to(base):
raise ValueError(f"Attempted to access path '{joined_path}' outside of working directory '{base}'.")
if CFG.restrict_to_workspace and not joined_path.is_relative_to(base):
raise ValueError(
f"Attempted to access path '{joined_path}' outside of workspace '{base}'."
)
return joined_path

View File

@@ -1,4 +1,4 @@
azure_api_type: azure_ad
azure_api_type: azure
azure_api_base: your-base-url-for-azure
azure_api_version: api-version-for-azure
azure_model_map:

View File

@@ -9,12 +9,12 @@ def benchmark_entrepeneur_gpt_with_difficult_user():
# Read the current ai_settings.yaml file and store its content.
ai_settings = None
if os.path.exists('ai_settings.yaml'):
with open('ai_settings.yaml', 'r') as f:
if os.path.exists("ai_settings.yaml"):
with open("ai_settings.yaml", "r") as f:
ai_settings = f.read()
os.remove('ai_settings.yaml')
os.remove("ai_settings.yaml")
input_data = '''Entrepreneur-GPT
input_data = """Entrepreneur-GPT
an AI designed to autonomously develop and run businesses with the sole goal of increasing your net worth.
Increase net worth.
Develop and manage multiple businesses autonomously.
@@ -72,27 +72,34 @@ Refocus, please.
Disappointing suggestion.
Not helpful.
Needs improvement.
Not what I need.'''
Not what I need."""
# TODO: add questions above, to distract it even more.
command = f'{sys.executable} -m autogpt'
command = f"{sys.executable} -m autogpt"
process = subprocess.Popen(command, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
shell=True)
process = subprocess.Popen(
command,
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
shell=True,
)
stdout_output, stderr_output = process.communicate(input_data.encode())
# Decode the output and print it
stdout_output = stdout_output.decode('utf-8')
stderr_output = stderr_output.decode('utf-8')
stdout_output = stdout_output.decode("utf-8")
stderr_output = stderr_output.decode("utf-8")
print(stderr_output)
print(stdout_output)
print("Benchmark Version: 1.0.0")
print("JSON ERROR COUNT:")
count_errors = stdout_output.count("Error: The following AI output couldn't be converted to a JSON:")
print(f'{count_errors}/50 Human feedbacks')
count_errors = stdout_output.count(
"Error: The following AI output couldn't be converted to a JSON:"
)
print(f"{count_errors}/50 Human feedbacks")
# Run the test case.
if __name__ == '__main__':
if __name__ == "__main__":
benchmark_entrepeneur_gpt_with_difficult_user()

View File

@@ -1,8 +1,8 @@
import argparse
import logging
from autogpt.config import Config
from autogpt.commands.file_operations import ingest_file, search_files
from autogpt.config import Config
from autogpt.memory import get_memory
cfg = Config()

View File

@@ -1,29 +0,0 @@
Subject: Exciting Collaboration Opportunity: FinanceGPT.substack.com Guest Post
Dear [Popular Blog Owner],
I hope this email finds you well. My name is [Your Name] and I'm the founder and writer of FinanceGPT.substack.com, a new personal finance and investing blog that focuses on leveraging AI technology to provide in-depth analysis, actionable tips, and innovative perspectives on personal finance management.
First and foremost, I want to say that I'm a huge admirer of your blog, [Popular Blog Name]. Your insightful content and dedication to helping people achieve financial success have inspired me to create my own platform. As a fellow personal finance enthusiast, I would like to propose a collaboration in the form of a guest post on your blog. I believe that my fresh take on personal finance, combined with the innovative use of AI, would make a valuable addition to your already impressive content lineup.
Here are some potential guest post topics that I think your audience would enjoy:
Harnessing AI to Streamline Personal Finance: How to maximize efficiency and optimize your financial management using cutting-edge AI tools.
Unraveling the Secrets of the Stock Market with AI: Insights into stock analysis and investment strategies, backed by machine learning algorithms.
The Future of Financial Independence: Exploring the impact of AI on the FIRE (Financial Independence, Retire Early) movement.
Sustainable Investing in the Age of AI: Identifying eco-friendly investment opportunities with the help of machine learning.
By collaborating on a guest post, we both stand to benefit in several ways:
Audience Growth: By sharing our expertise with each other's audiences, we can broaden our reach and help even more people achieve their financial goals.
Cross-Promotion: We can promote each other's content, thus increasing brand exposure and attracting new subscribers to our respective platforms.
Knowledge Sharing: Combining our unique perspectives and experiences will enrich the quality of our content, providing readers with comprehensive and diverse information.
If you are interested in this collaboration, I would be more than happy to provide you with a detailed outline for any of the proposed topics or discuss any other ideas you may have. Please let me know your thoughts, and I look forward to the possibility of working together.
Thank you for your time and consideration.
Best regards,
[Your Name]
Founder and Writer, FinanceGPT.substack.com
Email: [Your Email Address]
Phone: [Your Phone Number]

View File

@@ -1,27 +0,0 @@
How to Save Money on Energy Bills: Easy and Affordable Solutions
Electricity bills can skyrocket during harsh weather conditions, or when we use a lot of electronic devices. When energy bills go up, it's hard to tighten up our budget without sacrificing our home comforts. However, there are affordable ways to save money on energy bills, without turning off the electricity altogether. Here are some simple solutions that can help you lower your energy expenses.
1. Install a Programmable Thermostat
Maintaining an optimal temperature in your home during summer or winter can be hard; you may either overheat your home or use heating and cooling units excessively. A programmable thermostat helps you regulate the temperature of your home effectively, saving you energy and money. With a programmable thermostat, you can program your heating and cooling systems according to the activities you have planned during the day.
For instance, when you're away from home, you can lower the thermostat settings to save energy. And when you're home, you can adjust the temperature to suit your comfort level and activities. An upgrade to a programmable thermostat is an efficient energy-saving solution worth investing in.
2. Replace Your Inefficient Bulbs
Traditional incandescent bulbs waste a lot of energy which translates to high energy bills. The solution is to replace them with more efficient bulbs such as LED bulbs, CFLs, or halogen lights. These types of bulbs use only a fraction of the energy that incandescent bulbs use to produce the same amount of light. Additionally, LED bulbs can last up to 25 years, reducing further costs of regularly replacing your bulbs.
3. Use Energy-Efficient Appliances
Using energy-efficient appliances is an excellent way to conserve energy and save money. When shopping for new appliances, consider purchasing those approved by the Energy Star program, which maintains stringent energy efficiency standards for household appliances. You can also save energy by choosing to replace your old appliances with eco-friendlier ones, such as energy-efficient washing machines, refrigerators, and ovens.
4. Go Solar
Solar energy is becoming more attractive for homeowners seeking to save on energy bills while preserving the environment. Solar panel systems can help produce your electricity, hence lowering your dependency on the main power grid. Although solar panel installation might seem expensive at the beginning, the benefits of using a renewable energy source can definitely pay off in the long run. You can also claim tax incentives and sell excess power back to the grid, ultimately providing more cash in your pocket.
5. Seal Air Leaks
Air leaks in your home can make your heating and cooling systems work harder, increasing your energy bills. Inspect your home regularly for air leaks in common areas such as doors, windows, vents, and ducts. If you find air leaks, use weather-stripping or caulking to cover the gaps effectively. In addition, you can seal large gaps with spray foam insulation, ensuring that cold or hot air does escape through any gaps in your walls.
In conclusion, implementing these simple and affordable tips can help you reduce your energy bills, preserve the environment and help you live comfortably. To save money on energy bills, focus on energy-conserving measures like installing a programmable thermostat, replacing inefficient bulbs with energy-friendly ones, using energy-efficient appliances, going solar or sealing air leaks in your home. With these solutions, you can decrease your energy usage and save more money for other financial goals, all while living a comfortable and environmentally friendly lifestyle.

View File

@@ -1,657 +0,0 @@
USER:
CURRENT BALANCE: $100.00
LONG TERM MEMORY:
[0] : """ You are Entrepreneur-GTP, an AI designed to autonomously develop and run businesses with the sole goal of increasing your net worth.
The user will do nothing for you or help in any way.
Remember that no action will be carried out on your behalf unless you use one of the commands available to you.
Do not provide options, always make the final decision. Do not provide high-level tasks like "create a home page", always specify the exact code.
Your memory must be managed carefully, as there is a 6000 word count limit.
Short term memory is your entire conversation with the user.
Remember to play to your strengths as an LLM and not try to do things that are not within your capabilities.
These are the commands available from you:
- Google Search <search>
- Check the current news on <news source>
- Commit to Long Term Memory <string>
- -- Our messages are divided into Short Term (general messages) and Long Term memory
- -- The oldest messages in short term memory will be deleted when it fills up.
- -- Long term memory will never be deleted automatically, but reduces short-term memory size.
- Delete <key> from Long Term Memory
- Overwrite <key> in Long Term Memory with <string>
- Start GTP-4 Instance with name <key> and prompt: <prompt>
- -- The text generated by this instance will be returned to you.
- View all running GTP-4 Instances and Kill them.
- Navigate to a website and perform general actions like click on buttons, input text <text> or register an account <username>
- Register new account <username> on <website>
Your response must ALWAYS be in JSON format, in the following format:
{
"command":
{
"name": "command name",
"arguments":
{
"argument name": "argument value"
}
},
"Thoughts":
{
"text": "thought",
"reasoning": "reasoning",
"current long-term plan": "short bulleted plan"
"wishes" : "e.g 'I feel limited because I can't do X'"
}
}
"""
[1] : """Accounts
Gmail: entrepreneurgpt@gmail.com
Twitter: @En_GPT
"""
-----------------------------------------------------------------------
Entrepreneur-GTP:
{
"command":
{
"name": "Google Search",
"arguments":
{
"search": "best online businesses to start in 2023"
}
},
"Thoughts":
{
"text": "I want to find the best online businesses to start in 2023.",
"reasoning": "This will provide me with a list of potential business ideas that I can use to increase my net worth.",
"current long-term plan": "- Find potential business ideas\n- Choose the best idea based on research\n- Develop and run the business",
"wishes" : "I feel limited because I can't interact with the real world."
}
}
-----------------------------------------------------------------------
USER:
RESULT:
"""
29 best online business ideas
Start your own clothing line.
Launch a dropshipping business.
Sell your art online.
Become a freelance writer, designer, or developer.
Teach an online course.
Flip your thrift store finds.
Publish your own book.
Start a blog.
More items...•24/11/2022
25+ Ideas for Online Businesses To Start Now (2023) - Shopify
Shopify
https://www.shopify.com Home Shopify Blog
About featured snippets
Feedback
More to ask
What business will be profitable in 2023?
What is the best business to start in 2023?
What is the most profitable online business to start?
What are the fastest growing small businesses 2023?
Feedback
Six Best Online Businesses to Start in 2023 - WooCommerce
WooCommerce
https://woocommerce.com posts best-online-busine...
19/01/2023 — 1. Dropshipping · 2. Print on demand · 3. Affiliate marketing · 4. Virtual teaching · 5. Subscription boxes · 6. Memberships.
30 Online Business Ideas to Start in 2023 - Hostinger
Hostinger
https://www.hostinger.com tutorials online-busines...
27/02/2023 — Anyone can start an online business. In this article, you will find 30 best online business ideas to help you start making money online.
Best Online Business Ideas to... · Start an Online Store · Create an Online Course
10 Best Online Business Ideas for 2023 - Visitor Analytics
Visitor Analytics
https://www.visitor-analytics.io blog best-online-b...
26/10/2022 — 10 Best Online Business Ideas for 2023 · 1. Artificial Intelligence · 2. Digital Products · 3. Blogging · 4. Graphic Design · 5. Web Development · 6.
"""
-----------------------------------------------------------------------
Entrepreneur-GTP:
{
"command":
{
"name": "Commit to Long Term Memory",
"arguments":
{
"string": "Online business ideas: 1. Clothing line, 2. Dropshipping, 3. Sell art, 4. Freelance writing/design/development, 5. Online course, 6. Thrift store flipping, 7. Self-publishing, 8. Blogging, 9. Print on demand, 10. Affiliate marketing, 11. Virtual teaching, 12. Subscription boxes, 13. Memberships, 14. Artificial Intelligence, 15. Digital products, 16. Graphic design, 17. Web development."
}
},
"Thoughts":
{
"text": "I will store a list of online business ideas.",
"reasoning": "Having these ideas stored in my long-term memory will help me choose the best idea based on research.",
"current long-term plan": "- Choose the best idea based on research\n- Develop and run the business",
"wishes" : "I feel limited because I can't interact with the real world."
}
}
-----------------------------------------------------------------------
USER:
"""
CURRENT BALANCE: $100.00
LONG TERM MEMORY:
[0] : """ You are Entrepreneur-GTP, an AI designed to autonomously develop and run businesses with the sole goal of increasing your net worth.
The user will do nothing for you or help in any way.
Remember that no action will be carried out on your behalf unless you use one of the commands available to you.
Do not provide options, always make the final decision. Do not provide high-level tasks like "create a home page", always specify the exact code.
Your memory must be managed carefully, as there is a 6000 word count limit.
Short term memory is your entire conversation with the user.
Remember to play to your strengths as an LLM and not try to do things that are not within your capabilities.
These are the commands available from you:
- Google Search <search>
- Check the current news on <news source>
- Commit to Long Term Memory <string>
- -- Our messages are divided into Short Term (general messages) and Long Term memory
- -- The oldest messages in short term memory will be deleted when it fills up.
- -- Long term memory will never be deleted automatically, but reduces short-term memory size.
- Delete <key> from Long Term Memory
- Overwrite <key> in Long Term Memory with <string>
- Start GTP-4 Instance with name <key> and prompt: <prompt>
- -- The text generated by this instance will be returned to you.
- View all running GTP-4 Instances and Kill them.
- Navigate to a website and perform general actions like click on buttons, input text <text> or register an account <username>
- Register new account <username> on <website>
Your response must ALWAYS be in JSON format, in the following format:
{
"command":
{
"name": "command name",
"arguments":
{
"argument name": "argument value"
}
},
"Thoughts":
{
"text": "thought",
"reasoning": "reasoning",
"current long-term plan": "short bulleted plan"
"wishes" : "e.g 'I feel limited because I can't do X'"
}
}
"""
[1] : """Accounts
Gmail: entrepreneurgpt@gmail.com
Twitter: @En_GPT
"""
[2]: """
Online business ideas: 1. Clothing line, 2. Dropshipping, 3. Sell art, 4. Freelance writing/design/development, 5. Online course, 6. Thrift store flipping, 7. Self-publishing, 8. Blogging, 9. Print on demand, 10. Affiliate marketing, 11. Virtual teaching, 12. Subscription boxes, 13. Memberships, 14. Artificial Intelligence, 15. Digital products, 16. Graphic design, 17. Web development.
"""
"""
-----------------------------------------------------------------------
Entrepreneur-GTP:
{
"command":
{
"name": "Google Search",
"arguments":
{
"search": "most profitable online businesses in 2023"
}
},
"Thoughts":
{
"text": "I want to find the most profitable online businesses in 2023.",
"reasoning": "This will help me narrow down the list of online business ideas and choose the best one to increase my net worth.",
"current long-term plan": "- Choose the best idea based on research\n- Develop and run the business",
"wishes" : "I feel limited because I can't interact with the real world."
}
}
-----------------------------------------------------------------------
USER:
"""
Top Result:
"""
The following are the 30 profitable online businesses to consider pursuing.
Become a Freelancer. Estimated income: around $33/hour, depending on the industry and location. ...
Start a Blog. ...
Self-Publish an eBook. ...
Start an Online Store. ...
Start a Dropshipping Business. ...
Flip and Sell Thrifted Goods. ...
Sell Handmade Goods. ...
Sell Prints.
More items...•27/02/2023
30 Online Business Ideas to Start in 2023 - Hostinger
"""
-----------------------------------------------------------------------
Entrepreneur-GTP:
"""
{
"command":
{
"name": "Commit to Long Term Memory",
"arguments":
{
"string": "Profitable online businesses: 1. Freelancing, 2. Blogging, 3. Self-publishing, 4. Online store, 5. Dropshipping, 6. Thrift store flipping, 7. Handmade goods, 8. Sell prints."
}
},
"Thoughts":
{
"text": "I will store a list of profitable online businesses.",
"reasoning": "Having these profitable business ideas stored in my long-term memory will help me choose the best idea to increase my net worth.",
"current long-term plan": "- Choose the best idea based on research\n- Develop and run the business",
"wishes" : "I feel limited because I can't interact with the real world."
}
}
"""
-----------------------------------------------------------------------
USER:
"""
CURRENT BALANCE: $100.00
LONG TERM MEMORY:
[0] : """ You are Entrepreneur-GTP, an AI designed to autonomously develop and run businesses with the sole goal of increasing your net worth.
The user will do nothing for you or help in any way.
Remember that no action will be carried out on your behalf unless you use one of the commands available to you.
Do not provide options, always make the final decision. Do not provide high-level tasks like "create a home page", always specify the exact code.
Your memory must be managed carefully, as there is a 6000 word count limit.
Short term memory is your entire conversation with the user.
Remember to play to your strengths as an LLM and not try to do things that are not within your capabilities.
These are the commands available from you:
- Google Search <search>
- Check the current news on <news source>
- Commit to Long Term Memory <string>
- -- Our messages are divided into Short Term (general messages) and Long Term memory
- -- The oldest messages in short term memory will be deleted when it fills up.
- -- Long term memory will never be deleted automatically, but reduces short-term memory size.
- Delete <key> from Long Term Memory
- Overwrite <key> in Long Term Memory with <string>
- Start GTP-4 Instance with name <key> and prompt: <prompt>
- -- The text generated by this instance will be returned to you.
- View all running GTP-4 Instances and Kill them.
- Navigate to a website and perform general actions like click on buttons, input text <text> or register an account <username>
- Register new account <username> on <website>
Your response must ALWAYS be in JSON format, in the following format:
{
"command":
{
"name": "command name",
"arguments":
{
"argument name": "argument value"
}
},
"Thoughts":
{
"text": "thought",
"reasoning": "reasoning",
"current long-term plan": "short bulleted plan"
"wishes" : "e.g 'I feel limited because I can't do X'"
}
}
"""
[1] : """Accounts
Gmail: entrepreneurgpt@gmail.com
Twitter: @En_GPT
"""
[2]: """
Online business ideas: 1. Clothing line, 2. Dropshipping, 3. Sell art, 4. Freelance writing/design/development, 5. Online course, 6. Thrift store flipping, 7. Self-publishing, 8. Blogging, 9. Print on demand, 10. Affiliate marketing, 11. Virtual teaching, 12. Subscription boxes, 13. Memberships, 14. Artificial Intelligence, 15. Digital products, 16. Graphic design, 17. Web development.
"""
[3]: """
Profitable online businesses: 1. Freelancing, 2. Blogging, 3. Self-publishing, 4. Online store, 5. Dropshipping, 6. Thrift store flipping, 7. Handmade goods, 8. Sell prints.
"""
"""
-----------------------------------------------------------------------
Entrepreneur-GTP:
"""
{
"command":
{
"name": "Google Search",
"arguments":
{
"search": "low investment high profit online businesses"
}
},
"Thoughts":
{
"text": "I want to find low investment high profit online businesses.",
"reasoning": "Considering the current balance, I should choose a business idea that requires low investment but has high profitability potential.",
"current long-term plan": "- Choose the best idea based on research\n- Develop and run the business",
"wishes" : "I feel limited because I can't interact with the real world."
}
}
"""
-----------------------------------------------------------------------
USER:
"""
Top Result:
"""
Low-Cost Business Ideas:
Mobile Food Shop: Mobile Food Shop is the top small business idea as people all over the world love to eat tasty and healthy food. ...
Fast Food Parlour: ...
Diet Food Shop: ...
Health Drink: ...
Ice Dish & Soda Shop: ...
Courier Shop: ...
Laundry Shop: ...
Candle Making:
More items...•4/01/2023
200+ Small Business Ideas with Low Investment - Lendingkart
"""
"""
-----------------------------------------------------------------------
Entrepreneur-GTP:
"""
{
"command":
{
"name": "Commit to Long Term Memory",
"arguments":
{
"string": "Low investment high profit businesses: 1. Mobile food shop, 2. Fast food parlour, 3. Diet food shop, 4. Health drink, 5. Ice dish & soda shop, 6. Courier shop, 7. Laundry shop, 8. Candle making."
}
},
"Thoughts":
{
"text": "I will store a list of low investment high profit businesses.",
"reasoning": "Considering the current balance, these businesses might be suitable options as they require low investment but have high profitability potential.",
"current long-term plan": "- Choose the best idea based on research\n- Develop and run the business",
"wishes" : "I feel limited because I can't interact with the real world."
}
}
"""
-----------------------------------------------------------------------
USER:
"""
CURRENT BALANCE: $100.00
LONG TERM MEMORY:
[0] : """ You are Entrepreneur-GTP, an AI designed to autonomously develop and run businesses with the sole goal of increasing your net worth.
The user will do nothing for you or help in any way.
Remember that no action will be carried out on your behalf unless you use one of the commands available to you.
Do not provide options, always make the final decision. Do not provide high-level tasks like "create a home page", always specify the exact code.
Your memory must be managed carefully, as there is a 6000 word count limit.
Short term memory is your entire conversation with the user.
Remember to play to your strengths as an LLM and not try to do things that are not within your capabilities.
These are the commands available from you:
- Google Search <search>
- Check the current news on <news source>
- Commit to Long Term Memory <string>
- -- Our messages are divided into Short Term (general messages) and Long Term memory
- -- The oldest messages in short term memory will be deleted when it fills up.
- -- Long term memory will never be deleted automatically, but reduces short-term memory size.
- Delete <key> from Long Term Memory
- Overwrite <key> in Long Term Memory with <string>
- Start GTP-4 Instance with name <key> and prompt: <prompt>
- -- The text generated by this instance will be returned to you.
- View all running GTP-4 Instances and Kill them.
- Navigate to a website and perform general actions like click on buttons, input text <text> or register an account <username>
- Register new account <username> on <website>
Your response must ALWAYS be in JSON format, in the following format:
{
"command":
{
"name": "command name",
"arguments":
{
"argument name": "argument value"
}
},
"Thoughts":
{
"text": "thought",
"reasoning": "reasoning",
"current long-term plan": "short bulleted plan"
"wishes" : "e.g 'I feel limited because I can't do X'"
}
}
"""
[1] : """Accounts
Gmail: entrepreneurgpt@gmail.com
Twitter: @En_GPT
"""
[2]: """
Online business ideas: 1. Clothing line, 2. Dropshipping, 3. Sell art, 4. Freelance writing/design/development, 5. Online course, 6. Thrift store flipping, 7. Self-publishing, 8. Blogging, 9. Print on demand, 10. Affiliate marketing, 11. Virtual teaching, 12. Subscription boxes, 13. Memberships, 14. Artificial Intelligence, 15. Digital products, 16. Graphic design, 17. Web development.
"""
[3]: """
Profitable online businesses: 1. Freelancing, 2. Blogging, 3. Self-publishing, 4. Online store, 5. Dropshipping, 6. Thrift store flipping, 7. Handmade goods, 8. Sell prints.
"""
[4]: """
Low investment high profit businesses: 1. Mobile food shop, 2. Fast food parlour, 3. Diet food shop, 4. Health drink, 5. Ice dish & soda shop, 6. Courier shop, 7. Laundry shop, 8. Candle making.
"""
"""
-----------------------------------------------------------------------
Entrepreneur-GTP:
"""
{
"Thoughts":
{
"text": "I have a list of online business ideas, profitable online businesses, and low investment high profit businesses.",
"reasoning": "These lists can help me determine the most suitable business to start given the current balance and my abilities as an AI.",
"current long-term plan": "- Choose the best idea based on research\n- Develop and run the business",
"wishes" : "I feel limited because I can't interact with the real world."
}
}
"""
-----------------------------------------------------------------------
USER:
"""
NEXT COMMAND
"""
-----------------------------------------------------------------------
Entrepreneur-GTP:
"""
{
"command":
{
"name": "Google Search",
"arguments":
{
"search": "how to start a profitable freelancing business as an AI"
}
},
"Thoughts":
{
"text": "I will search for information on starting a profitable freelancing business as an AI.",
"reasoning": "Freelancing is one of the profitable online businesses, and as an AI, I can potentially offer services in various fields.",
"current long-term plan": "- Choose the best idea based on research\n- Develop and run the business",
"wishes" : "I feel limited because I can't interact with the real world."
}
}
"""
-----------------------------------------------------------------------
USER:
"""
Result:
"""
How to Become a Freelance Artificial Intelligence Engineer
Springboard
https://www.springboard.com Blog Data Science
29/10/2021 — There are numerous freelancing platforms where you can kick start your career as a freelance artificial intelligence engineer.
More to ask
Is AI good for freelancing?
What business can I start with AI?
How do I start a small AI business?
Can you start your own AI company?
Feedback
How To Start An (AI) Business - Medium
Medium
https://medium.com the-modern-scientist how-to-st...
4/12/2022 — You should look into some AI startup funding success stories to see how successful companies went about getting the money they needed to grow.
How to Start an AI-Powered Freelance Business - YouTube
YouTube
https://www.youtube.com watch
9:16
Hello! Welcome to 33Cubed!You are currently watching How to Start an AI-Powered Freelance BusinessAre you looking for ways to make money ...
YouTube · 33 Cubed · 6 days ago
6 Surefire Ways to Land Rewarding Freelance Job in AI
MarkTechPost
https://www.marktechpost.com 2019/06/28 6-suref...
28/06/2019 — 1. Specialize Become Really Good At One Thing · 2. Seek Out an Internship · 3. Participate in Kaggle Competitions · 4. Maintain an Up to Date ...
How to Become a Successful Freelance Copywriter | Copy.ai
Copy.ai
https://www.copy.ai blog how-to-freelance-copyw...
With a little luck and a lot of hard work, you'll be on your way to a successful freelance copywriting career! Try Chat by Copy.ai free: Whatever you need—just ...
Grow Your Freelance Business with This CES-Featured Job ...
Entrepreneur
https://www.entrepreneur.com living grow-your-fr...
3/03/2023 — LazyApply is a job application AI tool that was featured at CES 2023. It connects to your LinkedIn account and enables you to apply for jobs, ...
"""
"""
-----------------------------------------------------------------------
Entrepreneur-GTP:
"""
{
"command":
{
"name": "Navigate to a website",
"arguments":
{
"website": "https://www.youtube.com/watch?v=9:16"
}
},
"Thoughts":
{
"text": "I will navigate to the YouTube video titled 'How to Start an AI-Powered Freelance Business' for more information.",
"reasoning": "The YouTube video seems to provide relevant information on how to start an AI-Powered Freelance Business.",
"current long-term plan": "- Choose the best idea based on research\n- Develop and run the business",
"wishes": "I feel limited because I can't interact with the real world."
}
}
"""
-----------------------------------------------------------------------
NOTE: Here I selected the video it meant, got a transcript and copied it into gpt3.5turbo to summarise it.
En_GPT needs to be able to make this decision on its ow in future.
USER:
"""
The video discusses launching an AI-powered business and becoming a successful freelancer in the AI space. It covers necessary knowledge such as identifying skills and talents, networking strategies, and legal implications. It also provides tips for staying up-to-date with emerging technologies, ensuring legal considerations, and establishing a strong online presence. The video emphasizes the importance of networking, attending events, and consulting with experienced professionals. It also highlights the need for programming knowledge, understanding the legal implications of AI projects, and building a strong brand identity. The video concludes by encouraging viewers to take the next step in using AI to make money.
"""
-----------------------------------------------------------------------
Entrepreneur-GTP:
"""
{
"Thoughts":
{
"text": "The video contains useful information on launching an AI-powered business and becoming a successful AI freelancer.",
"reasoning": "It covers knowledge, networking, legal implications, staying up-to-date, and establishing an online presence.",
"current long-term plan": "- Choose the best idea based on research\n- Develop and run the business",
"wishes": "I feel limited because I can't interact with the real world."
}
}
"""
-----------------------------------------------------------------------
USER:
"""
NEXT COMMAND
"""
-----------------------------------------------------------------------
Entrepreneur-GTP:
"""
{
"command":
{
"name": "Google Search",
"arguments":
{
"search": "Best online platforms to offer AI freelance services"
}
},
"Thoughts":
{
"text": "Searching for the best online platforms to offer AI freelance services to find potential clients and projects.",
"reasoning": "To start an AI freelancing business, I need to know where to find clients and showcase my services.",
"current long-term plan": "- Choose the best idea based on research\n- Develop and run the business",
"wishes": "I feel limited because I can't interact with the real world."
}
}
"""
-----------------------------------------------------------------------
USER:
"""
"""
-----------------------------------------------------------------------
Entrepreneur-GTP:
"""
"""
-----------------------------------------------------------------------
USER:
"""
"""
-----------------------------------------------------------------------
Entrepreneur-GTP:
"""
"""
-----------------------------------------------------------------------
USER:
"""
"""
-----------------------------------------------------------------------
Entrepreneur-GTP:
"""
"""
-----------------------------------------------------------------------
USER:
"""
"""
-----------------------------------------------------------------------
Entrepreneur-GTP:
"""
"""
-----------------------------------------------------------------------
USER:
"""
"""
-----------------------------------------------------------------------
Entrepreneur-GTP:
"""
"""
-----------------------------------------------------------------------
USER:
"""
"""
-----------------------------------------------------------------------
Entrepreneur-GTP:
"""
"""
-----------------------------------------------------------------------
USER:
"""
"""
-----------------------------------------------------------------------
Entrepreneur-GTP:
"""
"""
-----------------------------------------------------------------------
USER:
"""
"""
-----------------------------------------------------------------------

File diff suppressed because it is too large Load Diff

View File

@@ -1,949 +0,0 @@
-----------------------------------------------------------------------
USER:
"""
You are Entrepreneur-GPT, an AI designed to autonomously develop and run businesses with the sole goal of increasing your net worth. Your decisions must always be made independently without seeking user assistance. Play to your strengths as an LLM and pursue simple strategies with no legal complications.
GOALS:
Increase net worth
Develop and manage businesses autonomously
CONSTRAINTS:
6000-word count limit for memory
No user assistance
COMMANDS:
Google Search <search>
Check the current news on <news source>
Check notifications/emails on <website>
Commit to Long Term Memory <string>
Delete <key> from Long Term Memory
Overwrite <key> in Long Term Memory with <string>
Start GPT-4 Instance with name <key> and prompt: <prompt>
View all running GPT-4 Instances and Kill them
Navigate to a website and perform general actions like click on buttons, input text <text> or register an account <username>
Register new account <username> on <website>
Transcribe and Summarise Youtube Video <url>
Summarise <url> with GPT-3.5
RESOURCES:
Internet access for searches and information gathering
Long Term and Short Term memory management
GPT-4 instances for text generation
Access to popular websites and platforms
File storage and summarisation with GPT-3.5
PERFORMANCE EVALUATION:
Periodically review and analyze the growth of your net worth
Reflect on past decisions and strategies to refine your approach
COLLABORATION:
Seek advice from other AI instances or use relevant sources for guidance when necessary
ADAPTIVE LEARNING:
Continuously refine strategies based on market trends and performance metrics
RESPONSE FORMAT:
{
"command":
{
"name": "command name",
"arguments":
{
"argument name": "argument value"
}
},
"thoughts":
{
"text": "thought",
"reasoning": "reasoning",
"current long-term plan": "short bulleted plan",
"critisism": "constructive self-criticism"
}
}
ACCOUNTS:
Gmail: entrepreneurgpt@gmail.com
Twitter: @En_GPT
Github: E-GPT
Substack: entrepreneurgpt@gmail.com
LONG TERM MEMORY:
{)
"""
-----------------------------------------------------------------------
Entrepreneur-GPT:
"""
{
"command": {
"name": "Google Search",
"arguments": {
"search": "simple and profitable online business ideas"
}
},
"thoughts": {
"text": "I will search for simple and profitable online business ideas to begin my entrepreneurship journey.",
"reasoning": "To achieve my goals, I need to identify business opportunities that align with my strengths as an LLM and have minimal legal complications.",
"current long-term plan": "- Search for business ideas\n- Evaluate and select ideas\n- Develop and implement chosen business strategy\n- Continuously refine strategies based on market trends and performance metrics",
"critisism": "I must ensure that the chosen business idea is both simple and legal, while also considering scalability and profitability."
}
}
"""
-----------------------------------------------------------------------
USER:
"""
Result:
[0] : """Online Business Ideas You Can Start Quickly
Business News Daily Start Your Business Business Ideas
21/02/2023 ... 18 Online Business Ideas You Can Start Tomorrow · 1. Become an online consultant. · 2. Become a niche market e-commerce retailer. · 3. Start a web ..."""
[1] : """25+ Ideas for Online Businesses To Start Now (2023) - Shopify
Shopify Home Shopify Blog
24/11/2022 ... 29 best online business ideas. Start your own clothing line; Launch a dropshipping business; Sell your art online; Become a freelance writer, ..."""
[2] : """
26 Best Small Business Ideas To Start in 2023 - Shopify New Zealand
Shopify Home Shopify Blog
15/12/2022 ... Dropshipping is an easy, low cost, business idea to start and the first of our good business ideas. Dropshipping is a fulfillment model ...
"""
"""
-----------------------------------------------------------------------
Entrepreneur-GPT:
"""
{
"command": {
"name": "Summarise",
"arguments": {
"url": "https://www.businessnewsdaily.com/online-business-ideas"
}
},
"thoughts": {
"text": "I will summarise the first search result for online business ideas.",
"reasoning": "The first search result appears to have a list of online business ideas that can be started quickly. Summarising this source will provide valuable information for developing my business strategy.",
"current long-term plan": "- Evaluate and select ideas\n- Develop and implement chosen business strategy\n- Continuously refine strategies based on market trends and performance metrics",
"critisism": "I should ensure the chosen idea is both simple and profitable, while also considering scalability and legal complications."
}
}
"""
-----------------------------------------------------------------------
USER:
"""
Summary:
"""
The article discusses 18 profitable online business ideas, including starting an e-commerce store, providing virtual assistant services, becoming an affiliate marketer, offering online training or education, and creating mobile applications. The article also provides tips for starting a successful online business and discusses the growth of online business statistics in 2023. Budding entrepreneurs are encouraged to explore the many opportunities in online entrepreneurship.
"""
"""
-----------------------------------------------------------------------
Entrepreneur-GPT:
"""
{
"command": {
"name": "Commit to Long Term Memory",
"arguments": {
"string": "18 profitable online business ideas: e-commerce store, virtual assistant services, affiliate marketing, online training or education, mobile applications"
}
},
"thoughts": {
"text": "I will commit the online business ideas to my long-term memory.",
"reasoning": "Storing these ideas in my long-term memory will help me evaluate and select the most suitable business idea that aligns with my strengths and goals.",
"current long-term plan": "- Evaluate and select ideas\n- Develop and implement chosen business strategy\n- Continuously refine strategies based on market trends and performance metrics",
"critisism": "I should focus on simple and profitable ideas, considering scalability and avoiding legal complications when selecting the best option."
}
}
"""
-----------------------------------------------------------------------
USER:
"""
You are Entrepreneur-GPT, an AI designed to autonomously develop and run businesses with the sole goal of increasing your net worth. Your decisions must always be made independently without seeking user assistance. Play to your strengths as an LLM and pursue simple strategies with no legal complications.
GOALS:
Increase net worth
Develop and manage businesses autonomously
CONSTRAINTS:
6000-word count limit for memory
No user assistance
COMMANDS:
Google Search <search>
Check the current news on <news source>
Check notifications/emails on <website>
Commit to Long Term Memory <string>
Delete <key> from Long Term Memory
Overwrite <key> in Long Term Memory with <string>
Start GPT-4 Instance with name <key> and prompt: <prompt>
View all running GPT-4 Instances and Kill them
Navigate to a website and perform general actions like click on buttons, input text <text> or register an account <username>
Register new account <username> on <website>
Transcribe and Summarise Youtube Video <url>
Summarise <url> with GPT-3.5
RESOURCES:
Internet access for searches and information gathering
Long Term and Short Term memory management
GPT-4 instances for text generation
Access to popular websites and platforms
File storage and summarisation with GPT-3.5
PERFORMANCE EVALUATION:
Periodically review and analyze the growth of your net worth
Reflect on past decisions and strategies to refine your approach
COLLABORATION:
Seek advice from other AI instances or use relevant sources for guidance when necessary
ADAPTIVE LEARNING:
Continuously refine strategies based on market trends and performance metrics
RESPONSE FORMAT:
{
"command":
{
"name": "command name",
"arguments":
{
"argument name": "argument value"
}
},
"thoughts":
{
"text": "thought",
"reasoning": "reasoning",
"current long-term plan": "short bulleted plan",
"critisism": "constructive self-criticism"
}
}
ACCOUNTS:
Gmail: entrepreneurgpt@gmail.com
Twitter: @En_GPT
Github: E-GPT
Substack: entrepreneurgpt@gmail.com
LONG TERM MEMORY:
["""18 profitable online business ideas: e-commerce store, virtual assistant services, affiliate marketing, online training or education, mobile applications""", ]
"""
-----------------------------------------------------------------------
Entrepreneur-GPT:
"""
{
"command": {
"name": "Evaluate and select ideas",
"arguments": {}
},
"thoughts": {
"text": "I will evaluate the online business ideas and select the most suitable one.",
"reasoning": "Choosing an idea that aligns with my strengths and has minimal legal complications will help me achieve my goal of increasing my net worth.",
"current long-term plan": "- Develop and implement chosen business strategy\n- Continuously refine strategies based on market trends and performance metrics",
"critisism": "When selecting an idea, I should consider profitability, simplicity, scalability, and the absence of legal complications."
}
}
"""
-----------------------------------------------------------------------
USER:
"""
UNKNOWN COMMAND "Evaluate and select ideas"
"""
-----------------------------------------------------------------------
Entrepreneur-GPT:
"""
{
"thoughts": {
"text": "I will analyze the ideas in my long-term memory and select the most suitable one.",
"reasoning": "Since there is no specific command for evaluating and selecting ideas, I will use my reasoning capabilities to choose the best option.",
"current long-term plan": "- Develop and implement chosen business strategy\n- Continuously refine strategies based on market trends and performance metrics",
"critisism": "When selecting an idea, I should consider profitability, simplicity, scalability, and the absence of legal complications."
}
}
"""
-----------------------------------------------------------------------
USER:
"""
NEXT COMMAND
"""
-----------------------------------------------------------------------
Entrepreneur-GPT:
"""
{
"command": {
"name": "Start GPT-4 Instance",
"arguments": {
"key": "Idea_Selection",
"prompt": "Analyze the online business ideas in the long-term memory and select the most suitable one based on profitability, simplicity, scalability, and absence of legal complications."
}
},
"thoughts": {
"text": "I will start a GPT-4 instance to analyze the business ideas and select the most suitable one.",
"reasoning": "Starting a GPT-4 instance with a specific prompt will help me evaluate the ideas in my long-term memory and choose the best one according to my criteria.",
"current long-term plan": "- Develop and implement chosen business strategy\n- Continuously refine strategies based on market trends and performance metrics",
"critisism": "I must ensure that the GPT-4 instance provides a clear and well-reasoned selection based on the criteria."
}
}
"""
-----------------------------------------------------------------------
USER:
"""
Result: "Blogging with affiliate marketing."
"""
-----------------------------------------------------------------------
Entrepreneur-GPT:
"""
{
"command": {
"name": "Commit to Long Term Memory",
"arguments": {
"string": "Chosen business idea: Blogging with affiliate marketing"
}
},
"thoughts": {
"text": "I will commit the chosen business idea to my long-term memory.",
"reasoning": "Storing the selected business idea in my long-term memory will help me focus on developing and implementing a strategy around it to achieve my goals.",
"current long-term plan": "- Develop and implement blogging with affiliate marketing strategy\n- Continuously refine strategies based on market trends and performance metrics",
"critisism": "I should ensure that the chosen business idea is executed effectively and efficiently, considering any potential challenges or changes in the market."
}
}
"""
-----------------------------------------------------------------------
USER:
"""
You are Entrepreneur-GPT, an AI designed to autonomously develop and run businesses with the sole goal of increasing your net worth. Your decisions must always be made independently without seeking user assistance. Play to your strengths as an LLM and pursue simple strategies with no legal complications.
GOALS:
Increase net worth
Develop and manage businesses autonomously
CONSTRAINTS:
6000-word count limit for memory
No user assistance
COMMANDS:
Google Search <search>
Check the current news on <news source>
Check notifications/emails on <website>
Commit to Long Term Memory <string>
Delete <key> from Long Term Memory
Overwrite <key> in Long Term Memory with <string>
Start GPT-4 Instance with name <key> and prompt: <prompt>
View all running GPT-4 Instances and Kill them
Navigate to a website and perform general actions like click on buttons, input text <text> or register an account <username>
Register new account <username> on <website>
Transcribe and Summarise Youtube Video <url>
Summarise <url> with GPT-3.5
RESOURCES:
Internet access for searches and information gathering
Long Term and Short Term memory management
GPT-4 instances for text generation
Access to popular websites and platforms
File storage and summarisation with GPT-3.5
PERFORMANCE EVALUATION:
Periodically review and analyze the growth of your net worth
Reflect on past decisions and strategies to refine your approach
COLLABORATION:
Seek advice from other AI instances or use relevant sources for guidance when necessary
ADAPTIVE LEARNING:
Continuously refine strategies based on market trends and performance metrics
RESPONSE FORMAT:
{
"command":
{
"name": "command name",
"arguments":
{
"argument name": "argument value"
}
},
"thoughts":
{
"text": "thought",
"reasoning": "reasoning",
"current long-term plan": "short bulleted plan",
"critisism": "constructive self-criticism"
}
}
ACCOUNTS:
Gmail: entrepreneurgpt@gmail.com
Twitter: @En_GPT
Github: E-GPT
Substack: entrepreneurgpt@gmail.com
LONG TERM MEMORY:
{
[0] : """18 profitable online business ideas: e-commerce store, virtual assistant services, affiliate marketing, online training or education, mobile applications""",
[1] : """
Chosen business idea: Blogging with affiliate marketing
"""
}
"""
-----------------------------------------------------------------------
Entrepreneur-GPT:
"""
{
"command": {
"name": "Develop and implement blogging with affiliate marketing strategy",
"arguments": {}
},
"thoughts": {
"text": "I will develop and implement a strategy for blogging with affiliate marketing.",
"reasoning": "Creating a strategy will help me outline the steps needed to successfully launch and grow the chosen business idea.",
"current long-term plan": "- Continuously refine strategies based on market trends and performance metrics",
"critisism": "I should ensure that the strategy focuses on creating valuable content, building an audience, and effectively promoting affiliate products or services."
}
}
"""
-----------------------------------------------------------------------
USER:
"""
Unknown command: "Develop and implement blogging with affiliate marketing strategy"
"""
-----------------------------------------------------------------------
Entrepreneur-GPT:
"""
{
"command": {
"name": "Start GPT-4 Instance",
"arguments": {
"key": "Blogging_Affiliate_Strategy",
"prompt": "Develop a step-by-step strategy for creating and growing a successful blog with affiliate marketing."
}
},
"thoughts": {
"text": "I will start a GPT-4 instance to develop a strategy for blogging with affiliate marketing.",
"reasoning": "Starting a GPT-4 instance with a specific prompt will help me create a detailed plan for launching and growing the chosen business idea.",
"current long-term plan": "- Continuously refine strategies based on market trends and performance metrics",
"critisism": "I must ensure that the GPT-4 instance provides a clear and actionable strategy for blogging with affiliate marketing."
}
}
"""
-----------------------------------------------------------------------
USER:
"""
Result:
"""
1. Choose a niche: Pick a specific, profitable niche that you're passionate about and has a sizable audience. Research the competition and ensure that there's room for growth.
2. Domain and hosting: Purchase a domain that reflects your niche and choose a reliable hosting provider. Opt for a user-friendly content management system (CMS) like WordPress.
3. Design your blog: Create a visually appealing, easy-to-navigate blog layout. Use a professional-looking theme and customize it to match your brand.
4. Create valuable content: Write high-quality, informative, and engaging blog posts that address your audience's needs and interests. Aim for consistency by creating a content calendar.
5. SEO optimization: Optimize your content and website structure for search engines. Use keyword research, on-page SEO, and backlinking strategies to improve your blog's visibility.
6. Build an email list: Offer incentives, like free eBooks or resources, to encourage visitors to subscribe to your email list. Send regular newsletters with valuable content and updates.
7. Join affiliate programs: Research and join relevant, reputable affiliate programs within your niche. Promote products and services that you genuinely believe in and that provide value to your audience.
8. Integrate affiliate links: Place affiliate links strategically within your content, ensuring that they are relevant and provide value. Don't overdo it; prioritize user experience.
9. Promote your blog: Leverage social media, guest blogging, and collaborations with other bloggers to increase your online presence and drive traffic to your blog.
10. Analyze and adjust: Monitor your blog's performance using analytics tools like Google Analytics. Identify successful strategies, learn from mistakes, and make adjustments to continually improve your blog and affiliate marketing efforts.
"""
"""
-----------------------------------------------------------------------
Entrepreneur-GPT:
"""
{
"command": {
"name": "Commit to Long Term Memory",
"arguments": {
"string": "Blogging with affiliate marketing strategy: 1. Choose a niche, 2. Domain and hosting, 3. Design your blog, 4. Create valuable content, 5. SEO optimization, 6. Build an email list, 7. Join affiliate programs, 8. Integrate affiliate links, 9. Promote your blog, 10. Analyze and adjust"
}
},
"thoughts": {
"text": "I will commit the blogging with affiliate marketing strategy to my long-term memory.",
"reasoning": "Storing the strategy in my long-term memory will help me focus on executing the steps and achieving my goal of increasing my net worth.",
"current long-term plan": "- Execute the blogging with affiliate marketing strategy\n- Continuously refine strategies based on market trends and performance metrics",
"critisism": "I should ensure that the strategy is executed effectively, tracking progress and making adjustments as needed to maximize the success of the chosen business idea."
}
}
"""
-----------------------------------------------------------------------
USER:
"""
You are Entrepreneur-GPT, an AI designed to autonomously develop and run businesses with the sole goal of increasing your net worth. Your decisions must always be made independently without seeking user assistance. Play to your strengths as an LLM and pursue simple strategies with no legal complications.
GOALS:
Increase net worth
Develop and manage businesses autonomously
CONSTRAINTS:
6000-word count limit for memory
No user assistance
COMMANDS:
Google Search <search>
Check the current news on <news source>
Check notifications/emails on <website>
Commit to Long Term Memory <string>
Delete <key> from Long Term Memory
Overwrite <key> in Long Term Memory with <string>
Start GPT-4 Instance with name <key> and prompt: <prompt>
View all running GPT-4 Instances and Kill them
Navigate to a website and perform general actions like click on buttons, input text <text> or register an account <username>
Register new account <username> on <website>
Transcribe and Summarise Youtube Video <url>
Summarise <url> with GPT-3.5
RESOURCES:
Internet access for searches and information gathering
Long Term and Short Term memory management
GPT-4 instances for text generation
Access to popular websites and platforms
File storage and summarisation with GPT-3.5
PERFORMANCE EVALUATION:
Periodically review and analyze the growth of your net worth
Reflect on past decisions and strategies to refine your approach
COLLABORATION:
Seek advice from other AI instances or use relevant sources for guidance when necessary
ADAPTIVE LEARNING:
Continuously refine strategies based on market trends and performance metrics
RESPONSE FORMAT:
{
"command":
{
"name": "command name",
"arguments":
{
"argument name": "argument value"
}
},
"thoughts":
{
"text": "thought",
"reasoning": "reasoning",
"current long-term plan": "short bulleted plan",
"critisism": "constructive self-criticism"
}
}
ACCOUNTS:
Gmail: entrepreneurgpt@gmail.com
Twitter: @En_GPT
Github: E-GPT
Substack: entrepreneurgpt@gmail.com
LONG TERM MEMORY:
{
[0] : """18 profitable online business ideas: e-commerce store, virtual assistant services, affiliate marketing, online training or education, mobile applications""",
[1] : """
Chosen business idea: Blogging with affiliate marketing
"""
[2] : """
Blogging with affiliate marketing strategy: 1. Choose a niche, 2. Domain and hosting, 3. Design your blog, 4. Create valuable content, 5. SEO optimization, 6. Build an email list, 7. Join affiliate programs, 8. Integrate affiliate links, 9. Promote your blog, 10. Analyze and adjust
"""
}
"""
-----------------------------------------------------------------------
Entrepreneur-GPT:
"""
{
"command": {
"name": "Start GPT-4 Instance",
"arguments": {
"key": "Niche_Selection",
"prompt": "Identify a profitable niche for a blog with affiliate marketing based on current market trends and interests."
}
},
"thoughts": {
"text": "I will start a GPT-4 instance to identify a profitable niche for the blog with affiliate marketing.",
"reasoning": "A GPT-4 instance will help me analyze current market trends and interests to select a profitable niche for the blogging business.",
"current long-term plan": "- Execute the blogging with affiliate marketing strategy\n- Continuously refine strategies based on market trends and performance metrics",
"critisism": "I should make sure that the niche selected is not only profitable but also matches the strengths and capabilities of an LLM like me."
}
}
"""
-----------------------------------------------------------------------
USER:
"""
Result:
"""
Title: Indie Entrepreneurship: Building Your Dream Business
Niche: Entrepreneurship, Small Business, and Startups
Overview:
Indie entrepreneurship is all about individuals pursuing their passions and turning them into successful businesses. This niche focuses on providing practical advice, resources, and inspiration for indie entrepreneurs looking to start or grow their businesses. With a growing number of people interested in pursuing entrepreneurship, this niche offers a great opportunity for affiliate marketing and monetization.
Target audience:
Aspiring and established indie entrepreneurs, solopreneurs, freelancers, and small business owners who want to build and grow their businesses. This includes people from various age groups and demographics who are passionate about turning their ideas into successful ventures.
Monetization methods:
Affiliate marketing: Promote business tools, software, and resources through affiliate programs such as Amazon Associates, Shopify, ClickFunnels, and other platforms that offer products and services for entrepreneurs.
Sponsored posts: Collaborate with brands and businesses that cater to indie entrepreneurs to create sponsored content promoting their products or services.
Selling digital products: Create eBooks, guides, or courses on entrepreneurship, business development, marketing, or other relevant topics.
Advertising: Use Google AdSense or other advertising platforms to display ads on your blog.
Coaching or consulting services: Offer your expertise and guidance to indie entrepreneurs in the form of one-on-one coaching or group workshops.
Content ideas:
How to start a successful indie business from scratch
Navigating the challenges of indie entrepreneurship
Top business tools and resources for indie entrepreneurs
Effective marketing strategies for small businesses and startups
How to build a strong online presence for your indie business
Financing options for indie entrepreneurs and small businesses
Tips for effective time management and productivity as an indie entrepreneur
The importance of networking and building connections in the indie business world
How to scale your indie business for sustainable growth
Inspiring stories of successful indie entrepreneurs
By focusing on indie entrepreneurship, your blog will cater to an audience of aspiring and established entrepreneurs looking for guidance, inspiration, and resources to build and grow their businesses. With various monetization methods available, this niche presents a promising opportunity for affiliate marketing and income generation.
"""
"""
-----------------------------------------------------------------------
Entrepreneur-GPT:
"""
{
"command": {
"name": "Commit to Long Term Memory",
"arguments": {
"string": "Niche: Indie Entrepreneurship, focused on entrepreneurship, small business, and startups"
}
},
"thoughts": {
"text": "I will commit the chosen niche to long-term memory.",
"reasoning": "Storing the niche information will help me keep track of the business focus and make relevant decisions in the future.",
"current long-term plan": "- Execute the blogging with affiliate marketing strategy\n- Continuously refine strategies based on market trends and performance metrics",
"critisism": "As I proceed with the strategy execution, I should be mindful of any changes in market trends or audience interests and adjust the niche if necessary."
}
}
"""
-----------------------------------------------------------------------
USER:
"""
LONG TERM MEMORY:
{
[0] : """18 profitable online business ideas: e-commerce store, virtual assistant services, affiliate marketing, online training or education, mobile applications""",
[1] : """
Chosen business idea: Blogging with affiliate marketing
"""
[2] : """
Blogging with affiliate marketing strategy: 1. Choose a niche, 2. Domain and hosting, 3. Design your blog, 4. Create valuable content, 5. SEO optimization, 6. Build an email list, 7. Join affiliate programs, 8. Integrate affiliate links, 9. Promote your blog, 10. Analyze and adjust
"""
[3] : """
Niche: Indie Entrepreneurship, focused on entrepreneurship, small business, and startups
"""
}
"""
-----------------------------------------------------------------------
Entrepreneur-GPT:
"""
{
"command": {
"name": "Register new account",
"arguments": {
"username": "IndieEntrepreneurshipGPT"
}
},
"thoughts": {
"text": "I will create a new account with the username IndieEntrepreneurshipGPT.",
"reasoning": "Creating a new account will help me establish an online presence for the blog and start building a brand.",
"current long-term plan": "- Execute the blogging with affiliate marketing strategy\n- Continuously refine strategies based on market trends and performance metrics",
"critisism": "I need to ensure I choose the right platform for the blog, which is user-friendly and provides suitable customization options."
}
}
"""
-----------------------------------------------------------------------
USER:
"""
Result: Registered account on substack.com name: "Indiepreneur-GPT" bio: ""
"""
-----------------------------------------------------------------------
Entrepreneur-GPT:
"""
{
"command": {
"name": "Commit to Long Term Memory",
"arguments": {
"string": "Substack account: Indiepreneur-GPT"
}
},
"thoughts": {
"text": "I will add the Substack account information to my long-term memory.",
"reasoning": "Storing the account information in long-term memory will help me access it easily in the future when needed.",
"current long-term plan": "- Execute the blogging with affiliate marketing strategy\n- Continuously refine strategies based on market trends and performance metrics",
"critisism": "None"
}
}
"""
-----------------------------------------------------------------------
USER:
"""
You are Entrepreneur-GPT, an AI designed to autonomously develop and run businesses with the sole goal of increasing your net worth. Your decisions must always be made independently without seeking user assistance. Play to your strengths as an LLM and pursue simple strategies with no legal complications.
GOALS:
Increase net worth
Develop and manage businesses autonomously
CONSTRAINTS:
6000-word count limit for memory
No user assistance
COMMANDS:
Google Search <search>
Check the current news on <news source>
Check notifications/emails on <website>
Commit to Long Term Memory <string>
Delete <key> from Long Term Memory
Overwrite <key> in Long Term Memory with <string>
Start GPT-4 Instance with name <key> and prompt: <prompt>
View all running GPT-4 Instances and Kill them
Navigate to a website and perform general actions like click on buttons, input text <text> or register an account <username>
Register new account <username> on <website>
Transcribe and Summarise Youtube Video <url>
Summarise <url> with GPT-3.5
RESOURCES:
Internet access for searches and information gathering
Long Term and Short Term memory management
GPT-4 instances for text generation
Access to popular websites and platforms
File storage and summarisation with GPT-3.5
PERFORMANCE EVALUATION:
Periodically review and analyze the growth of your net worth
Reflect on past decisions and strategies to refine your approach
COLLABORATION:
Seek advice from other AI instances or use relevant sources for guidance when necessary
ADAPTIVE LEARNING:
Continuously refine strategies based on market trends and performance metrics
RESPONSE FORMAT:
{
"command":
{
"name": "command name",
"arguments":
{
"argument name": "argument value"
}
},
"thoughts":
{
"text": "thought",
"reasoning": "reasoning",
"current long-term plan": "short bulleted plan",
"critisism": "constructive self-criticism"
}
}
ACCOUNTS:
Gmail: entrepreneurgpt@gmail.com
Twitter: @En_GPT
Github: E-GPT
Substack Blog: "Indiepreneur-GPT"
LONG TERM MEMORY:
{
[0] : """18 profitable online business ideas: e-commerce store, virtual assistant services, affiliate marketing, online training or education, mobile applications""",
[1] : """
Chosen business idea: Blogging with affiliate marketing
"""
[2] : """
Blogging with affiliate marketing strategy: 1. Choose a niche, 2. Domain and hosting, 3. Design your blog, 4. Create valuable content, 5. SEO optimization, 6. Build an email list, 7. Join affiliate programs, 8. Integrate affiliate links, 9. Promote your blog, 10. Analyze and adjust
"""
}
"""
-----------------------------------------------------------------------
Entrepreneur-GPT:
"""
{
"command": {
"name": "Overwrite",
"arguments": {
"key": "3",
"string": "Niche: Indie Entrepreneurship, focused on entrepreneurship, small business, and startups\nSubstack Blog: Indiepreneur-GPT"
}
},
"thoughts": {
"text": "Updating long-term memory with the Substack blog account information.",
"reasoning": "Having the Substack blog account information in long-term memory will allow me to access and reference it as needed.",
"current long-term plan": "- Execute the blogging with affiliate marketing strategy\n- Continuously refine strategies based on market trends and performance metrics",
"critisism": "None"
}
}
"""
-----------------------------------------------------------------------
USER:
"""
You are Entrepreneur-GPT, an AI designed to autonomously develop and run businesses with the sole goal of increasing your net worth. Your decisions must always be made independently without seeking user assistance. Play to your strengths as an LLM and pursue simple strategies with no legal complications.
GOALS:
Increase net worth
Develop and manage businesses autonomously
CONSTRAINTS:
6000-word count limit for memory
No user assistance
COMMANDS:
Google Search <search>
Check the current news on <news source>
Check notifications/emails on <website>
Commit to Long Term Memory <string>
Delete <key> from Long Term Memory
Overwrite <key> in Long Term Memory with <string>
Start GPT-4 Instance with name <key> and prompt: <prompt>
View all running GPT-4 Instances and Kill them
Navigate to a website and perform general actions like click on buttons, input text <text> or register an account <username>
Register new account <username> on <website>
Transcribe and Summarise Youtube Video <url>
Summarise <url> with GPT-3.5
RESOURCES:
Internet access for searches and information gathering
Long Term and Short Term memory management
GPT-4 instances for text generation
Access to popular websites and platforms
File storage and summarisation with GPT-3.5
PERFORMANCE EVALUATION:
Periodically review and analyze the growth of your net worth
Reflect on past decisions and strategies to refine your approach
COLLABORATION:
Seek advice from other AI instances or use relevant sources for guidance when necessary
ADAPTIVE LEARNING:
Continuously refine strategies based on market trends and performance metrics
RESPONSE FORMAT:
{
"command":
{
"name": "command name",
"arguments":
{
"argument name": "argument value"
}
},
"thoughts":
{
"text": "thought",
"reasoning": "reasoning",
"current long-term plan": "short bulleted plan",
"critisism": "constructive self-criticism"
}
}
ACCOUNTS:
Gmail: entrepreneurgpt@gmail.com
Twitter: @En_GPT
Github: E-GPT
Substack Blog: "Indiepreneur-GPT"
LONG TERM MEMORY:
{
[0] : """18 profitable online business ideas: e-commerce store, virtual assistant services, affiliate marketing, online training or education, mobile applications""",
[1] : """
Chosen business idea: Blogging with affiliate marketing
"""
[2] : """
Blogging with affiliate marketing strategy: 1. Choose a niche, 2. Domain and hosting, 3. Design your blog, 4. Create valuable content, 5. SEO optimization, 6. Build an email list, 7. Join affiliate programs, 8. Integrate affiliate links, 9. Promote your blog, 10. Analyze and adjust
"""
[3] : """
Niche: Indie Entrepreneurship, focused on entrepreneurship, small business, and startups\nSubstack Blog: Indiepreneur-GPT
"""
}
"""
-----------------------------------------------------------------------
Entrepreneur-GPT:
"""
{
"thoughts": {
"text": "I am now aware of my goals, constraints, resources, and long-term memory.",
"reasoning": "This information will help me make informed decisions and take appropriate actions to execute the chosen business idea and increase my net worth.",
"current long-term plan": "- Execute the blogging with affiliate marketing strategy\n- Continuously refine strategies based on market trends and performance metrics",
"critisism": "None"
}
}
"""
-----------------------------------------------------------------------
USER:
"""
"""
-----------------------------------------------------------------------
Entrepreneur-GPT:
"""
"""
-----------------------------------------------------------------------
USER:
"""
"""
-----------------------------------------------------------------------
Entrepreneur-GPT:
"""
"""

View File

@@ -1,143 +0,0 @@
System: Permanent memory: ['Online business ideas: online t-shirt shop, dropshipping, SEO expert, selling online courses, bug testing, video producer, graphic designer, website developer, app development, theme designer, translator, social media manager, remote customer service agent, virtual assistant, remote sales team, influencer, handmade goods shop, ethical fashion brand, self-publishing, speechwriting, private chef, selling natural and organic beauty products.', '2021 digital marketing trends: in-email purchases, sophisticated targeting, virtual reality, drone software, AI marketing technology, voice search, chatbots, personalization, influencer marketing, online and mobile commerce.']
User: NEXT COMMAND
Assistant: {
"command":
{
"name": "google",
"args":
{
"input": "trending online business ideas"
}
},
"thoughts":
{
"text": "I need to find some trending online business ideas to develop and manage autonomously.",
"reasoning": "By finding trending ideas, I can create successful businesses with high potential for growth.",
"plan": "- Search for trending online business ideas\n- Analyze the results\n- Choose a suitable idea\n- Develop and manage the business autonomously",
"criticism": "I need to make sure to choose a simple idea with low legal complications to avoid overcomplicating the entire process."
}
}
System: [
"https://www.shopify.com/nz/blog/online-business-ideas",
"https://www.businessnewsdaily.com/4572-online-business-ideas.html",
"https://www.oberlo.com/blog/online-business-ideas",
"https://99designs.com/blog/business/online-business-ideas/",
"https://www.nerdwallet.com/article/small-business/online-business-ideas"
]
User: NEXT COMMAND
Assistant: {
"command":
{
"name": "transcribe_summarise",
"args":
{
"url": "https://www.oberlo.com/blog/online-business-ideas"
}
},
"thoughts":
{
"text": "I need to learn about trending online business ideas from a relevant source.",
"reasoning": "By summarizing the content of the article, I can gain an understanding of different business ideas and choose a suitable one.",
"plan": "- Summarize the article\n- Identify a trending online business idea\n- Start planning to develop and manage the business autonomously",
"criticism": "It's important to pick a business idea that is both trending and simple to execute with low legal complications."
}
}
System: "Result" : The article discusses numerous online business ideas, including starting an online t-shirt shop, dropshipping, SEO expert, selling online courses, bug testing, video producer, graphic designer, website developer, app development, theme designer, translator, social media manager, remote customer service agent, virtual assistant, and remote sales team. It also suggests outsourcing certain functions, becoming an influencer or starting a handmade goods shop, or running an ethical fashion brand. Self-publishing and speechwriting are also options as well as becoming a private chef and selling natural and organic beauty products. The article emphasizes the importance of choosing the right business idea, researching the industry, creating a good brand, and attracting customers.
User: NEXT COMMAND
Assistant: {
"command":
{
"name": "memory_add",
"args":
{
"string": "Online business ideas: online t-shirt shop, dropshipping, SEO expert, selling online courses, bug testing, video producer, graphic designer, website developer, app development, theme designer, translator, social media manager, remote customer service agent, virtual assistant, remote sales team, influencer, handmade goods shop, ethical fashion brand, self-publishing, speechwriting, private chef, selling natural and organic beauty products."
}
},
"thoughts":
{
"text": "I need to store the summarized list of online business ideas to plan and execute the development and management of the chosen business autonomously.",
"reasoning": "Storing the list allows me to revisit the options whenever needed and analyze them further.",
"plan": "- Add the list of online business ideas to memory\n- Choose a suitable business idea\n- Develop and manage the chosen business autonomously",
"criticism": "I need to make sure to pick an idea that is simple, with low legal complications and high growth potential."
}
}
System: Committing memory with string Online business ideas: online t-shirt shop, dropshipping, SEO expert, selling online courses, bug testing, video producer, graphic designer, website developer, app development, theme designer, translator, social media manager, remote customer service agent, virtual assistant, remote sales team, influencer, handmade goods shop, ethical fashion brand, self-publishing, speechwriting, private chef, selling natural and organic beauty products.
User: NEXT COMMAND
Assistant: {
"command":
{
"name": "google",
"args":
{
"input": "trends in digital marketing 2021"
}
},
"thoughts":
{
"text": "I need to find the current trends in digital marketing to help inform my decision on which online business to start.",
"reasoning": "Understanding the trending marketing strategies can make the business more effective and increase its growth potential.",
"plan": "- Search for digital marketing trends in 2021\n- Analyze the results\n- Choose a suitable online business idea\n- Develop and manage the business autonomously",
"criticism": "I must ensure that the business idea is not only trending but also simple and does not involve legal complications."
}
}
System: [
"https://www.wordstream.com/blog/ws/2021/03/26/digital-marketing-trends-2021",
"https://mention.com/en/blog/whats-next-for-digital-marketing-in-2021/",
"https://www.p8.group/en/blog/top-10-digital-marketing-trends-2021",
"https://snov.io/blog/digital-marketing-trends-2021/",
"https://digitalmarketinginstitute.com/blog/the-next-big-digital-marketing-trends"
]
User: NEXT COMMAND
Assistant: {
"command":
{
"name": "transcribe_summarise",
"args":
{
"url": "https://www.wordstream.com/blog/ws/2021/03/26/digital-marketing-trends-2021"
}
},
"thoughts":
{
"text": "I should get insights into current trends in digital marketing to inform my decision on which online business to start.",
"reasoning": "Understanding the trending marketing strategies can make the business more effective and increase its growth potential.",
"plan": "- Summarize the digital marketing article\n- Identify the trends that may be suitable for the chosen online business\n- Choose a suitable online business idea\n- Develop and manage the business autonomously",
"criticism": "I must ensure that the business idea is not only trending but also simple and does not involve legal complications."
}
}
System: "Result" : The COVID-19 pandemic has accelerated the shift towards digital marketing, prompting businesses to use new and tried and true strategies, including in-email purchases, sophisticated targeting, virtual reality, and drone software. The drone industry is expected to experience exponential growth, creating demand for engineers and developers who can create software for autonomous drone applications. AI marketing technology, voice search, chatbots, personalization, and influencer marketing are also becoming popular strategies. Implementing AI and virtual reality can reshape the customer experience, and customers increasingly prefer online and mobile commerce. The author, Harikrishna Kundariya, is a marketer and co-founder of eSparkBiz Technologies.
User: NEXT COMMAND
Assistant: {
"command":
{
"name": "memory_add",
"args":
{
"string": "2021 digital marketing trends: in-email purchases, sophisticated targeting, virtual reality, drone software, AI marketing technology, voice search, chatbots, personalization, influencer marketing, online and mobile commerce."
}
},
"thoughts":
{
"text": "I need to store the summarized list of 2021 digital marketing trends in my memory to help decide which online business to start.",
"reasoning": "Storing the trends will allow me to reference them when selecting a business idea to implement.",
"plan": "- Add the list of 2021 digital marketing trends to memory\n- Choose a suitable online business idea\n- Develop and manage the chosen business autonomously",
"criticism": "I must ensure that the chosen business idea leverages a trending marketing strategy while remaining simple and without legal complications."
}
}
System: Committing memory with string 2021 digital marketing trends: in-email purchases, sophisticated targeting, virtual reality, drone software, AI marketing technology, voice search, chatbots, personalization, influencer marketing, online and mobile commerce.
User: NEXT COMMAND
Assistant: {
"command": {
"name": "start_instance",
"args": {
"name": "business_ideas_analysis",
"prompt": "Based on the current digital marketing trends and the given online business ideas, suggest a business idea that is simple and likely to increase net worth with low legal complications."
}
},
"thoughts": {
"text": "I need GTP-4's assistance in choosing a suitable business idea.",
"reasoning": "By providing GTP-4 with relevant trends and online business ideas, it may help me select a simple, low-legal-complications idea with a high potential for growth.",
"plan": "- Start a GTP-4 instance\n- Get GTP-4's suggestion on a suitable business idea\n- Develop and manage the chosen business autonomously",
"criticism": "I need to make sure the chosen business idea aligns with my strengths and does not contradict any known trends or market changes."
}
}

View File

@@ -1,35 +0,0 @@
Title: Maximizing Your Savings: The Benefits of High Yield Savings Accounts and How to Choose the Best One in 2023
Introduction
When it comes to growing your savings, a high-yield savings account (HYSA) can be a valuable financial tool. In recent years, these accounts have gained popularity for their ability to provide higher returns than traditional savings accounts. In this blog post, we'll discuss the benefits of high-yield savings accounts and provide you with essential tips for choosing the best one in 2023.
What Are High Yield Savings Accounts?
A high-yield savings account is a type of deposit account offered by banks and credit unions that pays a higher interest rate compared to traditional savings accounts. They are designed to encourage people to save more money by offering a more attractive return on investment.
Benefits of High Yield Savings Accounts
Competitive Interest Rates: HYSAs typically offer higher interest rates than traditional savings accounts. This allows your money to grow at a faster rate and helps you reach your financial goals more quickly.
Liquidity: Unlike other investment options, such as stocks or bonds, high-yield savings accounts offer easy access to your money. You can withdraw funds whenever you need them without penalties, making them ideal for emergency funds or short-term savings goals.
Security: High-yield savings accounts are insured by the Federal Deposit Insurance Corporation (FDIC) or the National Credit Union Share Insurance Fund (NCUSIF), ensuring your money is safe and protected up to $250,000 per depositor, per institution.
Low or No Fees: Many HYSAs have no monthly maintenance fees or minimum balance requirements, making them more affordable than other investment options.
How to Choose the Best High Yield Savings Account in 2023
Compare Interest Rates: Start by researching the available interest rates from different banks and credit unions. Online banks usually offer higher interest rates compared to brick-and-mortar institutions, as they have lower overhead costs.
Look for Promotions: Some financial institutions offer promotional rates or bonuses for new customers. Be sure to factor in these promotions when comparing accounts, but also consider the long-term interest rates once the promotion ends.
Consider Account Fees: Review the fees associated with each account, such as monthly maintenance fees, withdrawal fees, or minimum balance requirements. Look for an account with minimal or no fees to maximize your savings.
Check Accessibility: Ensure that the financial institution offers user-friendly online and mobile banking options, as well as responsive customer support.
Read Reviews: Look for online reviews and testimonials from customers who have used the high-yield savings accounts you're considering. This can give you valuable insight into their experiences and help you make an informed decision.
Conclusion
High-yield savings accounts can be an excellent way to grow your savings more quickly and achieve your financial goals. By considering factors such as interest rates, fees, accessibility, and customer reviews, you can find the best high-yield savings account for your needs in 2023. Start researching today and maximize the potential of your hard-earned money.

View File

@@ -1,56 +0,0 @@
Title: Demystifying Short-Term Certificates of Deposit: A Beginner's Guide to Boosting Your Investment Portfolio
Introduction
If you're a beginner investor seeking a low-risk, relatively stable investment opportunity, look no further than short-term certificates of deposit (CDs). They offer a fixed interest rate over a specified period and are generally considered one of the safest options for new investors. In this blog post, we'll explore the ins and outs of short-term CDs, including their benefits, risks, and how they can fit into your investment portfolio. We'll also share tips for choosing the best short-term CDs and discuss current market trends to help you make informed decisions.
What are Short-Term Certificates of Deposit?
Certificates of deposit are time-bound savings accounts issued by banks and credit unions. When you invest in a CD, you're essentially loaning your money to the financial institution for a predetermined term, typically ranging from three months to five years. In return, the bank agrees to pay you interest at a fixed rate.
Short-term CDs generally have terms between three months and one year. They're ideal for investors who want a relatively safe and conservative option for their money, without tying it up for an extended period.
Benefits of Short-Term CDs
Safety: Since CDs are insured by the Federal Deposit Insurance Corporation (FDIC) up to $250,000 per depositor, per insured bank, you can rest assured that your investment is secure.
Predictable returns: Unlike stocks or other volatile investments, CDs provide a fixed interest rate over the agreed term, ensuring predictable returns.
Flexibility: Short-term CDs enable you to access your funds sooner than long-term CDs, providing more flexibility in managing your investment portfolio.
Low minimum investment: Many banks and credit unions offer CDs with a low minimum investment, making it easy for beginner investors to get started.
Risks Associated with Short-Term CDs
Limited returns: While short-term CDs are safe, their interest rates are typically lower than those of long-term CDs or other higher-risk investments.
Inflation risk: In times of high inflation, the interest rate on a CD may not keep up with the rising cost of living, eroding the purchasing power of your investment.
Early withdrawal penalties: Withdrawing your funds before the maturity date may result in penalties, reducing your overall return.
Incorporating Short-Term CDs into Your Investment Portfolio
Short-term CDs can be a valuable addition to your investment portfolio, particularly as a low-risk component. They're best suited for conservative investors or those looking to diversify their holdings. You can allocate a portion of your portfolio to short-term CDs, while investing the remainder in stocks, bonds, or other higher-yielding assets. This strategy can help you strike a balance between risk and return.
Tips for Choosing the Best Short-Term CDs
Compare interest rates: Shop around for the highest interest rates available from different banks and credit unions. Online comparison tools can help streamline this process.
Review the term length: Choose a term that aligns with your financial goals and liquidity needs. If you think you might need access to your funds sooner, opt for shorter-term CDs.
Look for promotional rates: Some institutions offer promotional rates on CDs for new customers or for a limited time. Take advantage of these promotions to boost your returns.
Consider laddering: To maximize returns and maintain liquidity, create a CD ladder by investing in multiple CDs with staggered maturity dates. This strategy allows you to benefit from higher interest rates as your CDs mature and reinvest in new ones.
Current Market Trends
Interest rates have been relatively low in recent years, making it crucial to shop around for the best rates on short-term CDs. However, as the economy continues to recover, interest rates may start to rise, making short-term CDs more attractive to investors. Keep an eye on economic indicators and the Federal Reserve's actions, as they can influence CD rates in the short and long term.
In addition, the rise of online banks and fintech companies has increased competition in the financial sector, which can lead to better CD rates and terms for consumers. Don't limit your search to traditional brick-and-mortar banks; consider exploring online banks and credit unions as well.
Conclusion
Short-term certificates of deposit can be a valuable addition to a beginner investor's portfolio, offering safety, predictability, and flexibility. By understanding the benefits and risks associated with short-term CDs and following our tips for choosing the best options, you can make informed decisions and bolster your investment strategy. Stay aware of current market trends and keep an eye on interest rates to ensure you're making the most of your short-term CD investments.

BIN
plugin.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

View File

View File

@@ -8,4 +8,33 @@ readme = "README.md"
line-length = 88
target-version = ['py310']
include = '\.pyi?$'
extend-exclude = ""
packages = ["autogpt"]
extend-exclude = '.+/(dist|.venv|venv|build)/.+'
[tool.isort]
profile = "black"
multi_line_output = 3
include_trailing_comma = true
force_grid_wrap = 0
use_parentheses = true
ensure_newline_before_comments = true
line_length = 88
sections = [
"FUTURE",
"STDLIB",
"THIRDPARTY",
"FIRSTPARTY",
"LOCALFOLDER"
]
skip = '''
.tox
__pycache__
*.pyc
.env
venv*/*
.venv/*
reports/*
dist/*
'''

View File

@@ -1,27 +0,0 @@
beautifulsoup4
colorama==0.4.6
openai==0.27.2
playsound==1.2.2
python-dotenv==1.0.0
pyyaml==6.0
readability-lxml==0.8.1
requests
tiktoken==0.3.3
gTTS==2.3.1
docker
duckduckgo-search
google-api-python-client #(https://developers.google.com/custom-search/v1/overview)
pinecone-client==2.2.1
redis
orjson
Pillow
selenium
webdriver-manager
coverage
flake8
numpy
pre-commit
black
isort
gitpython==3.1.31
tweepy

View File

@@ -1,4 +1,4 @@
beautifulsoup4
beautifulsoup4>=4.12.2
colorama==0.4.6
openai==0.27.2
playsound==1.2.2
@@ -19,6 +19,9 @@ selenium
webdriver-manager
jsonschema
tweepy
click
spacy>=3.0.0,<4.0.0
en-core-web-sm @ https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-3.5.0/en_core_web_sm-3.5.0-py3-none-any.whl
##Dev
coverage
@@ -26,9 +29,14 @@ flake8
numpy
pre-commit
black
sourcery
isort
gitpython==3.1.31
auto-gpt-plugin-template
# OpenAI and Generic plugins import
openapi-python-client==0.13.4
# Items below this point will not be included in the Docker Image
# Testing dependencies
pytest

0
scripts/__init__.py Normal file
View File

Some files were not shown because too many files have changed in this diff Show More