diff --git a/griptape/config/config.py b/griptape/config/config.py index 64f2575dd..5f5dbb5db 100644 --- a/griptape/config/config.py +++ b/griptape/config/config.py @@ -4,6 +4,8 @@ from attrs import define, field +from griptape.utils.decorators import lazy_property + from .base_config import BaseConfig from .drivers.openai_driver_config import OpenAiDriverConfig from .logging.logging_config import LoggingConfig @@ -17,26 +19,13 @@ class _Config(BaseConfig): _logging_config: Optional[LoggingConfig] = field(default=None, alias="logging") _driver_config: Optional[BaseDriverConfig] = field(default=None, alias="drivers") - @property + @lazy_property() def driver_config(self) -> BaseDriverConfig: - """Lazily instantiates the drivers configuration to avoid client errors like missing API key.""" - if self._driver_config is None: - self._driver_config = OpenAiDriverConfig() - return self._driver_config - - @driver_config.setter - def driver_config(self, drivers: BaseDriverConfig) -> None: - self._driver_config = drivers + return OpenAiDriverConfig() - @property + @lazy_property() def logging_config(self) -> LoggingConfig: - if self._logging_config is None: - self._logging_config = LoggingConfig() - return self._logging_config - - @logging_config.setter - def logging_config(self, logging: LoggingConfig) -> None: - self._logging_config = logging + return LoggingConfig() config = _Config()