langchain-ai / langchain-nextjs-template

LangChain + Next.js starter template
https://langchain-nextjs-template.vercel.app
MIT License
1.38k stars 290 forks source link

langchain/vectorstores/chroma #5

Open dsws opened 11 months ago

dsws commented 11 months ago

I'm trying to use the langchain/vectorstores/chroma as a vector store in the POST handler app/api/chat/retrieval/route.ts

Keep getting this error

error ./node_modules/@visheratin/tokenizers-node/tokenizers_wasm.js:367:14 Module not found: Can't resolve 'fs' https://nextjs.org/docs/messages/module-not-found Import trace for requested module: ./node_modules/@visheratin/web-ai-node/node/tokenizer.js ./node_modules/@visheratin/web-ai-node/node/tokenizerLoader.js ./node_modules/@visheratin/web-ai-node/node/index.js ./node_modules/@visheratin/web-ai-node/index.js ./node_modules/chromadb/dist/module/embeddings/WebAIEmbeddingFunction.js ./node_modules/chromadb/dist/module/index.js ./node_modules/langchain/dist/vectorstores/chroma.cjs ./node_modules/langchain/vectorstores/chroma.cjs

I tried to load it like this but no luck... keeps throwing this error. Thoughts?

if(typeof window === "undefined") {
  const {Chroma} = require("langchain/vectorstores/chroma");
}
jacoblee93 commented 11 months ago

Looks like Chroma isn't supported in Edge environments :(

Can you open an issue on them?