🔬 Automate loan document analysis with Mistral OCR and GPT for underwriting decisions

615 views · 🔬 Document Extraction & Analysis

Description

LOB Underwriting with AI

This template ingests borrower documents from OneDrive, extracts text with OCR, classifies each file (ID, paystub, bank statement, utilities, tax forms, etc.), aggregates everything per borrower, and asks an LLM to produce a clear underwriting summary and decision (plus next steps).

Good to know

  1. AI and OCR usage consume credits (OpenAI + your OCR provider).
  2. Folder lookups by name can be ambiguous—use a fixed folderId in production.
  3. Scanned image quality drives OCR accuracy; bad scans yield weak text.
  4. This flow handles PII—mask sensitive data in logs and control access.
  5. Start small: batch size and pagination keep costs/memory sane.

How it works

  1. Import & locate docs: Manual trigger kicks off a OneDrive folder search (e.g., “LOBs”) and lists files inside.
  2. Per-file loop: Download each file → run OCR → classify the document type using filename + extracted text.
  3. Aggregate: Combine per-file results into a borrower payload (make BorrowerName dynamic).
  4. LLM analysis: Feed the payload to an AI Agent (OpenAI model) to extract underwriting-relevant facts and produce a decision + next steps.
  5. Output: Return a human-readable summary (and optionally structured JSON for systems).

How to use

  1. Start with the Manual Trigger to validate end-to-end on a tiny test folder.
  2. Once stable, swap in a Schedule/Cron or Webhook trigger.
  3. Review the generated underwriting summary; handle only flagged exceptions (unknown/unreadable docs, low confidence).

Setup steps

Connect accounts

Configure inputs

Wire the file path

Classification

Combine

  1. Replace the hard-coded BorrowerName with:

AI Agent

Optional outputs

Customize if needed

🔗 Nodes Used

Microsoft OneDrive, AI Agent, OpenAI Chat Model, Mistral AI

📥 Import

Download workflow.json and import into n8n: Workflow menu → Import from File

📖 Importing guide · 🔑 Credential setup