Jalajk commited on
Commit
46c6b31
1 Parent(s): ebff52c

Update Index.py

Browse files
Files changed (1) hide show
  1. Index.py +4 -4
Index.py CHANGED
@@ -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"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"index/{domain}",
171
  db_present=bool_value,
172
  )
173
  # print("Final - output : ", max_index)
@@ -193,7 +193,7 @@ def _load_embeddings_from_db(
193
  embeddings.load("index") # change this later
194
  else:
195
  print(3)
196
- embeddings.load(f"index/{domain}")
197
  return embeddings
198
 
199
 
@@ -221,7 +221,7 @@ def _search(query, extractor, question=None):
221
 
222
  @app.get("/rag")
223
  def rag(domain: str, question: str):
224
- db_exists = _check_if_db_exists(db_path=f"{os.getcwd()}\index\{domain}\documents")
225
  print(db_exists)
226
  # if db_exists:
227
  embeddings = _load_embeddings_from_db(db_exists, domain)
 
157
  max_index = _upsert_docs(
158
  doc=doc,
159
  embeddings=embeddings,
160
+ vector_doc_path=f"{os.getcwd()}/index/{domain}/documents",
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}/documents",
171
  db_present=bool_value,
172
  )
173
  # print("Final - output : ", max_index)
 
193
  embeddings.load("index") # change this later
194
  else:
195
  print(3)
196
+ embeddings.load(f"{os.getcwd()}/index/{domain}/documents")
197
  return embeddings
198
 
199
 
 
221
 
222
  @app.get("/rag")
223
  def rag(domain: str, question: str):
224
+ db_exists = _check_if_db_exists(db_path=f"{os.getcwd()}/index/{domain}/documents")
225
  print(db_exists)
226
  # if db_exists:
227
  embeddings = _load_embeddings_from_db(db_exists, domain)