mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-01-10 07:38:04 -05:00
Remove many env vars and use component-level configuration that could be loaded from file instead. ### Changed - `BaseAgent` provides `serialize_configs` and `deserialize_configs` that can save and load all component configuration as json `str`. Deserialized components/values overwrite existing values, so not all values need to be present in the serialized config. - Decoupled `forge/content_processing/text.py` from `Config` - Kept `execute_local_commands` in `Config` because it's needed to know if OS info should be included in the prompt - Updated docs to reflect changes - Renamed `Config` to `AppConfig` ### Added - Added `ConfigurableComponent` class for components and following configs: - `ActionHistoryConfiguration` - `CodeExecutorConfiguration` - `FileManagerConfiguration` - now file manager allows to have multiple agents using the same workspace - `GitOperationsConfiguration` - `ImageGeneratorConfiguration` - `WebSearchConfiguration` - `WebSeleniumConfiguration` - `BaseConfig` in `forge` and moved `Config` (now inherits from `BaseConfig`) back to `autogpt` - Required `config_class` attribute for the `ConfigurableComponent` class that should be set to configuration class for a component `--component-config-file` CLI option and `COMPONENT_CONFIG_FILE` env var and field in `Config`. This option allows to load configuration from a specific file, CLI option takes precedence over env var. - Added comments to config models ### Removed - Unused `change_agent_id` method from `FileManagerComponent` - Unused `allow_downloads` from `Config` and CLI options (it should be in web component config if needed) - CLI option `--browser-name` (the option is inside `WebSeleniumConfiguration`) - Unused `workspace_directory` from CLI options - No longer needed variables from `Config` and docs - Unused fields from `Config`: `image_size`, `audio_to_text_provider`, `huggingface_audio_to_text_model` - Removed `files` and `workspace` class attributes from `FileManagerComponent`
51 lines
1.4 KiB
Python
51 lines
1.4 KiB
Python
from pathlib import Path
|
|
|
|
import pytest
|
|
from forge.config.ai_profile import AIProfile
|
|
from forge.file_storage import FileStorageBackendName, get_storage
|
|
from forge.llm.providers import MultiProvider
|
|
|
|
from autogpt.agents.agent import Agent, AgentConfiguration, AgentSettings
|
|
from autogpt.app.config import AppConfig
|
|
|
|
|
|
@pytest.fixture
|
|
def dummy_agent(config: AppConfig, llm_provider: MultiProvider):
|
|
ai_profile = AIProfile(
|
|
ai_name="Dummy Agent",
|
|
ai_role="Dummy Role",
|
|
ai_goals=[
|
|
"Dummy Task",
|
|
],
|
|
)
|
|
|
|
agent_settings = AgentSettings(
|
|
name=Agent.default_settings.name,
|
|
description=Agent.default_settings.description,
|
|
ai_profile=ai_profile,
|
|
config=AgentConfiguration(
|
|
fast_llm=config.fast_llm,
|
|
smart_llm=config.smart_llm,
|
|
use_functions_api=config.openai_functions,
|
|
),
|
|
history=Agent.default_settings.history.copy(deep=True),
|
|
)
|
|
|
|
local = config.file_storage_backend == FileStorageBackendName.LOCAL
|
|
restrict_to_root = not local or config.restrict_to_workspace
|
|
file_storage = get_storage(
|
|
config.file_storage_backend,
|
|
root_path=Path("data"),
|
|
restrict_to_root=restrict_to_root,
|
|
)
|
|
file_storage.initialize()
|
|
|
|
agent = Agent(
|
|
settings=agent_settings,
|
|
llm_provider=llm_provider,
|
|
file_storage=file_storage,
|
|
app_config=config,
|
|
)
|
|
|
|
return agent
|