How nguyen756/rag works
This is a containerized RAG service for game-mechanics questions: a Handlebars web UI forwards queries to a FastAPI backend, which checks a semantic answer cache before routing uncached questions to Gemini tools or FAISS retrieval. The backend also ingests PDF or scraped text, cleans and chunks it, deduplicates chunks, and persists embeddings and metadata. The README documents Nginx, Terraform, and Prometheus/Grafana operations. Those infrastructure and monitoring links are shown where documented; unsampled implementation details are not inferred.
Main entry points: main.py Query API and cache · scraper.py PDF and web extraction · vector_engine.py Vector search · answer.route.js Answer route
Components 18
Web interface
- Question form
views/index.handlebars - Answer route
routes/answer.route.js - Express server
server.js
Query and tools
- Query API and cache
app/main.py - Agent calculations
app/agent/agent.py
Ingestion and storage
- Vector search
app/vector_engine.py - PDF and web extraction
app/scraper.py - PDF source
data/Hard Hit-3.pdf - Cleaning and chunking
app/utils.py - Hash ledger
app/sync.py - Vector index and metadata
data/vector_database.index
Operations
- HTTPS proxy
nginx/nginx.conf - AWS provisioning
infrastructure/main.tf - Prometheus
prometheus.yml
Other components
- Questioner
- Gemini API
- Scraped web pages
- Grafana dashboards
Connections 21
- Questioner → Question form: enters question
- Question form → Answer route: submits form
routes/answer.route.js - Express server → Answer route: mounts route
server.js - Answer route → Query API and cache: posts query
routes/answer.route.js - Query API and cache → Answer route: returns answer
routes/answer.route.js - Query API and cache → Gemini API: requests tool choice
app/main.py - Query API and cache → Agent calculations: calls calculation
app/main.py - Query API and cache → Vector search: searches retrieved query
app/main.py - Vector search → Vector index and metadata: loads and searches
app/vector_engine.py - Query API and cache → PDF source: reads configured PDF
app/main.py - Query API and cache → PDF and web extraction: extracts PDF text
app/main.py - PDF and web extraction → Cleaning and chunking: cleans and chunks
app/scraper.py - PDF and web extraction → Hash ledger: checks chunk IDs
app/scraper.py - Query API and cache → Vector search: embeds extracted chunks
app/main.py - Vector search → Vector index and metadata: saves index and metadata
app/vector_engine.py - PDF and web extraction → Scraped web pages: fetches pages
app/scraper.py - Questioner → HTTPS proxy: initiates HTTPS request
README.md - HTTPS proxy → Express server: proxies traffic
README.md - AWS provisioning → HTTPS proxy: provisions cloud gateway
README.md - Query API and cache → Prometheus: exposes metrics for scraping
README.md - Prometheus → Grafana dashboards: visualizes metrics
README.md