finai / README.md
Sandy-sys's picture
Deploy FinAI
db7ef8e verified
|
Raw History Blame Contribute Delete
2.21 kB
metadata
title: FinAI
emoji: πŸ“Š
colorFrom: indigo
colorTo: purple
sdk: docker
app_port: 7860
pinned: false
short_description: Conversational analytics for Magic Bus India Foundation

MBF Insight β€” Magic Bus AI Insights Platform

A Julius.ai-grade dynamic intelligence platform for the Magic Bus India Foundation magicbusDB knowledge base. Each query produces a uniquely composed dashboard with citations, multi-modal retrieval (GraphRAG + LlamaIndex SubQuery + Text-to-SQL + pgvector hybrid), and adaptive chart counts/types driven by data + intent.

Monorepo layout

FinAi/
β”œβ”€β”€ apps/
β”‚   β”œβ”€β”€ web/                Next.js 15 (App Router) + shadcn/ui
β”‚   └── api/                FastAPI orchestrator + LangGraph
β”œβ”€β”€ etl/                    Data foundation (MySQL import, PG mirror, Parquet, GraphRAG, vectors)
β”œβ”€β”€ infra/                  Docker compose (MySQL, Postgres+pgvector+AGE, Jupyter, Langfuse, Redis)
β”œβ”€β”€ evals/                  Gold-query eval harness
β”œβ”€β”€ mbtestdb/               Source MySQL dump (read-only)
└── data/                   Local snapshots, parquet, graphrag artifacts (gitignored)

Quick start (local-only)

# 1. Spin infrastructure
docker compose -f infra/docker-compose.yml up -d

# 2. Configure secrets (edit .env.local with DeepSeek keys β€” DO NOT commit)
copy .env.local.example .env.local

# 3. Import the MySQL dump
bash etl/import_mysql.sh

# 4. Mirror to Postgres + build dim tables
python etl/mirror_to_pg.py

# 5. Snapshot Parquet + build vectors + GraphRAG
python etl/snapshot_parquet.py
python etl/build_vectors.py
python etl/build_graphrag.py

# 6. Start backend
cd apps/api && uvicorn mbf.app:app --reload --port 8000

# 7. Start frontend
cd apps/web && pnpm install && pnpm dev

Security

  • Never commit .env.local β€” it holds the 15 DeepSeek API keys.
  • The MySQL dump is read-only source-of-truth; the backend connects via a read-only DB user.
  • Generated SQL passes through an AST allow-list (SELECT-only, no DDL/DML).

See /memories/session/plan.md for the full 8-phase plan.