Open clemenspeters opened 1 year ago
I have the exact same issues and i'm on a mac m1 pro.
Does not work on Azure :(
Had this error on my Electron project, got it fixed it with import change:
static async imports() { try {
const HierarchicalNSW = require('hnswlib-node').HierarchicalNSW;
return { HierarchicalNSW };
}
catch (err) {
throw new Error(err);
}
}
Doesn't work on AWS Lambda either ... maybe a problem with langchainjs but see https://github.com/hwchase17/langchainjs/issues/1930
Had this error on my Electron project, got it fixed it with import change:
static async imports() { try {
const HierarchicalNSW = require('hnswlib-node').HierarchicalNSW; return { HierarchicalNSW }; } catch (err) { throw new Error(err); } }
Thanks, man! I was trying to solve this for the past 5 hours (on electron).
Having same issue
Did anyone found a solution?
I had that problem on AWS Lambda with HNSWlib and Faiss due to missing dependencies. The Faiss developer fixed these so I switched Faiss in. However I can make that error appear if I attach the x86_64 Faiss layer to an arm64 based lambda. Possibly related, maybe not.
Think I figured it out, you need to install Visual Studio.
I had the same problem, but in the end I ended up using: import { MemoryVectorStore } from 'langchain/vectorstores/memory';
const embeddings = new OpenAIEmbeddings(); const store = await MemoryVectorStore.fromDocuments(docs, embeddings);
Also tried installing Visual Studio and it didn't helped :/
Hi @alexomon018, I'm facing same issue.
I am using it in GatsbyAPI and deploying it to Netlify. It doesn't work in local and in netlify as well.
I can try switching to MemoryVectorStore, but how can I serialize the data and use it for future again. I was able to do it in HNSWLib using save method.
[Update: I figured how to searilize MemoryVestorStore and use it. So I removed usage of HNSWLib and proceeded forward]
I had the same problem, but in the end I ended up using: import { MemoryVectorStore } from 'langchain/vectorstores/memory';
const embeddings = new OpenAIEmbeddings(); const store = await MemoryVectorStore.fromDocuments(docs, embeddings);
Also tried installing Visual Studio and it didn't helped :/
@alexomon018 Thanks man it's worked for me
having exactly the same issue... is it that langchain wasn't able to import this lib correctly somehow?
While the exact same docker image builds just fine on the linux AWS EC2 servers and in github actions, on my M2 Chip MacBook I get
when running
HNSWLib.fromDocuments(docs, new OpenAIEmbeddings({...embeddingsOpts, openAIApiKey:OPENAI_API_KEY}));
is called.So it works on the server (luckily), but not on my local machine in docker 🤔 😕
Dockerfile: