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
System Architecture
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.
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
Air-Gapping Probabilistic AI from Deterministic Math
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.
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.
Proactive Risk Alerts Without Notification Fatigue
Financial feeds publish hundreds of news articles daily. Alerting users on every headline caused immediate alert fatigue and high unsubscribe rates.
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.