Fix: Solve IndexError when no relevant documents are found in the vector db. (#59)

This commit is contained in:
limbo
2023-07-04 22:18:56 +05:30
committed by GitHub
parent 8987a0c8d9
commit 85008ff153
+3
View File
@@ -181,7 +181,10 @@ class EmbedChain:
n_results=1, n_results=1,
) )
result_formatted = self._format_result(result) result_formatted = self._format_result(result)
if result_formatted:
content = result_formatted[0][0].page_content content = result_formatted[0][0].page_content
else:
content = ""
return content return content
def generate_prompt(self, input_query, context): def generate_prompt(self, input_query, context):