feat: add reconstruct method
This pull request adds a new reconstruct method to the FAISS index classes, allowing users to retrieve the original vector for a given index key. It also exposes this method to the JavaScript API and provides tests to verify its correctness and error handling.
New API feature: Vector reconstruction
-
Added a
reconstructmethod to the base classIndexBase, enabling retrieval of the stored vector at a specified key, with validation and error handling. (src/faiss.cc) -
Exposed the
reconstructmethod as an instance method on theIndex,IndexFlatL2, andIndexFlatIPclasses, making it available in the JavaScript API. (src/faiss.cc) [1] [2] [3]
Testing
- Added a new test suite
reconstruct.test.jsto verify correct reconstruction of vectors, handling of invalid keys, and compatibility with bothIndexFlatL2andIndexclasses. (test/reconstruct.test.js)
If this doesn't get merged feel free to use the maintained fork. https://github.com/asilvas/faiss-node/blob/main/README.md?plain=1#L94-L96
If this doesn't get merged feel free to use the maintained fork. https://github.com/asilvas/faiss-node/blob/main/README.md?plain=1#L94-L96
Thank you, i will