Next.js Discord

Discord Forum

Vercel AI SDK + LllamaIndex: HuggingFace dependency too large and build doesn't deploy

Unanswered
Cape horse mackerel posted this in #help-forum
Open in Discord
Cape horse mackerelOP
I have been following the documentation for integrating LlamaIndex with the Vercel AI SDK. One of the dependencies is the @huggingface/transformers which appears to be 750MB.

That is causing the error: "Error: A Serverless Function has exceeded the unzipped maximum size of 250 MB."

I have tried to add the dependency to "serverExternalPackages" in my next.config.ts because I read somewhere that might help. It has not.

I am trying to figure out if there are any strategies to reduce the size of the function's dependencies. I am happy to provide additional info, this is new territory so I am not sure where to start. Honestly I hardly ever use API routes, but I am trying out the AI SDK starter project from Vercel's templates and would love to try and make it work with LlamaIndex.

Any help is appreciated!

0 Replies