I built a RAG application that retrieves relevant Bhagavad Gita verses for ethical dilemmas and generates structured guidance.
The problem: The Gita has 701 verses. Finding applicable wisdom for a specific situation requires either deep familiarity or hours of reading.
How it works: 1. User describes their ethical dilemma 2. Query is embedded using sentence-transformers 3. ChromaDB retrieves top-k semantically similar verses 4. LLM generates structured output: 3 options with tradeoffs, implementation steps, verse citations
Tech stack: - Backend: FastAPI, PostgreSQL, Redis - Vector DB: ChromaDB with all-MiniLM-L6-v2 embeddings - LLM: Ollama (qwen2.5:3b) primary, Anthropic Claude fallback - Frontend: React + TypeScript + Tailwind
Key design decisions: - RAG to prevent hallucination — every recommendation cites actual verses - Confidence scoring flags low-quality outputs for review - Structured JSON output for consistent UX - Local LLM option for privacy and zero API costs
What I learned: - LLM JSON extraction is harder than expected. Built a three-layer fallback (direct parse → markdown block extraction → raw_decode scanning) - Semantic search on religious texts works surprisingly well for ethical queries - Smaller models (3B params) work fine when constrained by good prompts and retrieved context
GitHub: https://github.com/geetanjaliapp/geetanjali
Happy to discuss the RAG architecture or take feedback.
prtmnth3 months ago
Thank you for open sourcing and sharing the GitHub repo. As someone actively trying to upgrade my skills when it comes to coding and building apps, this is really useful.
vnykmshrop3 months ago
You are welcome! I'm really glad to hear it's useful for your learning journey. Feel free to reach out if you have any questions while exploring the code. You can also check out - docs.geetanjaliapp.com
vnykmshrop3 months ago
Building Geetanjali - https://docs.geetanjaliapp.com/building-geetanjali.html
shivaji_123 months ago
Wow it looks great