krinya/smart_routing_with_render_example
0
1---2title: AI Chatbot with Smart Routing3emoji: ๐ค4colorFrom: blue5colorTo: purple6sdk: docker7pinned: false8license: mit9app_port: 786010---11 12# ๐ค Financial AI Chatbot with Smart Routing & RAG13 14**A demo GenAI app that demonstrates smart routing using LangChain**15 16## ๐ Try It Live17- **๐ฏ Live Demo**: [Financial AI Chatbot](https://huggingface.co/spaces/krinya/smart_routing_with_render_example) โ **Try it here!**18- **๐ป Frontend Code**: [`app.py`](https://huggingface.co/spaces/krinya/smart_routing_with_render_example/tree/main) - Gradio interface code19- **๐ Backend API**: [Deployed on Render](https://gen-ai-demo-rag-bot.onrender.com/docs)20- **๐ Backend API Code**: [GitHub Repository](https://github.com/krinya/gen_ai_demo_rag_bot/tree/main)21 22## ๐ฏ What This Demonstrates23 24This project shows **how to create a complete GenAI product**:25 26### 1. ๐ง Smart Routing with LangChain27Intelligently routes financial questions about **5 major companies** (Apple, Google, Amazon, Tesla, Intel):28- ๐ **FAQ Route**: Quick facts (CEO names, founding dates)29- ๐ **RAG Route**: Financial data from 2024 annual reports (revenue, profits) 30- ๐ง **LLM Route**: General explanations and financial concepts31 32### 2. ๐ RAG Implementation33- **Vector Storage**: ChromaDB with processed financial documents (full annual reports)34- **Retrieval System**: Semantic search for relevant information35- **Smart Fallbacks**: Multiple sources with quality scoring36 37### 3. ๐๏ธ Production Architecture38- **Backend**: Python FastAPI with LangChain, deployed on Render39- **Frontend**: Gradio UI deployed on Hugging Face Spaces 40- **Separation**: Backend API + Frontend UI for scalability41 42## ๐ ๏ธ How This Shows GenAI Product Development43 44**Complete workflow: Backend โ Deploy โ Frontend**45 461. **Write Backend** (Python + LangChain)47 - FastAPI with smart routing logic48 - RAG pipeline with vector storage49 - Deploy on Render cloud platform50 512. **Create Frontend** (Gradio + Hugging Face)52 - Interactive chat interface53 - Real-time routing insights54 - Deploy on Hugging Face Spaces55 563. **Connect & Scale**57 - Backend API serves multiple frontends58 - Docker containerization59 - Production-ready architecture60 61## ๐ง Tech Stack62 63- **AI**: OpenAI GPT-4o-mini + LangChain orchestration64- **Backend**: Python FastAPI deployed on Render65- **Frontend**: Gradio deployed on Hugging Face Spaces66- **Storage**: ChromaDB vector database67- **Data**: 2024 financial reports (Apple, Google, Amazon, Tesla, Intel)68 69## ๏ฟฝ Example Queries70 71Try these in the live demo:72- "Who is the CEO of Tesla?" โ FAQ route73- "What was Apple's revenue in 2024?" โ RAG route 74- "How do you calculate P/E ratio?" โ LLM route75 76---77 78**๐ฏ Key Learning**: This demonstrates the complete GenAI development stack from data processing to production deployment!79 