mistral_common.imports
assert_hf_hub_installed()
cached
Raise ImportError if the dependency is missing, with an install hint.
assert_jinja2_installed()
cached
Raise ImportError if the dependency is missing, with an install hint.
assert_llguidance_installed()
cached
Raise ImportError if the dependency is missing, with an install hint.
assert_opencv_installed()
cached
Raise ImportError if the dependency is missing, with an install hint.
assert_package_installed(package_name, error_message=None)
Raise ImportError if the package is not importable.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
package_name
|
str
|
The package to check. |
required |
error_message
|
str | None
|
Custom error message. If |
None
|
Raises:
| Type | Description |
|---|---|
ImportError
|
If the package is not installed. |
Source code in src/mistral_common/imports.py
assert_sentencepiece_installed()
cached
Raise ImportError if the dependency is missing, with an install hint.
Source code in src/mistral_common/imports.py
assert_soundfile_installed()
cached
Raise ImportError if the dependency is missing, with an install hint.
assert_soxr_installed()
cached
Raise ImportError if the dependency is missing, with an install hint.
is_hf_hub_installed()
cached
is_jinja2_installed()
cached
is_llguidance_installed()
cached
is_opencv_installed()
cached
Check whether the cv2 package is importable.
Broken cv2 installs that raise on import are treated as not installed; a warning is logged instead.
Returns:
| Type | Description |
|---|---|
bool
|
True if |
Source code in src/mistral_common/imports.py
is_package_installed(package_name)
Check whether a package is importable in the current environment.