This project is a full-stack Document Q&A system that allows users to ask questions about uploaded documents and receive accurate, content-based responses. The system consists of a React + TypeScript frontend and a Flask-based backend.
The backend uses advanced AI libraries like Langchain, FAISS, and Groq for efficient document processing and retrieval. The frontend allows users to ask questions and display results in an intuitive interface.
- AI-Powered Q&A: Ask questions about uploaded documents and get precise answers based on the content.
- Document Embedding: Efficient document embeddings using FAISS for fast document retrieval.
- PDF Support: Load PDF documents for analysis and question answering.
- Google and Groq API Integration: Embeddings and language models powered by Google AI and Groq.
- Full-Stack Solution: Frontend built with Vite, React, and TypeScript, and backend powered by Flask.
- React with TypeScript (modularized for easy scalability)
- Vite for fast development and production builds
- CSS Modules for styling components
- Flask: Python micro-framework for building the API
- FAISS: Vector search for document retrieval
- Langchain: For question answering and language model integration
- Groq: Model for generating responses
- Google Cloud AI: Embedding API for document embedding
- PyPDF2: PDF loading and processing
Ensure you have the following installed:
- Node.js (>=14.x)
- Python (>=3.8)
- Google Cloud API Key and Groq API Key
-
Clone the repository and navigate to the backend directory:
git clone https://github.com/yourusername/document-qa.git cd document-qa/backend
-
Create a virtual environment and activate it:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install the required Python packages:
pip install -r requirements.txt
-
Set up environment variables:
-
Create a
.env
file in the backend directory and add your API keys:GROQ_API_KEY=your_groq_api_key GOOGLE_API_KEY=your_google_api_key
-
-
Run the Flask server:
flask run
-
Navigate to the frontend directory:
cd ../frontend
-
Install the required Node.js packages:
npm install
-
Start the development server:
npm run dev
The frontend should now be running on http://localhost:5173
and the backend API on http://localhost:5000
.