Upload one or multiple sources (including .pdf files) and chat with the contents of the documents using OpenAI models.
- Uses pgvector extension for PostgreSQL
- Integrates OpenAI embeddings for vector creation
- Implements a NextJS web application for file upload and usage
- Chunks and stores vectors in a local database
- Provides a simple, intuitive user interface
- Uses OpenAI models for embedding and chat
- Node.js (v14 or later)
- Docker and Docker Compose
- OpenAI API key
-
Clone the repository:
git clone https://github.com/MartinKondor/chat-with-document.git cd chat-with-document
-
Install dependencies:
npm install
-
Set up the database:
docker-compose up -d npm run db:setup
-
Modify the given
.env
file in the root directory (if you wish):SKIP_ENV_VALIDATION=0 NODE_ENV="development" POSTGRES_URL="postgres://postgresuser:postgrespassword@localhost:54322" POSTGRES_URL_NON_POOLING="postgres://postgresuser:postgrespassword@localhost:54322?pool=false" OPENAI_API_KEY="sk-proj-..."
-
Start the development server:
npm run dev
-
Open your browser and navigate to
http://localhost:3000
. -
Follow the on-screen instructions:
- Upload one or more files (max 50,000 characters)
- Chat with the contents of the documents
- File Upload: The app chunks your uploaded text file and creates embeddings using OpenAI's API.
- Vector Storage: These embeddings are stored in the local PostgreSQL database using pgvector.
- Chat: The chat is done using OpenAI models.
Contributions are welcome! Please feel free to submit a Pull Request.
- OpenAI for their embedding and models API
- pgvector for enabling vector operations in PostgreSQL
- Next.js for the React framework
Martin Kondor - https://martinkondor.github.io/
Project Link: https://github.com/MartinKondor/chat-with-document
MIT License. See the LICENSE file for more details.
Copyright © Martin Kondor