From ad5c2d7253b0547bf9243f1c33a353816625bc39 Mon Sep 17 00:00:00 2001 From: Collin Dutter Date: Thu, 23 May 2024 11:46:32 -0700 Subject: [PATCH] Update error message for optional dependencies --- CHANGELOG.md | 1 + griptape/utils/import_utils.py | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index aaa95e7a5d..218bf62c63 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - Default the value of `azure_deployment` on all Azure Drivers to the model the Driver is using. - Field `azure_ad_token` on all Azure Drivers is no longer serializable. +- Error message to be more helpful when importing optional dependencies. ## [0.25.1] - 2024-05-15 diff --git a/griptape/utils/import_utils.py b/griptape/utils/import_utils.py index dd5b5b68ed..5e00551f84 100644 --- a/griptape/utils/import_utils.py +++ b/griptape/utils/import_utils.py @@ -26,7 +26,10 @@ def import_optional_dependency(name: str) -> Optional[ModuleType]: package_name = INSTALL_MAPPING.get(name) install_name = package_name if package_name is not None else name - msg = f"Missing optional dependency: '{install_name}'. " f"Use poetry or pip to install '{install_name}'." + msg = ( + f"Missing optional dependency: '{install_name}'. " + f"Please install the appropriate extra: https://docs.griptape.ai/stable/griptape-framework/#extras." + ) try: module = import_module(name) except ImportError: