How to load precomputed embeddings to FAISS from langchain

293 Views Asked by At

I am trying to read precomputed embeddings(i.e. simple vectors) into a FAISS vectorstore. As seen in the github repo of FAISS I build an index like this and add vectors to it:

import faiss                   # make faiss available
index = faiss.IndexFlatL2(d)   # build the index
index.add(xb)                  # add vectors to the index

How can I do the same with FAISS from langchain (i.e. langchain_community.vectorstores) or is there any other way I could do this and interact with langchain in a frictionless way compared to using faiss directly?

0

There are 0 best solutions below