How gowthamt-22/rag-q-a-system-intelligent-document-question-answering works
This is a FastAPI PDF question-answering service. Its main workflow accepts a question, retrieves relevant indexed chunks, generates a context-grounded answer, and returns page-level citations. PDFs enter through the upload endpoint or the documented batch-ingestion runner; both extract page text, chunk it, and store it for later retrieval. The graph also shows configuration and prompt construction. Edges reflect the sampled callers and README-documented capabilities; the batch runner is included as a product ingestion entry point, not as build machinery.
Main entry points: main.py REST API · vector_store.py Vector Store · config.py Settings · generator.py Answer Generator
Components 13
API
- REST API
app/main.py - API Models
app/schemas/api_models.py - RAG Pipeline
app/rag_pipeline.py - Settings
app/config.py
PDF Ingestion
- Batch Ingestion
scripts/ingest.py - PDF Extraction
app/ingestion/pdf_loader.py - Text Chunking
app/ingestion/chunker.py - Vector Store
app/ingestion/vector_store.py
Retrieval
- Semantic Retrieval
app/retrieval/retriever.py
Answer Generation
- Answer Generator
app/llm/generator.py - Grounding Prompt
app/llm/prompts.py
Other components
- User
- OpenAI Models
Connections 20
- User → REST API: asks or uploads
README.md - REST API → API Models: validates and formats
app/main.py - REST API → RAG Pipeline: initializes and calls
app/main.py - REST API → PDF Extraction: loads uploaded PDF
app/main.py - REST API → Text Chunking: chunks upload text
app/main.py - REST API → Vector Store: stores upload chunks
app/main.py - Batch Ingestion → PDF Extraction: loads PDFs
scripts/ingest.py - Batch Ingestion → Text Chunking: chunks pages
scripts/ingest.py - Batch Ingestion → Vector Store: stores chunks
scripts/ingest.py - RAG Pipeline → Semantic Retrieval: retrieves context
app/rag_pipeline.py - RAG Pipeline → Answer Generator: generates answer
app/rag_pipeline.py - Semantic Retrieval → Vector Store: searches vectors
app/retrieval/retriever.py - Answer Generator → Grounding Prompt: builds prompt from
app/llm/generator.py - PDF Extraction → Settings: reads settings
app/ingestion/pdf_loader.py - Text Chunking → Settings: reads settings
app/ingestion/chunker.py - Vector Store → Settings: reads settings
app/ingestion/vector_store.py - Semantic Retrieval → Settings: reads settings
app/retrieval/retriever.py - Answer Generator → Settings: reads settings
app/llm/generator.py - Vector Store → OpenAI Models: embeds text
README.md - Answer Generator → OpenAI Models: calls chat model
README.md