Team Ai
Apppublic

krinya/smart_routing_with_render_example

sourceHugging Facemitupdated 1y agoView on Hugging Face
0likes
README.md79 linesDownload Raw Back to root
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