hackrx / embedder.py
asdfghcwrej6u's picture
Upload 6 files
7de37f7 verified
raw
history blame contribute delete
424 Bytes
from langchain_community.embeddings import HuggingFaceEmbeddings
embedding_model = HuggingFaceEmbeddings(
model_name="BAAI/bge-small-en"
)
def embed_chunks(chunks):
from langchain_community.vectorstores import FAISS
from langchain.docstore.document import Document
docs = [Document(page_content=chunk) for chunk in chunks]
db = FAISS.from_documents(docs, embedding_model)
return db