ppsingh commited on
Commit
7ae21d5
1 Parent(s): 2b7be76

Update auditqa/doc_process.py

Browse files
Files changed (1) hide show
  1. auditqa/doc_process.py +8 -5
auditqa/doc_process.py CHANGED
@@ -6,7 +6,7 @@ from torch import cuda
6
  from langchain_community.document_loaders import PyMuPDFLoader
7
  from langchain_community.embeddings import HuggingFaceEmbeddings, HuggingFaceInferenceAPIEmbeddings
8
  from langchain_community.vectorstores import Qdrant
9
- #from qdrant_client import QdrantClient
10
  from auditqa.reports import files, report_list
11
  device = 'cuda' if cuda.is_available() else 'cpu'
12
 
@@ -93,15 +93,18 @@ def process_pdf():
93
  print("done")
94
  return qdrant_collections
95
 
96
- def get_local_qdrant(client, name):
97
  print(client.get_collections())
 
98
  embeddings = HuggingFaceEmbeddings(
99
  model_kwargs = {'device': device},
100
  encode_kwargs = {'normalize_embeddings': True},
101
  model_name="BAAI/bge-small-en-v1.5")
102
-
103
- vectorstore = Qdrant(client=client, collection_name=name, embeddings=embeddings, )
104
- return vectorstore
 
 
105
 
106
 
107
 
 
6
  from langchain_community.document_loaders import PyMuPDFLoader
7
  from langchain_community.embeddings import HuggingFaceEmbeddings, HuggingFaceInferenceAPIEmbeddings
8
  from langchain_community.vectorstores import Qdrant
9
+ from qdrant_client import QdrantClient
10
  from auditqa.reports import files, report_list
11
  device = 'cuda' if cuda.is_available() else 'cpu'
12
 
 
93
  print("done")
94
  return qdrant_collections
95
 
96
+ def get_local_qdrant():
97
  print(client.get_collections())
98
+ qdrant_collections = {}
99
  embeddings = HuggingFaceEmbeddings(
100
  model_kwargs = {'device': device},
101
  encode_kwargs = {'normalize_embeddings': True},
102
  model_name="BAAI/bge-small-en-v1.5")
103
+ list_ = ['Consolidated','District','Ministry','allreports']
104
+ for val in list_:
105
+ client = QdrantClient(path="./data/{val}")
106
+ qdrant_collections[val] = Qdrant(client=client, collection_name=val, embeddings=embeddings, )
107
+ return qdrant_collections
108
 
109
 
110