Spaces:
Runtime error
Runtime error
Commit Β·
2ea4404
1
Parent(s): 25ef36b
Fix all indentation for vector DB auto-generation in Hugging Face Spaces
Browse files- enhanced_rag_chatbot.py +10 -10
enhanced_rag_chatbot.py
CHANGED
|
@@ -41,18 +41,18 @@ class EnhancedRAGChatbot:
|
|
| 41 |
path=str(VECTOR_DB_DIR),
|
| 42 |
settings=Settings(anonymized_telemetry=False)
|
| 43 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
try:
|
|
|
|
|
|
|
| 45 |
self.collection = self.client.get_collection("rackspace_knowledge")
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
subprocess.run(["python", "enhanced_vector_db.py"], check=True)
|
| 51 |
-
self.collection = self.client.get_collection("rackspace_knowledge")
|
| 52 |
-
print("β
Vector DB rebuilt successfully!")
|
| 53 |
-
except Exception as rebuild_e:
|
| 54 |
-
print("β Failed to rebuild vector DB. Please run 'python enhanced_vector_db.py' manually.")
|
| 55 |
-
self.collection = None
|
| 56 |
|
| 57 |
# Load embedding model (still needed for RAG)
|
| 58 |
print(f"π€ Loading embedding model: {EMBEDDING_MODEL}")
|
|
|
|
| 41 |
path=str(VECTOR_DB_DIR),
|
| 42 |
settings=Settings(anonymized_telemetry=False)
|
| 43 |
)
|
| 44 |
+
try:
|
| 45 |
+
self.collection = self.client.get_collection("rackspace_knowledge")
|
| 46 |
+
except Exception as e:
|
| 47 |
+
print("β Vector DB or collection missing! Attempting to rebuild...")
|
| 48 |
try:
|
| 49 |
+
import subprocess
|
| 50 |
+
subprocess.run(["python", "enhanced_vector_db.py"], check=True)
|
| 51 |
self.collection = self.client.get_collection("rackspace_knowledge")
|
| 52 |
+
print("β
Vector DB rebuilt successfully!")
|
| 53 |
+
except Exception as rebuild_e:
|
| 54 |
+
print("β Failed to rebuild vector DB. Please run 'python enhanced_vector_db.py' manually.")
|
| 55 |
+
self.collection = None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
|
| 57 |
# Load embedding model (still needed for RAG)
|
| 58 |
print(f"π€ Loading embedding model: {EMBEDDING_MODEL}")
|