Resume-worthy project β An AI-powered investment research chatbot using
Retrieval-Augmented Generation (RAG) + NLP, backed entirely by free, unlimited APIs.
User Query
β
βΌ
[ FastAPI Backend β main.py ]
β
βββΊ [ NLP Ticker Extraction β llm_handler.py ]
β Uses Groq LLM to identify stocks from natural language
β
βββΊ [ Financial Data Fetcher β financial_data.py ]
β yfinance β income statements, balance sheets, cash flow,
β price history, news (100% free, no API key)
β
βββΊ [ Embedding Manager β embeddings.py ]
β sentence-transformers (all-MiniLM-L6-v2) β text embeddings
β ChromaDB β local vector storage + semantic retrieval
β
βββΊ [ LLM Handler β llm_handler.py ]
Groq API (llama3-8b-8192) β generates structured analysis
with RAG context injected into the prompt
[ FastAPI serves frontend ]
[ Frontend β index.html / style.css / script.js ]
βββΊ Chart.js price charts + marked.js markdown rendering
| Tool | Purpose | Cost |
|---|---|---|
| yfinance | Live stock data, financials, news | Free, no key |
| Groq API | LLM inference (llama3-8b) | Free β 14,400 req/day |
| sentence-transformers | Local text embeddings | Free, open-source |
| ChromaDB | Local vector database | Free, open-source |
| FastAPI + Uvicorn | Backend server | Free, open-source |
| Chart.js | Price charts (CDN) | Free |
| marked.js | Markdown rendering (CDN) | Free |
investment-rag-chatbot/
βββ backend/
β βββ main.py β FastAPI app + API routes + frontend serving
β βββ rag_engine.py β RAG orchestrator (the brain)
β βββ financial_data.py β yfinance data fetcher
β βββ embeddings.py β ChromaDB + sentence-transformers
β βββ llm_handler.py β Groq LLM + NLP ticker extraction
βββ frontend/
β βββ index.html β UI layout
β βββ style.css β Dark investment dashboard theme
β βββ script.js β Chat logic, charts, market ticker
βββ chroma_db/ β Auto-created by ChromaDB
βββ requirements.txt
βββ .env.example
βββ README.md
Make sure you have:
- Python 3.10 or 3.11 (recommended)
- pip
- Git (optional)
python --version # Should show 3.10+
pip --version- Go to https://console.groq.com
- Sign up (no credit card needed)
- Click "API Keys" β "Create API Key"
- Copy your key (looks like:
gsk_xxxxxxxxxxxxx)
# If you have the zip, extract it first, then:
cd investment-rag-chatbot# Windows
python -m venv venv
venv\Scripts\activate
# Mac / Linux
python -m venv venv
source venv/bin/activatepip install -r requirements.txtβ³ First run downloads the sentence-transformers model (~80 MB). This happens once.
# Copy the example file
cp .env.example .env
# Open .env and paste your Groq API key
# .env should look like:
# GROQ_API_KEY=gsk_your_actual_key_hereOn Windows (if cp doesn't work):
copy .env.example .env
notepad .env
cd backend
python main.pyYou should see:
INFO: Started server process [xxxxx]
INFO: Uvicorn running on http://0.0.0.0:8000
Open your browser and go to:
http://localhost:8000
You'll see the FinSight AI dashboard. Try asking:
- "Analyze Apple stock"
- "Compare Microsoft and Google"
- "What is Tesla's P/E ratio and is it overvalued?"
main.py
βββ imports RAGEngine from rag_engine.py
βββ imports FinancialDataFetcher from financial_data.py
βββ serves ../frontend/ as static files
rag_engine.py
βββ imports FinancialDataFetcher from financial_data.py
βββ imports EmbeddingManager from embeddings.py
βββ imports LLMHandler from llm_handler.py
βββ Orchestrates: fetch β chunk β embed β retrieve β generate
financial_data.py
βββ No internal imports (standalone)
βββ Uses: yfinance, pandas
embeddings.py
βββ No internal imports (standalone)
βββ Uses: sentence-transformers, chromadb
llm_handler.py
βββ No internal imports (standalone)
βββ Uses: groq, python-dotenv
frontend/index.html
βββ loads /static/style.css
βββ loads /static/script.js
βββ calls /api/chat, /api/stock/{ticker}, /api/market, /api/news/{ticker}
-
Create account at https://render.com (free, no credit card)
-
Push to GitHub:
git init git add . git commit -m "Initial commit: FinSight AI" # Create a repo on github.com, then: git remote add origin https://github.com/YOUR_USERNAME/finsight-ai.git git push -u origin main
-
Create a
render.yamlin the project root:services: - type: web name: finsight-ai runtime: python rootDir: backend buildCommand: pip install -r ../requirements.txt startCommand: python main.py envVars: - key: GROQ_API_KEY sync: false # You'll enter this in Render dashboard - key: APP_PORT value: "10000" - key: CHROMA_PERSIST_DIR value: "./chroma_db"
-
On Render dashboard:
- Click "New Web Service"
- Connect your GitHub repo
- Set GROQ_API_KEY in Environment Variables
- Click Deploy
-
Your app will be live at:
https://finsight-ai.onrender.com
β οΈ Note: Render free tier spins down after 15 min of inactivity and wakes up on the next request (~30s delay). ChromaDB data resets on each deploy (ephemeral filesystem). This is fine for demo purposes.
- Go to https://railway.app
- "New Project" β "Deploy from GitHub"
- Add env var:
GROQ_API_KEY=your_key - Set start command:
cd backend && python main.py - Done β Railway provides a persistent filesystem so ChromaDB data survives restarts.
- RAG Pipeline β Fetches real-time financial data, converts to embeddings, retrieves semantically relevant chunks per query
- NLP Ticker Extraction β LLM identifies stock symbols from natural language ("Tell me about Apple" β AAPL)
- Multi-turn Conversation β Maintains conversation history for contextual follow-up questions
- Live Financial Data β Income statements, balance sheets, cash flow, price history, analyst ratings, news
- Vector Search β ChromaDB cosine similarity search over financial document chunks
- Professional UI β Dark dashboard, animated market ticker, Chart.js price charts, markdown rendering
RAG (Retrieval-Augmented Generation) = fetch relevant data first, then ask the LLM.
Without RAG, the LLM only knows its training data.
With RAG, we fetch live Apple earnings β embed it β find the most relevant parts for your question β send that as context to the LLM. The LLM then answers based on real data.
Text converted to numerical vectors where semantically similar text is mathematically close.
Example: "Apple revenue" and "AAPL income" will have similar embeddings, so a question about "Apple's earnings" retrieves both.
A local vector database. Stores (text + embedding) pairs and lets you do similarity search in milliseconds.
Groq runs LLMs at ~300 tokens/second β far faster than OpenAI's free tier. The llama3-8b-8192 model on Groq gives you 14,400 free requests/day with an 8,192 token context window.
| Problem | Solution |
|---|---|
GROQ_API_KEY not found |
Make sure .env exists in the project root with your key |
No module named 'groq' |
Run pip install -r requirements.txt inside your venv |
| Backend shows 500 error | Check terminal logs; most likely a yfinance network timeout |
| Chart doesn't appear | Some tickers have limited yfinance data; try AAPL, MSFT, GOOGL |
| Model download stuck | Wait ~2 min on first run; all-MiniLM-L6-v2 is ~80MB |
| Port 8000 in use | Change APP_PORT=8001 in .env |
MIT β Free for personal and commercial use.