FinSight AI is an AI-powered equity research assistant that automates financial news analysis using a Retrieval-Augmented Generation (RAG) pipeline.
It allows users to input up to 3 financial news article URLs, processes them into a semantic vector index, and answers natural-language questions with grounded insights and source citations.
The system is designed with production-grade architecture, focusing on accuracy, low hallucination risk, and fault tolerance.
-
Financial News Scraping
- Extracts clean article text from public financial news URLs using LangChain loaders and BeautifulSoup.
- Preserves source URLs for citation and traceability.
-
RAG-Based Question Answering
- Uses semantic search to retrieve the most relevant article chunks.
- LLM answers are strictly grounded in retrieved content.
-
Semantic Vector Search (FAISS)
- Embeddings stored locally using FAISS for ultra-fast similarity search.
- Exact L2 nearest-neighbor search for high retrieval accuracy on small datasets.
-
Multi-Model LLM Fallback
- Uses OpenRouter to route queries across multiple free LLMs.
- Automatic fallback ensures reliability even if a model fails or times out.
-
Source-Backed Answers
- Every answer includes links to the original articles used.
- Optional reasoning visibility for transparency.
-
URL Ingestion
- User provides up to 3 financial news URLs.
- Content is fetched and cleaned into plain text.
-
Chunking
- Text is split using
RecursiveCharacterTextSplitter. chunk_size = 600,chunk_overlap = 100for semantic coherence and API safety.
- Text is split using
-
Embedding
- Each chunk is embedded using Google Gemini Embedding Model (
models/gemini-embedding-001). - Produces 768-dimensional dense vectors.
- Each chunk is embedded using Google Gemini Embedding Model (
-
Vector Store
- Vectors are stored in a local FAISS index (
faiss_index/). - Metadata (source URLs) is persisted alongside vectors.
- Vectors are stored in a local FAISS index (
-
Query Flow
- User question is embedded with the same Gemini model.
- FAISS retrieves top-k (default = 4) most similar chunks.
- Retrieved chunks are passed to the LLM for answer generation.
-
LLM Inference
- Queries routed via OpenRouter with a fallback chain:
- Mistral Small 3.1 → LLaMA 3.3 → Gemma 3 → DeepSeek R1
- Queries routed via OpenRouter with a fallback chain:
| Layer | Technology |
|---|---|
| UI | Streamlit (dark-themed UI) |
| Web Scraping | LangChain WebBaseLoader + BeautifulSoup |
| Text Chunking | RecursiveCharacterTextSplitter |
| Embeddings | Google Gemini gemini-embedding-001 |
| Vector Store | FAISS (CPU, Flat L2 index) |
| RAG Orchestration | LangChain RetrievalQAWithSourcesChain |
| LLM Gateway | OpenRouter |
| Environment | Python, python-dotenv |
- Clone this repository:
git clone https://github.com/yourusername/finsight-ai.git
- Navigate to the project directory:
cd finsight-ai - Install dependencies:
pip install -r requirements.txt
- Configure environment variables in a .env file:
GOOGLE_API_KEY=your_gemini_api_key_here OPENROUTER_API_KEY=your_openrouter_api_key_here
🧩 Usage
- Launch the Streamlit application: streamlit run main.py
- Input URLs or upload files containing financial articles.
- Click “Process Articles” to extract text, create embeddings, and build the FAISS index.
- Ask queries related to market trends, company performance, or financial insights — FinSight AI will provide responses with source references.