aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Reinier van der Leer <pwuts@agpt.co> 2023-12-08 14:13:32 +0100
committerGravatar Reinier van der Leer <pwuts@agpt.co> 2023-12-08 14:13:59 +0100
commit2d4e16d5e1baba98d72e313bf6c4f71fbafe53a1 (patch)
tree6af8ee1d42dcfed74cf735e0a2ab4faeb33d2f66
parentfeat(agent/serve): Add StepID header to outgoing LLM requests (diff)
downloadAuto-GPT-2d4e16d5e1baba98d72e313bf6c4f71fbafe53a1.tar.gz
Auto-GPT-2d4e16d5e1baba98d72e313bf6c4f71fbafe53a1.tar.bz2
Auto-GPT-2d4e16d5e1baba98d72e313bf6c4f71fbafe53a1.zip
fix(agent): Fix type issues with agent ID and apply_overrides_to_ai_settings
- Fix type annotation for `agent_id` in `BaseAgentSettings` class - Add assertion to ensure `agent_id` is not an empty string in `AgentManager.get_agent_dir()` method - Change type of `override_name` and `override_role` to be optional in `apply_overrides_to_ai_settings()` function
-rw-r--r--autogpts/autogpt/autogpt/agent_manager/agent_manager.py1
-rw-r--r--autogpts/autogpt/autogpt/agents/base.py2
-rw-r--r--autogpts/autogpt/autogpt/app/setup.py4
3 files changed, 4 insertions, 3 deletions
diff --git a/autogpts/autogpt/autogpt/agent_manager/agent_manager.py b/autogpts/autogpt/autogpt/agent_manager/agent_manager.py
index dc3bc6461..0b4731bc6 100644
--- a/autogpts/autogpt/autogpt/agent_manager/agent_manager.py
+++ b/autogpts/autogpt/autogpt/agent_manager/agent_manager.py
@@ -29,6 +29,7 @@ class AgentManager:
]
def get_agent_dir(self, agent_id: str, must_exist: bool = False) -> Path:
+ assert len(agent_id) > 0
agent_dir = self.agents_dir / agent_id
if must_exist and not agent_dir.exists():
raise FileNotFoundError(f"No agent with ID '{agent_id}'")
diff --git a/autogpts/autogpt/autogpt/agents/base.py b/autogpts/autogpt/autogpt/agents/base.py
index 062149edd..7c34d40ad 100644
--- a/autogpts/autogpt/autogpt/agents/base.py
+++ b/autogpts/autogpt/autogpt/agents/base.py
@@ -124,7 +124,7 @@ class BaseAgentConfiguration(SystemConfiguration):
class BaseAgentSettings(SystemSettings):
- agent_id: Optional[str] = None
+ agent_id: str = ""
agent_data_dir: Optional[Path] = None
ai_profile: AIProfile = Field(default_factory=lambda: AIProfile(ai_name="AutoGPT"))
diff --git a/autogpts/autogpt/autogpt/app/setup.py b/autogpts/autogpt/autogpt/app/setup.py
index ab41afa3c..8a271d26f 100644
--- a/autogpts/autogpt/autogpt/app/setup.py
+++ b/autogpts/autogpt/autogpt/app/setup.py
@@ -12,8 +12,8 @@ logger = logging.getLogger(__name__)
def apply_overrides_to_ai_settings(
ai_profile: AIProfile,
directives: AIDirectives,
- override_name: str = "",
- override_role: str = "",
+ override_name: Optional[str] = "",
+ override_role: Optional[str] = "",
replace_directives: bool = False,
resources: Optional[list[str]] = None,
constraints: Optional[list[str]] = None,