How vivektiwari-s/doqa works
DoQA is a conversational PDF question-answering app. A user uploads a PDF in Streamlit; the API parses pages, chunks text, embeds it, and stores vectors in Pinecone. The user then asks a question; the API embeds it, retrieves relevant chunks, builds grounded context, and requests an answer from Gemma through OpenRouter, returning the answer and source chunks to the chat UI. The README documents citations and multi-document support as roadmap items; they are not represented as implemented features here.
Main entry points: routes.py Question endpoint · ingestion.py Embed and upsert · retrieval.py Chunk retrieval · streamlit_app.py Streamlit chat
Components 17
Chat interface
- Streamlit chat
ui/streamlit_app.py
API layer
- FastAPI app
main.py - Upload and query routes
app/api/routes.py - Request and response models
app/models/schemas.py - PDF upload handling
app/api/routes.py - Question endpoint
app/api/routes.py
Document ingestion
- PDF page parsing
app/core/ingestion.py - Page text chunking
app/core/ingestion.py - Embed and upsert
app/core/ingestion.py - Index setup
app/core/ingestion.py
Question answering
- Chunk retrieval
app/core/retrieval.py - Grounded prompt
app/core/retrieval.py - Answer generation
app/core/retrieval.py
Other components
- Document user
- Pinecone vector index
- HuggingFace embeddings
- OpenRouter Gemma
Connections 23
- Document user → Streamlit chat: uploads or asks
- Streamlit chat → FastAPI app: HTTP requests
- FastAPI app → Upload and query routes: mounts router
- Upload and query routes → PDF upload handling: handles upload
- Upload and query routes → Question endpoint: handles query
- PDF upload handling → Request and response models: returns upload model
- Question endpoint → Request and response models: validates and returns
- PDF upload handling → PDF page parsing: calls ingestion
- PDF page parsing → Page text chunking: passes pages
- Page text chunking → Embed and upsert: passes chunks
- Embed and upsert → HuggingFace embeddings: embeds documents
- Embed and upsert → Index setup: gets index
- Index setup → Pinecone vector index: creates or opens index
- Embed and upsert → Pinecone vector index: upserts vectors
- Question endpoint → Chunk retrieval: calls answer generation
- Chunk retrieval → HuggingFace embeddings: embeds question
- Chunk retrieval → Pinecone vector index: searches vectors
- Chunk retrieval → Grounded prompt: passes matching chunks
- Grounded prompt → Answer generation: provides context
- Answer generation → OpenRouter Gemma: requests completion
- Answer generation → Question endpoint: returns answer and sources
- Question endpoint → Streamlit chat: returns response
- Streamlit chat → Document user: shows answer and sources