Skip to content

Conversation

@mikhael-remboski
Copy link

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 reconstruct method to the base class IndexBase, enabling retrieval of the stored vector at a specified key, with validation and error handling. (src/faiss.cc)

  • Exposed the reconstruct method as an instance method on the Index, IndexFlatL2, and IndexFlatIP classes, making it available in the JavaScript API. (src/faiss.cc) [1] [2] [3]

Testing

  • Added a new test suite reconstruct.test.js to verify correct reconstruction of vectors, handling of invalid keys, and compatibility with both IndexFlatL2 and Index classes. (test/reconstruct.test.js)

@asilvas
Copy link
Contributor

asilvas commented Aug 19, 2025

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

@mikhael-remboski
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants