Back to all projects
ActiveFinTech / Agentic AI / Personal Wealth Intelligence• Technical Overview

FinSight

Privacy-First AI Financial Intelligence Platform for Retail Investors

What it is

FinSight is an app that lets you analyze your whole investment portfolio and gives insights on how diversified your money is across sectors, and gives you the latest market news that might affect your portfolio. It eliminates manual spreadsheet tracking by automatically aggregating mutual fund statements across brokers and calculating audit-grade returns with zero AI math hallucinations.

Tech Stack

Frontend
Next.js 16 (App Router)React 19Tailwind CSSWebSockets
Backend
FastAPI (Python 3.12)Pydantic v2NumPyUvicorn
Database & Cache
PostgreSQL 16 + pgvectorRedis 7 (Pub/Sub & Caching)
AI & Cloud
LiteLLM RouterGoogle Gemini 2.0Groq Llama-3.3-70BDocker & Caddy

System Architecture

System Architecture Sketch
Whiteboard architecture • Click any box to inspect
Tier 1: User Touchpoints & Ingress
HTTPS / WSS
Tier 2: Core Processing & Parallel Engines
Async IPC & SQL Wire
Tier 3: Persistence & Memory
Next.js 16 Web DashboardFrontend
Component Role

Provides real-time portfolio analytics, drag-and-drop mutual fund PDF uploads, and streaming WebSocket notifications.

Core Engineering Highlight

Dynamic Multi-LLM Adapter & Sub-150ms Failover Router

Eliminating single-provider dependency to achieve 99.9% uptime and fraction-of-a-cent inference costs.

Relying on a single AI endpoint causes frequent user-facing errors whenever upstream providers hit rate limits (HTTP 429), undergo maintenance, or experience network drops. FinSight routes all AI tasks through an intelligent LiteLLM fallback adapter. Primary research queries run against Gemini Flash, but if the upstream API throttles or errors out, the request cascades to Gemini Flash-Lite or Groq Llama 3.3 in ~125–150ms without the user ever noticing an interruption.

How it works & Technical Depth:
Health-aware failover cascade: Primary Gemini Flash ➔ instant failover to Gemini Flash-Lite ➔ Groq Llama-3.3-70B.
Audited cost control: Average inference cost kept to < $0.0001 per query through lightweight tiered models.
Built-in circuit-breaking: Prevents retry storms by temporarily backing off degraded upstream endpoints.
Zero user interruption: 99.9% effective uptime even during major third-party AI provider incidents.
backend/services/llm_router.py (LiteLLM Fallback Pattern)python
from litellm import completion, ModelResponse
import time, logging

# Tiered failover cascade: Fast primary -> Cost-effective secondary -> High-throughput fallback
MODEL_CASCADE = [
    {"model": "gemini/gemini-2.0-flash", "timeout": 8.0},
    {"model": "gemini/gemini-2.0-flash-lite", "timeout": 6.0},
    {"model": "groq/llama-3.3-70b-versatile", "timeout": 5.0},
]

async def execute_with_failover(prompt: str, system_message: str) -> str:
    start_time = time.monotonic()
    
    for attempt_idx, config in enumerate(MODEL_CASCADE):
        try:
            response: ModelResponse = completion(
                model=config["model"],
                messages=[
                    {"role": "system", "content": system_message},
                    {"role": "user", "content": prompt}
                ],
                timeout=config["timeout"],
                temperature=0.2
            )
            elapsed_ms = int((time.monotonic() - start_time) * 1000)
            logging.info(f"Success with {config['model']} in {elapsed_ms}ms (tier {attempt_idx+1})")
            return response.choices[0].message.content
            
        except Exception as err:
            logging.warning(f"Tier {attempt_idx+1} ({config['model']}) failed: {err}. Cascading to backup...")
            continue
            
    raise RuntimeError("All LLM providers in cascade exhausted.")

Key Challenges & Trade-offs

Hurdle #1

Air-Gapping Probabilistic AI from Deterministic Math

The Bottleneck:

When LLMs were asked to calculate returns across 40+ mutual fund holdings, the hallucination rate exceeded 35% on multi-fund sums, XIRR compounding, and capital gains taxes.

The Engineered Solution:

Air-gapped the language model: the AI is strictly restricted to parsing messy document text and formatting English summaries. All arithmetic, XIRR calculations, and statutory Budget 2024 taxes are executed by dedicated Python calculation classes.

Takeaway: 100% mathematical accuracy across every portfolio size. In fintech, never let a probabilistic model do arithmetic.
Hurdle #2

Proactive Risk Alerts Without Notification Fatigue

The Bottleneck:

Financial feeds publish hundreds of news articles daily. Alerting users on every headline caused immediate alert fatigue and high unsubscribe rates.

The Engineered Solution:

The Market Monitor agent deduplicates news by content hash, determines the affected economic sectors, and cross-references them against the user's live holdings in PostgreSQL. Alerts are only fired if the user holds >15% exposure in that specific sector.

Takeaway: High signal-to-noise ratio: turns a passive dashboard into an intelligent copilot that only interrupts when real money is at stake.