langchain-ai / langchain

🦜🔗 Build context-aware reasoning applications
https://python.langchain.com
MIT License
92.28k stars 14.74k forks source link

pdf-parse.d.ts not found when using PDFLoader #6471

Closed RitvikShandilya closed 9 months ago

RitvikShandilya commented 1 year ago

System Info

{ "name": "server-chatgpt", "version": "1.0.0", "description": "", "type": "module", "main": "dist/app.js", "scripts": { "start": "tsc & node dist/app.js", "dev": "tsc -w & nodemon -x 'node dist/app.js || touch dist/app.js'", "dev2": "tsc -w & pm2 start dist/app.js --watch", "log": "pm2 log", "stop": "pm2 stop app", "lint": "eslint . --ext .ts", "test": "echo \"Error: no test specified\" && exit 1" }, "author": "", "license": "ISC", "devDependencies": { "@types/cors": "^2.8.13", "@types/express": "^4.17.17", "@typescript-eslint/eslint-plugin": "^5.59.6", "@typescript-eslint/parser": "^5.59.6", "eslint": "^8.41.0", "nodemon": "^2.0.22", "pm2": "^5.3.0", "ts-node": "^10.9.1", "typescript": "^5.0.4" }, "dependencies": { "@types/node": "^20.3.1", "@types/pdf-parse": "^1.1.1", "body-parser": "^1.20.2", "chatgpt": "^5.2.4", "chromadb": "^1.5.2", "cors": "^2.8.5", "dotenv": "^16.0.3", "express": "^4.18.2", "hnswlib-node": "^1.4.2", "langchain": "^0.0.95", "openai": "^3.2.1", "pdfjs-dist": "^3.7.107", "pg": "^8.11.0", "typeorm": "^0.3.16", "uuid": "^9.0.0" } }

Who can help?

@eyurtsev @agola11

Information

Related Components

Reproduction

When "npm run dev" is executed, I get an error saying node_modules/langchain/dist/document_loaders/fs/pdf.d.ts:1:22 - error TS6053: /node_modules/langchain/src/types/pdf-parse.d.ts' not found.

///

This error comes when I try to import { PDFLoader } from "langchain/document_loaders/fs/pdf";

tsconfig: { "compilerOptions": { "module": "NodeNext", "esModuleInterop": true, "target": "es6", "moduleResolution": "nodenext", "sourceMap": true, "outDir": "dist", "resolveJsonModule": true, "allowJs": true }, "lib": ["es2015"] }

Expected behavior

no error is expected as pdf-parse is already installed, similar issue with pdfjs-dist

kdcokenny commented 1 year ago

This repo is for python. This is the js/ts library -> https://github.com/hwchase17/langchainjs

glenchao commented 1 year ago

"skipLibCheck": true in tsconfig should get you unblocked

dosubot[bot] commented 9 months ago

Hi, @RitvikShandilya! I'm Dosu, and I'm helping the LangChain team manage their backlog. I wanted to let you know that we are marking this issue as stale.

From what I understand, you reported that the pdf-parse.d.ts file is not found when using the PDFLoader in the langchain package. kdcokenny pointed out that this repository is for Python, and suggested using the JavaScript/TypeScript library instead. glenchao also suggested adding "skipLibCheck": true to the tsconfig file to resolve the issue.

Before we close this issue, we wanted to check if it is still relevant to the latest version of the LangChain repository. If it is, please let us know by commenting on the issue. Otherwise, feel free to close the issue yourself or it will be automatically closed in 7 days.

Thank you for your understanding and contribution to the LangChain project!