LexGuardian / FAISS index.py
sunbal7's picture
Update FAISS index.py
c2fb213 verified
raw
history blame
456 Bytes
from langchain_community.vectorstores import FAISS
from langchain.embeddings import SentenceTransformerEmbeddings
embedding_model = SentenceTransformerEmbeddings(model_name="sentence-transformers/all-MiniLM-L6-v2")
documents = ["Mathematical modeling is used in AI, finance, and physics.", "Differential equations are part of modeling."]
vectorstore = FAISS.from_texts(documents, embedding_model)
# Save FAISS index
vectorstore.save_local("faiss_index")