Spaces:
Sleeping
Sleeping
Update Index.py
Browse files
Index.py
CHANGED
@@ -96,7 +96,7 @@ def _upsert_docs(doc, embeddings, vector_doc_path: str, db_present: bool):
|
|
96 |
print(vector_doc_path)
|
97 |
if db_present:
|
98 |
print(1)
|
99 |
-
max_index = _max_index_id(f"{vector_doc_path}
|
100 |
print(max_index)
|
101 |
embeddings.upsert(_stream(doc, 500, max_index["max_index"]))
|
102 |
print("Embeddings done!!")
|
@@ -106,7 +106,7 @@ def _upsert_docs(doc, embeddings, vector_doc_path: str, db_present: bool):
|
|
106 |
print(2)
|
107 |
embeddings.index(_stream(doc, 500, 0))
|
108 |
embeddings.save(vector_doc_path)
|
109 |
-
max_index = _max_index_id(f"{vector_doc_path}
|
110 |
print(max_index)
|
111 |
# check
|
112 |
# max_index = _max_index_id(f"{vector_doc_path}/documents")
|
@@ -157,7 +157,7 @@ def get_domain_file_path(domain: str, file_path: str):
|
|
157 |
max_index = _upsert_docs(
|
158 |
doc=doc,
|
159 |
embeddings=embeddings,
|
160 |
-
vector_doc_path=f"{os.getcwd()}/index/{domain}
|
161 |
db_present=bool_value,
|
162 |
)
|
163 |
# print("-------")
|
@@ -167,7 +167,7 @@ def get_domain_file_path(domain: str, file_path: str):
|
|
167 |
max_index = _upsert_docs(
|
168 |
doc=doc,
|
169 |
embeddings=embeddings,
|
170 |
-
vector_doc_path=f"{os.getcwd()}/index/{domain}
|
171 |
db_present=bool_value,
|
172 |
)
|
173 |
# print("Final - output : ", max_index)
|
|
|
96 |
print(vector_doc_path)
|
97 |
if db_present:
|
98 |
print(1)
|
99 |
+
max_index = _max_index_id(f"{vector_doc_path}")
|
100 |
print(max_index)
|
101 |
embeddings.upsert(_stream(doc, 500, max_index["max_index"]))
|
102 |
print("Embeddings done!!")
|
|
|
106 |
print(2)
|
107 |
embeddings.index(_stream(doc, 500, 0))
|
108 |
embeddings.save(vector_doc_path)
|
109 |
+
max_index = _max_index_id(f"{vector_doc_path}")
|
110 |
print(max_index)
|
111 |
# check
|
112 |
# max_index = _max_index_id(f"{vector_doc_path}/documents")
|
|
|
157 |
max_index = _upsert_docs(
|
158 |
doc=doc,
|
159 |
embeddings=embeddings,
|
160 |
+
vector_doc_path=f"{os.getcwd()}/index/{domain}",
|
161 |
db_present=bool_value,
|
162 |
)
|
163 |
# print("-------")
|
|
|
167 |
max_index = _upsert_docs(
|
168 |
doc=doc,
|
169 |
embeddings=embeddings,
|
170 |
+
vector_doc_path=f"{os.getcwd()}/index/{domain}",
|
171 |
db_present=bool_value,
|
172 |
)
|
173 |
# print("Final - output : ", max_index)
|