From c0de22c9cd5b55f661cd9abaff34cc6a6a90f97a Mon Sep 17 00:00:00 2001 From: Yiorgis Gozadinos Date: Tue, 23 Sep 2025 12:34:32 +0300 Subject: [PATCH] Show package versions --- docs/cli.md | 6 +++++- src/haiku/rag/app.py | 24 +++++++++++++++++------- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/docs/cli.md b/docs/cli.md index 5e77be17..7442cc14 100644 --- a/docs/cli.md +++ b/docs/cli.md @@ -138,9 +138,13 @@ Shows: - path to the database - stored haiku.rag version (from settings) - embeddings provider/model and vector dimension -- LanceDB version - number of documents +At the end, a separate “Versions” section lists runtime package versions: +- haiku.rag +- lancedb +- docling + ### Vacuum (Optimize and Cleanup) Reduce disk usage by optimizing and pruning old table versions across all tables: diff --git a/src/haiku/rag/app.py b/src/haiku/rag/app.py index c292ede6..cd89d0d8 100644 --- a/src/haiku/rag/app.py +++ b/src/haiku/rag/app.py @@ -38,9 +38,6 @@ class HaikuRAGApp: f" [repr.attrib_name]path[/repr.attrib_name]: {self.db_path}" ) - # Prevent accidental creation: require existing local path - # (For cloud/object storage users, info should be invoked with proper env vars and - # an existing local cache/path if applicable.) if not self.db_path.exists(): self.console.print("[red]Database path does not exist.[/red]") return @@ -53,11 +50,18 @@ class HaikuRAGApp: self.console.print(f"[red]Failed to open database: {e}[/red]") return - # Resolve LanceDB version (best-effort) try: ldb_version = pkg_version("lancedb") except Exception: ldb_version = "unknown" + try: + hr_version = pkg_version("haiku.rag") + except Exception: + hr_version = "unknown" + try: + docling_version = pkg_version("docling") + except Exception: + docling_version = "unknown" # Read settings (if present) to find stored haiku.rag version and embedding config stored_version = "unknown" @@ -81,13 +85,11 @@ class HaikuRAGApp: else None ) - # Count documents efficiently (best-effort, avoiding full scans) num_docs = 0 if "documents" in table_names: docs_tbl = db.open_table("documents") num_docs = int(docs_tbl.count_rows()) # type: ignore[attr-defined] - # Render collected info self.console.print( f" [repr.attrib_name]haiku.rag version (db)[/repr.attrib_name]: {stored_version}" ) @@ -103,11 +105,19 @@ class HaikuRAGApp: self.console.print( " [repr.attrib_name]embeddings[/repr.attrib_name]: unknown" ) + self.console.print( + f" [repr.attrib_name]documents[/repr.attrib_name]: {num_docs}" + ) + self.console.rule() + self.console.print("[bold]Versions[/bold]") + self.console.print( + f" [repr.attrib_name]haiku.rag[/repr.attrib_name]: {hr_version}" + ) self.console.print( f" [repr.attrib_name]lancedb[/repr.attrib_name]: {ldb_version}" ) self.console.print( - f" [repr.attrib_name]documents[/repr.attrib_name]: {num_docs}" + f" [repr.attrib_name]docling[/repr.attrib_name]: {docling_version}" ) async def list_documents(self):