import_utils
INSTALL_MAPPING = {'huggingface_hub': 'huggingface-hub', 'pinecone': 'pinecone-client', 'opensearchpy': 'opensearch-py', 'google.generativeai': 'google-generativeai'}
module-attribute
import_optional_dependency(name)
Import an optional dependency.
If a dependency is missing, an ImportError with a nice message will be raised.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
str
|
The module name. |
required |
Returns:
Type | Description |
---|---|
ModuleType
|
The imported module, when found. |
ModuleType
|
None is returned when the package is not found and |
Source code in griptape/utils/import_utils.py
is_dependency_installed(name)
Check if an optional dependency is available.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
str
|
The module name. |
required |
Returns:
Type | Description |
---|---|
bool
|
True if the dependency is available. |
bool
|
False if the dependency is not available. |