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.

Refactor/move singleton out of config module (#3161)

James Collinsdfcbf6eee64f
diff --git a/.gitignore b/.gitignore
index 1ac55f6b93..816cdb0c8f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -20,6 +20,7 @@ log-ingestion.txt
logs
*.log
*.mp3
+mem.sqlite3
# Byte-compiled / optimized / DLL files
__pycache__/
diff --git a/autogpt/agent/agent_manager.py b/autogpt/agent/agent_manager.py
index 9a62ef61ec..257127a303 100644
--- a/autogpt/agent/agent_manager.py
+++ b/autogpt/agent/agent_manager.py
@@ -1,10 +1,11 @@
"""Agent manager for managing GPT agents"""
from __future__ import annotations
-from typing import List, Union
+from typing import List
-from autogpt.config.config import Config, Singleton
+from autogpt.config.config import Config
from autogpt.llm_utils import create_chat_completion
+from autogpt.singleton import Singleton
from autogpt.types.openai import Message
diff --git a/autogpt/config/__init__.py b/autogpt/config/__init__.py
index 726b6dcf3d..9bdd98e215 100644
--- a/autogpt/config/__init__.py
+++ b/autogpt/config/__init__.py
@@ -3,12 +3,9 @@ This module contains the configuration classes for AutoGPT.
"""
from autogpt.config.ai_config import AIConfig
from autogpt.config.config import Config, check_openai_api_key
-from autogpt.config.singleton import AbstractSingleton, Singleton
__all__ = [
"check_openai_api_key",
- "AbstractSingleton",
"AIConfig",
"Config",
- "Singleton",
]
diff --git a/autogpt/config/config.py b/autogpt/config/config.py
index 600c31041b..101f2919f3 100644
--- a/autogpt/config/config.py
+++ b/autogpt/config/config.py
@@ -8,7 +8,7 @@ from auto_gpt_plugin_template import AutoGPTPluginTemplate
from colorama import Fore
from dotenv import load_dotenv
-from autogpt.config.singleton import Singleton
+from autogpt.singleton import Singleton
load_dotenv(verbose=True, override=True)
diff --git a/autogpt/logs.py b/autogpt/logs.py
index 35037404a9..9d66193326 100644
--- a/autogpt/logs.py
+++ b/autogpt/logs.py
@@ -10,7 +10,8 @@ from logging import LogRecord
from colorama import Fore, Style
-from autogpt.config import Config, Singleton
+from autogpt.config import Config
+from autogpt.singleton import Singleton
from autogpt.speech import say_text
CFG = Config()
diff --git a/autogpt/memory/base.py b/autogpt/memory/base.py
index b625246403..83d807506a 100644
--- a/autogpt/memory/base.py
+++ b/autogpt/memory/base.py
@@ -1,7 +1,8 @@
"""Base class for memory providers."""
import abc
-from autogpt.config import AbstractSingleton, Config
+from autogpt.config import Config
+from autogpt.singleton import AbstractSingleton
cfg = Config()
diff --git a/autogpt/config/singleton.py b/autogpt/singleton.py
similarity index 100%
rename from autogpt/config/singleton.py
rename to autogpt/singleton.py
diff --git a/autogpt/speech/base.py b/autogpt/speech/base.py
index d74fa51be7..7adcc37d54 100644
--- a/autogpt/speech/base.py
+++ b/autogpt/speech/base.py
@@ -2,7 +2,7 @@
import abc
from threading import Lock
-from autogpt.config import AbstractSingleton
+from autogpt.singleton import AbstractSingleton
class VoiceBase(AbstractSingleton):