Skip to content

Hypergraph is more powerful. Transform unstructured text into structured knowledge with LLMs. Graphs, hypergraphs, and spatio-temporal extractions — with one command.

fix: raise ValueError from AutoList/AutoModel search when index is missing

dex0shubhamf513a1b460bc
diff --git a/hyperextract/types/list.py b/hyperextract/types/list.py
index aa8c1c3..ca3546b 100644
--- a/hyperextract/types/list.py
+++ b/hyperextract/types/list.py
@@ -292,7 +292,7 @@ class AutoList(BaseAutoType[AutoListSchema[ItemSchema]], Generic[ItemSchema]):
return []
if self._index is None:
- raise Exception("Vector store not initialized")
+ raise ValueError("Index not built. Call build_index() first.")
docs = self._index.similarity_search(query, k=top_k)
results: list[ItemSchema] = []
diff --git a/hyperextract/types/model.py b/hyperextract/types/model.py
index 86f2177..10a7037 100644
--- a/hyperextract/types/model.py
+++ b/hyperextract/types/model.py
@@ -284,7 +284,7 @@ class AutoModel(BaseAutoType[T]):
return []
if self._index is None:
- raise Exception("Index is not built, please build the index first.")
+ raise ValueError("Index not built. Call build_index() first.")
docs = self._index.similarity_search(query, k=top_k)