This project provides a web application for interacting with PDF documents using AI, specifically targeting users who need to quickly extract information or engage in Q&A over their documents. It leverages a Retrieval-Augmented Generation (RAG) pipeline powered by Together AI for language models and embeddings, with MongoDB Atlas serving as the vector database.
How It Works
The application utilizes a RAG architecture. PDFs are processed, chunked, and converted into embeddings using the M2 Bert 80M model via Together AI. These embeddings are stored in a MongoDB Atlas vector database. When a user queries the PDF, their query is also embedded, and similar document chunks are retrieved from the database. These chunks are then passed to the Mixtral LLM (also via Together AI) as context to generate an answer. LangChain.js orchestrates the RAG pipeline.
Quick Start & Requirements
- Install/Run: Deploy to Vercel or other hosts. Requires setting up several external services.
- Prerequisites: Together AI account, MongoDB Atlas cluster with a specific vector search index (768 dimensions, Euclidean similarity), Bytescale account, Clerk account. Environment variables must be configured via an
.env
file.
- Setup: Requires configuring multiple external services and environment variables.
- Links:
.example.env
for environment variables.
Highlighted Details
- Powered by Together AI for Mixtral LLM and M2 Bert 80M embeddings.
- Uses MongoDB Atlas as a vector database with a specific vector search index configuration.
- Built with Next.js App Router, Clerk for authentication, and Tailwind CSS.
- Bytescale is used for PDF storage.
Maintenance & Community
- Sponsored by Together AI, Bytescale, Pinecone, and Clerk.
- Future tasks include adding PDF deletion, exploring different embedding models, prompt engineering, API route protection, and benchmarking.
- Contributions are welcome.
Licensing & Compatibility
- The README does not explicitly state a license. However, the use of services like Together AI, MongoDB Atlas, Bytescale, and Clerk implies potential costs and terms of service associated with those platforms. Compatibility for commercial use would depend on the licenses of these underlying services and any explicit license for this repository.
Limitations & Caveats
- The setup process is complex, requiring integration with multiple third-party services and specific database configurations.
- The project is described as a "template," suggesting it may require significant customization for production use.
- PDFs larger than 10MB may require compression.