An AI-powered PDF chat built with Next.js 13, Vercel's AI SDK, Langchain, and PineconeDB
Subscribe to my YouTube Channel for an upcoming video tutorial!
Demo.1.mov
![Embed LLM](https://private-user-images.githubusercontent.com/15684795/261312283-b1252438-f5b3-4df3-aecc-245553006a60.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjM4ODQ3NTUsIm5iZiI6MTcyMzg4NDQ1NSwicGF0aCI6Ii8xNTY4NDc5NS8yNjEzMTIyODMtYjEyNTI0MzgtZjViMy00ZGYzLWFlY2MtMjQ1NTUzMDA2YTYwLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTclMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODE3VDA4NDczNVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTZmNzA4NmViMTM0MzFmMTg0ODNkNjM2OGI3NjRjN2ZkYTRhMjg0ZGQ3ZDNlNmM4MWVjM2Y3NmY0MTYyYmM0ZDUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.foPeL5b6Yg5FBlwnjaXvJ6vqiH_sx249PzeeoyTU9Ys)
Built with:
- โ Next.js 13
- โ Vercel's AI SDK
- โ Shadcn-ui
- โ Langchain TypeScript integration
- โ PineconeDB as the knowledge store
- โ Dark Mode with persistent theme-switching
- Create a free account and get an OPEN_AI key from platform.openai.com
- Create a free account and get access to PineconeDB
- And populate your
.env
file with the required information.
- The PineconeDB index creation happens when we run
npm run prepare:data
, but its better to create it manually if you dont want the command to fail. - If the command fails, then give sometime for pinecone index to get initialized and try to run the command again, it should work eventually.
All commands are run from the root of the project, from a terminal:
Command | Action |
---|---|
npm install |
Installs dependencies |
npm run prepare:data |
Splits your PDF file under the /docs folder into chunks, embeds them, uploads them to Pinecone |
npm run dev |
Starts the local dev server at localhost:3000 |
- โ Add sources to the streamed chat bubble
- ๐ง Clean up and show proper error messages
- ๐ง Sanitize input and output source documents
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.