You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The error you're encountering, "Cannot read properties of undefined (reading 'embedDocuments')", indicates that the HuggingFaceTransformersEmbeddings object you're passing to HNSWLib.fromTexts might not be correctly instantiated or does not have the embedDocuments method defined. This method is essential for converting texts to vectors, which are then added to the HNSW index.
To resolve this issue, ensure that HuggingFaceTransformersEmbeddings is properly implemented and instantiated. It should adhere to the EmbeddingsInterface, which requires an embedDocuments method that takes an array of documents as input and returns a promise resolving to an array of vectors for each document.
Here's a quick checklist:
Verify that HuggingFaceTransformersEmbeddings is compatible with LangChain.js and is correctly installed in your project.
Ensure that HuggingFaceTransformersEmbeddings correctly implements the EmbeddingsInterface, especially the embedDocuments method.
Double-check the instantiation of HuggingFaceTransformersEmbeddings before passing it to HNSWLib.fromTexts.
If after these checks the issue persists, it might be helpful to review the documentation or source code of HuggingFaceTransformersEmbeddings to ensure it's being used as intended.
Checked other resources
Example Code
Error Message and Stack Trace (if applicable)
The text was updated successfully, but these errors were encountered: