Arun-AK commited on
Commit
ecef2e4
·
verified ·
1 Parent(s): 13f0f1e

Update pages/2_🧠_context_aware_chatbot.py

Browse files
pages/2_🧠_context_aware_chatbot.py CHANGED
@@ -35,8 +35,16 @@ class ContextChatbot:
35
  # Load documents
36
  documents = []
37
  for path in file_paths:
38
- loader = TextLoader(path)
39
- documents.extend(loader.load())
 
 
 
 
 
 
 
 
40
  text_splitter = RecursiveCharacterTextSplitter(
41
  chunk_size=600, chunk_overlap=50, add_start_index=True
42
  )
 
35
  # Load documents
36
  documents = []
37
  for path in file_paths:
38
+ try:
39
+ loader = TextLoader(path)
40
+ documents.extend(loader.load())
41
+ print(f"Successfully loaded: {path}")
42
+ except Exception as e:
43
+ print(f"Error loading {path}: {e}")
44
+
45
+ # Check if any documents were loaded
46
+ if not documents:
47
+ raise RuntimeError("No documents were loaded. Please check the file paths and file contents.")
48
  text_splitter = RecursiveCharacterTextSplitter(
49
  chunk_size=600, chunk_overlap=50, add_start_index=True
50
  )