How theonlyabdulhamid/ai-agent works
AI Research Assistant is a FastAPI backend for uploading PDFs and asking questions about their contents. The documented upload workflow extracts PDF text, chunks it, embeds the chunks, and stores them in ChromaDB; the documented question workflow retrieves relevant chunks and uses Groq to generate a context-aware answer. The upload path is wired in the excerpts, but the ask endpoint currently only returns the submitted question: its connection to RAG and answer generation is documented, not implemented in the shown code. The React frontend is described as future work. Unverified links are dashed.
Main entry points: routes.py API routes · document_processor.py Document processor · rag.py RAG context builder · retrieval.py Semantic retrieval
Components 13
API and intake
- FastAPI application
backend/main.py - API routes
backend/app/api/routes.py - Request and response schemas
backend/app/schemas/document.py - PDF text extraction
backend/app/api/routes.py
Document processing
- Document processor
backend/app/services/document_processor.py - Text chunking
backend/app/services/chunking.py
Retrieval and generation
- RAG context builder
backend/app/services/rag.py - Semantic retrieval
backend/app/services/retrieval.py - Groq answer service
backend/app/services/groq_service.py
Embedding and storage
- Semantic embeddings
backend/app/services/embeddings.py - Chroma vector store
backend/app/database/chroma.py
Other components
- Research user
- Groq API
Connections 15
- Research user → API routes: uploads PDF
README.md - Research user → API routes: asks question
README.md - FastAPI application → API routes: registers
backend/main.py - API routes → Request and response schemas: validates with
backend/app/api/routes.py - API routes → PDF text extraction: extracts text
backend/app/api/routes.py - API routes → Document processor: processes text
backend/app/api/routes.py - Document processor → Text chunking: chunks text
backend/app/services/document_processor.py - Document processor → Semantic embeddings: embeds chunks
backend/app/services/document_processor.py - Document processor → Chroma vector store: stores chunks
backend/app/services/document_processor.py - API routes → RAG context builder: builds context
- RAG context builder → Semantic retrieval: retrieves context
backend/app/services/rag.py - Semantic retrieval → Semantic embeddings: embeds query
backend/app/services/retrieval.py - Semantic retrieval → Chroma vector store: queries vectors
backend/app/services/retrieval.py - RAG context builder → Groq answer service: generates answer
- Groq answer service → Groq API: requests completion
backend/app/services/groq_service.py