ai icon indicating copy to clipboard operation
ai copied to clipboard

LangChain usage issue.

Open tnguye20 opened this issue 1 year ago • 1 comments

Ran into this issue while following the LangChain example and guide page. Any clarification or support would be much appreciated.

./node_modules/@dqbd/tiktoken/tiktoken_bg.wasm
Module parse failed: Unexpected character ' ' (1:0)
The module seem to be a WebAssembly module, but module is not flagged as WebAssembly module for webpack.
BREAKING CHANGE: Since webpack 5 WebAssembly is not enabled by default and flagged as experimental feature.
You need to enable one of the WebAssembly experiments via 'experiments.asyncWebAssembly: true' (based on async modules) or 'experiments.syncWebAssembly: true' (like webpack 4, deprecated).
For files that transpile to WebAssembly, make sure to set the module type in the 'module.rules' section of the config (e. g. 'type: "webassembly/async"').
(Source code omitted for this binary file)

Import trace for requested module:
./node_modules/@dqbd/tiktoken/tiktoken_bg.wasm
./node_modules/@dqbd/tiktoken/tiktoken.js
./node_modules/langchain/dist/base_language/count_tokens.js
./node_modules/langchain/dist/llms/openai.js
./node_modules/langchain/dist/index.js
./node_modules/langchain/index.js

tnguye20 avatar Jun 20 '23 16:06 tnguye20

What version of langchain are you on? Old versions required modifying next.config.js to allow WASM support in order for tiktoken to work.

jaredpalmer avatar Jun 20 '23 18:06 jaredpalmer

Closing without more info / a reproduction. @tnguye20 please reply back if you haven't been able to solve this by upgrading langchain.

MaxLeiter avatar Jun 22 '23 19:06 MaxLeiter