mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-05 02:31:47 +00:00
Add helpful ImportError messages for optional dependencies
When optional dependencies are missing, raise ImportError with installation instructions pointing to the relevant extras group (e.g. `[messaging]`, `[cli]`, `[mcp]`, etc.) instead of letting the import fail silently.
This commit is contained in:
parent
79a5f03f92
commit
2df306e6cd
9 changed files with 81 additions and 14 deletions
|
|
@ -318,7 +318,13 @@ def _resize_image_for_vision(image_path: Path, mime_type: Optional[str] = None,
|
|||
else:
|
||||
data_url = None # defer full encode; try Pillow resize first
|
||||
|
||||
from PIL import Image
|
||||
try:
|
||||
from PIL import Image
|
||||
except ImportError:
|
||||
raise ImportError(
|
||||
"Pillow is required for image resizing. "
|
||||
"Install with: pip install hermes-agent[cli]"
|
||||
) from None
|
||||
import io as _io
|
||||
|
||||
logger.info("Image file is %.1f MB (estimated base64 %.1f MB, limit %.1f MB), auto-resizing...",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue