The second parameter of the FAISS.from_embeddings is an Embeddings object that is in charge of the embedding. If you want to use your own function, you could wrap it inside a class inheriting from the Embbedings abstract class (cf. this page and the linked source code)