File size: 5,499 Bytes
f316317
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3b8655b
f316317
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3b8655b
1ca0954
f316317
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
# PrepAI – Intelligent Interview & Notes Assistant

PrepAI is a comprehensive AI-powered platform designed to help users prepare for interviews, generate personalized quizzes, manage study notes, and even participate in real-time mock interviews using conversational AI. It blends multiple modern technologies such as FastAPI, React, ChromaDB, PostgreSQL, Vapi, Groq, and LlamaIndex into a cohesive, production-ready system.

---

## πŸš€ Live Demo

β–Ά **Try the project here:** [https://huggingface.co/spaces/aki-008/prepAI](https://huggingface.co/spaces/aki-008/prepAI)

---

## πŸš€ Overview

PrepAI enables users to:

- Conduct **AI-powered mock interviews** with real-time voice interaction.
- Upload PDFs and **chat with notes** using vector search + RAG.
- Generate **MCQ quizzes** from resumes or study material.
- Maintain persistent **chat sessions**, interview transcripts, and summaries.
- Work inside a fully containerized architecture with isolated services.

This system is ideal for interview preparation platforms, ed-tech tools, or personal study automation.

---

## 🧩 Architecture

PrepAI is built with a modular full-stack architecture:

### **Backend (FastAPI)**

- JWT Authentication
- Upload & process PDFs
- ChromaDB vector store integration
- Streaming LLM responses
- Vapi-powered live interview assistant
- Quiz generation using Groq/OpenAI

### **Frontend (React + TypeScript + Vite)**

- User onboarding (Sign In / Sign Up)
- PDF upload, preview, rename, deletion
- Interactive note-chat interface
- Dashboard with metrics
- Seamless Vapi interview client

### **Database Layer**

- **PostgreSQL** stores:

  - Users
  - PDFs
  - Chat sessions
  - Messages
  - Metadata

### **Vector Search Layer**

- **ChromaDB** stores:

  - Chunked PDF embeddings
  - User-ingested knowledge

### **AI Services**

- **Groq/OpenAI** for LLM responses
- **SentenceTransformers** for embeddings
- **Vapi** for real-time voice conversations
- **LlamaIndex** for PDF parsing & chunking

---

## πŸ“¦ Directory Structure

```
aki-008-prepai/
β”œβ”€β”€ Backend/
β”‚   β”œβ”€β”€ app/
β”‚   β”œβ”€β”€ Dockerfile
β”‚   └── requirements.txt
β”‚
β”œβ”€β”€ Frontend/
β”‚   β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ Dockerfile
β”‚   └── vite.config.ts
β”‚
β”œβ”€β”€ docker-compose.yml
└── RUN.md
```

---

## βš™οΈ Installation & Setup

### **1. Clone the repository**

```
git clone <repo-url>
cd aki-008-prepai
```

### **2. Create your `.env` file**

Provide:

- PostgreSQL credentials
- Groq API key
- OpenAI key (if needed)
- VAPI_PRIVATE_KEY
- VAPI_PUBLIC_KEY
- VAPI_ASSISTANT_ID

Example:

```
DATABASE_URL=postgresql+asyncpg://postgres:password@db:5432/studentdb
GROQ_API_KEY=your-key
VAPI_PRIVATE_KEY=your-key
VAPI_PUBLIC_KEY=your-key
VAPI_ASSISTANT_ID=your-assistant-id
```

### **3. Run the system (Docker)**

```
docker-compose up --build
```

Services started:

- Frontend β†’ [http://localhost:5173](http://localhost:5173)
- Backend β†’ [http://localhost:8000](http://localhost:8000)
- ChromaDB β†’ [http://localhost:8080](http://localhost:8080)
- PostgreSQL β†’ [http://localhost:5432](http://localhost:5432)

### **4. Dev mode (manual)**

Backend:

```
cd Backend
python run.py
```

Frontend:

```
cd Frontend
npm install
npm run dev
```

ChromaDB:

```
chroma run --host 0.0.0.0 --port 8080 --path ./chroma_store
```

---

## πŸ§ͺ Key Features in Detail

### **1. PDF Upload & Notes Chat**

- PDFs are chunked using PyMuPDF + LlamaIndex.
- Embeddings generated via MiniLM.
- Chunks stored in ChromaDB.
- Users can open chats tied to each PDF with full chat history.

### **2. AI Interview System**

- Dynamic prompt generation based on job-role, experience, difficulty.
- Real-time Vapi-based interview with:

  - Emotion recognition
  - Adjustable voice
  - Adaptive follow-ups
  - Strict 5-minute flow

- Transcripts saved automatically.

### **3. Quiz Generation**

From resumes or notes:

- Strict rules enforced by the SYSTEM_PROMPT
- Always 10 MCQs with 4 options
- JSON-structured output
- Options + explanations

### **4. Authentication**

- Secure hashing using Argon2
- JWT tokens
- Protected routes for all user-specific actions

---

## πŸ› οΈ Development Notes

### **Backend**

- Powered by **FastAPI** with async SQLAlchemy.
- Auto-table creation on startup.
- Organized into clear routers: Auth, Notes, Interview, Quiz.
- Streaming responses for chat.

### **Frontend**

- Built on **React + TypeScript**.
- Modern UI with Tailwind.
- Routes include: Home, Dashboard, Notes, Interview.
- ProtectedRoute ensures authentication.

### **Docker Setup**

`docker-compose.yml` orchestrates:

- PostgreSQL database
- ChromaDB vector server
- Backend (Python)
- Frontend (Nginx)

---

## πŸ“„ Interview Transcript Storage

During every interview:

- All real-time transcripts are appended in `Backend/transcripts/<call_id>.txt`.
- Summary is appended at end of call.

---

## 🚧 Roadmap

Future improvements:

- User analytics dashboard
- Multi-file knowledge merging
- Advanced scoring for interview responses
- Multi-voice model selector
- Mobile-friendly front-end layout

---

## πŸ§‘β€πŸ’» Contributing

Feel free to open issues or submit pull requests. Contributions are welcome for both frontend and backend.

---

## πŸ“œ License

This project is licensed under your chosen license (MIT recommended).

---

### ❀️ Thank you for using PrepAI!

If you'd like additional documentation (API reference, UML diagrams, onboarding guide), just ask!