utkarsh134 commited on
Commit
3164405
·
verified ·
1 Parent(s): 63e6fc9

Update core/vector_store.py

Browse files
Files changed (1) hide show
  1. core/vector_store.py +4 -12
core/vector_store.py CHANGED
@@ -1,8 +1,7 @@
1
  import os
2
  from langchain_google_genai import GoogleGenerativeAIEmbeddings
3
- from langchain_community.vectorstores import Chroma
4
- from langchain_core.documents import Document
5
- from chromadb.config import Settings
6
 
7
  def create_or_load_vectorstore(text_chunks):
8
  embeddings = GoogleGenerativeAIEmbeddings(
@@ -14,15 +13,9 @@ def create_or_load_vectorstore(text_chunks):
14
  for chunk in text_chunks
15
  ]
16
 
17
- vectorstore = Chroma.from_documents(
18
  documents=documents,
19
- embedding=embeddings,
20
- collection_name=f"resume_{os.getpid()}_{id(documents)}",
21
- client_settings=Settings(
22
- anonymized_telemetry=False,
23
- is_persistent=False,
24
- chroma_db_impl="duckdb+parquet",
25
- )
26
  )
27
 
28
  return vectorstore
@@ -34,5 +27,4 @@ def similarity_search(vectorstore, query, k=5):
34
  return documents
35
  except Exception as e:
36
  print(f"Error in similarity search: {str(e)}")
37
-
38
  return []
 
1
  import os
2
  from langchain_google_genai import GoogleGenerativeAIEmbeddings
3
+ from langchain_community.vectorstores import FAISS
4
+ from langchain.docstore.document import Document
 
5
 
6
  def create_or_load_vectorstore(text_chunks):
7
  embeddings = GoogleGenerativeAIEmbeddings(
 
13
  for chunk in text_chunks
14
  ]
15
 
16
+ vectorstore = FAISS.from_documents(
17
  documents=documents,
18
+ embedding=embeddings
 
 
 
 
 
 
19
  )
20
 
21
  return vectorstore
 
27
  return documents
28
  except Exception as e:
29
  print(f"Error in similarity search: {str(e)}")
 
30
  return []