Skip to content

Commit 022181d

Browse files
akashmangoaifm1320
authored andcommitted
fix
1 parent f44932b commit 022181d

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

adalflow/adalflow/components/retriever/lancedb_retriver.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,13 @@ def retrieve(self, query: Union[str, List[str]], top_k: Optional[int] = None) ->
8282
if isinstance(query, str):
8383
query = [query]
8484

85-
# Embed the query text(s) with Embedder
85+
if not query or (isinstance(query, str) and query.strip() == ""):
86+
raise ValueError("Query cannot be empty.")
87+
88+
# Check if table (index) exists before performing search
89+
if not self.table:
90+
raise ValueError("The index has not been initialized or the table is missing.")
91+
8692
query_embeddings = self.embedder(input=query).data
8793
output: List[RetrieverOutput] = []
8894

0 commit comments

Comments
 (0)