Subha95 commited on
Commit
e230469
·
verified ·
1 Parent(s): ef19d3c

Update chatbot_rag.py

Browse files
Files changed (1) hide show
  1. chatbot_rag.py +3 -1
chatbot_rag.py CHANGED
@@ -95,7 +95,9 @@ def build_qa():
95
 
96
  # 6. Helper functions
97
  def format_docs(docs):
98
- return "\n".join(doc.page_content for doc in docs)
 
 
99
 
100
  def hf_to_str(x):
101
  """Convert Hugging Face pipeline output to clean plain text."""
 
95
 
96
  # 6. Helper functions
97
  def format_docs(docs):
98
+ # skip any docs where page_content is None
99
+ return "\n".join(d.page_content for d in docs if d.page_content)
100
+
101
 
102
  def hf_to_str(x):
103
  """Convert Hugging Face pipeline output to clean plain text."""