Demonstration
Demonstration
Download Node.js Windows Installer (v20.18.1): https://nodejs.org/en/download/prebuilt-installer
Install the Node.js (.msi)
Download WebStorm: https://www.jetbrains.com/webstorm/
Install the Webstorm.exe file
Register or log in to account for WebStorm
Sign up or log in to HuggingFace: https://huggingface.co/welcome
Launch Webstorm
Open the file project name (documentLoaders)
Initialize a Node.js Project: npm init -y. It will generate a package.json file
Install necessary dependency:
npm install langchain node-fetch fs dotenv @huggingface/inference @langchain/community
PDF loader library: npm install pdf-parse
CSV loader library: npm install d3-dsv
5. Configure the .env file: Add your HuggingFace API key
Get API Key: HuggingFace -> Click Profile -> Access Tokens -> Create token -> Copy token -> Paste in .env file
For access tokens, tick the boxes in the inference to use the text summarization and chatbot features.
6. Update package.json for ES6 modules
change "type": "commonjs" to "type": "module"
7. Run program: node index.js
8. Ask the chatbot the summaries of txt/json/pdf/csv: <file> summaries
Check the node and the node package installation
node --version
npm --version
2. Error missing dependencies
Reinstall the dependencies: npm install <package name>
3. Error API key
Ensure a valid API key
Allow the inference permissions
4. Error finding the file path
Ensure the correct file path in the code
- Nur Insyirah Iman
REFERENCES
Sample Application
GitHub. (n.d.). developersdigest/langchain-document-loaders-in-node-js. https://github.com/developersdigest/langchain-document-loaders-in-node-js