Handle missing textual dependencies

This commit is contained in:
Yiorgis Gozadinos 2025-11-20 15:43:01 +02:00
parent 8450c07085
commit 59eba31267
No known key found for this signature in database
3 changed files with 11 additions and 7 deletions

View file

@ -420,7 +420,11 @@ def inspect(
),
):
"""Launch the inspector TUI for browsing documents and chunks."""
from haiku.rag.inspector import run_inspector
try:
from haiku.rag.inspector import run_inspector
except ImportError as e:
typer.echo(f"Error: {e}", err=True)
raise typer.Exit(1) from e
db_path = db if db else get_config().storage.data_dir / "haiku.rag.lancedb"
run_inspector(db_path)

View file

@ -1,3 +1,8 @@
from haiku.rag.inspector.app import run_inspector
try:
from haiku.rag.inspector.app import run_inspector
except ImportError as e:
raise ImportError(
"textual is not installed. Please install it with `pip install 'haiku.rag-slim[inspector]'` or use the full haiku.rag package."
) from e
__all__ = ["run_inspector"]

View file

@ -229,11 +229,6 @@ def run_inspector(db_path: Path | None = None) -> None:
Args:
db_path: Path to the LanceDB database. If None, uses default from config.
"""
if not TEXTUAL_AVAILABLE:
raise ImportError(
"Textual is not installed. Install it with: pip install 'haiku.rag-slim[inspector]'"
)
config = get_config()
if db_path is None:
db_path = config.storage.data_dir / "haiku.rag.lancedb"