-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HNSW Lib does not work even after installing hnswlib-node #3782
Comments
🤖 Hey @KaKashi1210! I'm Dosu, a friendly bot here to lend a hand with bugs, answer questions, and guide you to be an awesome contributor. While we're waiting for a human maintainer, I'm here to help. Let's dive into this together. 😊 The error you're encountering might be due to the way
Here is the part of the code that might be causing the issue: static async imports(): Promise<{
HierarchicalNSW: typeof HierarchicalNSWT;
}> {
try {
const {
default: { HierarchicalNSW },
} = await import("hnswlib-node");
return { HierarchicalNSW };
// eslint-disable-next-line @typescript-eslint/no-explicit-any
} catch (err: any) {
throw new Error(
`Could not import hnswlib-node. Please install hnswlib-node as a dependency with, e.g. \`npm install -S hnswlib-node\`.\n\nError: ${err?.message}`
);
}
} You can try changing the dynamic import statement to a static import statement like this: import { HierarchicalNSW } from "hnswlib-node"; And then use You can find this code in the libs/langchain-community/src/vectorstores/hnswlib.ts file. If you're still encountering issues, could you please provide more details about the error message you're seeing and the steps you're taking when the error occurs? This will help me better understand the issue and provide a more accurate solution. SourcesThis response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research. Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant. If you want to continue the conversation, start your reply with @dosu-bot. |
same here |
It looks like you're using It might be worth opening an issue/PR on the HNSW package for |
@jacoblee93 thanks for the idea much appreciated <3 |
use bun 1.1.0+ |
same here, but I am using Node 18.18.0 - any recommendations please? |
After Installing hnswlib-node the issue persists-
The text was updated successfully, but these errors were encountered: