Skip to content

Commit

Permalink
fixes #29193 | handles case for no documents
Browse files Browse the repository at this point in the history
  • Loading branch information
prady00 committed Jan 14, 2025
1 parent c55af44 commit 328808e
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"metadata": {},
"outputs": [
{
"name": "stdin",
"name": "stdout",
"output_type": "stream",
"text": [
"OPENAI_API_KEY: ········\n",
Expand Down Expand Up @@ -182,7 +182,10 @@
" documents = recall_vector_store.similarity_search(\n",
" query, k=3, filter=_filter_function\n",
" )\n",
" return [document.page_content for document in documents]"
" if not documents:\n",
" return []\n",
" else:\n",
" return [document.page_content for document in documents]"
]
},
{
Expand Down

0 comments on commit 328808e

Please sign in to comment.