How kvamshiformlops/multi-pdf-rag-chatbot-using-ollama-and-llama3.2 works
This repository is a PDF/TXT retrieval-augmented question-answering service. A client uploads documents through FastAPI; the shared FileProcessor loads them, semantically chunks the text, and builds an in-memory FAISS index. For questions, it searches the index, re-ranks candidates, and passes the selected context to a grounded QA chain backed by Ollama. Upload files persist on disk, but the index is process-local and lost on restart. The README documents this workflow; the graph’s implementation relationships are evidenced by app.py.
Main entry points: app.py FileProcessor
Components 13
API and uploads
- FastAPI routes
app.py - Uploaded files
app.py
Document ingestion
- FileProcessor
app.py - PDF/TXT loaders
app.py - Semantic chunker
app.py - BGE embeddings
app.py
Search and ranking
- FAISS index
app.py - Similarity search
app.py - CrossEncoder reranker
app.py
Grounded answering
- QA chain
app.py - Grounding prompt
app.py - Ollama LLM
Other components
- API client
Connections 17
- API client → FastAPI routes: uploads or asks
README.md - FastAPI routes → Uploaded files: writes files
app.py - FastAPI routes → FileProcessor: processes files
app.py - Uploaded files → FileProcessor: provides paths
app.py - FileProcessor → PDF/TXT loaders: loads text
app.py - FileProcessor → Semantic chunker: chunks text
app.py - Semantic chunker → BGE embeddings: segments with
app.py - FileProcessor → FAISS index: builds index
app.py - FAISS index → BGE embeddings: embeds documents
app.py - FastAPI routes → FileProcessor: answers question
app.py - FileProcessor → Similarity search: searches index
app.py - FileProcessor → FAISS index: searches
app.py - FileProcessor → CrossEncoder reranker: scores candidates
app.py - FileProcessor → QA chain: submits top chunks
app.py - QA chain → Grounding prompt: uses template
app.py - QA chain → Ollama LLM: generates answer
app.py - FastAPI routes → API client: returns response
app.py