From 328808ef6c6f81d1ef8b60ee6d4e4c478ca00fff Mon Sep 17 00:00:00 2001 From: Pradeep Kumar Date: Tue, 14 Jan 2025 11:19:50 +0000 Subject: [PATCH] fixes #29193 | handles case for no documents --- .../versions/migrating_memory/long_term_memory_agent.ipynb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/docs/docs/versions/migrating_memory/long_term_memory_agent.ipynb b/docs/docs/versions/migrating_memory/long_term_memory_agent.ipynb index 8ab6f7be5fc61..eb5efff4ebd01 100644 --- a/docs/docs/versions/migrating_memory/long_term_memory_agent.ipynb +++ b/docs/docs/versions/migrating_memory/long_term_memory_agent.ipynb @@ -52,7 +52,7 @@ "metadata": {}, "outputs": [ { - "name": "stdin", + "name": "stdout", "output_type": "stream", "text": [ "OPENAI_API_KEY: ········\n", @@ -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]" ] }, {