ppsingh commited on
Commit
5323bc1
·
verified ·
1 Parent(s): a90749d

Update appStore/embed.py

Browse files
Files changed (1) hide show
  1. appStore/embed.py +18 -1
appStore/embed.py CHANGED
@@ -29,4 +29,21 @@ def hybrid_embed_chunks(chunks):
29
  )
30
 
31
  print(qdrant_collections)
32
- print("vector embeddings done")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
  )
30
 
31
  print(qdrant_collections)
32
+ print("vector embeddings done")
33
+
34
+ @st.cache_resource
35
+ def get_local_qdrant(collection_name):
36
+ """once the local qdrant server is created this is used to make the connection to exisitng server"""
37
+
38
+ qdrant_collections = {}
39
+ embeddings = HuggingFaceEmbeddings(
40
+ model_kwargs = {'device': device},
41
+ encode_kwargs = {'normalize_embeddings': True},
42
+ model_name='BAAI/bge-m3')
43
+ client = QdrantClient(path="/data/local_qdrant")
44
+ sparse_embeddings = FastEmbedSparse(model_name="Qdrant/bm25")
45
+ print("Collections in local Qdrant:",client.get_collections())
46
+ qdrant_collections[collection_name] = Qdrant(client=client, collection_name=collection_name,
47
+ embeddings=embeddings, sparse_embeddings = sparse_embeddings,
48
+ )
49
+ return qdrant_collections