Skip to content

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.

fix merge

BillSchumacher7d45de8901d0
diff --git a/autogpt/__main__.py b/autogpt/__main__.py
index 7e8bbc1a31..128f9eea49 100644
--- a/autogpt/__main__.py
+++ b/autogpt/__main__.py
@@ -3,78 +3,3 @@ import autogpt.cli
if __name__ == "__main__":
autogpt.cli.main()
-
-
-"""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.commands.command import CommandRegistry
-from autogpt.config import Config, check_openai_api_key
-from autogpt.logs import logger
-from autogpt.memory import get_memory
-
-from autogpt.prompts.prompt import construct_main_ai_config
-from autogpt.plugins import scan_plugins
-
-
-# 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)
- 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.audio_text")
- command_registry.import_commands("autogpt.commands.evaluate_code")
- 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.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()
diff --git a/autogpt/cli.py b/autogpt/cli.py
index a69a53acc3..aaf1769415 100644
--- a/autogpt/cli.py
+++ b/autogpt/cli.py
@@ -74,13 +74,15 @@ def main(
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.prompt import construct_prompt
+ from autogpt.prompts.prompt import construct_main_ai_config
from autogpt.utils import get_latest_bulletin
-
+ from autogpt.plugins import scan_plugins
if ctx.invoked_subcommand is None:
cfg = Config()
# TODO: fill in llm values here
@@ -105,7 +107,25 @@ def main(
motd = get_latest_bulletin()
if motd:
logger.typewriter_log("NEWS: ", Fore.GREEN, motd)
- system_prompt = construct_prompt()
+
+ 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.audio_text")
+ command_registry.import_commands("autogpt.commands.evaluate_code")
+ 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.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 = []
@@ -122,11 +142,16 @@ def main(
"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,
)