From 0664b737abe1f1017e1b8c3b475c51220b09437c Mon Sep 17 00:00:00 2001 From: Toran Bruce Richards Date: Tue, 18 Apr 2023 18:11:56 +1200 Subject: [PATCH 1/7] Updates sponsors --- README.md | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/README.md b/README.md index 8e5cfe7b299d..dd49f0354c12 100644 --- a/README.md +++ b/README.md @@ -31,18 +31,14 @@ Your support is greatly appreciated Development of this free, open-source project is made possible by all the contributors and sponsors. If you'd like to sponsor this project and have your avatar or company logo appear below click here.

- -

Enterprise Sponsors

InfluxData    Roost.AI    NucleiAI    AlgohashFe    

-

Individual Sponsors

robinicus  prompthero  crizzler  tob-le-rone  FSTatSBS  toverly1  ddtarazona  Nalhos  Kazamario  pingbotan  indoor47  AuroraHolding  kreativai  hunteraraujo  Explorergt92  judegomila   thepok   SpacingLily  merwanehamadi  m  zkonduit  maxxflyer  tekelsey  digisomni  nocodeclarity  tjarmain -Dradstone  CrypteorCapital  avy-ai  shawnharmsen  sunchongren  DailyBotHQ  mathewhawkins  MediConCenHK  kMag410  nicoguyon  Mobivs  jazgarewal  marv-technology  rapidstartup  Brodie0  lucas-chu  rejunity  comet-ml  ColinConwell  cfarquhar  ikarosai  ChrisDMT  Odin519Tomas  vkozacek  belharethsami  sultanmeghji  scryptedinc  johnculkin  RealChrisSean  fruition  jd3655  Web3Capital  allenstecat  tob-le-rone  SwftCoins  MetaPath01  joaomdmoura  ternary5  refinery1  josephcmiller2  webbcolton  tommygeee  lmaugustin  garythebat  Cameron-Fulton  angiaou  caitlynmeeks  MBassi91  Daniel1357  omphos  abhinav-pandey29  DataMetis  concreit  st617  RThaweewat  KiaArmani  Pythagora-io  AryaXAI  fabrietech  jun784  Mr-Bishop42  rickscode  projectonegames  rocks6  GalaxyVideoAgency  thisisjeffchen  TheStoneMX  txtr99  ZERO-A-ONE  

- +Josecodesalot  saten-private  kenndanielso  johnculkin  Daniel1357  0xmatchmaker  belharethsami  nicoguyon  josephcmiller2  KiaArmani  Mobivs  rocks6  Odin519Tomas  ChrisDMT  thisisjeffchen  RealChrisSean  AIdevelopersAI  scryptedinc  jun784  goldenrecursion  allenstecat  LeeRobidas  cfarquhar  avy-ai  omphos  sunchongren  CrazySwami  fruition  Web3Capital  jazgarewal  rejunity  dexterityx  hostdp6  shawnharmsen  tommygeee  abhinav-pandey29  ColinConwell  kMag410  lucas-chu  Heitechsoft  bentoml  MediConCenHK  nnkostov  founderblocks-sils  CarmenCocoa  angiaou  fabrietech  Partender  RThaweewat  GalaxyVideoAgency  Brodie0  sultanmeghji  CatsMeow492  caitlynmeeks  garythebat  concreit  Pythagora-io  ASmithOWL  Cameron-Fulton  joaomdmoura  Dradstone  st617  wenfengwang  morcos  CrypteorCapital  jd3655  mathewhawkins  ZERO-A-ONE  MayurVirkar  SwftCoins  marv-technology  cxs  iddelacruz  AryaXAI  lmaugustin  Mr-Bishop42  vixul-accelerator  TheStoneMX  ciscodebs  ntwrite  DataMetis  ikarosai  refinery1  MetaPath01  ternary5  arjunb023  yx3110  vkozacek  eelbaz  rapidstartup  txtr99  tob-le-rone  neverinstall  projectonegames  DailyBotHQ  comet-ml  rickscode  webbcolton  MBassi91  

