CoolFace
Apppublic

krinya/smart_routing_with_render_example

sourceHugging Facemitupdated 1y agoView on Hugging Face
0likes
App README

๐Ÿค– Financial AI Chatbot with Smart Routing & RAG

A demo GenAI app that demonstrates smart routing using LangChain

๐Ÿš€ Try It Live

๐ŸŽฏ 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. 1.Write Backend (Python + LangChain)
  2. 2.FastAPI with smart routing logic
  3. 3.RAG pipeline with vector storage
  4. 4.Deploy on Render cloud platform
  1. 1.Create Frontend (Gradio + Hugging Face)
  2. 2.Interactive chat interface
  3. 3.Real-time routing insights
  4. 4.Deploy on Hugging Face Spaces
  1. 1.Connect & Scale
  2. 2.Backend API serves multiple frontends
  3. 3.Docker containerization
  4. 4.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!