File size: 2,862 Bytes
9d0a2e8 41ca8e9 9d0a2e8 41ca8e9 9d0a2e8 41ca8e9 12e3d57 41ca8e9 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | ---
title: AI Chatbot with Smart Routing
emoji: π€
colorFrom: blue
colorTo: purple
sdk: docker
pinned: false
license: mit
app_port: 7860
---
# π€ 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](https://huggingface.co/spaces/krinya/smart_routing_with_render_example) β **Try it here!**
- **π» Frontend Code**: [`app.py`](https://huggingface.co/spaces/krinya/smart_routing_with_render_example/tree/main) - Gradio interface code
- **π Backend API**: [Deployed on Render](https://gen-ai-demo-rag-bot.onrender.com/docs)
- **π Backend API Code**: [GitHub Repository](https://github.com/krinya/gen_ai_demo_rag_bot/tree/main)
## π― 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**
1. **Write Backend** (Python + LangChain)
- FastAPI with smart routing logic
- RAG pipeline with vector storage
- Deploy on Render cloud platform
2. **Create Frontend** (Gradio + Hugging Face)
- Interactive chat interface
- Real-time routing insights
- Deploy on Hugging Face Spaces
3. **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!
|