NavyDevilDoc commited on
Commit
4c360e5
·
verified ·
1 Parent(s): 161831e

Update src/rag_engine.py

Browse files
Files changed (1) hide show
  1. src/rag_engine.py +2 -0
src/rag_engine.py CHANGED
@@ -131,6 +131,8 @@ def search_knowledge_base(query, username, k=10, final_k=4):
131
  # Extract just the text for the cross-encoder
132
  candidate_docs = [doc for doc, _ in results]
133
  candidate_texts = [doc.page_content for doc in candidate_docs]
 
 
134
 
135
  # Form pairs: (Query, Document Text)
136
  pairs = [[query, text] for text in candidate_texts]
 
131
  # Extract just the text for the cross-encoder
132
  candidate_docs = [doc for doc, _ in results]
133
  candidate_texts = [doc.page_content for doc in candidate_docs]
134
+ if not candidate_texts:
135
+ return []
136
 
137
  # Form pairs: (Query, Document Text)
138
  pairs = [[query, text] for text in candidate_texts]