krinya/smart_routing_with_render_example
0
๐ค Financial AI Chatbot with Smart Routing & RAG
A demo GenAI app that demonstrates smart routing using LangChain
๐ Try It Live
- ๐ฏ Live Demo: Financial AI Chatbot โ Try it here!
- ๐ป Frontend Code: `app.py` - Gradio interface code
- ๐ Backend API: Deployed on Render
- ๐ Backend API Code: GitHub Repository
๐ฏ What This Demonstrates
This project shows how to create a complete GenAI product:
1. ๐ง Smart Routing with LangChain
Intelligently routes financial questions about 5 major companies (Apple, Google, Amazon, Tesla, Intel):
- ๐ FAQ Route: Quick facts (CEO names, founding dates)
- ๐ RAG Route: Financial data from 2024 annual reports (revenue, profits)
- ๐ง LLM Route: General explanations and financial concepts
2. ๐ RAG Implementation
- Vector Storage: ChromaDB with processed financial documents (full annual reports)
- Retrieval System: Semantic search for relevant information
- Smart Fallbacks: Multiple sources with quality scoring
3. ๐๏ธ Production Architecture
- Backend: Python FastAPI with LangChain, deployed on Render
- Frontend: Gradio UI deployed on Hugging Face Spaces
- Separation: Backend API + Frontend UI for scalability
๐ ๏ธ How This Shows GenAI Product Development
Complete workflow: Backend โ Deploy โ Frontend
- Write Backend (Python + LangChain)
- FastAPI with smart routing logic
- RAG pipeline with vector storage
- Deploy on Render cloud platform
- Create Frontend (Gradio + Hugging Face)
- Interactive chat interface
- Real-time routing insights
- Deploy on Hugging Face Spaces
- Connect & Scale
- Backend API serves multiple frontends
- Docker containerization
- Production-ready architecture
๐ง Tech Stack
- AI: OpenAI GPT-4o-mini + LangChain orchestration
- Backend: Python FastAPI deployed on Render
- Frontend: Gradio deployed on Hugging Face Spaces
- Storage: ChromaDB vector database
- Data: 2024 financial reports (Apple, Google, Amazon, Tesla, Intel)
๏ฟฝ Example Queries
Try these in the live demo:
- "Who is the CEO of Tesla?" โ FAQ route
- "What was Apple's revenue in 2024?" โ RAG route
- "How do you calculate P/E ratio?" โ LLM route
๐ฏ Key Learning: This demonstrates the complete GenAI development stack from data processing to production deployment!
