How judy-yxchen/qa-rag-project works
QA-RAG-Project is a Streamlit news-question answering prototype. A user chooses a vector model and retrieval mode, submits a question, and receives an answer with source links when retrieval provides them. The main app supports all-news retrieval, cluster-scoped retrieval, cluster-based simulated-QA selection, and direct LLM answers; mode3.py supplies the QA matching and answer-generation layer. The README also documents two embedding choices, cached index loading, and index construction. The optional LangGraph endpoint is mentioned in app.py, but the excerpt does not show a request to it; other omitted app logic limits detail on exact retrieval calls.
Main entry points: app.py Mode dispatcher · mode3.py Question matching · data News and vectors · Groq_news_with_questions_Final.csv Simulated QA data
Components 17
Chat interface
- Streamlit chat
app.py - Mode dispatcher
app.py
Retrieval modes
- Model resources
app.py - Cluster predictor
app.py - All-news search
app.py - Cluster search
app.py - Cluster QA mode
app.py - Direct answer
app.py
Simulated QA
- Question matching
mode3.py - QA relevance ranking
mode3.py - Answer generation
mode3.py
Knowledge assets
- News and vectors
data - Simulated QA data
data/Groq_news_with_questions_Final.csv - FAISS indexes
- KMeans models
Other components
- Questioner
- Gemini API
Connections 26
- Questioner → Streamlit chat: asks
app.py - Streamlit chat → Mode dispatcher: submits query
app.py - Mode dispatcher → Model resources: loads model
app.py - Model resources → FAISS indexes: loads index
app.py - Model resources → KMeans models: loads model
app.py - Mode dispatcher → All-news search: routes mode
app.py - Mode dispatcher → Cluster search: routes mode
app.py - Mode dispatcher → Cluster QA mode: routes mode
app.py - Mode dispatcher → Direct answer: routes mode
app.py - Cluster search → Cluster predictor: predicts cluster
app.py - Cluster QA mode → Cluster predictor: predicts cluster
app.py - Cluster predictor → KMeans models: uses model
app.py - Cluster predictor → Model resources: embeds query
app.py - All-news search → FAISS indexes: retrieves documents
app.py - Cluster search → FAISS indexes: retrieves documents
- Cluster QA mode → Question matching: calls QA helpers
app.py - Question matching → Simulated QA data: loads questions
mode3.py - Question matching → News and vectors: uses QA vectors
mode3.py - Question matching → QA relevance ranking: ranks candidates
mode3.py - QA relevance ranking → Gemini API: checks relevance
mode3.py - Cluster QA mode → Answer generation: generates answer
app.py - Answer generation → Gemini API: invokes model
mode3.py - Direct answer → Gemini API: asks directly
app.py - All-news search → Gemini API: generates response
- Cluster search → Gemini API: generates response
- Mode dispatcher → Streamlit chat: returns answer and sources
app.py