| --- |
| 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! |
|
|