Skip to content

ArshanKaudinya/PDFhelper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PDFhelper - talk about your PDF!

Live Demo

  • Frontend:
    • Next.js (React 18 App Router), Tailwind CSS, React Query
  • Backend:
    • FastAPI for API endpoints and cross-origin interaction
  • Database:
    • PDFs stored securely in Supabase buckets
    • SQLite database for metadata
    • Local storage for FAISS vector indices
  • NLP and Retrieval:
    • LangChain and LlamaIndex for context retrieval
  • Embedding Model:
    • togethercomputer/m2-bert-80M-32k-retrieval (Together AI API)
  • LLM Model:
    • mistralai/Mixtral-8x7B-Instruct-v0.1 (Together AI API)

Architecture Diagram

Backend Architecture

  • FastAPI Endpoints:
    • /upload: Upload PDF documents, save to Supabase Storage, and index locally.
    • /ask: Submit questions and receive streamed answers.
  • PDF Processing:
    • Extract text using PyMuPDF.
    • Store temporary vectors using FAISS.
  • NLP Handling:
    • LangChain and LlamaIndex manage context retrieval and LLM interaction.

Frontend Architecture

  • Next.js App Router based pages and layouts
  • React Query for robust asynchronous API handling
  • Tailwind CSS for responsive and clean UI
  • Error Handling: Client-side notifications for upload or server failures

Setup Instructions

1. Clone the Repository

git clone https://github.com/ArshanKaudinya/PDFhelper
cd PDFhelper

2. Environment Variables

Create a .env file inside the backend folder with the following:

SUPABASE_URL=your_supabase_url
SUPABASE_ANON_KEY=your_supabase_anon_key
OPENAI_API_KEY=your_together_ai_token

Create a .env.local file inside the frontend folder with:

NEXT_PUBLIC_API_BASE=http://localhost:8000

(Replace localhost:8000 if backend hosted elsewhere.)

3. Install Dependencies

Backend
cd backend
python -m venv .venv
source .venv/bin/activate  # or .venv\Scripts\activate on Windows
pip install -r requirements.txt

4. Run Locally

Backend
cd backend
uvicorn app.main:app --reload
Frontend
cd frontend
pnpm dev
# or
npm run dev

Deployment

  • Frontend deployed on Vercel
  • Backend hosted on Railway
  • Storage handled by Supabase buckets

Key Features

  • Upload PDFs directly from your browser
  • Embeddings are generated and stored locally
  • Ask natural questions about uploaded PDFs
  • Search within chat by keywords
  • Fully responsive design with mobile support

Functional Overview

  1. Upload a PDF document.
  2. Ask any question related to the uploaded document.
  3. Receive concise and accurate answers powered by the Mixtral LLM.
  4. Search across previous conversation messages.

About

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors