sunbal7 commited on
Commit
c2fb213
·
verified ·
1 Parent(s): 9361dc9

Update FAISS index.py

Browse files
Files changed (1) hide show
  1. FAISS index.py +9 -0
FAISS index.py CHANGED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ from langchain_community.vectorstores import FAISS
2
+ from langchain.embeddings import SentenceTransformerEmbeddings
3
+
4
+ embedding_model = SentenceTransformerEmbeddings(model_name="sentence-transformers/all-MiniLM-L6-v2")
5
+ documents = ["Mathematical modeling is used in AI, finance, and physics.", "Differential equations are part of modeling."]
6
+ vectorstore = FAISS.from_texts(documents, embedding_model)
7
+
8
+ # Save FAISS index
9
+ vectorstore.save_local("faiss_index")