Closed sagech closed 3 months ago
Latest commit: e1fe4342af1f9c74296830413eaecb9347d764bf
Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.
Click here to learn what changesets are, and how to add one.
Click here if you're a maintainer who wants to add a changeset to this PR
The update involves a modification to the Webpack configuration in a Next.js project. Specifically, a new external module, llamaindex
, has been declared to use the commonjs format. This change likely aims to optimize the build process by excluding llamaindex
from the output bundle.
File Path | Change Summary |
---|---|
.../streaming/nextjs/webpack.config.mjs |
Added llamaindex as a commonjs external in Webpack |
🐰✨ In the land of code, where the bits align, A new change rolls out, oh so fine! 'Llamaindex' now external, let's cheer, For smoother builds, we hold dear. Hop, hop, hooray, let's code away! 🎉🐇
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
@sagech Seems to be unrelated to https://github.com/run-llama/create-llama/issues/78 - do you have a simple test case of the error that should be fixed with this PR?
@marcusschiesser In my specific scenario, I ran create-llama
and selected Chat + Nextjs, and Qdrant as the vector database. Full options listed below:
✔ What is your project named? … <REDACTED>
✔ Which template would you like to use? › Chat
✔ Which framework would you like to use? › NextJS
✔ Would you like to set up observability? › No
✔ Please provide your OpenAI API key (leave blank to skip): …
✔ Which data source would you like to use? › Use an example PDF
✔ Would you like to add another data source? › No
✔ Would you like to use LlamaParse (improved parser for RAG - requires API key)? … no / yes
✔ Would you like to use a vector database? › Qdrant
✔ Would you like to build an agent using tools? If so, select the tools here, otherwise just press enter ›
✔ How would you like to proceed? › Just generate code (~1 sec)
./app/api/chat/engine/index.ts
is generated from https://github.com/run-llama/create-llama/blob/6fe240b8546e411a140c155be4af0eab1b74c2fb/templates/components/vectordbs/typescript/qdrant/index.ts#L2POST /api/chat
), I get an error 500 (arising from the line above):
[LlamaIndex] TypeError: llamaindex__WEBPACK_IMPORTED_MODULE_1__.QdrantVectorStore is not a constructor
at getDataSource (webpack-internal:///(rsc)/./app/api/chat/engine/index.ts:21:19)
at createChatEngine (webpack-internal:///(rsc)/./app/api/chat/engine/chat.ts:10:78)
at POST (webpack-internal:///(rsc)/./app/api/chat/route.ts:54:96)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async /<REDACTED>/Projects/ml/testcreatellama/node_modules/.pnpm/next@14.2.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/compiled/next-server/app-route.runtime.dev.js:6:53446
at async e_.execute (/<REDACTED>/Projects/ml/testcreatellama/node_modules/.pnpm/next@14.2.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/compiled/next-server/app-route.runtime.dev.js:6:44747)
at async e_.handle (/<REDACTED>/Projects/ml/testcreatellama/node_modules/.pnpm/next@14.2.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/compiled/next-server/app-route.runtime.dev.js:6:54700)
at async doRender (/<REDACTED>/Projects/ml/testcreatellama/node_modules/.pnpm/next@14.2.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/server/base-server.js:1377:42)
at async cacheEntry.responseCache.get.routeKind (/<REDACTED>/Projects/ml/testcreatellama/node_modules/.pnpm/next@14.2.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/server/base-server.js:1599:28)
at async DevServer.renderToResponseWithComponentsImpl (/<REDACTED>/Projects/ml/testcreatellama/node_modules/.pnpm/next@14.2.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/server/base-server.js:1507:28)
at async DevServer.renderPageComponent (/<REDACTED>/Projects/ml/testcreatellama/node_modules/.pnpm/next@14.2.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/server/base-server.js:1924:24)
at async DevServer.renderToResponseImpl (/<REDACTED>/Projects/ml/testcreatellama/node_modules/.pnpm/next@14.2.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/server/base-server.js:1962:32)
at async DevServer.pipeImpl (/<REDACTED>/Projects/ml/testcreatellama/node_modules/.pnpm/next@14.2.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/server/base-server.js:920:25)
at async NextNodeServer.handleCatchallRenderRequest (/<REDACTED>/Projects/ml/testcreatellama/node_modules/.pnpm/next@14.2.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/server/next-server.js:272:17)
at async DevServer.handleRequestImpl (/<REDACTED>/Projects/ml/testcreatellama/node_modules/.pnpm/next@14.2.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/server/base-server.js:816:17)
at async /<REDACTED>/Projects/ml/testcreatellama/node_modules/.pnpm/next@14.2.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/server/dev/next-dev-server.js:339:20
at async Span.traceAsyncFn (/<REDACTED>/Projects/ml/testcreatellama/node_modules/.pnpm/next@14.2.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/trace/trace.js:154:20)
at async DevServer.handleRequest (/<REDACTED>/Projects/ml/testcreatellama/node_modules/.pnpm/next@14.2.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/server/dev/next-dev-server.js:336:24)
at async invokeRender (/<REDACTED>/Projects/ml/testcreatellama/node_modules/.pnpm/next@14.2.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/server/lib/router-server.js:174:21)
at async handleRequest (/<REDACTED>/Projects/ml/testcreatellama/node_modules/.pnpm/next@14.2.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/server/lib/router-server.js:353:24)
at async requestHandlerImpl (/<REDACTED>/Projects/ml/testcreatellama/node_modules/.pnpm/next@14.2.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/server/lib/router-server.js:377:13)
at async Server.requestListener (/<REDACTED>/Projects/ml/testcreatellama/node_modules/.pnpm/next@14.2.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/server/lib/start-server.js:141:13)
POST /api/chat 500 in 2955ms
webpack.config.mjs
like in this PR, then the error goes away@sagech got it, can you please try with create-llama@0.1.3 again? The issue should be fixed there
@marcusschiesser create-llama@0.1.3 works great for me!
@sagech great! Then I'll close this PR! Thanks for pointing me to this issue!
Bug Fixes
llamaindex
beingundefined
. Example issue: https://github.com/run-llama/create-llama/issues/78Summary by CodeRabbit