## 🚀 Features From 525073bb940b69a6f7dd1adf8f8da0479f5e8730 Mon Sep 17 00:00:00 2001 From: Toran Bruce Richards Date: Tue, 18 Apr 2023 18:46:50 +1200 Subject: [PATCH 2/7] Change on PR to all branches --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0a9a92877902..bb5665ea016d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,7 +6,7 @@ on: - master pull_request: branches: - - master + - '**' jobs: build: From 7ac296081ce3c414b761cda60c5e0e7533eb5229 Mon Sep 17 00:00:00 2001 From: Toran Bruce Richards Date: Tue, 18 Apr 2023 19:11:09 +1200 Subject: [PATCH 3/7] Add pull_request_target to CI trigger --- .github/workflows/ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bb5665ea016d..2eb34b9d61a0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,6 +7,9 @@ on: pull_request: branches: - '**' + pull_request_target: + branches: + - '**' jobs: build: From b5378174f3c0a6d934247b6fd812e9b7b2b610a2 Mon Sep 17 00:00:00 2001 From: 0xArty Date: Tue, 18 Apr 2023 13:19:17 +0100 Subject: [PATCH 4/7] Switched to using click --- README.md | 14 +-- autogpt/__main__.py | 85 ++++++++++++++++-- autogpt/{args.py => configurator.py} | 123 ++++++++++----------------- requirements.txt | 1 + 4 files changed, 135 insertions(+), 88 deletions(-) rename autogpt/{args.py => configurator.py} (52%) diff --git a/README.md b/README.md index dd49f0354c12..4969e5edd45f 100644 --- a/README.md +++ b/README.md @@ -132,11 +132,15 @@ _To execute the following commands, open a CMD, Bash, or Powershell window by na ## 🔧 Usage -1. Run `autogpt` Python module in your terminal - - ``` - python -m autogpt - ``` +1. Run `autogpt` Python module in your terminal. + On linux or mac: + ```bash + # On Linux of Mac: + ./run.sh start + # On Windows: + ./run.bat start + ``` + Running with `--help` after `start` lists all the possible command line arguments you can pass. 2. After each action, choose from options to authorize command(s), exit the program, or provide feedback to the AI. diff --git a/autogpt/__main__.py b/autogpt/__main__.py index 64ed398e0324..0d0ecb37af5b 100644 --- a/autogpt/__main__.py +++ b/autogpt/__main__.py @@ -1,24 +1,95 @@ """Main script for the autogpt package.""" import logging +import click 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.configurator import create_config from autogpt.logs import logger from autogpt.memory import get_memory from autogpt.prompt import construct_prompt -# Load environment variables from .env file - +@click.group() def main() -> None: - """Main function for the script""" + """ + Welcome to AutoGPT an experimental open-source application showcasing the capabilities of the GPT-4 pushing the boundaries of AI. + """ + pass + + +@main.command() +@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.", +) +def start( + 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, +) -> None: + """Start an Auto-GPT assistant""" cfg = Config() # TODO: fill in llm values here check_openai_api_key() - parse_arguments() + create_config( + continuous, + continuous_limit, + ai_settings, + skip_reprompt, + speak, + debug, + gpt3only, + gpt4only, + memory_type, + browser_name, + allow_downloads, + ) logger.set_level(logging.DEBUG if cfg.debug_mode else logging.INFO) ai_name = "" system_prompt = construct_prompt() @@ -35,9 +106,9 @@ def main() -> None: # 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__}" + "Using memory of type:", Fore.GREEN, f"{memory.__class__.__name__}" ) - logger.typewriter_log(f"Using Browser:", Fore.GREEN, cfg.selenium_web_browser) + logger.typewriter_log("Using Browser:", Fore.GREEN, cfg.selenium_web_browser) agent = Agent( ai_name=ai_name, memory=memory, diff --git a/autogpt/args.py b/autogpt/configurator.py similarity index 52% rename from autogpt/args.py rename to autogpt/configurator.py index 5ca4221ccd03..247cdac9161e 100644 --- a/autogpt/args.py +++ b/autogpt/configurator.py @@ -1,6 +1,5 @@ -"""This module contains the argument parsing logic for the script.""" -import argparse - +"""Configurator module.""" +import click from colorama import Back, Fore, Style from autogpt import utils @@ -11,72 +10,44 @@ CFG = Config() -def parse_arguments() -> None: - """Parses the arguments passed to the script +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, +) -> 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 - 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: + if debug: logger.typewriter_log("Debug Mode: ", Fore.GREEN, "ENABLED") CFG.set_debug_mode(True) - if args.continuous: + if continuous: logger.typewriter_log("Continuous Mode: ", Fore.RED, "ENABLED") logger.typewriter_log( "WARNING: ", @@ -87,31 +58,31 @@ def parse_arguments() -> None: ) CFG.set_continuous_mode(True) - if args.continuous_limit: + if continuous_limit: logger.typewriter_log( - "Continuous Limit: ", Fore.GREEN, f"{args.continuous_limit}" + "Continuous Limit: ", Fore.GREEN, f"{continuous_limit}" ) - CFG.set_continuous_limit(args.continuous_limit) + CFG.set_continuous_limit(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 continuous_limit and not continuous: + raise click.UsageError("--continuous-limit can only be used with --continuous") - if args.speak: + if speak: logger.typewriter_log("Speak Mode: ", Fore.GREEN, "ENABLED") CFG.set_speak_mode(True) - if args.gpt3only: + if gpt3only: logger.typewriter_log("GPT3.5 Only Mode: ", Fore.GREEN, "ENABLED") CFG.set_smart_llm_model(CFG.fast_llm_model) - if args.gpt4only: + if gpt4only: logger.typewriter_log("GPT4 Only Mode: ", Fore.GREEN, "ENABLED") CFG.set_fast_llm_model(CFG.smart_llm_model) - if args.memory_type: + if memory_type: supported_memory = get_supported_memory_backends() - chosen = args.memory_type + chosen = memory_type if chosen not in supported_memory: logger.typewriter_log( "ONLY THE FOLLOWING MEMORY BACKENDS ARE SUPPORTED: ", @@ -122,12 +93,12 @@ def parse_arguments() -> None: else: CFG.memory_backend = chosen - if args.skip_reprompt: + if 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 + if ai_settings_file: + file = ai_settings_file # Validate file (validated, message) = utils.validate_yaml_file(file) @@ -140,7 +111,7 @@ def parse_arguments() -> None: CFG.ai_settings_file = file CFG.skip_reprompt = True - if args.allow_downloads: + if allow_downloads: logger.typewriter_log("Native Downloading:", Fore.GREEN, "ENABLED") logger.typewriter_log( "WARNING: ", @@ -155,5 +126,5 @@ def parse_arguments() -> None: ) CFG.allow_downloads = True - if args.browser_name: - CFG.selenium_web_browser = args.browser_name + if browser_name: + CFG.selenium_web_browser = browser_name diff --git a/requirements.txt b/requirements.txt index 3f1eee5b7da3..b4245323e9ce 100644 --- a/requirements.txt +++ b/requirements.txt @@ -19,6 +19,7 @@ selenium webdriver-manager jsonschema tweepy +click ##Dev coverage From fbdf9d4bd434b3fbd1fa377c82e47f4e9e3afcd7 Mon Sep 17 00:00:00 2001 From: EH Date: Tue, 18 Apr 2023 13:21:57 +0100 Subject: [PATCH 5/7] docs: add warning for non-essential contributions (#2359) --- .github/PULL_REQUEST_TEMPLATE.md | 7 +++++++ CONTRIBUTING.md | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index cf7ffbf320f9..a4f28a3d27d6 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,3 +1,10 @@ + +