AutomationFlowsAI & RAG › Process Legal Documents with Ollama AI & Generate HTML Reports (100% Local)

Process Legal Documents with Ollama AI & Generate HTML Reports (100% Local)

ByRish @b2brish on n8n.io

TUTORIAL VIDEO

Event trigger★★★★☆ complexityAI-powered7 nodesLocal File TriggerRead Write FileAgentOpenAI Chat
AI & RAG Trigger: Event Nodes: 7 Complexity: ★★★★☆ AI nodes: yes Added:

This workflow corresponds to n8n.io template #4869 — we link there as the canonical source.

This workflow follows the Agent → OpenAI Chat recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "id": "rqu4dt6kaPwKplr3",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Local PDF",
  "tags": [],
  "nodes": [
    {
      "id": "cffc6896-7d35-4183-af3b-4e139199f2e2",
      "name": "Extract from File",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        -600,
        -80
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "a0b0bbe8-796d-4ea5-9eaf-d958f72cc79f",
      "name": "Local File Trigger",
      "type": "n8n-nodes-base.localFileTrigger",
      "position": [
        -1040,
        -80
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "f79e5605-677d-4205-8d6d-1b7b4c3bda04",
      "name": "Read/Write Files from Disk",
      "type": "n8n-nodes-base.readWriteFile",
      "position": [
        -820,
        -80
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "5c5b052c-5e09-423c-b5c4-27408986f36b",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -380,
        -80
      ],
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "8e5108d3-8041-4032-ba14-65c385def2cd",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -360,
        200
      ],
      "parameters": {},
      "typeVersion": 1.2
    },
    {
      "id": "f10e2d2f-c21b-46ed-a36c-2fcc883846ff",
      "name": "Convert to File",
      "type": "n8n-nodes-base.convertToFile",
      "position": [
        -4,
        -80
      ],
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "73f9871a-a759-4de0-8561-68418e2c1e91",
      "name": "Read/Write Files from Disk1",
      "type": "n8n-nodes-base.readWriteFile",
      "position": [
        216,
        -80
      ],
      "parameters": {},
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "84fddb7f-1243-4894-903c-024e89c3b9cb",
  "connections": {
    "AI Agent": {
      "main": [
        [
          {
            "node": "Convert to File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Convert to File": {
      "main": [
        [
          {
            "node": "Read/Write Files from Disk1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract from File": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Local File Trigger": {
      "main": [
        [
          {
            "node": "Read/Write Files from Disk",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read/Write Files from Disk": {
      "main": [
        [
          {
            "node": "Extract from File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read/Write Files from Disk1": {
      "main": [
        []
      ]
    }
  }
}
Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

TUTORIAL VIDEO

Source: https://n8n.io/workflows/4869/ — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

AI & RAG

Reconcile Rent Payments With Local Excel Spreadsheet And Openai. Uses localFileTrigger, toolCode, outputParserStructured, readWriteFile. Event-driven trigger; 17 nodes.

Local File Trigger, Tool Code, Output Parser Structured +3
AI & RAG

Localfile Splitout. Uses localFileTrigger, toolCode, outputParserStructured, readWriteFile. Event-driven trigger; 17 nodes.

Local File Trigger, Tool Code, Output Parser Structured +3
AI & RAG

This n8n workflow is designed to work on the local network and assists with reconciling downloaded bank statements with internal tenant records to quickly highlight any issues with payments such as mi

Local File Trigger, Tool Code, Output Parser Structured +3
AI & RAG

This workflow contains a community node.

Local File Trigger, OpenAI Chat, Agent +1
AI & RAG

This Workflow uses a community node.

Local File Trigger, OpenAI Chat, Read Write File +2