Do not load disabled commands (faster exec & benchmark runs) (#5078)

* Use modern material theme for docs

* Do not load disabled commands

* black .

---------

Co-authored-by: lc0rp <2609411+lc0rp@users.noreply.github.com>
pull/3887/head
Luke 2023-07-30 14:51:50 -04:00 committed by GitHub
parent c9bf2ee48d
commit c1567c22f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 34 deletions

View File

@ -26,7 +26,7 @@ def bootstrap_agent(task, continuous_mode) -> Agent:
config.continuous_mode = continuous_mode config.continuous_mode = continuous_mode
config.temperature = 0 config.temperature = 0
config.plain_output = True config.plain_output = True
command_registry = get_command_registry(config) command_registry = CommandRegistry.with_command_modules(COMMAND_CATEGORIES, config)
config.memory_backend = "no_memory" config.memory_backend = "no_memory"
config.workspace_path = Workspace.init_workspace_directory(config) config.workspace_path = Workspace.init_workspace_directory(config)
config.file_logger_path = Workspace.build_file_logger_path(config.workspace_path) config.file_logger_path = Workspace.build_file_logger_path(config.workspace_path)
@ -45,16 +45,6 @@ def bootstrap_agent(task, continuous_mode) -> Agent:
) )
def get_command_registry(config: Config):
command_registry = CommandRegistry()
enabled_command_categories = [
x for x in COMMAND_CATEGORIES if x not in config.disabled_command_categories
]
for command_module in enabled_command_categories:
command_registry.import_command_module(command_module)
return command_registry
if __name__ == "__main__": if __name__ == "__main__":
# The first argument is the script name itself, second is the task # The first argument is the script name itself, second is the task
if len(sys.argv) != 2: if len(sys.argv) != 2:

View File

@ -6,7 +6,7 @@ from colorama import Fore
from autogpt.agents import Agent from autogpt.agents import Agent
from autogpt.app.main import UserFeedback from autogpt.app.main import UserFeedback
from autogpt.commands import COMMAND_CATEGORIES from autogpt.commands import COMMAND_CATEGORIES
from autogpt.config import AIConfig, Config, ConfigBuilder from autogpt.config import AIConfig, ConfigBuilder
from autogpt.logs import logger from autogpt.logs import logger
from autogpt.memory.vector import get_memory from autogpt.memory.vector import get_memory
from autogpt.models.command_registry import CommandRegistry from autogpt.models.command_registry import CommandRegistry
@ -85,7 +85,7 @@ def bootstrap_agent(task, continuous_mode) -> Agent:
config.continuous_mode = continuous_mode config.continuous_mode = continuous_mode
config.temperature = 0 config.temperature = 0
config.plain_output = True config.plain_output = True
command_registry = get_command_registry(config) command_registry = CommandRegistry.with_command_modules(COMMAND_CATEGORIES, config)
config.memory_backend = "no_memory" config.memory_backend = "no_memory"
config.workspace_path = Workspace.init_workspace_directory(config) config.workspace_path = Workspace.init_workspace_directory(config)
config.file_logger_path = Workspace.build_file_logger_path(config.workspace_path) config.file_logger_path = Workspace.build_file_logger_path(config.workspace_path)
@ -102,13 +102,3 @@ def bootstrap_agent(task, continuous_mode) -> Agent:
config=config, config=config,
triggering_prompt=DEFAULT_TRIGGERING_PROMPT, triggering_prompt=DEFAULT_TRIGGERING_PROMPT,
) )
def get_command_registry(config: Config):
command_registry = CommandRegistry()
enabled_command_categories = [
x for x in COMMAND_CATEGORIES if x not in config.disabled_command_categories
]
for command_module in enabled_command_categories:
command_registry.import_command_module(command_module)
return command_registry

View File

@ -22,7 +22,7 @@ def bootstrap_agent(task):
config.continuous_mode = False config.continuous_mode = False
config.temperature = 0 config.temperature = 0
config.plain_output = True config.plain_output = True
command_registry = get_command_registry(config) command_registry = CommandRegistry.with_command_modules(COMMAND_CATEGORIES, config)
config.memory_backend = "no_memory" config.memory_backend = "no_memory"
config.workspace_path = Workspace.init_workspace_directory(config) config.workspace_path = Workspace.init_workspace_directory(config)
config.file_logger_path = Workspace.build_file_logger_path(config.workspace_path) config.file_logger_path = Workspace.build_file_logger_path(config.workspace_path)
@ -39,13 +39,3 @@ def bootstrap_agent(task):
config=config, config=config,
triggering_prompt=DEFAULT_TRIGGERING_PROMPT, triggering_prompt=DEFAULT_TRIGGERING_PROMPT,
) )
def get_command_registry(config: Config):
command_registry = CommandRegistry()
enabled_command_categories = [
x for x in COMMAND_CATEGORIES if x not in config.disabled_command_categories
]
for command_category in enabled_command_categories:
command_registry.import_commands(command_category)
return command_registry