Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -90,6 +90,33 @@ for _, row in df.iterrows():
|
|
| 90 |
case_docs.append(Document(text=text, metadata=meta))
|
| 91 |
logger.info(f"Loaded {len(case_docs)} documents from {CSV_PATH}.")
|
| 92 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 93 |
# --- CELL 4: Load prebuilt Vector Index ---
|
| 94 |
vector_store = QdrantVectorStore(
|
| 95 |
client=qdrant,
|
|
|
|
| 90 |
case_docs.append(Document(text=text, metadata=meta))
|
| 91 |
logger.info(f"Loaded {len(case_docs)} documents from {CSV_PATH}.")
|
| 92 |
|
| 93 |
+
# --- ADD THIS CODE SNIPPET ---
|
| 94 |
+
|
| 95 |
+
# Define and configure the embedding model
|
| 96 |
+
EMBED_MODEL_ID = "BAAI/bge-small-en-v1.5"
|
| 97 |
+
embed_model = HuggingFaceEmbedding(
|
| 98 |
+
model_name=EMBED_MODEL_ID
|
| 99 |
+
)
|
| 100 |
+
|
| 101 |
+
# Set the global embedding model for Llama-Index
|
| 102 |
+
Settings.embed_model = embed_model
|
| 103 |
+
logger.info(f"✅ Set global embedding model to {EMBED_MODEL_ID}")
|
| 104 |
+
|
| 105 |
+
# --- END OF SNIPPET ---
|
| 106 |
+
|
| 107 |
+
# --- CELL 4: Load prebuilt Vector Index ---
|
| 108 |
+
vector_store = QdrantVectorStore(
|
| 109 |
+
client=qdrant,
|
| 110 |
+
collection_name=COLLECTION_NAME,
|
| 111 |
+
prefer_grpc=False
|
| 112 |
+
)
|
| 113 |
+
storage_context = StorageContext.from_defaults(vector_store=vector_store)
|
| 114 |
+
|
| 115 |
+
# This line is now fixed to use the correct API method
|
| 116 |
+
index = VectorStoreIndex.from_vector_store(vector_store=vector_store)
|
| 117 |
+
logger.info("✅ Loaded existing VectorStoreIndex from Qdrant")
|
| 118 |
+
|
| 119 |
+
|
| 120 |
# --- CELL 4: Load prebuilt Vector Index ---
|
| 121 |
vector_store = QdrantVectorStore(
|
| 122 |
client=qdrant,
|