The Finance AI Bot is an intelligent financial research assistant that provides real-time insights, analysis, and full-length reports on financial markets, stocks, and economic trends. It uses Groq's LLM API and direct web search (via DuckDuckGo) to deliver accurate, source-cited answers.
- Quick Answer Mode — Get a concise, bullet-point answer to any finance question in seconds, with live web sources.
- Deep Research Mode — Generate a comprehensive, 1000+ word Financial Report with executive summary, analysis, future outlook, and cited sources.
- Source Credibility Scores — Every response includes a color-coded confidence score (High / Medium / Low) based on the credibility of the sources used.
- XSS-Safe Output — All AI-generated HTML is sanitized with DOMPurify before rendering.
- Rate Limiting — API endpoints are protected (10 req/min for query, 5 req/min for research).
- Dockerized — Full Docker Compose setup for one-command deployment.
| Category | Technologies |
|---|---|
| Backend | Python 3.11, Flask, Groq Python SDK, ddgs |
| Frontend | React 18, Axios, DOMPurify, Nginx |
| AI Model | Groq — llama-3.3-70b-versatile |
| Search | DuckDuckGo (via ddgs) |
| Infra | Docker, Docker Compose |
- Node.js 18+ and npm
- Python 3.11+ and pip
- A free Groq API key from console.groq.com
git clone https://github.com/Kshitij-KS/Finance-AI-Agent.git
cd Finance-AI-Agent/finbotCopy the example env file and add your Groq API key:
cp .env.example .env
# Edit .env and set: groq_api_key=your_key_herecd Backend
pip install -r requirements.txt
python FinanceAI.py
# Server runs on http://localhost:5000cd ../Frontend
cp .env.example .env.local # already has REACT_APP_BACKEND_URL=http://localhost:5000
npm install
npm start
# App runs on http://localhost:3000cd finbot
# Add your Groq key to .env first
docker compose up --build
# Frontend → http://localhost:80
# Backend → http://localhost:5000| Service | Platform | Notes |
|---|---|---|
| Backend | Render.com | Free tier, cold starts after idle |
| Frontend | Vercel.com | Free tier, always-on CDN |
Steps:
- Push
Backend/to GitHub → Deploy on Render as Python Web Service- Build command:
pip install -r requirements.txt - Start command:
gunicorn -w 2 -b 0.0.0.0:$PORT --timeout 120 FinanceAI:app - Env var:
groq_api_key = <your key>andFRONTEND_URL = https://your-app.vercel.app
- Build command:
- Push
Frontend/to GitHub → Deploy on Vercel (auto-detects CRA)- Env var:
REACT_APP_BACKEND_URL = https://your-backend.onrender.com
- Env var:
finbot/
├── Backend/
│ ├── FinanceAI.py # Flask API — search + LLM logic
│ ├── requirements.txt # Python dependencies
│ └── Dockerfile
├── Frontend/
│ ├── src/
│ │ ├── App.js # Main React component
│ │ └── App.css # All styles
│ ├── .env.example
│ └── Dockerfile # Multi-stage Nginx build
├── compose.yaml # Docker Compose
└── .env # API keys (gitignored)
| Variable | Location | Description |
|---|---|---|
groq_api_key |
Backend .env |
Your Groq API key |
FRONTEND_URL |
Backend .env |
CORS allowed origin (production) |
REACT_APP_BACKEND_URL |
Frontend .env.local |
Backend URL for API calls |
FLASK_DEBUG |
Backend .env |
Set true for dev debug mode |
- API keys are loaded from
.envand never exposed to the frontend. - CORS is restricted to
localhost:3000(dev) and your configuredFRONTEND_URL(prod). - All HTML rendered in the browser is sanitized with DOMPurify.
- Rate limiting prevents API abuse (10 req/min quick, 5 req/min research).
- Groq — Ultra-fast LLM inference
- DuckDuckGo (ddgs) — Privacy-respecting web search
- React — Frontend framework
Email: kshitijsingh2727@gmail.com
GitHub: Kshitij-KS
Project: Finance-AI-Agent