Open jiveshkalra opened 2 months ago
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:
HuggingFaceTransformersEmbeddings
is compatible with LangChain.js and is correctly installed in your project.HuggingFaceTransformersEmbeddings
correctly implements the EmbeddingsInterface
, especially the embedDocuments
method.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.
Also using Memory Vector store gives me even weirder error ->
ror: (0 , _xenova_transformers__WEBPACK_IMPORTED_MODULE_0__.pipeline) is not a function
Source
app\actions\chatbot_action.jsx (44:46) @ fromDocuments
42 |
43 |
> 44 | const vectorStore = await MemoryVectorStore.fromDocuments(final_posts,new HuggingFaceTransformersEmbeddings({model: "mixedbread-ai/mxbai-embed-large-v1",}));
| ^
in code I just only changed a one word in the code
const vectorStore = await MemoryVectorStore.fromDocuments(final_posts,new HuggingFaceTransformersEmbeddings({model: "mixedbread-ai/mxbai-embed-large-v1",}));```
Checked other resources
Example Code
Error Message and Stack Trace (if applicable)