Skip to content
项目

johnsonhk88/AI-Bank-Statement-Document-Automation-By-LLM-And-Personal-Finanical-Analysis-Prediction

在 GitHub 查看

关于

通过 LLM 模型实现银行对账单文档自动化和个人财务分析

人工智能与机器学习

这些数字如何统计

可以做什么

  • Deterministic pipeline — PyMuPDF extract, PII redaction, heuristic parse + LLM fallback, balance check
  • Selectable agents — Pipeline, CrewAI, Deep Agents (Hermes still disabled)
  • Object storage — S3-compatible RustFS locally; same client for AWS/R2 later
  • SQL ledger — dashboard totals from transactions, not JSONB blobs

实测星标增长

24小时
0
7天
0
15天
+3
1个月
正在收集历史

各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。

README.md

原文

AI Bank Statement Automation with LLM & Personal Financial Analysis

Python CrewAI Deep Agents LiteLLM License

Upload bank-statement PDFs, extract a Postgres ledger, and ask questions with a shared pipeline. Choose Pipeline, CrewAI, or Deep Agents. Local LLMs via LiteLLM (vLLM, SGLang, Strata, LM Studio, Ollama).

Scripts: docs/guides/getting-started.md · Manual (no scripts): docs/guides/manual-setup.md · Terms: CONTEXT.md


Quick start

With scripts

./scripts/setup.sh          # infra/.env + JWT
./scripts/up.sh             # Postgres, Redis, Qdrant, RustFS, API :8000, worker
./scripts/preflight.sh      # health + login + sample upload
./scripts/dev-frontend.sh   # http://localhost:5173

Manual (same stack, no ./scripts)

cp infra/.env.example infra/.env   # then edit JWT_SECRET, ADMIN_EMAIL, ADMIN_PASSWORD
cd infra && docker compose up -d --build
curl -s http://localhost:8000/api/health
cd ../frontend && npm install && npm run dev

Full commands, ports, overlays, and pitfalls: docs/guides/manual-setup.md.

Script Purpose
./scripts/setup.sh Write infra/.env, generate JWT_SECRET
./scripts/up.sh Compose up (--gpu, --ocr, --prod)
./scripts/preflight.sh Health, login, sample PDF
./scripts/dev-frontend.sh Vite on :5173
./scripts/logs.sh Follow backend + worker (or pass service names)
./scripts/test.sh Backend pytest + frontend vitest
./scripts/down.sh Stop (--volumes wipes data)

On New analysis pick Pipeline (default), CrewAI, or Deep Agents. PDFs go to RustFS; statements and transactions go to Postgres.


How it fits together

Store Holds
RustFS :9000 (console :9001) PDF bytes (documents/{sha256}.pdf)
Postgres 16 Upload registry, statements, transactions, analysis history
Qdrant Redacted chunks for RAG — not the ledger
Redis Celery queue

Pipeline stages (shared by every harness): extract → optional OCR → redact PII → parse → verify → categorize → store → report.


Key features

  • Deterministic pipeline — PyMuPDF extract, PII redaction, heuristic parse + LLM fallback, balance check
  • Selectable agents — Pipeline, CrewAI, Deep Agents (Hermes still disabled)
  • Object storage — S3-compatible RustFS locally; same client for AWS/R2 later
  • SQL ledger — dashboard totals from transactions, not JSONB blobs
  • Local LLM first — vLLM, SGLang, Strata, LM Studio, Ollama via LiteLLM; live /v1/models
  • Optional YOLO + OCR — ./scripts/up.sh --ocr when PDF text is sparse
  • GPU optional — ./scripts/up.sh --gpu (CPU torch is the default image)
  • History dashboard — quarterly / annual totals from Postgres
  • MCP stdio — Claude Desktop / Cursor over the BankAI API
  • Domain skills — edit skills/ only, then python scripts/sync_skills.py --apply

Ports

Port Service
5173 Vite UI (dev)
80 Nginx UI (prod profile)
8000 FastAPI (/api/*)
5432 PostgreSQL
6379 Redis
6333 Qdrant
9000 MinIO S3 API
9001 MinIO console (login = S3_ACCESS_KEY / S3_SECRET_KEY)
3001 Grafana (optional monitoring stack)

BankAI FastAPI owns :8000. If you run vLLM, bind it to :8001.


Object storage

docker compose -f infra/monitoring/docker-compose.yml up -d
# Grafana http://localhost:3001  (admin/admin)  dashboard /d/bankai-local-llm

Prefer 9B+ models and 16K+ context (32K better). Prefer Markdown reports over strict JSON on small local models.


Tech stack

Component Technology
API FastAPI, SQLAlchemy 2.0 (async), Alembic, Pydantic v2
Pipeline PyMuPDF, PII redact, heuristic + instructor parse
Object store RustFS (S3 API)
LLM LiteLLM (vLLM, SGLang, Strata, LM Studio, Ollama, OpenAI, …)
Agents Pipeline adapter · CrewAI · Deep Agents
Vector DB Qdrant
Queue Celery + Redis
Database PostgreSQL 16
Frontend React 18, TypeScript 5, Vite 5, TailwindCSS 3
GPU (optional) NVIDIA Container Toolkit, PyTorch cu128

Project structure

├── backend/                 # FastAPI + Celery (HTTP under /api/*)
│   ├── app/pipeline/        # Canonical extract → report stages
│   ├── app/agents/          # pipeline, crewai, deep-agents, hermes stub
│   └── alembic/
├── frontend/                # React SPA
├── infra/                   # Compose, Dockerfiles, k8s stub, monitoring
├── skills/                  # Canonical SKILL.md packages
├── scripts/                 # setup, up, down, logs, test, preflight
├── agents/                  # Experimental harness copies (not the API)
├── notebooks/               # CrewAI / YOLO experiments
├── data/samples/
├── docs/guides/             # Run books
├── docs/specs/              # Historical design snapshots
├── docs/adr/
└── CONTEXT.md

Skills: edit skills/ only, then python scripts/sync_skills.py --apply.


GPU (optional)

Default ./scripts/up.sh is CPU. For CUDA torch and NVIDIA devices:

./scripts/up.sh --gpu
cd infra && docker compose exec backend python -c \
  "import torch; print(torch.cuda.is_available(), torch.cuda.get_device_name(0) if torch.cuda.is_available() else '')"

Needs NVIDIA Container Toolkit on the host. Verify with:

docker run --rm --gpus all nvidia/cuda:12.2.1-base-ubuntu22.04 nvidia-smi

HTTP smoke tests and pytest

After ./scripts/up.sh, use docs/guides/full-stack-app-guide.md for curl walkthroughs and test layout.

./scripts/test.sh

Experiments (notebooks / agents/)

Production analysis is the FastAPI app. These trees are offline experiments:

Harness Path How to run
CrewAI notebook notebooks/ai_agent_skills_dev.ipynb project venv + Jupyter
Deep Agents CLI agents/deep-agents/ run_e2e.py --mode pipeline (no LLM)
Hermes agents/hermes/ Hermes CLI + Docker sandbox

Guide: docs/guides/multi-harness-agents-guide.md

python -m venv venv && source venv/bin/activate
pip install -r requirements.txt
jupyter notebook notebooks/ai_agent_skills_dev.ipynb

Developer notes


Roadmap

  • Wire Hermes into the live API
  • Kubernetes as a separate base project
  • Stronger PII (names/addresses)
  • Multi-document workspaces / forecasting on the SQL ledger

License

Apache License 2.0

探索相关项目

加载中…