Juslin Jay commited on
Commit ·
f1afa2b
1
Parent(s): b263f2b
Update utils.py
Browse files- app/utils.py +2 -2
app/utils.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
from llama_index.indices import
|
| 2 |
import os
|
| 3 |
|
| 4 |
def get_index(document_id: str):
|
|
@@ -6,4 +6,4 @@ def get_index(document_id: str):
|
|
| 6 |
if not os.path.exists(index_path):
|
| 7 |
raise ValueError("Index not found for this document.")
|
| 8 |
storage_context = StorageContext.from_defaults(persist_dir=index_path)
|
| 9 |
-
return
|
|
|
|
| 1 |
+
from llama_index.indices import VectorStoreIndex, StorageContext
|
| 2 |
import os
|
| 3 |
|
| 4 |
def get_index(document_id: str):
|
|
|
|
| 6 |
if not os.path.exists(index_path):
|
| 7 |
raise ValueError("Index not found for this document.")
|
| 8 |
storage_context = StorageContext.from_defaults(persist_dir=index_path)
|
| 9 |
+
return VectorStoreIndex.load_from_storage(storage_context)
|