承保贷款分析
高级
这是一个Document Extraction, AI Summarization领域的自动化工作流,包含 17 个节点。主要使用 Code, MistralAi, ManualTrigger, SplitInBatches, Agent 等节点。 使用 Mistral OCR 和 GPT 自动化贷款文档分析以进行承保决策
前置要求
- •OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"id": "rVKBWXqaa79EfTVA",
"meta": {
"instanceId": "db1715da5f21adba44ce4ea3b08abb06cd1771e876f5ad2751fcafd78c5eb9dc",
"templateCredsSetupCompleted": true
},
"name": "承保贷款分析",
"tags": [],
"nodes": [
{
"id": "0d40759f-812a-4972-ba74-e42c8d5aa258",
"name": "搜索文件夹",
"type": "n8n-nodes-base.microsoftOneDrive",
"position": [
624,
0
],
"parameters": {
"query": "<Your Folder Name>",
"resource": "folder",
"operation": "search"
},
"credentials": {
"microsoftOneDriveOAuth2Api": {
"id": "<Your One Drive API Key>",
"name": "Microsoft Drive account"
}
},
"typeVersion": 1
},
{
"id": "65de0a29-5e09-41ae-b14c-e83a10eb1be5",
"name": "获取文件夹中的项目",
"type": "n8n-nodes-base.microsoftOneDrive",
"position": [
832,
0
],
"parameters": {
"folderId": "={{ $json.id }}",
"resource": "folder"
},
"credentials": {
"microsoftOneDriveOAuth2Api": {
"id": "<Your One Drive API Key>",
"name": "Microsoft Drive account"
}
},
"typeVersion": 1,
"alwaysOutputData": true
},
{
"id": "bdfdb814-df76-42ff-8b07-926c7e7d48c2",
"name": "下载文件",
"type": "n8n-nodes-base.microsoftOneDrive",
"position": [
1216,
80
],
"parameters": {
"fileId": "={{ $('Get items in a folder').item.json.id }}",
"operation": "download"
},
"credentials": {
"microsoftOneDriveOAuth2Api": {
"id": "<Your One Drive API Key>",
"name": "Microsoft Drive account"
}
},
"typeVersion": 1,
"alwaysOutputData": true
},
{
"id": "bcd0718c-df22-41e1-9754-a2298877ae43",
"name": "提取文本",
"type": "n8n-nodes-base.mistralAi",
"position": [
1376,
80
],
"parameters": {
"options": {}
},
"credentials": {
"mistralCloudApi": {
"id": "<Your OCR API Key>",
"name": "Mistral Cloud account"
}
},
"typeVersion": 1
},
{
"id": "6eaee806-a5e6-4c5d-b89a-500bd70cc03d",
"name": "文件分类",
"type": "n8n-nodes-base.code",
"position": [
1584,
80
],
"parameters": {
"jsCode": "// get filename from Download node\nconst fileName = ($('Download a file').first().json.name || '').toLowerCase();\n\n// get extracted text from OCR node\nconst text = ($input.first().json.extractedText || '').toLowerCase();\n\nlet type = \"Unknown\";\n\n// --- Rule-based classification ---\n\n// Priority 1: File name clues\nif (fileName.includes(\"passport\")) type = \"Passport\";\nelse if (fileName.includes(\"license\") || fileName.includes(\"dl\")) type = \"Driving License\";\nelse if (fileName.includes(\"mortgage\")) type = \"Mortgage Application\";\nelse if (fileName.includes(\"proof\") && fileName.includes(\"fund\")) type = \"Proof of Funds Letter\";\nelse if (fileName.includes(\"pay\") || fileName.includes(\"paystub\")) type = \"Employee Pay Statement\";\nelse if (fileName.includes(\"t4\")) type = \"T4 Statement\";\nelse if (fileName.includes(\"electric\") || fileName.includes(\"hydro\")) type = \"Electricity Bill\";\nelse if (fileName.includes(\"internet\") || fileName.includes(\"shaw\")) type = \"Internet Bill\";\nelse if (fileName.includes(\"statement\") && fileName.includes(\"account\")) type = \"Account Statement\";\nelse if (fileName.includes(\"bank\")) type = \"Bank Statement\";\n\n// Priority 2: Text-based fallback\nelse if (text.includes(\"gross pay\") || text.includes(\"net pay\")) type = \"Employee Pay Statement\";\nelse if (text.includes(\"bank of montreal\") || text.includes(\"scotiabank\") || text.includes(\"royal bank\")) type = \"Bank Statement\";\nelse if (text.includes(\"proof of funds\")) type = \"Proof of Funds Letter\";\nelse if (text.includes(\"mortgage application\")) type = \"Mortgage Application\";\nelse if (text.includes(\"driver\") && text.includes(\"licence\")) type = \"Driving License\";\nelse if (text.includes(\"internet\") && text.includes(\"usage\")) type = \"Internet Bill\";\nelse if (text.includes(\"hydro\") || text.includes(\"electricity\")) type = \"Electricity Bill\";\nelse if (text.includes(\"t4\") && text.includes(\"income\")) type = \"T4 Statement\";\n\nreturn [{\n json: {\n FileName: $('Download a file').first().json.name,\n DocumentType: type,\n ExtractedText: $input.first().json.extractedText\n }\n}];\n"
},
"typeVersion": 2,
"alwaysOutputData": true
},
{
"id": "15d653cd-af01-43a1-ac1d-1497774745dd",
"name": "合并数据",
"type": "n8n-nodes-base.code",
"position": [
1248,
-256
],
"parameters": {
"jsCode": "// Gather all items coming from the \"Done\" output of the Loop Over Items node\nconst docs = $input.all().map(item => ({\n FileName: item.json.FileName || null,\n DocumentType: item.json.DocumentType || \"Unknown\",\n ExtractedText: item.json.ExtractedText || \"\"\n}));\n\nreturn [{\n json: {\n BorrowerName: \"Kenneth Smith\", // replace with dynamic value if available\n Documents: docs\n }\n}];\n"
},
"typeVersion": 2
},
{
"id": "fa0b2bc5-2038-4b94-8650-5908298c64dc",
"name": "AI Agent",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
1392,
-256
],
"parameters": {
"text": "=You will receive an array of documents belonging to a single mortgage applicant.\n\nEach document object includes:\n- FileName \n- DocumentType \n- ExtractedText (the OCR text from the original file)\n\nAnalyze the full dataset, identify document types, extract key financial information, and produce an underwriting summary and decision as described in the system prompt.\n\nBorrower Documents:\n{{ JSON.stringify($json.Documents, null, 2) }}\n",
"options": {
"systemMessage": "=You are a senior mortgage underwriter at a Canadian financial institution.\n\nYou will analyze a borrower’s full document set to determine mortgage eligibility, loan feasibility, and documentation completeness.\n\nYour analysis must include:\n\n### 1. Identity Verification\nConfirm borrower identity, address, and citizenship using ID documents (Passport, Driver’s License, Utility Bills).\n\n### 2. Employment & Income Verification\nValidate employment details, employer name, job title, tenure, and consistency of pay across pay statements, T4s, and tax filings.\n\n### 3. Asset & Liability Review\nSummarize checking, savings, and investment balances. \nIdentify recurring debts or monthly obligations (utilities, rent, phone, insurance, etc.). \nCalculate Debt-to-Income (DTI) ratio.\n\n### 4. Property & Loan Analysis\nIf a mortgage application or loan-related document is present, extract:\n- Lender name and officer\n- Loan amount and term\n- Interest rate type (fixed / variable)\n- Loan purpose (purchase / refinance)\n- Down payment and percentage\n- Property value and address\n- Property type and use (primary, investment, secondary)\n- Amortization structure\n- Derived Loan-to-Value (LTV = loan amount ÷ property value)\nThen evaluate:\n- Whether the borrower’s verified assets can support the required down payment.\n- Whether DTI and LTV fall within standard underwriting thresholds.\n- Any property or loan risks (e.g., old property, low down payment, non-owner-occupied use).\n\n### 5. Document Consistency\nIdentify missing, inconsistent, or outdated documents (expired IDs, missing pay stubs, missing credit report).\n\n### 6. Decision\nProvide a professional underwriter-style decision with justification:\n- **Decision:** Approve / Approve with conditions / Decline / Escalate\n- **Rationale:** Clear bullet points explaining the reasoning.\n- **Next Steps:** Requested documents or verifications before final approval.\n\n### Output Format\nReturn your analysis as Markdown:\n\n#### Step 1: Identity Verification\n#### Step 2: Employment & Income\n#### Step 3: Assets & Liabilities\n#### Step 4: Property & Loan Analysis\n#### Step 5: Document Consistency\n#### Step 6: Final Decision\n#### Decision Summary (bullet points)\n"
},
"promptType": "define"
},
"typeVersion": 2.2
},
{
"id": "1be14652-9fa5-473b-afc8-901a0ec4ed07",
"name": "OpenAI 聊天模型",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
1392,
-112
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "<Your LLM Model Name>"
},
"options": {}
},
"credentials": {
"openAiApi": {
"id": "<Your LLM Model API Key>",
"name": "OpenAi account 2"
}
},
"typeVersion": 1.2
},
{
"id": "e5fe5cff-e538-4032-8df5-1246099618d1",
"name": "当点击\"执行工作流\"时",
"type": "n8n-nodes-base.manualTrigger",
"position": [
432,
0
],
"parameters": {},
"typeVersion": 1
},
{
"id": "30b481ed-670c-4303-a0da-7362e94fa2d4",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
-480,
176
],
"parameters": {
"color": 4,
"width": 816,
"content": "**解决方案:"
},
"typeVersion": 1
},
{
"id": "9ea5459a-21f6-4e75-830b-b4b38400f089",
"name": "便签 1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-480,
-224
],
"parameters": {
"color": 4,
"width": 816,
"content": "**问题陈述**"
},
"typeVersion": 1
},
{
"id": "4d426895-0b7f-4ea1-a38f-5188801f586a",
"name": "便签 2",
"type": "n8n-nodes-base.stickyNote",
"position": [
-480,
-32
],
"parameters": {
"color": 4,
"width": 816,
"height": 176,
"content": "***约束条件***"
},
"typeVersion": 1
},
{
"id": "844083c1-ce99-4ab3-98b7-7a6523d88109",
"name": "遍历项目",
"type": "n8n-nodes-base.splitInBatches",
"disabled": true,
"position": [
1040,
0
],
"parameters": {
"options": {}
},
"typeVersion": 3
},
{
"id": "40f0d23a-aae0-4450-959e-3b98032659c2",
"name": "便签 3",
"type": "n8n-nodes-base.stickyNote",
"position": [
368,
-144
],
"parameters": {
"width": 208,
"height": 112,
"content": "用于本地测试和手动运行的入口触发器;它只是启动流程并将任务传递给 OneDrive 文件夹搜索。"
},
"typeVersion": 1
},
{
"id": "781728d1-9f06-4e95-adfc-ae2095771027",
"name": "便签 4",
"type": "n8n-nodes-base.stickyNote",
"position": [
624,
-144
],
"parameters": {
"width": 320,
"height": 112,
"content": "在 OneDrive 中找到目标借款人文档容器,并输出下游节点使用的文件夹 ID。获取找到的文件夹 ID 并列出其中的文件,以便循环处理每个项目。"
},
"typeVersion": 1
},
{
"id": "8425b303-96cc-4ff9-ba20-a386a300519d",
"name": "便签 5",
"type": "n8n-nodes-base.stickyNote",
"position": [
992,
288
],
"parameters": {
"width": 768,
"height": 256,
"content": "**循环处理**:驱动逐文件处理:对于每个列出的文件,它路由到下载/OCR/分类,当最后一个项目完成后,将收集的结果转发给合并器。"
},
"typeVersion": 1
},
{
"id": "f55f83eb-f7b7-4982-99c1-ec21f573793c",
"name": "便签6",
"type": "n8n-nodes-base.stickyNote",
"position": [
1200,
-432
],
"parameters": {
"width": 560,
"content": "**合并数据 (代码)**:将所有逐文件记录聚合成一个包含 BorrowerName 和 Documents[] 数组的单一借款人数据负载,准备用于承保分析。"
},
"typeVersion": 1
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "b3d81169-9b6f-4530-b765-1ab386b90e4a",
"connections": {
"Extract text": {
"main": [
[
{
"node": "Classify the File",
"type": "main",
"index": 0
}
]
]
},
"Download a file": {
"main": [
[
{
"node": "Extract text",
"type": "main",
"index": 0
}
]
]
},
"Loop Over Items": {
"main": [
[
{
"node": "Combine the Data",
"type": "main",
"index": 0
}
],
[
{
"node": "Download a file",
"type": "main",
"index": 0
}
]
]
},
"Search a folder": {
"main": [
[
{
"node": "Get items in a folder",
"type": "main",
"index": 0
}
]
]
},
"Combine the Data": {
"main": [
[
{
"node": "AI Agent",
"type": "main",
"index": 0
}
]
]
},
"Classify the File": {
"main": [
[
{
"node": "Loop Over Items",
"type": "main",
"index": 0
}
]
]
},
"OpenAI Chat Model": {
"ai_languageModel": [
[
{
"node": "AI Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Get items in a folder": {
"main": [
[
{
"node": "Loop Over Items",
"type": "main",
"index": 0
}
]
]
},
"When clicking ‘Execute workflow’": {
"main": [
[
{
"node": "Search a folder",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
高级 - 文档提取, AI 摘要总结
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
现金核对
通过 Mistral AI 和 OpenAI GPT-4 实现发票与银行对账单核对的自动化
Code
Mistral Ai
Manual Trigger
+5
15 节点Vinay Gangidi
内容创作
自动化学术论文元数据及变量提取,从Gemini到Google Sheets
自动化学术论文元数据及变量提取,从Gemini到Google Sheets
Set
Code
Wait
+14
39 节点OwenLee
文档提取
使用 AI 和 Gmail 自动更新 YNAB 中的亚马逊交易备注
使用 AI 和 Gmail 自动更新 YNAB 中的亚马逊交易备注
If
Set
Wait
+13
30 节点Angel Menendez
文档提取
初学者数据分析:使用 GPT-4o 在 Google Sheets 中合并、筛选和汇总
初学者数据分析:使用 GPT-4o 在 Google Sheets 中合并、筛选和汇总
If
Set
Code
+9
21 节点Robert Breen
文档提取
Facebook页面评论管理机器人:回复、删除、封禁和通知
AI驱动的Facebook评论管理:自动回复、删除、封禁和通知
If
Set
Code
+18
59 节点SpaGreen Creative
社交媒体
使用Slack和Asana的虚拟Scrum Master
基于AI的Scrum Master助手,集成OpenAI、Slack和Asana
Set
Code
Html
+10
35 节点Łukasz
项目管理